instance_id
stringlengths
10
57
base_commit
stringlengths
40
40
created_at
stringdate
2014-04-30 14:58:36
2025-04-30 20:14:11
environment_setup_commit
stringlengths
40
40
hints_text
stringlengths
0
273k
patch
stringlengths
251
7.06M
problem_statement
stringlengths
11
52.5k
repo
stringlengths
7
53
test_patch
stringlengths
231
997k
meta
dict
version
stringclasses
851 values
install_config
dict
requirements
stringlengths
93
34.2k
environment
stringlengths
760
20.5k
FAIL_TO_PASS
listlengths
1
9.39k
FAIL_TO_FAIL
listlengths
0
2.69k
PASS_TO_PASS
listlengths
0
7.87k
PASS_TO_FAIL
listlengths
0
192
license_name
stringclasses
55 values
__index_level_0__
int64
0
21.4k
before_filepaths
listlengths
1
105
after_filepaths
listlengths
1
105
pimutils__khal-551
52b9da07a2a94ccf9c0d05aaacb633e14378aee5
2017-01-13 00:16:36
52b9da07a2a94ccf9c0d05aaacb633e14378aee5
geier: looks good, thanks! Could you please add a warning to the user? hobarrera: LGTM
diff --git a/AUTHORS.txt b/AUTHORS.txt index 4c1283d..5123a7c 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -28,3 +28,4 @@ Troy Sankey - sankeytms [at] gmail [dot] com Mart Lubbers - mart [at] martlubbers [dot] net Paweł Fertyk - pfertyk [at] openmailbox [dot] org Moritz Kobel - moritz [at] kobelnet [dot] ch - http://www.kobelnet.ch +Guilhem Saurel - guilhem [at] saurel [dot] me - https://saurel.me diff --git a/CHANGELOG.rst b/CHANGELOG.rst index fce5319..4dd4fcc 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -31,6 +31,8 @@ not released yet * `import` can now import multiple files at once (Christian Geier) * configuration file path $XDG_CONFIG_HOME/khal/config is now supported and $XDG_CONFIG_HOME/khal/khal.conf deprecated +* events that start and end at the same time are now displayed as if their + duration was one hour instead of one day (Guilhem Saurel) ikhal ----- diff --git a/khal/khalendar/utils.py b/khal/khalendar/utils.py index b03d7da..27e16bc 100644 --- a/khal/khalendar/utils.py +++ b/khal/khalendar/utils.py @@ -189,7 +189,7 @@ def sanitize(vevent, default_timezone, href='', calendar=''): def sanitize_timerange(dtstart, dtend, duration=None): '''return sensible dtstart and end for events that have an invalid or - missing DTEND, assuming the event just lasts one day.''' + missing DTEND, assuming the event just lasts one hour.''' if isinstance(dtstart, datetime) and isinstance(dtend, datetime): if dtstart.tzinfo and not dtend.tzinfo: @@ -214,7 +214,11 @@ def sanitize_timerange(dtstart, dtend, duration=None): raise ValueError('The event\'s end time (DTEND) is older than ' 'the event\'s start time (DTSTART).') elif dtend == dtstart: - dtend += timedelta(days=1) + logger.warning( + "Event start time and end time are the same. " + "Assuming the event's duration is one hour." + ) + dtend += timedelta(hours=1) return dtstart, dtend
iCal, DTSTART == DTEND Currently, when DTSTART == DTEND khal shows things like: ``` Today: 20:00→ : "blah foo bar" Tomorrow: → 20:00: "blah foo bar" ``` Google Agenda assume that event last 1 hour. Neither behavior is perfect and both are better than omitting the event. But khal output seems more confusing and by assuming that event last 24h give the visual impression that 2 distinct event happens (especially if other events happens in the timespan). Assuming up the end-of-the-day, or, like Google 1 hour, could be better trade-off.
pimutils/khal
diff --git a/tests/khalendar_aux_test.py b/tests/khalendar_aux_test.py index dbe60e9..6fe9316 100644 --- a/tests/khalendar_aux_test.py +++ b/tests/khalendar_aux_test.py @@ -736,6 +736,17 @@ END:VEVENT END:VCALENDAR """ +instant = """ +BEGIN:VCALENDAR +BEGIN:VEVENT +UID:instant123 +DTSTART;TZID=Europe/Berlin;VALUE=DATE-TIME:20170113T010000 +DTEND;TZID=Europe/Berlin;VALUE=DATE-TIME:20170113T010000 +SUMMARY:Really fast event +END:VEVENT +END:VCALENDAR +""" + class TestSanitize(object): @@ -754,3 +765,9 @@ class TestSanitize(object): def test_duration(self): vevent = _get_vevent_file('event_dtr_exdatez') vevent = utils.sanitize(vevent, berlin, '', '') + + def test_instant(self): + vevent = _get_vevent(instant) + assert vevent['DTEND'].dt - vevent['DTSTART'].dt == timedelta() + vevent = utils.sanitize(vevent, berlin, '', '') + assert vevent['DTEND'].dt - vevent['DTSTART'].dt == timedelta(hours=1)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 3 }
0.7
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "pytest-cov", "codecov" ], "pre_install": null, "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
atomicwrites==1.4.1 certifi==2025.1.31 charset-normalizer==3.4.1 click==8.1.8 codecov==2.1.13 configobj==5.0.9 coverage==7.8.0 exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work icalendar==6.1.3 idna==3.10 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work -e git+https://github.com/pimutils/khal.git@52b9da07a2a94ccf9c0d05aaacb633e14378aee5#egg=khal packaging @ file:///croot/packaging_1734472117206/work pluggy @ file:///croot/pluggy_1733169602837/work pytest @ file:///croot/pytest_1738938843180/work pytest-cov==6.0.0 python-dateutil==2.9.0.post0 pytz==2025.2 pyxdg==0.28 requests==2.32.3 six==1.17.0 tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work typing_extensions==4.13.0 tzdata==2025.2 tzlocal==5.3.1 urllib3==2.3.0 urwid==2.6.16 wcwidth==0.2.13
name: khal channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - atomicwrites==1.4.1 - certifi==2025.1.31 - charset-normalizer==3.4.1 - click==8.1.8 - codecov==2.1.13 - configobj==5.0.9 - coverage==7.8.0 - icalendar==6.1.3 - idna==3.10 - pytest-cov==6.0.0 - python-dateutil==2.9.0.post0 - pytz==2025.2 - pyxdg==0.28 - requests==2.32.3 - six==1.17.0 - typing-extensions==4.13.0 - tzdata==2025.2 - tzlocal==5.3.1 - urllib3==2.3.0 - urwid==2.6.16 - wcwidth==0.2.13 prefix: /opt/conda/envs/khal
[ "tests/khalendar_aux_test.py::TestSanitize::test_instant" ]
[ "tests/khalendar_aux_test.py::TestExpand::test_expand_dt", "tests/khalendar_aux_test.py::TestExpand::test_expand_dtb", "tests/khalendar_aux_test.py::TestExpand::test_expand_dttz", "tests/khalendar_aux_test.py::TestExpand::test_expand_invalid_exdate", "tests/khalendar_aux_test.py::TestExpandNoRR::test_expand_dtr_exdatez", "tests/khalendar_aux_test.py::TestExpandNoRR::test_expand_rrule_notz_until_z", "tests/khalendar_aux_test.py::TestSpecial::test_until_notz", "tests/khalendar_aux_test.py::TestSpecial::test_another_problem", "tests/khalendar_aux_test.py::TestSpecial::test_event_exdate_dt", "tests/khalendar_aux_test.py::TestSpecial::test_event_exdates_dt", "tests/khalendar_aux_test.py::TestSpecial::test_event_exdatesl_dt", "tests/khalendar_aux_test.py::TestSpecial::test_event_dt_rrule_invalid_until2", "tests/khalendar_aux_test.py::TestRDate::test_simple_rdate", "tests/khalendar_aux_test.py::TestRDate::test_rrule_and_rdate" ]
[ "tests/khalendar_aux_test.py::TestExpand::test_expand_dtf", "tests/khalendar_aux_test.py::TestExpand::test_expand_d", "tests/khalendar_aux_test.py::TestExpand::test_expand_dtz", "tests/khalendar_aux_test.py::TestExpand::test_expand_dtzb", "tests/khalendar_aux_test.py::TestExpandNoRR::test_expand_dt", "tests/khalendar_aux_test.py::TestExpandNoRR::test_expand_dtb", "tests/khalendar_aux_test.py::TestExpandNoRR::test_expand_dttz", "tests/khalendar_aux_test.py::TestExpandNoRR::test_expand_dtf", "tests/khalendar_aux_test.py::TestExpandNoRR::test_expand_d", "tests/khalendar_aux_test.py::TestExpandNoRR::test_expand_rrule_exdate_z", "tests/khalendar_aux_test.py::TestSpecial::test_count", "tests/khalendar_aux_test.py::TestSpecial::test_until_d_notz", "tests/khalendar_aux_test.py::TestSpecial::test_latest_bug", "tests/khalendar_aux_test.py::TestSpecial::test_event_dt_rrule_invalid_until", "tests/khalendar_aux_test.py::TestRDate::test_rrule_past", "tests/khalendar_aux_test.py::TestRDate::test_rdate_date", "tests/khalendar_aux_test.py::TestSanitize::test_noend_date", "tests/khalendar_aux_test.py::TestSanitize::test_noend_datetime", "tests/khalendar_aux_test.py::TestSanitize::test_duration" ]
[]
MIT License
958
[ "khal/khalendar/utils.py", "AUTHORS.txt", "CHANGELOG.rst" ]
[ "khal/khalendar/utils.py", "AUTHORS.txt", "CHANGELOG.rst" ]
openmrslab__suspect-40
b03275c0dd645fd522cab182a2cfbe28dfc948ed
2017-01-13 12:14:36
964f2460e46378c29e78d280f999128f34e829df
coveralls: [![Coverage Status](https://coveralls.io/builds/9657280/badge)](https://coveralls.io/builds/9657280) Coverage increased (+1.6%) to 74.955% when pulling **3e435af1f6fc1029fab1a96315317b0dd8699ab8 on #39_denoising** into **b03275c0dd645fd522cab182a2cfbe28dfc948ed on master**.
diff --git a/suspect/processing/denoising.py b/suspect/processing/denoising.py index f55b7ae..46dfc04 100644 --- a/suspect/processing/denoising.py +++ b/suspect/processing/denoising.py @@ -85,8 +85,8 @@ def svd(input_signal, rank): def spline(input_signal, num_splines, spline_order): # input signal has to be a multiple of num_splines - padded_input_signal = _pad(input_signal, (numpy.ceil(len(input_signal) / float(num_splines))) * num_splines) - stride = len(padded_input_signal) / num_splines + padded_input_signal = _pad(input_signal, int(numpy.ceil(len(input_signal) / float(num_splines))) * num_splines) + stride = len(padded_input_signal) // num_splines import scipy.signal # we construct the spline basis by building the first one, then the rest # are identical copies offset by stride @@ -95,11 +95,11 @@ def spline(input_signal, num_splines, spline_order): spline_basis = numpy.zeros((num_splines + 1, len(padded_input_signal)), input_signal.dtype) for i in range(num_splines + 1): spline_basis[i, :] = numpy.roll(first_spline, i * stride) - spline_basis[:(num_splines / 4), (len(padded_input_signal) / 2):] = 0.0 - spline_basis[(num_splines * 3 / 4):, :(len(padded_input_signal) / 2)] = 0.0 + spline_basis[:(num_splines // 4), (len(padded_input_signal) // 2):] = 0.0 + spline_basis[(num_splines * 3 // 4):, :(len(padded_input_signal) // 2)] = 0.0 coefficients = numpy.linalg.lstsq(spline_basis.T, padded_input_signal) recon = numpy.dot(coefficients[0], spline_basis) - start_offset = (len(padded_input_signal) - len(input_signal)) / 2.0 + start_offset = (len(padded_input_signal) - len(input_signal)) // 2 return recon[start_offset:(start_offset + len(input_signal))] @@ -108,9 +108,9 @@ def wavelet(input_signal, wavelet_shape, threshold): # we have to pad the signal to make it a power of two next_power_of_two = int(numpy.floor(numpy.log2(len(input_signal))) + 1) padded_input_signal = _pad(input_signal, 2**next_power_of_two) - wt_coeffs = pywt.wavedec(padded_input_signal, wavelet_shape, level=None, mode='per') + wt_coeffs = pywt.wavedec(padded_input_signal, wavelet_shape, level=None, mode='periodization') denoised_coeffs = wt_coeffs[:] denoised_coeffs[1:] = (pywt.threshold(i, value=threshold) for i in denoised_coeffs[1:]) - recon = pywt.waverec(denoised_coeffs, wavelet_shape, mode='per') - start_offset = (len(padded_input_signal) - len(input_signal)) / 2.0 + recon = pywt.waverec(denoised_coeffs, wavelet_shape, mode='periodization') + start_offset = (len(padded_input_signal) - len(input_signal)) // 2 return recon[start_offset:(start_offset + len(input_signal))]
Spline denoising fails on numpy 1.12 In numpy 1.12 spline denoising fails because it passes floating point values to _pad and roll instead of integer values.
openmrslab/suspect
diff --git a/tests/test_mrs/test_processing/test_denoising.py b/tests/test_mrs/test_processing/test_denoising.py new file mode 100644 index 0000000..2e45982 --- /dev/null +++ b/tests/test_mrs/test_processing/test_denoising.py @@ -0,0 +1,29 @@ +import suspect + +import numpy + +import warnings +warnings.filterwarnings("ignore", message="numpy.dtype size changed") + +def test_spline(): + # we need to check if this runs correctly when number of splines is not a + # factor of length of signal, so that padding is required. + # generate a sample signal + input_signal = numpy.random.randn(295) + 10 + # denoise the signal with splines + output_signal = suspect.processing.denoising.spline(input_signal, 32, 2) + # main thing is that the test runs without errors, but we can also check + # for reduced std in the result + assert numpy.std(output_signal) < numpy.std(input_signal) + + +def test_wavelet(): + # this is to check if the code runs without throwing double -> integer + # conversion issues + # generate a sample signal + input_signal = numpy.random.randn(295) + 10 + # denoise the signal with splines + output_signal = suspect.processing.denoising.wavelet(input_signal, "db8", 1e-2) + # main thing is that the test runs without errors, but we can also check + # for reduced std in the result + assert numpy.std(output_signal) < numpy.std(input_signal) \ No newline at end of file
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 1 }
0.2
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "mock" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 asteval==0.9.26 async-generator==1.10 attrs==22.2.0 Babel==2.11.0 backcall==0.2.0 bleach==4.1.0 certifi==2021.5.30 charset-normalizer==2.0.12 decorator==5.1.1 defusedxml==0.7.1 docutils==0.18.1 entrypoints==0.4 future==1.0.0 idna==3.10 imagesize==1.4.1 importlib-metadata==4.8.3 iniconfig==1.1.1 ipykernel==5.5.6 ipython==7.16.3 ipython-genutils==0.2.0 jedi==0.17.2 Jinja2==3.0.3 jsonschema==3.2.0 jupyter-client==7.1.2 jupyter-core==4.9.2 jupyterlab-pygments==0.1.2 lmfit==1.0.3 MarkupSafe==2.0.1 mistune==0.8.4 mock==5.2.0 nbclient==0.5.9 nbconvert==6.0.7 nbformat==5.1.3 nbsphinx==0.8.8 nest-asyncio==1.6.0 numpy==1.19.5 packaging==21.3 pandocfilters==1.5.1 Parsley==1.3 parso==0.7.1 pexpect==4.9.0 pickleshare==0.7.5 pluggy==1.0.0 prompt-toolkit==3.0.36 ptyprocess==0.7.0 py==1.11.0 pydicom==2.3.1 Pygments==2.14.0 pyparsing==3.1.4 pyrsistent==0.18.0 pytest==7.0.1 python-dateutil==2.9.0.post0 pytz==2025.2 PyWavelets==1.1.1 pyzmq==25.1.2 requests==2.27.1 scipy==1.5.4 six==1.17.0 snowballstemmer==2.2.0 Sphinx==5.3.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -e git+https://github.com/openmrslab/suspect.git@b03275c0dd645fd522cab182a2cfbe28dfc948ed#egg=suspect testpath==0.6.0 tomli==1.2.3 tornado==6.1 traitlets==4.3.3 typing_extensions==4.1.1 uncertainties==3.1.7 urllib3==1.26.20 wcwidth==0.2.13 webencodings==0.5.1 zipp==3.6.0
name: suspect channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - asteval==0.9.26 - async-generator==1.10 - attrs==22.2.0 - babel==2.11.0 - backcall==0.2.0 - bleach==4.1.0 - charset-normalizer==2.0.12 - decorator==5.1.1 - defusedxml==0.7.1 - docutils==0.18.1 - entrypoints==0.4 - future==1.0.0 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - ipykernel==5.5.6 - ipython==7.16.3 - ipython-genutils==0.2.0 - jedi==0.17.2 - jinja2==3.0.3 - jsonschema==3.2.0 - jupyter-client==7.1.2 - jupyter-core==4.9.2 - jupyterlab-pygments==0.1.2 - lmfit==1.0.3 - markupsafe==2.0.1 - mistune==0.8.4 - mock==5.2.0 - nbclient==0.5.9 - nbconvert==6.0.7 - nbformat==5.1.3 - nbsphinx==0.8.8 - nest-asyncio==1.6.0 - numpy==1.19.5 - packaging==21.3 - pandocfilters==1.5.1 - parsley==1.3 - parso==0.7.1 - pexpect==4.9.0 - pickleshare==0.7.5 - pluggy==1.0.0 - prompt-toolkit==3.0.36 - ptyprocess==0.7.0 - py==1.11.0 - pydicom==2.3.1 - pygments==2.14.0 - pyparsing==3.1.4 - pyrsistent==0.18.0 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pytz==2025.2 - pywavelets==1.1.1 - pyzmq==25.1.2 - requests==2.27.1 - scipy==1.5.4 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==5.3.0 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - testpath==0.6.0 - tomli==1.2.3 - tornado==6.1 - traitlets==4.3.3 - typing-extensions==4.1.1 - uncertainties==3.1.7 - urllib3==1.26.20 - wcwidth==0.2.13 - webencodings==0.5.1 - zipp==3.6.0 prefix: /opt/conda/envs/suspect
[ "tests/test_mrs/test_processing/test_denoising.py::test_spline", "tests/test_mrs/test_processing/test_denoising.py::test_wavelet" ]
[]
[]
[]
MIT License
959
[ "suspect/processing/denoising.py" ]
[ "suspect/processing/denoising.py" ]
cdent__gabbi-200
3e450b1d375c2ee8f18a7c6798cfca211ba2fa98
2017-01-13 15:18:55
3e450b1d375c2ee8f18a7c6798cfca211ba2fa98
cdent: I'm struggling (because of other mental commitments and general stupidness) to come up with a reasonable way to add tests for this. If anyone has ideas please feel free to let me know.
diff --git a/gabbi/suite.py b/gabbi/suite.py index 765a929..f6d3868 100644 --- a/gabbi/suite.py +++ b/gabbi/suite.py @@ -16,6 +16,7 @@ This suite has two features: the contained tests are ordered and there are suite-level fixtures that operate as context managers. """ +import sys import unittest from wsgi_intercept import interceptor @@ -58,6 +59,26 @@ class GabbiSuite(unittest.TestSuite): except unittest.SkipTest as exc: for test in self._tests: result.addSkip(test, str(exc)) + # If we have an exception in the nested fixtures, that means + # there's been an exception somewhere in the cycle other + # than a specific test (as that would have been caught + # already), thus from a fixture. If that exception were to + # continue to raise here, then some test runners would + # swallow it and the traceback of the failure would be + # undiscoverable. To ensure the traceback is reported (via + # the testrunner) to a human, the first test in the suite is + # marked as having an error (it's fixture failed) and then + # the entire suite is skipped, and the result stream told + # we're done. If there are no tests (an empty suite) the + # exception is re-raised. + except Exception as exc: + if self._tests: + result.addError(self._tests[0], sys.exc_info()) + for test in self._tests: + result.addSkip(test, 'fixture failure') + result.stop() + else: + raise return result
exceptions that happen in start_fixture() are swallowed during the test discovery process The discovery will fail and end up producing a seemingly non-related error like `math domain error` and the real exception is nowhere to be found. This needs to be narrowed to a minimal test case and then figured out. What seems likely is that something about the test suites is being processed is not following unittest/testtools rules of failure.
cdent/gabbi
diff --git a/gabbi/tests/test_suite.py b/gabbi/tests/test_suite.py new file mode 100644 index 0000000..eb1bd22 --- /dev/null +++ b/gabbi/tests/test_suite.py @@ -0,0 +1,54 @@ +# +# 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. +"""Unit tests for the gabbi.suite. +""" + +import sys +import unittest + +from gabbi import fixture +from gabbi import suitemaker + +VALUE_ERROR = 'value error sentinel' + + +class FakeFixture(fixture.GabbiFixture): + + def start_fixture(self): + raise ValueError(VALUE_ERROR) + + +class SuiteTest(unittest.TestCase): + + def test_suite_catches_fixture_fail(self): + """When a fixture fails in start_fixture it should fail + the first test in the suite and skip the others. + """ + loader = unittest.defaultTestLoader + result = unittest.TestResult() + test_data = {'fixtures': ['FakeFixture'], + 'tests': [{'name': 'alpha', 'GET': '/'}, + {'name': 'beta', 'GET': '/'}]} + test_suite = suitemaker.test_suite_from_dict( + loader, 'foo', test_data, '.', 'localhost', + 80, sys.modules[__name__], None) + + test_suite.run(result) + + self.assertEqual(2, len(result.skipped)) + self.assertEqual(1, len(result.errors)) + + errored_test, trace = result.errors[0] + + self.assertIn('foo_alpha', str(errored_test)) + self.assertIn(VALUE_ERROR, trace)
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 1 }, "num_modified_files": 1 }
1.30
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 colorama==0.4.5 decorator==5.1.1 fixtures==4.0.1 -e git+https://github.com/cdent/gabbi.git@3e450b1d375c2ee8f18a7c6798cfca211ba2fa98#egg=gabbi importlib-metadata==4.8.3 iniconfig==1.1.1 jsonpath-rw==1.4.0 jsonpath-rw-ext==1.2.2 packaging==21.3 pbr==6.1.1 pluggy==1.0.0 ply==3.11 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 PyYAML==6.0.1 six==1.17.0 testtools==2.6.0 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 wsgi_intercept==1.13.1 zipp==3.6.0
name: gabbi channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - colorama==0.4.5 - decorator==5.1.1 - fixtures==4.0.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - jsonpath-rw==1.4.0 - jsonpath-rw-ext==1.2.2 - packaging==21.3 - pbr==6.1.1 - pluggy==1.0.0 - ply==3.11 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - pyyaml==6.0.1 - six==1.17.0 - testtools==2.6.0 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - wsgi-intercept==1.13.1 - zipp==3.6.0 prefix: /opt/conda/envs/gabbi
[ "gabbi/tests/test_suite.py::SuiteTest::test_suite_catches_fixture_fail" ]
[]
[]
[]
Apache License 2.0
960
[ "gabbi/suite.py" ]
[ "gabbi/suite.py" ]
ipython__ipython-10157
ee0571bd401ef1bd296c728b5436ff219097846f
2017-01-13 16:44:52
78ec96d7ca0147f0655d5260f2ab0c61d94e4279
Carreau: can you rebase/repush. Travis is unhappy because GitHub was showing unicorns, and refuse to get restared.
diff --git a/IPython/core/inputtransformer.py b/IPython/core/inputtransformer.py index 9036add8a..3fdc64160 100644 --- a/IPython/core/inputtransformer.py +++ b/IPython/core/inputtransformer.py @@ -120,25 +120,18 @@ class TokenInputTransformer(InputTransformer): """ def __init__(self, func): self.func = func - self.current_line = "" - self.line_used = False + self.buf = [] self.reset_tokenizer() - + def reset_tokenizer(self): - self.tokenizer = generate_tokens(self.get_line) - - def get_line(self): - if self.line_used: - raise TokenError - self.line_used = True - return self.current_line - + it = iter(self.buf) + self.tokenizer = generate_tokens(it.__next__) + def push(self, line): - self.current_line += line + "\n" - if self.current_line.isspace(): + self.buf.append(line + '\n') + if all(l.isspace() for l in self.buf): return self.reset() - - self.line_used = False + tokens = [] stop_at_NL = False try: @@ -158,13 +151,13 @@ def push(self, line): return self.output(tokens) def output(self, tokens): - self.current_line = "" + self.buf.clear() self.reset_tokenizer() return untokenize(self.func(tokens)).rstrip('\n') def reset(self): - l = self.current_line - self.current_line = "" + l = ''.join(self.buf) + self.buf.clear() self.reset_tokenizer() if l: return l.rstrip('\n')
End of multiline string that contains a backslash-terminated line is not recognized IPython 5.0/PTK1.0.5 does not recognize that ``` """ foo\ bar """ ``` is a full string and that it should execute the typed-in string after that point.
ipython/ipython
diff --git a/IPython/core/tests/test_inputtransformer.py b/IPython/core/tests/test_inputtransformer.py index 27e67d8dd..2aa0670d5 100644 --- a/IPython/core/tests/test_inputtransformer.py +++ b/IPython/core/tests/test_inputtransformer.py @@ -389,6 +389,11 @@ def test_assemble_python_lines(): (u"2,", None), (None, u"a = [1,\n2,"), ], + [(u"a = '''", None), # Test line continuation within a multi-line string + (u"abc\\", None), + (u"def", None), + (u"'''", u"a = '''\nabc\\\ndef\n'''"), + ], ] + syntax_ml['multiline_datastructure'] for example in tests: transform_checker(example, ipt.assemble_python_lines)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 3 }, "num_modified_files": 1 }
5.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[test]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-xdist", "pytest-mock", "pytest-asyncio" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 decorator==5.1.1 entrypoints==0.4 execnet==1.9.0 idna==3.10 importlib-metadata==4.8.3 iniconfig==1.1.1 ipykernel==5.5.6 -e git+https://github.com/ipython/ipython.git@ee0571bd401ef1bd296c728b5436ff219097846f#egg=ipython ipython-genutils==0.2.0 jsonschema==3.2.0 jupyter-client==7.1.2 jupyter-core==4.9.2 nbformat==5.1.3 nest-asyncio==1.6.0 nose==1.3.7 numpy==1.19.5 packaging==21.3 pexpect==4.9.0 pickleshare==0.7.5 pluggy==1.0.0 prompt-toolkit==1.0.18 ptyprocess==0.7.0 py==1.11.0 Pygments==2.14.0 pyparsing==3.1.4 pyrsistent==0.18.0 pytest==7.0.1 pytest-asyncio==0.16.0 pytest-cov==4.0.0 pytest-mock==3.6.1 pytest-xdist==3.0.2 python-dateutil==2.9.0.post0 pyzmq==25.1.2 requests==2.27.1 simplegeneric==0.8.1 six==1.17.0 testpath==0.6.0 tomli==1.2.3 tornado==6.1 traitlets==4.3.3 typing_extensions==4.1.1 urllib3==1.26.20 wcwidth==0.2.13 zipp==3.6.0
name: ipython channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - charset-normalizer==2.0.12 - coverage==6.2 - decorator==5.1.1 - entrypoints==0.4 - execnet==1.9.0 - idna==3.10 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - ipykernel==5.5.6 - ipython-genutils==0.2.0 - jsonschema==3.2.0 - jupyter-client==7.1.2 - jupyter-core==4.9.2 - nbformat==5.1.3 - nest-asyncio==1.6.0 - nose==1.3.7 - numpy==1.19.5 - packaging==21.3 - pexpect==4.9.0 - pickleshare==0.7.5 - pluggy==1.0.0 - prompt-toolkit==1.0.18 - ptyprocess==0.7.0 - py==1.11.0 - pygments==2.14.0 - pyparsing==3.1.4 - pyrsistent==0.18.0 - pytest==7.0.1 - pytest-asyncio==0.16.0 - pytest-cov==4.0.0 - pytest-mock==3.6.1 - pytest-xdist==3.0.2 - python-dateutil==2.9.0.post0 - pyzmq==25.1.2 - requests==2.27.1 - simplegeneric==0.8.1 - six==1.17.0 - testpath==0.6.0 - tomli==1.2.3 - tornado==6.1 - traitlets==4.3.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - wcwidth==0.2.13 - zipp==3.6.0 prefix: /opt/conda/envs/ipython
[ "IPython/core/tests/test_inputtransformer.py::test_assemble_python_lines" ]
[]
[ "IPython/core/tests/test_inputtransformer.py::test_assign_system", "IPython/core/tests/test_inputtransformer.py::test_assign_magic", "IPython/core/tests/test_inputtransformer.py::test_classic_prompt", "IPython/core/tests/test_inputtransformer.py::test_ipy_prompt", "IPython/core/tests/test_inputtransformer.py::test_assemble_logical_lines", "IPython/core/tests/test_inputtransformer.py::test_help_end", "IPython/core/tests/test_inputtransformer.py::test_escaped_noesc", "IPython/core/tests/test_inputtransformer.py::test_escaped_shell", "IPython/core/tests/test_inputtransformer.py::test_escaped_help", "IPython/core/tests/test_inputtransformer.py::test_escaped_magic", "IPython/core/tests/test_inputtransformer.py::test_escaped_quote", "IPython/core/tests/test_inputtransformer.py::test_escaped_quote2", "IPython/core/tests/test_inputtransformer.py::test_escaped_paren", "IPython/core/tests/test_inputtransformer.py::test_cellmagic", "IPython/core/tests/test_inputtransformer.py::test_has_comment", "IPython/core/tests/test_inputtransformer.py::test_token_input_transformer" ]
[]
BSD 3-Clause "New" or "Revised" License
961
[ "IPython/core/inputtransformer.py" ]
[ "IPython/core/inputtransformer.py" ]
conjure-up__conjure-up-579
26386751eb6c0e696609582128cd6b872f27f49c
2017-01-13 20:26:41
2c8b2b9a848e19ffc77cade081472db13b94004b
diff --git a/conjureup/controllers/deploy/gui.py b/conjureup/controllers/deploy/gui.py index 66958e6..54f872c 100644 --- a/conjureup/controllers/deploy/gui.py +++ b/conjureup/controllers/deploy/gui.py @@ -24,13 +24,22 @@ class DeployController: self.assignments = defaultdict(list) self.deployed_juju_machines = {} self.maas_machine_map = {} - self.sync_with_bundle() + self.init_machines_assignments() - def sync_with_bundle(self): - # If no machines are specified, add a machine for each app: + def init_machines_assignments(self): + """Initialize the controller's machines and assignments. + + If no machines are specified, or we are deploying to a LXD + controller, add a top-level machine for each app - assumes + that no placement directives exist in the bundle, and logs any + it finds. + + Otherwise, syncs assignments from the bundle's applications' + placement specs. + """ bundle = app.metadata_controller.bundle - if len(bundle.machines) == 0: + if len(bundle.machines) == 0 or app.current_cloud == "localhost": self.generate_juju_machines() else: self.sync_assignments() @@ -112,9 +121,16 @@ class DeployController: for bundle_application in sorted(bundle.services, key=attrgetter('service_name')): if bundle_application.placement_spec: - app.log.warning("Ignoring placement spec because no machines " - "were set in the bundle: {}".format( - bundle.application.placement_spec)) + if app.current_cloud == "localhost": + app.log.info("Ignoring placement spec because we are " + "deploying to LXD: {}".format( + bundle_application.placement_spec)) + else: + app.log.warning("Ignoring placement spec because no " + "machines were set in the " + "bundle: {}".format( + bundle_application.placement_spec)) + for n in range(bundle_application.num_units): bundle.add_machine(dict(series=bundle.series), str(midx))
deploying kubernetes-core onto LXD breaks due to nested LXDs Since adding the placement-sync code, deploying kubernetes-core attempts to put easyrsa onto a LXD container inside the LXD container 0. There's no reason to do this, LXD deploys can be flat.
conjure-up/conjure-up
diff --git a/test/test_controllers_deploy_gui.py b/test/test_controllers_deploy_gui.py index 1b72ad3..eac49e8 100644 --- a/test/test_controllers_deploy_gui.py +++ b/test/test_controllers_deploy_gui.py @@ -14,7 +14,7 @@ from conjureup.controllers.deploy.gui import DeployController class DeployGUIRenderTestCase(unittest.TestCase): def setUp(self): - with patch.object(DeployController, 'sync_with_bundle'): + with patch.object(DeployController, 'init_machines_assignments'): self.controller = DeployController() self.utils_patcher = patch( @@ -74,7 +74,7 @@ class DeployGUIRenderTestCase(unittest.TestCase): class DeployGUIFinishTestCase(unittest.TestCase): def setUp(self): - with patch.object(DeployController, 'sync_with_bundle'): + with patch.object(DeployController, 'init_machines_assignments'): self.controller = DeployController() self.controllers_patcher = patch(
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 1 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "nose", "tox", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 bson==0.5.10 certifi==2021.5.30 charset-normalizer==2.0.12 -e git+https://github.com/conjure-up/conjure-up.git@26386751eb6c0e696609582128cd6b872f27f49c#egg=conjure_up distlib==0.3.9 filelock==3.4.1 idna==3.10 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig==1.1.1 Jinja2==3.0.3 juju-wait==2.8.4 MarkupSafe==2.0.1 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 petname==2.6 platformdirs==2.4.0 pluggy==1.0.0 prettytable==2.5.0 progressbar2==3.55.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 python-utils==3.5.2 PyYAML==6.0.1 q==2.7 requests==2.27.1 requests-oauthlib==2.0.0 requests-unixsocket==0.3.0 six==1.17.0 termcolor==1.1.0 toml==0.10.2 tomli==1.2.3 tox==3.28.0 typing_extensions==4.1.1 urllib3==1.26.20 urwid==2.1.2 virtualenv==20.17.1 wcwidth==0.2.13 ws4py==0.3.4 zipp==3.6.0
name: conjure-up channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - bson==0.5.10 - charset-normalizer==2.0.12 - distlib==0.3.9 - filelock==3.4.1 - idna==3.10 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - iniconfig==1.1.1 - jinja2==3.0.3 - juju-wait==2.8.4 - markupsafe==2.0.1 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - petname==2.6 - platformdirs==2.4.0 - pluggy==1.0.0 - prettytable==2.5.0 - progressbar2==3.55.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - python-utils==3.5.2 - pyyaml==6.0.1 - q==2.7 - requests==2.27.1 - requests-oauthlib==2.0.0 - requests-unixsocket==0.3.0 - six==1.17.0 - termcolor==1.1.0 - toml==0.10.2 - tomli==1.2.3 - tox==3.28.0 - typing-extensions==4.1.1 - urllib3==1.26.20 - urwid==2.1.2 - virtualenv==20.17.1 - wcwidth==0.2.13 - ws4py==0.3.4 - zipp==3.6.0 prefix: /opt/conda/envs/conjure-up
[ "test/test_controllers_deploy_gui.py::DeployGUIRenderTestCase::test_queue_predeploy_once", "test/test_controllers_deploy_gui.py::DeployGUIFinishTestCase::test_show_bootstrap_wait", "test/test_controllers_deploy_gui.py::DeployGUIFinishTestCase::test_skip_bootstrap_wait" ]
[]
[]
[]
MIT License
962
[ "conjureup/controllers/deploy/gui.py" ]
[ "conjureup/controllers/deploy/gui.py" ]
prophile__jacquard-17
e70c7df43d5b71f59da265d830d74f7424c7d7b3
2017-01-15 23:44:38
e70c7df43d5b71f59da265d830d74f7424c7d7b3
diff --git a/jacquard/experiments/commands.py b/jacquard/experiments/commands.py index ffeb602..cf7e84b 100644 --- a/jacquard/experiments/commands.py +++ b/jacquard/experiments/commands.py @@ -3,8 +3,10 @@ import yaml import pathlib import datetime +import dateutil.tz from jacquard.commands import BaseCommand +from .experiment import Experiment class Launch(BaseCommand): @@ -25,26 +27,20 @@ class Launch(BaseCommand): def handle(self, config, options): """Run command.""" with config.storage.transaction() as store: - try: - experiment_config = store[ - 'experiments/%s' % options.experiment - ] - except KeyError: - print("Experiment %r not configured" % options.experiment) - return + experiment = Experiment.from_store(store, options.experiment) current_experiments = store.get('active-experiments', []) - if options.experiment in current_experiments: - print("Experiment %r already launched!" % options.experiment) + if experiment.id in current_experiments: + print("Experiment %r already launched!" % experiment.id) return store['active-experiments'] = ( current_experiments + [options.experiment] ) - experiment_config['launched'] = str(datetime.datetime.utcnow()) - store['experiments/%s' % options.experiment] = experiment_config + experiment.launched = datetime.datetime.now(dateutil.tz.tzutc()) + experiment.save(store) class Conclude(BaseCommand): @@ -78,13 +74,7 @@ class Conclude(BaseCommand): def handle(self, config, options): """Run command.""" with config.storage.transaction() as store: - try: - experiment_config = store[ - 'experiments/%s' % options.experiment - ] - except KeyError: - print("Experiment %r not configured" % options.experiment) - return + experiment = Experiment.from_store(store, options.experiment) current_experiments = store.get('active-experiments', []) @@ -98,18 +88,12 @@ class Conclude(BaseCommand): defaults = store.get('defaults', {}) # Find branch matching ID - for branch in experiment_config['branches']: - if branch['id'] == options.branch: - defaults.update(branch['settings']) - break - else: - print("Cannot find branch %r" % options.branch) - return + defaults.update(experiment.branch(options.branch)['settings']) store['defaults'] = defaults - experiment_config['concluded'] = str(datetime.datetime.utcnow()) - store['experiments/%s' % options.experiment] = experiment_config + experiment.concluded = datetime.datetime.now(dateutil.tz.tzutc()) + experiment.save(store) store['active-experiments'] = current_experiments @@ -146,15 +130,46 @@ class Load(BaseCommand): print("No branches specified.") return - experiment_id = definition['id'] + experiment = Experiment.from_json(definition) with config.storage.transaction() as store: live_experiments = store.get('active-experiments', ()) - if experiment_id in live_experiments: + if experiment.id in live_experiments: print( - "Experiment %r is live, refusing to edit" % experiment_id, + "Experiment %r is live, refusing to edit" % experiment.id, ) return - store['experiments/%s' % experiment_id] = definition + experiment.save(store) + + +class ListExperiments(BaseCommand): + """ + List all experiments. + + Mostly useful in practice when one cannot remember the ID of an experiment. + """ + + help = "list all experiments" + + def handle(self, config, options): + """Run command.""" + with config.storage.transaction() as store: + for experiment in Experiment.enumerate(store): + if experiment.name == experiment.id: + title = experiment.id + else: + title = '%s: %s' % (experiment.id, experiment.name) + print(title) + print('=' * len(title)) + print() + if experiment.launched: + print('Launched: %s' % experiment.launched) + if experiment.concluded: + print('Concluded: %s' % experiment.concluded) + else: + print('In progress') + else: + print('Not yet launched') + print() diff --git a/jacquard/experiments/experiment.py b/jacquard/experiments/experiment.py new file mode 100644 index 0000000..0c732e7 --- /dev/null +++ b/jacquard/experiments/experiment.py @@ -0,0 +1,124 @@ +"""Experiment definition abstraction class.""" + +import contextlib +import dateutil.parser + + +class Experiment(object): + """ + The definition of an experiment. + + This is essentially a plain-old-data class with utility methods for + canonical serialisation and deserialisation of various flavours. + """ + + def __init__( + self, + experiment_id, + branches, + *, + constraints=None, + name=None, + launched=None, + concluded=None + ): + """Base constructor. Takes all the arguments.""" + self.id = experiment_id + self.branches = branches + self.constraints = constraints or {} + self.name = name or self.id + self.launched = launched + self.concluded = concluded + + @classmethod + def from_json(cls, obj): + """ + Create instance from a JSON-esque definition. + + Required keys: id, branches + + Optional keys: name, constraints, launched, concluded + """ + kwargs = {} + + with contextlib.suppress(KeyError): + kwargs['name'] = obj['name'] + + with contextlib.suppress(KeyError): + kwargs['constraints'] = obj['constraints'] + + with contextlib.suppress(KeyError): + kwargs['launched'] = dateutil.parser.parse(obj['launched']) + + with contextlib.suppress(KeyError): + kwargs['concluded'] = dateutil.parser.parse(obj['concluded']) + + return cls(obj['id'], obj['branches'], **kwargs) + + @classmethod + def from_store(cls, store, experiment_id): + """Create instance from a store lookup by ID.""" + json_repr = dict(store['experiments/%s' % experiment_id]) + # Be resilient to missing ID + if 'id' not in json_repr: + json_repr['id'] = experiment_id + return cls.from_json(json_repr) + + @classmethod + def enumerate(cls, store): + """ + Iterator over all named experiments in a store. + + Includes inactive experiments. + """ + prefix = 'experiments/' + + for key in store: + if not key.startswith(prefix): + continue + + experiment_id = key[len(prefix):] + yield cls.from_store(store, experiment_id) + + def to_json(self): + """Serialise as canonical JSON.""" + representation = { + 'id': self.id, + 'branches': self.branches, + 'constraints': self.constraints, + 'name': self.name, + 'launched': str(self.launched), + 'concluded': str(self.concluded), + } + + if not representation['constraints']: + del representation['constraints'] + + if representation['name'] == self.id: + del representation['name'] + + if representation['launched'] == 'None': + del representation['launched'] + + if representation['concluded'] == 'None': + del representation['concluded'] + + return representation + + def save(self, store): + """Save into the given store using the ID as the key.""" + store['experiments/%s' % self.id] = self.to_json() + + def branch(self, branch_id): + """ + Get the branch with a given ID. + + In case of multiple branches with the same ID (which should Never Ever + Happen), behaviour is undefined. + + If there is no such branch, LookupErrors will materialise. + """ + for branch in self.branches: + if branch['id'] == branch_id: + return branch + raise LookupError("No such branch: %r" % branch_id) diff --git a/jacquard/service/wsgi.py b/jacquard/service/wsgi.py index 594e003..b0745da 100644 --- a/jacquard/service/wsgi.py +++ b/jacquard/service/wsgi.py @@ -7,6 +7,7 @@ import werkzeug.exceptions from jacquard.users import get_settings from jacquard.users.settings import branch_hash from jacquard.experiments.constraints import meets_constraints +from jacquard.experiments.experiment import Experiment def on_root(config): @@ -44,23 +45,17 @@ def on_experiments(config): """ with config.storage.transaction() as store: active_experiments = store.get('active-experiments', ()) - experiments = [] - - for key in store: - if not key.startswith('experiments/'): - continue - definition = store[key] - experiments.append(definition) + experiments = list(Experiment.enumerate(store)) return [ { - 'id': experiment['id'], - 'url': '/experiment/%s' % experiment['id'], + 'id': experiment.id, + 'url': '/experiment/%s' % experiment.id, 'state': 'active' - if experiment['id'] in active_experiments + if experiment.id in active_experiments else 'inactive', - 'name': experiment.get('name', experiment['id']), + 'name': experiment.name, } for experiment in experiments ] @@ -78,15 +73,13 @@ def on_experiment(config, experiment): Provided for reporting tooling which runs statistics. """ with config.storage.transaction() as store: - experiment_config = store['experiments/%s' % experiment] + experiment_config = Experiment.from_store(store, experiment) - branch_ids = [branch['id'] for branch in experiment_config['branches']] + branch_ids = [branch['id'] for branch in experiment_config.branches] branches = {x: [] for x in branch_ids} - constraints = experiment_config.get('constraints', {}) - for user_entry in config.directory.all_users(): - if not meets_constraints(constraints, user_entry): + if not meets_constraints(experiment_config.constraints, user_entry): continue branch_id = branch_ids[ @@ -97,10 +90,10 @@ def on_experiment(config, experiment): branches[branch_id].append(user_entry.id) return { - 'id': experiment_config['id'], - 'name': experiment_config.get('name', experiment_config['id']), - 'launched': experiment_config.get('launched'), - 'concluded': experiment_config.get('concluded'), + 'id': experiment_config.id, + 'name': experiment_config.name, + 'launched': experiment_config.launched, + 'concluded': experiment_config.concluded, 'branches': branches, } diff --git a/jacquard/storage/dummy.py b/jacquard/storage/dummy.py index c3e4c34..ca7dfc4 100644 --- a/jacquard/storage/dummy.py +++ b/jacquard/storage/dummy.py @@ -24,6 +24,10 @@ class DummyStore(StorageEngine): else: self.data = {} + def __getitem__(self, key): + """Direct item access. This is for test usage.""" + return json.loads(self.data.get(key, 'null')) + def begin(self): """Begin transaction.""" pass diff --git a/jacquard/users/settings.py b/jacquard/users/settings.py index 21c1687..1063f88 100644 --- a/jacquard/users/settings.py +++ b/jacquard/users/settings.py @@ -2,6 +2,7 @@ import hashlib +from jacquard.experiments.experiment import Experiment from jacquard.experiments.constraints import meets_constraints @@ -20,32 +21,30 @@ def get_settings(user_id, storage, directory=None): live_experiments = store.get('active-experiments', []) experiment_definitions = [ - {**store['experiments/%s' % x], 'id': x} + Experiment.from_store(store, x) for x in live_experiments ] overrides = store.get('overrides/%s' % user_id, {}) experiment_settings = {} - for experiment_def in experiment_definitions: - constraints = experiment_def.get('constraints', {}) - - if constraints: + for experiment in experiment_definitions: + if experiment.constraints: if directory is None: raise ValueError( "Cannot evaluate constraints on experiment %r " - "with no directory" % experiment_def['id'], + "with no directory" % experiment.id, ) user_entry = directory.lookup(user_id) - if not meets_constraints(constraints, user_entry): + if not meets_constraints(experiment.constraints, user_entry): continue - branch = experiment_def['branches'][branch_hash( - experiment_def['id'], + branch = experiment.branches[branch_hash( + experiment.id, user_id, - ) % len(experiment_def['branches'])] + ) % len(experiment.branches)] experiment_settings.update(branch['settings']) return {**defaults, **experiment_settings, **overrides} diff --git a/setup.py b/setup.py index 760e76f..d0102b6 100644 --- a/setup.py +++ b/setup.py @@ -68,6 +68,7 @@ setup( 'launch = jacquard.experiments.commands:Launch', 'conclude = jacquard.experiments.commands:Conclude', 'load-experiment = jacquard.experiments.commands:Load', + 'list = jacquard.experiments.commands:ListExperiments', 'list-users = jacquard.directory.commands:ListUsers', ), 'jacquard.directory_engines': (
Refactor experiments into `jacquard.experiments` Currently various users analyse the experiment data structure directly. It needs to be migrated to a Python class within `jacquard.experiments`.
prophile/jacquard
diff --git a/jacquard/experiments/tests/test_smoke.py b/jacquard/experiments/tests/test_smoke.py new file mode 100644 index 0000000..e9d5acb --- /dev/null +++ b/jacquard/experiments/tests/test_smoke.py @@ -0,0 +1,61 @@ +import datetime +import dateutil.tz + +from unittest.mock import Mock + +from jacquard.cli import main +from jacquard.storage.dummy import DummyStore + + +BRANCH_SETTINGS = {'pony': 'gravity'} + +DUMMY_DATA_PRE_LAUNCH = { + 'experiments/foo': { + 'branches': [ + {'id': 'bar', 'settings': BRANCH_SETTINGS}, + ], + }, +} + +DUMMY_DATA_POST_LAUNCH = { + 'experiments/foo': { + 'branches': [ + {'id': 'bar', 'settings': BRANCH_SETTINGS}, + ], + 'launched': str(datetime.datetime.now(dateutil.tz.tzutc())), + }, + 'active-experiments': ['foo'], +} + + +def test_launch(): + config = Mock() + config.storage = DummyStore('', data=DUMMY_DATA_PRE_LAUNCH) + + main(('launch', 'foo'), config=config) + + assert 'launched' in config.storage['experiments/foo'] + assert 'concluded' not in config.storage['experiments/foo'] + assert 'foo' in config.storage['active-experiments'] + + +def test_conclude_no_branch(): + config = Mock() + config.storage = DummyStore('', data=DUMMY_DATA_POST_LAUNCH) + + main(('conclude', 'foo', '--no-promote-branch'), config=config) + + assert 'concluded' in config.storage['experiments/foo'] + assert 'foo' not in config.storage['active-experiments'] + assert not config.storage['defaults'] + + +def test_conclude_updates_defaults(): + config = Mock() + config.storage = DummyStore('', data=DUMMY_DATA_POST_LAUNCH) + + main(('conclude', 'foo', 'bar'), config=config) + + assert 'concluded' in config.storage['experiments/foo'] + assert 'foo' not in config.storage['active-experiments'] + assert config.storage['defaults'] == BRANCH_SETTINGS diff --git a/jacquard/service/tests/test_http.py b/jacquard/service/tests/test_http.py new file mode 100644 index 0000000..05aaebf --- /dev/null +++ b/jacquard/service/tests/test_http.py @@ -0,0 +1,92 @@ +import json + +import datetime +import dateutil.tz + +from unittest.mock import Mock + +from jacquard.service import get_wsgi_app +from jacquard.storage.dummy import DummyStore +from jacquard.directory.base import UserEntry +from jacquard.directory.dummy import DummyDirectory + +import werkzeug.test + + +def get_status(path): + config = Mock() + config.storage = DummyStore('', data={ + 'defaults': {'pony': 'gravity'}, + 'active-experiments': ['foo'], + 'experiments/foo': { + 'id': 'foo', + 'constraints': { + 'excluded_tags': ['excluded'], + 'anonymous': False, + }, + 'branches': [{'id': 'bar', 'settings': {'pony': 'horse'}}], + }, + }) + now = datetime.datetime.now(dateutil.tz.tzutc()) + config.directory = DummyDirectory(users=( + UserEntry(id=1, join_date=now, tags=('excluded',)), + UserEntry(id=2, join_date=now, tags=('excluded',)), + UserEntry(id=3, join_date=now, tags=()), + )) + + wsgi = get_wsgi_app(config) + test_client = werkzeug.test.Client(wsgi) + + data, status, headers = test_client.get(path) + all_data = b''.join(data) + return status, all_data + + +def get(path): + status, all_data = get_status(path) + assert status == '200 OK' + return json.loads(all_data.decode('utf-8')) + + +def test_root(): + assert get('/') == { + 'experiments': '/experiment', + 'user': '/users/<user>', + } + + +def test_user_lookup(): + assert get('/users/1') == { + 'user': '1', + 'pony': 'gravity', + } + + +def test_user_lookup_with_non_numeric_id(): + assert get('/users/bees') == { + 'user': 'bees', + 'pony': 'gravity', + } + + +def test_experiments_list(): + # Verify no exceptions + assert get('/experiment') == [{ + 'id': 'foo', + 'url': '/experiment/foo', + 'state': 'active', + 'name': 'foo', + }] + + +def test_experiment_get_smoke(): + # Verify no exceptions + assert get('/experiment/foo')['name'] == 'foo' + + +def test_experiment_get_membership(): + assert get('/experiment/foo')['branches']['bar'] == [3] + + +def test_missing_paths_get_404(): + assert get_status('/missing')[0] == '404 NOT FOUND'
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_added_files", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 5 }
0.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "flake8", "flake8-docstrings" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
async-timeout==5.0.1 exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work flake8==7.2.0 flake8-docstrings==1.7.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work -e git+https://github.com/prophile/jacquard.git@e70c7df43d5b71f59da265d830d74f7424c7d7b3#egg=jacquard_split MarkupSafe==3.0.2 mccabe==0.7.0 packaging @ file:///croot/packaging_1734472117206/work pluggy @ file:///croot/pluggy_1733169602837/work pycodestyle==2.13.0 pydocstyle==6.3.0 pyflakes==3.3.1 pytest @ file:///croot/pytest_1738938843180/work python-dateutil==2.9.0.post0 PyYAML==6.0.2 redis==5.2.1 six==1.17.0 snowballstemmer==2.2.0 tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work Werkzeug==3.1.3
name: jacquard channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - async-timeout==5.0.1 - flake8==7.2.0 - flake8-docstrings==1.7.0 - markupsafe==3.0.2 - mccabe==0.7.0 - pycodestyle==2.13.0 - pydocstyle==6.3.0 - pyflakes==3.3.1 - python-dateutil==2.9.0.post0 - pyyaml==6.0.2 - redis==5.2.1 - six==1.17.0 - snowballstemmer==2.2.0 - werkzeug==3.1.3 prefix: /opt/conda/envs/jacquard
[ "jacquard/experiments/tests/test_smoke.py::test_launch", "jacquard/experiments/tests/test_smoke.py::test_conclude_no_branch", "jacquard/experiments/tests/test_smoke.py::test_conclude_updates_defaults" ]
[ "jacquard/service/tests/test_http.py::test_root", "jacquard/service/tests/test_http.py::test_user_lookup", "jacquard/service/tests/test_http.py::test_user_lookup_with_non_numeric_id", "jacquard/service/tests/test_http.py::test_experiments_list", "jacquard/service/tests/test_http.py::test_experiment_get_smoke", "jacquard/service/tests/test_http.py::test_experiment_get_membership", "jacquard/service/tests/test_http.py::test_missing_paths_get_404" ]
[]
[]
MIT License
963
[ "setup.py", "jacquard/service/wsgi.py", "jacquard/storage/dummy.py", "jacquard/experiments/experiment.py", "jacquard/experiments/commands.py", "jacquard/users/settings.py" ]
[ "setup.py", "jacquard/service/wsgi.py", "jacquard/storage/dummy.py", "jacquard/experiments/experiment.py", "jacquard/experiments/commands.py", "jacquard/users/settings.py" ]
docker__docker-py-1393
aed1af6f6f8c97658ad8d11619ba0e7fce7af240
2017-01-16 07:57:41
4a50784ad432283a1bd314da0c574fbe5699f1c9
diff --git a/docker/models/images.py b/docker/models/images.py index 32068e69..6f8f4fe2 100644 --- a/docker/models/images.py +++ b/docker/models/images.py @@ -30,10 +30,10 @@ class Image(Model): """ The image's tags. """ - return [ - tag for tag in self.attrs.get('RepoTags', []) - if tag != '<none>:<none>' - ] + tags = self.attrs.get('RepoTags') + if tags is None: + tags = [] + return [tag for tag in tags if tag != '<none>:<none>'] def history(self): """
Exception retrieving untagged images on api >= 1.24 Docker API >= 1.24 will return a null object if image tags DNE instead of not including it in the response. This makes the dict.get fail to catch the null case and the list comprehension to iterate over a non-iterable. ``` File "<stdin>", line 1, in <module> File "docker/models/images.py", line 16, in __repr__ return "<%s: '%s'>" % (self.__class__.__name__, "', '".join(self.tags)) File "docker/models/images.py", line 34, in tags tag for tag in self.attrs.get('RepoTags', []) TypeError: 'NoneType' object is not iterable ``` This is similar to an issue seen in [salt](https://github.com/saltstack/salt/pull/35447/commits/b833b5f9587534d3b843a026ef91abc4ec929d0f) Was able to get things working with a pretty quick change: ``` diff --git a/docker/models/images.py b/docker/models/images.py index 32068e6..39a640d 100644 --- a/docker/models/images.py +++ b/docker/models/images.py @@ -30,9 +30,11 @@ class Image(Model): """ The image's tags. """ + tags = self.attrs.get('RepoTags', []) + if tags is None: + return [] return [ - tag for tag in self.attrs.get('RepoTags', []) - if tag != '<none>:<none>' + tag for tag in tags if tag != '<none>:<none>' ] def history(self): ```
docker/docker-py
diff --git a/tests/unit/models_images_test.py b/tests/unit/models_images_test.py index 392c58d7..efb21166 100644 --- a/tests/unit/models_images_test.py +++ b/tests/unit/models_images_test.py @@ -83,6 +83,11 @@ class ImageTest(unittest.TestCase): }) assert image.tags == [] + image = Image(attrs={ + 'RepoTags': None + }) + assert image.tags == [] + def test_history(self): client = make_fake_client() image = client.images.get(FAKE_IMAGE_ID)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 1 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 -e git+https://github.com/docker/docker-py.git@aed1af6f6f8c97658ad8d11619ba0e7fce7af240#egg=docker docker-pycreds==0.2.1 importlib-metadata==4.8.3 iniconfig==1.1.1 packaging==21.3 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 requests==2.11.1 six==1.17.0 tomli==1.2.3 typing_extensions==4.1.1 websocket-client==0.32.0 zipp==3.6.0
name: docker-py channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - docker-pycreds==0.2.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - requests==2.11.1 - six==1.17.0 - tomli==1.2.3 - typing-extensions==4.1.1 - websocket-client==0.32.0 - zipp==3.6.0 prefix: /opt/conda/envs/docker-py
[ "tests/unit/models_images_test.py::ImageTest::test_tags" ]
[]
[ "tests/unit/models_images_test.py::ImageCollectionTest::test_build", "tests/unit/models_images_test.py::ImageCollectionTest::test_get", "tests/unit/models_images_test.py::ImageCollectionTest::test_list", "tests/unit/models_images_test.py::ImageCollectionTest::test_load", "tests/unit/models_images_test.py::ImageCollectionTest::test_pull", "tests/unit/models_images_test.py::ImageCollectionTest::test_push", "tests/unit/models_images_test.py::ImageCollectionTest::test_remove", "tests/unit/models_images_test.py::ImageCollectionTest::test_search", "tests/unit/models_images_test.py::ImageTest::test_history", "tests/unit/models_images_test.py::ImageTest::test_save", "tests/unit/models_images_test.py::ImageTest::test_short_id", "tests/unit/models_images_test.py::ImageTest::test_tag" ]
[]
Apache License 2.0
964
[ "docker/models/images.py" ]
[ "docker/models/images.py" ]
wireservice__csvkit-755
f1180b3d674e7945bbcba336f541dc3597614918
2017-01-17 05:17:22
e88daad61ed949edf11dfbf377eb347a9b969d47
diff --git a/docs/scripts/csvclean.rst b/docs/scripts/csvclean.rst index 281f2d0..8937495 100644 --- a/docs/scripts/csvclean.rst +++ b/docs/scripts/csvclean.rst @@ -5,7 +5,14 @@ csvclean Description =========== -Cleans a CSV file of common syntax errors. Outputs [basename]_out.csv and [basename]_err.csv, the former containing all valid rows and the latter containing all error rows along with line numbers and descriptions:: +Cleans a CSV file of common syntax errors: + +* reports rows that have a different number of columns than the header row +* removes optional quote characters +* changes the record delimiter to a line feed +* changes the character encoding to UTF-8 + +Outputs [basename]_out.csv and [basename]_err.csv, the former containing all valid rows and the latter containing all error rows along with line numbers and descriptions:: usage: csvclean [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b] [-p ESCAPECHAR] [-z MAXFIELDSIZE] [-e ENCODING] [-S] [-v] [-l] diff --git a/examples/optional_quote_characters.csv b/examples/optional_quote_characters.csv new file mode 100644 index 0000000..bf9fcfb --- /dev/null +++ b/examples/optional_quote_characters.csv @@ -0,0 +1,2 @@ +a,b,c +"1","2","3"
csvclean documentation is poor Great tool really, but the documentation is very poor. It should be interesting to explain each task done by csvclean: - delete every unneeded quote - recode from XXX charset to UTF-8 - replace X delimiter by a comma - replace \r\n by \n This last modification is ok for me as I can then grep the file without problem, but it is not compatible with the RFC (which recommand \r\n).
wireservice/csvkit
diff --git a/tests/test_utilities/test_csvclean.py b/tests/test_utilities/test_csvclean.py index 808ec46..3b85ffb 100644 --- a/tests/test_utilities/test_csvclean.py +++ b/tests/test_utilities/test_csvclean.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- import os import sys @@ -17,12 +18,8 @@ from tests.utils import CSVKitTestCase, EmptyFileTests class TestCSVClean(CSVKitTestCase, EmptyFileTests): Utility = CSVClean - def test_launch_new_instance(self): - with patch.object(sys, 'argv', [self.Utility.__name__.lower(), 'examples/bad.csv']): - launch_new_instance() - - def test_simple(self): - args = ['examples/bad.csv'] + def assertCleaned(self, basename, output_lines, error_lines, additional_args=[]): + args = ['examples/%s.csv' % basename] + additional_args output_file = six.StringIO() utility = CSVClean(args, output_file) @@ -30,24 +27,64 @@ class TestCSVClean(CSVKitTestCase, EmptyFileTests): output_file.close() - self.assertTrue(os.path.exists('examples/bad_err.csv')) - self.assertTrue(os.path.exists('examples/bad_out.csv')) + output_file = 'examples/%s_out.csv' % basename + error_file = 'examples/%s_err.csv' % basename + + self.assertEqual(os.path.exists(output_file), bool(output_lines)) + self.assertEqual(os.path.exists(error_file), bool(error_lines)) try: - with open('examples/bad_err.csv') as f: - next(f) - self.assertEqual(next(f)[0], '1') - self.assertEqual(next(f)[0], '2') - self.assertRaises(StopIteration, next, f) - - with open('examples/bad_out.csv') as f: - next(f) - self.assertEqual(next(f)[0], '0') - self.assertRaises(StopIteration, next, f) + if output_lines: + with open(output_file) as f: + for line in output_lines: + self.assertEqual(next(f), line) + self.assertRaises(StopIteration, next, f) + if error_lines: + with open(error_file) as f: + for line in error_lines: + self.assertEqual(next(f), line) + self.assertRaises(StopIteration, next, f) finally: - # Cleanup - os.remove('examples/bad_err.csv') - os.remove('examples/bad_out.csv') + if output_lines: + os.remove(output_file) + if error_lines: + os.remove(error_file) + + + def test_launch_new_instance(self): + with patch.object(sys, 'argv', [self.Utility.__name__.lower(), 'examples/bad.csv']): + launch_new_instance() + + def test_simple(self): + self.assertCleaned('bad', [ + 'column_a,column_b,column_c\n', + '0,mixed types.... uh oh,17\n', + ], [ + 'line_number,msg,column_a,column_b,column_c\n', + '1,"Expected 3 columns, found 4 columns",1,27,,I\'m too long!\n', + '2,"Expected 3 columns, found 2 columns",,I\'m too short!\n', + ]) + + def test_removes_optional_quote_characters(self): + self.assertCleaned('optional_quote_characters', [ + 'a,b,c\n', + '1,2,3\n', + ], []) + + def test_changes_line_endings(self): + self.assertCleaned('mac_newlines', [ + 'a,b,c\n', + '1,2,3\n', + '"Once upon\n', + 'a time",5,6\n', + ], []) + + def test_changes_character_encoding(self): + self.assertCleaned('test_latin1', [ + 'a,b,c\n', + '1,2,3\n', + '4,5,©\n', + ], [], ['-e', 'latin1']) def test_dry_run(self): output = self.get_output_as_io(['-n', 'examples/bad.csv'])
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_added_files", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 2, "test_score": 2 }, "num_modified_files": 1 }
1.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "nose" ], "pre_install": [ "apt-get update", "apt-get install -y gcc postgresql postgresql-contrib" ], "python": "3.9", "reqs_path": [ "requirements-py3.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
agate==1.13.0 agate-dbf==0.2.3 agate-excel==0.4.1 agate-sql==0.7.2 alabaster==0.7.16 babel==2.17.0 cachetools==5.5.2 certifi==2025.1.31 chardet==5.2.0 charset-normalizer==3.4.1 colorama==0.4.6 coverage==7.8.0 -e git+https://github.com/wireservice/csvkit.git@f1180b3d674e7945bbcba336f541dc3597614918#egg=csvkit dbfread==2.0.7 distlib==0.3.9 docutils==0.21.2 et_xmlfile==2.0.0 exceptiongroup==1.2.2 filelock==3.18.0 greenlet==3.1.1 idna==3.10 imagesize==1.4.1 importlib_metadata==8.6.1 iniconfig==2.1.0 isodate==0.7.2 Jinja2==3.1.6 leather==0.4.0 MarkupSafe==3.0.2 nose==1.3.7 olefile==0.47 openpyxl==3.1.5 packaging==24.2 parsedatetime==2.6 platformdirs==4.3.7 pluggy==1.5.0 Pygments==2.19.1 pyproject-api==1.9.0 pytest==8.3.5 python-slugify==8.0.4 pytimeparse==1.1.8 requests==2.32.3 six==1.17.0 snowballstemmer==2.2.0 Sphinx==7.4.7 sphinx-rtd-theme==3.0.2 sphinxcontrib-applehelp==2.0.0 sphinxcontrib-devhelp==2.0.0 sphinxcontrib-htmlhelp==2.1.0 sphinxcontrib-jquery==4.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==2.0.0 sphinxcontrib-serializinghtml==2.0.0 SQLAlchemy==2.0.40 text-unidecode==1.3 tomli==2.2.1 tox==4.25.0 typing_extensions==4.13.0 urllib3==2.3.0 virtualenv==20.29.3 xlrd==2.0.1 zipp==3.21.0
name: csvkit channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - agate==1.13.0 - agate-dbf==0.2.3 - agate-excel==0.4.1 - agate-sql==0.7.2 - alabaster==0.7.16 - babel==2.17.0 - cachetools==5.5.2 - certifi==2025.1.31 - chardet==5.2.0 - charset-normalizer==3.4.1 - colorama==0.4.6 - coverage==7.8.0 - dbfread==2.0.7 - distlib==0.3.9 - docutils==0.21.2 - et-xmlfile==2.0.0 - exceptiongroup==1.2.2 - filelock==3.18.0 - greenlet==3.1.1 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==8.6.1 - iniconfig==2.1.0 - isodate==0.7.2 - jinja2==3.1.6 - leather==0.4.0 - markupsafe==3.0.2 - nose==1.3.7 - olefile==0.47 - openpyxl==3.1.5 - packaging==24.2 - parsedatetime==2.6 - platformdirs==4.3.7 - pluggy==1.5.0 - pygments==2.19.1 - pyproject-api==1.9.0 - pytest==8.3.5 - python-slugify==8.0.4 - pytimeparse==1.1.8 - requests==2.32.3 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==7.4.7 - sphinx-rtd-theme==3.0.2 - sphinxcontrib-applehelp==2.0.0 - sphinxcontrib-devhelp==2.0.0 - sphinxcontrib-htmlhelp==2.1.0 - sphinxcontrib-jquery==4.1 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==2.0.0 - sphinxcontrib-serializinghtml==2.0.0 - sqlalchemy==2.0.40 - text-unidecode==1.3 - tomli==2.2.1 - tox==4.25.0 - typing-extensions==4.13.0 - urllib3==2.3.0 - virtualenv==20.29.3 - xlrd==2.0.1 - zipp==3.21.0 prefix: /opt/conda/envs/csvkit
[ "tests/test_utilities/test_csvclean.py::TestCSVClean::test_removes_optional_quote_characters" ]
[]
[ "tests/test_utilities/test_csvclean.py::TestCSVClean::test_changes_character_encoding", "tests/test_utilities/test_csvclean.py::TestCSVClean::test_changes_line_endings", "tests/test_utilities/test_csvclean.py::TestCSVClean::test_dry_run", "tests/test_utilities/test_csvclean.py::TestCSVClean::test_empty", "tests/test_utilities/test_csvclean.py::TestCSVClean::test_launch_new_instance", "tests/test_utilities/test_csvclean.py::TestCSVClean::test_simple" ]
[]
MIT License
965
[ "docs/scripts/csvclean.rst", "examples/optional_quote_characters.csv" ]
[ "docs/scripts/csvclean.rst", "examples/optional_quote_characters.csv" ]
Pylons__webob-306
1ac5148d680a020f3a05138ef0c1a5f529c49ed5
2017-01-17 06:40:34
b2e78a53af7abe866b90a532479cf5c0ae00301b
diff --git a/CHANGES.txt b/CHANGES.txt index 393cd8d..2105fe8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,13 @@ Unreleased ---------- +Bugfix +~~~~~~ +- ``Response.__init__`` would discard ``app_iter`` when a ``Response`` had no + body, this would cause issues when ``app_iter`` was an object that was tied + to the life-cycle of a web application and had to be properly closed. + ``app_iter`` is more advanced API for ``Response`` and thus even if it + contains a body and is thus against the HTTP RFC's, we should let the users + shoot themselves by returning a body. See + https://github.com/Pylons/webob/issues/305 diff --git a/webob/response.py b/webob/response.py index 899fc99..cd376b9 100644 --- a/webob/response.py +++ b/webob/response.py @@ -320,7 +320,7 @@ class Response(object): if k.lower() != 'content-length' ] self._headerlist.append(('Content-Length', str(len(body)))) - elif app_iter is None or not code_has_body: + elif app_iter is None and not code_has_body: app_iter = [b''] self._app_iter = app_iter
Seems WebOb 1.7 has some glitches with WebTest when a 204 is responded The recent WebOb 1.7 changes to initialisation function seem to had introduced a side effect when WebTest is used, as webtest will recreate a new `Response` object from the application response. A simple testcase can be created to showcase the issue: ``` from webob import Response def wsgi_app(environ, start_response): resp = Response(status='204 No Content', body=b'') resp.content_type = None return resp(environ, start_response) ``` The snippet is meant to work on both 1.6 and 1.7, so it adds some unnecessary values like `body` and `content_type` which are already provided in 1.7 (those values are in fact a nop on 1.7) while they are required on 1.6 to generate a response without content. The response is as expected both on 1.6 and 1.7 ``` Response: 204 No Content ``` Creating a plain webtest `TestApp` from the previous example: ``` from webtest import TestApp app = TestApp(wsgi_app) app.get('/') ``` will issue a validation error on WebOb 1.7: ``` Iterator garbage collected without being closedException AssertionError: AssertionError('Iterator garbage collected without being closed',) in <bound method IteratorWrapper.__del__ of <webtest.lint.IteratorWrapper object at 0x100ed0850>> ignored ``` while it will work without the error with WebOb 1.6. This seems to be related to https://github.com/Pylons/webob/commit/35fd5854b4b706adafa4caab43b6bcdcf3e6a934 as https://github.com/Pylons/webob/blob/master/webob/response.py#L323 throws away the webtest `IteratorWrapper` injected by WebTest replacing it with `[b'']` as `code_has_body` is False and thus breaking `WebTest` I wouldn't take for granted that if there is an `app_iter` it will be wrong and needs to be discarded as response has no content. It's probably a right assumption in the case of `body`, but discarding `app_iter` might in fact break some application by discarding an iterator which returns an empty response too but has other side effects.
Pylons/webob
diff --git a/tests/test_response.py b/tests/test_response.py index 1d272c6..8e9b3ae 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -1316,7 +1316,9 @@ def test_204_has_no_body(): def test_204_app_iter_set(): res = Response(status='204', app_iter=[b'test']) - assert res.body == b'' + + # You are on your own in this case... you set app_iter you bought it + assert res.body == b'test' assert res.content_length is None assert res.headerlist == [] @@ -1353,3 +1355,13 @@ def test_content_type_has_charset(): assert res.content_type == 'application/foo' assert res.charset == 'UTF-8' assert res.headers['Content-Type'] == 'application/foo; charset=UTF-8' + +def test_app_iter_is_same(): + class app_iter(object): + pass + + my_app_iter = app_iter() + + res = Response(status=204, app_iter=my_app_iter) + assert res.app_iter == my_app_iter + assert isinstance(res.app_iter, app_iter)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 2 }
1.7
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest pytest-cov", "pytest" ], "pre_install": null, "python": "3.5", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 coverage==6.2 importlib-metadata==4.8.3 iniconfig==1.1.1 packaging==21.3 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 pytest-cov==4.0.0 tomli==1.2.3 typing_extensions==4.1.1 -e git+https://github.com/Pylons/webob.git@1ac5148d680a020f3a05138ef0c1a5f529c49ed5#egg=WebOb zipp==3.6.0
name: webob channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - coverage==6.2 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-cov==4.0.0 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/webob
[ "tests/test_response.py::test_204_app_iter_set", "tests/test_response.py::test_app_iter_is_same" ]
[]
[ "tests/test_response.py::test_response", "tests/test_response.py::test_set_response_status_binary", "tests/test_response.py::test_set_response_status_str_no_reason", "tests/test_response.py::test_set_response_status_str_generic_reason", "tests/test_response.py::test_set_response_status_code", "tests/test_response.py::test_set_response_status_bad", "tests/test_response.py::test_set_response_status_code_generic_reason", "tests/test_response.py::test_content_type", "tests/test_response.py::test_init_content_type_w_charset", "tests/test_response.py::test_init_adds_default_charset_when_not_json", "tests/test_response.py::test_init_no_charset_when_json", "tests/test_response.py::test_init_keeps_specified_charset_when_json", "tests/test_response.py::test_init_doesnt_add_default_content_type_with_bodyless_status", "tests/test_response.py::test_cookies", "tests/test_response.py::test_unicode_cookies_error_raised", "tests/test_response.py::test_unicode_cookies_warning_issued", "tests/test_response.py::test_cookies_raises_typeerror", "tests/test_response.py::test_http_only_cookie", "tests/test_response.py::test_headers", "tests/test_response.py::test_response_copy", "tests/test_response.py::test_response_copy_content_md5", "tests/test_response.py::test_HEAD_closes", "tests/test_response.py::test_HEAD_conditional_response_returns_empty_response", "tests/test_response.py::test_HEAD_conditional_response_range_empty_response", "tests/test_response.py::test_conditional_response_if_none_match_false", "tests/test_response.py::test_conditional_response_if_none_match_true", "tests/test_response.py::test_conditional_response_if_none_match_weak", "tests/test_response.py::test_conditional_response_if_modified_since_false", "tests/test_response.py::test_conditional_response_if_modified_since_true", "tests/test_response.py::test_conditional_response_range_not_satisfiable_response", "tests/test_response.py::test_HEAD_conditional_response_range_not_satisfiable_response", "tests/test_response.py::test_md5_etag", "tests/test_response.py::test_md5_etag_set_content_md5", "tests/test_response.py::test_decode_content_defaults_to_identity", "tests/test_response.py::test_decode_content_with_deflate", "tests/test_response.py::test_content_length", "tests/test_response.py::test_app_iter_range", "tests/test_response.py::test_app_iter_range_inner_method", "tests/test_response.py::test_has_body", "tests/test_response.py::test_str_crlf", "tests/test_response.py::test_from_file", "tests/test_response.py::test_from_file2", "tests/test_response.py::test_from_text_file", "tests/test_response.py::test_from_file_w_leading_space_in_header", "tests/test_response.py::test_file_bad_header", "tests/test_response.py::test_from_file_not_unicode_headers", "tests/test_response.py::test_file_with_http_version", "tests/test_response.py::test_file_with_http_version_more_status", "tests/test_response.py::test_set_status", "tests/test_response.py::test_set_headerlist", "tests/test_response.py::test_request_uri_no_script_name", "tests/test_response.py::test_request_uri_https", "tests/test_response.py::test_app_iter_range_starts_after_iter_end", "tests/test_response.py::test_resp_write_app_iter_non_list", "tests/test_response.py::test_response_file_body_writelines", "tests/test_response.py::test_response_file_body_tell_text", "tests/test_response.py::test_response_write_non_str", "tests/test_response.py::test_response_file_body_write_empty_app_iter", "tests/test_response.py::test_response_file_body_write_empty_body", "tests/test_response.py::test_response_file_body_close_not_implemented", "tests/test_response.py::test_response_file_body_repr", "tests/test_response.py::test_body_get_is_none", "tests/test_response.py::test_body_get_is_unicode_notverylong", "tests/test_response.py::test_body_get_is_unicode", "tests/test_response.py::test_body_set_not_unicode_or_str", "tests/test_response.py::test_body_set_unicode", "tests/test_response.py::test_body_set_under_body_doesnt_exist", "tests/test_response.py::test_body_del", "tests/test_response.py::test_text_get_no_charset", "tests/test_response.py::test_text_get_no_default_body_encoding", "tests/test_response.py::test_unicode_body", "tests/test_response.py::test_text_get_decode", "tests/test_response.py::test_text_set_no_charset", "tests/test_response.py::test_text_set_no_default_body_encoding", "tests/test_response.py::test_text_set_not_unicode", "tests/test_response.py::test_text_del", "tests/test_response.py::test_body_file_del", "tests/test_response.py::test_write_unicode", "tests/test_response.py::test_write_unicode_no_charset", "tests/test_response.py::test_write_text", "tests/test_response.py::test_app_iter_del", "tests/test_response.py::test_charset_set_no_content_type_header", "tests/test_response.py::test_charset_del_no_content_type_header", "tests/test_response.py::test_content_type_params_get_no_semicolon_in_content_type_header", "tests/test_response.py::test_content_type_params_get_semicolon_in_content_type_header", "tests/test_response.py::test_content_type_params_set_value_dict_empty", "tests/test_response.py::test_content_type_params_set_ok_param_quoting", "tests/test_response.py::test_charset_delete", "tests/test_response.py::test_set_cookie_overwrite", "tests/test_response.py::test_set_cookie_value_is_None", "tests/test_response.py::test_set_cookie_expires_is_None_and_max_age_is_int", "tests/test_response.py::test_set_cookie_expires_is_None_and_max_age_is_timedelta", "tests/test_response.py::test_set_cookie_expires_is_datetime_and_max_age_is_None", "tests/test_response.py::test_set_cookie_expires_is_timedelta_and_max_age_is_None", "tests/test_response.py::test_set_cookie_expires_is_datetime_tz_and_max_age_is_None", "tests/test_response.py::test_delete_cookie", "tests/test_response.py::test_delete_cookie_with_path", "tests/test_response.py::test_delete_cookie_with_domain", "tests/test_response.py::test_unset_cookie_not_existing_and_not_strict", "tests/test_response.py::test_unset_cookie_not_existing_and_strict", "tests/test_response.py::test_unset_cookie_key_in_cookies", "tests/test_response.py::test_merge_cookies_no_set_cookie", "tests/test_response.py::test_merge_cookies_resp_is_Response", "tests/test_response.py::test_merge_cookies_resp_is_wsgi_callable", "tests/test_response.py::test_body_get_body_is_None_len_app_iter_is_zero", "tests/test_response.py::test_cache_control_get", "tests/test_response.py::test_location", "tests/test_response.py::test_location_unicode", "tests/test_response.py::test_request_uri_http", "tests/test_response.py::test_request_uri_no_script_name2", "tests/test_response.py::test_cache_control_object_max_age_ten", "tests/test_response.py::test_cache_control_set_object_error", "tests/test_response.py::test_cache_expires_set", "tests/test_response.py::test_status_code_set", "tests/test_response.py::test_cache_control_set_dict", "tests/test_response.py::test_cache_control_set_None", "tests/test_response.py::test_cache_control_set_unicode", "tests/test_response.py::test_cache_control_set_control_obj_is_not_None", "tests/test_response.py::test_cache_control_del", "tests/test_response.py::test_body_file_get", "tests/test_response.py::test_body_file_write_no_charset", "tests/test_response.py::test_body_file_write_unicode_encodes", "tests/test_response.py::test_repr", "tests/test_response.py::test_cache_expires_set_timedelta", "tests/test_response.py::test_cache_expires_set_int", "tests/test_response.py::test_cache_expires_set_None", "tests/test_response.py::test_cache_expires_set_zero", "tests/test_response.py::test_encode_content_unknown", "tests/test_response.py::test_encode_content_identity", "tests/test_response.py::test_encode_content_gzip_already_gzipped", "tests/test_response.py::test_encode_content_gzip_notyet_gzipped", "tests/test_response.py::test_encode_content_gzip_notyet_gzipped_lazy", "tests/test_response.py::test_encode_content_gzip_buffer_coverage", "tests/test_response.py::test_decode_content_identity", "tests/test_response.py::test_decode_content_weird", "tests/test_response.py::test_decode_content_gzip", "tests/test_response.py::test__make_location_absolute_has_scheme_only", "tests/test_response.py::test__make_location_absolute_path", "tests/test_response.py::test__make_location_absolute_already_absolute", "tests/test_response.py::test_response_set_body_file1", "tests/test_response.py::test_response_set_body_file2", "tests/test_response.py::test_response_json_body", "tests/test_response.py::test_cache_expires_set_zero_then_nonzero", "tests/test_response.py::test_default_content_type", "tests/test_response.py::test_default_charset", "tests/test_response.py::test_header_list_no_defaults", "tests/test_response.py::test_204_has_no_body", "tests/test_response.py::test_explicit_charset", "tests/test_response.py::test_set_content_type", "tests/test_response.py::test_raises_no_charset", "tests/test_response.py::test_raises_none_charset", "tests/test_response.py::test_doesnt_raise_with_charset_content_type_has_no_charset", "tests/test_response.py::test_content_type_has_charset" ]
[]
null
966
[ "CHANGES.txt", "webob/response.py" ]
[ "CHANGES.txt", "webob/response.py" ]
imageio__imageio-209
18721f19cef4a5448cfd54251c474800b6c89948
2017-01-18 12:08:52
48e81976e70f2c4795dfdd105d8115bc53f66a11
diff --git a/imageio/core/request.py b/imageio/core/request.py index 42185bb..bc07b25 100644 --- a/imageio/core/request.py +++ b/imageio/core/request.py @@ -326,6 +326,7 @@ class Request(object): elif self._uri_type in [URI_HTTP or URI_FTP]: assert not want_to_write # This should have been tested in init self._file = urlopen(self.filename, timeout=5) + fix_HTTPResponse(self._file) return self._file @@ -458,3 +459,35 @@ def read_n_bytes(f, N): break bb += extra_bytes return bb + + +def fix_HTTPResponse(f): + """This fixes up an HTTPResponse object so that it can tell(), and also + seek() will work if its effectively a no-op. This allows tools like Pillow + to use the file object. + """ + count = [0] + + def read(n=None): + res = ori_read(n) + count[0] += len(res) + return res + + def tell(): + return count[0] + + def seek(i, mode=0): + if not (mode == 0 and i == count[0]): + ori_seek(i, mode) + + def fail_seek(i, mode=0): + raise RuntimeError('No seeking allowed!') + + # Note, there is currently no protection from wrapping an object more than + # once, it will (probably) work though, because closures. + ori_read = f.read + ori_seek = f.seek if hasattr(f, 'seek') else fail_seek + + f.read = read + f.tell = tell + f.seek = seek
UnsupportedOperation seek while reading HTTP uri I am using imageio for a while, but since I upgraded to python 3.6, I have problems loading an image from an online location ``` imageio.imread(url) --------------------------------------------------------------------------- UnsupportedOperation Traceback (most recent call last) <ipython-input-33-cd9354e362f7> in <module>() ----> 1 imageio.imread(url) /usr/local/lib/python3.6/site-packages/imageio/core/functions.py in imread(uri, format, **kwargs) 185 reader = read(uri, format, 'i', **kwargs) 186 with reader: --> 187 return reader.get_data(0) 188 189 /usr/local/lib/python3.6/site-packages/imageio/core/format.py in get_data(self, index, **kwargs) 330 self._checkClosed() 331 self._BaseReaderWriter_last_index = index --> 332 im, meta = self._get_data(index, **kwargs) 333 return Image(im, meta) # Image tests im and meta 334 /usr/local/lib/python3.6/site-packages/imageio/plugins/pillow.py in _get_data(self, index) 300 301 def _get_data(self, index): --> 302 im, info = PillowFormat.Reader._get_data(self, index) 303 304 # Handle exif /usr/local/lib/python3.6/site-packages/imageio/plugins/pillow.py in _get_data(self, index) 113 i += 1 114 self._seek(i) --> 115 self._im.getdata()[0] 116 im = pil_get_frame(self._im, self._grayscale) 117 return im, self._im.info /usr/local/lib/python3.6/site-packages/PIL/Image.py in getdata(self, band) 1151 """ 1152 -> 1153 self.load() 1154 if band is not None: 1155 return self.im.getband(band) /usr/local/lib/python3.6/site-packages/PIL/ImageFile.py in load(self) 193 decoder = Image._getdecoder(self.mode, decoder_name, 194 args, self.decoderconfig) --> 195 seek(offset) 196 try: 197 decoder.setimage(self.im, extents) UnsupportedOperation: seek In [34]: ``` while a direct import would work: ``` import requests from PIL import Image url ='https://raw.githubusercontent.com/bicv/SLIP/master/database/serre07_targets/B_N107001.jpg' im = Image.open(requests.get(url, stream=True).raw) im.show() ``` my config is: ``` Python 3.6.0 64bit [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] IPython 5.1.0 OS Darwin 16.3.0 x86_64 i386 64bit numpy 1.12.0rc2 scipy 0.18.1 pillow 4.1.0.dev0 imageio 2.1.1dev ```
imageio/imageio
diff --git a/tests/test_pillow.py b/tests/test_pillow.py index d2e4668..5bb5931 100644 --- a/tests/test_pillow.py +++ b/tests/test_pillow.py @@ -147,7 +147,15 @@ def test_png(): assert s2 < s1 im2 = imageio.imread(fnamebase + '1.png') assert im2.dtype == np.uint16 - + + +def test_png_remote(): + # issue #202 + need_internet() + im = imageio.imread('https://raw.githubusercontent.com/imageio/' + + 'imageio-binaries/master/images/astronaut.png') + assert im.shape == (512, 512, 3) + def test_jpg():
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_media" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 1 }
2.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-xdist" ], "pre_install": [ "apt-get update", "apt-get install -y libfreeimage3" ], "python": "3.5", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 coverage==6.2 execnet==1.9.0 -e git+https://github.com/imageio/imageio.git@18721f19cef4a5448cfd54251c474800b6c89948#egg=imageio importlib-metadata==4.8.3 iniconfig==1.1.1 numpy==1.19.5 packaging==21.3 Pillow==8.4.0 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 pytest-cov==4.0.0 pytest-xdist==3.0.2 tomli==1.2.3 typing_extensions==4.1.1 zipp==3.6.0
name: imageio channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - coverage==6.2 - execnet==1.9.0 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - numpy==1.19.5 - packaging==21.3 - pillow==8.4.0 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-cov==4.0.0 - pytest-xdist==3.0.2 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/imageio
[ "tests/test_pillow.py::test_png_remote" ]
[]
[ "tests/test_pillow.py::test_pillow_format", "tests/test_pillow.py::test_png", "tests/test_pillow.py::test_jpg", "tests/test_pillow.py::test_jpg_more", "tests/test_pillow.py::test_gif", "tests/test_pillow.py::test_animated_gif" ]
[]
BSD 2-Clause "Simplified" License
967
[ "imageio/core/request.py" ]
[ "imageio/core/request.py" ]
kytos__python-openflow-240
558038f25ef5e85cf46dfa395c1c5262919b2850
2017-01-18 13:33:44
558038f25ef5e85cf46dfa395c1c5262919b2850
diff --git a/docs/.gitignore b/docs/.gitignore index 6b8dea0..5ce97da 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,1 +1,3 @@ +_rebuild +modules.rst python.inv diff --git a/pyof/foundation/network_types.py b/pyof/foundation/network_types.py index a538631..d91847c 100644 --- a/pyof/foundation/network_types.py +++ b/pyof/foundation/network_types.py @@ -67,7 +67,7 @@ class GenericTLV: """Create an instance and set its attributes.""" #: type (int): The Type of the TLV Structure self.type = tlv_type - #: value (int): The value of the TLV Structure + #: value (BinaryData): The value of the TLV Structure self._value = value @property @@ -78,7 +78,7 @@ class GenericTLV: @property def length(self): """Struct length in bytes.""" - return len(self.value.pack()) + return len(self._value.pack()) @property def header(self): @@ -101,7 +101,7 @@ class GenericTLV: """ if value is None: output = self.header.pack() - output += self.value.pack() + output += self._value.pack() return output elif isinstance(value, type(self)): @@ -129,7 +129,7 @@ class GenericTLV: self.type = header.value >> 9 length = header.value & 511 begin, end = offset + 2, offset + 2 + length - self.value = BinaryData(buffer[begin:end]) + self._value = BinaryData(buffer[begin:end]) def get_size(self, value=None): """Return struct size.""" diff --git a/requirements-dev.txt b/requirements-dev.txt index e8aacce..816c26a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,6 +2,7 @@ # For running doctests (during "python setup.py test") Sphinx >= 1.4.5 +sphinx_bootstrap_theme # Linters git+git://github.com/cemsbr/pylama_pylint.git@master diff --git a/setup.py b/setup.py index ca5e1f0..b6a20ef 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ descriptions. """ import sys from abc import abstractmethod -from subprocess import call, check_call +from subprocess import CalledProcessError, call, check_call from setuptools import Command, find_packages, setup @@ -15,11 +15,13 @@ from pyof import __version__ def lint(): """Run pylama and radon.""" files = 'tests setup.py pyof' - print('Pylama is running. It may take a while...') + print('Pylama is running. It may take several seconds...') cmd = 'pylama {}'.format(files) - check_call(cmd, shell=True) - print('Low grades (<= C) for Maintainability Index (if any):') - check_call('radon mi --min=C ' + files, shell=True) + try: + check_call(cmd, shell=True) + except CalledProcessError as e: + print('Please, fix linter errors above.') + sys.exit(e.returncode) class SimpleCommand(Command):
Error while migrating to python 3.6 While testing the full project on python 3.6 (running kyco against a mininet instance with 3 hosts and 3 switches, no loop version), the error below were throughed on the kytos console: > Exception in thread Thread-198: > Traceback (most recent call last): > File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner > self.run() > File "/usr/local/lib/python3.6/threading.py", line 864, in run > self._target(*self._args, **self._kwargs) > File "/home/diraol/devel/kyco/kyco/utils.py", line 70, in threaded_handler > handler(*args) > File "/home/diraol/.virtualenvs/python-openflow/var/lib/kytos/napps/kytos/of_lldp/main.py", line 78, in update_links > lldp.unpack(ethernet.data.value) > File "/home/diraol/devel/python-openflow/pyof/foundation/base.py", line 431, in unpack > size = self._unpack_attribute(name, value, buff, begin) > File "/home/diraol/devel/python-openflow/pyof/foundation/base.py", line 441, in _unpack_attribute > attribute.unpack(buff, begin) > File "/home/diraol/devel/python-openflow/pyof/foundation/network_types.py", line 132, in unpack > self.value = BinaryData(buffer[begin:end]) > AttributeError: can't set attribute @cemsbr, please, address this error as soon as possible so we can have the project working on Python 3.6 =)
kytos/python-openflow
diff --git a/tests/test_foundation/test_network_types.py b/tests/test_foundation/test_network_types.py new file mode 100644 index 0000000..747a862 --- /dev/null +++ b/tests/test_foundation/test_network_types.py @@ -0,0 +1,17 @@ +"""Test Python-openflow network types.""" +import unittest + +from pyof.foundation.basic_types import BinaryData +from pyof.foundation.network_types import GenericTLV + + +class TestNetworkTypes(unittest.TestCase): + """Reproduce bugs found.""" + + def test_GenTLV_value_unpack(self): + """Value attribute should be the same after unpacking.""" + value = BinaryData(b'test') + tlv = GenericTLV(value=value) + tlv_unpacked = GenericTLV() + tlv_unpacked.unpack(tlv.pack()) + self.assertEqual(tlv.value.value, tlv_unpacked.value.value)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 4 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip3 install python-openflow", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work packaging @ file:///croot/packaging_1734472117206/work pluggy @ file:///croot/pluggy_1733169602837/work pytest @ file:///croot/pytest_1738938843180/work python-openflow==2021.1 tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
name: python-openflow channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - python-openflow==2021.1 prefix: /opt/conda/envs/python-openflow
[ "tests/test_foundation/test_network_types.py::TestNetworkTypes::test_GenTLV_value_unpack" ]
[]
[]
[]
MIT License
968
[ "setup.py", "requirements-dev.txt", "pyof/foundation/network_types.py", "docs/.gitignore" ]
[ "setup.py", "requirements-dev.txt", "pyof/foundation/network_types.py", "docs/.gitignore" ]
conjure-up__conjure-up-613
930227d57a2f9b97f249524cf6591d533957514b
2017-01-18 16:14:09
33cca823b51a4f745145a7f5ecf0ceb0852f5bcf
diff --git a/README.md b/README.md index 305c191..f2f872f 100644 --- a/README.md +++ b/README.md @@ -17,30 +17,6 @@ solutions up and going with as little hindrance as possible. ## recommended -``` -$ sudo snap install conjure-up --edge --classic -``` - -## alternative installation - -### pre-reqs - -If you plan to use conjure-up to deploy onto LXD containers on your local -machine (aka the _localhost_ cloud type), you will need to set up LXD -beforehand, as this requires **sudo**. If you haven't done that, you can configure -storage and networking with: -``` -$ sudo dpkg-reconfigure -p medium lxd -``` - -> Note: Make sure that you select **NO** when asked to setup IPv6 as this not currently supported. - -..and wake up the lxd daemon with: - -``` -$ lxc finger -``` - Install the packages from the below PPA's ``` diff --git a/conjureup/controllers/lxdsetup/gui.py b/conjureup/controllers/lxdsetup/gui.py index 196ced0..65f55dd 100644 --- a/conjureup/controllers/lxdsetup/gui.py +++ b/conjureup/controllers/lxdsetup/gui.py @@ -80,12 +80,12 @@ class LXDSetupController: app.current_cloud = 'localhost' controllers.use('newcloud').render(bootstrap=True) - def render(self): + def render(self, msg): """ Render """ track_screen("LXD Setup") - self.view = LXDSetupView(app, - self.finish) + self.view = LXDSetupView(app, msg=msg, + cb=self.finish) app.ui.set_header( title="Setup LXD Bridge", diff --git a/conjureup/controllers/newcloud/gui.py b/conjureup/controllers/newcloud/gui.py index 4564d1b..17b0fcf 100644 --- a/conjureup/controllers/newcloud/gui.py +++ b/conjureup/controllers/newcloud/gui.py @@ -147,9 +147,26 @@ class NewCloudController: # information. if app.current_cloud == 'localhost': - if not utils.check_bridge_exists() or \ - not utils.check_user_in_group('lxd'): - return controllers.use('lxdsetup').render() + if not utils.check_bridge_exists(): + return controllers.use('lxdsetup').render( + "Unable to determine an existing LXD network bridge, " + "please make sure you've run `sudo lxd init` to configure " + "LXD." + ) + if not utils.check_user_in_group('lxd'): + return controllers.use('lxdsetup').render( + "{} is not part of the LXD group. You will need " + "to exit conjure-up and do one of the following: " + " 1: Run `newgrp lxd` and re-launch conjure-up\n" + " 2: Log out completely, Log in and " + "re-launch conjure-up".format(os.environ['USER'])) + if utils.lxd_has_ipv6(): + return controllers.use('lxdsetup').render( + "The LXD bridge has IPv6 enabled. Currently this is " + "unsupported by conjure-up. Please disable IPv6 and " + "re-launch conjure-up\n\n" + "Visit http://conjure-up.io/docs/en/users/#_lxd for " + "information on how to disable IPv6.") app.log.debug("Found an IPv4 address, " "assuming LXD is configured.") diff --git a/conjureup/ui/__init__.py b/conjureup/ui/__init__.py index 0cc2b71..7cbe6e1 100644 --- a/conjureup/ui/__init__.py +++ b/conjureup/ui/__init__.py @@ -23,7 +23,7 @@ class ConjureUI(Frame): errmsg += ("\n\n" "Review log messages at ~/.cache/conjure-up/conjure-up.log " "If appropriate, please submit a bug here: " - "https://bugs.launchpad.net/conjure-up/+filebug") + "https://github.com/conjure-up/conjure-up/issues/new") self.frame.body = ErrorView(errmsg) app.log.exception("Showing dialog for exception:") diff --git a/conjureup/ui/views/lxdsetup.py b/conjureup/ui/views/lxdsetup.py index 60bb8b3..74e1bf7 100644 --- a/conjureup/ui/views/lxdsetup.py +++ b/conjureup/ui/views/lxdsetup.py @@ -1,78 +1,18 @@ -from collections import OrderedDict - -from urwid import Columns, Filler, Pile, Text, WidgetWrap +from urwid import Filler, Pile, Text, WidgetWrap from ubuntui.utils import Color, Padding from ubuntui.widgets.buttons import cancel_btn, confirm_btn from ubuntui.widgets.hr import HR -from ubuntui.widgets.input import StringEditor, YesNo from ubuntui.widgets.text import Instruction -# import os - -# Network format -# -# { key: (Widget, Help Text)} - -NETWORK = OrderedDict([ - ('_USE_LXD_BRIDGE', - (YesNo(), - 'Use a new bridge')), - ('LXD_BRIDGE', - (StringEditor(default='lxdbr0'), - 'Bridge name')), - # ('_LXD_CONFILE', - # (StringEditor(), - # None)), - ('LXD_DOMAIN', - (StringEditor(default='lxd'), - 'DNS domain for the bridge')), - ('LXD_IPV4_ADDR', - (StringEditor(default='10.10.0.1'), - 'IPv4 Address (e.g. 10.10.0.1)')), - ('LXD_IPV4_NETMASK', - (StringEditor(default='255.255.255.0'), - 'IPv4 netmask (e.g. 255.255.255.0)')), - ('LXD_IPV4_NETWORK', - (StringEditor(default='10.10.0.1/24'), - 'IPv4 network (e.g. 10.10.0.1/24)')), - ('LXD_IPV4_DHCP_RANGE', - (StringEditor(default='10.10.0.2,10.10.0.254'), - 'IPv4 DHCP range (e.g. 10.10.0.2,10.10.0.254)')), - ('LXD_IPV4_DHCP_MAX', - (StringEditor(default='250'), - 'IPv4 DHCP number of hosts (e.g. 250)')), - ('LXD_IPV4_NAT', - (YesNo(), - 'NAT IPv4 traffic')) - # Enable this at some point - # ('_LXD_IPV6_ADDR', - # (StringEditor(), - # None)), - # ('_LXD_IPV6_MASK', - # (StringEditor(), - # None)), - # ('_LXD_IPV6_NETWORK', - # (StringEditor(), - # None)), - # ('_LXD_IPV6_NAT', - # (YesNo(), - # None)), - # ('_LXD_IPV6_PROXY', - # (YesNo(), - # None)) -]) - class LXDSetupView(WidgetWrap): - def __init__(self, app, cb): + def __init__(self, app, msg, cb): self.app = app - self.input_items = NETWORK + self.msg = msg self.cb = cb _pile = [ - # Padding.center_60(Instruction( - # "Enter LXD information:")), Padding.center_60(Instruction( "Please configure networking for LXD" )), @@ -106,50 +46,12 @@ class LXDSetupView(WidgetWrap): def build_info(self): items = [ - Text("There was no LXD bridge found on your system or " - "not part of the 'lxd' group which usually " - "means this is your first time running LXD."), - Padding.line_break(""), - Text("If you wish to do so now pressing confirm will drop you out " - "of the installer and you will be required to run the " - "following: \n\n" - " $ sudo lxd init\n" - " $ newgrp lxd\n" - " $ lxc finger\n\n" - "If `lxc finger` does not fail with an error you are ready " - "to re-run conjure-up and continue the installation.\n\n" - "NOTE: Do NOT setup a IPv6 subnet when asked, " - "only IPv4 subnets are supported.") + Text(self.msg) ] return Pile(items) - def build_inputs(self): - # FIXME: Skip this for now as we're shelling out to - # dpkg-reconfigure lxd :\ yay and such. - items = [] - for k in self.input_items.keys(): - widget, help_text = self.input_items[k] - if isinstance(widget.value, bool): - widget.set_default('Yes', True) - if k.startswith('_'): - # Don't treat 'private' keys as input - continue - col = Columns( - [ - ('weight', 0.5, Text(help_text, align='right')), - Color.string_input(widget, - focus_map='string_input focus') - ], dividechars=1 - ) - items.append(col) - items.append(Padding.line_break("")) - return Pile(items) - def cancel(self, btn): self.cb(back=True) def submit(self, result): - # os.execl("/usr/share/conjure-up/run-lxd-config", - # "/usr/share/conjure-up/run-lxd-config", - # self.app.config['spell']) self.cb(needs_lxd_setup=True) diff --git a/conjureup/utils.py b/conjureup/utils.py index 1f44695..2197707 100644 --- a/conjureup/utils.py +++ b/conjureup/utils.py @@ -13,7 +13,6 @@ from subprocess import ( check_output ) -import requests_unixsocket import yaml from termcolor import colored @@ -25,16 +24,6 @@ from conjureup.app_config import app from conjureup.telemetry import track_event -def is_snap_package_installed(pkg): - # snapd is not idempotent so we need to query first - snap_query = 'http+unix://%2Frun%2Fsnapd.socket/v2/snaps/{}'.format( - pkg) - with requests_unixsocket.Session() as session: - if session.get(snap_query).ok: - return True - return False - - def run(cmd, **kwargs): """ Compatibility function to support python 3.4 """ @@ -117,23 +106,41 @@ def run_attach(cmd, output_cb=None): subproc.returncode)) -def check_bridge_exists(): - """ Checks that an LXD network bridge exists +def lxd_version(): + """ Get current LXD version """ cmd = run_script('lxc version') if cmd.returncode == 0: - lxd_version = cmd.stdout.decode().strip() + return cmd.stdout.decode().strip() else: raise Exception("Could not determine LXD version.") - if lxd_version >= "2.4.0": + +def lxd_has_ipv6(): + """ Checks whether LXD bridge has IPv6 enabled + """ + if check_bridge_exists(): + if lxd_version() >= "2.4.0": + cmd = run_script('lxc network get lxdbr0 ipv6.nat') + else: + cmd = run_script('debconf-show lxd|grep bridge-ipv6-nat') + out = cmd.stdout.decode().strip() + if "true" in out: + return True + return False + + +def check_bridge_exists(): + """ Checks that an LXD network bridge exists + """ + if lxd_version() >= "2.4.0": try: run('lxc network list|grep -q bridge', shell=True, check=True) except CalledProcessError: return False return True - elif lxd_version < "2.4.0": + elif lxd_version() < "2.4.0": if os.path.isfile('/etc/default/lxd-bridge'): config_string = "[dummy]\n" with open('/etc/default/lxd-bridge') as f: diff --git a/debian/conjure-up.postinst b/debian/conjure-up.postinst index c08cb8e..9ceea86 100644 --- a/debian/conjure-up.postinst +++ b/debian/conjure-up.postinst @@ -1,9 +1,9 @@ #!/bin/sh -set -e +set -eu if [ ! -d /var/log/conjure-up ]; then - mkdir /var/log/conjure-up + mkdir /var/log/conjure-up fi chown syslog:syslog /var/log/conjure-up @@ -11,4 +11,38 @@ ln -sf /usr/share/conjure-up/conjure-up-rsyslog.conf /etc/rsyslog.d/99-conjure-u invoke-rc.d rsyslog restart -#DEBHELPER# \ No newline at end of file +# Do the manual steps a user has to run on a fresh system to get an lxd +# bridge so the juju lxd provider can function. Taken from changes made +# to cloud-init to do approximately this. + +VERSION=$(lxd --version) + +# LXD 2.3+ needs lxdbr0 setup via lxc. +if dpkg --compare-versions "$VERSION" gt "2.2"; then + if ! lxc network list | grep -q lxdbr0; then + # Configure a known address ranges for lxdbr0. + lxc network create lxdbr0 \ + ipv4.address=10.0.8.1/24 ipv4.nat=true \ + ipv6.address=none ipv6.nat=false + fi +else + if ! debconf-show lxd | grep -q 'bridge-ipv4:\strue'; then + debconf-communicate << EOF > /dev/null +set lxd/setup-bridge true +set lxd/bridge-domain lxd +set lxd/bridge-name lxdbr0 +set lxd/bridge-ipv4 true +set lxd/bridge-ipv4-address 10.0.8.1 +set lxd/bridge-ipv4-dhcp-first 10.0.8.3 +set lxd/bridge-ipv4-dhcp-last 10.0.8.254 +set lxd/bridge-ipv4-dhcp-leases 252 +set lxd/bridge-ipv4-netmask 24 +set lxd/bridge-ipv4-nat true +set lxd/bridge-ipv6 false +EOF + rm -rf /etc/default/lxd-bridge + dpkg-reconfigure lxd --frontend=noninteractive + fi +fi + +#DEBHELPER#
handle error if ipv6 is enabled and localhost was selected http://paste.ubuntu.com/23345012/ ``` conjure-up/_unspecified_spell: [ERROR] conjure-up/_unspecified_spell: ERROR creating LXD client: /etc/default/lxd-bridge has IPv6 enabled. Juju doesn't currently support IPv6. IPv6 can be disabled by running: sudo dpkg-reconfigure -p medium lxd and then bootstrap again. conjure-up/_unspecified_spell: [ERROR] conjure-up/_unspecified_spell: Showing dialog for exception: NoneType conjure-up/_unspecified_spell: [ERROR] conjure-up/_unspecified_spell: Showing dialog for exception: Traceback (most recent call last): File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3/dist-packages/conjureup/controllers/deploy/gui.py", line 30, in _pre_deploy_exec app.current_model)['provider-type'] File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 32, in _decorator login(force=True) File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 102, in login account = get_account(app.current_controller) File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 525, in get_account return get_accounts().get(controller, {}) File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 537, in get_accounts "Unable to find: {}".format(env)) Exception: Unable to find: /home/ubuntu/.local/share/juju/accounts.yaml conjure-up/_unspecified_spell: [ERROR] conjure-up/_unspecified_spell: Showing dialog for exception: Traceback (most recent call last): File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 32, in _decorator login(force=True) File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 102, in login account = get_account(app.current_controller) File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 525, in get_account return get_accounts().get(controller, {}) File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 537, in get_accounts "Unable to find: {}".format(env)) Exception: Unable to find: /home/ubuntu/.local/share/juju/accounts.yaml conjure-up/_unspecified_spell: [ERROR] conjure-up/_unspecified_spell: Showing dialog for exception: Traceback (most recent call last): File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3/dist-packages/conjureup/controllers/deploy/gui.py", line 30, in _pre_deploy_exec app.current_model)['provider-type'] File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 32, in _decorator login(force=True) File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 102, in login account = get_account(app.current_controller) File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 525, in get_account return get_accounts().get(controller, {}) File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 537, in get_accounts "Unable to find: {}".format(env)) Exception: Unable to find: /home/ubuntu/.local/share/juju/accounts.yaml conjure-up/_unspecified_spell: [ERROR] conjure-up/_unspecified_spell: Showing dialog for exception: Traceback (most recent call last): File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 32, in _decorator login(force=True) File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 102, in login account = get_account(app.current_controller) File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 525, in get_account return get_accounts().get(controller, {}) File "/usr/lib/python3/dist-packages/conjureup/juju.py", line 537, in get_accounts "Unable to find: {}".format(env)) Exception: Unable to find: /home/ubuntu/.local/share/juju/accounts.yaml ```
conjure-up/conjure-up
diff --git a/test/test_controllers_lxdsetup_gui.py b/test/test_controllers_lxdsetup_gui.py index c429aa4..80b7e1d 100644 --- a/test/test_controllers_lxdsetup_gui.py +++ b/test/test_controllers_lxdsetup_gui.py @@ -45,7 +45,7 @@ class LXDSetupGUIRenderTestCase(unittest.TestCase): def test_render(self): "call render" - self.controller.render() + self.controller.render("A message") class LXDSetupGUIFinishTestCase(unittest.TestCase):
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 7 }
2.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "nose", "tox", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 bson==0.5.10 certifi==2021.5.30 charset-normalizer==2.0.12 -e git+https://github.com/conjure-up/conjure-up.git@930227d57a2f9b97f249524cf6591d533957514b#egg=conjure_up distlib==0.3.9 filelock==3.4.1 idna==3.10 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig==1.1.1 Jinja2==3.0.3 juju-wait==2.8.4 MarkupSafe==2.0.1 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 petname==2.6 platformdirs==2.4.0 pluggy==1.0.0 prettytable==2.5.0 progressbar2==3.55.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 python-utils==3.5.2 PyYAML==6.0.1 q==2.7 requests==2.27.1 requests-oauthlib==2.0.0 requests-unixsocket==0.3.0 six==1.17.0 termcolor==1.1.0 toml==0.10.2 tomli==1.2.3 tox==3.28.0 typing_extensions==4.1.1 urllib3==1.26.20 urwid==2.1.2 virtualenv==20.17.1 wcwidth==0.2.13 ws4py==0.3.4 zipp==3.6.0
name: conjure-up channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - bson==0.5.10 - charset-normalizer==2.0.12 - distlib==0.3.9 - filelock==3.4.1 - idna==3.10 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - iniconfig==1.1.1 - jinja2==3.0.3 - juju-wait==2.8.4 - markupsafe==2.0.1 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - petname==2.6 - platformdirs==2.4.0 - pluggy==1.0.0 - prettytable==2.5.0 - progressbar2==3.55.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - python-utils==3.5.2 - pyyaml==6.0.1 - q==2.7 - requests==2.27.1 - requests-oauthlib==2.0.0 - requests-unixsocket==0.3.0 - six==1.17.0 - termcolor==1.1.0 - toml==0.10.2 - tomli==1.2.3 - tox==3.28.0 - typing-extensions==4.1.1 - urllib3==1.26.20 - urwid==2.1.2 - virtualenv==20.17.1 - wcwidth==0.2.13 - ws4py==0.3.4 - zipp==3.6.0 prefix: /opt/conda/envs/conjure-up
[ "test/test_controllers_lxdsetup_gui.py::LXDSetupGUIRenderTestCase::test_render" ]
[]
[ "test/test_controllers_lxdsetup_gui.py::LXDSetupGUIFinishTestCase::test_finish" ]
[]
MIT License
969
[ "conjureup/utils.py", "debian/conjure-up.postinst", "README.md", "conjureup/controllers/lxdsetup/gui.py", "conjureup/ui/views/lxdsetup.py", "conjureup/controllers/newcloud/gui.py", "conjureup/ui/__init__.py" ]
[ "conjureup/utils.py", "debian/conjure-up.postinst", "README.md", "conjureup/controllers/lxdsetup/gui.py", "conjureup/ui/views/lxdsetup.py", "conjureup/controllers/newcloud/gui.py", "conjureup/ui/__init__.py" ]
damnever__fmt-16
12cc50185a8ff90db1ac17f862568a4780fee774
2017-01-19 14:13:22
12cc50185a8ff90db1ac17f862568a4780fee774
diff --git a/fmt/fmt.py b/fmt/fmt.py index 019eab3..8344646 100644 --- a/fmt/fmt.py +++ b/fmt/fmt.py @@ -104,7 +104,7 @@ class Expression(Node): def __init__(self, expr, fmt, name='name'): self._expr = expr self._name = name - self._fmt = fmt.replace(expr, name).replace(' ', '') + self._fmt = name.join(s.strip() for s in fmt.split(expr)) def generate(self, namespace): ns = {} @@ -314,15 +314,37 @@ class Parser(object): # <optional : format specifier> # } <text> ...''' expr = None - splitd = node_str.rsplit(':', 1) - if len(splitd) > 1: - left, fmt_spec = splitd - if not fmt_spec: + if ':' in node_str: + if node_str.startswith('('): + brackets = 1 + for i, c in enumerate(node_str[1:]): + if c == '(': + brackets += 1 + elif c == ')': + brackets -= 1 + if brackets == 0: + break + i += 1 + if brackets != 0: + raise SyntaxError('unexpected EOF at {}'.format( + node_str[i])) + i += 1 + if len(node_str) > i+2 and node_str[i] == '(': + i += 2 + if node_str[i] != ':': + raise SyntaxError('unexpected EOF at {}'.format( + node_str[i])) + left, fmt_spec = node_str[:i], node_str[i+1:] + else: + left, fmt_spec = node_str, None + else: + left, fmt_spec = node_str.split(':', 1) + if 'lambda' in left: + left = node_str + if fmt_spec is not None and not fmt_spec: raise SyntaxError('need format specifier after ":"') - elif 'lambda' in left: - left = node_str else: - left = splitd[0] + left = node_str splitd = left.rsplit('!', 1) if len(splitd) > 1:
datetime format - `f('{datetime(1994, 11, 6, 0, 0, 0):%Y-%m-%d %H:%M:%S}')` - `f('{(lambda: datetime(1994, 11, 6, 0, 0, 0))():%Y-%m-%d %H:%M:%S}')`
damnever/fmt
diff --git a/tests/test_fmt.py b/tests/test_fmt.py index 19033b8..36b3765 100644 --- a/tests/test_fmt.py +++ b/tests/test_fmt.py @@ -133,6 +133,10 @@ def test_fmt(): f('int:{23:d}, hex:{23:x}, oct:{23:#o}, bin:{23:#b}')) assert '1,234,567,890' == f('{1234567890:,}') assert '1994-11-06' == f('{datetime(1994, 11, 6):%Y-%m-%d}') + assert '1994-11-06 00:00:00' == f('{datetime(1994, 11, 6, 0, 0, 0):%Y-%m-%d %H:%M:%S}') + assert 'None' == f('{(lambda: None)()}') + assert '1994:11:06' == f('{(lambda: datetime(1994, 11, 6))():%Y:%m:%d}') + assert '1994-11-06 00:00:00' == f('{(lambda: datetime(1994, 11, 6, 0, 0, 0))():%Y-%m-%d %H:%M:%S}') assert g_foo not in f._g_ns assert g_bar not in f._g_ns
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 1 }, "num_modified_files": 1 }
0.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "flake8", "pylint" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
astroid==3.3.9 dill==0.3.9 exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work flake8==7.2.0 -e git+https://github.com/damnever/fmt.git@12cc50185a8ff90db1ac17f862568a4780fee774#egg=fmt iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work isort==6.0.1 mccabe==0.7.0 packaging @ file:///croot/packaging_1734472117206/work platformdirs==4.3.7 pluggy @ file:///croot/pluggy_1733169602837/work pycodestyle==2.13.0 pyflakes==3.3.2 pylint==3.3.6 pytest @ file:///croot/pytest_1738938843180/work tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work tomlkit==0.13.2 typing_extensions==4.13.0
name: fmt channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - astroid==3.3.9 - dill==0.3.9 - flake8==7.2.0 - isort==6.0.1 - mccabe==0.7.0 - platformdirs==4.3.7 - pycodestyle==2.13.0 - pyflakes==3.3.2 - pylint==3.3.6 - tomlkit==0.13.2 - typing-extensions==4.13.0 prefix: /opt/conda/envs/fmt
[ "tests/test_fmt.py::test_fmt" ]
[]
[ "tests/test_fmt.py::test_parsed_nodes_been_cached", "tests/test_fmt.py::test_namespace", "tests/test_fmt.py::test_closure_namespace" ]
[]
BSD 3-Clause "New" or "Revised" License
970
[ "fmt/fmt.py" ]
[ "fmt/fmt.py" ]
sotetsuk__memozo-17
15ee64a59b7123bc3a7bab29f0b4345132502375
2017-01-20 03:06:25
15ee64a59b7123bc3a7bab29f0b4345132502375
diff --git a/memozo/memozo.py b/memozo/memozo.py index 4832552..a67bbe5 100644 --- a/memozo/memozo.py +++ b/memozo/memozo.py @@ -40,3 +40,39 @@ class Memozo(object): return _wrapper return wrapper + + def generator(self, name=None, ext='file'): + + def wrapper(func): + _name = func.__name__ if name is None else name + + @functools.wraps(func) + def _wrapper(*args, **kwargs): + # get cached data path + args = utils.get_bound_args(func, *args, **kwargs) + args_str = utils.get_args_str(args) + sha1 = utils.get_hash(_name, func.__name__, args_str) + file_path = os.path.join(self.base_path, "{}_{}.{}".format(_name, sha1, ext)) + + # if cached data exists, return generator using cached data + if utils.log_exisits(self.base_path, _name, func.__name__, args_str) and os.path.exists(file_path): + def gen_cached_data(): + with codecs.open(file_path, 'r', utils.ENCODING) as f: + for line in f: + yield line + return gen_cached_data + + gen = func(*args, **kwargs) + + # if no cached data exists, generator not only yield value but save value at each iteration + def generator_with_cache(gen, file_path): + with codecs.open(file_path, 'w', utils.ENCODING) as f: + for e in gen: + f.write(e) + yield e + + return generator_with_cache(gen, file_path) + + return _wrapper + + return wrapper
implement generator See #2
sotetsuk/memozo
diff --git a/tests/test_memozo.py b/tests/test_memozo.py index b47b5d2..41b3642 100644 --- a/tests/test_memozo.py +++ b/tests/test_memozo.py @@ -1,5 +1,6 @@ import os import unittest +import codecs from memozo import Memozo, utils @@ -70,4 +71,41 @@ class TestMemozoCall(unittest.TestCase): create_dummy_data(3) self.assertTrue(os.path.exists(file_path)) - os.remove(file_path) \ No newline at end of file + os.remove(file_path) + + +class TestMemozoGenerator(unittest.TestCase): + + def test_no_cache_output(self): + base_path = './tests/resources' + m = Memozo(base_path) + + @m.generator('gen_test') + def gen_test_func(): + for i in range(10): + if i % 3 == 0: + yield "{}\n".format(i) + + gen = gen_test_func() + for i in gen: + self.assertTrue(int(i.strip('\n')) % 3 == 0) + + def test_data_cached_collectly(self): + base_path = './tests/resources' + m = Memozo(base_path) + sha1 = utils.get_hash('gen_test', 'gen_test_func', '') + file_path = os.path.join(base_path, "{}_{}.{}".format('gen_test', sha1, 'file')) + + @m.generator('gen_test') + def gen_test_func(): + for i in range(10): + if i % 3 == 0: + yield "{}\n".format(i) + + gen1 = gen_test_func() + for _ in gen1: + continue + + with codecs.open(file_path, 'r', 'utf-8') as f: + for line in f: + self.assertTrue(int(line.strip('\n')) % 3 == 0)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_issue_reference" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 3, "test_score": 2 }, "num_modified_files": 1 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work -e git+https://github.com/sotetsuk/memozo.git@15ee64a59b7123bc3a7bab29f0b4345132502375#egg=memozo packaging @ file:///croot/packaging_1734472117206/work pluggy @ file:///croot/pluggy_1733169602837/work pytest @ file:///croot/pytest_1738938843180/work tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
name: memozo channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 prefix: /opt/conda/envs/memozo
[ "tests/test_memozo.py::TestMemozoGenerator::test_data_cached_collectly", "tests/test_memozo.py::TestMemozoGenerator::test_no_cache_output" ]
[]
[ "tests/test_memozo.py::TestMemozoCall::test_args", "tests/test_memozo.py::TestMemozoCall::test_call", "tests/test_memozo.py::TestMemozoCall::test_doc_string", "tests/test_memozo.py::TestMemozoCall::test_set_name" ]
[]
MIT License
972
[ "memozo/memozo.py" ]
[ "memozo/memozo.py" ]
sotetsuk__memozo-21
a0d0985f445279d2c0ae295e9488556cf6507f9f
2017-01-20 03:32:25
a0d0985f445279d2c0ae295e9488556cf6507f9f
diff --git a/memozo/memozo.py b/memozo/memozo.py index a67bbe5..e4e3311 100644 --- a/memozo/memozo.py +++ b/memozo/memozo.py @@ -76,3 +76,32 @@ class Memozo(object): return _wrapper return wrapper + + def pickle(self, name=None, ext='pickle', protocol=None): + + def wrapper(func): + _name = func.__name__ if name is None else name + + @functools.wraps(func) + def _wrapper(*args, **kwargs): + args = utils.get_bound_args(func, *args, **kwargs) + args_str = utils.get_args_str(args) + sha1 = utils.get_hash(_name, func.__name__, args_str) + file_path = os.path.join(self.base_path, "{}_{}.{}".format(_name, sha1, ext)) + + if utils.log_exisits(self.base_path, _name, func.__name__, args_str) and os.path.exists(file_path): + with open(file_path, 'rb') as f: + obj = pickle.load(f) + return obj + + obj = func(*args, **kwargs) + + with open(file_path, 'wb') as f: + pickle.dump(obj, f, protocol=protocol) + utils.write(self.base_path, _name, func.__name__, args_str) + + return obj + + return _wrapper + + return wrapper
implement pickle ```py @m.pickle() ```
sotetsuk/memozo
diff --git a/tests/test_memozo.py b/tests/test_memozo.py index e224e0a..4c39e59 100644 --- a/tests/test_memozo.py +++ b/tests/test_memozo.py @@ -1,6 +1,7 @@ import os import unittest import codecs +import pickle from memozo import Memozo, utils @@ -115,3 +116,30 @@ class TestMemozoGenerator(unittest.TestCase): def test_load_data_from_cache(self): # TODO(sotetsuk): WRITE THIS TEST pass + + +class TestMemozoPickle(unittest.TestCase): + + def test_no_cache_output(self): + base_path = './tests/resources' + m = Memozo(base_path) + + @m.pickle('pickle_test', protocol=pickle.HIGHEST_PROTOCOL) + def pickle_test_func(): + return {'a': 3, 'b': 5} + + expected = {'a': 3, 'b': 5} + actual = pickle_test_func() + self.assertTrue(actual == expected) + + sha1 = utils.get_hash('pickle_test', 'pickle_test_func', '') + file_path = os.path.join(base_path, "{}_{}.{}".format('pickle_test', sha1, 'pickle')) + os.remove(file_path) + + def test_data_cached_collectly(self): + # TODO(sotetsuk): WRITE THIS TEST + pass + + def test_load_data_from_cache(self): + # TODO(sotetsuk): WRITE THIS TEST + pass
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 3, "test_score": 2 }, "num_modified_files": 1 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work -e git+https://github.com/sotetsuk/memozo.git@a0d0985f445279d2c0ae295e9488556cf6507f9f#egg=memozo packaging @ file:///croot/packaging_1734472117206/work pluggy @ file:///croot/pluggy_1733169602837/work pytest @ file:///croot/pytest_1738938843180/work tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
name: memozo channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 prefix: /opt/conda/envs/memozo
[ "tests/test_memozo.py::TestMemozoPickle::test_no_cache_output" ]
[]
[ "tests/test_memozo.py::TestMemozoCall::test_args", "tests/test_memozo.py::TestMemozoCall::test_call", "tests/test_memozo.py::TestMemozoCall::test_doc_string", "tests/test_memozo.py::TestMemozoCall::test_set_name", "tests/test_memozo.py::TestMemozoGenerator::test_data_cached_collectly", "tests/test_memozo.py::TestMemozoGenerator::test_load_data_from_cache", "tests/test_memozo.py::TestMemozoGenerator::test_no_cache_output", "tests/test_memozo.py::TestMemozoPickle::test_data_cached_collectly", "tests/test_memozo.py::TestMemozoPickle::test_load_data_from_cache" ]
[]
MIT License
973
[ "memozo/memozo.py" ]
[ "memozo/memozo.py" ]
mapbox__mapbox-sdk-py-150
1481f35d31bf102a2affe97073694ae16e0c40a8
2017-01-21 10:04:01
1481f35d31bf102a2affe97073694ae16e0c40a8
diff --git a/CHANGES b/CHANGES index 3fcb802..d7154d0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,7 +1,9 @@ -Next ----- +0.11.0 (Soon) +------------- - Require boto3>=1.4 to get `upload_fileobj()`. - Add a callback function for AWS SDK uploads to `uploads.stage()` (#147). +- Allow configuration of API host using MAPBOX_HOST environment variable or + Service constructor keyword argument `host` (#143, #150). 0.10.1 (2016-11-22) ------------------- diff --git a/mapbox/services/base.py b/mapbox/services/base.py index 6b66533..421565e 100644 --- a/mapbox/services/base.py +++ b/mapbox/services/base.py @@ -32,13 +32,16 @@ def Session(access_token=None, env=os.environ): class Service(object): """Service base class.""" - def __init__(self, access_token=None, cache=None): + default_host = 'api.mapbox.com' + + def __init__(self, access_token=None, host=None, cache=None): """Constructs a Service object. :param access_token: Mapbox access token string. :param cache: CacheControl cache instance (Dict or FileCache). """ self.session = Session(access_token) + self.host = host or os.environ.get('MAPBOX_HOST', self.default_host) if cache: self.session = CacheControl(self.session, cache=cache) diff --git a/mapbox/services/datasets.py b/mapbox/services/datasets.py index c913fc3..921897b 100644 --- a/mapbox/services/datasets.py +++ b/mapbox/services/datasets.py @@ -7,14 +7,12 @@ from uritemplate import URITemplate from mapbox.services.base import Service -# Constants -BASE_URI = 'https://api.mapbox.com/datasets/v1' - - class Datasets(Service): """Access to the Datasets API.""" - baseuri = 'https://api.mapbox.com/datasets/v1' + @property + def baseuri(self): + return 'https://{0}/datasets/v1'.format(self.host) def _attribs(self, name=None, description=None): """Form an attributes dictionary from keyword args.""" @@ -94,7 +92,8 @@ class Datasets(Service): :param dataset: the dataset identifier string. """ uri = URITemplate(self.baseuri + '/{owner}/{id}/features').expand( - owner=self.username, id=dataset) + owner=self.username, id=dataset) + params = {} if reverse: params['reverse'] = 'true' diff --git a/mapbox/services/directions.py b/mapbox/services/directions.py index 9b6ba52..d6f6af3 100644 --- a/mapbox/services/directions.py +++ b/mapbox/services/directions.py @@ -8,13 +8,16 @@ from mapbox import errors class Directions(Service): """Access to the Directions API.""" - baseuri = 'https://api.mapbox.com/v4/directions' valid_profiles = ['mapbox.driving', 'mapbox.cycling', 'mapbox.walking'] valid_instruction_formats = ['text', 'html'] valid_geom_encoding = ['geojson', 'polyline', 'false'] + @property + def baseuri(self): + return 'https://{0}/v4/directions'.format(self.host) + def _validate_profile(self, profile): if profile not in self.valid_profiles: raise errors.InvalidProfileError( diff --git a/mapbox/services/distance.py b/mapbox/services/distance.py index 7b89121..be27a34 100644 --- a/mapbox/services/distance.py +++ b/mapbox/services/distance.py @@ -8,9 +8,12 @@ from mapbox.services.base import Service class Distance(Service): """Access to the Distance API.""" - baseuri = 'https://api.mapbox.com/distances/v1/mapbox' valid_profiles = ['driving', 'cycling', 'walking'] + @property + def baseuri(self): + return 'https://{0}/distances/v1/mapbox'.format(self.host) + def _validate_profile(self, profile): if profile not in self.valid_profiles: raise InvalidProfileError( diff --git a/mapbox/services/geocoding.py b/mapbox/services/geocoding.py index 8c66aba..85c03c7 100644 --- a/mapbox/services/geocoding.py +++ b/mapbox/services/geocoding.py @@ -9,9 +9,12 @@ from mapbox.services.base import Service class Geocoder(Service): """Access to the Geocoding API.""" - baseuri = 'https://api.mapbox.com/geocoding/v5' precision = {'reverse': 5, 'proximity': 3} + @property + def baseuri(self): + return 'https://{0}/geocoding/v5'.format(self.host) + def __init__(self, name='mapbox.places', access_token=None, cache=None): """Constructs a Geocoding Service object. diff --git a/mapbox/services/mapmatching.py b/mapbox/services/mapmatching.py index 6a68b96..cec6acc 100644 --- a/mapbox/services/mapmatching.py +++ b/mapbox/services/mapmatching.py @@ -9,9 +9,12 @@ from mapbox.services.base import Service class MapMatcher(Service): """Access to the Map Matching API.""" - baseuri = 'https://api.mapbox.com/matching/v4' valid_profiles = ['mapbox.driving', 'mapbox.cycling', 'mapbox.walking'] + @property + def baseuri(self): + return 'https://{0}/matching/v4'.format(self.host) + def _validate_profile(self, profile): if profile not in self.valid_profiles: raise errors.InvalidProfileError( diff --git a/mapbox/services/static.py b/mapbox/services/static.py index 5f81a88..fe5a9fb 100644 --- a/mapbox/services/static.py +++ b/mapbox/services/static.py @@ -10,7 +10,9 @@ from mapbox.utils import normalize_geojson_featurecollection class Static(Service): """Access to the Static Map API.""" - baseuri = 'https://api.mapbox.com/v4' + @property + def baseuri(self): + return 'https://{0}/v4'.format(self.host) def _validate_lat(self, val): if val < -85.0511 or val > 85.0511: diff --git a/mapbox/services/surface.py b/mapbox/services/surface.py index aabbc18..8c69073 100644 --- a/mapbox/services/surface.py +++ b/mapbox/services/surface.py @@ -7,7 +7,9 @@ from mapbox.services.base import Service class Surface(Service): """Access to the Surface API.""" - baseuri = 'https://api.mapbox.com/v4/surface' + @property + def baseuri(self): + return 'https://{0}/v4/surface'.format(self.host) def surface(self, features, diff --git a/mapbox/services/uploads.py b/mapbox/services/uploads.py index 3e765a0..1fe1f2f 100644 --- a/mapbox/services/uploads.py +++ b/mapbox/services/uploads.py @@ -27,7 +27,9 @@ class Uploader(Service): assert job not in u.list().json() """ - baseuri = 'https://api.mapbox.com/uploads/v1' + @property + def baseuri(self): + return 'https://{0}/uploads/v1'.format(self.host) def _get_credentials(self): """Gets temporary S3 credentials to stage user-uploaded files diff --git a/mapbox/utils.py b/mapbox/utils.py index b811212..ad53c69 100644 --- a/mapbox/utils.py +++ b/mapbox/utils.py @@ -1,5 +1,6 @@ from collections import Mapping, Sequence + def normalize_geojson_featurecollection(obj): """Takes a geojson-like mapping representing geometry, Feature or FeatureCollection (or a sequence of such objects)
Configurable baseuri Currently, the endpoint for all services is hardcoded for each service as `baseuri` ``` mapbox/services/datasets.py: baseuri = 'https://api.mapbox.com/datasets/v1' mapbox/services/directions.py: baseuri = 'https://api.mapbox.com/v4/directions' mapbox/services/distance.py: baseuri = 'https://api.mapbox.com/distances/v1/mapbox' mapbox/services/geocoding.py: baseuri = 'https://api.mapbox.com/geocoding/v5' mapbox/services/mapmatching.py: baseuri = 'https://api.mapbox.com/matching/v4' mapbox/services/static.py: baseuri = 'https://api.mapbox.com/v4' mapbox/services/surface.py: baseuri = 'https://api.mapbox.com/v4/surface' mapbox/services/uploads.py: baseuri = 'https://api.mapbox.com/uploads/v1' ``` There is a need for changing this in order to hit staging/testing endpoints that implement the same services. Ideally we'd have a true base URI (defaulting to `https://api.mapbox.com/`) that was easily configurable from any service class. Something like... ``` >>> service = mapbox.Upload() >>> service.base = 'http://my-local-test-server/' >>> service.baseuri http://my-local-test-server/uploads/v1 ``` Are there other mechanisms for changing the base uri? What about environment variables? We'll also want to plan the corresponding flags in the command line interface.
mapbox/mapbox-sdk-py
diff --git a/tests/test_base.py b/tests/test_base.py index 24f2b57..2025043 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -85,6 +85,17 @@ def test_username(monkeypatch): assert service.username == 'testuser' +def test_default_host(): + service = base.Service() + assert service.host == 'api.mapbox.com' + + +def test_configured_host(monkeypatch): + monkeypatch.setenv('MAPBOX_HOST', 'example.com') + service = base.Service() + assert service.host == 'example.com' + + def test_username_failures(monkeypatch): monkeypatch.delenv('MAPBOX_ACCESS_TOKEN', raising=False) monkeypatch.delenv('MapboxAccessToken', raising=False)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 11 }
0.10
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[test]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.5", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work boto3==1.23.10 botocore==1.26.10 CacheControl==0.12.14 certifi==2021.5.30 charset-normalizer==2.0.12 click==8.0.4 click-plugins==1.1.1 cligj==0.7.2 coverage==6.2 coveralls==3.3.1 distlib==0.3.9 docopt==0.6.2 filelock==3.4.1 idna==3.10 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work iso3166==2.1.1 jmespath==0.10.0 -e git+https://github.com/mapbox/mapbox-sdk-py.git@1481f35d31bf102a2affe97073694ae16e0c40a8#egg=mapbox more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work msgpack==1.0.5 packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work platformdirs==2.4.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work polyline==1.4.0 py @ file:///opt/conda/conda-bld/py_1644396412707/work pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 pytest-cov==4.0.0 python-dateutil==2.9.0.post0 requests==2.27.1 responses==0.17.0 s3transfer==0.5.2 six==1.17.0 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tomli==1.2.3 tox==3.28.0 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work uritemplate==4.1.1 urllib3==1.26.20 virtualenv==20.17.1 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: mapbox-sdk-py channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - boto3==1.23.10 - botocore==1.26.10 - cachecontrol==0.12.14 - charset-normalizer==2.0.12 - click==8.0.4 - click-plugins==1.1.1 - cligj==0.7.2 - coverage==6.2 - coveralls==3.3.1 - distlib==0.3.9 - docopt==0.6.2 - filelock==3.4.1 - idna==3.10 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - iso3166==2.1.1 - jmespath==0.10.0 - msgpack==1.0.5 - platformdirs==2.4.0 - polyline==1.4.0 - pytest-cov==4.0.0 - python-dateutil==2.9.0.post0 - requests==2.27.1 - responses==0.17.0 - s3transfer==0.5.2 - six==1.17.0 - tomli==1.2.3 - tox==3.28.0 - uritemplate==4.1.1 - urllib3==1.26.20 - virtualenv==20.17.1 prefix: /opt/conda/envs/mapbox-sdk-py
[ "tests/test_base.py::test_default_host", "tests/test_base.py::test_configured_host" ]
[]
[ "tests/test_base.py::test_service_session", "tests/test_base.py::test_service_session_env", "tests/test_base.py::test_service_session_os_environ", "tests/test_base.py::test_service_session_os_environ_caps", "tests/test_base.py::test_service_session_os_environ_precedence", "tests/test_base.py::test_user_agent", "tests/test_base.py::test_custom_messages", "tests/test_base.py::test_username", "tests/test_base.py::test_username_failures" ]
[]
MIT License
974
[ "mapbox/services/base.py", "mapbox/services/distance.py", "mapbox/services/directions.py", "mapbox/services/surface.py", "mapbox/services/geocoding.py", "mapbox/services/datasets.py", "CHANGES", "mapbox/utils.py", "mapbox/services/mapmatching.py", "mapbox/services/static.py", "mapbox/services/uploads.py" ]
[ "mapbox/services/base.py", "mapbox/services/distance.py", "mapbox/services/directions.py", "mapbox/services/surface.py", "mapbox/services/geocoding.py", "mapbox/services/datasets.py", "CHANGES", "mapbox/utils.py", "mapbox/services/mapmatching.py", "mapbox/services/static.py", "mapbox/services/uploads.py" ]
PyCQA__mccabe-47
682145a37fee41fe7b6640244faa0c3f58e3b496
2017-01-22 19:43:39
682145a37fee41fe7b6640244faa0c3f58e3b496
diff --git a/mccabe.py b/mccabe.py index 305fb94..c604c1d 100644 --- a/mccabe.py +++ b/mccabe.py @@ -160,10 +160,11 @@ class PathGraphingAstVisitor(ASTVisitor): name = "Stmt %d" % lineno self.appendPathNode(name) - visitAssert = visitAssign = visitAugAssign = visitDelete = visitPrint = \ - visitRaise = visitYield = visitImport = visitCall = visitSubscript = \ - visitPass = visitContinue = visitBreak = visitGlobal = visitReturn = \ - visitAwait = visitSimpleStatement + def default(self, node): + if isinstance(node, ast.stmt): + self.visitSimpleStatement(node) + else: + super(PathGraphingAstVisitor, self).default(node) def visitLoop(self, node): name = "Loop %d" % node.lineno
Trivial function with docstring reports complexity of 2 ```python def f(): """hi""" x = 1 def g(): """hi""" ``` ``` $ python3.5 mccabe.py test.py 1:0: 'f' 1 6:0: 'g' 2 ``` ``` $ git rev-parse HEAD 682145a37fee41fe7b6640244faa0c3f58e3b496 ```
PyCQA/mccabe
diff --git a/test_mccabe.py b/test_mccabe.py index 44fb565..3b8fcce 100644 --- a/test_mccabe.py +++ b/test_mccabe.py @@ -16,6 +16,12 @@ from mccabe import get_code_complexity trivial = 'def f(): pass' +expr_as_statement = '''\ +def f(): + """docstring""" +''' + + sequential = """\ def f(n): k = n + 4 @@ -176,6 +182,10 @@ class McCabeTestCase(unittest.TestCase): printed_message = self.strio.getvalue() self.assertEqual(printed_message, "") + def test_expr_as_statement(self): + complexity = get_complexity_number(expr_as_statement, self.strio) + self.assertEqual(complexity, 1) + def test_try_else(self): self.assert_complexity(try_else, 4)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_git_commit_hash" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 1 }
0.5
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work -e git+https://github.com/PyCQA/mccabe.git@682145a37fee41fe7b6640244faa0c3f58e3b496#egg=mccabe packaging @ file:///croot/packaging_1734472117206/work pluggy @ file:///croot/pluggy_1733169602837/work pytest @ file:///croot/pytest_1738938843180/work tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
name: mccabe channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 prefix: /opt/conda/envs/mccabe
[ "test_mccabe.py::McCabeTestCase::test_expr_as_statement" ]
[]
[ "test_mccabe.py::McCabeTestCase::test_async_keywords", "test_mccabe.py::McCabeTestCase::test_for_else_snippet", "test_mccabe.py::McCabeTestCase::test_for_loop_snippet", "test_mccabe.py::McCabeTestCase::test_if_elif_else_dead_path_snippet", "test_mccabe.py::McCabeTestCase::test_nested_functions_snippet", "test_mccabe.py::McCabeTestCase::test_print_message", "test_mccabe.py::McCabeTestCase::test_recursive_snippet", "test_mccabe.py::McCabeTestCase::test_sequential_snippet", "test_mccabe.py::McCabeTestCase::test_sequential_unencapsulated_snippet", "test_mccabe.py::McCabeTestCase::test_trivial", "test_mccabe.py::McCabeTestCase::test_try_else", "test_mccabe.py::RegressionTests::test_max_complexity_is_always_an_int" ]
[]
Expat License
975
[ "mccabe.py" ]
[ "mccabe.py" ]
conjure-up__conjure-up-619
fd4ccd29a9b6198364738f3ff9e8f8ab63fa0344
2017-01-23 16:55:46
33cca823b51a4f745145a7f5ecf0ceb0852f5bcf
mikemccracken: A couple minor comments: I think maybe the model name should include 'conjure-up' also, so when you conjure-up and use a preexisting controller, you still know that the model came from conjure-up. It might also be nice to include cloud type in the controller name, like 'conjure-up-aws'. Also I don't think we need more than 3-4 digits of random UUID string. You get 8 from the code you wrote, maybe just truncate it? Someone's going to end up typing the whole thing and get mad.. battlemidget: @mikemccracken updated based on your suggestions battlemidget: @mikemccracken should be ready for review and merge, test deploys reflects both the updated controller and models
diff --git a/README.md b/README.md index f2f872f..7521e7c 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,15 @@ $ sudo apt update $ sudo apt install conjure-up ``` +## alternate (soon to be recommended) + +We will be switching over to a snap based installation in the very near future. +Please help us test this out by installing via `snap` command: + +``` +$ sudo snap install conjure-up --classic --edge +``` + # how to use ## Run the installer interactively diff --git a/conjureup/controllers/controllerpicker/gui.py b/conjureup/controllers/controllerpicker/gui.py index 3ace007..0469bd5 100644 --- a/conjureup/controllers/controllerpicker/gui.py +++ b/conjureup/controllers/controllerpicker/gui.py @@ -1,6 +1,4 @@ -import petname - -from conjureup import async, controllers, juju +from conjureup import async, controllers, juju, utils from conjureup.app_config import app from conjureup.telemetry import track_exception, track_screen from conjureup.ui.views.ControllerListView import ControllerListView @@ -23,7 +21,9 @@ class ControllerPicker: return controllers.use('clouds').render() app.current_controller = controller - app.current_model = petname.Name() + app.current_model = "conjure-up-{}-{}".format( + app.env['CONJURE_UP_SPELL'], + utils.gen_hash()) async.submit(self.__add_model, self.__handle_exception, queue_name=juju.JUJU_ASYNC_QUEUE) diff --git a/conjureup/controllers/newcloud/gui.py b/conjureup/controllers/newcloud/gui.py index 17b0fcf..ab118c3 100644 --- a/conjureup/controllers/newcloud/gui.py +++ b/conjureup/controllers/newcloud/gui.py @@ -4,8 +4,6 @@ import os.path as path from functools import partial from subprocess import check_output -import petname - from conjureup import async, controllers, juju, utils from conjureup.api.models import model_info from conjureup.app_config import app @@ -57,6 +55,7 @@ class NewCloudController: future = juju.bootstrap_async( controller=app.current_controller, cloud=cloud, + model=app.current_model, credential=credential, exc_cb=self.__handle_exception) app.bootstrap.running = future @@ -136,10 +135,14 @@ class NewCloudController: track_screen("Cloud Creation") if app.current_controller is None: - app.current_controller = petname.Name() + app.current_controller = "conjure-up-{}-{}".format( + app.current_cloud, + utils.gen_hash()) if app.current_model is None: - app.current_model = 'conjure-up' + app.current_model = "conjure-up-{}-{}".format( + app.env['CONJURE_UP_SPELL'], + utils.gen_hash()) # LXD is a special case as we want to make sure a bridge # is configured. If not we'll bring up a new view to allow diff --git a/conjureup/controllers/newcloud/tui.py b/conjureup/controllers/newcloud/tui.py index fb0f3c9..540a7c7 100644 --- a/conjureup/controllers/newcloud/tui.py +++ b/conjureup/controllers/newcloud/tui.py @@ -3,8 +3,6 @@ import os import sys from subprocess import PIPE -import petname - from conjureup import controllers, juju, utils from conjureup.api.models import model_info from conjureup.app_config import app @@ -45,12 +43,15 @@ class NewCloudController: return controllers.use('deploy').render() def render(self): - if app.current_controller is None: - app.current_controller = petname.Name() + app.current_controller = "conjure-up-{}-{}".format( + app.current_cloud, + utils.gen_hash()) if app.current_model is None: - app.current_model = 'conjure-up' + app.current_model = "conjure-up-{}-{}".format( + app.env['CONJURE_UP_SPELL'], + utils.gen_hash()) if app.current_cloud != 'localhost': if not common.try_get_creds(app.current_cloud): @@ -72,6 +73,7 @@ class NewCloudController: utils.info("Bootstrapping Juju controller") p = juju.bootstrap(controller=app.current_controller, cloud=app.current_cloud, + model=app.current_model, credential=common.try_get_creds(app.current_cloud)) if p.returncode != 0: pathbase = os.path.join( diff --git a/conjureup/juju.py b/conjureup/juju.py index 784ef24..8fbd18f 100644 --- a/conjureup/juju.py +++ b/conjureup/juju.py @@ -139,7 +139,8 @@ def login(force=False): this.IS_AUTHENTICATED = True # noqa -def bootstrap(controller, cloud, series="xenial", credential=None): +def bootstrap(controller, cloud, model='conjure-up', series="xenial", + credential=None): """ Performs juju bootstrap If not LXD pass along the newly defined credentials @@ -155,7 +156,7 @@ def bootstrap(controller, cloud, series="xenial", credential=None): "--config image-stream=daily ".format( cloud, controller) cmd += "--config enable-os-upgrade=false " - cmd += "--default-model conjure-up " + cmd += "--default-model {} ".format(model) if app.argv.http_proxy: cmd += "--config http-proxy={} ".format(app.argv.http_proxy) if app.argv.https_proxy: @@ -204,12 +205,14 @@ def bootstrap(controller, cloud, series="xenial", credential=None): raise e -def bootstrap_async(controller, cloud, credential=None, exc_cb=None): +def bootstrap_async(controller, cloud, model='conjure-up', credential=None, + exc_cb=None): """ Performs a bootstrap asynchronously """ return async.submit(partial(bootstrap, controller=controller, cloud=cloud, + model=model, credential=credential), exc_cb, queue_name=JUJU_ASYNC_QUEUE) diff --git a/conjureup/ui/views/bootstrapwait.py b/conjureup/ui/views/bootstrapwait.py index 15a9d7f..f6277ff 100644 --- a/conjureup/ui/views/bootstrapwait.py +++ b/conjureup/ui/views/bootstrapwait.py @@ -33,7 +33,7 @@ class BootstrapWaitView(WidgetWrap): sanitize = "".join(ch for ch in t if unicodedata.category(ch)[0] != "C") if sanitize.endswith("%"): - new_out.append(sanitize.split("%")[0]) + new_out.append("{}%".format(sanitize.split("%")[0])) else: new_out.append(sanitize) if len(new_out) >= 10: @@ -66,7 +66,7 @@ class BootstrapWaitView(WidgetWrap): text = [Padding.line_break(""), self.message, Padding.line_break(""), - self.output, + Padding.center_90(self.output), Padding.line_break("")] _boxes = [] diff --git a/conjureup/utils.py b/conjureup/utils.py index 2197707..df24e3a 100644 --- a/conjureup/utils.py +++ b/conjureup/utils.py @@ -4,6 +4,7 @@ import errno import os import pty import shutil +import uuid from subprocess import ( DEVNULL, PIPE, @@ -355,3 +356,9 @@ def get_options_whitelist(service_name): svc_opts_whitelist = options_whitelist.get(service_name, []) return svc_opts_whitelist + + +def gen_hash(): + """ generates a UUID + """ + return str(uuid.uuid4()).split('-')[0][:3]
conjure-up uses petname for model name conjure-up apparently uses single-word petnames for Juju models it creates, e.g.: ``` | james@malefic:~$ juju models | Controller: lxd | | Model Cloud/Region Status Machines Cores Access Last connection | controller localhost/localhost available 1 - admin just now | default localhost/localhost available 0 - admin 2017-01-02 | dane* localhost/localhost available 4 - admin 6 minutes ago | | james@malefic:~$ ``` A bare pet name is pretty confusing and would only get more so if you conjured up multiple spells. At a minimum, I think the spell should be indicated in some way in the model name (perhaps combined with a petname, if you need to avoid clashes). It might also be useful to indicate in some way that this is a conjure-up model?
conjure-up/conjure-up
diff --git a/test/test_controllers_newcloud_tui.py b/test/test_controllers_newcloud_tui.py index f570b25..941177f 100644 --- a/test/test_controllers_newcloud_tui.py +++ b/test/test_controllers_newcloud_tui.py @@ -63,11 +63,13 @@ class NewCloudTUIRenderTestCase(unittest.TestCase): self.mock_common.try_get_creds.return_value = True self.mock_app.current_controller = sentinel.controllername self.mock_app.current_cloud = sentinel.cloudname + self.mock_app.current_model = sentinel.modelname self.mock_juju.bootstrap.return_value.returncode = 0 self.controller.render() self.mock_juju.bootstrap.assert_called_once_with( controller=sentinel.controllername, cloud=sentinel.cloudname, + model=sentinel.modelname, credential=True) self.controller.do_post_bootstrap.assert_called_once_with()
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 7 }
2.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "nose", "tox", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 -e git+https://github.com/conjure-up/conjure-up.git@fd4ccd29a9b6198364738f3ff9e8f8ab63fa0344#egg=conjure_up distlib==0.3.9 filelock==3.4.1 idna==3.10 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig==1.1.1 Jinja2==3.0.3 juju-wait==2.8.4 MarkupSafe==2.0.1 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 petname==2.6 platformdirs==2.4.0 pluggy==1.0.0 prettytable==2.5.0 progressbar2==3.55.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 python-utils==3.5.2 PyYAML==6.0.1 q==2.7 requests==2.27.1 requests-oauthlib==2.0.0 requests-unixsocket==0.3.0 six==1.17.0 termcolor==1.1.0 toml==0.10.2 tomli==1.2.3 tox==3.28.0 typing_extensions==4.1.1 urllib3==1.26.20 urwid==2.1.2 virtualenv==20.17.1 wcwidth==0.2.13 ws4py==0.3.4 zipp==3.6.0
name: conjure-up channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - charset-normalizer==2.0.12 - distlib==0.3.9 - filelock==3.4.1 - idna==3.10 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - iniconfig==1.1.1 - jinja2==3.0.3 - juju-wait==2.8.4 - markupsafe==2.0.1 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - petname==2.6 - platformdirs==2.4.0 - pluggy==1.0.0 - prettytable==2.5.0 - progressbar2==3.55.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-utils==3.5.2 - pyyaml==6.0.1 - q==2.7 - requests==2.27.1 - requests-oauthlib==2.0.0 - requests-unixsocket==0.3.0 - six==1.17.0 - termcolor==1.1.0 - toml==0.10.2 - tomli==1.2.3 - tox==3.28.0 - typing-extensions==4.1.1 - urllib3==1.26.20 - urwid==2.1.2 - virtualenv==20.17.1 - wcwidth==0.2.13 - ws4py==0.3.4 - zipp==3.6.0 prefix: /opt/conda/envs/conjure-up
[ "test/test_controllers_newcloud_tui.py::NewCloudTUIRenderTestCase::test_render" ]
[]
[ "test/test_controllers_newcloud_tui.py::NewCloudTUIRenderTestCase::test_render_non_localhost_no_creds", "test/test_controllers_newcloud_tui.py::NewCloudTUIRenderTestCase::test_render_non_localhost_with_creds", "test/test_controllers_newcloud_tui.py::NewCloudTUIFinishTestCase::test_finish" ]
[]
MIT License
976
[ "conjureup/utils.py", "conjureup/juju.py", "README.md", "conjureup/ui/views/bootstrapwait.py", "conjureup/controllers/newcloud/gui.py", "conjureup/controllers/newcloud/tui.py", "conjureup/controllers/controllerpicker/gui.py" ]
[ "conjureup/utils.py", "conjureup/juju.py", "README.md", "conjureup/ui/views/bootstrapwait.py", "conjureup/controllers/newcloud/gui.py", "conjureup/controllers/newcloud/tui.py", "conjureup/controllers/controllerpicker/gui.py" ]
SciLifeLab__genologics-190
dc79dc55dc1218582f30a5e76e9a0fff428cbf30
2017-01-24 13:06:46
dc79dc55dc1218582f30a5e76e9a0fff428cbf30
diff --git a/genologics/entities.py b/genologics/entities.py index 3cdef28..89c4fd9 100644 --- a/genologics/entities.py +++ b/genologics/entities.py @@ -297,10 +297,12 @@ class Entity(object): self.lims.post(self.uri, data) @classmethod - def create(cls, lims, **kwargs): - """Create an instance from attributes then post it to the LIMS""" + def _create(cls, lims, creation_tag=None, **kwargs): + """Create an instance from attributes and return it""" instance = cls(lims, _create_new=True) - if cls._TAG: + if creation_tag: + instance.root = ElementTree.Element(nsmap(cls._PREFIX + ':' + creation_tag)) + elif cls._TAG: instance.root = ElementTree.Element(nsmap(cls._PREFIX + ':' + cls._TAG)) else: instance.root = ElementTree.Element(nsmap(cls._PREFIX + ':' + cls.__name__.lower())) @@ -309,6 +311,13 @@ class Entity(object): setattr(instance, attribute, kwargs.get(attribute)) else: raise TypeError("%s create: got an unexpected keyword argument '%s'" % (cls.__name__, attribute)) + + return instance + + @classmethod + def create(cls, lims, creation_tag=None, **kwargs): + """Create an instance from attributes then post it to the LIMS""" + instance = cls._create(lims, creation_tag=None, **kwargs) data = lims.tostring(ElementTree.ElementTree(instance.root)) instance.root = lims.post(uri=lims.get_uri(cls._URI), data=data) instance._uri = instance.root.attrib['uri'] @@ -412,6 +421,23 @@ class Sample(Entity): # biosource XXX + @classmethod + def create(cls, lims, container, position, **kwargs): + """Create an instance of Sample from attributes then post it to the LIMS""" + if not isinstance(container, Container): + raise TypeError('%s is not of type Container'%container) + instance = super(Sample, cls)._create(lims, creation_tag='samplecreation', **kwargs) + + location = ElementTree.SubElement(instance.root, 'location') + ElementTree.SubElement(location, 'container', dict(uri=container.uri)) + position_element = ElementTree.SubElement(location, 'value') + position_element.text = position + data = lims.tostring(ElementTree.ElementTree(instance.root)) + instance.root = lims.post(uri=lims.get_uri(cls._URI), data=data) + instance._uri = instance.root.attrib['uri'] + return instance + + class Containertype(Entity): "Type of container for analyte artifacts." diff --git a/genologics/version.py b/genologics/version.py index 613e29a..58caa73 100644 --- a/genologics/version.py +++ b/genologics/version.py @@ -1,1 +1,1 @@ -__version__="0.3.8" +__version__="0.3.9"
Create new samples Hi guys! I was wondering how it would be possible to create new samples using the REST API. I got it working using this package but it required some hacking. Perhaps I'm missing something.. Are you using the API to do something like that? This is briefly my approach: 1. The API needs a "location" reference with a container on sample level so I borrow some code from `create` and add the extra stuff in the XML code: ```python lims_sample = Sample(lims=lims, _create_new=True) uhmmm = "{}:{}".format(Sample._PREFIX, Sample.__name__.lower()) lims_sample.root = ElementTree.Element(nsmap(uhmmm)) lims_sample.name = name lims_sample.project = lims_project location = ElementTree.SubElement(lims_sample.root, 'location') ElementTree.SubElement(location, 'container', dict(uri=lims_container.uri)) position_element = ElementTree.SubElement(location, 'value') position_element.text = position ``` 2. To save a sample you need to use the "smp:samplecreation" tag (or whatever it's called) so I have to modify the data string before posting: ```python data = lims.tostring(ElementTree.ElementTree(lims_sample.root)) data = data.decode('utf-8').replace('smp:sample', 'smp:samplecreation') lims_sample.root = lims.post(uri=lims.get_uri(Sample._URI), data=data) lims_sample._uri = lims_sample.root.attrib['uri'] ``` Just wanted to share the research I did to make this work. If it's something you are interested in adding support for I'd be happy to work with you. Right now I don't feel like I understand the package well enough to suggest how best to add it tho.
SciLifeLab/genologics
diff --git a/tests/test_entities.py b/tests/test_entities.py index 91dcbbd..933f708 100644 --- a/tests/test_entities.py +++ b/tests/test_entities.py @@ -1,9 +1,10 @@ +import operator from sys import version_info from unittest import TestCase from xml.etree import ElementTree from genologics.entities import StepActions, Researcher, Artifact, \ - Step, StepPlacements, Container, Stage, ReagentKit, ReagentLot + Step, StepPlacements, Container, Stage, ReagentKit, ReagentLot, Sample, Project from genologics.lims import Lims if version_info[0] == 2: @@ -126,6 +127,20 @@ generic_step_actions_no_escalation_xml = """<stp:actions xmlns:stp="http://genol </next-actions> </stp:actions>""" +generic_sample_creation_xml = """ +<smp:samplecreation xmlns:smp="http://genologics.com/ri/sample" limsid="s1" uri="{url}/api/v2/samples/s1"> + <location> + <container limsid="cont1" uri="{url}/api/v2/containers/cont1"> + </container> + <value>1:1</value> + </location> + <name> + sample1 + </name> + <project uri="{url}/api/v2/projects/p1" limsid="p1"> + </project> +</smp:samplecreation> +""" class TestEntities(TestCase): def test_pass(self): @@ -133,12 +148,22 @@ class TestEntities(TestCase): def elements_equal(e1, e2): - if e1.tag != e2.tag: return False - if e1.text and e2.text and e1.text.strip() != e2.text.strip(): return False - if e1.tail and e2.tail and e1.tail.strip() != e2.tail.strip(): return False - if e1.attrib != e2.attrib: return False - if len(e1) != len(e2): return False - return all(elements_equal(c1, c2) for c1, c2 in zip(e1, e2)) + if e1.tag != e2.tag: + print('Tag: %s != %s'%(e1.tag, e2.tag)) + return False + if e1.text and e2.text and e1.text.strip() != e2.text.strip(): + print('Text: %s != %s' % (e1.text.strip(), e2.text.strip())) + return False + if e1.tail and e2.tail and e1.tail.strip() != e2.tail.strip(): + print('Tail: %s != %s' % (e1.tail.strip(), e2.tail.strip())) + return False + if e1.attrib != e2.attrib: + print('Attrib: %s != %s' % (e1.attrib, e2.attrib)) + return False + if len(e1) != len(e2): + print('length %s (%s) != length (%s) ' % (e1.tag, len(e1), e2.tag, len(e2))) + return False + return all(elements_equal(c1, c2) for c1, c2 in zip(sorted(e1, key=lambda x: x.tag), sorted(e2, key=lambda x: x.tag))) class TestEntities(TestCase): @@ -289,3 +314,30 @@ class TestReagentLots(TestEntities): assert l.uri assert l.name == 'kitname' assert l.lot_number == '100' + + +class TestSample(TestEntities): + sample_creation = generic_sample_creation_xml.format(url=url) + + def test_create_entity(self): + with patch('genologics.lims.requests.post', + return_value=Mock(content=self.sample_creation, status_code=201)) as patch_post: + l = Sample.create( + self.lims, + project=Project(self.lims, uri='project'), + container=Container(self.lims, uri='container'), + position='1:1', + name='s1', + ) + data = '''<?xml version=\'1.0\' encoding=\'utf-8\'?> + <smp:samplecreation xmlns:smp="http://genologics.com/ri/sample"> + <name>s1</name> + <project uri="project" /> + <location> + <container uri="container" /> + <value>1:1</value> + </location> + </smp:samplecreation>''' + assert elements_equal(ElementTree.fromstring(patch_post.call_args_list[0][1]['data']), ElementTree.fromstring(data)) + +
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 1 }, "num_modified_files": 2 }
0.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": null, "pre_install": null, "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 -e git+https://github.com/SciLifeLab/genologics.git@dc79dc55dc1218582f30a5e76e9a0fff428cbf30#egg=genologics idna==3.10 importlib-metadata==4.8.3 iniconfig==1.1.1 mock==5.2.0 packaging==21.3 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 requests==2.27.1 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 zipp==3.6.0
name: genologics channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - charset-normalizer==2.0.12 - idna==3.10 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - mock==5.2.0 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - requests==2.27.1 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/genologics
[ "tests/test_entities.py::TestSample::test_create_entity" ]
[]
[ "tests/test_entities.py::TestStepActions::test_escalation", "tests/test_entities.py::TestStepActions::test_next_actions", "tests/test_entities.py::TestStepPlacements::test_get_placements_list", "tests/test_entities.py::TestStepPlacements::test_set_placements_list", "tests/test_entities.py::TestStepPlacements::test_set_placements_list_fail", "tests/test_entities.py::TestArtifacts::test_input_artifact_list", "tests/test_entities.py::TestArtifacts::test_workflow_stages_and_statuses", "tests/test_entities.py::TestReagentKits::test_create_entity", "tests/test_entities.py::TestReagentKits::test_parse_entity", "tests/test_entities.py::TestReagentLots::test_create_entity", "tests/test_entities.py::TestReagentLots::test_parse_entity" ]
[]
MIT License
977
[ "genologics/version.py", "genologics/entities.py" ]
[ "genologics/version.py", "genologics/entities.py" ]
scrapy__scrapy-2510
4620d2f4256093296c490b412a95e4eb9aa5bd41
2017-01-24 14:34:24
dfe6d3d59aa3de7a96c1883d0f3f576ba5994aa9
codecov-io: ## [Current coverage](https://codecov.io/gh/scrapy/scrapy/pull/2510?src=pr) is 83.46% (diff: 100%) > Merging [#2510](https://codecov.io/gh/scrapy/scrapy/pull/2510?src=pr) into [master](https://codecov.io/gh/scrapy/scrapy/branch/master?src=pr) will decrease coverage by **<.01%** ```diff @@ master #2510 diff @@ ========================================== Files 161 161 Lines 8780 8779 -1 Methods 0 0 Messages 0 0 Branches 1288 1288 ========================================== - Hits 7328 7327 -1 Misses 1204 1204 Partials 248 248 ``` > Powered by [Codecov](https://codecov.io?src=pr). Last update [4620d2f...5034821](https://codecov.io/gh/scrapy/scrapy/compare/4620d2f4256093296c490b412a95e4eb9aa5bd41...5034821d028fefbcb35e043f481fa1edc849e578?src=pr)
diff --git a/scrapy/utils/reqser.py b/scrapy/utils/reqser.py index 7e1e99e48..2fceb0d94 100644 --- a/scrapy/utils/reqser.py +++ b/scrapy/utils/reqser.py @@ -5,6 +5,7 @@ import six from scrapy.http import Request from scrapy.utils.python import to_unicode, to_native_str +from scrapy.utils.misc import load_object def request_to_dict(request, spider=None): @@ -32,6 +33,8 @@ def request_to_dict(request, spider=None): 'priority': request.priority, 'dont_filter': request.dont_filter, } + if type(request) is not Request: + d['_class'] = request.__module__ + '.' + request.__class__.__name__ return d @@ -47,7 +50,8 @@ def request_from_dict(d, spider=None): eb = d['errback'] if eb and spider: eb = _get_method(spider, eb) - return Request( + request_cls = load_object(d['_class']) if '_class' in d else Request + return request_cls( url=to_native_str(d['url']), callback=cb, errback=eb,
Disk queues don't preserve Request class When a Request subclass (e.g. FormRequest) is sent to a disk queue a bare Request is what you get back. This is inconvenient for scrapy-splash: Splash requests all have Splash URL as request.url, but for logging it is nice to display the requested URL, not only Splash URL. In scrapy-splash this is implemented by changing `__repr__` in a Request subclass, but it works only when request is kept in memory.
scrapy/scrapy
diff --git a/tests/test_utils_reqser.py b/tests/test_utils_reqser.py index a62f13e21..5b889ab5d 100644 --- a/tests/test_utils_reqser.py +++ b/tests/test_utils_reqser.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import unittest -from scrapy.http import Request +from scrapy.http import Request, FormRequest from scrapy.spiders import Spider from scrapy.utils.reqser import request_to_dict, request_from_dict @@ -42,6 +42,7 @@ class RequestSerializationTest(unittest.TestCase): self._assert_same_request(request, request2) def _assert_same_request(self, r1, r2): + self.assertEqual(r1.__class__, r2.__class__) self.assertEqual(r1.url, r2.url) self.assertEqual(r1.callback, r2.callback) self.assertEqual(r1.errback, r2.errback) @@ -54,6 +55,12 @@ class RequestSerializationTest(unittest.TestCase): self.assertEqual(r1.priority, r2.priority) self.assertEqual(r1.dont_filter, r2.dont_filter) + def test_request_class(self): + r = FormRequest("http://www.example.com") + self._assert_serializes_ok(r, spider=self.spider) + r = CustomRequest("http://www.example.com") + self._assert_serializes_ok(r, spider=self.spider) + def test_callback_serialization(self): r = Request("http://www.example.com", callback=self.spider.parse_item, errback=self.spider.handle_error) @@ -77,3 +84,7 @@ class TestSpider(Spider): def handle_error(self, failure): pass + + +class CustomRequest(Request): + pass
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 1 }
1.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==25.3.0 Automat==24.8.1 cffi==1.17.1 constantly==23.10.4 cryptography==44.0.2 cssselect==1.3.0 exceptiongroup==1.2.2 hyperlink==21.0.0 idna==3.10 incremental==24.7.2 iniconfig==2.1.0 jmespath==1.0.1 lxml==5.3.1 packaging==24.2 parsel==1.10.0 pluggy==1.5.0 pyasn1==0.6.1 pyasn1_modules==0.4.2 pycparser==2.22 PyDispatcher==2.0.7 pyOpenSSL==25.0.0 pytest==8.3.5 queuelib==1.7.0 -e git+https://github.com/scrapy/scrapy.git@4620d2f4256093296c490b412a95e4eb9aa5bd41#egg=Scrapy service-identity==24.2.0 six==1.17.0 tomli==2.2.1 Twisted==24.11.0 typing_extensions==4.13.0 w3lib==2.3.1 zope.interface==7.2
name: scrapy channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==25.3.0 - automat==24.8.1 - cffi==1.17.1 - constantly==23.10.4 - cryptography==44.0.2 - cssselect==1.3.0 - exceptiongroup==1.2.2 - hyperlink==21.0.0 - idna==3.10 - incremental==24.7.2 - iniconfig==2.1.0 - jmespath==1.0.1 - lxml==5.3.1 - packaging==24.2 - parsel==1.10.0 - pluggy==1.5.0 - pyasn1==0.6.1 - pyasn1-modules==0.4.2 - pycparser==2.22 - pydispatcher==2.0.7 - pyopenssl==25.0.0 - pytest==8.3.5 - queuelib==1.7.0 - service-identity==24.2.0 - six==1.17.0 - tomli==2.2.1 - twisted==24.11.0 - typing-extensions==4.13.0 - w3lib==2.3.1 - zope-interface==7.2 prefix: /opt/conda/envs/scrapy
[ "tests/test_utils_reqser.py::RequestSerializationTest::test_request_class" ]
[]
[ "tests/test_utils_reqser.py::RequestSerializationTest::test_all_attributes", "tests/test_utils_reqser.py::RequestSerializationTest::test_basic", "tests/test_utils_reqser.py::RequestSerializationTest::test_callback_serialization", "tests/test_utils_reqser.py::RequestSerializationTest::test_latin1_body", "tests/test_utils_reqser.py::RequestSerializationTest::test_unserializable_callback1", "tests/test_utils_reqser.py::RequestSerializationTest::test_unserializable_callback2", "tests/test_utils_reqser.py::RequestSerializationTest::test_utf8_body" ]
[]
BSD 3-Clause "New" or "Revised" License
978
[ "scrapy/utils/reqser.py" ]
[ "scrapy/utils/reqser.py" ]
pystorm__pystorm-42
266004865f5c9db2b8fb96e1b4c0217f19aefc9a
2017-01-24 15:23:19
266004865f5c9db2b8fb96e1b4c0217f19aefc9a
coveralls: [![Coverage Status](https://coveralls.io/builds/9818486/badge)](https://coveralls.io/builds/9818486) Coverage decreased (-0.1%) to 83.091% when pulling **9d1e2b94ba2b130cd99f0993bf7a4fc37bf1ae19 on feature/activate_deactivate_spout** into **266004865f5c9db2b8fb96e1b4c0217f19aefc9a on master**. coveralls: [![Coverage Status](https://coveralls.io/builds/9818530/badge)](https://coveralls.io/builds/9818530) Coverage decreased (-0.1%) to 83.091% when pulling **552fe17df9b072ac8721e4bad135651165afd0e5 on feature/activate_deactivate_spout** into **266004865f5c9db2b8fb96e1b4c0217f19aefc9a on master**.
diff --git a/pystorm/spout.py b/pystorm/spout.py index 47cfd37..169fbd1 100644 --- a/pystorm/spout.py +++ b/pystorm/spout.py @@ -76,6 +76,23 @@ class Spout(Component): direct_task=direct_task, need_task_ids=need_task_ids) + def activate(self): + """Called when the Spout has been activated after being deactivated. + + .. note:: + This requires at least Storm 1.1.0. + """ + pass + + + def deactivate(self): + """Called when the Spout has been deactivated. + + .. note:: + This requires at least Storm 1.1.0. + """ + pass + def _run(self): """The inside of ``run``'s infinite loop. @@ -88,6 +105,10 @@ class Spout(Component): self.ack(cmd['id']) elif cmd['command'] == 'fail': self.fail(cmd['id']) + elif cmd['command'] == 'activate': + self.activate() + elif cmd['command'] == 'deactivate': + self.deactivate() else: self.logger.error('Received invalid command from Storm: %r', cmd) self.send_message({'command': 'sync'})
Support Spout activate/deactivate _From @andrewkcarter on January 23, 2017 21:51_ Storm has recently exposed the activate and deactivate events via the `ShellSpout`. I would like to see these made available in streamparse for storm's next release. https://github.com/apache/storm/pull/1096 _Copied from original issue: Parsely/streamparse#351_
pystorm/pystorm
diff --git a/test/pystorm/test_spout.py b/test/pystorm/test_spout.py index ed84b16..25c762a 100644 --- a/test/pystorm/test_spout.py +++ b/test/pystorm/test_spout.py @@ -87,6 +87,22 @@ class SpoutTests(unittest.TestCase): read_command_mock.assert_called_with(self.spout) self.assertEqual(next_tuple_mock.call_count, 1) + @patch.object(Spout, 'read_command', autospec=True, + return_value={'command': 'activate', 'id': 1234}) + @patch.object(Spout, 'activate', autospec=True) + def test_activate(self, activate_mock, read_command_mock): + self.spout._run() + read_command_mock.assert_called_with(self.spout) + self.assertEqual(activate_mock.call_count, 1) + + @patch.object(Spout, 'read_command', autospec=True, + return_value={'command': 'deactivate', 'id': 1234}) + @patch.object(Spout, 'deactivate', autospec=True) + def test_deactivate(self, deactivate_mock, read_command_mock): + self.spout._run() + read_command_mock.assert_called_with(self.spout) + self.assertEqual(deactivate_mock.call_count, 1) + class ReliableSpoutTests(unittest.TestCase):
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_hyperlinks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 1 }
3.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[all]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "mock", "pytest", "unittest2" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup==1.2.2 iniconfig==2.1.0 linecache2==1.0.0 mock==5.2.0 msgpack-python==0.5.6 packaging==24.2 pluggy==1.5.0 -e git+https://github.com/pystorm/pystorm.git@266004865f5c9db2b8fb96e1b4c0217f19aefc9a#egg=pystorm pytest==8.3.5 pytest-timeout==2.3.1 simplejson==3.20.1 six==1.17.0 tomli==2.2.1 traceback2==1.4.0 unittest2==1.1.0
name: pystorm channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - argparse==1.4.0 - exceptiongroup==1.2.2 - iniconfig==2.1.0 - linecache2==1.0.0 - mock==5.2.0 - msgpack-python==0.5.6 - packaging==24.2 - pluggy==1.5.0 - pytest==8.3.5 - pytest-timeout==2.3.1 - simplejson==3.20.1 - six==1.17.0 - tomli==2.2.1 - traceback2==1.4.0 - unittest2==1.1.0 prefix: /opt/conda/envs/pystorm
[ "test/pystorm/test_spout.py::SpoutTests::test_activate", "test/pystorm/test_spout.py::SpoutTests::test_deactivate" ]
[]
[ "test/pystorm/test_spout.py::SpoutTests::test_ack", "test/pystorm/test_spout.py::SpoutTests::test_emit", "test/pystorm/test_spout.py::SpoutTests::test_fail", "test/pystorm/test_spout.py::SpoutTests::test_next_tuple", "test/pystorm/test_spout.py::ReliableSpoutTests::test_ack", "test/pystorm/test_spout.py::ReliableSpoutTests::test_emit_reliable", "test/pystorm/test_spout.py::ReliableSpoutTests::test_emit_reliable_direct", "test/pystorm/test_spout.py::ReliableSpoutTests::test_emit_unreliable", "test/pystorm/test_spout.py::ReliableSpoutTests::test_fail_above_limit", "test/pystorm/test_spout.py::ReliableSpoutTests::test_fail_below_limit" ]
[]
Apache License 2.0
979
[ "pystorm/spout.py" ]
[ "pystorm/spout.py" ]
google__mobly-87
312070ed24d3e229689a374c7357267879fd2549
2017-01-25 09:35:23
b4362eda0c8148644812849cdb9c741e35d5750d
diff --git a/README.md b/README.md index f606ce5..16bb283 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ class HelloWorldTest(base_test.BaseTestClass): # object is created from this. self.ads = self.register_controller(android_device) self.dut = self.ads[0] + self.dut.load_sl4a() # starts sl4a. def test_hello(self): self.dut.sl4a.makeToast('Hello World!') @@ -147,6 +148,7 @@ class HelloWorldTest(base_test.BaseTestClass): def setup_class(self): self.ads = self.register_controller(android_device) self.dut = self.ads[0] + self.dut.load_sl4a() def test_hello(self): self.dut.sl4a.makeToast('Hello World!') @@ -282,7 +284,9 @@ class HelloWorldTest(base_test.BaseTestClass): # requires at least two Android devices. self.ads = self.register_controller(android_device, min_number=2) self.dut = android_device.get_device(self.ads, label="dut") + self.dut.load_sl4a() self.discoverer = android_device.get_device(self.ads, label="discoverer") + self.discoverer.load_sl4a() self.dut.ed.clear_all_events() self.discoverer.ed.clear_all_events() diff --git a/docs/tutorials/lesson1.md b/docs/tutorials/lesson1.md index 3c93107..490ce40 100644 --- a/docs/tutorials/lesson1.md +++ b/docs/tutorials/lesson1.md @@ -40,6 +40,7 @@ class HelloWorldTest(base_test.BaseTestClass): # object is created from this. self.ads = self.register_controller(android_device) self.dut = self.ads[0] + self.dut.load_sl4a() def test_hello(self): self.dut.sl4a.makeToast('Hello World!') diff --git a/docs/tutorials/lesson2.md b/docs/tutorials/lesson2.md index 6d45715..83e76ec 100644 --- a/docs/tutorials/lesson2.md +++ b/docs/tutorials/lesson2.md @@ -21,6 +21,7 @@ class HelloWorldTest(base_test.BaseTestClass): def setup_class(self): self.ads = self.register_controller(android_device) self.dut = self.ads[0] + self.dut.load_sl4a() def test_hello(self): self.dut.sl4a.makeToast('Hello World!') diff --git a/docs/tutorials/lesson5.md b/docs/tutorials/lesson5.md index c31e000..7366f5e 100644 --- a/docs/tutorials/lesson5.md +++ b/docs/tutorials/lesson5.md @@ -41,7 +41,9 @@ class HelloWorldTest(base_test.BaseTestClass): # requires at least two Android devices. self.ads = self.register_controller(android_device, min_number=2) self.dut = android_device.get_device(self.ads, label="dut") + self.dut.load_sl4a() self.discoverer = android_device.get_device(self.ads, label="discoverer") + self.discoverer.load_sl4a() self.dut.ed.clear_all_events() self.discoverer.ed.clear_all_events() diff --git a/mobly/controllers/android_device.py b/mobly/controllers/android_device.py index 0d108a8..2f76b8a 100644 --- a/mobly/controllers/android_device.py +++ b/mobly/controllers/android_device.py @@ -40,8 +40,7 @@ ANDROID_DEVICE_ADB_LOGCAT_PARAM_KEY = 'adb_logcat_param' ANDROID_DEVICE_EMPTY_CONFIG_MSG = 'Configuration is empty, abort!' ANDROID_DEVICE_NOT_LIST_CONFIG_MSG = 'Configuration should be a list, abort!' -# Keys for attributes in configs that alternate device behavior -KEY_SKIP_SL4A = 'skip_sl4a' +# Keys for attributes in configs that alternate the controller module behavior. KEY_DEVICE_REQUIRED = 'required' @@ -98,10 +97,6 @@ def destroy(ads): for ad in ads: try: ad.stop_services() - # Refresh the adb connection to this device so we don't have any - # adb processes/ports started by the test lingering on after test - # stops. It also recovers unresponsive devices in some cases. - ad.adb.reconnect() except: ad.log.exception('Failed to clean up properly.') @@ -136,7 +131,7 @@ def _start_services_on_ads(ads): for ad in ads: running_ads.append(ad) try: - ad.start_services(skip_sl4a=getattr(ad, KEY_SKIP_SL4A, False)) + ad.start_services() except Exception as e: is_required = getattr(ad, KEY_DEVICE_REQUIRED, True) if is_required: @@ -338,10 +333,9 @@ def take_bug_reports(ads, test_name, begin_time): class AndroidDevice(object): """Class representing an android device. - Each object of this class represents one Android device in Mobly, including - handles to adb, fastboot, and sl4a clients. In addition to direct adb - commands, this object also uses adb port forwarding to talk to the Android - device. + Each object of this class represents one Android device in Mobly. This class + provides various ways, like adb, fastboot, sl4a, and snippets, to control an + Android device, whether it's a real device or an emulator instance. Attributes: serial: A string that's the serial number of the Androi device. @@ -396,29 +390,21 @@ class AndroidDevice(object): """ self.log.extra['tag'] = tag - # TODO(angli): This function shall be refactored to accommodate all services - # and not have hard coded switch for SL4A when b/29157104 is done. - def start_services(self, skip_sl4a=False): - """Starts long running services on the android device. - - 1. Start adb logcat capture. - 2. Start SL4A if not skipped. - - Args: - skip_sl4a: Does not attempt to start SL4A if True. + def start_services(self): + """Starts long running services on the android device, like adb logcat + capture. """ try: self.start_adb_logcat() except: self.log.exception('Failed to start adb logcat!') raise - if not skip_sl4a: - self._start_sl4a() def stop_services(self): - """Stops long running services on the android device. + """Stops long running services on the Android device. - Stop adb logcat and terminate sl4a sessions if exist. + Stop adb logcat, terminate sl4a sessions if exist, terminate all + snippet clients. """ if self._adb_logcat_process: self.stop_adb_logcat() @@ -558,60 +544,57 @@ class AndroidDevice(object): 'Snippet package "%s" has already been loaded under name' ' "%s".' % (package, client_name)) host_port = utils.get_available_host_port() - # TODO(adorokhine): Don't assume that a free host-side port is free on - # the device as well. Both sides should allocate a unique port. - device_port = host_port client = snippet_client.SnippetClient( - package=package, port=host_port, adb_proxy=self.adb) - self._start_jsonrpc_client(client, host_port, device_port) + package=package, host_port=host_port, adb_proxy=self.adb) + self._start_jsonrpc_client(client) self._snippet_clients[name] = client setattr(self, name, client) - def _start_sl4a(self): - """Create an sl4a connection to the device. + def load_sl4a(self): + """Start sl4a service on the Android device. - Assigns the open sl4a client to self.sl4a. By default, another - connection on the same session is made for EventDispatcher, and the - dispatcher is bound to self.ed. + Launch sl4a server if not already running, spin up a session on the + server, and two connections to this session. - If sl4a server is not started on the device, tries to start it. + Creates an sl4a client (self.sl4a) with one connection, and one + EventDispatcher obj (self.ed) with the other connection. """ host_port = utils.get_available_host_port() - device_port = sl4a_client.DEVICE_SIDE_PORT - self.sl4a = sl4a_client.Sl4aClient(self.adb) - self._start_jsonrpc_client(self.sl4a, host_port, device_port) + self.sl4a = sl4a_client.Sl4aClient( + host_port=host_port, adb_proxy=self.adb) + self._start_jsonrpc_client(self.sl4a) # Start an EventDispatcher for the current sl4a session - event_client = sl4a_client.Sl4aClient(self.adb) + event_client = sl4a_client.Sl4aClient( + host_port=host_port, adb_proxy=self.adb) event_client.connect( - port=host_port, uid=self.sl4a.uid, cmd=jsonrpc_client_base.JsonRpcCommand.CONTINUE) self.ed = event_dispatcher.EventDispatcher(event_client) self.ed.start() - def _start_jsonrpc_client(self, client, host_port, device_port): + def _start_jsonrpc_client(self, client): """Create a connection to a jsonrpc server running on the device. If the connection cannot be made, tries to restart it. """ client.check_app_installed() - self.adb.tcp_forward(host_port, device_port) + self.adb.tcp_forward(client.host_port, client.device_port) try: - client.connect(port=host_port) + client.connect() except: try: client.stop_app() except Exception as e: self.log.warning(e) client.start_app() - client.connect(port=host_port) + client.connect() def _terminate_jsonrpc_client(self, client): client.closeSl4aSession() client.close() client.stop_app() - self.adb.forward('--remove tcp:%d' % client.port) + self.adb.forward('--remove tcp:%d' % client.host_port) def _is_timestamp_in_range(self, target, begin_time, end_time): low = mobly_logger.logline_timestamp_comparator(begin_time, @@ -829,13 +812,15 @@ class AndroidDevice(object): self.fastboot.reboot() return snippet_info = self._get_active_snippet_info() + use_sl4a = self.sl4a is not None self.stop_services() self.adb.reboot() self.wait_for_boot_completion() if self.is_rootable: self.root_adb() - skip_sl4a = getattr(self, KEY_SKIP_SL4A, False) or self.sl4a is None - self.start_services(skip_sl4a=skip_sl4a) + self.start_services() + if use_sl4a: + self.load_sl4a() for attr_name, package_name in snippet_info: self.load_snippet(attr_name, package_name) diff --git a/mobly/controllers/android_device_lib/jsonrpc_client_base.py b/mobly/controllers/android_device_lib/jsonrpc_client_base.py index 3f7d6f5..da16a3e 100644 --- a/mobly/controllers/android_device_lib/jsonrpc_client_base.py +++ b/mobly/controllers/android_device_lib/jsonrpc_client_base.py @@ -39,9 +39,7 @@ Response: from builtins import str import json -import logging import socket -import sys import threading import time @@ -94,15 +92,25 @@ class JsonRpcClientBase(object): of communication. Attributes: - uid: (int) The uid of this session. + host_port: (int) The host port of this RPC client. + device_port: (int) The device port of this RPC client. app_name: (str) The user-visible name of the app being communicated - with. Must be set by the superclass. + with. + uid: (int) The uid of this session. """ - def __init__(self, adb_proxy): + + def __init__(self, host_port, device_port, app_name, adb_proxy): """ Args: - adb_proxy: adb.AdbProxy, The adb proxy to use to start the app + host_port: (int) The host port of this RPC client. + device_port: (int) The device port of this RPC client. + app_name: (str) The user-visible name of the app being communicated + with. + adb_proxy: (adb.AdbProxy) The adb proxy to use to start the app. """ + self.host_port = host_port + self.device_port = device_port + self.app_name = app_name self.uid = None self._adb = adb_proxy self._client = None # prevent close errors on connect failure @@ -139,16 +147,6 @@ class JsonRpcClientBase(object): """ raise NotImplementedError() - def _is_app_running(self): - """Checks if the app is currently running on an android device. - - Must be implemented by subclasses. - - Returns: - True if the app is running, False otherwise. - """ - raise NotImplementedError() - # Rest of the client methods. def check_app_installed(self): @@ -161,7 +159,7 @@ class JsonRpcClientBase(object): Args: wait_time: float, The time to wait for the app to come up before - raising an error. + raising an error. Raises: AppStartError: When the app was not able to be started. @@ -175,8 +173,7 @@ class JsonRpcClientBase(object): raise AppStartError( '%s failed to start on %s.' % (self.app_name, self._adb.serial)) - def connect(self, port, addr='localhost', uid=UNKNOWN_UID, - cmd=JsonRpcCommand.INIT): + def connect(self, uid=UNKNOWN_UID, cmd=JsonRpcCommand.INIT): """Opens a connection to a JSON RPC server. Opens a connection to a remote client. The connection attempt will time @@ -185,12 +182,8 @@ class JsonRpcClientBase(object): as well. Args: - port: int, The port this client should connect to. - addr: str, The address this client should connect to. uid: int, The uid of the session to join, or UNKNOWN_UID to start a new session. - connection_timeout: int, The time to wait for the connection to come - up. cmd: JsonRpcCommand, The command to use for creating the connection. Raises: @@ -199,14 +192,9 @@ class JsonRpcClientBase(object): ProtocolError: Raised when there is an error in the protocol. """ self._counter = self._id_counter() - try: - self._conn = socket.create_connection((addr, port), - _SOCKET_TIMEOUT) - self._conn.settimeout(_SOCKET_TIMEOUT) - except (socket.timeout, socket.error, IOError): - logging.exception("Failed to create socket connection!") - raise - self.port = port + self._conn = socket.create_connection(('127.0.0.1', self.host_port), + _SOCKET_TIMEOUT) + self._conn.settimeout(_SOCKET_TIMEOUT) self._client = self._conn.makefile(mode="brw") resp = self._cmd(cmd, uid) @@ -271,6 +259,20 @@ class JsonRpcClientBase(object): raise ProtocolError(ProtocolError.MISMATCHED_API_ID) return result['result'] + def _is_app_running(self): + """Checks if the app is currently running on an android device. + + May be overridden by subclasses with custom sanity checks. + """ + running = False + try: + self.connect() + running = True + finally: + self.close() + # This 'return' squashes exceptions from connect() + return running + def __getattr__(self, name): """Wrapper for python magic to turn method calls into RPC calls.""" def rpc_call(*args): diff --git a/mobly/controllers/android_device_lib/sl4a_client.py b/mobly/controllers/android_device_lib/sl4a_client.py index 1842eb5..71963d0 100644 --- a/mobly/controllers/android_device_lib/sl4a_client.py +++ b/mobly/controllers/android_device_lib/sl4a_client.py @@ -27,13 +27,25 @@ _LAUNCH_CMD = ( class Sl4aClient(jsonrpc_client_base.JsonRpcClientBase): - def __init__(self, adb_proxy): - super(Sl4aClient, self).__init__(adb_proxy) - self.app_name = 'SL4A' + """A client for interacting with SL4A using Mobly Snippet Lib. + + See superclass documentation for a list of public attributes. + """ + + def __init__(self, host_port, adb_proxy): + """Initializes an Sl4aClient. + + Args: + host_port: (int) The host port of this RPC client. + adb_proxy: (adb.AdbProxy) The adb proxy to use to start the app. + """ + super(Sl4aClient, self).__init__( + host_port=host_port, device_port=DEVICE_SIDE_PORT, app_name='SL4A', + adb_proxy=adb_proxy) def _do_start_app(self): """Overrides superclass.""" - self._adb.shell(_LAUNCH_CMD.format(DEVICE_SIDE_PORT)) + self._adb.shell(_LAUNCH_CMD.format(self.device_port)) def stop_app(self): """Overrides superclass.""" @@ -49,16 +61,3 @@ class Sl4aClient(jsonrpc_client_base.JsonRpcClientBase): if (e.ret_code == 1) and (not e.stdout) and (not e.stderr): return False raise - - def _is_app_running(self): - """Overrides superclass.""" - # Grep for process with a preceding S which means it is truly started. - try: - out = self._adb.shell( - 'ps | grep "S com.googlecode.android_scripting"').decode( - 'utf-8').strip() - return bool(out) - except adb.AdbError as e: - if (e.ret_code == 1) and (not e.stdout) and (not e.stderr): - return False - raise diff --git a/mobly/controllers/android_device_lib/snippet_client.py b/mobly/controllers/android_device_lib/snippet_client.py index 370d852..ebcae0f 100644 --- a/mobly/controllers/android_device_lib/snippet_client.py +++ b/mobly/controllers/android_device_lib/snippet_client.py @@ -15,7 +15,6 @@ # limitations under the License. """JSON RPC interface to Mobly Snippet Lib.""" import logging -import socket from mobly.controllers.android_device_lib import adb from mobly.controllers.android_device_lib import jsonrpc_client_base @@ -32,42 +31,43 @@ class Error(Exception): class SnippetClient(jsonrpc_client_base.JsonRpcClientBase): - def __init__(self, package, port, adb_proxy): - """Initialzies a SnippetClient. + """A client for interacting with snippet APKs using Mobly Snippet Lib. + + See superclass documentation for a list of public attributes. + """ + + def __init__(self, package, host_port, adb_proxy): + """Initializes a SnippetClient. Args: - package: (str) The package name of the apk where the snippets are - defined. - port: (int) The port at which to start the snippet client. Note that - the same port will currently be used for both the device and host - side of the connection. - TODO(adorokhine): allocate a distinct free port for both sides of - the connection; it is not safe in general to reuse the same one. - adb_proxy: (adb.AdbProxy) The adb proxy to use to start the app. + package: (str) The package name of the apk where the snippets are + defined. + host_port: (int) The port at which to start the snippet client. Note + that the same port will currently be used for both the + device and host side of the connection. + adb_proxy: (adb.AdbProxy) The adb proxy to use to start the app. """ - super(SnippetClient, self).__init__(adb_proxy) - self.app_name = package - self._package = package - self._port = port - - @property - def package(self): - return self._package + # TODO(adorokhine): Don't assume that a free host-side port is free on + # the device as well. Both sides should allocate a unique port. + super(SnippetClient, self).__init__( + host_port=host_port, device_port=host_port, app_name=package, + adb_proxy=adb_proxy) + self.package = package def _do_start_app(self): """Overrides superclass.""" - cmd = _LAUNCH_CMD.format(self._port, self._package) + cmd = _LAUNCH_CMD.format(self.device_port, self.package) # Use info here so people know exactly what's happening here, which is # helpful since they need to create their own instrumentations and # manifest. logging.info('Launching snippet apk with: %s', cmd) - self._adb.shell(_LAUNCH_CMD.format(self._port, self._package)) + self._adb.shell(cmd) def stop_app(self): """Overrides superclass.""" - cmd = _STOP_CMD.format(self._package) + cmd = _STOP_CMD.format(self.package) logging.info('Stopping snippet apk with: %s', cmd) - out = self._adb.shell(_STOP_CMD.format(self._package)).decode('utf-8') + out = self._adb.shell(_STOP_CMD.format(self.package)).decode('utf-8') if 'OK (0 tests)' not in out: raise Error('Failed to stop existing apk. Unexpected output: %s' % out) @@ -77,22 +77,9 @@ class SnippetClient(jsonrpc_client_base.JsonRpcClientBase): try: out = self._adb.shell( 'pm list instrumentation | grep ^instrumentation:%s/' % - self._package).decode('utf-8') + self.package).decode('utf-8') return bool(out) except adb.AdbError as e: if (e.ret_code == 1) and (not e.stdout) and (not e.stderr): return False raise - - def _is_app_running(self): - """Overrides superclass.""" - # While instrumentation is running, 'ps' only shows the package of the - # main apk. However, the main apk might be running for other reasons. - # Instead of grepping the process tree, this is implemented by seeing if - # our destination port is alive. - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - try: - result = sock.connect_ex(('127.0.0.1', self._port)) - return result == 0 - finally: - sock.close() diff --git a/mobly/controllers/monsoon.py b/mobly/controllers/monsoon.py index e02c22b..17d945c 100644 --- a/mobly/controllers/monsoon.py +++ b/mobly/controllers/monsoon.py @@ -880,8 +880,7 @@ class Monsoon(object): self._wait_for_device(self.dut) # Wait for device to come back online. time.sleep(10) - self.dut.start_services(skip_sl4a=getattr(self.dut, - "skip_sl4a", False)) + self.dut.start_services() # Release wake lock to put device into sleep. self.dut.sl4a.goToSleepNow() return results @@ -923,8 +922,7 @@ class Monsoon(object): self._wait_for_device(self.dut) # Wait for device to come back online. time.sleep(10) - self.dut.start_services(skip_sl4a=getattr(self.dut, - "skip_sl4a", False)) + self.dut.start_services() # Release wake lock to put device into sleep. self.dut.sl4a.goToSleepNow() self.log.info("Dut reconnected.") diff --git a/tools/sl4a_shell.py b/tools/sl4a_shell.py index 13b4847..501e656 100755 --- a/tools/sl4a_shell.py +++ b/tools/sl4a_shell.py @@ -43,6 +43,7 @@ class Sl4aShell(jsonrpc_shell_base.JsonRpcShellBase): def _start_services(self, console_env): """Overrides superclass.""" self._ad.start_services() + self._ad.load_sl4a() console_env['s'] = self._ad.sl4a console_env['sl4a'] = self._ad.sl4a console_env['ed'] = self._ad.ed diff --git a/tools/snippet_shell.py b/tools/snippet_shell.py index 0283f30..0991747 100755 --- a/tools/snippet_shell.py +++ b/tools/snippet_shell.py @@ -28,7 +28,6 @@ from __future__ import print_function import argparse import logging -import sys from mobly.controllers.android_device_lib import jsonrpc_shell_base
Make sl4a a service that needs to be explicitly requested Right now people have to explicitly say they don't need sl4a in config file, which is odd since most users don't use sl4a. Let's flip the assumption and make sl4a an optional service that people can request in setup if needed.
google/mobly
diff --git a/tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py b/tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py index ce01bad..19dc109 100755 --- a/tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py +++ b/tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py @@ -46,7 +46,9 @@ class MockSocketFile(object): class FakeRpcClient(jsonrpc_client_base.JsonRpcClientBase): def __init__(self): - super(FakeRpcClient, self).__init__(adb_proxy=None) + super(FakeRpcClient, self).__init__( + host_port=80, device_port=90, app_name='FakeRpcClient', + adb_proxy=None) class JsonRpcClientBaseTest(unittest.TestCase): @@ -78,7 +80,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): mock_create_connection.side_effect = IOError() with self.assertRaises(IOError): client = FakeRpcClient() - client.connect(port=80) + client.connect() @mock.patch('socket.create_connection') def test_connect_timeout(self, mock_create_connection): @@ -90,7 +92,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): mock_create_connection.side_effect = socket.timeout with self.assertRaises(socket.timeout): client = FakeRpcClient() - client.connect(port=80) + client.connect() @mock.patch('socket.create_connection') def test_handshake_error(self, mock_create_connection): @@ -104,7 +106,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): mock_create_connection.return_value = fake_conn with self.assertRaises(jsonrpc_client_base.ProtocolError): client = FakeRpcClient() - client.connect(port=80) + client.connect() @mock.patch('socket.create_connection') def test_connect_handshake(self, mock_create_connection): @@ -118,7 +120,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): mock_create_connection.return_value = fake_conn client = FakeRpcClient() - client.connect(port=80) + client.connect() self.assertEqual(client.uid, 1) @@ -135,7 +137,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): mock_create_connection.return_value = fake_conn client = FakeRpcClient() - client.connect(port=80) + client.connect() self.assertEqual(client.uid, jsonrpc_client_base.UNKNOWN_UID) @@ -149,7 +151,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): fake_file = self.setup_mock_socket_file(mock_create_connection) client = FakeRpcClient() - client.connect(port=80) + client.connect() fake_file.resp = None @@ -169,7 +171,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): fake_file = self.setup_mock_socket_file(mock_create_connection) client = FakeRpcClient() - client.connect(port=80) + client.connect() fake_file.resp = MOCK_RESP_WITH_ERROR @@ -186,7 +188,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): fake_file = self.setup_mock_socket_file(mock_create_connection) client = FakeRpcClient() - client.connect(port=80) + client.connect() fake_file.resp = (MOCK_RESP_TEMPLATE % 52).encode('utf8') @@ -205,7 +207,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): fake_file = self.setup_mock_socket_file(mock_create_connection) client = FakeRpcClient() - client.connect(port=80) + client.connect() fake_file.resp = None @@ -224,7 +226,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): fake_file = self.setup_mock_socket_file(mock_create_connection) client = FakeRpcClient() - client.connect(port=80) + client.connect() result = client.some_rpc(1, 2, 3) self.assertEquals(result, 123) @@ -243,7 +245,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): fake_file = self.setup_mock_socket_file(mock_create_connection) client = FakeRpcClient() - client.connect(port=80) + client.connect() for i in range(0, 10): fake_file.resp = (MOCK_RESP_TEMPLATE % i).encode('utf-8') diff --git a/tests/mobly/test_runner_test.py b/tests/mobly/test_runner_test.py index 74ffb8d..ed166d3 100755 --- a/tests/mobly/test_runner_test.py +++ b/tests/mobly/test_runner_test.py @@ -180,8 +180,7 @@ class TestRunnerTest(unittest.TestCase): {"serial": "xxxx", "magic": "Magic2"}] mock_test_config[tb_key][mock_ctrlr_config_name] = my_config mock_test_config[tb_key]["AndroidDevice"] = [ - {"serial": "1", - "skip_sl4a": True} + {"serial": "1"} ] tr = test_runner.TestRunner(mock_test_config, [('Integration2Test', None),
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 0, "test_score": 3 }, "num_modified_files": 11 }
1.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup==1.2.2 future==1.0.0 iniconfig==2.1.0 -e git+https://github.com/google/mobly.git@312070ed24d3e229689a374c7357267879fd2549#egg=mobly mock==1.0.1 packaging==24.2 pluggy==1.5.0 pytest==8.3.5 pytz==2025.2 tomli==2.2.1
name: mobly channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - exceptiongroup==1.2.2 - future==1.0.0 - iniconfig==2.1.0 - mock==1.0.1 - packaging==24.2 - pluggy==1.5.0 - pytest==8.3.5 - pytz==2025.2 - tomli==2.2.1 prefix: /opt/conda/envs/mobly
[ "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_connect_handshake", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_connect_handshake_unknown_status", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_connect_no_response", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_connect_timeout", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_handshake_error", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_open_timeout_io_error", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_rpc_call_increment_counter", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_rpc_error_response", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_rpc_id_mismatch", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_rpc_no_response", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_rpc_send_to_socket" ]
[]
[ "tests/mobly/test_runner_test.py::TestRunnerTest::test_register_controller_dup_register", "tests/mobly/test_runner_test.py::TestRunnerTest::test_register_controller_less_than_min_number", "tests/mobly/test_runner_test.py::TestRunnerTest::test_register_controller_no_config", "tests/mobly/test_runner_test.py::TestRunnerTest::test_register_controller_no_get_info", "tests/mobly/test_runner_test.py::TestRunnerTest::test_register_controller_return_value", "tests/mobly/test_runner_test.py::TestRunnerTest::test_run_twice", "tests/mobly/test_runner_test.py::TestRunnerTest::test_run_two_test_classes", "tests/mobly/test_runner_test.py::TestRunnerTest::test_verify_controller_module", "tests/mobly/test_runner_test.py::TestRunnerTest::test_verify_controller_module_missing_attr", "tests/mobly/test_runner_test.py::TestRunnerTest::test_verify_controller_module_null_attr" ]
[]
Apache License 2.0
980
[ "tools/sl4a_shell.py", "mobly/controllers/android_device_lib/snippet_client.py", "docs/tutorials/lesson1.md", "mobly/controllers/android_device.py", "tools/snippet_shell.py", "mobly/controllers/android_device_lib/jsonrpc_client_base.py", "docs/tutorials/lesson5.md", "mobly/controllers/monsoon.py", "README.md", "docs/tutorials/lesson2.md", "mobly/controllers/android_device_lib/sl4a_client.py" ]
[ "tools/sl4a_shell.py", "mobly/controllers/android_device_lib/snippet_client.py", "docs/tutorials/lesson1.md", "mobly/controllers/android_device.py", "tools/snippet_shell.py", "mobly/controllers/android_device_lib/jsonrpc_client_base.py", "docs/tutorials/lesson5.md", "mobly/controllers/monsoon.py", "README.md", "docs/tutorials/lesson2.md", "mobly/controllers/android_device_lib/sl4a_client.py" ]
dask__dask-1934
dd1d3a7f38ad8b80171ff9798d552e676665971a
2017-01-25 19:18:32
3b9528cf701b410258fe432ea374122fd9846dee
diff --git a/dask/__init__.py b/dask/__init__.py index f5f266a68..5da166f83 100644 --- a/dask/__init__.py +++ b/dask/__init__.py @@ -8,7 +8,7 @@ try: except ImportError: pass try: - from .base import visualize, compute + from .base import visualize, compute, persist except ImportError: pass diff --git a/dask/bag/core.py b/dask/bag/core.py index 5daa80998..d21ae1624 100644 --- a/dask/bag/core.py +++ b/dask/bag/core.py @@ -4,6 +4,7 @@ from collections import Iterable, Iterator, defaultdict from functools import wraps, partial import itertools import math +from operator import getitem import os import types import uuid @@ -1117,23 +1118,40 @@ class Bag(Base): -------- >>> b.repartition(5) # set to have 5 partitions # doctest: +SKIP """ - if npartitions > self.npartitions: - msg = ("Repartition only supports going to fewer partitions\n" - " old: %d new: %d") - raise NotImplementedError(msg % (self.npartitions, npartitions)) - npartitions_ratio = self.npartitions / npartitions - new_partitions_boundaries = [int(old_partition_index * npartitions_ratio) - for old_partition_index in range(npartitions + 1)] - new_name = 'repartition-%d-%s' % (npartitions, tokenize(self)) - - dsk = {} - for new_partition_index in range(npartitions): - value = (list, (toolz.concat, - [(self.name, old_partition_index) - for old_partition_index in - range(new_partitions_boundaries[new_partition_index], - new_partitions_boundaries[new_partition_index + 1])])) - dsk[new_name, new_partition_index] = value + new_name = 'repartition-%d-%s' % (npartitions, tokenize(self, npartitions)) + if npartitions == self.npartitions: + return self + elif npartitions < self.npartitions: + ratio = self.npartitions / npartitions + new_partitions_boundaries = [int(old_partition_index * ratio) + for old_partition_index in range(npartitions + 1)] + + dsk = {} + for new_partition_index in range(npartitions): + value = (list, (toolz.concat, + [(self.name, old_partition_index) + for old_partition_index in + range(new_partitions_boundaries[new_partition_index], + new_partitions_boundaries[new_partition_index + 1])])) + dsk[new_name, new_partition_index] = value + else: # npartitions > self.npartitions + ratio = npartitions / self.npartitions + split_name = 'split-%s' % tokenize(self, npartitions) + dsk = {} + last = 0 + j = 0 + for i in range(self.npartitions): + new = last + ratio + if i == self.npartitions - 1: + k = npartitions - j + else: + k = int(new - last) + dsk[(split_name, i)] = (split, (self.name, i), k) + for jj in range(k): + dsk[(new_name, j)] = (getitem, (split_name, i), jj) + j += 1 + last = new + return Bag(dsk=merge(self.dask, dsk), name=new_name, npartitions=npartitions) def accumulate(self, binop, initial=no_default): @@ -1677,3 +1695,18 @@ def random_state_data_python(n, random_state=None): maxuint32 = 1 << 32 return [tuple(random_state.randint(0, maxuint32) for i in range(624)) for i in range(n)] + + +def split(seq, n): + """ Split apart a sequence into n equal pieces + + >>> split(range(10), 3) + [[0, 1, 2], [3, 4, 5], [6, 7, 8, 9]] + """ + if not isinstance(seq, (list, tuple)): + seq = list(seq) + + part = len(seq) / n + L = [seq[int(part * i): int(part * (i + 1))] for i in range(n - 1)] + L.append(seq[int(part * (n - 1)):]) + return L diff --git a/dask/base.py b/dask/base.py index 8729ad3ea..dc187a38c 100644 --- a/dask/base.py +++ b/dask/base.py @@ -1,9 +1,9 @@ from __future__ import absolute_import, division, print_function from collections import OrderedDict +import copy from functools import partial from hashlib import md5 -from operator import attrgetter import pickle import os import uuid @@ -11,8 +11,9 @@ import uuid from toolz import merge, groupby, curry, identity from toolz.functoolz import Compose -from .compatibility import bind_method, unicode +from .compatibility import bind_method, unicode, PY3 from .context import _globals +from .core import flatten from .utils import Dispatch __all__ = ("Base", "compute", "normalize_token", "tokenize", "visualize") @@ -61,8 +62,21 @@ class Base(object): return visualize(self, filename=filename, format=format, optimize_graph=optimize_graph, **kwargs) + def persist(self, **kwargs): + """ Persist this dask collection into memory + + See ``dask.base.persist`` for full docstring + """ + (result,) = persist(self, **kwargs) + return result + def compute(self, **kwargs): - """Compute several dask collections at once. + """ Compute this dask collection + + This turns a lazy Dask collection into its in-memory equivalent. + For example a Dask.array turns into a NumPy array and a Dask.dataframe + turns into a Pandas dataframe. The entire dataset must fit into memory + before calling this operation. Parameters ---------- @@ -76,7 +90,8 @@ class Base(object): kwargs Extra keywords to forward to the scheduler ``get`` function. """ - return compute(self, **kwargs)[0] + (result,) = compute(self, **kwargs) + return result @classmethod def _get(cls, dsk, keys, get=None, **kwargs): @@ -119,24 +134,6 @@ class Base(object): raise NotImplementedError -def _extract_graph_and_keys(vals): - """Given a list of dask vals, return a single graph and a list of keys such - that ``get(dsk, keys)`` is equivalent to ``[v.compute() v in vals]``.""" - dsk = {} - keys = [] - for v in vals: - # Optimization to avoid merging dictionaries in Delayed values. Reduces - # memory usage for large graphs. - if hasattr(v, '_dasks'): - for d in v._dasks: - dsk.update(d) - else: - dsk.update(v.dask) - keys.append(v._keys()) - - return dsk, keys - - def compute(*args, **kwargs): """Compute several dask collections at once. @@ -165,13 +162,12 @@ def compute(*args, **kwargs): >>> compute(a, b) (45, 4.5) """ + optimize_graph = kwargs.pop('optimize_graph', True) variables = [a for a in args if isinstance(a, Base)] if not variables: return args get = kwargs.pop('get', None) or _globals['get'] - optimizations = (kwargs.pop('optimizations', None) or - _globals.get('optimizations', [])) if not get: get = variables[0]._default_get @@ -181,18 +177,8 @@ def compute(*args, **kwargs): "scheduler `get` function using either " "the `get` kwarg or globally with `set_options`.") - if kwargs.get('optimize_graph', True): - groups = groupby(attrgetter('_optimize'), variables) - groups = {opt: _extract_graph_and_keys(val) - for opt, val in groups.items()} - for opt in optimizations: - groups = {k: [opt(dsk, keys), keys] - for k, (dsk, keys) in groups.items()} - dsk = merge([opt(dsk, keys, **kwargs) - for opt, (dsk, keys) in groups.items()]) - keys = [var._keys() for var in variables] - else: - dsk, keys = _extract_graph_and_keys(variables) + dsk = collections_to_dsk(variables, optimize_graph, **kwargs) + keys = [var._keys() for var in variables] results = get(dsk, keys, **kwargs) results_iter = iter(results) @@ -388,3 +374,162 @@ def tokenize(*args, **kwargs): if kwargs: args = args + (kwargs,) return md5(str(tuple(map(normalize_token, args))).encode()).hexdigest() + + +def collections_to_dsk(collections, optimize_graph=True, **kwargs): + """ + Convert many collections into a single dask graph, after optimization + """ + optimizations = (kwargs.pop('optimizations', None) or + _globals.get('optimizations', [])) + if optimize_graph: + groups = groupby(lambda x: x._optimize, collections) + groups = {opt: _extract_graph_and_keys(val) + for opt, val in groups.items()} + for opt in optimizations: + groups = {k: [opt(dsk, keys), keys] + for k, (dsk, keys) in groups.items()} + dsk = merge([opt(dsk, keys, **kwargs) + for opt, (dsk, keys) in groups.items()]) + else: + dsk = merge(c.dask for c in collections) + + return dsk + + +def _extract_graph_and_keys(vals): + """Given a list of dask vals, return a single graph and a list of keys such + that ``get(dsk, keys)`` is equivalent to ``[v.compute() v in vals]``.""" + dsk = {} + keys = [] + for v in vals: + # Optimization to avoid merging dictionaries in Delayed values. Reduces + # memory usage for large graphs. + if hasattr(v, '_dasks'): + for d in v._dasks: + dsk.update(d) + else: + dsk.update(v.dask) + keys.append(v._keys()) + + return dsk, keys + + +def redict_collection(c, dsk): + from dask.delayed import Delayed + if isinstance(c, Delayed): + return Delayed(c.key, [dsk]) + else: + cc = copy.copy(c) + cc.dask = dsk + return cc + + +def persist(*args, **kwargs): + """ Persist multiple Dask collections into memory + + This turns lazy Dask collections into Dask collections with the same + metadata, but now with their results fully computed or actively computing + in the background. + + For example a lazy dask.array built up from many lazy calls will now be a + dask.array of the same shape, dtype, chunks, etc., but now with all of + those previously lazy tasks either computed in memory as many small NumPy + arrays (in the single-machine case) or asynchronously running in the + background on a cluster (in the distributed case). + + This function operates differently if a ``dask.distributed.Client`` exists + and is connected to a distributed scheduler. In this case this function + will return as soon as the task graph has been submitted to the cluster, + but before the computations have completed. Computations will continue + asynchronously in the background. When using this function with the single + machine scheduler it blocks until the computations have finished. + + When using Dask on a single machine you should ensure that the dataset fits + entirely within memory. + + Examples + -------- + >>> df = dd.read_csv('/path/to/*.csv') # doctest: +SKIP + >>> df = df[df.name == 'Alice'] # doctest: +SKIP + >>> df['in-debt'] = df.balance < 0 # doctest: +SKIP + >>> df = df.persist() # triggers computation # doctest: +SKIP + + >>> df.value().min() # future computations are now fast # doctest: +SKIP + -10 + >>> df.value().max() # doctest: +SKIP + 100 + + >>> from dask import persist # use persist function on multiple collections + >>> a, b = persist(a, b) # doctest: +SKIP + + Parameters + ---------- + *args: Dask collections + get : callable, optional + A scheduler ``get`` function to use. If not provided, the default + is to check the global settings first, and then fall back to + the collection defaults. + optimize_graph : bool, optional + If True [default], the graph is optimized before computation. + Otherwise the graph is run as is. This can be useful for debugging. + **kwargs + Extra keywords to forward to the scheduler ``get`` function. + + Returns + ------- + New dask collections backed by in-memory data + """ + collections = [a for a in args if isinstance(a, Base)] + if not collections: + return args + + try: + from distributed.client import default_client + except ImportError: + pass + else: + try: + client = default_client() + except ValueError: + pass + else: + collections = client.persist(collections, **kwargs) + if isinstance(collections, list): # distributed is inconsistent here + collections = tuple(collections) + else: + collections = (collections,) + results_iter = iter(collections) + return tuple(a if not isinstance(a, Base) + else next(results_iter) + for a in args) + + optimize_graph = kwargs.pop('optimize_graph', True) + + get = kwargs.pop('get', None) or _globals['get'] + + if not get: + get = collections[0]._default_get + if not all(a._default_get == get for a in collections): + raise ValueError("Compute called on multiple collections with " + "differing default schedulers. Please specify a " + "scheduler `get` function using either " + "the `get` kwarg or globally with `set_options`.") + + dsk = collections_to_dsk(collections, optimize_graph, **kwargs) + keys = list(flatten([var._keys() for var in collections])) + results = get(dsk, keys, **kwargs) + + d = dict(zip(keys, results)) + + result = [redict_collection(c, {k: d[k] + for k in flatten(c._keys())}) + for c in collections] + results_iter = iter(result) + return tuple(a if not isinstance(a, Base) + else next(results_iter) + for a in args) + + +if PY3: + Base.persist.__doc__ = persist.__doc__
Use repartition to increase the number of partitions This works fine when the user supplies divisions but doesn't work otherwise.
dask/dask
diff --git a/dask/bag/tests/test_bag.py b/dask/bag/tests/test_bag.py index 27e474e2e..0d114cf07 100644 --- a/dask/bag/tests/test_bag.py +++ b/dask/bag/tests/test_bag.py @@ -915,19 +915,29 @@ def test_zip(npartitions, hi=1000): assert list(pairs) == list(zip(range(0, hi, 2), range(1, hi, 2))) -def test_repartition(): - for x, y in [(10, 5), (7, 3), (5, 1), (5, 4)]: - b = db.from_sequence(range(20), npartitions=x) - c = b.repartition(y) [email protected]('nin', [1, 2, 7, 11, 23]) [email protected]('nout', [1, 2, 5, 12, 23]) +def test_repartition(nin, nout): + b = db.from_sequence(range(100), npartitions=nin) + c = b.repartition(npartitions=nout) - assert b.npartitions == x - assert c.npartitions == y - assert list(b) == c.compute(get=dask.get) + assert c.npartitions == nout + assert b.compute(get=dask.get) == c.compute(get=dask.get) + results = dask.get(c.dask, c._keys()) + assert all(results) - try: - b.repartition(100) - except NotImplementedError as e: - assert '100' in str(e) + +def test_repartition_names(): + b = db.from_sequence(range(100), npartitions=5) + c = b.repartition(2) + assert b.name != c.name + + d = b.repartition(20) + assert b.name != c.name + assert c.name != d.name + + c = b.repartition(5) + assert b is c @pytest.mark.skipif('not db.core._implement_accumulate') diff --git a/dask/tests/test_base.py b/dask/tests/test_base.py index 6aa7d54f9..1d7c73103 100644 --- a/dask/tests/test_base.py +++ b/dask/tests/test_base.py @@ -7,8 +7,10 @@ import subprocess import sys import dask +from dask import delayed from dask.base import (compute, tokenize, normalize_token, normalize_function, - visualize) + visualize, persist) +from dask.delayed import Delayed from dask.utils import tmpdir, tmpfile, ignoring from dask.utils_test import inc, dec from dask.compatibility import unicode @@ -263,6 +265,19 @@ def test_compute_array(): assert np.allclose(out2, arr + 2) [email protected]('not da') +def test_persist_array(): + from dask.array.utils import assert_eq + arr = np.arange(100).reshape((10, 10)) + x = da.from_array(arr, chunks=(5, 5)) + x = (x + 1) - x.mean(axis=0) + y = x.persist() + + assert_eq(x, y) + assert set(y.dask).issubset(x.dask) + assert len(y.dask) == y.npartitions + + @pytest.mark.skipif('not dd') def test_compute_dataframe(): df = pd.DataFrame({'a': [1, 2, 3, 4], 'b': [5, 5, 3, 3]}) @@ -378,3 +393,42 @@ def test_default_imports(): 'partd', 's3fs', 'distributed'] for mod in blacklist: assert mod not in modules + + +def test_persist_literals(): + assert persist(1, 2, 3) == (1, 2, 3) + + +def test_persist_delayed(): + x1 = delayed(1) + x2 = delayed(inc)(x1) + x3 = delayed(inc)(x2) + + xx, = persist(x3) + assert isinstance(xx, Delayed) + assert xx.key == x3.key + assert len(xx.dask) == 1 + + assert x3.compute() == xx.compute() + + [email protected]('not da or not db') +def test_persist_array_bag(): + x = da.arange(5, chunks=2) + 1 + b = db.from_sequence([1, 2, 3]).map(inc) + + with pytest.raises(ValueError): + persist(x, b) + + xx, bb = persist(x, b, get=dask.async.get_sync) + + assert isinstance(xx, da.Array) + assert isinstance(bb, db.Bag) + + assert xx.name == x.name + assert bb.name == b.name + assert len(xx.dask) == xx.npartitions < len(x.dask) + assert len(bb.dask) == bb.npartitions < len(b.dask) + + assert np.allclose(x, xx) + assert list(b) == list(bb) diff --git a/dask/tests/test_distributed.py b/dask/tests/test_distributed.py index 45b00a0bb..5cd3fcc51 100644 --- a/dask/tests/test_distributed.py +++ b/dask/tests/test_distributed.py @@ -1,6 +1,25 @@ import pytest pytest.importorskip('distributed') +from dask import persist, delayed +from distributed.client import _wait +from distributed.utils_test import gen_cluster, inc + def test_can_import_client(): from dask.distributed import Client # noqa: F401 + + +@gen_cluster(client=True) +def test_persist(c, s, a, b): + x = delayed(inc)(1) + x2, = persist(x) + + yield _wait(x2) + assert x2.key in a.data or x2.key in b.data + + y = delayed(inc)(10) + y2, one = persist(y, 1) + + yield _wait(y2) + assert y2.key in a.data or y2.key in b.data
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 3, "issue_text_score": 3, "test_score": 3 }, "num_modified_files": 3 }
1.15
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[complete]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y graphviz liblzma-dev" ], "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
aiobotocore==2.1.2 aiohttp==3.8.6 aioitertools==0.11.0 aiosignal==1.2.0 async-timeout==4.0.2 asynctest==0.13.0 attrs==22.2.0 botocore==1.23.24 certifi==2021.5.30 charset-normalizer==3.0.1 click==8.0.4 cloudpickle==2.2.1 -e git+https://github.com/dask/dask.git@dd1d3a7f38ad8b80171ff9798d552e676665971a#egg=dask distributed==1.16.0 frozenlist==1.2.0 fsspec==2022.1.0 HeapDict==1.0.1 idna==3.10 idna-ssl==1.1.0 importlib-metadata==4.8.3 iniconfig==1.1.1 jmespath==0.10.0 locket==1.0.0 msgpack-python==0.5.6 multidict==5.2.0 numpy==1.19.5 packaging==21.3 pandas==1.1.5 partd==1.2.0 pluggy==1.0.0 psutil==7.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 pytz==2025.2 s3fs==2022.1.0 six==1.17.0 sortedcollections==2.1.0 sortedcontainers==2.4.0 tblib==1.7.0 tomli==1.2.3 toolz==0.12.0 tornado==6.1 typing_extensions==4.1.1 urllib3==1.26.20 wrapt==1.16.0 yarl==1.7.2 zict==2.1.0 zipp==3.6.0
name: dask channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - aiobotocore==2.1.2 - aiohttp==3.8.6 - aioitertools==0.11.0 - aiosignal==1.2.0 - async-timeout==4.0.2 - asynctest==0.13.0 - attrs==22.2.0 - botocore==1.23.24 - charset-normalizer==3.0.1 - click==8.0.4 - cloudpickle==2.2.1 - distributed==1.16.0 - frozenlist==1.2.0 - fsspec==2022.1.0 - heapdict==1.0.1 - idna==3.10 - idna-ssl==1.1.0 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - jmespath==0.10.0 - locket==1.0.0 - msgpack-python==0.5.6 - multidict==5.2.0 - numpy==1.19.5 - packaging==21.3 - pandas==1.1.5 - partd==1.2.0 - pluggy==1.0.0 - psutil==7.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pytz==2025.2 - s3fs==2022.1.0 - six==1.17.0 - sortedcollections==2.1.0 - sortedcontainers==2.4.0 - tblib==1.7.0 - tomli==1.2.3 - toolz==0.12.0 - tornado==6.1 - typing-extensions==4.1.1 - urllib3==1.26.20 - wrapt==1.16.0 - yarl==1.7.2 - zict==2.1.0 - zipp==3.6.0 prefix: /opt/conda/envs/dask
[ "dask/bag/tests/test_bag.py::test_Bag", "dask/bag/tests/test_bag.py::test_keys", "dask/bag/tests/test_bag.py::test_map", "dask/bag/tests/test_bag.py::test_map_function_with_multiple_arguments", "dask/bag/tests/test_bag.py::test_map_with_constructors", "dask/bag/tests/test_bag.py::test_map_with_builtins", "dask/bag/tests/test_bag.py::test_map_with_kwargs", "dask/bag/tests/test_bag.py::test_filter", "dask/bag/tests/test_bag.py::test_remove", "dask/bag/tests/test_bag.py::test_iter", "dask/bag/tests/test_bag.py::test_repr[str]", "dask/bag/tests/test_bag.py::test_repr[repr]", "dask/bag/tests/test_bag.py::test_pluck", "dask/bag/tests/test_bag.py::test_pluck_with_default", "dask/bag/tests/test_bag.py::test_unzip", "dask/bag/tests/test_bag.py::test_fold", "dask/bag/tests/test_bag.py::test_distinct", "dask/bag/tests/test_bag.py::test_frequencies", "dask/bag/tests/test_bag.py::test_topk", "dask/bag/tests/test_bag.py::test_topk_with_non_callable_key", "dask/bag/tests/test_bag.py::test_topk_with_multiarg_lambda", "dask/bag/tests/test_bag.py::test_lambdas", "dask/bag/tests/test_bag.py::test_reductions", "dask/bag/tests/test_bag.py::test_reduction_names", "dask/bag/tests/test_bag.py::test_tree_reductions", "dask/bag/tests/test_bag.py::test_mean", "dask/bag/tests/test_bag.py::test_non_splittable_reductions", "dask/bag/tests/test_bag.py::test_std", "dask/bag/tests/test_bag.py::test_var", "dask/bag/tests/test_bag.py::test_join", "dask/bag/tests/test_bag.py::test_foldby", "dask/bag/tests/test_bag.py::test_map_partitions", "dask/bag/tests/test_bag.py::test_map_partitions_with_kwargs", "dask/bag/tests/test_bag.py::test_random_sample_size", "dask/bag/tests/test_bag.py::test_random_sample_prob_range", "dask/bag/tests/test_bag.py::test_random_sample_repeated_computation", "dask/bag/tests/test_bag.py::test_random_sample_different_definitions", "dask/bag/tests/test_bag.py::test_random_sample_random_state", "dask/bag/tests/test_bag.py::test_lazify_task", "dask/bag/tests/test_bag.py::test_lazify", "dask/bag/tests/test_bag.py::test_inline_singleton_lists", "dask/bag/tests/test_bag.py::test_take", "dask/bag/tests/test_bag.py::test_take_npartitions", "dask/bag/tests/test_bag.py::test_take_npartitions_warn", "dask/bag/tests/test_bag.py::test_map_is_lazy", "dask/bag/tests/test_bag.py::test_can_use_dict_to_make_concrete", "dask/bag/tests/test_bag.py::test_read_text", "dask/bag/tests/test_bag.py::test_read_text_large", "dask/bag/tests/test_bag.py::test_read_text_encoding", "dask/bag/tests/test_bag.py::test_read_text_large_gzip", "dask/bag/tests/test_bag.py::test_from_sequence", "dask/bag/tests/test_bag.py::test_from_long_sequence", "dask/bag/tests/test_bag.py::test_product", "dask/bag/tests/test_bag.py::test_partition_collect", "dask/bag/tests/test_bag.py::test_groupby", "dask/bag/tests/test_bag.py::test_groupby_with_indexer", "dask/bag/tests/test_bag.py::test_groupby_with_npartitions_changed", "dask/bag/tests/test_bag.py::test_concat", "dask/bag/tests/test_bag.py::test_concat_after_map", "dask/bag/tests/test_bag.py::test_args", "dask/bag/tests/test_bag.py::test_to_textfiles[gz-GzipFile]", "dask/bag/tests/test_bag.py::test_to_textfiles[-open]", "dask/bag/tests/test_bag.py::test_to_textfiles[bz2-BZ2File]", "dask/bag/tests/test_bag.py::test_to_textfiles_name_function_preserves_order", "dask/bag/tests/test_bag.py::test_to_textfiles_name_function_warn", "dask/bag/tests/test_bag.py::test_to_textfiles_encoding", "dask/bag/tests/test_bag.py::test_to_textfiles_inputs", "dask/bag/tests/test_bag.py::test_to_textfiles_endlines", "dask/bag/tests/test_bag.py::test_string_namespace", "dask/bag/tests/test_bag.py::test_string_namespace_with_unicode", "dask/bag/tests/test_bag.py::test_str_empty_split", "dask/bag/tests/test_bag.py::test_map_with_iterator_function", "dask/bag/tests/test_bag.py::test_ensure_compute_output_is_concrete", "dask/bag/tests/test_bag.py::test_bag_class_extend", "dask/bag/tests/test_bag.py::test_gh715", "dask/bag/tests/test_bag.py::test_bag_compute_forward_kwargs", "dask/bag/tests/test_bag.py::test_to_delayed", "dask/bag/tests/test_bag.py::test_from_delayed", "dask/bag/tests/test_bag.py::test_range", "dask/bag/tests/test_bag.py::test_zip[1]", "dask/bag/tests/test_bag.py::test_zip[7]", "dask/bag/tests/test_bag.py::test_zip[10]", "dask/bag/tests/test_bag.py::test_zip[28]", "dask/bag/tests/test_bag.py::test_repartition[1-1]", "dask/bag/tests/test_bag.py::test_repartition[1-2]", "dask/bag/tests/test_bag.py::test_repartition[1-7]", "dask/bag/tests/test_bag.py::test_repartition[1-11]", "dask/bag/tests/test_bag.py::test_repartition[1-23]", "dask/bag/tests/test_bag.py::test_repartition[2-1]", "dask/bag/tests/test_bag.py::test_repartition[2-2]", "dask/bag/tests/test_bag.py::test_repartition[2-7]", "dask/bag/tests/test_bag.py::test_repartition[2-11]", "dask/bag/tests/test_bag.py::test_repartition[2-23]", "dask/bag/tests/test_bag.py::test_repartition[5-1]", "dask/bag/tests/test_bag.py::test_repartition[5-2]", "dask/bag/tests/test_bag.py::test_repartition[5-7]", "dask/bag/tests/test_bag.py::test_repartition[5-11]", "dask/bag/tests/test_bag.py::test_repartition[5-23]", "dask/bag/tests/test_bag.py::test_repartition[12-1]", "dask/bag/tests/test_bag.py::test_repartition[12-2]", "dask/bag/tests/test_bag.py::test_repartition[12-7]", "dask/bag/tests/test_bag.py::test_repartition[12-11]", "dask/bag/tests/test_bag.py::test_repartition[12-23]", "dask/bag/tests/test_bag.py::test_repartition[23-1]", "dask/bag/tests/test_bag.py::test_repartition[23-2]", "dask/bag/tests/test_bag.py::test_repartition[23-7]", "dask/bag/tests/test_bag.py::test_repartition[23-11]", "dask/bag/tests/test_bag.py::test_repartition[23-23]", "dask/bag/tests/test_bag.py::test_repartition_names", "dask/bag/tests/test_bag.py::test_accumulate", "dask/bag/tests/test_bag.py::test_groupby_tasks", "dask/bag/tests/test_bag.py::test_groupby_tasks_names", "dask/bag/tests/test_bag.py::test_groupby_tasks_2[1000-20-100]", "dask/bag/tests/test_bag.py::test_groupby_tasks_2[12345-234-1042]", "dask/bag/tests/test_bag.py::test_groupby_tasks_3", "dask/bag/tests/test_bag.py::test_to_textfiles_empty_partitions", "dask/bag/tests/test_bag.py::test_reduction_empty", "dask/bag/tests/test_bag.py::test_reduction_with_non_comparable_objects", "dask/bag/tests/test_bag.py::test_empty", "dask/bag/tests/test_bag.py::test_bag_picklable", "dask/bag/tests/test_bag.py::test_msgpack_unicode", "dask/bag/tests/test_bag.py::test_bag_with_single_callable", "dask/bag/tests/test_bag.py::test_optimize_fuse_keys", "dask/bag/tests/test_bag.py::test_reductions_are_lazy", "dask/bag/tests/test_bag.py::test_repeated_groupby", "dask/tests/test_distributed.py::test_can_import_client" ]
[ "dask/tests/test_distributed.py::test_persist" ]
[]
[]
BSD 3-Clause "New" or "Revised" License
982
[ "dask/bag/core.py", "dask/base.py", "dask/__init__.py" ]
[ "dask/bag/core.py", "dask/base.py", "dask/__init__.py" ]
Azure__azure-cli-1876
62dab24154f910ff7f3ef2b6b3783945b58e9098
2017-01-26 00:16:00
1576ec67f5029db062579da230902a559acbb9fe
diff --git a/src/azure-cli-core/azure/cli/core/_util.py b/src/azure-cli-core/azure/cli/core/_util.py index c194599bc..379152887 100644 --- a/src/azure-cli-core/azure/cli/core/_util.py +++ b/src/azure-cli-core/azure/cli/core/_util.py @@ -94,21 +94,27 @@ def get_json_object(json_string): def get_file_json(file_path, throw_on_empty=True): + content = read_file_content(file_path) + if not content and not throw_on_empty: + return None + return json.loads(content) + + +def read_file_content(file_path, allow_binary=False): from codecs import open as codecs_open - # always try 'utf-8-sig' first, so that BOM in WinOS won't cause trouble. - for encoding in ('utf-8-sig', 'utf-8', 'utf-16', 'utf-16le', 'utf-16be'): + # Note, always put 'utf-8-sig' first, so that BOM in WinOS won't cause trouble. + for encoding in ['utf-8-sig', 'utf-8', 'utf-16', 'utf-16le', 'utf-16be']: try: with codecs_open(file_path, encoding=encoding) as f: - text = f.read() - - if not text and not throw_on_empty: - return None - - return json.loads(text) + return f.read() + except UnicodeDecodeError: + if allow_binary: + with open(file_path, 'rb') as input_file: + return input_file.read() + else: + raise except UnicodeError: pass - except Exception as ex: - raise CLIError("File '{}' contains error: {}".format(file_path, str(ex))) raise CLIError('Failed to decode file {} - unknown decoding'.format(file_path)) diff --git a/src/azure-cli-core/azure/cli/core/application.py b/src/azure-cli-core/azure/cli/core/application.py index e651a2c8a..72b282d16 100644 --- a/src/azure-cli-core/azure/cli/core/application.py +++ b/src/azure-cli-core/azure/cli/core/application.py @@ -13,7 +13,7 @@ from azure.cli.core._output import CommandResultItem import azure.cli.core.extensions import azure.cli.core._help as _help import azure.cli.core.azlogging as azlogging -from azure.cli.core._util import todict, truncate_text, CLIError +from azure.cli.core._util import todict, truncate_text, CLIError, read_file_content from azure.cli.core._config import az_config import azure.cli.core.telemetry as telemetry @@ -237,19 +237,13 @@ class Application(object): @staticmethod def _load_file(path): - try: - if path == '-': - content = sys.stdin.read() - else: - try: - with open(os.path.expanduser(path), 'r') as input_file: - content = input_file.read() - except UnicodeDecodeError: - with open(os.path.expanduser(path), 'rb') as input_file: - content = input_file.read() - return content[0:-1] if content[-1] == '\n' else content - except: - raise CLIError('Failed to open file {}'.format(path)) + if path == '-': + content = sys.stdin.read() + else: + content = read_file_content(os.path.expanduser(path), + allow_binary=True) + + return content[0:-1] if content and content[-1] == '\n' else content def _handle_builtin_arguments(self, **kwargs): args = kwargs['args']
"@file support": should handle the BOM on file loading Otherwise, using `@<parameter-file>` will return an invalid json string for the command to use. Since json file is the main file type, so the core layer should handle it. CLI already have [the logic](https://github.com/Azure/azure-cli/blob/master/src/azure-cli-core/azure/cli/core/_util.py#L91) to handle BOM, so we just need to incorporate the same mechanism to [here](https://github.com/Azure/azure-cli/blob/master/src/azure-cli-core/azure/cli/core/application.py#L244)
Azure/azure-cli
diff --git a/src/azure-cli-core/azure/cli/core/tests/test_application.py b/src/azure-cli-core/azure/cli/core/tests/test_application.py index 42f09f10f..2142b0515 100644 --- a/src/azure-cli-core/azure/cli/core/tests/test_application.py +++ b/src/azure-cli-core/azure/cli/core/tests/test_application.py @@ -87,13 +87,21 @@ class TestApplication(unittest.TestCase): f = tempfile.NamedTemporaryFile(delete=False) f.close() + f_with_bom = tempfile.NamedTemporaryFile(delete=False) + f_with_bom.close() + with open(f.name, 'w+') as stream: stream.write('foo') + from codecs import open as codecs_open + with codecs_open(f_with_bom.name, encoding='utf-8-sig', mode='w+') as stream: + stream.write('foo') + cases = [ [['bar=baz'], ['bar=baz']], [['bar', 'baz'], ['bar', 'baz']], [['bar=@{}'.format(f.name)], ['bar=foo']], + [['bar=@{}'.format(f_with_bom.name)], ['bar=foo']], [['bar', '@{}'.format(f.name)], ['bar', 'foo']], [['bar', f.name], ['bar', f.name]], [['[email protected]'], ['[email protected]']],
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 0 }, "num_modified_files": 2 }
0.1
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc libssl-dev libffi-dev" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==1.2.7 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==1.4.9 attrs==22.2.0 autopep8==1.2.4 azure-batch==1.1.0 -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_context&subdirectory=src/command_modules/azure-cli-context -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@62dab24154f910ff7f3ef2b6b3783945b58e9098#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.4 azure-core==1.24.2 azure-graphrbac==0.30.0rc6 azure-keyvault==0.1.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==2.0.0 azure-mgmt-compute==0.32.1 azure-mgmt-containerregistry==0.1.1 azure-mgmt-dns==0.30.0rc6 azure-mgmt-iothub==0.2.1 azure-mgmt-keyvault==0.30.0 azure-mgmt-network==0.30.0 azure-mgmt-nspkg==3.0.2 azure-mgmt-redis==1.0.0 azure-mgmt-resource==0.30.2 azure-mgmt-sql==0.2.0 azure-mgmt-storage==0.31.0 azure-mgmt-trafficmanager==0.30.0rc6 azure-mgmt-web==0.30.1 azure-nspkg==3.0.2 azure-storage==0.33.0 certifi==2021.5.30 cffi==1.15.1 charset-normalizer==2.0.12 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 idna==3.10 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.4.29 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.5.4 pyOpenSSL==16.1.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 PyYAML==3.11 requests==2.27.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.5 tomli==1.2.3 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 wrapt==1.16.0 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==1.2.7 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==1.4.9 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==1.1.0 - azure-common==1.1.4 - azure-core==1.24.2 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.1.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==2.0.0 - azure-mgmt-compute==0.32.1 - azure-mgmt-containerregistry==0.1.1 - azure-mgmt-dns==0.30.0rc6 - azure-mgmt-iothub==0.2.1 - azure-mgmt-keyvault==0.30.0 - azure-mgmt-network==0.30.0 - azure-mgmt-nspkg==3.0.2 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==0.30.2 - azure-mgmt-sql==0.2.0 - azure-mgmt-storage==0.31.0 - azure-mgmt-trafficmanager==0.30.0rc6 - azure-mgmt-web==0.30.1 - azure-nspkg==3.0.2 - azure-storage==0.33.0 - cffi==1.15.1 - charset-normalizer==2.0.12 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - idna==3.10 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.4.29 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.5.4 - pyopenssl==16.1.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pyyaml==3.11 - requests==2.27.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.5 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - wrapt==1.16.0 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/azure-cli-core/azure/cli/core/tests/test_application.py::TestApplication::test_expand_file_prefixed_files" ]
[]
[ "src/azure-cli-core/azure/cli/core/tests/test_application.py::TestApplication::test_application_register_and_call_handlers", "src/azure-cli-core/azure/cli/core/tests/test_application.py::TestApplication::test_list_value_parameter" ]
[]
MIT License
983
[ "src/azure-cli-core/azure/cli/core/application.py", "src/azure-cli-core/azure/cli/core/_util.py" ]
[ "src/azure-cli-core/azure/cli/core/application.py", "src/azure-cli-core/azure/cli/core/_util.py" ]
google__vimdoc-97
1634f964109d66746b2b79f083ef8e0cdb068ee4
2017-01-26 00:33:05
2ce5d6c00e67164e1c2e6f0fc1b0f12d3b670cd3
diff --git a/README.md b/README.md index e322fcb..79fb40e 100644 --- a/README.md +++ b/README.md @@ -116,10 +116,13 @@ Available block directives include: - `@private` marks a function private. - `@section name[, id]` allows you to write a new section for the helpfile. The id will be a lowercased version of name if omitted. +- `@parentsection id` defines the current section as a child of the given + section. Must be contained within a `@section` block. - `@subsection name` defines a subsection (heading) within a section block. - `@backmatter id` declares a block to be rendered at the end of the given section. -- `@order ...` allows you to define the order of the sections. +- `@order ...` allows you to define the order of the sections. Sections with a + `@parentsection` may not be included here. - `@dict name` (above blank lines) allows you to define a new dictionary. - `@dict dict.fn` (above a function) allows you to add a function to a dictionary. diff --git a/vimdoc/block.py b/vimdoc/block.py index 03bed17..b02113b 100644 --- a/vimdoc/block.py +++ b/vimdoc/block.py @@ -32,6 +32,9 @@ class Block(object): # name (of section) # type (constant, e.g. vimdoc.FUNCTION) # id (of section, in section or backmatter) + # parent_id (in section) + # children (in section) + # level (in section, tracks nesting level) # namespace (of function) # attribute (of function in dict) self.locals = {} @@ -137,6 +140,12 @@ class Block(object): else: raise error.TypeConflict(ourtype, newtype) + def SetParentSection(self, parent_id): + """Sets the parent_id for blocks of type SECTION""" + if not (self.locals.get('type') == vimdoc.SECTION): + raise error.MisplacedParentSection(parent_id) + self.Local(parent_id=parent_id) + def SetHeader(self, directive): """Sets the header handler.""" if self.header: diff --git a/vimdoc/docline.py b/vimdoc/docline.py index 51b588e..c5c3251 100644 --- a/vimdoc/docline.py +++ b/vimdoc/docline.py @@ -180,8 +180,12 @@ class Public(BlockDirective): class Section(BlockDirective): REGEX = regex.section_args + def __init__(self, args): + super(Section, self).__init__(args) + def Assign(self, name, ident): self.name = name.replace('\\,', ',').replace('\\\\', '\\') + if ident is None: # If omitted, it's the name in lowercase, with spaces converted to dashes. ident = self.name.lower().replace(' ', '-') @@ -192,6 +196,16 @@ class Section(BlockDirective): block.Local(name=self.name, id=self.id) +class ParentSection(BlockDirective): + REGEX = regex.parent_section_args + + def Assign(self, name): + self.name = name.lower() + + def Update(self, block): + block.SetParentSection(self.name) + + class Setting(BlockDirective): REGEX = regex.one_arg @@ -384,6 +398,7 @@ BLOCK_DIRECTIVES = { 'function': Function, 'library': Library, 'order': Order, + 'parentsection': ParentSection, 'private': Private, 'public': Public, 'section': Section, diff --git a/vimdoc/error.py b/vimdoc/error.py index 127ad53..725b128 100644 --- a/vimdoc/error.py +++ b/vimdoc/error.py @@ -116,6 +116,20 @@ class NoSuchSection(BadStructure): 'Section {} never defined.'.format(section)) +class MisplacedParentSection(BadStructure): + def __init__(self, section): + super(MisplacedParentSection, self).__init__( + 'Parent section {} defined outside a @section block.'.format(section)) + + +class NoSuchParentSection(BadStructure): + def __init__(self, section, parent_id): + super(NoSuchParentSection, self).__init__( + ('Section {} has non-existent parent {}. ' + 'Try setting the id of the parent section explicitly.' + ).format(section, parent_id)) + + class DuplicateSection(BadStructure): def __init__(self, section): super(DuplicateSection, self).__init__( @@ -132,3 +146,9 @@ class NeglectedSections(BadStructure): def __init__(self, sections, order): super(NeglectedSections, self).__init__( 'Sections {} not included in ordering {}.'.format(sections, order)) + + +class OrderedChildSections(BadStructure): + def __init__(self, section, order): + super(OrderedChildSections, self).__init__( + 'Child section {} included in ordering {}.'.format(section, order)) diff --git a/vimdoc/module.py b/vimdoc/module.py index 05b09d1..4a50821 100644 --- a/vimdoc/module.py +++ b/vimdoc/module.py @@ -149,19 +149,57 @@ class Module(object): for backmatter in self.backmatters: if backmatter not in self.sections: raise error.NoSuchSection(backmatter) + # Use explicit order as partial ordering and merge with default section # ordering. All custom sections must be ordered explicitly. self.order = self._GetSectionOrder(self.order, self.sections) + # Child section collection + to_delete = [] + for key in self.sections: + section = self.sections[key] + parent_id = section.locals.get('parent_id', None) + if parent_id: + if parent_id not in self.sections: + raise error.NoSuchParentSection( + section.locals['name'], parent_id) + parent = self.sections[parent_id] + parent.locals.setdefault('children', []).append(section) + to_delete.append(key) + + for key in to_delete: + self.sections.pop(key) + known = set(self.sections) neglected = sorted(known.difference(self.order)) if neglected: raise error.NeglectedSections(neglected, self.order) - # Sections are now in order. + + # Reinsert top-level sections in the correct order, expanding the tree of + # child sections along the way so we have a linear list of sections to pass + # to the output functions. + + # Helper function to recursively add children to self.sections. + # We add a 'level' variable to locals so that WriteTableOfContents can keep + # track of the nesting. + def _AddChildSections(section): + section.locals.setdefault('level', 0) + if 'children' in section.locals: + sort_key = lambda s: s.locals['name'] + for child in sorted(section.locals['children'], key=sort_key): + child.locals['level'] = section.locals['level'] + 1 + self.sections[child.locals['id']] = child + _AddChildSections(child) + + # Insert sections according to the @order directive for key in self.order: if key in self.sections: + section = self.sections.pop(key) + if 'parent_id' in section.locals and section.locals['parent_id']: + raise error.OrderedChildSections(section.locals['id'], self.order) # Move to end. - self.sections[key] = self.sections.pop(key) + self.sections[key] = section + _AddChildSections(section) def Chunks(self): for ident, section in self.sections.items(): diff --git a/vimdoc/output.py b/vimdoc/output.py index a472b6b..7f9b025 100644 --- a/vimdoc/output.py +++ b/vimdoc/output.py @@ -52,16 +52,33 @@ class Helpfile(object): self.WriteLine(right=tag) self.WriteLine() + # Helper function for WriteTableOfContents(). + def _EnumerateIndices(self, sections): + """Keep track of section numbering for each level of the tree""" + count = [{'level': 0, 'index': 0}] + for block in sections: + assert 'id' in block.locals + assert 'name' in block.locals + level = block.locals['level'] + while level < count[-1]['level']: + count.pop() + if level == count[-1]['level']: + count[-1]['index'] += 1 + else: + count.append({'level': level, 'index': 1}) + yield (count[-1]['index'], block) + def WriteTableOfContents(self): """Writes the table of contents.""" self.WriteRow() self.WriteLine('CONTENTS', right=self.Tag(self.Slug('contents'))) - for i, block in enumerate(self.module.sections.values()): - assert 'id' in block.locals - assert 'name' in block.locals - line = '%d. %s' % (i + 1, block.locals['name']) - slug = self.Slug(block.locals['id']) - self.WriteLine(line, indent=1, right=self.Link(slug), fill='.') + # We need to keep track of section numbering on a per-level basis + for index, block in self._EnumerateIndices(self.module.sections.values()): + self.WriteLine( + '%d. %s' % (index, block.locals['name']), + indent=2 * block.locals['level'] + 1, + right=self.Link(self.Slug(block.locals['id'])), + fill='.') self.WriteLine() def WriteChunk(self, chunk): diff --git a/vimdoc/regex.py b/vimdoc/regex.py index 39c23dc..8e977cd 100644 --- a/vimdoc/regex.py +++ b/vimdoc/regex.py @@ -42,6 +42,10 @@ True >>> section_args.match('The Beginning, beg').groups() ('The Beginning', 'beg') +>>> parent_section_args.match('123') +>>> parent_section_args.match('foo').groups() +('foo',) + >>> backmatter_args.match('123') >>> backmatter_args.match('foo').groups() ('foo',) @@ -211,7 +215,8 @@ section_args = re.compile(r""" # MATCH GROUP 1: The Name ( # Non-commas or escaped commas or escaped escapes. - (?:[^\\,]|\\.)+ + # Must not end with a space. + (?:[^\\,]|\\.)+\S ) # Optional identifier (?: @@ -222,6 +227,7 @@ section_args = re.compile(r""" )? $ """, re.VERBOSE) +parent_section_args = re.compile(r'([a-zA-Z_-][a-zA-Z0-9_-]*)') backmatter_args = re.compile(r'([a-zA-Z_-][a-zA-Z0-9_-]*)') dict_args = re.compile(r""" ^([a-zA-Z_][a-zA-Z0-9]*)(?:\.([a-zA-Z_][a-zA-Z0-9_]*))?$
[usage]How to add something to an exist section? @dbarnett Hi, I am author of SpaceVim, I want to use vimdoc generate doc for SpaceVim-layers. in this PR, https://github.com/SpaceVim/SpaceVim/pull/127 , I define a Layers section in `autoload/SpaceVim/layers.vim`, and all the layers is in `autoload/SpaceVim/layers/`, for example `autoload/SpaceVim/layers/lang/php.vim` is `lang#php` layer. and the doc for this layer is in this vim script, But I want to append the doc of this layer to the end of section Layers, and make the doc looks like: ```help LAYERS *SpaceVim-layers* SpaceVim support many kinds of layers, in each layer contains some plugins and config. here is the list of layers supported by SpaceVim. lang#php : this layer is for php development, and it provide auto codo completion, and syntax check, and jump to the definition location. requirement: PHP 5.3+ PCNTL Extension Msgpack 0.5.7+(for NeoVim) Extension or JSON(for Vim 7.4+) Extension Composer Project ```
google/vimdoc
diff --git a/tests/module_tests.py b/tests/module_tests.py index 1226997..1e74e04 100644 --- a/tests/module_tests.py +++ b/tests/module_tests.py @@ -64,6 +64,64 @@ class TestVimModule(unittest.TestCase): main_module.Close() self.assertEqual([commands, about, intro], list(main_module.Chunks())) + def test_child_sections(self): + """Sections should be ordered after their parents.""" + plugin = module.VimPlugin('myplugin') + main_module = module.Module('myplugin', plugin) + first = Block(vimdoc.SECTION) + first.Local(name='Section 1', id='first') + # Configure explicit order. + first.Global(order=['first', 'second', 'third']) + second = Block(vimdoc.SECTION) + second.Local(name='Section 2', id='second') + third = Block(vimdoc.SECTION) + third.Local(name='Section 3', id='third') + child11 = Block(vimdoc.SECTION) + child11.Local(name='child11', id='child11', parent_id='first') + child12 = Block(vimdoc.SECTION) + child12.Local(name='child12', id='child12', parent_id='first') + child21 = Block(vimdoc.SECTION) + child21.Local(name='child21', id='child21', parent_id='second') + # Merge in arbitrary order. + for m in [second, child12, third, child11, first, child21]: + main_module.Merge(m) + main_module.Close() + self.assertEqual( + [first, child11, child12, second, child21, third], + list(main_module.Chunks())) + + def test_missing_parent(self): + """Parent sections should exist.""" + plugin = module.VimPlugin('myplugin') + main_module = module.Module('myplugin', plugin) + first = Block(vimdoc.SECTION) + first.Local(name='Section 1', id='first') + second = Block(vimdoc.SECTION) + second.Local(name='Section 2', id='second', parent_id='missing') + main_module.Merge(first) + main_module.Merge(second) + with self.assertRaises(error.NoSuchParentSection) as cm: + main_module.Close() + expected = ( + 'Section Section 2 has non-existent parent missing. ' + 'Try setting the id of the parent section explicitly.') + self.assertEqual((expected,), cm.exception.args) + + def test_ordered_child(self): + """Child sections should not be included in @order.""" + plugin = module.VimPlugin('myplugin') + main_module = module.Module('myplugin', plugin) + first = Block(vimdoc.SECTION) + first.Local(name='Section 1', id='first') + second = Block(vimdoc.SECTION) + second.Local(name='Section 2', id='second', parent_id='first') + first.Global(order=['first', 'second']) + main_module.Merge(first) + main_module.Merge(second) + with self.assertRaises(error.OrderedChildSections) as cm: + main_module.Close() + self.assertEqual(("Child section second included in ordering ['first', 'second'].",), cm.exception.args) + def test_partial_ordering(self): """Always respect explicit order and prefer built-in ordering.
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 7 }
0.6
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work packaging @ file:///croot/packaging_1734472117206/work pluggy @ file:///croot/pluggy_1733169602837/work pytest @ file:///croot/pytest_1738938843180/work tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work -e git+https://github.com/google/vimdoc.git@1634f964109d66746b2b79f083ef8e0cdb068ee4#egg=vimdoc
name: vimdoc channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 prefix: /opt/conda/envs/vimdoc
[ "tests/module_tests.py::TestVimModule::test_child_sections", "tests/module_tests.py::TestVimModule::test_missing_parent", "tests/module_tests.py::TestVimModule::test_ordered_child" ]
[]
[ "tests/module_tests.py::TestVimModule::test_default_section_ordering", "tests/module_tests.py::TestVimModule::test_duplicate_section", "tests/module_tests.py::TestVimModule::test_manual_section_ordering", "tests/module_tests.py::TestVimModule::test_partial_ordering", "tests/module_tests.py::TestVimModule::test_section" ]
[]
Apache License 2.0
984
[ "vimdoc/block.py", "vimdoc/module.py", "vimdoc/docline.py", "vimdoc/output.py", "README.md", "vimdoc/regex.py", "vimdoc/error.py" ]
[ "vimdoc/block.py", "vimdoc/module.py", "vimdoc/docline.py", "vimdoc/output.py", "README.md", "vimdoc/regex.py", "vimdoc/error.py" ]
tornadoweb__tornado-1936
69253c820df473407c562a227d0ba36df25018ab
2017-01-27 00:17:20
ecd8968c5135b810cd607b5902dda2cd32122b39
diff --git a/tornado/concurrent.py b/tornado/concurrent.py index ec68dc4f..e7b0e44e 100644 --- a/tornado/concurrent.py +++ b/tornado/concurrent.py @@ -234,7 +234,10 @@ class Future(object): if self._result is not None: return self._result if self._exc_info is not None: - raise_exc_info(self._exc_info) + try: + raise_exc_info(self._exc_info) + finally: + self = None self._check_done() return self._result diff --git a/tornado/gen.py b/tornado/gen.py index d7df3b52..8e6a5940 100644 --- a/tornado/gen.py +++ b/tornado/gen.py @@ -315,6 +315,7 @@ def _make_coroutine_wrapper(func, replace_callback): future.set_exc_info(sys.exc_info()) else: _futures_to_runners[future] = Runner(result, future, yielded) + yielded = None try: return future finally: @@ -990,6 +991,7 @@ class Runner(object): # of the coroutine. self.stack_context_deactivate = None if self.handle_yield(first_yielded): + gen = result_future = first_yielded = None self.run() def register_callback(self, key): @@ -1046,10 +1048,15 @@ class Runner(object): except Exception: self.had_exception = True exc_info = sys.exc_info() + future = None if exc_info is not None: - yielded = self.gen.throw(*exc_info) - exc_info = None + try: + yielded = self.gen.throw(*exc_info) + finally: + # Break up a reference to itself + # for faster GC on CPython. + exc_info = None else: yielded = self.gen.send(value) @@ -1082,6 +1089,7 @@ class Runner(object): return if not self.handle_yield(yielded): return + yielded = None finally: self.running = False @@ -1130,8 +1138,11 @@ class Runner(object): self.future.set_exc_info(sys.exc_info()) if not self.future.done() or self.future is moment: + def inner(f): + f = None + self.run() self.io_loop.add_future( - self.future, lambda f: self.run()) + self.future, inner) return False return True diff --git a/tornado/http1connection.py b/tornado/http1connection.py index 7ee83161..464ca4d3 100644 --- a/tornado/http1connection.py +++ b/tornado/http1connection.py @@ -257,6 +257,7 @@ class HTTP1Connection(httputil.HTTPConnection): if need_delegate_close: with _ExceptionLoggingContext(app_log): delegate.on_connection_close() + header_future = None self._clear_callbacks() raise gen.Return(True) diff --git a/tornado/util.py b/tornado/util.py index d0f83d1f..186995f3 100644 --- a/tornado/util.py +++ b/tornado/util.py @@ -193,7 +193,11 @@ def exec_in(code, glob, loc=None): if PY3: exec(""" def raise_exc_info(exc_info): - raise exc_info[1].with_traceback(exc_info[2]) + try: + raise exc_info[1].with_traceback(exc_info[2]) + finally: + exc_info = None + """) else: exec("""
Possible memory leak Hi, I have memory leaks even in "hello, world" example listed here http://www.tornadoweb.org/en/stable/ Code of tornado_memory_test.py: http://pastebin.com/BfG7Na9Z Here is an example of a problem: $ python tornado_memory_test.py No memory leaks found! No memory leaks found! [I 161031 18:00:54 web:1946] 200 GET /test (127.0.0.1) 0.87ms Memory garbage detected [gc stat]: 73 objects in garbage Memory garbage detected [gc stat]: 73 objects in garbage Memory garbage detected [gc stat]: 73 objects in garbage [I 161031 18:01:11 web:1946] 200 GET /test (127.0.0.1) 0.73ms Memory garbage detected [gc stat]: 146 objects in garbage Here is a verbose output of garbage: http://pastebin.com/BzXudRXd $ pip freeze | grep -i tor tornado==4.4.2 $ python -V Python 2.7.12 Also tried on: $ pip freeze | grep tor tornado==4.5.dev1 $ python -V Python 2.7.12
tornadoweb/tornado
diff --git a/tornado/test/gen_test.py b/tornado/test/gen_test.py index 8bbfc5fa..8102f223 100644 --- a/tornado/test/gen_test.py +++ b/tornado/test/gen_test.py @@ -992,6 +992,31 @@ class GenCoroutineTest(AsyncTestCase): self.finished = True + @skipNotCPython + def test_coroutine_refcounting(self): + # On CPython, tasks and their arguments should be released immediately + # without waiting for garbage collection. + @gen.coroutine + def inner(): + class Foo(object): + pass + local_var = Foo() + self.local_ref = weakref.ref(local_var) + yield gen.coroutine(lambda: None)() + raise ValueError('Some error') + + @gen.coroutine + def inner2(): + try: + yield inner() + except ValueError: + pass + + self.io_loop.run_sync(inner2, timeout=3) + + self.assertIs(self.local_ref(), None) + self.finished = True + class GenSequenceHandler(RequestHandler): @asynchronous
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 3, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 4 }
4.4
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "sphinx", "sphinx_rtd_theme", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work Babel==2.11.0 certifi==2021.5.30 charset-normalizer==2.0.12 docutils==0.18.1 idna==3.10 imagesize==1.4.1 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work Jinja2==3.0.3 MarkupSafe==2.0.1 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work Pygments==2.14.0 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 pytz==2025.2 requests==2.27.1 snowballstemmer==2.2.0 Sphinx==5.3.0 sphinx-rtd-theme==2.0.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jquery==4.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 toml @ file:///tmp/build/80754af9/toml_1616166611790/work -e git+https://github.com/tornadoweb/tornado.git@69253c820df473407c562a227d0ba36df25018ab#egg=tornado typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: tornado channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - babel==2.11.0 - charset-normalizer==2.0.12 - docutils==0.18.1 - idna==3.10 - imagesize==1.4.1 - jinja2==3.0.3 - markupsafe==2.0.1 - pygments==2.14.0 - pytz==2025.2 - requests==2.27.1 - snowballstemmer==2.2.0 - sphinx==5.3.0 - sphinx-rtd-theme==2.0.0 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jquery==4.1 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - urllib3==1.26.20 prefix: /opt/conda/envs/tornado
[ "tornado/test/gen_test.py::GenCoroutineTest::test_coroutine_refcounting" ]
[]
[ "tornado/test/gen_test.py::GenEngineTest::test_arguments", "tornado/test/gen_test.py::GenEngineTest::test_async_raise_return", "tornado/test/gen_test.py::GenEngineTest::test_async_raise_return_value", "tornado/test/gen_test.py::GenEngineTest::test_async_raise_return_value_tuple", "tornado/test/gen_test.py::GenEngineTest::test_bogus_yield", "tornado/test/gen_test.py::GenEngineTest::test_bogus_yield_tuple", "tornado/test/gen_test.py::GenEngineTest::test_exception_in_task_phase1", "tornado/test/gen_test.py::GenEngineTest::test_exception_in_task_phase2", "tornado/test/gen_test.py::GenEngineTest::test_exception_in_yield", "tornado/test/gen_test.py::GenEngineTest::test_exception_phase1", "tornado/test/gen_test.py::GenEngineTest::test_exception_phase2", "tornado/test/gen_test.py::GenEngineTest::test_future", "tornado/test/gen_test.py::GenEngineTest::test_inline_cb", "tornado/test/gen_test.py::GenEngineTest::test_ioloop_cb", "tornado/test/gen_test.py::GenEngineTest::test_key_mismatch", "tornado/test/gen_test.py::GenEngineTest::test_key_mismatch_tuple", "tornado/test/gen_test.py::GenEngineTest::test_key_reuse", "tornado/test/gen_test.py::GenEngineTest::test_key_reuse_tuple", "tornado/test/gen_test.py::GenEngineTest::test_leaked_callback", "tornado/test/gen_test.py::GenEngineTest::test_leaked_callback_tuple", "tornado/test/gen_test.py::GenEngineTest::test_multi", "tornado/test/gen_test.py::GenEngineTest::test_multi_dict", "tornado/test/gen_test.py::GenEngineTest::test_multi_dict_future", "tornado/test/gen_test.py::GenEngineTest::test_multi_empty", "tornado/test/gen_test.py::GenEngineTest::test_multi_exceptions", "tornado/test/gen_test.py::GenEngineTest::test_multi_future", "tornado/test/gen_test.py::GenEngineTest::test_multi_future_delayed", "tornado/test/gen_test.py::GenEngineTest::test_multi_future_dict_delayed", "tornado/test/gen_test.py::GenEngineTest::test_multi_future_duplicate", "tornado/test/gen_test.py::GenEngineTest::test_multi_future_exceptions", "tornado/test/gen_test.py::GenEngineTest::test_multi_mixed_types", "tornado/test/gen_test.py::GenEngineTest::test_multi_performance", "tornado/test/gen_test.py::GenEngineTest::test_multi_yieldpoint_delayed", "tornado/test/gen_test.py::GenEngineTest::test_multi_yieldpoint_dict_delayed", "tornado/test/gen_test.py::GenEngineTest::test_no_yield", "tornado/test/gen_test.py::GenEngineTest::test_orphaned_callback", "tornado/test/gen_test.py::GenEngineTest::test_parallel_callback", "tornado/test/gen_test.py::GenEngineTest::test_raise_after_stop", "tornado/test/gen_test.py::GenEngineTest::test_resume_after_exception_in_yield", "tornado/test/gen_test.py::GenEngineTest::test_return_value", "tornado/test/gen_test.py::GenEngineTest::test_return_value_tuple", "tornado/test/gen_test.py::GenEngineTest::test_reuse", "tornado/test/gen_test.py::GenEngineTest::test_stack_context_leak", "tornado/test/gen_test.py::GenEngineTest::test_stack_context_leak_exception", "tornado/test/gen_test.py::GenEngineTest::test_sync_raise_return", "tornado/test/gen_test.py::GenEngineTest::test_sync_raise_return_value", "tornado/test/gen_test.py::GenEngineTest::test_sync_raise_return_value_tuple", "tornado/test/gen_test.py::GenEngineTest::test_task", "tornado/test/gen_test.py::GenEngineTest::test_task_refcounting", "tornado/test/gen_test.py::GenEngineTest::test_task_transfer_stack_context", "tornado/test/gen_test.py::GenEngineTest::test_wait_all", "tornado/test/gen_test.py::GenEngineTest::test_wait_transfer_stack_context", "tornado/test/gen_test.py::GenEngineTest::test_with_arg", "tornado/test/gen_test.py::GenEngineTest::test_with_arg_tuple", "tornado/test/gen_test.py::GenCoroutineTest::test_async_await", "tornado/test/gen_test.py::GenCoroutineTest::test_async_await_mixed_multi_native_future", "tornado/test/gen_test.py::GenCoroutineTest::test_async_await_mixed_multi_native_yieldpoint", "tornado/test/gen_test.py::GenCoroutineTest::test_async_early_return", "tornado/test/gen_test.py::GenCoroutineTest::test_async_gen_return", "tornado/test/gen_test.py::GenCoroutineTest::test_async_raise", "tornado/test/gen_test.py::GenCoroutineTest::test_async_return", "tornado/test/gen_test.py::GenCoroutineTest::test_async_return_no_value", "tornado/test/gen_test.py::GenCoroutineTest::test_async_with_timeout", "tornado/test/gen_test.py::GenCoroutineTest::test_attributes", "tornado/test/gen_test.py::GenCoroutineTest::test_is_coroutine_function", "tornado/test/gen_test.py::GenCoroutineTest::test_moment", "tornado/test/gen_test.py::GenCoroutineTest::test_pass_callback", "tornado/test/gen_test.py::GenCoroutineTest::test_py3_leak_exception_context", "tornado/test/gen_test.py::GenCoroutineTest::test_replace_context_exception", "tornado/test/gen_test.py::GenCoroutineTest::test_replace_yieldpoint_exception", "tornado/test/gen_test.py::GenCoroutineTest::test_sleep", "tornado/test/gen_test.py::GenCoroutineTest::test_swallow_context_exception", "tornado/test/gen_test.py::GenCoroutineTest::test_swallow_yieldpoint_exception", "tornado/test/gen_test.py::GenCoroutineTest::test_sync_gen_return", "tornado/test/gen_test.py::GenCoroutineTest::test_sync_raise", "tornado/test/gen_test.py::GenCoroutineTest::test_sync_return", "tornado/test/gen_test.py::GenCoroutineTest::test_sync_return_no_value", "tornado/test/gen_test.py::GenWebTest::test_async_prepare_error_handler", "tornado/test/gen_test.py::GenWebTest::test_coroutine_exception_handler", "tornado/test/gen_test.py::GenWebTest::test_coroutine_sequence_handler", "tornado/test/gen_test.py::GenWebTest::test_coroutine_unfinished_sequence_handler", "tornado/test/gen_test.py::GenWebTest::test_exception_handler", "tornado/test/gen_test.py::GenWebTest::test_native_coroutine_handler", "tornado/test/gen_test.py::GenWebTest::test_sequence_handler", "tornado/test/gen_test.py::GenWebTest::test_task_handler", "tornado/test/gen_test.py::GenWebTest::test_undecorated_coroutines", "tornado/test/gen_test.py::GenWebTest::test_yield_exception_handler", "tornado/test/gen_test.py::WithTimeoutTest::test_already_resolved", "tornado/test/gen_test.py::WithTimeoutTest::test_completed_concurrent_future", "tornado/test/gen_test.py::WithTimeoutTest::test_completes_before_timeout", "tornado/test/gen_test.py::WithTimeoutTest::test_fails_before_timeout", "tornado/test/gen_test.py::WithTimeoutTest::test_timeout", "tornado/test/gen_test.py::WithTimeoutTest::test_timeout_concurrent_future", "tornado/test/gen_test.py::WaitIteratorTest::test_already_done", "tornado/test/gen_test.py::WaitIteratorTest::test_empty_iterator", "tornado/test/gen_test.py::WaitIteratorTest::test_iterator", "tornado/test/gen_test.py::WaitIteratorTest::test_iterator_async_await", "tornado/test/gen_test.py::WaitIteratorTest::test_no_ref", "tornado/test/gen_test.py::RunnerGCTest::test_gc" ]
[]
Apache License 2.0
985
[ "tornado/util.py", "tornado/concurrent.py", "tornado/http1connection.py", "tornado/gen.py" ]
[ "tornado/util.py", "tornado/concurrent.py", "tornado/http1connection.py", "tornado/gen.py" ]
red-hat-storage__rhcephpkg-91
ccc287abb2d2674338a8f80dbb825a10f834f2f5
2017-01-27 00:26:11
ccc287abb2d2674338a8f80dbb825a10f834f2f5
coveralls: [![Coverage Status](https://coveralls.io/builds/9866736/badge)](https://coveralls.io/builds/9866736) Coverage decreased (-0.2%) to 68.107% when pulling **59466d6b4a5f87ab80c729ea80a5f09b21ba1f39 on merge-patches-force** into **ccc287abb2d2674338a8f80dbb825a10f834f2f5 on master**.
diff --git a/rhcephpkg/merge_patches.py b/rhcephpkg/merge_patches.py index 9db15c2..6cb48d1 100644 --- a/rhcephpkg/merge_patches.py +++ b/rhcephpkg/merge_patches.py @@ -14,23 +14,30 @@ that into our local patch-queue branch, so that both branches align. This command helps to align the patch series between our RHEL packages and our Ubuntu packages. +Options: +--force Do a hard reset, rather than restricting to fast-forward merges + only. Use this option if the RHEL patches branch was amended or + rebased for some reason. """ name = 'merge-patches' def __init__(self, argv): self.argv = argv - self.options = [] + self.options = ['--force', '--hard-reset'] def main(self): self.parser = Transport(self.argv, options=self.options) self.parser.catch_help = self.help() self.parser.parse_args() - self._run() + force = False + if self.parser.has(['--force', '--hard-reset']): + force = True + self._run(force) def help(self): return self._help - def _run(self): + def _run(self, force=False): # Determine the names of the relevant branches current_branch = util.current_branch() debian_branch = util.current_debian_branch() @@ -43,6 +50,10 @@ Ubuntu packages. # For example: "git pull --ff-only patches/ceph-2-rhel-patches" cmd = ['git', 'pull', '--ff-only', 'patches/' + rhel_patches_branch] + if force: + # Do a hard reset on HEAD instead. + cmd = ['git', 'reset', '--hard', + 'patches/' + rhel_patches_branch] else: # HEAD is our debian branch. Use "git fetch" to update the # patch-queue ref. For example: @@ -50,6 +61,10 @@ Ubuntu packages. # patches/ceph-2-rhel-patches:patch-queue/ceph-2-ubuntu" cmd = ['git', 'fetch', '.', 'patches/%s:%s' % (rhel_patches_branch, patches_branch)] + if force: + # Do a hard push (with "+") instead. + cmd = ['git', 'push', '.', '+%s:patches/%s' % + (patches_branch, rhel_patches_branch)] log.info(' '.join(cmd)) subprocess.check_call(cmd)
"merge-patches --hard-reset" Currently the `rhcephpkg merge-patches` command can automatically merge patches from the rdopkg -patches branch *as long as* it is a fast-forward merge. Sometimes if we need to back out a patch, this is no longer a fast-forward merge, and we have to do the following by hand instead: ``` $ git checkout patch-queue/ceph-2-ubuntu $ git reset --hard patches/ceph-2-rhel-patches ``` It would be great to have a `rhcephpkg merge-patches --hard-reset` to do this automatically.
red-hat-storage/rhcephpkg
diff --git a/rhcephpkg/tests/test_merge_patches.py b/rhcephpkg/tests/test_merge_patches.py index 90da51c..308f0aa 100644 --- a/rhcephpkg/tests/test_merge_patches.py +++ b/rhcephpkg/tests/test_merge_patches.py @@ -42,6 +42,31 @@ class TestMergePatches(object): expected = ['git', 'pull', '--ff-only', 'patches/ceph-2-rhel-patches'] assert self.last_cmd == expected + def test_force_on_debian_branch(self, monkeypatch): + monkeypatch.setenv('HOME', FIXTURES_DIR) + monkeypatch.setattr('subprocess.check_call', self.fake_check_call) + # set current_branch() to a debian branch: + monkeypatch.setattr('rhcephpkg.util.current_branch', + lambda: 'ceph-2-ubuntu') + localbuild = MergePatches(()) + localbuild._run(force=True) + # Verify that we run the "git push" command here. + expected = ['git', 'push', '.', + '+patch-queue/ceph-2-ubuntu:patches/ceph-2-rhel-patches'] + assert self.last_cmd == expected + + def test_force_on_patch_queue_branch(self, monkeypatch): + monkeypatch.setenv('HOME', FIXTURES_DIR) + monkeypatch.setattr('subprocess.check_call', self.fake_check_call) + # set current_branch() to a patch-queue branch: + monkeypatch.setattr('rhcephpkg.util.current_branch', + lambda: 'patch-queue/ceph-2-ubuntu') + localbuild = MergePatches(()) + localbuild._run(force=True) + # Verify that we run the "git reset" command here. + expected = ['git', 'reset', '--hard', 'patches/ceph-2-rhel-patches'] + assert self.last_cmd == expected + class TestMergePatchesRhelPatchesBranch(object):
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 3 }, "num_modified_files": 1 }
1.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-flake8" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 flake8==5.0.4 idna==3.10 importlib-metadata==4.2.0 iniconfig==1.1.1 mccabe==0.7.0 multi-key-dict==2.0.3 packaging==21.3 pbr==6.1.1 pluggy==1.0.0 py==1.11.0 pycodestyle==2.9.1 pyflakes==2.5.0 pyparsing==3.1.4 pytest==7.0.1 pytest-flake8==1.1.1 python-jenkins==1.8.2 requests==2.27.1 -e git+https://github.com/red-hat-storage/rhcephpkg.git@ccc287abb2d2674338a8f80dbb825a10f834f2f5#egg=rhcephpkg six==1.17.0 tambo==0.4.0 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 zipp==3.6.0
name: rhcephpkg channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - charset-normalizer==2.0.12 - flake8==5.0.4 - idna==3.10 - importlib-metadata==4.2.0 - iniconfig==1.1.1 - mccabe==0.7.0 - multi-key-dict==2.0.3 - packaging==21.3 - pbr==6.1.1 - pluggy==1.0.0 - py==1.11.0 - pycodestyle==2.9.1 - pyflakes==2.5.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-flake8==1.1.1 - python-jenkins==1.8.2 - requests==2.27.1 - six==1.17.0 - tambo==0.4.0 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/rhcephpkg
[ "rhcephpkg/tests/test_merge_patches.py::TestMergePatches::test_force_on_debian_branch", "rhcephpkg/tests/test_merge_patches.py::TestMergePatches::test_force_on_patch_queue_branch" ]
[]
[ "rhcephpkg/tests/test_merge_patches.py::TestMergePatches::test_merge_patch_on_debian_branch", "rhcephpkg/tests/test_merge_patches.py::TestMergePatches::test_merge_patch_on_patch_queue_branch", "rhcephpkg/tests/test_merge_patches.py::TestMergePatchesRhelPatchesBranch::test_get_rhel_patches_branch[ceph-1.3-ubuntu-ceph-1.3-rhel-patches]", "rhcephpkg/tests/test_merge_patches.py::TestMergePatchesRhelPatchesBranch::test_get_rhel_patches_branch[ceph-2-ubuntu-ceph-2-rhel-patches]", "rhcephpkg/tests/test_merge_patches.py::TestMergePatchesRhelPatchesBranch::test_get_rhel_patches_branch[ceph-2-trusty-ceph-2-rhel-patches]", "rhcephpkg/tests/test_merge_patches.py::TestMergePatchesRhelPatchesBranch::test_get_rhel_patches_branch[ceph-2-xenial-ceph-2-rhel-patches]", "rhcephpkg/tests/test_merge_patches.py::TestMergePatchesRhelPatchesBranch::test_get_rhel_patches_branch[someotherproduct-2-ubuntu-someotherproduct-2-rhel-patches]" ]
[]
MIT License
986
[ "rhcephpkg/merge_patches.py" ]
[ "rhcephpkg/merge_patches.py" ]
falconry__falcon-993
673bb2e13613f04462a5515ba41f84dbab142970
2017-01-27 00:42:54
673bb2e13613f04462a5515ba41f84dbab142970
codecov-io: ## [Current coverage](https://codecov.io/gh/falconry/falcon/pull/993?src=pr) is 100% (diff: 100%) > Merging [#993](https://codecov.io/gh/falconry/falcon/pull/993?src=pr) into [master](https://codecov.io/gh/falconry/falcon/branch/master?src=pr) will not change coverage ```diff @@ master #993 diff @@ ==================================== Files 31 31 Lines 2066 2066 Methods 0 0 Messages 0 0 Branches 335 335 ==================================== Hits 2066 2066 Misses 0 0 Partials 0 0 ``` > Powered by [Codecov](https://codecov.io?src=pr). Last update [673bb2e...4fa2fa6](https://codecov.io/gh/falconry/falcon/compare/673bb2e13613f04462a5515ba41f84dbab142970...4fa2fa63786fecc043c0dc370aa504756016240d?src=pr)
diff --git a/falcon/responders.py b/falcon/responders.py index da093e4..f4dce2f 100644 --- a/falcon/responders.py +++ b/falcon/responders.py @@ -17,7 +17,7 @@ from falcon.errors import HTTPBadRequest from falcon.errors import HTTPMethodNotAllowed from falcon.errors import HTTPNotFound -from falcon.status_codes import HTTP_204 +from falcon.status_codes import HTTP_200 def path_not_found(req, resp, **kwargs): @@ -56,7 +56,7 @@ def create_default_options(allowed_methods): allowed = ', '.join(allowed_methods) def on_options(req, resp, **kwargs): - resp.status = HTTP_204 + resp.status = HTTP_200 resp.set_header('Allow', allowed) resp.set_header('Content-Length', '0')
Default OPTIONS responder does not set Content-Length to "0" Per RFC 7231: > A server MUST generate a Content-Length field with a value of "0" if no payload body is to be sent in the response.
falconry/falcon
diff --git a/tests/test_after_hooks.py b/tests/test_after_hooks.py index d3ca908..7847b85 100644 --- a/tests/test_after_hooks.py +++ b/tests/test_after_hooks.py @@ -210,7 +210,7 @@ class TestHooks(testing.TestCase): # Decorator should not affect the default on_options responder result = self.simulate_options('/wrapped') - self.assertEqual(result.status_code, 204) + self.assertEqual(result.status_code, 200) self.assertFalse(result.text) def test_wrapped_resource_with_hooks_aware_of_resource(self): @@ -230,5 +230,5 @@ class TestHooks(testing.TestCase): # Decorator should not affect the default on_options responder result = self.simulate_options('/wrapped_aware') - self.assertEqual(result.status_code, 204) + self.assertEqual(result.status_code, 200) self.assertFalse(result.text) diff --git a/tests/test_http_method_routing.py b/tests/test_http_method_routing.py index 1f1e79b..7949692 100644 --- a/tests/test_http_method_routing.py +++ b/tests/test_http_method_routing.py @@ -89,6 +89,7 @@ class MiscResource(object): pass def on_options(self, req, resp): + # NOTE(kgriffs): The default responder returns 200 resp.status = falcon.HTTP_204 # NOTE(kgriffs): This is incorrect, but only return GET so @@ -192,16 +193,16 @@ class TestHttpMethodRouting(testing.TestBase): self.assertThat(headers, Contains(allow_header)) - def test_on_options(self): + def test_default_on_options(self): self.simulate_request('/things/84/stuff/65', method='OPTIONS') - self.assertEqual(self.srmock.status, falcon.HTTP_204) + self.assertEqual(self.srmock.status, falcon.HTTP_200) headers = self.srmock.headers allow_header = ('allow', 'GET, HEAD, PUT') self.assertThat(headers, Contains(allow_header)) - def test_default_on_options(self): + def test_on_options(self): self.simulate_request('/misc', method='OPTIONS') self.assertEqual(self.srmock.status, falcon.HTTP_204)
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 1 }, "num_modified_files": 1 }
1.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "tools/test-requires" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 ddt==1.7.2 -e git+https://github.com/falconry/falcon.git@673bb2e13613f04462a5515ba41f84dbab142970#egg=falcon fixtures==4.0.1 idna==3.10 importlib-metadata==4.8.3 iniconfig==1.1.1 packaging==21.3 pbr==6.1.1 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 python-mimeparse==1.6.0 PyYAML==6.0.1 requests==2.27.1 six==1.17.0 testtools==2.6.0 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 zipp==3.6.0
name: falcon channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - charset-normalizer==2.0.12 - coverage==6.2 - ddt==1.7.2 - fixtures==4.0.1 - idna==3.10 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - packaging==21.3 - pbr==6.1.1 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-mimeparse==1.6.0 - pyyaml==6.0.1 - requests==2.27.1 - six==1.17.0 - testtools==2.6.0 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/falcon
[ "tests/test_after_hooks.py::TestHooks::test_wrapped_resource", "tests/test_after_hooks.py::TestHooks::test_wrapped_resource_with_hooks_aware_of_resource", "tests/test_http_method_routing.py::TestHttpMethodRouting::test_default_on_options" ]
[ "tests/test_httperror.py::TestHTTPError::test_custom_new_error_serializer", "tests/test_httperror.py::TestHTTPError::test_custom_old_error_serializer", "tests/test_utils.py::TestFalconUtils::test_deprecated_decorator" ]
[ "tests/test_access_route.py::test_remote_addr_only", "tests/test_access_route.py::test_rfc_forwarded", "tests/test_access_route.py::test_malformed_rfc_forwarded", "tests/test_access_route.py::test_x_forwarded_for", "tests/test_access_route.py::test_x_real_ip", "tests/test_access_route.py::test_remote_addr", "tests/test_access_route.py::test_remote_addr_missing", "tests/test_after_hooks.py::TestHooks::test_hook_as_callable_class", "tests/test_after_hooks.py::TestHooks::test_output_validator", "tests/test_after_hooks.py::TestHooks::test_serializer", "tests/test_before_hooks.py::TestHooks::test_field_validator", "tests/test_before_hooks.py::TestHooks::test_input_validator", "tests/test_before_hooks.py::TestHooks::test_multiple_resource_hooks", "tests/test_before_hooks.py::TestHooks::test_param_validator", "tests/test_before_hooks.py::TestHooks::test_parser", "tests/test_before_hooks.py::TestHooks::test_wrapped_resource", "tests/test_before_hooks.py::TestHooks::test_wrapped_resource_with_hooks_aware_of_resource", "tests/test_boundedstream.py::test_not_writeable", "tests/test_cmd_print_api.py::TestPrintRoutes::test_traverse", "tests/test_cmd_print_api.py::TestPrintRoutes::test_traverse_with_verbose", "tests/test_cookies.py::test_response_base_case", "tests/test_cookies.py::test_response_disable_secure_globally", "tests/test_cookies.py::test_response_complex_case", "tests/test_cookies.py::test_cookie_expires_naive", "tests/test_cookies.py::test_cookie_expires_aware", "tests/test_cookies.py::test_cookies_setable", "tests/test_cookies.py::test_cookie_max_age_float_and_string[foofloat]", "tests/test_cookies.py::test_cookie_max_age_float_and_string[foostring]", "tests/test_cookies.py::test_response_unset_cookie", "tests/test_cookies.py::test_cookie_timezone", "tests/test_cookies.py::test_request_cookie_parsing", "tests/test_cookies.py::test_unicode_inside_ascii_range", "tests/test_cookies.py::test_non_ascii_name[Unicode_\\xc3\\xa6\\xc3\\xb8]", "tests/test_cookies.py::test_non_ascii_name[Unicode_\\xc3\\x83\\xc2\\xa6\\xc3\\x83\\xc2\\xb8]", "tests/test_cookies.py::test_non_ascii_name[42]", "tests/test_cookies.py::test_non_ascii_value[Unicode_\\xc3\\xa6\\xc3\\xb8]", "tests/test_cookies.py::test_non_ascii_value[Unicode_\\xc3\\x83\\xc2\\xa6\\xc3\\x83\\xc2\\xb8]", "tests/test_cookies.py::test_non_ascii_value[42]", "tests/test_custom_router.py::TestCustomRouter::test_can_pass_additional_params_to_add_route", "tests/test_custom_router.py::TestCustomRouter::test_custom_router_add_route_should_be_used", "tests/test_custom_router.py::TestCustomRouter::test_custom_router_find_should_be_used", "tests/test_default_router.py::TestRegressionCases::test_recipes", "tests/test_default_router.py::TestRegressionCases::test_versioned_url", "tests/test_default_router.py::TestComplexRouting::test_collision_1__teams__collision_", "tests/test_default_router.py::TestComplexRouting::test_collision_2__emojis_signs__id_too_", "tests/test_default_router.py::TestComplexRouting::test_collision_3__repos__org___repo__compare__complex___vs_____complex2___collision_", "tests/test_default_router.py::TestComplexRouting::test_complex_1______5_", "tests/test_default_router.py::TestComplexRouting::test_complex_2____full___10_", "tests/test_default_router.py::TestComplexRouting::test_complex_3____part___15_", "tests/test_default_router.py::TestComplexRouting::test_complex_alt_1______16____repos__org___repo__compare__usr0___branch0___", "tests/test_default_router.py::TestComplexRouting::test_complex_alt_2____full___17____repos__org___repo__compare__usr0___branch0__full__", "tests/test_default_router.py::TestComplexRouting::test_dead_segment_1__teams", "tests/test_default_router.py::TestComplexRouting::test_dead_segment_2__emojis_signs", "tests/test_default_router.py::TestComplexRouting::test_dead_segment_3__gists", "tests/test_default_router.py::TestComplexRouting::test_dead_segment_4__gists_42", "tests/test_default_router.py::TestComplexRouting::test_dump", "tests/test_default_router.py::TestComplexRouting::test_invalid_field_name_1____", "tests/test_default_router.py::TestComplexRouting::test_invalid_field_name_2___9v_", "tests/test_default_router.py::TestComplexRouting::test_invalid_field_name_3____kgriffs_", "tests/test_default_router.py::TestComplexRouting::test_invalid_field_name_4__repos__simple_thing__etc", "tests/test_default_router.py::TestComplexRouting::test_invalid_field_name_5__repos__or_g___repo__compare__thing_", "tests/test_default_router.py::TestComplexRouting::test_invalid_field_name_6__repos__org___repo__compare___", "tests/test_default_router.py::TestComplexRouting::test_invalid_field_name_7__repos__complex______thing_", "tests/test_default_router.py::TestComplexRouting::test_invalid_field_name_8__repos__complex___9v___thing__etc", "tests/test_default_router.py::TestComplexRouting::test_literal", "tests/test_default_router.py::TestComplexRouting::test_literal_segment", "tests/test_default_router.py::TestComplexRouting::test_literal_vs_variable_01____teams_default___19_", "tests/test_default_router.py::TestComplexRouting::test_literal_vs_variable_02____teams_default_members___7_", "tests/test_default_router.py::TestComplexRouting::test_literal_vs_variable_03____teams_foo___6_", "tests/test_default_router.py::TestComplexRouting::test_literal_vs_variable_04____teams_foo_members___7_", "tests/test_default_router.py::TestComplexRouting::test_literal_vs_variable_05____gists_first___20_", "tests/test_default_router.py::TestComplexRouting::test_literal_vs_variable_06____gists_first_raw___18_", "tests/test_default_router.py::TestComplexRouting::test_literal_vs_variable_07____gists_first_pdf___21_", "tests/test_default_router.py::TestComplexRouting::test_literal_vs_variable_08____gists_1776_pdf___21_", "tests/test_default_router.py::TestComplexRouting::test_literal_vs_variable_09____emojis_signs_78___13_", "tests/test_default_router.py::TestComplexRouting::test_literal_vs_variable_10____emojis_signs_78_small___22_", "tests/test_default_router.py::TestComplexRouting::test_malformed_pattern", "tests/test_default_router.py::TestComplexRouting::test_multivar", "tests/test_default_router.py::TestComplexRouting::test_non_collision_1__repos__org___repo__compare__simple_vs_complex_", "tests/test_default_router.py::TestComplexRouting::test_non_collision_2__repos__complex___vs___simple_", "tests/test_default_router.py::TestComplexRouting::test_non_collision_3__repos__org___repo__compare__complex___vs_____complex2__full", "tests/test_default_router.py::TestComplexRouting::test_not_found_01__this_does_not_exist", "tests/test_default_router.py::TestComplexRouting::test_not_found_02__user_bogus", "tests/test_default_router.py::TestComplexRouting::test_not_found_03__repos_racker_falcon_compare_johndoe_master___janedoe_dev_bogus", "tests/test_default_router.py::TestComplexRouting::test_not_found_04__teams", "tests/test_default_router.py::TestComplexRouting::test_not_found_05__teams_42_members_undefined", "tests/test_default_router.py::TestComplexRouting::test_not_found_06__teams_42_undefined", "tests/test_default_router.py::TestComplexRouting::test_not_found_07__teams_42_undefined_segments", "tests/test_default_router.py::TestComplexRouting::test_not_found_08__teams_default_members_undefined", "tests/test_default_router.py::TestComplexRouting::test_not_found_09__teams_default_members_thing_undefined", "tests/test_default_router.py::TestComplexRouting::test_not_found_10__teams_default_members_thing_undefined_segments", "tests/test_default_router.py::TestComplexRouting::test_not_found_11__teams_default_undefined", "tests/test_default_router.py::TestComplexRouting::test_not_found_12__teams_default_undefined_segments", "tests/test_default_router.py::TestComplexRouting::test_not_found_13__emojis_signs", "tests/test_default_router.py::TestComplexRouting::test_not_found_14__emojis_signs_0_small", "tests/test_default_router.py::TestComplexRouting::test_not_found_15__emojis_signs_0_undefined", "tests/test_default_router.py::TestComplexRouting::test_not_found_16__emojis_signs_0_undefined_segments", "tests/test_default_router.py::TestComplexRouting::test_not_found_17__emojis_signs_20_small", "tests/test_default_router.py::TestComplexRouting::test_not_found_18__emojis_signs_20_undefined", "tests/test_default_router.py::TestComplexRouting::test_not_found_19__emojis_signs_42_undefined", "tests/test_default_router.py::TestComplexRouting::test_not_found_20__emojis_signs_78_undefined", "tests/test_default_router.py::TestComplexRouting::test_override", "tests/test_default_router.py::TestComplexRouting::test_single_character_field_name", "tests/test_default_router.py::TestComplexRouting::test_subsegment_not_found", "tests/test_default_router.py::TestComplexRouting::test_variable", "tests/test_deps.py::TestDeps::test_mimeparse_correct_package", "tests/test_error.py::TestError::test_http_bad_gateway_entity_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_bad_gateway_entity_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_bad_request_no_title_and_desc", "tests/test_error.py::TestError::test_http_bad_request_with_title_and_desc", "tests/test_error.py::TestError::test_http_conflict_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_conflict_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_failed_dependency_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_failed_dependency_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_forbidden_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_forbidden_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_insufficient_storage_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_insufficient_storage_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_internal_server_error_entity_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_internal_server_error_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_length_required_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_length_required_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_locked_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_locked_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_loop_detected_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_loop_detected_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_not_acceptable_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_not_acceptable_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_precondition_faild_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_precondition_failed_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_request_entity_too_large_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_request_entity_too_large_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_service_unavailable_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_service_unavailable_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_too_many_requests_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_too_many_requests_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_unauthorized_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_unauthorized_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_unavailable_for_legal_reasons_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_unavailable_for_legal_reasons_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_unprocessable_entity_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_unprocessable_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_unsupported_media_type_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_unsupported_media_type_with_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_uri_too_long_no_title_and_desc_and_challenges", "tests/test_error.py::TestError::test_http_uri_too_long_with_title_and_desc_and_challenges", "tests/test_error_handlers.py::TestErrorHandler::test_caught_error", "tests/test_error_handlers.py::TestErrorHandler::test_converted_error", "tests/test_error_handlers.py::TestErrorHandler::test_error_order_duplicate", "tests/test_error_handlers.py::TestErrorHandler::test_error_order_subclass", "tests/test_error_handlers.py::TestErrorHandler::test_error_order_subclass_masked", "tests/test_error_handlers.py::TestErrorHandler::test_handle_not_defined", "tests/test_error_handlers.py::TestErrorHandler::test_subclass_error", "tests/test_error_handlers.py::TestErrorHandler::test_uncaught_error", "tests/test_error_handlers.py::TestErrorHandler::test_uncaught_error_else", "tests/test_headers.py::TestHeaders::test_add_link_complex", "tests/test_headers.py::TestHeaders::test_add_link_multiple", "tests/test_headers.py::TestHeaders::test_add_link_single", "tests/test_headers.py::TestHeaders::test_add_link_with_anchor", "tests/test_headers.py::TestHeaders::test_add_link_with_hreflang", "tests/test_headers.py::TestHeaders::test_add_link_with_hreflang_multi", "tests/test_headers.py::TestHeaders::test_add_link_with_title", "tests/test_headers.py::TestHeaders::test_add_link_with_title_star", "tests/test_headers.py::TestHeaders::test_add_link_with_type_hint", "tests/test_headers.py::TestHeaders::test_content_header_missing", "tests/test_headers.py::TestHeaders::test_content_length", "tests/test_headers.py::TestHeaders::test_content_length_options", "tests/test_headers.py::TestHeaders::test_content_type_no_body", "tests/test_headers.py::TestHeaders::test_custom_content_type", "tests/test_headers.py::TestHeaders::test_default_media_type", "tests/test_headers.py::TestHeaders::test_default_value", "tests/test_headers.py::TestHeaders::test_headers_as_list", "tests/test_headers.py::TestHeaders::test_no_content_length_1_204_No_Content", "tests/test_headers.py::TestHeaders::test_no_content_length_2_304_Not_Modified", "tests/test_headers.py::TestHeaders::test_no_content_type_1_204_No_Content", "tests/test_headers.py::TestHeaders::test_no_content_type_2_304_Not_Modified", "tests/test_headers.py::TestHeaders::test_override_default_media_type_1___text_plain__charset_UTF_8____Hello_Unicode_____", "tests/test_headers.py::TestHeaders::test_override_default_media_type_2___text_plain____Hello_ISO_8859_1___", "tests/test_headers.py::TestHeaders::test_override_default_media_type_missing_encoding", "tests/test_headers.py::TestHeaders::test_passthrough_request_headers", "tests/test_headers.py::TestHeaders::test_required_header", "tests/test_headers.py::TestHeaders::test_response_append_header", "tests/test_headers.py::TestHeaders::test_response_header_helpers_on_get", "tests/test_headers.py::TestHeaders::test_response_set_and_get_header", "tests/test_headers.py::TestHeaders::test_unicode_headers_convertable", "tests/test_headers.py::TestHeaders::test_unicode_location_headers", "tests/test_headers.py::TestHeaders::test_vary_header_1____accept_encoding_____accept_encoding__", "tests/test_headers.py::TestHeaders::test_vary_header_2____accept_encoding____x_auth_token_____accept_encoding__x_auth_token__", "tests/test_headers.py::TestHeaders::test_vary_header_3____accept_encoding____x_auth_token_____accept_encoding__x_auth_token__", "tests/test_headers.py::TestHeaders::test_vary_star", "tests/test_hello.py::TestHelloWorld::test_body_1", "tests/test_hello.py::TestHelloWorld::test_body_2", "tests/test_hello.py::TestHelloWorld::test_body_3", "tests/test_hello.py::TestHelloWorld::test_env_headers_list_of_tuples", "tests/test_hello.py::TestHelloWorld::test_filelike", "tests/test_hello.py::TestHelloWorld::test_filelike_using_helper", "tests/test_hello.py::TestHelloWorld::test_no_body_on_head", "tests/test_hello.py::TestHelloWorld::test_no_route", "tests/test_hello.py::TestHelloWorld::test_root_route", "tests/test_hello.py::TestHelloWorld::test_status_not_set", "tests/test_hello.py::TestHelloWorld::test_stream_chunked", "tests/test_hello.py::TestHelloWorld::test_stream_known_len", "tests/test_http_method_routing.py::TestHttpMethodRouting::test_bogus_method", "tests/test_http_method_routing.py::TestHttpMethodRouting::test_get", "tests/test_http_method_routing.py::TestHttpMethodRouting::test_method_not_allowed_with_param", "tests/test_http_method_routing.py::TestHttpMethodRouting::test_methods_not_allowed_complex", "tests/test_http_method_routing.py::TestHttpMethodRouting::test_methods_not_allowed_simple", "tests/test_http_method_routing.py::TestHttpMethodRouting::test_misc", "tests/test_http_method_routing.py::TestHttpMethodRouting::test_on_options", "tests/test_http_method_routing.py::TestHttpMethodRouting::test_post_not_allowed", "tests/test_http_method_routing.py::TestHttpMethodRouting::test_put", "tests/test_httperror.py::TestHTTPError::test_401", "tests/test_httperror.py::TestHTTPError::test_404_with_body", "tests/test_httperror.py::TestHTTPError::test_404_without_body", "tests/test_httperror.py::TestHTTPError::test_405_with_body", "tests/test_httperror.py::TestHTTPError::test_405_without_body", "tests/test_httperror.py::TestHTTPError::test_405_without_body_with_extra_headers", "tests/test_httperror.py::TestHTTPError::test_405_without_body_with_extra_headers_double_check", "tests/test_httperror.py::TestHTTPError::test_410_with_body", "tests/test_httperror.py::TestHTTPError::test_410_without_body", "tests/test_httperror.py::TestHTTPError::test_411", "tests/test_httperror.py::TestHTTPError::test_413", "tests/test_httperror.py::TestHTTPError::test_414", "tests/test_httperror.py::TestHTTPError::test_414_with_custom_kwargs", "tests/test_httperror.py::TestHTTPError::test_414_with_description", "tests/test_httperror.py::TestHTTPError::test_414_with_title", "tests/test_httperror.py::TestHTTPError::test_416", "tests/test_httperror.py::TestHTTPError::test_429", "tests/test_httperror.py::TestHTTPError::test_429_datetime", "tests/test_httperror.py::TestHTTPError::test_429_no_retry_after", "tests/test_httperror.py::TestHTTPError::test_503_datetime_retry_after", "tests/test_httperror.py::TestHTTPError::test_503_integer_retry_after", "tests/test_httperror.py::TestHTTPError::test_base_class", "tests/test_httperror.py::TestHTTPError::test_client_does_not_accept_anything", "tests/test_httperror.py::TestHTTPError::test_client_does_not_accept_json_or_xml", "tests/test_httperror.py::TestHTTPError::test_custom_old_error_serializer_no_body", "tests/test_httperror.py::TestHTTPError::test_epic_fail_json", "tests/test_httperror.py::TestHTTPError::test_epic_fail_xml_1_text_xml", "tests/test_httperror.py::TestHTTPError::test_epic_fail_xml_2_application_xml", "tests/test_httperror.py::TestHTTPError::test_epic_fail_xml_3_application_vnd_company_system_project_resource_xml_v_1_1", "tests/test_httperror.py::TestHTTPError::test_epic_fail_xml_4_application_atom_xml", "tests/test_httperror.py::TestHTTPError::test_forbidden_1_application_json", "tests/test_httperror.py::TestHTTPError::test_forbidden_2_application_vnd_company_system_project_resource_json_v_1_1", "tests/test_httperror.py::TestHTTPError::test_forbidden_3_application_json_patch_json", "tests/test_httperror.py::TestHTTPError::test_invalid_header", "tests/test_httperror.py::TestHTTPError::test_invalid_param", "tests/test_httperror.py::TestHTTPError::test_misc", "tests/test_httperror.py::TestHTTPError::test_missing_header", "tests/test_httperror.py::TestHTTPError::test_missing_param", "tests/test_httperror.py::TestHTTPError::test_no_description_json", "tests/test_httperror.py::TestHTTPError::test_no_description_xml", "tests/test_httperror.py::TestHTTPError::test_temporary_413_datetime_retry_after", "tests/test_httperror.py::TestHTTPError::test_temporary_413_integer_retry_after", "tests/test_httperror.py::TestHTTPError::test_title_default_message_if_none", "tests/test_httperror.py::TestHTTPError::test_unicode_json", "tests/test_httperror.py::TestHTTPError::test_unicode_xml", "tests/test_httpstatus.py::TestHTTPStatus::test_raise_status_empty_body", "tests/test_httpstatus.py::TestHTTPStatus::test_raise_status_in_before_hook", "tests/test_httpstatus.py::TestHTTPStatus::test_raise_status_in_responder", "tests/test_httpstatus.py::TestHTTPStatus::test_raise_status_runs_after_hooks", "tests/test_httpstatus.py::TestHTTPStatus::test_raise_status_survives_after_hooks", "tests/test_httpstatus.py::TestHTTPStatusWithMiddleware::test_raise_status_in_process_request", "tests/test_httpstatus.py::TestHTTPStatusWithMiddleware::test_raise_status_in_process_resource", "tests/test_httpstatus.py::TestHTTPStatusWithMiddleware::test_raise_status_runs_process_response", "tests/test_middleware.py::TestRequestTimeMiddleware::test_add_invalid_middleware", "tests/test_middleware.py::TestRequestTimeMiddleware::test_log_get_request", "tests/test_middleware.py::TestRequestTimeMiddleware::test_response_middleware_raises_exception", "tests/test_middleware.py::TestRequestTimeMiddleware::test_skip_process_resource", "tests/test_middleware.py::TestTransactionIdMiddleware::test_generate_trans_id_with_request", "tests/test_middleware.py::TestSeveralMiddlewares::test_generate_trans_id_and_time_with_request", "tests/test_middleware.py::TestSeveralMiddlewares::test_independent_middleware_execution_order", "tests/test_middleware.py::TestSeveralMiddlewares::test_inner_mw_throw_exception", "tests/test_middleware.py::TestSeveralMiddlewares::test_inner_mw_with_ex_handler_throw_exception", "tests/test_middleware.py::TestSeveralMiddlewares::test_legacy_middleware_called_with_correct_args", "tests/test_middleware.py::TestSeveralMiddlewares::test_middleware_execution_order", "tests/test_middleware.py::TestSeveralMiddlewares::test_multiple_reponse_mw_throw_exception", "tests/test_middleware.py::TestSeveralMiddlewares::test_order_independent_mw_executed_when_exception_in_req", "tests/test_middleware.py::TestSeveralMiddlewares::test_order_independent_mw_executed_when_exception_in_resp", "tests/test_middleware.py::TestSeveralMiddlewares::test_order_independent_mw_executed_when_exception_in_rsrc", "tests/test_middleware.py::TestSeveralMiddlewares::test_order_mw_executed_when_exception_in_req", "tests/test_middleware.py::TestSeveralMiddlewares::test_order_mw_executed_when_exception_in_resp", "tests/test_middleware.py::TestSeveralMiddlewares::test_order_mw_executed_when_exception_in_rsrc", "tests/test_middleware.py::TestSeveralMiddlewares::test_outer_mw_with_ex_handler_throw_exception", "tests/test_middleware.py::TestRemoveBasePathMiddleware::test_base_path_is_removed_before_routing", "tests/test_middleware.py::TestResourceMiddleware::test_can_access_resource_params", "tests/test_middleware.py::TestErrorHandling::test_error_composed_before_resp_middleware_called", "tests/test_middleware.py::TestErrorHandling::test_http_status_raised_from_error_handler", "tests/test_options.py::TestRequestOptions::test_incorrect_options", "tests/test_options.py::TestRequestOptions::test_option_defaults", "tests/test_options.py::TestRequestOptions::test_options_toggle_1_keep_blank_qs_values", "tests/test_options.py::TestRequestOptions::test_options_toggle_2_auto_parse_form_urlencoded", "tests/test_options.py::TestRequestOptions::test_options_toggle_3_auto_parse_qs_csv", "tests/test_options.py::TestRequestOptions::test_options_toggle_4_strip_url_path_trailing_slash", "tests/test_query_params.py::_TestQueryParams::test_allowed_names", "tests/test_query_params.py::_TestQueryParams::test_bad_percentage", "tests/test_query_params.py::_TestQueryParams::test_blank", "tests/test_query_params.py::_TestQueryParams::test_boolean", "tests/test_query_params.py::_TestQueryParams::test_boolean_blank", "tests/test_query_params.py::_TestQueryParams::test_get_date_invalid", "tests/test_query_params.py::_TestQueryParams::test_get_date_missing_param", "tests/test_query_params.py::_TestQueryParams::test_get_date_store", "tests/test_query_params.py::_TestQueryParams::test_get_date_valid", "tests/test_query_params.py::_TestQueryParams::test_get_date_valid_with_format", "tests/test_query_params.py::_TestQueryParams::test_get_dict_invalid", "tests/test_query_params.py::_TestQueryParams::test_get_dict_missing_param", "tests/test_query_params.py::_TestQueryParams::test_get_dict_store", "tests/test_query_params.py::_TestQueryParams::test_get_dict_valid", "tests/test_query_params.py::_TestQueryParams::test_int", "tests/test_query_params.py::_TestQueryParams::test_int_neg", "tests/test_query_params.py::_TestQueryParams::test_list_transformer", "tests/test_query_params.py::_TestQueryParams::test_list_type", "tests/test_query_params.py::_TestQueryParams::test_list_type_blank", "tests/test_query_params.py::_TestQueryParams::test_multiple_form_keys", "tests/test_query_params.py::_TestQueryParams::test_multiple_form_keys_as_list", "tests/test_query_params.py::_TestQueryParams::test_multiple_keys_as_bool", "tests/test_query_params.py::_TestQueryParams::test_multiple_keys_as_int", "tests/test_query_params.py::_TestQueryParams::test_none", "tests/test_query_params.py::_TestQueryParams::test_option_auto_parse_qs_csv_complex_false", "tests/test_query_params.py::_TestQueryParams::test_option_auto_parse_qs_csv_simple_false", "tests/test_query_params.py::_TestQueryParams::test_option_auto_parse_qs_csv_simple_true", "tests/test_query_params.py::_TestQueryParams::test_param_property", "tests/test_query_params.py::_TestQueryParams::test_percent_encoded", "tests/test_query_params.py::_TestQueryParams::test_required_1_get_param", "tests/test_query_params.py::_TestQueryParams::test_required_2_get_param_as_int", "tests/test_query_params.py::_TestQueryParams::test_required_3_get_param_as_bool", "tests/test_query_params.py::_TestQueryParams::test_required_4_get_param_as_list", "tests/test_query_params.py::_TestQueryParams::test_simple", "tests/test_query_params.py::PostQueryParams::test_allowed_names", "tests/test_query_params.py::PostQueryParams::test_bad_percentage", "tests/test_query_params.py::PostQueryParams::test_blank", "tests/test_query_params.py::PostQueryParams::test_boolean", "tests/test_query_params.py::PostQueryParams::test_boolean_blank", "tests/test_query_params.py::PostQueryParams::test_empty_body", "tests/test_query_params.py::PostQueryParams::test_empty_body_no_content_length", "tests/test_query_params.py::PostQueryParams::test_explicitly_disable_auto_parse", "tests/test_query_params.py::PostQueryParams::test_get_date_invalid", "tests/test_query_params.py::PostQueryParams::test_get_date_missing_param", "tests/test_query_params.py::PostQueryParams::test_get_date_store", "tests/test_query_params.py::PostQueryParams::test_get_date_valid", "tests/test_query_params.py::PostQueryParams::test_get_date_valid_with_format", "tests/test_query_params.py::PostQueryParams::test_get_dict_invalid", "tests/test_query_params.py::PostQueryParams::test_get_dict_missing_param", "tests/test_query_params.py::PostQueryParams::test_get_dict_store", "tests/test_query_params.py::PostQueryParams::test_get_dict_valid", "tests/test_query_params.py::PostQueryParams::test_http_methods_body_expected_1_POST", "tests/test_query_params.py::PostQueryParams::test_http_methods_body_expected_2_PUT", "tests/test_query_params.py::PostQueryParams::test_http_methods_body_expected_3_PATCH", "tests/test_query_params.py::PostQueryParams::test_http_methods_body_expected_4_DELETE", "tests/test_query_params.py::PostQueryParams::test_http_methods_body_expected_5_OPTIONS", "tests/test_query_params.py::PostQueryParams::test_http_methods_body_not_expected_1_GET", "tests/test_query_params.py::PostQueryParams::test_http_methods_body_not_expected_2_HEAD", "tests/test_query_params.py::PostQueryParams::test_int", "tests/test_query_params.py::PostQueryParams::test_int_neg", "tests/test_query_params.py::PostQueryParams::test_list_transformer", "tests/test_query_params.py::PostQueryParams::test_list_type", "tests/test_query_params.py::PostQueryParams::test_list_type_blank", "tests/test_query_params.py::PostQueryParams::test_multiple_form_keys", "tests/test_query_params.py::PostQueryParams::test_multiple_form_keys_as_list", "tests/test_query_params.py::PostQueryParams::test_multiple_keys_as_bool", "tests/test_query_params.py::PostQueryParams::test_multiple_keys_as_int", "tests/test_query_params.py::PostQueryParams::test_non_ascii", "tests/test_query_params.py::PostQueryParams::test_none", "tests/test_query_params.py::PostQueryParams::test_option_auto_parse_qs_csv_complex_false", "tests/test_query_params.py::PostQueryParams::test_option_auto_parse_qs_csv_simple_false", "tests/test_query_params.py::PostQueryParams::test_option_auto_parse_qs_csv_simple_true", "tests/test_query_params.py::PostQueryParams::test_param_property", "tests/test_query_params.py::PostQueryParams::test_percent_encoded", "tests/test_query_params.py::PostQueryParams::test_required_1_get_param", "tests/test_query_params.py::PostQueryParams::test_required_2_get_param_as_int", "tests/test_query_params.py::PostQueryParams::test_required_3_get_param_as_bool", "tests/test_query_params.py::PostQueryParams::test_required_4_get_param_as_list", "tests/test_query_params.py::PostQueryParams::test_simple", "tests/test_query_params.py::GetQueryParams::test_allowed_names", "tests/test_query_params.py::GetQueryParams::test_bad_percentage", "tests/test_query_params.py::GetQueryParams::test_blank", "tests/test_query_params.py::GetQueryParams::test_boolean", "tests/test_query_params.py::GetQueryParams::test_boolean_blank", "tests/test_query_params.py::GetQueryParams::test_get_date_invalid", "tests/test_query_params.py::GetQueryParams::test_get_date_missing_param", "tests/test_query_params.py::GetQueryParams::test_get_date_store", "tests/test_query_params.py::GetQueryParams::test_get_date_valid", "tests/test_query_params.py::GetQueryParams::test_get_date_valid_with_format", "tests/test_query_params.py::GetQueryParams::test_get_dict_invalid", "tests/test_query_params.py::GetQueryParams::test_get_dict_missing_param", "tests/test_query_params.py::GetQueryParams::test_get_dict_store", "tests/test_query_params.py::GetQueryParams::test_get_dict_valid", "tests/test_query_params.py::GetQueryParams::test_int", "tests/test_query_params.py::GetQueryParams::test_int_neg", "tests/test_query_params.py::GetQueryParams::test_list_transformer", "tests/test_query_params.py::GetQueryParams::test_list_type", "tests/test_query_params.py::GetQueryParams::test_list_type_blank", "tests/test_query_params.py::GetQueryParams::test_multiple_form_keys", "tests/test_query_params.py::GetQueryParams::test_multiple_form_keys_as_list", "tests/test_query_params.py::GetQueryParams::test_multiple_keys_as_bool", "tests/test_query_params.py::GetQueryParams::test_multiple_keys_as_int", "tests/test_query_params.py::GetQueryParams::test_none", "tests/test_query_params.py::GetQueryParams::test_option_auto_parse_qs_csv_complex_false", "tests/test_query_params.py::GetQueryParams::test_option_auto_parse_qs_csv_simple_false", "tests/test_query_params.py::GetQueryParams::test_option_auto_parse_qs_csv_simple_true", "tests/test_query_params.py::GetQueryParams::test_param_property", "tests/test_query_params.py::GetQueryParams::test_percent_encoded", "tests/test_query_params.py::GetQueryParams::test_required_1_get_param", "tests/test_query_params.py::GetQueryParams::test_required_2_get_param_as_int", "tests/test_query_params.py::GetQueryParams::test_required_3_get_param_as_bool", "tests/test_query_params.py::GetQueryParams::test_required_4_get_param_as_list", "tests/test_query_params.py::GetQueryParams::test_simple", "tests/test_query_params.py::PostQueryParamsDefaultBehavior::test_dont_auto_parse_by_default", "tests/test_redirects.py::TestRedirects::test_redirect_1___GET____301_Moved_Permanently_____moved_perm__", "tests/test_redirects.py::TestRedirects::test_redirect_2___POST____302_Found_____found__", "tests/test_redirects.py::TestRedirects::test_redirect_3___PUT____303_See_Other_____see_other__", "tests/test_redirects.py::TestRedirects::test_redirect_4___DELETE____307_Temporary_Redirect_____tmp_redirect__", "tests/test_redirects.py::TestRedirects::test_redirect_5___HEAD____308_Permanent_Redirect_____perm_redirect__", "tests/test_req_vars.py::TestReqVars::test_attribute_headers", "tests/test_req_vars.py::TestReqVars::test_bogus_content_length_nan", "tests/test_req_vars.py::TestReqVars::test_bogus_content_length_neg", "tests/test_req_vars.py::TestReqVars::test_client_accepts", "tests/test_req_vars.py::TestReqVars::test_client_accepts_bogus", "tests/test_req_vars.py::TestReqVars::test_client_accepts_props", "tests/test_req_vars.py::TestReqVars::test_client_prefers", "tests/test_req_vars.py::TestReqVars::test_content_length", "tests/test_req_vars.py::TestReqVars::test_content_length_method", "tests/test_req_vars.py::TestReqVars::test_content_type_method", "tests/test_req_vars.py::TestReqVars::test_date_1___Date____date__", "tests/test_req_vars.py::TestReqVars::test_date_2___If_Modified_since____if_modified_since__", "tests/test_req_vars.py::TestReqVars::test_date_3___If_Unmodified_since____if_unmodified_since__", "tests/test_req_vars.py::TestReqVars::test_date_invalid_1___Date____date__", "tests/test_req_vars.py::TestReqVars::test_date_invalid_2___If_Modified_Since____if_modified_since__", "tests/test_req_vars.py::TestReqVars::test_date_invalid_3___If_Unmodified_Since____if_unmodified_since__", "tests/test_req_vars.py::TestReqVars::test_date_missing_1_date", "tests/test_req_vars.py::TestReqVars::test_date_missing_2_if_modified_since", "tests/test_req_vars.py::TestReqVars::test_date_missing_3_if_unmodified_since", "tests/test_req_vars.py::TestReqVars::test_empty", "tests/test_req_vars.py::TestReqVars::test_empty_path", "tests/test_req_vars.py::TestReqVars::test_host", "tests/test_req_vars.py::TestReqVars::test_method", "tests/test_req_vars.py::TestReqVars::test_missing_attribute_header", "tests/test_req_vars.py::TestReqVars::test_missing_qs", "tests/test_req_vars.py::TestReqVars::test_netloc_default_port_1_HTTP_1_0", "tests/test_req_vars.py::TestReqVars::test_netloc_default_port_2_HTTP_1_1", "tests/test_req_vars.py::TestReqVars::test_netloc_from_env_1_HTTP_1_0", "tests/test_req_vars.py::TestReqVars::test_netloc_from_env_2_HTTP_1_1", "tests/test_req_vars.py::TestReqVars::test_netloc_nondefault_port_1_HTTP_1_0", "tests/test_req_vars.py::TestReqVars::test_netloc_nondefault_port_2_HTTP_1_1", "tests/test_req_vars.py::TestReqVars::test_nonlatin_path_1__hello_привет", "tests/test_req_vars.py::TestReqVars::test_nonlatin_path_2__test__E5_BB_B6_E5_AE_89", "tests/test_req_vars.py::TestReqVars::test_nonlatin_path_3__test__C3_A4_C3_B6_C3_BC_C3_9F_E2_82_AC", "tests/test_req_vars.py::TestReqVars::test_port_explicit_1_HTTP_1_0", "tests/test_req_vars.py::TestReqVars::test_port_explicit_2_HTTP_1_1", "tests/test_req_vars.py::TestReqVars::test_range", "tests/test_req_vars.py::TestReqVars::test_range_invalid", "tests/test_req_vars.py::TestReqVars::test_range_unit", "tests/test_req_vars.py::TestReqVars::test_reconstruct_url", "tests/test_req_vars.py::TestReqVars::test_relative_uri", "tests/test_req_vars.py::TestReqVars::test_scheme_http_1_HTTP_1_0", "tests/test_req_vars.py::TestReqVars::test_scheme_http_2_HTTP_1_1", "tests/test_req_vars.py::TestReqVars::test_scheme_https_1_HTTP_1_0", "tests/test_req_vars.py::TestReqVars::test_scheme_https_2_HTTP_1_1", "tests/test_req_vars.py::TestReqVars::test_subdomain", "tests/test_req_vars.py::TestReqVars::test_uri", "tests/test_req_vars.py::TestReqVars::test_uri_http_1_0", "tests/test_req_vars.py::TestReqVars::test_uri_https", "tests/test_request_body.py::TestRequestBody::test_body_stream_wrapper", "tests/test_request_body.py::TestRequestBody::test_bounded_stream_property_empty_body", "tests/test_request_body.py::TestRequestBody::test_empty_body", "tests/test_request_body.py::TestRequestBody::test_read_body", "tests/test_request_body.py::TestRequestBody::test_tiny_body", "tests/test_request_body.py::TestRequestBody::test_tiny_body_overflow", "tests/test_request_context.py::TestRequestContext::test_custom_request_context", "tests/test_request_context.py::TestRequestContext::test_custom_request_context_failure", "tests/test_request_context.py::TestRequestContext::test_custom_request_context_request_access", "tests/test_request_context.py::TestRequestContext::test_default_request_context", "tests/test_response_body.py::TestResponseBody::test_append_body", "tests/test_response_context.py::TestRequestContext::test_custom_response_context", "tests/test_response_context.py::TestRequestContext::test_custom_response_context_factory", "tests/test_response_context.py::TestRequestContext::test_custom_response_context_failure", "tests/test_response_context.py::TestRequestContext::test_default_response_context", "tests/test_sinks.py::TestDefaultRouting::test_multiple_patterns", "tests/test_sinks.py::TestDefaultRouting::test_named_groups", "tests/test_sinks.py::TestDefaultRouting::test_route_precedence", "tests/test_sinks.py::TestDefaultRouting::test_route_precedence_with_both_id", "tests/test_sinks.py::TestDefaultRouting::test_route_precedence_with_id", "tests/test_sinks.py::TestDefaultRouting::test_single_compiled_pattern", "tests/test_sinks.py::TestDefaultRouting::test_single_default_pattern", "tests/test_sinks.py::TestDefaultRouting::test_single_simple_pattern", "tests/test_sinks.py::TestDefaultRouting::test_with_route", "tests/test_slots.py::TestSlots::test_slots_request", "tests/test_slots.py::TestSlots::test_slots_response", "tests/test_uri_templates.py::TestUriTemplates::test_empty_path_component_1___", "tests/test_uri_templates.py::TestUriTemplates::test_empty_path_component_2___begin", "tests/test_uri_templates.py::TestUriTemplates::test_empty_path_component_3__end__", "tests/test_uri_templates.py::TestUriTemplates::test_empty_path_component_4__in__side", "tests/test_uri_templates.py::TestUriTemplates::test_field_name_cannot_start_with_digit_1__hello__1world_", "tests/test_uri_templates.py::TestUriTemplates::test_field_name_cannot_start_with_digit_2___524hello__world", "tests/test_uri_templates.py::TestUriTemplates::test_multiple", "tests/test_uri_templates.py::TestUriTemplates::test_multiple_with_digits", "tests/test_uri_templates.py::TestUriTemplates::test_no_vars", "tests/test_uri_templates.py::TestUriTemplates::test_not_str", "tests/test_uri_templates.py::TestUriTemplates::test_relative_path_1_", "tests/test_uri_templates.py::TestUriTemplates::test_relative_path_2_no", "tests/test_uri_templates.py::TestUriTemplates::test_relative_path_3_no_leading_slash", "tests/test_uri_templates.py::TestUriTemplates::test_root_path", "tests/test_uri_templates.py::TestUriTemplates::test_same_level_complex_var", "tests/test_uri_templates.py::TestUriTemplates::test_same_level_complex_var_in_reverse_order", "tests/test_uri_templates.py::TestUriTemplates::test_single", "tests/test_uri_templates.py::TestUriTemplates::test_single_trailing_slash", "tests/test_uri_templates.py::TestUriTemplates::test_single_with_trailing_digits", "tests/test_uri_templates.py::TestUriTemplates::test_single_with_underscore", "tests/test_uri_templates.py::TestUriTemplates::test_special_chars", "tests/test_uri_templates.py::TestUriTemplates::test_whitespace_not_allowed_1___thing___world", "tests/test_uri_templates.py::TestUriTemplates::test_whitespace_not_allowed_2____thing__world", "tests/test_uri_templates.py::TestUriTemplates::test_whitespace_not_allowed_3____thing___world", "tests/test_uri_templates.py::TestUriTemplates::test_whitespace_not_allowed_4___thing__wo_rld", "tests/test_uri_templates.py::TestUriTemplates::test_whitespace_not_allowed_5___thing___world", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_malformed_field", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_no_fields_1__hello", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_no_fields_2__hello_world", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_no_fields_3__hi_there_how_are_you", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_one_field", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_one_field_with_digits", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_one_field_with_prefixed_digits", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_root", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_string_type_required_1_42", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_string_type_required_2_API", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_template_may_not_contain_double_slash_1___", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_template_may_not_contain_double_slash_2_a__", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_template_may_not_contain_double_slash_3___b", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_template_may_not_contain_double_slash_4_a__b", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_template_may_not_contain_double_slash_5_a_b__", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_template_may_not_contain_double_slash_6_a_b__c", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_template_must_start_with_slash_1_this", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_template_must_start_with_slash_2_this_that", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_three_fields", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_two_fields_1_", "tests/test_uri_templates_legacy.py::TestUriTemplates::test_two_fields_2__", "tests/test_utils.py::TestFalconUtils::test_dt_to_http", "tests/test_utils.py::TestFalconUtils::test_get_http_status", "tests/test_utils.py::TestFalconUtils::test_http_date_to_dt", "tests/test_utils.py::TestFalconUtils::test_http_now", "tests/test_utils.py::TestFalconUtils::test_pack_query_params_none", "tests/test_utils.py::TestFalconUtils::test_pack_query_params_one", "tests/test_utils.py::TestFalconUtils::test_pack_query_params_several", "tests/test_utils.py::TestFalconUtils::test_parse_host", "tests/test_utils.py::TestFalconUtils::test_parse_query_string", "tests/test_utils.py::TestFalconUtils::test_prop_uri_decode_models_stdlib_unquote_plus", "tests/test_utils.py::TestFalconUtils::test_prop_uri_encode_models_stdlib_quote", "tests/test_utils.py::TestFalconUtils::test_prop_uri_encode_value_models_stdlib_quote_safe_tilde", "tests/test_utils.py::TestFalconUtils::test_uri_decode", "tests/test_utils.py::TestFalconUtils::test_uri_encode", "tests/test_utils.py::TestFalconUtils::test_uri_encode_double", "tests/test_utils.py::TestFalconUtils::test_uri_encode_value", "tests/test_utils.py::TestFalconTesting::test_decode_empty_result", "tests/test_utils.py::TestFalconTesting::test_httpnow_alias_for_backwards_compat", "tests/test_utils.py::TestFalconTesting::test_no_prefix_allowed_for_query_strings_in_create_environ", "tests/test_utils.py::TestFalconTesting::test_none_header_value_in_create_environ", "tests/test_utils.py::TestFalconTesting::test_path_escape_chars_in_create_environ", "tests/test_utils.py::test_simulate_request_protocol[https-CONNECT]", "tests/test_utils.py::test_simulate_request_protocol[https-DELETE]", "tests/test_utils.py::test_simulate_request_protocol[https-GET]", "tests/test_utils.py::test_simulate_request_protocol[https-HEAD]", "tests/test_utils.py::test_simulate_request_protocol[https-OPTIONS]", "tests/test_utils.py::test_simulate_request_protocol[https-PATCH]", "tests/test_utils.py::test_simulate_request_protocol[https-POST]", "tests/test_utils.py::test_simulate_request_protocol[https-PUT]", "tests/test_utils.py::test_simulate_request_protocol[https-TRACE]", "tests/test_utils.py::test_simulate_request_protocol[http-CONNECT]", "tests/test_utils.py::test_simulate_request_protocol[http-DELETE]", "tests/test_utils.py::test_simulate_request_protocol[http-GET]", "tests/test_utils.py::test_simulate_request_protocol[http-HEAD]", "tests/test_utils.py::test_simulate_request_protocol[http-OPTIONS]", "tests/test_utils.py::test_simulate_request_protocol[http-PATCH]", "tests/test_utils.py::test_simulate_request_protocol[http-POST]", "tests/test_utils.py::test_simulate_request_protocol[http-PUT]", "tests/test_utils.py::test_simulate_request_protocol[http-TRACE]", "tests/test_utils.py::TestFalconTestCase::test_cached_text_in_result", "tests/test_utils.py::TestFalconTestCase::test_path_must_start_with_slash", "tests/test_utils.py::TestFalconTestCase::test_query_string", "tests/test_utils.py::TestFalconTestCase::test_query_string_in_path", "tests/test_utils.py::TestFalconTestCase::test_query_string_no_question", "tests/test_utils.py::TestFalconTestCase::test_simple_resource_body_json_xor", "tests/test_utils.py::TestFalconTestCase::test_status", "tests/test_utils.py::TestFalconTestCase::test_wsgi_iterable_not_closeable", "tests/test_utils.py::FancyTestCase::test_something", "tests/test_wsgi.py::TestWSGIServer::test_get", "tests/test_wsgi.py::TestWSGIServer::test_put", "tests/test_wsgi.py::TestWSGIServer::test_head_405", "tests/test_wsgi.py::TestWSGIServer::test_post", "tests/test_wsgi.py::TestWSGIServer::test_post_invalid_content_length", "tests/test_wsgi.py::TestWSGIServer::test_post_read_bounded_stream", "tests/test_wsgi.py::TestWSGIServer::test_post_read_bounded_stream_no_body", "tests/test_wsgi_errors.py::TestWSGIError::test_responder_logged_bytestring", "tests/test_wsgi_interface.py::TestWSGIInterface::test_srmock", "tests/test_wsgi_interface.py::TestWSGIInterface::test_pep3333", "tests/test_wsgiref_inputwrapper_with_size.py::TestWsgiRefInputWrapper::test_resources_can_read_request_stream_during_tests" ]
[]
Apache License 2.0
987
[ "falcon/responders.py" ]
[ "falcon/responders.py" ]
google__mobly-90
312070ed24d3e229689a374c7357267879fd2549
2017-01-27 02:05:24
b4362eda0c8148644812849cdb9c741e35d5750d
diff --git a/mobly/controllers/android_device.py b/mobly/controllers/android_device.py index 0d108a8..de89289 100644 --- a/mobly/controllers/android_device.py +++ b/mobly/controllers/android_device.py @@ -558,12 +558,9 @@ class AndroidDevice(object): 'Snippet package "%s" has already been loaded under name' ' "%s".' % (package, client_name)) host_port = utils.get_available_host_port() - # TODO(adorokhine): Don't assume that a free host-side port is free on - # the device as well. Both sides should allocate a unique port. - device_port = host_port client = snippet_client.SnippetClient( - package=package, port=host_port, adb_proxy=self.adb) - self._start_jsonrpc_client(client, host_port, device_port) + package=package, host_port=host_port, adb_proxy=self.adb) + self._start_jsonrpc_client(client) self._snippet_clients[name] = client setattr(self, name, client) @@ -577,41 +574,41 @@ class AndroidDevice(object): If sl4a server is not started on the device, tries to start it. """ host_port = utils.get_available_host_port() - device_port = sl4a_client.DEVICE_SIDE_PORT - self.sl4a = sl4a_client.Sl4aClient(self.adb) - self._start_jsonrpc_client(self.sl4a, host_port, device_port) + self.sl4a = sl4a_client.Sl4aClient( + host_port=host_port, adb_proxy=self.adb) + self._start_jsonrpc_client(self.sl4a) # Start an EventDispatcher for the current sl4a session - event_client = sl4a_client.Sl4aClient(self.adb) + event_client = sl4a_client.Sl4aClient( + host_port=host_port, adb_proxy=self.adb) event_client.connect( - port=host_port, uid=self.sl4a.uid, cmd=jsonrpc_client_base.JsonRpcCommand.CONTINUE) self.ed = event_dispatcher.EventDispatcher(event_client) self.ed.start() - def _start_jsonrpc_client(self, client, host_port, device_port): + def _start_jsonrpc_client(self, client): """Create a connection to a jsonrpc server running on the device. If the connection cannot be made, tries to restart it. """ client.check_app_installed() - self.adb.tcp_forward(host_port, device_port) + self.adb.tcp_forward(client.host_port, client.device_port) try: - client.connect(port=host_port) + client.connect() except: try: client.stop_app() except Exception as e: self.log.warning(e) client.start_app() - client.connect(port=host_port) + client.connect() def _terminate_jsonrpc_client(self, client): client.closeSl4aSession() client.close() client.stop_app() - self.adb.forward('--remove tcp:%d' % client.port) + self.adb.forward('--remove tcp:%d' % client.host_port) def _is_timestamp_in_range(self, target, begin_time, end_time): low = mobly_logger.logline_timestamp_comparator(begin_time, diff --git a/mobly/controllers/android_device_lib/jsonrpc_client_base.py b/mobly/controllers/android_device_lib/jsonrpc_client_base.py index 3f7d6f5..dc6b75d 100644 --- a/mobly/controllers/android_device_lib/jsonrpc_client_base.py +++ b/mobly/controllers/android_device_lib/jsonrpc_client_base.py @@ -41,7 +41,6 @@ from builtins import str import json import logging import socket -import sys import threading import time @@ -94,15 +93,25 @@ class JsonRpcClientBase(object): of communication. Attributes: - uid: (int) The uid of this session. + host_port: (int) The host port of this RPC client. + device_port: (int) The device port of this RPC client. app_name: (str) The user-visible name of the app being communicated - with. Must be set by the superclass. + with. + uid: (int) The uid of this session. """ - def __init__(self, adb_proxy): + + def __init__(self, host_port, device_port, app_name, adb_proxy): """ Args: - adb_proxy: adb.AdbProxy, The adb proxy to use to start the app + host_port: (int) The host port of this RPC client. + device_port: (int) The device port of this RPC client. + app_name: (str) The user-visible name of the app being communicated + with. + adb_proxy: (adb.AdbProxy) The adb proxy to use to start the app. """ + self.host_port = host_port + self.device_port = device_port + self.app_name = app_name self.uid = None self._adb = adb_proxy self._client = None # prevent close errors on connect failure @@ -139,16 +148,6 @@ class JsonRpcClientBase(object): """ raise NotImplementedError() - def _is_app_running(self): - """Checks if the app is currently running on an android device. - - Must be implemented by subclasses. - - Returns: - True if the app is running, False otherwise. - """ - raise NotImplementedError() - # Rest of the client methods. def check_app_installed(self): @@ -161,7 +160,7 @@ class JsonRpcClientBase(object): Args: wait_time: float, The time to wait for the app to come up before - raising an error. + raising an error. Raises: AppStartError: When the app was not able to be started. @@ -175,8 +174,7 @@ class JsonRpcClientBase(object): raise AppStartError( '%s failed to start on %s.' % (self.app_name, self._adb.serial)) - def connect(self, port, addr='localhost', uid=UNKNOWN_UID, - cmd=JsonRpcCommand.INIT): + def connect(self, uid=UNKNOWN_UID, cmd=JsonRpcCommand.INIT): """Opens a connection to a JSON RPC server. Opens a connection to a remote client. The connection attempt will time @@ -185,12 +183,8 @@ class JsonRpcClientBase(object): as well. Args: - port: int, The port this client should connect to. - addr: str, The address this client should connect to. uid: int, The uid of the session to join, or UNKNOWN_UID to start a new session. - connection_timeout: int, The time to wait for the connection to come - up. cmd: JsonRpcCommand, The command to use for creating the connection. Raises: @@ -200,13 +194,12 @@ class JsonRpcClientBase(object): """ self._counter = self._id_counter() try: - self._conn = socket.create_connection((addr, port), + self._conn = socket.create_connection(('127.0.0.1', self.host_port), _SOCKET_TIMEOUT) self._conn.settimeout(_SOCKET_TIMEOUT) except (socket.timeout, socket.error, IOError): logging.exception("Failed to create socket connection!") raise - self.port = port self._client = self._conn.makefile(mode="brw") resp = self._cmd(cmd, uid) @@ -271,6 +264,20 @@ class JsonRpcClientBase(object): raise ProtocolError(ProtocolError.MISMATCHED_API_ID) return result['result'] + def _is_app_running(self): + """Checks if the app is currently running on an android device. + + May be overridden by subclasses with custom sanity checks. + """ + running = False + try: + self.connect() + running = True + finally: + self.close() + # This 'return' squashes exceptions from connect() + return running + def __getattr__(self, name): """Wrapper for python magic to turn method calls into RPC calls.""" def rpc_call(*args): diff --git a/mobly/controllers/android_device_lib/sl4a_client.py b/mobly/controllers/android_device_lib/sl4a_client.py index 1842eb5..71963d0 100644 --- a/mobly/controllers/android_device_lib/sl4a_client.py +++ b/mobly/controllers/android_device_lib/sl4a_client.py @@ -27,13 +27,25 @@ _LAUNCH_CMD = ( class Sl4aClient(jsonrpc_client_base.JsonRpcClientBase): - def __init__(self, adb_proxy): - super(Sl4aClient, self).__init__(adb_proxy) - self.app_name = 'SL4A' + """A client for interacting with SL4A using Mobly Snippet Lib. + + See superclass documentation for a list of public attributes. + """ + + def __init__(self, host_port, adb_proxy): + """Initializes an Sl4aClient. + + Args: + host_port: (int) The host port of this RPC client. + adb_proxy: (adb.AdbProxy) The adb proxy to use to start the app. + """ + super(Sl4aClient, self).__init__( + host_port=host_port, device_port=DEVICE_SIDE_PORT, app_name='SL4A', + adb_proxy=adb_proxy) def _do_start_app(self): """Overrides superclass.""" - self._adb.shell(_LAUNCH_CMD.format(DEVICE_SIDE_PORT)) + self._adb.shell(_LAUNCH_CMD.format(self.device_port)) def stop_app(self): """Overrides superclass.""" @@ -49,16 +61,3 @@ class Sl4aClient(jsonrpc_client_base.JsonRpcClientBase): if (e.ret_code == 1) and (not e.stdout) and (not e.stderr): return False raise - - def _is_app_running(self): - """Overrides superclass.""" - # Grep for process with a preceding S which means it is truly started. - try: - out = self._adb.shell( - 'ps | grep "S com.googlecode.android_scripting"').decode( - 'utf-8').strip() - return bool(out) - except adb.AdbError as e: - if (e.ret_code == 1) and (not e.stdout) and (not e.stderr): - return False - raise diff --git a/mobly/controllers/android_device_lib/snippet_client.py b/mobly/controllers/android_device_lib/snippet_client.py index 370d852..ebcae0f 100644 --- a/mobly/controllers/android_device_lib/snippet_client.py +++ b/mobly/controllers/android_device_lib/snippet_client.py @@ -15,7 +15,6 @@ # limitations under the License. """JSON RPC interface to Mobly Snippet Lib.""" import logging -import socket from mobly.controllers.android_device_lib import adb from mobly.controllers.android_device_lib import jsonrpc_client_base @@ -32,42 +31,43 @@ class Error(Exception): class SnippetClient(jsonrpc_client_base.JsonRpcClientBase): - def __init__(self, package, port, adb_proxy): - """Initialzies a SnippetClient. + """A client for interacting with snippet APKs using Mobly Snippet Lib. + + See superclass documentation for a list of public attributes. + """ + + def __init__(self, package, host_port, adb_proxy): + """Initializes a SnippetClient. Args: - package: (str) The package name of the apk where the snippets are - defined. - port: (int) The port at which to start the snippet client. Note that - the same port will currently be used for both the device and host - side of the connection. - TODO(adorokhine): allocate a distinct free port for both sides of - the connection; it is not safe in general to reuse the same one. - adb_proxy: (adb.AdbProxy) The adb proxy to use to start the app. + package: (str) The package name of the apk where the snippets are + defined. + host_port: (int) The port at which to start the snippet client. Note + that the same port will currently be used for both the + device and host side of the connection. + adb_proxy: (adb.AdbProxy) The adb proxy to use to start the app. """ - super(SnippetClient, self).__init__(adb_proxy) - self.app_name = package - self._package = package - self._port = port - - @property - def package(self): - return self._package + # TODO(adorokhine): Don't assume that a free host-side port is free on + # the device as well. Both sides should allocate a unique port. + super(SnippetClient, self).__init__( + host_port=host_port, device_port=host_port, app_name=package, + adb_proxy=adb_proxy) + self.package = package def _do_start_app(self): """Overrides superclass.""" - cmd = _LAUNCH_CMD.format(self._port, self._package) + cmd = _LAUNCH_CMD.format(self.device_port, self.package) # Use info here so people know exactly what's happening here, which is # helpful since they need to create their own instrumentations and # manifest. logging.info('Launching snippet apk with: %s', cmd) - self._adb.shell(_LAUNCH_CMD.format(self._port, self._package)) + self._adb.shell(cmd) def stop_app(self): """Overrides superclass.""" - cmd = _STOP_CMD.format(self._package) + cmd = _STOP_CMD.format(self.package) logging.info('Stopping snippet apk with: %s', cmd) - out = self._adb.shell(_STOP_CMD.format(self._package)).decode('utf-8') + out = self._adb.shell(_STOP_CMD.format(self.package)).decode('utf-8') if 'OK (0 tests)' not in out: raise Error('Failed to stop existing apk. Unexpected output: %s' % out) @@ -77,22 +77,9 @@ class SnippetClient(jsonrpc_client_base.JsonRpcClientBase): try: out = self._adb.shell( 'pm list instrumentation | grep ^instrumentation:%s/' % - self._package).decode('utf-8') + self.package).decode('utf-8') return bool(out) except adb.AdbError as e: if (e.ret_code == 1) and (not e.stdout) and (not e.stderr): return False raise - - def _is_app_running(self): - """Overrides superclass.""" - # While instrumentation is running, 'ps' only shows the package of the - # main apk. However, the main apk might be running for other reasons. - # Instead of grepping the process tree, this is implemented by seeing if - # our destination port is alive. - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - try: - result = sock.connect_ex(('127.0.0.1', self._port)) - return result == 0 - finally: - sock.close() diff --git a/tools/snippet_shell.py b/tools/snippet_shell.py index 0283f30..0991747 100755 --- a/tools/snippet_shell.py +++ b/tools/snippet_shell.py @@ -28,7 +28,6 @@ from __future__ import print_function import argparse import logging -import sys from mobly.controllers.android_device_lib import jsonrpc_shell_base
Snippet client's _is_app_running() doesn't work properly, leading to race conditions Slow loading snippets fail because _is_app_running() returns True even when nothing is on the other side of the socket. This leads to race conditions between the snippet app really starting and the connection attempt. ``` >>> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >>> print self._port 8822 >>> result = sock.connect_ex(('127.0.0.1', self._port)) >>> print result 0 And yet... $ nc 127.0.0.1 8822 $ ```
google/mobly
diff --git a/tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py b/tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py index ce01bad..19dc109 100755 --- a/tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py +++ b/tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py @@ -46,7 +46,9 @@ class MockSocketFile(object): class FakeRpcClient(jsonrpc_client_base.JsonRpcClientBase): def __init__(self): - super(FakeRpcClient, self).__init__(adb_proxy=None) + super(FakeRpcClient, self).__init__( + host_port=80, device_port=90, app_name='FakeRpcClient', + adb_proxy=None) class JsonRpcClientBaseTest(unittest.TestCase): @@ -78,7 +80,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): mock_create_connection.side_effect = IOError() with self.assertRaises(IOError): client = FakeRpcClient() - client.connect(port=80) + client.connect() @mock.patch('socket.create_connection') def test_connect_timeout(self, mock_create_connection): @@ -90,7 +92,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): mock_create_connection.side_effect = socket.timeout with self.assertRaises(socket.timeout): client = FakeRpcClient() - client.connect(port=80) + client.connect() @mock.patch('socket.create_connection') def test_handshake_error(self, mock_create_connection): @@ -104,7 +106,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): mock_create_connection.return_value = fake_conn with self.assertRaises(jsonrpc_client_base.ProtocolError): client = FakeRpcClient() - client.connect(port=80) + client.connect() @mock.patch('socket.create_connection') def test_connect_handshake(self, mock_create_connection): @@ -118,7 +120,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): mock_create_connection.return_value = fake_conn client = FakeRpcClient() - client.connect(port=80) + client.connect() self.assertEqual(client.uid, 1) @@ -135,7 +137,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): mock_create_connection.return_value = fake_conn client = FakeRpcClient() - client.connect(port=80) + client.connect() self.assertEqual(client.uid, jsonrpc_client_base.UNKNOWN_UID) @@ -149,7 +151,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): fake_file = self.setup_mock_socket_file(mock_create_connection) client = FakeRpcClient() - client.connect(port=80) + client.connect() fake_file.resp = None @@ -169,7 +171,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): fake_file = self.setup_mock_socket_file(mock_create_connection) client = FakeRpcClient() - client.connect(port=80) + client.connect() fake_file.resp = MOCK_RESP_WITH_ERROR @@ -186,7 +188,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): fake_file = self.setup_mock_socket_file(mock_create_connection) client = FakeRpcClient() - client.connect(port=80) + client.connect() fake_file.resp = (MOCK_RESP_TEMPLATE % 52).encode('utf8') @@ -205,7 +207,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): fake_file = self.setup_mock_socket_file(mock_create_connection) client = FakeRpcClient() - client.connect(port=80) + client.connect() fake_file.resp = None @@ -224,7 +226,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): fake_file = self.setup_mock_socket_file(mock_create_connection) client = FakeRpcClient() - client.connect(port=80) + client.connect() result = client.some_rpc(1, 2, 3) self.assertEquals(result, 123) @@ -243,7 +245,7 @@ class JsonRpcClientBaseTest(unittest.TestCase): fake_file = self.setup_mock_socket_file(mock_create_connection) client = FakeRpcClient() - client.connect(port=80) + client.connect() for i in range(0, 10): fake_file.resp = (MOCK_RESP_TEMPLATE % i).encode('utf-8')
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 0, "test_score": 3 }, "num_modified_files": 5 }
1.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y adb" ], "python": "3.9", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup==1.2.2 future==1.0.0 iniconfig==2.1.0 -e git+https://github.com/google/mobly.git@312070ed24d3e229689a374c7357267879fd2549#egg=mobly mock==1.0.1 packaging==24.2 pluggy==1.5.0 pytest==8.3.5 pytz==2025.2 tomli==2.2.1
name: mobly channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - exceptiongroup==1.2.2 - future==1.0.0 - iniconfig==2.1.0 - mock==1.0.1 - packaging==24.2 - pluggy==1.5.0 - pytest==8.3.5 - pytz==2025.2 - tomli==2.2.1 prefix: /opt/conda/envs/mobly
[ "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_connect_handshake", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_connect_handshake_unknown_status", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_connect_no_response", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_connect_timeout", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_handshake_error", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_open_timeout_io_error", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_rpc_call_increment_counter", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_rpc_error_response", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_rpc_id_mismatch", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_rpc_no_response", "tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py::JsonRpcClientBaseTest::test_rpc_send_to_socket" ]
[]
[]
[]
Apache License 2.0
988
[ "mobly/controllers/android_device_lib/snippet_client.py", "mobly/controllers/android_device.py", "mobly/controllers/android_device_lib/jsonrpc_client_base.py", "tools/snippet_shell.py", "mobly/controllers/android_device_lib/sl4a_client.py" ]
[ "mobly/controllers/android_device_lib/snippet_client.py", "mobly/controllers/android_device.py", "mobly/controllers/android_device_lib/jsonrpc_client_base.py", "tools/snippet_shell.py", "mobly/controllers/android_device_lib/sl4a_client.py" ]
wireservice__csvkit-770
7c26421a9f7f32318eb96b2649f62ab0192f2f33
2017-01-27 15:42:42
e88daad61ed949edf11dfbf377eb347a9b969d47
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6ebf3be..06441ce 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,7 +6,8 @@ Improvements: * Add a :code:`--version` (:code:`-V`) flag. * :code:`-I` is the short option for :code:`--no-inference`. * :doc:`/scripts/csvjoin` supports :code:`--snifflimit` and :code:`--no-inference`. -* :doc:`/scripts/in2csv` now supports a :code:`--names` flag to print Excel sheet names. +* :doc:`/scripts/csvstat` adds a :code:`--freq-count` option to set the maximum number of frequent values to display. +* :doc:`/scripts/in2csv` adds a :code:`--names` flag to print Excel sheet names. Fixes: diff --git a/csvkit/utilities/csvstat.py b/csvkit/utilities/csvstat.py index 2292e77..29908d2 100644 --- a/csvkit/utilities/csvstat.py +++ b/csvkit/utilities/csvstat.py @@ -13,9 +13,6 @@ from csvkit.cli import CSVKitUtility, parse_column_identifiers NoneType = type(None) -MAX_UNIQUE = 5 -MAX_FREQ = 5 - OPERATIONS = OrderedDict([ ('type', { 'aggregation': None, @@ -97,8 +94,10 @@ class CSVStat(CSVKitUtility): help='Only output the length of the longest values.') self.argparser.add_argument('--freq', dest='freq_only', action='store_true', help='Only output lists of frequent values.') + self.argparser.add_argument('--freq-count', dest='freq_count', type=int, + help='The maximum number of frequent values to display.') self.argparser.add_argument('--count', dest='count_only', action='store_true', - help='Only output total row count') + help='Only output total row count.') self.argparser.add_argument('-y', '--snifflimit', dest='sniff_limit', type=int, help='Limit CSV dialect sniffing to the specified number of bytes. Specify "0" to disable sniffing entirely.') @@ -144,18 +143,23 @@ class CSVStat(CSVKitUtility): self.get_column_offset() ) + kwargs = {} + + if self.args.freq_count: + kwargs['freq_count'] = self.args.freq_count + # Output a single stat if operations: if len(column_ids) == 1: - self.print_one(table, column_ids[0], operations[0], label=False) + self.print_one(table, column_ids[0], operations[0], label=False, **kwargs) else: for column_id in column_ids: - self.print_one(table, column_id, operations[0]) + self.print_one(table, column_id, operations[0], **kwargs) else: stats = {} for column_id in column_ids: - stats[column_id] = self.calculate_stats(table, column_id) + stats[column_id] = self.calculate_stats(table, column_id, **kwargs) # Output as CSV if self.args.csv_output: @@ -164,7 +168,7 @@ class CSVStat(CSVKitUtility): else: self.print_stats(table, column_ids, stats) - def print_one(self, table, column_id, operation, label=True): + def print_one(self, table, column_id, operation, label=True, **kwargs): """ Print data for a single statistic. """ @@ -178,7 +182,7 @@ class CSVStat(CSVKitUtility): try: if getter: - stat = getter(table, column_id) + stat = getter(table, column_id, **kwargs) else: op = OPERATIONS[op_name]['aggregation'] stat = table.aggregate(op(column_id)) @@ -198,7 +202,7 @@ class CSVStat(CSVKitUtility): else: self.output_file.write(u'%s\n' % stat) - def calculate_stats(self, table, column_id): + def calculate_stats(self, table, column_id, **kwargs): """ Calculate stats for all valid operations. """ @@ -212,7 +216,7 @@ class CSVStat(CSVKitUtility): try: if getter: - stats[op_name] = getter(table, column_id) + stats[op_name] = getter(table, column_id, **kwargs) else: op = op_data['aggregation'] v = table.aggregate(op(column_id)) @@ -314,16 +318,16 @@ class CSVStat(CSVKitUtility): writer.writerow(output_row) -def get_type(table, column_id): +def get_type(table, column_id, **kwargs): return '%s' % table.columns[column_id].data_type.__class__.__name__ -def get_unique(table, column_id): +def get_unique(table, column_id, **kwargs): return len(table.columns[column_id].values_distinct()) -def get_freq(table, column_id): - return table.pivot(column_id).order_by('Count', reverse=True).limit(MAX_FREQ) +def get_freq(table, column_id, freq_count=5, **kwargs): + return table.pivot(column_id).order_by('Count', reverse=True).limit(freq_count) def launch_new_instance():
csvstat: flag to specify how many frequent values to display Csvstat is really a very useful tool, but it still could be better : the "frequent values" feature is apparently fixedly limited to 5 values. It would be great if this "5" value was only the default value, and could be altered by a new parameter, say "-f ". For example : "csvstat -f 20 -c 3,7 --freq myfile.csv" would return the 20 most frequent values of colums 3 and 7. Today it (seems) impossible to exceed the limit of 5 values. Best regards, thanks for this great kit.
wireservice/csvkit
diff --git a/tests/test_utilities/test_csvstat.py b/tests/test_utilities/test_csvstat.py index 2f9cec2..875c7dd 100644 --- a/tests/test_utilities/test_csvstat.py +++ b/tests/test_utilities/test_csvstat.py @@ -55,6 +55,14 @@ class TestCSVStat(CSVKitTestCase, ColumnsTests, EmptyFileTests, NamesTests): self.assertIn('SALINE (59x)', output) self.assertNotIn('MIAMI (56x)', output) + + def test_freq_count(self): + output = self.get_output(['examples/realdata/ks_1033_data.csv', '--freq-count', '1']) + + self.assertIn('WYANDOTTE (123x)', output) + self.assertNotIn('SALINE (59x)', output) + self.assertNotIn('MIAMI (56x)', output) + def test_csv(self): output = self.get_output_as_io(['--csv', 'examples/realdata/ks_1033_data.csv'])
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 2 }
1.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "nose", "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": [ "requirements-py3.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
agate==1.13.0 agate-dbf==0.2.3 agate-excel==0.4.1 agate-sql==0.7.2 alabaster==0.7.13 attrs==22.2.0 Babel==2.11.0 certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 -e git+https://github.com/wireservice/csvkit.git@7c26421a9f7f32318eb96b2649f62ab0192f2f33#egg=csvkit dbfread==2.0.7 distlib==0.3.9 docutils==0.18.1 et-xmlfile==1.1.0 filelock==3.4.1 greenlet==2.0.2 idna==3.10 imagesize==1.4.1 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig==1.1.1 isodate==0.6.1 Jinja2==3.0.3 leather==0.4.0 MarkupSafe==2.0.1 nose==1.3.7 olefile==0.47 openpyxl==3.1.3 packaging==21.3 parsedatetime==2.6 platformdirs==2.4.0 pluggy==1.0.0 py==1.11.0 Pygments==2.14.0 pyparsing==3.1.4 pytest==7.0.1 python-slugify==6.1.2 pytimeparse==1.1.8 pytz==2025.2 requests==2.27.1 six==1.17.0 snowballstemmer==2.2.0 Sphinx==5.3.0 sphinx-rtd-theme==2.0.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jquery==4.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 SQLAlchemy==1.4.54 text-unidecode==1.3 toml==0.10.2 tomli==1.2.3 tox==3.28.0 typing_extensions==4.1.1 urllib3==1.26.20 virtualenv==20.17.1 xlrd==2.0.1 zipp==3.6.0
name: csvkit channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - agate==1.13.0 - agate-dbf==0.2.3 - agate-excel==0.4.1 - agate-sql==0.7.2 - alabaster==0.7.13 - attrs==22.2.0 - babel==2.11.0 - charset-normalizer==2.0.12 - coverage==6.2 - dbfread==2.0.7 - distlib==0.3.9 - docutils==0.18.1 - et-xmlfile==1.1.0 - filelock==3.4.1 - greenlet==2.0.2 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - iniconfig==1.1.1 - isodate==0.6.1 - jinja2==3.0.3 - leather==0.4.0 - markupsafe==2.0.1 - nose==1.3.7 - olefile==0.47 - openpyxl==3.1.3 - packaging==21.3 - parsedatetime==2.6 - platformdirs==2.4.0 - pluggy==1.0.0 - py==1.11.0 - pygments==2.14.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-slugify==6.1.2 - pytimeparse==1.1.8 - pytz==2025.2 - requests==2.27.1 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==5.3.0 - sphinx-rtd-theme==2.0.0 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jquery==4.1 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - sqlalchemy==1.4.54 - text-unidecode==1.3 - toml==0.10.2 - tomli==1.2.3 - tox==3.28.0 - typing-extensions==4.1.1 - urllib3==1.26.20 - virtualenv==20.17.1 - xlrd==2.0.1 - zipp==3.6.0 prefix: /opt/conda/envs/csvkit
[ "tests/test_utilities/test_csvstat.py::TestCSVStat::test_freq_count" ]
[]
[ "tests/test_utilities/test_csvstat.py::TestCSVStat::test_columns", "tests/test_utilities/test_csvstat.py::TestCSVStat::test_count_only", "tests/test_utilities/test_csvstat.py::TestCSVStat::test_csv", "tests/test_utilities/test_csvstat.py::TestCSVStat::test_csv_columns", "tests/test_utilities/test_csvstat.py::TestCSVStat::test_empty", "tests/test_utilities/test_csvstat.py::TestCSVStat::test_encoding", "tests/test_utilities/test_csvstat.py::TestCSVStat::test_freq_list", "tests/test_utilities/test_csvstat.py::TestCSVStat::test_invalid_column", "tests/test_utilities/test_csvstat.py::TestCSVStat::test_invalid_options", "tests/test_utilities/test_csvstat.py::TestCSVStat::test_launch_new_instance", "tests/test_utilities/test_csvstat.py::TestCSVStat::test_max_length", "tests/test_utilities/test_csvstat.py::TestCSVStat::test_names", "tests/test_utilities/test_csvstat.py::TestCSVStat::test_no_header_row", "tests/test_utilities/test_csvstat.py::TestCSVStat::test_runs", "tests/test_utilities/test_csvstat.py::TestCSVStat::test_unique" ]
[]
MIT License
989
[ "CHANGELOG.rst", "csvkit/utilities/csvstat.py" ]
[ "CHANGELOG.rst", "csvkit/utilities/csvstat.py" ]
sigmavirus24__github3.py-673
5544e976156f0e1179a0d1c61236901b75499ab4
2017-01-27 22:12:42
785562d89a01545e1efe54efc8aba5e8a15cdd18
diff --git a/AUTHORS.rst b/AUTHORS.rst index 1b2e5854..ba807766 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -145,3 +145,4 @@ Contributors - Björn Kautler (@Vampire) +- David Prothero (@dprothero) diff --git a/github3/models.py b/github3/models.py index 3d7d9243..1f4008b4 100644 --- a/github3/models.py +++ b/github3/models.py @@ -276,7 +276,10 @@ class GitHubCore(object): @property def _api(self): - return "{0.scheme}://{0.netloc}{0.path}".format(self._uri) + value = "{0.scheme}://{0.netloc}{0.path}".format(self._uri) + if self._uri.query: + value += '?{}'.format(self._uri.query) + return value @_api.setter def _api(self, uri): diff --git a/tox.ini b/tox.ini index e4261396..ec2e066c 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,7 @@ envlist = py{27,33,34,35,py},py{27,34}-flake8,docstrings minversion = 2.5.0 [testenv] +passenv = GH_* pip_pre = False deps = requests{env:REQUESTS_VERSION:>=2.0}
Calling refresh() always pulls content from master branch On version 0.9.5, I'm getting a content object like so: ```python content = repository.contents('/path/to/file', ref='some-other-branch') ``` If, at some point, I call: ```python content.refresh() ``` It pulls in the object from the `master` branch instead of `some-other-branch`. I see on line 220 of `github3\models.py` it's calling: ```python json = self._json(self._get(self._api, headers=headers), 200) ``` But `self._api` doesn't have the "?ref=some-other-branch" on it, so it's just defaulting to master. Is the value of `self._api` wrong, should we use another variable, or am I just using the library incorrectly? Happy to provide a PR if someone can point me in the right direction. <bountysource-plugin> --- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/41407137-calling-refresh-always-pulls-content-from-master-branch?utm_campaign=plugin&utm_content=tracker%2F183477&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F183477&utm_medium=issues&utm_source=github). </bountysource-plugin>
sigmavirus24/github3.py
diff --git a/tests/cassettes/Contents_delete.json b/tests/cassettes/Contents_delete.json index b932726c..aec0db4e 100644 --- a/tests/cassettes/Contents_delete.json +++ b/tests/cassettes/Contents_delete.json @@ -1,1 +1,1 @@ -{"http_interactions": [{"request": {"body": {"string": "", "encoding": "utf-8"}, "headers": {"Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/1.0.0a2", "Accept-Charset": "utf-8", "Connection": "keep-alive", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "GET", "uri": "https://api.github.com/repos/github3py/delete_contents"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA+2YzW7bOhCFX8XQ9rqmnbRuYaDofYO76aobg5JoiQglCiRlwyHy7j0k9WffILLDLAMEgSxxPh4NOdTM2ITnye7b+uuP7cPjepnUtGLJLsmZYIbtM1kbVhudLJNDK8S+e1pwU7bpY3Mm/x8nTzVTyc4mQha8BmoYDIiba/P9x8Pm23aZ0CM1VO1bJTCqNKbRO0LCTb0KVq1mqtOwymRFWtJZ/zr+fASvUB3EgRPcuII1vAMFa9A0meopTSWuBITHfvx05EEKIU+wv9b75hRkMHMe9AheF+9BwMwSaUoGh+E1XtzLc23ulONNLF5Mmz3PHURjCRTL75PUGUGQW+wXSxRrpKe1qc4UbwyX9Z3SLkyBkqqgNX+m70DB1O1YJ+pOEd4Epuzodv19Tgk2ljSKH2l2du5QLGP8CO++h3dlDJw5Ny42/5t4xvmcI1BpXrlgO1Ch2csy8RoMBvsbS0TXTfv8lXDO2bCgmPp3yfUCf4ZVjVRUcXFeYDvmi/S86KJl1ZwXB6kWHCcHwtMtH4Zrgw0MsXjyNKh6M1j9Uowh+Io0x5pZoxkIwhMIyHpi50iSI1iC/11cZQh2msJHRs6dGXMiL1CWTH+6TWYYrSLFewRQpZSxHvUIoLjWLbtp38+9vidp0odX3VZpOP9uCao5eGBAL9WaFzVjkZ4cMJb0x3SqaJ2VseCeYkm48itPi0i5jgBQKmQaSUL0E4+xRJc0fJ7MPl6h4zrKBVaxwwfIdZQBa1T02nupDjNA8Z002AaRWnsKsZ1nBa2Llhax3AGDHeC+6AV9ns1v5uJp5ADqMjfF0/YjjsCR5NSGNAPnQKxrR9CI9dnL29/+WTdM8iDviKric/nEHLODXATCh4Ddvr2Gu9/zKdAtkh3FkvHUDh+Gjh/n5e7L0GudztIXLnET9BRi/2moKd2phskaqlgs10OITSnStdVqZUtGfTpeMRUd14EBGFVZifQzTqvtKciVKmp8sn9wUnMk/0LSPDIEBwyQYUHj9AbGdC80qFwjRXrElFlxgZxW1rFn8MiZ0mtp+IFnt9Q+cyF4gbK/NK8ztqRCLLEBDc849jUyc7eeSFdZrJ8CA6+CLkIogATDFo/0vkIzwlEsCTVrzhohzx9wPk1ALrQVQ82U76lBpfOw3my/rDdfHr7/Xm93m+3u6/YPxrRNPjumaXU5g8GR2+1yXKHrEWqny6bDdcXjOhlQoHU5mv47Gu7C5StNmc4wE9iuV7F1z7zH62/iLcYQXMqKNchWkl2NKHL16jOu0Wqa5ByZbGt4HTdP1CBZxnd9vNXnKT2gpHofojzZGdW68hZ3xnNkcvPEn/h0kNOhh/ozFJDjRBVXSnYNqaBVNqzu5poIClWjUzt5fqHe/8jZgbbC7EPCjj1VUW3QG0N5zlSFN0CaATE26Yr38C5u9/SS3bETrlHTTxsin/21rv/42V8bO6dvdyI/+2uX3V+kMRfNOYTl7f21mpkTWkeTM2FaknQnyublLz1XlkZdFwAA", "encoding": "utf-8"}, "headers": {"vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "x-github-media-type": "github.v3; param=full; format=json", "x-oauth-scopes": "admin:public_key, gist, repo, user", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "x-accepted-oauth-scopes": "repo", "etag": "W/\"f4de1d3e6758ef37ba4c516ec79ec972\"", "cache-control": "private, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "4993", "x-served-by": "7b641bda7ec2ca7cd9df72d2578baf75", "access-control-expose-headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "transfer-encoding": "chunked", "x-github-request-id": "97E45D32:135D3:6A62232:56A8616D", "access-control-allow-credentials": "true", "last-modified": "Wed, 27 Jan 2016 06:16:46 GMT", "date": "Wed, 27 Jan 2016 06:19:25 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000; includeSubdomains; preload", "server": "GitHub.com", "x-ratelimit-limit": "5000", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1453878422"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/github3py/delete_contents"}, "recorded_at": "2016-01-27T06:19:25"}, {"request": {"body": {"string": "", "encoding": "utf-8"}, "headers": {"Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/1.0.0a2", "Accept-Charset": "utf-8", "Connection": "keep-alive", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "GET", "uri": "https://api.github.com/repos/github3py/delete_contents/readme"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA7WSXWvCMBSG/0uuxfTDj1UYYzJXq3jjQFEESfNhuyZpaFJcJ/73pVPEybzQsYuQ8EKe95z3nB2QSFDQA9PB88tk0BQENIBCJrmQdIKs4gU+8pnHsO/Hvuch6nYZ85wAd1wHEUa7rS4h7TayDJ1+WuyD2wBlwe3XxBilexAilTY3qUnKuIlzAQuqcg0Pgq8qSCinhq5xLg2VRsPT41TfU0HZo0Da0MLaJEbw9U+HM/p1bszzGB4o8Lx1++MCd2PBFgBruIY3hEXyreQ5IhfWBdoesyo1LY5RfMd2vbFfejKVqifMUk5tYkeMFaKqny3nH5yEM7bwgtLeJRlOxrMwUbjq18dZzt1t7I8SLLimb30Xe7MsCkftlYxCokiYuIv3SYmH2WYpgioKeU2RWLw6aB6U0XDKsT9VscDjlbTmVOKcpHJj3WOkaadltTVPZaZBbwc05ez/VsVmdj/8rrHWy3lm+YfF3O+/AFUXR1upAwAA", "encoding": "utf-8"}, "headers": {"vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "x-github-media-type": "github.v3; param=full; format=json", "x-oauth-scopes": "admin:public_key, gist, repo, user", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "x-accepted-oauth-scopes": "", "etag": "W/\"e61c42dbb02e81cf5d49f612ab0304ea\"", "cache-control": "private, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "4992", "x-served-by": "d594a23ec74671eba905bf91ef329026", "access-control-expose-headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "transfer-encoding": "chunked", "x-github-request-id": "97E45D32:135D3:6A62260:56A8616D", "access-control-allow-credentials": "true", "last-modified": "Wed, 27 Jan 2016 06:16:46 GMT", "date": "Wed, 27 Jan 2016 06:19:26 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000; includeSubdomains; preload", "server": "GitHub.com", "x-ratelimit-limit": "5000", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1453878422"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/github3py/delete_contents/readme"}, "recorded_at": "2016-01-27T06:19:25"}, {"request": {"body": {"string": "{\"sha\": \"293a3f2fc33b322ae17ff209c610adfe747dd55a\", \"message\": \"Deleting readme from repository\"}", "encoding": "utf-8"}, "headers": {"Content-Length": "97", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/1.0.0a2", "Accept-Charset": "utf-8", "Connection": "keep-alive", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "DELETE", "uri": "https://api.github.com/repos/github3py/delete_contents/contents/README.md"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA7WSwU7DMAyGX2XKeaNJ2qRdT0hw5cYJhFCSOm2lpq0a9zChvTsOYxIckJgYt9iO8/l3/jfmphFhRFaP6zBsKQyhp+iNxc6wmlmjpNGCOyWVdCBkDhUvfSWtVuCgorJvQAi2ZesyUEOHOMc6y8zc37Q9dqu9oTezBeYpZqdEPh+yBgZAeP2kf1SyEztmFzA7DMPrd/AX6M+4E+oSklmxm5a0mNEEIKEPBnFz161jS9ohmD6p7zEGOiO6VLhtUzrppyuNwdQmudA7LnayfOS6Fvta6id2PC8e4R8RuABNcP7ZwlZSNU4X0lkNdm+45qAK66tG72VVeQtQ7HlxjZ9N5Jj9mkjrCBCjadPC7pNT+rHdLGCaABu/TIHOZKcep+VA481mIQdHVj+ftZVO6Ebk3goyqjLO5xSXUhjpSl7k3BtV+TxX19B2du0FzD+69tek48vx+A5O0iMi4gMAAA==", "encoding": "utf-8"}, "headers": {"vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "x-github-media-type": "github.v3; param=full; format=json", "x-oauth-scopes": "admin:public_key, gist, repo, user", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "x-accepted-oauth-scopes": "", "etag": "W/\"dee69476834ba2605db71846bd15f8b0\"", "cache-control": "private, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "4991", "x-served-by": "a474937f3b2fa272558fa6dc951018ad", "access-control-expose-headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "transfer-encoding": "chunked", "x-github-request-id": "97E45D32:135D3:6A62286:56A8616E", "access-control-allow-credentials": "true", "date": "Wed, 27 Jan 2016 06:19:26 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000; includeSubdomains; preload", "server": "GitHub.com", "x-ratelimit-limit": "5000", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1453878422"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/github3py/delete_contents/contents/README.md"}, "recorded_at": "2016-01-27T06:19:25"}], "recorded_with": "betamax/0.5.0"} \ No newline at end of file +{"http_interactions": [{"recorded_at": "2017-01-27T23:50:11", "response": {"url": "https://api.github.com/repos/github3py/delete_contents", "body": {"base64_string": "H4sIAAAAAAAAA+2Y327jKhDGXyXy7cmGpN1NK0tHe97g3PTq3ETYJjEqNhbgVCnqu58P8L9kqzopvay0WrkO8+NjYPDM2IQXSfpr/fNxe3e/XiY1rViSJgUTzLBdLmvDaqOTZbJvhdh1vx64KdvsvjmRP8fJl5qpJLWJkAdeAzUMBsTNtXl4vNv82i4TeqSGql2rBEaVxjQ6JSS81Ktg1WqmOg2rXFakJZ317+Pf9+AdVAdx4AQvLmAN70DBGjRNpnpKU4kLAeFnP346ci+FkC+wv9T74RRkMHMe9AheHz6DgJkl0pQMDsMy3tziuTY3yvEmFgvTZscLB9HYAsWK2yR1RhDkNvvNEsUa6WltpnPFG8NlfaO0M1OgpDrQmr/ST6Bg6k6sE3WjCG8CU3Z0p/42pwQbSxrFjzQ/OXcoljN+hHc/w7swBs6cGheb/04843zOEai0qFyw7anQ7G2ZeA0Gg/2LJaLrqnP+TjgXbNhQTP1Ucr3AP8OqRiqquDgtcByLRXZadNGyak6LvVQLjpsD4em2D8O1wQGGWPzyPKj6MFj9Vowh+I40x5rZoxkIwhMIyHpmp0iSI1iC/7u4yhHsNIOPjJy7M+ZEnqEsmf7pDplhtIoU7xFAlVLGetQjgOJat+yqcz+3fE/SpA+vuq2ycP9dE1Rz8MCAXqo1P9SMRXpywFjSX9OZonVexoJ7iiXhye88PUTKdQSAMiGzSBKin3iMJbqk4fNkdvEKHddRzrCK7b9ArqMMWKOi995LdZgBiu+kwTGI1NpTiO08K2h9aOkhljtgcALcF/1AX2fzm7l4GjmAusxN8az9iitwJDm1Ic3APRDr2hE0Yn328vG3f9YNkzzIO6Kq+Fw+McfsIGeB8CVgd24v4e7v+RToGsmOYsl4a4cPQ8eP83L3Zei1TmfpC5e4CXoKsX811JTuVsNkDVUslushxGYU6dpqtbIloz4dr5iKjuvAAIyqvET6GafV9hTkShU1PtnfO6kFkn8haREZggMGyLChcXoDY3oWGlSukSI9YsqsuEBOK+vYO3jkTOm1NHzP82tqn7kQPEPZ35rXOVtSIZY4gIbnHOcambnbT6SrLNZPgYGloIsQCiDBcMQjva/QjHAUS0LNWrBGyNMX3E8TkAttxVAzFTtqUOncrTfbH+vNj7uHp/U23WzTn9v/MKZtitkxTavLPzCPT+uH9H6Trh8dBldud8rxhK5HqJ3Omw6XFY/rZMBU63I0/Wc0TMPjO02ZzjAXOK4XsXXLvMfLb+I1xhBcyoo1yFaStEYUuXr1Fc+bs5wjl20Nr6P/9EINkmV818dXfZ7SA0qqdyHKk9So1pW3eDPeI5OXL/yZTwc5HXqoP0MBOU5UcaVk15AKWmXD6m6uXhCEh6rRqZ387pfUq/dLKdietsLsQsKOM1VRbdAbQ3nOVIUVIM2AGJt0xXtYizs9vWR37YRn1PSC56zWgxun/ZHvdlvXjvxut42N1I8bk9/ttvNmMLKas14dovT6dlvNzAs6SZM7a1qhdBfM5u1/awphDWwXAAA=", "string": "", "encoding": "utf-8"}, "headers": {"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "X-GitHub-Media-Type": "github.drax-preview; format=json", "Content-Security-Policy": "default-src 'none'", "X-RateLimit-Reset": "1485561234", "X-GitHub-Request-Id": "913C:2C93:4138498:52D8182:588BDCB2", "Last-Modified": "Wed, 27 Jan 2016 06:16:46 GMT", "X-Frame-Options": "deny", "Content-Type": "application/json; charset=utf-8", "Status": "200 OK", "X-Accepted-OAuth-Scopes": "repo", "Date": "Fri, 27 Jan 2017 23:50:10 GMT", "X-Content-Type-Options": "nosniff", "X-RateLimit-Remaining": "4943", "Access-Control-Allow-Origin": "*", "Access-Control-Expose-Headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "X-OAuth-Scopes": "repo", "X-Served-By": "318e55760cf7cdb40e61175a4d36cd32", "Server": "GitHub.com", "ETag": "W/\"86f11c16739f664d9b922346de133e77\"", "Cache-Control": "private, max-age=60, s-maxage=60", "Content-Encoding": "gzip", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "Transfer-Encoding": "chunked", "X-RateLimit-Limit": "5000", "X-XSS-Protection": "1; mode=block"}, "status": {"code": 200, "message": "OK"}}, "request": {"uri": "https://api.github.com/repos/github3py/delete_contents", "body": {"string": "", "encoding": "utf-8"}, "headers": {"Content-Type": "application/json", "Accept": "application/vnd.github.drax-preview+json", "Accept-Encoding": "gzip, deflate", "User-Agent": "github3.py/1.0.0a4", "Connection": "keep-alive", "Authorization": "token <AUTH_TOKEN>", "Accept-Charset": "utf-8"}, "method": "GET"}}, {"recorded_at": "2017-01-27T23:50:11", "response": {"url": "https://api.github.com/repos/github3py/delete_contents/contents/test.txt", "body": {"string": "{\"content\":{\"name\":\"test.txt\",\"path\":\"test.txt\",\"sha\":\"9a2c7732fab5bcd73ea3ed52d2d9599a4cc47666\",\"size\":7,\"url\":\"https://api.github.com/repos/github3py/delete_contents/contents/test.txt?ref=master\",\"html_url\":\"https://github.com/github3py/delete_contents/blob/master/test.txt\",\"git_url\":\"https://api.github.com/repos/github3py/delete_contents/git/blobs/9a2c7732fab5bcd73ea3ed52d2d9599a4cc47666\",\"download_url\":\"https://raw.githubusercontent.com/github3py/delete_contents/master/test.txt\",\"type\":\"file\",\"_links\":{\"self\":\"https://api.github.com/repos/github3py/delete_contents/contents/test.txt?ref=master\",\"git\":\"https://api.github.com/repos/github3py/delete_contents/git/blobs/9a2c7732fab5bcd73ea3ed52d2d9599a4cc47666\",\"html\":\"https://github.com/github3py/delete_contents/blob/master/test.txt\"}},\"commit\":{\"sha\":\"a623ca5974523ec35fd83909dd99b220e498ef58\",\"url\":\"https://api.github.com/repos/github3py/delete_contents/git/commits/a623ca5974523ec35fd83909dd99b220e498ef58\",\"html_url\":\"https://github.com/github3py/delete_contents/commit/a623ca5974523ec35fd83909dd99b220e498ef58\",\"author\":{\"name\":\"Ian Cordasco\",\"email\":\"[email protected]\",\"date\":\"2017-01-27T23:50:11Z\"},\"committer\":{\"name\":\"Ian Cordasco\",\"email\":\"[email protected]\",\"date\":\"2017-01-27T23:50:11Z\"},\"tree\":{\"sha\":\"adc0d991d0812b918423960234fdcc2bca6ba9e6\",\"url\":\"https://api.github.com/repos/github3py/delete_contents/git/trees/adc0d991d0812b918423960234fdcc2bca6ba9e6\"},\"message\":\"Create test.txt\",\"parents\":[{\"sha\":\"7d52c200d80d86f70fbda3e9ebf48060867f9f65\",\"url\":\"https://api.github.com/repos/github3py/delete_contents/git/commits/7d52c200d80d86f70fbda3e9ebf48060867f9f65\",\"html_url\":\"https://github.com/github3py/delete_contents/commit/7d52c200d80d86f70fbda3e9ebf48060867f9f65\"}]}}", "encoding": "utf-8"}, "headers": {"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Content-Security-Policy": "default-src 'none'", "X-RateLimit-Reset": "1485561234", "X-GitHub-Request-Id": "913C:2C93:41384A7:52D8190:588BDCB2", "Content-Type": "application/json; charset=utf-8", "Content-Length": "1788", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "Status": "201 Created", "X-Accepted-OAuth-Scopes": "", "Date": "Fri, 27 Jan 2017 23:50:11 GMT", "X-Content-Type-Options": "nosniff", "X-RateLimit-Remaining": "4942", "Access-Control-Allow-Origin": "*", "Access-Control-Expose-Headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "X-OAuth-Scopes": "repo", "X-Served-By": "d594a23ec74671eba905bf91ef329026", "Server": "GitHub.com", "ETag": "\"78cccef3ab1ce99582b483505a8d4e2f\"", "Cache-Control": "private, max-age=60, s-maxage=60", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-RateLimit-Limit": "5000"}, "status": {"code": 201, "message": "Created"}}, "request": {"uri": "https://api.github.com/repos/github3py/delete_contents/contents/test.txt", "body": {"string": "{\"message\": \"Create test.txt\", \"content\": \"dGVzdGluZw==\"}", "encoding": "utf-8"}, "headers": {"Content-Length": "57", "Content-Type": "application/json", "Accept": "application/vnd.github.v3.full+json", "Accept-Encoding": "gzip, deflate", "User-Agent": "github3.py/1.0.0a4", "Connection": "keep-alive", "Authorization": "token <AUTH_TOKEN>", "Accept-Charset": "utf-8"}, "method": "PUT"}}, {"recorded_at": "2017-01-27T23:50:11", "response": {"url": "https://api.github.com/repos/github3py/delete_contents/contents/test.txt", "body": {"base64_string": "H4sIAAAAAAAAA7WSTWrDMBCF76J1sMC/2GC6zA26KAUjS+NYVJaMNcZNQu7eceMWJyWLGLoTT8w3897MmVnRASsYgscAP5HtWC+wvVV8K0jIRSizLAobUSe1VFkEIgKVhCpUeZLnIpYyztI0JYTXJ4JmOzYOhipbxN4XnIteBweN7VgH0nV8gN55fhWi/sgVGECopLMIFj3/ffwM9zJAU3bCIwzUpMXOVLcNVvDH2Nq4ml8pfGWbCu5oT45LAD6zPX8iKeUma5xQd60HMS1JjR6GJYjv0B77+msJj/2820YboLwWCglq/3pSezO+TWX5bukLrHRK2wP91cJDGpNWGW0/PCvOzINp/m2L5Gc7e1Pk892sWm6/mcvlCy84VO8/AwAA", "string": "", "encoding": "utf-8"}, "headers": {"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Content-Security-Policy": "default-src 'none'", "X-RateLimit-Reset": "1485561234", "X-GitHub-Request-Id": "913C:2C93:41384CD:52D81C4:588BDCB3", "Last-Modified": "Fri, 27 Jan 2017 23:50:11 GMT", "X-Frame-Options": "deny", "Content-Type": "application/json; charset=utf-8", "Status": "200 OK", "X-Accepted-OAuth-Scopes": "", "Date": "Fri, 27 Jan 2017 23:50:11 GMT", "X-Content-Type-Options": "nosniff", "X-RateLimit-Remaining": "4941", "Access-Control-Allow-Origin": "*", "Access-Control-Expose-Headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "X-OAuth-Scopes": "repo", "X-Served-By": "ef96c2e493b28ffea49b891b085ed2dd", "Server": "GitHub.com", "ETag": "W/\"db4036393e435dfb4677c0f3555c0060\"", "Cache-Control": "private, max-age=60, s-maxage=60", "Content-Encoding": "gzip", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "Transfer-Encoding": "chunked", "X-RateLimit-Limit": "5000", "X-XSS-Protection": "1; mode=block"}, "status": {"code": 200, "message": "OK"}}, "request": {"uri": "https://api.github.com/repos/github3py/delete_contents/contents/test.txt", "body": {"string": "", "encoding": "utf-8"}, "headers": {"Content-Type": "application/json", "Accept": "application/vnd.github.v3.full+json", "Accept-Encoding": "gzip, deflate", "User-Agent": "github3.py/1.0.0a4", "Connection": "keep-alive", "Authorization": "token <AUTH_TOKEN>", "Accept-Charset": "utf-8"}, "method": "GET"}}, {"recorded_at": "2017-01-27T23:50:13", "response": {"url": "https://api.github.com/repos/github3py/delete_contents/contents/test.txt?ref=master", "body": {"base64_string": "H4sIAAAAAAAAA72Sy2rDMBBFfyVondiybFmWV4V2031XLSXI0sgW+IUkl4bgf6+c1JAuCgkNXY4ec+beuUckh95D71HZT227DWXXmVAdkWsEKlGiJGgmqCaaMqkTWmUZEJwXWnFWAYEEY53yHG3RZNvwofF+dGUci9FEtfHNVEWhZ2xhHFx8PkjHQ6ygBQ/7b/rpJj6zXXwDs/Fdu/8JvoD+jjujbiGJyTeDXYzpRQdB6LPoN4+DVcLJIaiHTphFvzN1Jz6MnRzJHiYH1kX9ENS3hws7wnsl/NKF4ITtcLIj7IWkJcVlQl7RvO7Bw/8RvYUw0Lr3XFaZSiuqBEiRFZqBZDmmDEtZJFoxLquQB8zusfeF7OKricGdDpwT9eLf05Ij09cbD85H/tNvtB26zSluxg/2EAYchQ0Jd6h8W9WJnKRSUM4ySlKQKdWqSDnmSnFeEYIh4wVoWtxD3ZrqG5h/TPXVpPl9nr8Am5a38AIEAAA=", "string": "", "encoding": "utf-8"}, "headers": {"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Content-Security-Policy": "default-src 'none'", "X-RateLimit-Reset": "1485561234", "X-GitHub-Request-Id": "913C:2C93:41384D5:52D81CE:588BDCB3", "Content-Type": "application/json; charset=utf-8", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "Status": "200 OK", "X-Accepted-OAuth-Scopes": "", "Date": "Fri, 27 Jan 2017 23:50:12 GMT", "X-Content-Type-Options": "nosniff", "X-RateLimit-Remaining": "4940", "Access-Control-Allow-Origin": "*", "Access-Control-Expose-Headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "X-OAuth-Scopes": "repo", "X-Served-By": "318e55760cf7cdb40e61175a4d36cd32", "Server": "GitHub.com", "ETag": "W/\"dfc258e06d9d41fca25275828fd97590\"", "Cache-Control": "private, max-age=60, s-maxage=60", "Content-Encoding": "gzip", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "Transfer-Encoding": "chunked", "X-RateLimit-Limit": "5000"}, "status": {"code": 200, "message": "OK"}}, "request": {"uri": "https://api.github.com/repos/github3py/delete_contents/contents/test.txt?ref=master", "body": {"string": "{\"message\": \"Deleting test.txt from repository\", \"sha\": \"9a2c7732fab5bcd73ea3ed52d2d9599a4cc47666\"}", "encoding": "utf-8"}, "headers": {"Content-Length": "99", "Content-Type": "application/json", "Accept": "application/vnd.github.v3.full+json", "Accept-Encoding": "gzip, deflate", "User-Agent": "github3.py/1.0.0a4", "Connection": "keep-alive", "Authorization": "token <AUTH_TOKEN>", "Accept-Charset": "utf-8"}, "method": "DELETE"}}], "recorded_with": "betamax/0.8.0"} \ No newline at end of file diff --git a/tests/cassettes/Contents_update.json b/tests/cassettes/Contents_update.json index d5b22a68..544c6042 100644 --- a/tests/cassettes/Contents_update.json +++ b/tests/cassettes/Contents_update.json @@ -1,1 +1,1 @@ -{"http_interactions": [{"request": {"body": {"string": "", "encoding": "utf-8"}, "headers": {"Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/1.0.0a2", "Accept-Charset": "utf-8", "Connection": "keep-alive", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "GET", "uri": "https://api.github.com/repos/github3py/delete_contents"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA+2Y326jOhDGXyXi9mTjJN1Nu0hHe95gb3q1N5EBB6wajGyTKkV99/PZ5l+yVUnqXlaqKgKenz/GHjMzbcSzKP6x/v6w296tl1FFSxbFUcYEM2yfysqwyuhoGR0aIfbd05yboknu6hP5e5x8rpiK4jYSMucVUMNgQOxcm/uH7ebHbhnRIzVU7RslMKowptYxIf6mXnmrRjPVaVilsiQN6ax/Hf+9Ay9XHcSCI9y4gNW8A3lr0DSZ6ilMKS4E+Mdu/HTkQQohn2F/qffdKchgZj3oELzKP4KAWUukKRgchtd4tS/PtblRjjNp8WLa7HlmIRpLoFh2m6TOCILsYr+2RLFaOlqT6FTx2nBZ3SjtzBQoqXJa8Rf6ARRM7Y61om4U4Uxgyo5219/mFG/TklrxI01P1h2KpYwf4d2P8C6MgTOn2sbm74lnrM85ApVmpQ22AxWavS4jp8FgsLuxRHRdtc/fCOeMDQuKqR8Lrhf4M6yspaKKi9MC2zFbJKdFFy2r+rQ4SLXgODkQnnb5MFwbbGCIxZOnQdW7weqWYgzBN6RZ1swazUAQnkBA1hM7BZIsoSX438VVimCnCXxk5NyZMSfyDNWS6U+7yQyjZaB4hwCqkDLUow4BFNe6YVft+7nXdyRN+vCqmjLx5981QTUH9wzopVrzvGIs0JMDpiX9MZ0oWqVFKLintMRfuZWneaBcSwAoETIJJCH6icO0RBfUf57MPlyh5VrKGVaxwyfItZQBa1Tw2jupFjNA8Z002AaBWnsKaTvPClrlDc1DuQMGO8B+0XP6MpvfzMXTyAHUZm6KJ81nHIEjyar1aQbOgVDXjqAR67KX97/9s26Y5EHOEWXJ5/KJOWYHOQuETwHbfXsJt7/nU6BrJFtKS8ZT238YOn6Yl7svQ691OktfuIRN0FNI+09NTWFPNUxWU8VCuQ5C2oQiXVutVm3BqEvHS6aC49ozAKMqLZB+hmltewpypZIal+wfrNQMyb+QNAsMwQEDpF/QML2eMd0LNSrXQJEOMWWWXCCnlVXoGTxypvRKGn7g6TW1z1wInqHaX5pXKVtSIZbYgIanHPsambldT6SrLNRPnoFXQRfBF0CCYYsHel+hGWEpLfE1a8ZqIU+fcD5NQDa0FUPNlO2pQaWzXW9239abb9v7x/Uu3uzi77s/GNPU2eyYutHFX5iHx/V9vP0Z3zkMjtxul+MKXQ9fO503HS4rHtvJgKnWxWj632gY+8s3mjKdYSqwXS9i65Z5j5ffxGuMIbiQJauRrURxhSiy9eoLrtFqmuQcqWwqeB03n6lBsozv+nirz1N6QEH13kd5FBvV2PIWd8ZzZHLzmT/x6SCrQw/1py8gx4lKrpTsGlJeq6xZ1c01EeSrRqt28vxMvfuRsQNthNn7hB17qqTaoDeG8pypEm+ANANi2qgr3v272N3TS7bHjr9GTT9tiHz117r+41d/beycvt+J/OqvnXd/kcacNecQltf31ypmntE6mpwJ05KkO1E2r/8DMfbCQV0XAAA=", "encoding": "utf-8"}, "headers": {"vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "x-github-media-type": "github.v3; param=full; format=json", "x-oauth-scopes": "admin:public_key, gist, repo, user", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "x-accepted-oauth-scopes": "repo", "etag": "W/\"2b7352621b54ddc5cc69e260ad86b555\"", "cache-control": "private, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "4978", "x-served-by": "cee4c0729c8e9147e7abcb45b9d69689", "access-control-expose-headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "transfer-encoding": "chunked", "x-github-request-id": "97E45D32:14F48:218827:56A9C3BB", "access-control-allow-credentials": "true", "last-modified": "Wed, 27 Jan 2016 06:16:46 GMT", "date": "Thu, 28 Jan 2016 07:31:07 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000; includeSubdomains; preload", "server": "GitHub.com", "x-ratelimit-limit": "5000", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1453967471"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/github3py/delete_contents"}, "recorded_at": "2016-01-28T07:31:07"}, {"request": {"body": {"string": "", "encoding": "utf-8"}, "headers": {"Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/1.0.0a2", "Accept-Charset": "utf-8", "Connection": "keep-alive", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "GET", "uri": "https://api.github.com/repos/github3py/delete_contents/readme"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA7WSX2vCMBTFv0ufxVRr1Qoy5uZqHb44UBRB0uT2z0zS0KS4TvzuS6eIk/mgYw8h4UB+99xz784SmIPVs6bDx+fJsM6pVbMk1smFpBJslHbHc0O306LYBohc14mcVtdzutBxIkwj2rYbtNUJXcNQ6afBdps1q8iZ+ZpoLVUPISzTepzqpAjrJOMoB5kpdBAcWSIKDDSsSSY0CK3Q6XHy95BD1OdYachNmURztv5Z4Yx+nRuyLEQHCjpv3fy4wN1o2ABQBVfohrBothUsw/SidI63x6wKBfkxiu/Yrjf2S0+6lNWEo5SBSeyIMUJQDjbL+Qej/ixaNL3C3AUdTV5nfiJJOaiOvZw3tqEzTghnCt4GDdKcbQJ/7K5E4FNJ/aSxeJ8UZLSJl9wrA59VFEH4i43nXhGMpow4UxlyUjzF/f5KGAMgSEZTERsHIVbQbhltzVKxUVZvZylg0f+ti8ntfvhdo60W9KzkH5Zzv/8C4g372q0DAAA=", "encoding": "utf-8"}, "headers": {"vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "x-github-media-type": "github.v3; param=full; format=json", "x-oauth-scopes": "admin:public_key, gist, repo, user", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "x-accepted-oauth-scopes": "", "etag": "W/\"f96980266c26e5e87d6ff79c2b424621\"", "cache-control": "private, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "4977", "x-served-by": "5aeb3f30c9e3ef6ef7bcbcddfd9a68f7", "access-control-expose-headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "transfer-encoding": "chunked", "x-github-request-id": "97E45D32:14F48:21884A:56A9C3BB", "access-control-allow-credentials": "true", "last-modified": "Thu, 28 Jan 2016 07:29:36 GMT", "date": "Thu, 28 Jan 2016 07:31:07 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000; includeSubdomains; preload", "server": "GitHub.com", "x-ratelimit-limit": "5000", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1453967471"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/github3py/delete_contents/readme"}, "recorded_at": "2016-01-28T07:31:07"}, {"request": {"body": {"string": "{\"content\": \"SEVMTE8=\", \"sha\": \"6795b574da0eef553f348938e73fadfd601d47b5\", \"message\": \"Updating README.md\"}", "encoding": "utf-8"}, "headers": {"Content-Length": "107", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/1.0.0a2", "Accept-Charset": "utf-8", "Connection": "keep-alive", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "PUT", "uri": "https://api.github.com/repos/github3py/delete_contents/contents/README.md"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA7VUy27bMBD8lUBnx6ReJCWgSIo2x1yK9tKiMPhYWkL1gkghSAP9e5ex4zpGA8SPAjoQK2lmZ3a4T5HuOw+dj8qnqJMtRGX05e7j5/u7ZWuiRTRIXx2UXCWxYgpGc60kF0IBHsHqLGaQUKMgjxMuRWJSSmPEcPVvhM0X0TQ2+Gfl/eBKQuRQL9e1rya11H1LRhh6RzaFdHgkBhrwsNq258jusGvvZgT7oZXOw4gslW+b1WuGPfS3cVXTK7JBIfvK8Y8DuCMbRgASwB05wivTP3RNL80B9Sgftl5NDsatFc+2vS3sH5r84xAGbOsG0LFVU3e/XBi8g8b+v8lgi6eDn+RiyMIe5Rk5mOcF3pC2DRLQp+foc5MnOqHUCHyY5dQqI1MoQNlMUEYF47awLEeLz0p8kL7hduQIzlMvwobqGCY5+aof9zbHvfT+6lM1dWvUDq2swxRq71o8e6/Di9t1KIfo4idG+pDHhMbsmsbXifhKeZnGJeXfo53x4Xr/XU4XpvAjYAcvk2VaZSZVuZGgZSYsB81xt3GqtYit4YVWOdeUX2KygdmRdzOiHS04J9fBsG8DOld366vXq3rEPY73+ceLHGGBCp4zlhTAbZ6ntkAFomC4mQ3PbMZZDEJcNKhHcJ4Z1HczzT/n+Q+GPTUB6AYAAA==", "encoding": "utf-8"}, "headers": {"vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "x-github-media-type": "github.v3; param=full; format=json", "x-oauth-scopes": "admin:public_key, gist, repo, user", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "x-accepted-oauth-scopes": "", "etag": "W/\"b7558c14fd20e3506470ac71d1d932c0\"", "cache-control": "private, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "4976", "x-served-by": "8a5c38021a5cd7cef7b8f49a296fee40", "access-control-expose-headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "transfer-encoding": "chunked", "x-github-request-id": "97E45D32:14F48:21885B:56A9C3BB", "access-control-allow-credentials": "true", "date": "Thu, 28 Jan 2016 07:31:07 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000; includeSubdomains; preload", "server": "GitHub.com", "x-ratelimit-limit": "5000", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1453967471"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/github3py/delete_contents/contents/README.md"}, "recorded_at": "2016-01-28T07:31:08"}], "recorded_with": "betamax/0.5.0"} \ No newline at end of file +{"http_interactions": [{"response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA+2Yz27bOBDGX8XQdV0zThq3EFB032AvPe3FoCXaIkKJAkk5cIS8+35D6p+9QWSHOQYoCkXm/PhxyKFmpk1knqSPd99/bu4f7pZJxUuRpEkulHBim+nKicrZZJnsG6W23a8H6Ypm91Cf2P/H6edKmCRtE6UPsgJqGAwIzbX+8fN+/bhZJvzIHTfbxiiMKpyrbcpYeGlXwaqxwnQaVpkuWcM669/HXw/gHUwHIXCCFxewWnagYA2aZVM9hSvVhYDwsx8/HbnXSuln2F/qfXcKNpiRBz1CVoePIGDWMu0KAYdhGa+0eGndjXK8SYuFWbeVOUEstsCI/DZJnREE0Wa/tsyIWntas7OZkbWTurpR2pkpUNoceCVf+AdQMKUTS6JuFOFNYCqOdOpvc0qwaVlt5JFnJ3KHEZmQR3j3I7wLY+DcqabY/GfiGfK5RKDyvKRg23Nlxesy8RocBvsXS0TXVef8jXDOxbChmPpPIe0C/5woa224keq0wHHMF7vToouWVX1a7LVZSNwcCE/aPgy3DgcYYvHL06Dq3WD1WzGG4BvSiDWzRzMQhCcQkPUkTpEkIrQM/3dxlSHY+Q4+cnruzpgTeYZq2fRPOmRO8DJSvEcAVWgd61GPAEpa24irzv3c8j3Jsj68qqbchfvvmqCagwcG9HJr5aESItKTA6Zl/TW9M7zKilhwT2lZePI7zw+RcokA0E7pXSQJ0c88pmW24OHz5LbxColLlDOsEftPkEuUAetM9N57qYQZoPhOOhyDSK09hbWdZxWvDg0/xHIHDE4AfdEP/GU2v5mLp5EDKGVuRu6az7gCRxKpDWkG7oFY146gEeuzl/e//bNumORB3hFlKefyiTlmBzkLhE8B07m9hNPf8ynQNZKJ0rLx1g4fho4f5+Xuy9Brnc7SFy5xE/QU1v5Vc1fQrYbJam5ELNdDWLvjSNdWq1VbCO7T8VKY6LgODMC4yQqkn3Fa256CXKnkzif7e5KaI/lXmueRIThggAwbGqc3MKZnoUblGinSI6bMUirktLqKvYNHzpReaSf3Mrum9pkLwTNU+9vKKhNLrtQSB9DJTOJcIzOn/US6KmL9FBhYCroIoQBSAkc80vsGzQiitCzUrLmolT59wv00AVFoG4GaKd9yh0rn/m69+Xa3/nb/48/dJl1v0u+bfzGmqfPZMXVjiwnmR4e5f0gfH9L1I2Fw5XanHE/oeoTa6bzpcFnxUCcDptYWo+nfo2EaHt9oynSGmcJxvYitW+Y9Xn4TrzGG4EKXoka2kqQVoojq1Rc8r89yjkw3FbyO/tMzd0iW8V0fX/V5Sg8ouN2GKE9SZxoqb/FmvEcmL5/lk5wOIh12qD9DATlOVEpjdNeQClp1Lapurl4QhIeqkdROfvdL6tX7peRizxvltiFhx5kquXXojaE8F6bECpBmQEybdMV7WAudnl4yXTvhGTW9kpmo7ODGaX/kq93WtSO/2m1jI/X9xuRXu+28GYys5qxXhyi9vt1WCfeMTtLkzppWKN0Fs379D2MlxjdsFwAA", "string": ""}, "headers": {"X-Accepted-OAuth-Scopes": "repo", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "Cache-Control": "private, max-age=60, s-maxage=60", "Status": "200 OK", "X-RateLimit-Reset": "1485561234", "Server": "GitHub.com", "Access-Control-Expose-Headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Transfer-Encoding": "chunked", "ETag": "W/\"e0a392bce31715f40135849e89f270a4\"", "Content-Encoding": "gzip", "X-OAuth-Scopes": "repo", "X-RateLimit-Remaining": "4891", "Content-Type": "application/json; charset=utf-8", "X-Served-By": "474556b853193c38f1b14328ce2d1b7d", "Last-Modified": "Wed, 27 Jan 2016 06:16:46 GMT", "X-GitHub-Media-Type": "github.drax-preview; format=json", "X-GitHub-Request-Id": "A39A:2C94:6F2F8BF:8C5A463:588BDD7B", "Content-Security-Policy": "default-src 'none'", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "Date": "Fri, 27 Jan 2017 23:53:31 GMT", "X-RateLimit-Limit": "5000", "X-XSS-Protection": "1; mode=block", "Access-Control-Allow-Origin": "*"}, "url": "https://api.github.com/repos/github3py/delete_contents", "status": {"message": "OK", "code": 200}}, "recorded_at": "2017-01-27T23:53:31", "request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"Connection": "keep-alive", "Accept-Charset": "utf-8", "User-Agent": "github3.py/1.0.0a4", "Authorization": "token <AUTH_TOKEN>", "Accept-Encoding": "gzip, deflate", "Content-Type": "application/json", "Accept": "application/vnd.github.drax-preview+json"}, "method": "GET", "uri": "https://api.github.com/repos/github3py/delete_contents"}}, {"response": {"body": {"encoding": "utf-8", "string": "{\"content\":{\"name\":\"test.txt\",\"path\":\"test.txt\",\"sha\":\"9a2c7732fab5bcd73ea3ed52d2d9599a4cc47666\",\"size\":7,\"url\":\"https://api.github.com/repos/github3py/delete_contents/contents/test.txt?ref=master\",\"html_url\":\"https://github.com/github3py/delete_contents/blob/master/test.txt\",\"git_url\":\"https://api.github.com/repos/github3py/delete_contents/git/blobs/9a2c7732fab5bcd73ea3ed52d2d9599a4cc47666\",\"download_url\":\"https://raw.githubusercontent.com/github3py/delete_contents/master/test.txt\",\"type\":\"file\",\"_links\":{\"self\":\"https://api.github.com/repos/github3py/delete_contents/contents/test.txt?ref=master\",\"git\":\"https://api.github.com/repos/github3py/delete_contents/git/blobs/9a2c7732fab5bcd73ea3ed52d2d9599a4cc47666\",\"html\":\"https://github.com/github3py/delete_contents/blob/master/test.txt\"}},\"commit\":{\"sha\":\"fb2a74614c16264b5e61fa892ad10448f049b9f4\",\"url\":\"https://api.github.com/repos/github3py/delete_contents/git/commits/fb2a74614c16264b5e61fa892ad10448f049b9f4\",\"html_url\":\"https://github.com/github3py/delete_contents/commit/fb2a74614c16264b5e61fa892ad10448f049b9f4\",\"author\":{\"name\":\"Ian Cordasco\",\"email\":\"[email protected]\",\"date\":\"2017-01-27T23:53:31Z\"},\"committer\":{\"name\":\"Ian Cordasco\",\"email\":\"[email protected]\",\"date\":\"2017-01-27T23:53:31Z\"},\"tree\":{\"sha\":\"adc0d991d0812b918423960234fdcc2bca6ba9e6\",\"url\":\"https://api.github.com/repos/github3py/delete_contents/git/trees/adc0d991d0812b918423960234fdcc2bca6ba9e6\"},\"message\":\"Create test.txt\",\"parents\":[{\"sha\":\"6c00b51b2b96ee0825d47ace00bb97b650d127e8\",\"url\":\"https://api.github.com/repos/github3py/delete_contents/git/commits/6c00b51b2b96ee0825d47ace00bb97b650d127e8\",\"html_url\":\"https://github.com/github3py/delete_contents/commit/6c00b51b2b96ee0825d47ace00bb97b650d127e8\"}]}}"}, "headers": {"X-Accepted-OAuth-Scopes": "", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "Content-Length": "1788", "Cache-Control": "private, max-age=60, s-maxage=60", "Content-Security-Policy": "default-src 'none'", "X-RateLimit-Reset": "1485561234", "Server": "GitHub.com", "Access-Control-Expose-Headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "ETag": "\"067e7bfa1d18c395514875effb397455\"", "X-OAuth-Scopes": "repo", "X-RateLimit-Remaining": "4890", "Content-Type": "application/json; charset=utf-8", "X-Served-By": "edf23fdc48375d9066b698b8d98062e9", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "X-GitHub-Request-Id": "A39A:2C94:6F2F8C7:8C5A471:588BDD7B", "Status": "201 Created", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "Date": "Fri, 27 Jan 2017 23:53:32 GMT", "X-RateLimit-Limit": "5000", "X-XSS-Protection": "1; mode=block", "Access-Control-Allow-Origin": "*"}, "url": "https://api.github.com/repos/github3py/delete_contents/contents/test.txt", "status": {"message": "Created", "code": 201}}, "recorded_at": "2017-01-27T23:53:32", "request": {"body": {"encoding": "utf-8", "string": "{\"content\": \"dGVzdGluZw==\", \"message\": \"Create test.txt\"}"}, "headers": {"Connection": "keep-alive", "Content-Length": "57", "Accept-Charset": "utf-8", "User-Agent": "github3.py/1.0.0a4", "Authorization": "token <AUTH_TOKEN>", "Accept-Encoding": "gzip, deflate", "Content-Type": "application/json", "Accept": "application/vnd.github.v3.full+json"}, "method": "PUT", "uri": "https://api.github.com/repos/github3py/delete_contents/contents/test.txt"}}, {"response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA7WSTWrDMBCF76J1sMC/2GC6zA26KAUjS+NYVJaMNcZNQu7eceMWJyWLGLoTT8w3897MmVnRASsYgscAP5HtWC+wvVV8K0jIRSizLAobUSe1VFkEIgKVhCpUeZLnIpYyztI0JYTXJ4JmOzYOhipbxN4XnIteBweN7VgH0nV8gN55fhWi/sgVGECopLMIFj3/ffwM9zJAU3bCIwzUpMXOVLcNVvDH2Nq4ml8pfGWbCu5oT45LAD6zPX8iKeUma5xQd60HMS1JjR6GJYjv0B77+msJj/2820YboLwWCglq/3pSezO+TWX5bukLrHRK2wP91cJDGpNWGW0/PCvOzINp/m2L5Gc7e1Pk892sWm6/mcvlCy84VO8/AwAA", "string": ""}, "headers": {"X-Accepted-OAuth-Scopes": "", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "Cache-Control": "private, max-age=60, s-maxage=60", "Status": "200 OK", "X-RateLimit-Reset": "1485561234", "Server": "GitHub.com", "Access-Control-Expose-Headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Transfer-Encoding": "chunked", "ETag": "W/\"db4036393e435dfb4677c0f3555c0060\"", "Content-Encoding": "gzip", "X-OAuth-Scopes": "repo", "X-RateLimit-Remaining": "4889", "Content-Type": "application/json; charset=utf-8", "X-Served-By": "88531cdcf1929112ec480e1806d44a33", "Last-Modified": "Fri, 27 Jan 2017 23:53:31 GMT", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "X-GitHub-Request-Id": "A39A:2C94:6F2F912:8C5A4CA:588BDD7C", "Content-Security-Policy": "default-src 'none'", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "Date": "Fri, 27 Jan 2017 23:53:32 GMT", "X-RateLimit-Limit": "5000", "X-XSS-Protection": "1; mode=block", "Access-Control-Allow-Origin": "*"}, "url": "https://api.github.com/repos/github3py/delete_contents/contents/test.txt", "status": {"message": "OK", "code": 200}}, "recorded_at": "2017-01-27T23:53:32", "request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"Connection": "keep-alive", "Accept-Charset": "utf-8", "User-Agent": "github3.py/1.0.0a4", "Authorization": "token <AUTH_TOKEN>", "Accept-Encoding": "gzip, deflate", "Content-Type": "application/json", "Accept": "application/vnd.github.v3.full+json"}, "method": "GET", "uri": "https://api.github.com/repos/github3py/delete_contents/contents/test.txt"}}, {"response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA7VUy27bMBD8lUBnx3zqZaBIgJ56by8tCmMpLi2heoGkmrqB/71kbKdyggCxk1wEghBndmZn9z6pht5j75PVfdJDh8kq8ej80v/xySIZwdenN66GcKHLjKaVgrwoFIYjmkqyDDnVClPGcyi4FpSyAOGavwE0XSSTbcPL2vvRrQiBsVluGl9PalkNHbE4Do7sL8S4JRpb9Lg+FOfI4+FY3I1F86kD59EGktp37fqUYAb+MqxqB0X2KGQmOzx4gnZmuQGARGxHznBKD3d9O4B+Qm3h7uDU5NAejHgw7WVdzyX57Rh7a5oWg1/rtul/udhzh635sLaEAi/HvsjDGIQZ5eUh2O0WYTS6LioILj2kXhYAgtGiqAqqkDEpBQVFKUqVi9wYzAExL2Pq3xT2qHzP7cgZnJcOwZ7qHCaYfD3Y2cr4Av3V58FqcNUQ1GMHTWyDazYd/G7s5Li8jel1y34Io95uZ7Mf/tfgYzg5Zfk1Zdc8/8rFKhUrwb8nj32Ik/5/SX0so7cYCjr2XWuqtOQgisoIIzNhBGWVYFoCL3X8ZqlSgr5H3yNz2BqvZQzudOgcbKJ/38ZgZNNvrk42uA3bPYz6j6MaozjkMmOyYhnPpEoxYwaKkoNmVMrCUFmq0sj3UHNM8Rmcb0zxq5l2P3e7f2fhkcT+BgAA", "string": ""}, "headers": {"X-Accepted-OAuth-Scopes": "", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "Cache-Control": "private, max-age=60, s-maxage=60", "Status": "200 OK", "X-RateLimit-Reset": "1485561234", "Server": "GitHub.com", "Access-Control-Expose-Headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Transfer-Encoding": "chunked", "ETag": "W/\"228f97ea9c74ef83d9cfd8f2c235494a\"", "Content-Encoding": "gzip", "X-OAuth-Scopes": "repo", "X-RateLimit-Remaining": "4888", "Content-Type": "application/json; charset=utf-8", "X-Served-By": "b0ef53392caa42315c6206737946d931", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "X-GitHub-Request-Id": "A39A:2C94:6F2F922:8C5A4E9:588BDD7C", "Content-Security-Policy": "default-src 'none'", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "Date": "Fri, 27 Jan 2017 23:53:33 GMT", "X-RateLimit-Limit": "5000", "X-XSS-Protection": "1; mode=block", "Access-Control-Allow-Origin": "*"}, "url": "https://api.github.com/repos/github3py/delete_contents/contents/test.txt?ref=master", "status": {"message": "OK", "code": 200}}, "recorded_at": "2017-01-27T23:53:33", "request": {"body": {"encoding": "utf-8", "string": "{\"sha\": \"9a2c7732fab5bcd73ea3ed52d2d9599a4cc47666\", \"message\": \"Updating test.txt\", \"content\": \"SEVMTE8=\"}"}, "headers": {"Connection": "keep-alive", "Content-Length": "106", "Accept-Charset": "utf-8", "User-Agent": "github3.py/1.0.0a4", "Authorization": "token <AUTH_TOKEN>", "Accept-Encoding": "gzip, deflate", "Content-Type": "application/json", "Accept": "application/vnd.github.v3.full+json"}, "method": "PUT", "uri": "https://api.github.com/repos/github3py/delete_contents/contents/test.txt?ref=master"}}, {"response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA72Sy2rDMBBFfyVondiSJVu2V4V2031XLSWM5PED/EKSS0Pwv1dOakgXhYSGLkePOXPv3CPRQ++wdyTvp7bd+rLrGl8dia2B5IRyEUvBI6qgjMosU4yxNI5oIlDEaZxgViSySJBsyWRa/6F2brR5GMLYBFXj6kkFvmdocBxseD7g4yEssEWH+2/66SY8s214A7N2Xbv/Cb6A/o47o24hweTqwSzG9NChF/oM/eZxMAVYPXj12EGz6LdN1cFHYyYbiYfJorFBP3j17eHCDv++ALd0iSiTO8p2kXyJeB7znPNXMq97cPh/RGfQD7TuPdFKFFzFBaAGkZYStUxoLKnWKSsLmWkVS03lPfa+kG14NdG706G1UC3+PS05avpq49C6wH26TWmGbnOKW+MGc/ADjmB8wi3J31Z1IgXgjKapTqlCxoTgFBSlKJTksixRAqLM2D3Uram+gfnHVF9Nmt/n+QvEiSHCAgQAAA==", "string": ""}, "headers": {"X-Accepted-OAuth-Scopes": "", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "Cache-Control": "private, max-age=60, s-maxage=60", "Status": "200 OK", "X-RateLimit-Reset": "1485561234", "Server": "GitHub.com", "Access-Control-Expose-Headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Transfer-Encoding": "chunked", "ETag": "W/\"c8cc191f28fbb16963cad0d7b03c6267\"", "Content-Encoding": "gzip", "X-OAuth-Scopes": "repo", "X-RateLimit-Remaining": "4887", "Content-Type": "application/json; charset=utf-8", "X-Served-By": "8dd185e423974a7e13abbbe6e060031e", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "X-GitHub-Request-Id": "A39A:2C94:6F2F973:8C5A55D:588BDD7D", "Content-Security-Policy": "default-src 'none'", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "Date": "Fri, 27 Jan 2017 23:53:34 GMT", "X-RateLimit-Limit": "5000", "X-XSS-Protection": "1; mode=block", "Access-Control-Allow-Origin": "*"}, "url": "https://api.github.com/repos/github3py/delete_contents/contents/test.txt?ref=master", "status": {"message": "OK", "code": 200}}, "recorded_at": "2017-01-27T23:53:34", "request": {"body": {"encoding": "utf-8", "string": "{\"sha\": \"d9605cba788be605efc416e20dbe5127a82d3001\", \"message\": \"Deleting test.txt from repository\"}"}, "headers": {"Connection": "keep-alive", "Content-Length": "99", "Accept-Charset": "utf-8", "User-Agent": "github3.py/1.0.0a4", "Authorization": "token <AUTH_TOKEN>", "Accept-Encoding": "gzip, deflate", "Content-Type": "application/json", "Accept": "application/vnd.github.v3.full+json"}, "method": "DELETE", "uri": "https://api.github.com/repos/github3py/delete_contents/contents/test.txt?ref=master"}}], "recorded_with": "betamax/0.8.0"} \ No newline at end of file diff --git a/tests/integration/test_repos_repo.py b/tests/integration/test_repos_repo.py index 3aa9475a..7489728e 100644 --- a/tests/integration/test_repos_repo.py +++ b/tests/integration/test_repos_repo.py @@ -1135,8 +1135,9 @@ class TestContents(helper.IntegrationHelper): cassette_name = self.cassette_name('delete') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('github3py', 'delete_contents') - content = repository.readme() - deleted = content.delete('Deleting readme from repository') + repository.create_file('test.txt', 'Create test.txt', b'testing') + content = repository.file_contents('test.txt') + deleted = content.delete('Deleting test.txt from repository') assert deleted @@ -1146,13 +1147,17 @@ class TestContents(helper.IntegrationHelper): cassette_name = self.cassette_name('update') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('github3py', 'delete_contents') - content = repository.readme() - update = content.update(message='Updating README.md', + repository.create_file('test.txt', 'Create test.txt', b'testing') + content = repository.file_contents('test.txt') + update = content.update(message='Updating test.txt', content=b'HELLO') + assert isinstance(update, dict) + assert isinstance(update['content'], + github3.repos.contents.Contents) + assert isinstance(update['commit'], github3.git.Commit) - assert isinstance(update, dict) - assert isinstance(update['content'], github3.repos.contents.Contents) - assert isinstance(update['commit'], github3.git.Commit) + # Clean-up + update['content'].delete('Deleting test.txt from repository') class TestHook(helper.IntegrationHelper): diff --git a/tests/unit/test_models.py b/tests/unit/test_models.py index e06ff8c3..4fa6fde9 100644 --- a/tests/unit/test_models.py +++ b/tests/unit/test_models.py @@ -216,3 +216,24 @@ class TestGitHubCore(helper.UnitHelper): def test_strptime_time_str_required(self): """Verify that method converts ISO 8601 formatted string.""" assert self.instance._strptime('') is None + + +class TestGitHubCoreIssue672(helper.UnitHelper): + + described_class = MyTestRefreshClass + last_modified = datetime.now().strftime( + '%a, %d %b %Y %H:%M:%S GMT' + ) + url = 'https://api.github.com/foo?bar=1' + etag = '644b5b0155e6404a9cc4bd9d8b1ae730' + example_data = { + 'url': url, + 'last_modified': last_modified, + 'etag': etag, + 'fake_attr': 'foo', + } + + def test_issue_672(self): + """Verify that _api property contains URL query""" + assert '?' in self.instance._api + assert self.instance._api == self.url diff --git a/tests/unit/test_repos_repo.py b/tests/unit/test_repos_repo.py index 564d7ebc..654bc8f8 100644 --- a/tests/unit/test_repos_repo.py +++ b/tests/unit/test_repos_repo.py @@ -24,6 +24,7 @@ compare_url_for = helper.create_url_helper( ) contents_url_for = helper.create_url_helper( 'https://api.github.com/repos/github3py/github3.py/contents/README.rst' + '?ref=master' ) hook_url_for = helper.create_url_helper( 'https://api.github.com/repos/octocat/Hello-World/hooks/1'
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 3 }
0.9
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov" ], "pre_install": null, "python": "3.5", "reqs_path": [ "dev-requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 betamax==0.8.1 betamax-matchers==0.4.0 certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 distlib==0.3.9 filelock==3.4.1 -e git+https://github.com/sigmavirus24/github3.py.git@5544e976156f0e1179a0d1c61236901b75499ab4#egg=github3.py idna==3.10 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig==1.1.1 mock==1.0.1 packaging==21.3 platformdirs==2.4.0 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 pytest-cov==4.0.0 requests==2.27.1 requests-toolbelt==1.0.0 six==1.17.0 swebench-matterhorn @ file:///swebench_matterhorn toml==0.10.2 tomli==1.2.3 tox==3.28.0 typing_extensions==4.1.1 uritemplate==4.1.1 urllib3==1.26.20 virtualenv==20.17.1 zipp==3.6.0
name: github3.py channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - betamax==0.8.1 - betamax-matchers==0.4.0 - charset-normalizer==2.0.12 - coverage==6.2 - distlib==0.3.9 - filelock==3.4.1 - idna==3.10 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - iniconfig==1.1.1 - mock==1.0.1 - packaging==21.3 - platformdirs==2.4.0 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-cov==4.0.0 - requests==2.27.1 - requests-toolbelt==1.0.0 - six==1.17.0 - swebench-matterhorn==0.0.0 - toml==0.10.2 - tomli==1.2.3 - tox==3.28.0 - typing-extensions==4.1.1 - uritemplate==4.1.1 - urllib3==1.26.20 - virtualenv==20.17.1 - wheel==0.21.0 - zipp==3.6.0 prefix: /opt/conda/envs/github3.py
[ "tests/integration/test_repos_repo.py::TestContents::test_delete", "tests/integration/test_repos_repo.py::TestContents::test_update", "tests/unit/test_models.py::TestGitHubCoreIssue672::test_issue_672", "tests/unit/test_repos_repo.py::TestContents::test_delete", "tests/unit/test_repos_repo.py::TestContents::test_update" ]
[]
[ "tests/integration/test_repos_repo.py::TestRepository::test_add_collaborator", "tests/integration/test_repos_repo.py::TestRepository::test_assignees", "tests/integration/test_repos_repo.py::TestRepository::test_blob", "tests/integration/test_repos_repo.py::TestRepository::test_branch", "tests/integration/test_repos_repo.py::TestRepository::test_branches", "tests/integration/test_repos_repo.py::TestRepository::test_code_frequency", "tests/integration/test_repos_repo.py::TestRepository::test_collaborators", "tests/integration/test_repos_repo.py::TestRepository::test_comments", "tests/integration/test_repos_repo.py::TestRepository::test_commit_activity", "tests/integration/test_repos_repo.py::TestRepository::test_commit_comment", "tests/integration/test_repos_repo.py::TestRepository::test_commits", "tests/integration/test_repos_repo.py::TestRepository::test_compare_commits", "tests/integration/test_repos_repo.py::TestRepository::test_contributor_statistics", "tests/integration/test_repos_repo.py::TestRepository::test_contributors", "tests/integration/test_repos_repo.py::TestRepository::test_create_blob", "tests/integration/test_repos_repo.py::TestRepository::test_create_comment", "tests/integration/test_repos_repo.py::TestRepository::test_create_commit", "tests/integration/test_repos_repo.py::TestRepository::test_create_commit_with_empty_committer", "tests/integration/test_repos_repo.py::TestRepository::test_create_deployment", "tests/integration/test_repos_repo.py::TestRepository::test_create_empty_blob", "tests/integration/test_repos_repo.py::TestRepository::test_create_file", "tests/integration/test_repos_repo.py::TestRepository::test_create_fork", "tests/integration/test_repos_repo.py::TestRepository::test_create_hook", "tests/integration/test_repos_repo.py::TestRepository::test_create_issue", "tests/integration/test_repos_repo.py::TestRepository::test_create_issue_both_assignee_and_assignees", "tests/integration/test_repos_repo.py::TestRepository::test_create_issue_multiple_assignees", "tests/integration/test_repos_repo.py::TestRepository::test_create_key", "tests/integration/test_repos_repo.py::TestRepository::test_create_label", "tests/integration/test_repos_repo.py::TestRepository::test_create_milestone", "tests/integration/test_repos_repo.py::TestRepository::test_create_pull", "tests/integration/test_repos_repo.py::TestRepository::test_create_pull_from_issue", "tests/integration/test_repos_repo.py::TestRepository::test_create_release", "tests/integration/test_repos_repo.py::TestRepository::test_create_status", "tests/integration/test_repos_repo.py::TestRepository::test_create_tag", "tests/integration/test_repos_repo.py::TestRepository::test_delete", "tests/integration/test_repos_repo.py::TestRepository::test_delete_key", "tests/integration/test_repos_repo.py::TestRepository::test_delete_subscription", "tests/integration/test_repos_repo.py::TestRepository::test_deployment", "tests/integration/test_repos_repo.py::TestRepository::test_deployments", "tests/integration/test_repos_repo.py::TestRepository::test_edit", "tests/integration/test_repos_repo.py::TestRepository::test_events", "tests/integration/test_repos_repo.py::TestRepository::test_file_contents", "tests/integration/test_repos_repo.py::TestRepository::test_forks", "tests/integration/test_repos_repo.py::TestRepository::test_git_commit", "tests/integration/test_repos_repo.py::TestRepository::test_hook", "tests/integration/test_repos_repo.py::TestRepository::test_hooks", "tests/integration/test_repos_repo.py::TestRepository::test_ignore", "tests/integration/test_repos_repo.py::TestRepository::test_import_issue", "tests/integration/test_repos_repo.py::TestRepository::test_import_issue_with_comments", "tests/integration/test_repos_repo.py::TestRepository::test_imported_issue", "tests/integration/test_repos_repo.py::TestRepository::test_imported_issues", "tests/integration/test_repos_repo.py::TestRepository::test_is_assignee", "tests/integration/test_repos_repo.py::TestRepository::test_is_collaborator", "tests/integration/test_repos_repo.py::TestRepository::test_issue", "tests/integration/test_repos_repo.py::TestRepository::test_issue_events", "tests/integration/test_repos_repo.py::TestRepository::test_issue_with_multiple_assignees", "tests/integration/test_repos_repo.py::TestRepository::test_issues_accepts_state_all", "tests/integration/test_repos_repo.py::TestRepository::test_issues_sorts_ascendingly", "tests/integration/test_repos_repo.py::TestRepository::test_key", "tests/integration/test_repos_repo.py::TestRepository::test_keys", "tests/integration/test_repos_repo.py::TestRepository::test_label", "tests/integration/test_repos_repo.py::TestRepository::test_labels", "tests/integration/test_repos_repo.py::TestRepository::test_languages", "tests/integration/test_repos_repo.py::TestRepository::test_latest_release", "tests/integration/test_repos_repo.py::TestRepository::test_license", "tests/integration/test_repos_repo.py::TestRepository::test_mark_notifications", "tests/integration/test_repos_repo.py::TestRepository::test_merge", "tests/integration/test_repos_repo.py::TestRepository::test_milestone", "tests/integration/test_repos_repo.py::TestRepository::test_milestones", "tests/integration/test_repos_repo.py::TestRepository::test_network_events", "tests/integration/test_repos_repo.py::TestRepository::test_notifications", "tests/integration/test_repos_repo.py::TestRepository::test_original_license", "tests/integration/test_repos_repo.py::TestRepository::test_protected_branches", "tests/integration/test_repos_repo.py::TestRepository::test_pull_request", "tests/integration/test_repos_repo.py::TestRepository::test_pull_requests", "tests/integration/test_repos_repo.py::TestRepository::test_pull_requests_accepts_sort_and_direction", "tests/integration/test_repos_repo.py::TestRepository::test_readme", "tests/integration/test_repos_repo.py::TestRepository::test_ref", "tests/integration/test_repos_repo.py::TestRepository::test_refs", "tests/integration/test_repos_repo.py::TestRepository::test_refs_raises_unprocessable_exception", "tests/integration/test_repos_repo.py::TestRepository::test_release", "tests/integration/test_repos_repo.py::TestRepository::test_release_from_tag", "tests/integration/test_repos_repo.py::TestRepository::test_releases", "tests/integration/test_repos_repo.py::TestRepository::test_remove_collaborator", "tests/integration/test_repos_repo.py::TestRepository::test_stargazers", "tests/integration/test_repos_repo.py::TestRepository::test_statuses", "tests/integration/test_repos_repo.py::TestRepository::test_subscribe", "tests/integration/test_repos_repo.py::TestRepository::test_subscribers", "tests/integration/test_repos_repo.py::TestRepository::test_subscription", "tests/integration/test_repos_repo.py::TestRepository::test_tag", "tests/integration/test_repos_repo.py::TestRepository::test_tags", "tests/integration/test_repos_repo.py::TestRepository::test_teams", "tests/integration/test_repos_repo.py::TestRepository::test_tree", "tests/integration/test_repos_repo.py::TestRepository::test_weekly_commit_count", "tests/integration/test_repos_repo.py::TestHook::test_delete", "tests/integration/test_repos_repo.py::TestHook::test_edit", "tests/integration/test_repos_repo.py::TestHook::test_ping", "tests/integration/test_repos_repo.py::TestHook::test_test", "tests/integration/test_repos_repo.py::TestRepoComment::test_delete", "tests/integration/test_repos_repo.py::TestRepoComment::test_update", "tests/integration/test_repos_repo.py::TestRepoCommit::test_diff", "tests/integration/test_repos_repo.py::TestRepoCommit::test_patch", "tests/integration/test_repos_repo.py::TestComparison::test_diff", "tests/integration/test_repos_repo.py::TestComparison::test_patch", "tests/unit/test_models.py::TestGitHubError::test_message", "tests/unit/test_models.py::TestGitHubError::test_message_is_empty", "tests/unit/test_models.py::TestGitHubError::test_str", "tests/unit/test_models.py::TestGitHubCore::test_boolean", "tests/unit/test_models.py::TestGitHubCore::test_boolean_empty_response", "tests/unit/test_models.py::TestGitHubCore::test_boolean_false_code", "tests/unit/test_models.py::TestGitHubCore::test_boolean_raises_exception", "tests/unit/test_models.py::TestGitHubCore::test_exposes_attributes", "tests/unit/test_models.py::TestGitHubCore::test_from_json", "tests/unit/test_models.py::TestGitHubCore::test_instance_or_null", "tests/unit/test_models.py::TestGitHubCore::test_json", "tests/unit/test_models.py::TestGitHubCore::test_json_status_code_does_not_match", "tests/unit/test_models.py::TestGitHubCore::test_missingattribute", "tests/unit/test_models.py::TestGitHubCore::test_refresh", "tests/unit/test_models.py::TestGitHubCore::test_refresh_custom_headers", "tests/unit/test_models.py::TestGitHubCore::test_refresh_etag", "tests/unit/test_models.py::TestGitHubCore::test_refresh_json", "tests/unit/test_models.py::TestGitHubCore::test_refresh_last_modified", "tests/unit/test_models.py::TestGitHubCore::test_strptime", "tests/unit/test_models.py::TestGitHubCore::test_strptime_time_str_required", "tests/unit/test_repos_repo.py::TestRepository::test_add_collaborator", "tests/unit/test_repos_repo.py::TestRepository::test_add_null_collaborator", "tests/unit/test_repos_repo.py::TestRepository::test_asset", "tests/unit/test_repos_repo.py::TestRepository::test_asset_requires_a_positive_id", "tests/unit/test_repos_repo.py::TestRepository::test_create_file", "tests/unit/test_repos_repo.py::TestRepository::test_create_file_required_content", "tests/unit/test_repos_repo.py::TestRepository::test_create_fork", "tests/unit/test_repos_repo.py::TestRepository::test_create_fork_to_organization", "tests/unit/test_repos_repo.py::TestRepository::test_create_hook", "tests/unit/test_repos_repo.py::TestRepository::test_create_hook_requires_valid_config", "tests/unit/test_repos_repo.py::TestRepository::test_create_hook_requires_valid_name", "tests/unit/test_repos_repo.py::TestRepository::test_create_hook_requires_valid_name_and_config", "tests/unit/test_repos_repo.py::TestRepository::test_create_issue", "tests/unit/test_repos_repo.py::TestRepository::test_create_issue_multiple_assignees", "tests/unit/test_repos_repo.py::TestRepository::test_create_issue_require_valid_issue", "tests/unit/test_repos_repo.py::TestRepository::test_create_key", "tests/unit/test_repos_repo.py::TestRepository::test_create_key_readonly", "tests/unit/test_repos_repo.py::TestRepository::test_create_key_requires_a_valid_key", "tests/unit/test_repos_repo.py::TestRepository::test_create_key_requires_a_valid_title", "tests/unit/test_repos_repo.py::TestRepository::test_create_key_requires_a_valid_title_and_key", "tests/unit/test_repos_repo.py::TestRepository::test_create_label", "tests/unit/test_repos_repo.py::TestRepository::test_create_label_required_color", "tests/unit/test_repos_repo.py::TestRepository::test_create_label_required_name", "tests/unit/test_repos_repo.py::TestRepository::test_create_label_required_name_and_color", "tests/unit/test_repos_repo.py::TestRepository::test_create_milestone", "tests/unit/test_repos_repo.py::TestRepository::test_create_milestone_accepted_state", "tests/unit/test_repos_repo.py::TestRepository::test_create_pull", "tests/unit/test_repos_repo.py::TestRepository::test_create_pull_from_issue", "tests/unit/test_repos_repo.py::TestRepository::test_create_pull_from_issue_required_issue_number", "tests/unit/test_repos_repo.py::TestRepository::test_create_pull_private", "tests/unit/test_repos_repo.py::TestRepository::test_create_pull_private_required_data", "tests/unit/test_repos_repo.py::TestRepository::test_create_ref", "tests/unit/test_repos_repo.py::TestRepository::test_create_ref_requires_a_non_None_sha", "tests/unit/test_repos_repo.py::TestRepository::test_create_ref_requires_a_reference_start_with_refs", "tests/unit/test_repos_repo.py::TestRepository::test_create_ref_requires_a_reference_with_two_slashes", "tests/unit/test_repos_repo.py::TestRepository::test_create_ref_requires_a_truthy_sha", "tests/unit/test_repos_repo.py::TestRepository::test_create_status", "tests/unit/test_repos_repo.py::TestRepository::test_create_status_required_sha", "tests/unit/test_repos_repo.py::TestRepository::test_create_status_required_sha_and_state", "tests/unit/test_repos_repo.py::TestRepository::test_create_status_required_state", "tests/unit/test_repos_repo.py::TestRepository::test_create_tag_that_is_not_lightweight", "tests/unit/test_repos_repo.py::TestRepository::test_create_tree", "tests/unit/test_repos_repo.py::TestRepository::test_create_tree_rejects_invalid_trees", "tests/unit/test_repos_repo.py::TestRepository::test_create_tree_with_base_tree", "tests/unit/test_repos_repo.py::TestRepository::test_delete", "tests/unit/test_repos_repo.py::TestRepository::test_delete_key", "tests/unit/test_repos_repo.py::TestRepository::test_delete_key_required_id", "tests/unit/test_repos_repo.py::TestRepository::test_delete_subscription", "tests/unit/test_repos_repo.py::TestRepository::test_deployment", "tests/unit/test_repos_repo.py::TestRepository::test_deployment_requires_positive_int", "tests/unit/test_repos_repo.py::TestRepository::test_directory_contents", "tests/unit/test_repos_repo.py::TestRepository::test_directory_contents_with_ref", "tests/unit/test_repos_repo.py::TestRepository::test_edit", "tests/unit/test_repos_repo.py::TestRepository::test_edit_required_name", "tests/unit/test_repos_repo.py::TestRepository::test_file_contents", "tests/unit/test_repos_repo.py::TestRepository::test_git_commit", "tests/unit/test_repos_repo.py::TestRepository::test_git_commit_required_sha", "tests/unit/test_repos_repo.py::TestRepository::test_hook", "tests/unit/test_repos_repo.py::TestRepository::test_hook_required_hook", "tests/unit/test_repos_repo.py::TestRepository::test_import_issue", "tests/unit/test_repos_repo.py::TestRepository::test_imported_issue", "tests/unit/test_repos_repo.py::TestRepository::test_is_assignee", "tests/unit/test_repos_repo.py::TestRepository::test_is_assignee_required_username", "tests/unit/test_repos_repo.py::TestRepository::test_is_collaborator", "tests/unit/test_repos_repo.py::TestRepository::test_is_collaborator_required_username", "tests/unit/test_repos_repo.py::TestRepository::test_issue", "tests/unit/test_repos_repo.py::TestRepository::test_issue_required_number", "tests/unit/test_repos_repo.py::TestRepository::test_key", "tests/unit/test_repos_repo.py::TestRepository::test_key_requires_positive_id", "tests/unit/test_repos_repo.py::TestRepository::test_label", "tests/unit/test_repos_repo.py::TestRepository::test_label_required_name", "tests/unit/test_repos_repo.py::TestRepository::test_latest_pages_build", "tests/unit/test_repos_repo.py::TestRepository::test_latest_release", "tests/unit/test_repos_repo.py::TestRepository::test_mark_notifications", "tests/unit/test_repos_repo.py::TestRepository::test_mark_notifications_required_last_read", "tests/unit/test_repos_repo.py::TestRepository::test_merge", "tests/unit/test_repos_repo.py::TestRepository::test_merge_no_message", "tests/unit/test_repos_repo.py::TestRepository::test_milestone", "tests/unit/test_repos_repo.py::TestRepository::test_milestone_requires_positive_id", "tests/unit/test_repos_repo.py::TestRepository::test_pages", "tests/unit/test_repos_repo.py::TestRepository::test_parent", "tests/unit/test_repos_repo.py::TestRepository::test_permission", "tests/unit/test_repos_repo.py::TestRepository::test_pull_request", "tests/unit/test_repos_repo.py::TestRepository::test_pull_request_required_number", "tests/unit/test_repos_repo.py::TestRepository::test_readme", "tests/unit/test_repos_repo.py::TestRepository::test_ref", "tests/unit/test_repos_repo.py::TestRepository::test_ref_required_ref", "tests/unit/test_repos_repo.py::TestRepository::test_release_from_tag", "tests/unit/test_repos_repo.py::TestRepository::test_remove_collaborator", "tests/unit/test_repos_repo.py::TestRepository::test_remove_collaborator_required_username", "tests/unit/test_repos_repo.py::TestRepository::test_source", "tests/unit/test_repos_repo.py::TestRepository::test_str", "tests/unit/test_repos_repo.py::TestRepository::test_subscription", "tests/unit/test_repos_repo.py::TestRepository::test_tag", "tests/unit/test_repos_repo.py::TestRepository::test_tag_required_sha", "tests/unit/test_repos_repo.py::TestRepository::test_tree", "tests/unit/test_repos_repo.py::TestRepository::test_tree_required_sha", "tests/unit/test_repos_repo.py::TestRepository::test_weekly_commit_count", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_assignees", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_branches", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_branches_protected", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_code_frequency", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_collaborators", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_comments", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_commit_activity", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_commits", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_commits_per_page", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_commits_sha_path", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_commits_since_until_datetime", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_contributor_statistics", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_contributors", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_contributors_with_anon", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_deployments", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_events", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_forks", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_hooks", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_imported_issues", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_issue_events", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_issues", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_keys", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_labels", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_languages", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_milestones", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_network_events", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_notifications", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_pages_builds", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_pull_requests", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_pull_requests_ignore_invalid_state", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_refs", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_refs_with_a_subspace", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_releases", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_stargazers", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_statuses", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_statuses_requires_a_sha", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_subscribers", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_tags", "tests/unit/test_repos_repo.py::TestRepositoryIterator::test_teams", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_add_collaborator", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_create_file", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_create_fork", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_create_hook", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_create_issue", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_create_key", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_create_pull", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_create_pull_from_issue", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_create_ref", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_create_status", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_delete_key", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_delete_subscription", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_edit", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_hook", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_hooks", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_import_issue", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_imported_issue", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_imported_issues", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_is_collaborator", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_key", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_keys", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_mark_notifications", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_merge", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_notifications", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_pages_builds", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_remove_collaborator", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_subscription", "tests/unit/test_repos_repo.py::TestRepositoryRequiresAuth::test_teams", "tests/unit/test_repos_repo.py::TestContents::test_git_url", "tests/unit/test_repos_repo.py::TestContents::test_html_url", "tests/unit/test_repos_repo.py::TestContents::test_str", "tests/unit/test_repos_repo.py::TestContents::test_update_required_content", "tests/unit/test_repos_repo.py::TestContentsRequiresAuth::test_delete", "tests/unit/test_repos_repo.py::TestContentsRequiresAuth::test_update", "tests/unit/test_repos_repo.py::TestHook::test_delete", "tests/unit/test_repos_repo.py::TestHook::test_edit", "tests/unit/test_repos_repo.py::TestHook::test_edit_failed", "tests/unit/test_repos_repo.py::TestHook::test_ping", "tests/unit/test_repos_repo.py::TestHook::test_str", "tests/unit/test_repos_repo.py::TestHook::test_test", "tests/unit/test_repos_repo.py::TestHookRequiresAuth::test_delete", "tests/unit/test_repos_repo.py::TestHookRequiresAuth::test_edit", "tests/unit/test_repos_repo.py::TestHookRequiresAuth::test_ping", "tests/unit/test_repos_repo.py::TestHookRequiresAuth::test_test", "tests/unit/test_repos_repo.py::TestRepoComment::test_delete", "tests/unit/test_repos_repo.py::TestRepoComment::test_str", "tests/unit/test_repos_repo.py::TestRepoComment::test_update", "tests/unit/test_repos_repo.py::TestRepoCommentRequiresAuth::test_delete", "tests/unit/test_repos_repo.py::TestRepoCommentRequiresAuth::test_update", "tests/unit/test_repos_repo.py::TestRepoCommit::test_diff", "tests/unit/test_repos_repo.py::TestRepoCommit::test_patch", "tests/unit/test_repos_repo.py::TestRepoCommit::test_str", "tests/unit/test_repos_repo.py::TestComparison::test_diff", "tests/unit/test_repos_repo.py::TestComparison::test_patch", "tests/unit/test_repos_repo.py::TestComparison::test_str" ]
[]
BSD 3-Clause "New" or "Revised" License
990
[ "tox.ini", "AUTHORS.rst", "github3/models.py" ]
[ "tox.ini", "AUTHORS.rst", "github3/models.py" ]
wireservice__csvkit-776
b69d7cd51f0e273564a3209d871bb9af3cfd7f42
2017-01-28 07:04:06
e88daad61ed949edf11dfbf377eb347a9b969d47
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8f1617b..9dc61c3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,8 +3,9 @@ Improvements: -* Add a :code:`--version` (:code:`-V`) flag. +* Add a :code:`--version` flag. * Add a :code:`--skip-lines` option to skip initial lines (e.g. comments, copyright notices, empty rows). +* Add a :code:`--locale` option to set the locale of any formatted numbers. * :code:`-I` is the short option for :code:`--no-inference`. * :doc:`/scripts/csvjoin` supports :code:`--snifflimit` and :code:`--no-inference`. * :doc:`/scripts/csvstat` adds a :code:`--freq-count` option to set the maximum number of frequent values to display. diff --git a/csvkit/cli.py b/csvkit/cli.py index cf52724..f69f961 100644 --- a/csvkit/cli.py +++ b/csvkit/cli.py @@ -159,7 +159,10 @@ class CSVKitUtility(object): help='Maximum length of a single field in the input CSV file.') if 'e' not in self.override_flags: self.argparser.add_argument('-e', '--encoding', dest='encoding', default='utf-8', - help='Specify the encoding the input CSV file.') + help='Specify the encoding of the input CSV file.') + if 'L' not in self.override_flags: + self.argparser.add_argument('-L', '--locale', dest='locale', default='en_US', + help='Specify the locale (en_US) of any formatted numbers.') if 'S' not in self.override_flags: self.argparser.add_argument('-S', '--skipinitialspace', dest='skipinitialspace', action='store_true', help='Ignore whitespace immediately following the delimiter.') @@ -283,7 +286,7 @@ class CSVKitUtility(object): else: return agate.TypeTester(types=[ agate.Boolean(), - agate.Number(), + agate.Number(locale=self.args.locale), agate.TimeDelta(), agate.Date(), agate.DateTime(), diff --git a/csvkit/utilities/sql2csv.py b/csvkit/utilities/sql2csv.py index 98bf911..1b56f52 100644 --- a/csvkit/utilities/sql2csv.py +++ b/csvkit/utilities/sql2csv.py @@ -10,7 +10,7 @@ from csvkit.cli import CSVKitUtility class SQL2CSV(CSVKitUtility): description = 'Execute an SQL query on a database and output the result to a CSV file.' - override_flags = 'f,b,d,e,H,K,p,q,S,t,u,z,zero'.split(',') + override_flags = 'f,b,d,e,H,K,L,p,q,S,t,u,z,zero'.split(',') def add_arguments(self): self.argparser.add_argument('--db', dest='connection_string', default='sqlite://', @@ -20,7 +20,7 @@ class SQL2CSV(CSVKitUtility): self.argparser.add_argument('--query', default=None, help="The SQL query to execute. If specified, it overrides FILE and STDIN.") self.argparser.add_argument('-e', '--encoding', dest='encoding', default='utf-8', - help='Specify the encoding the input query file.') + help='Specify the encoding of the input query file.') self.argparser.add_argument('-H', '--no-header-row', dest='no_header_row', action='store_true', help='Do not output column names.') diff --git a/docs/common_arguments.rst b/docs/common_arguments.rst index b4af001..337ac0a 100644 --- a/docs/common_arguments.rst +++ b/docs/common_arguments.rst @@ -24,7 +24,9 @@ All tools which accept CSV as input share a set of common command-line arguments Maximum length of a single field in the input CSV file. -e ENCODING, --encoding ENCODING - Specify the encoding the input CSV file. + Specify the encoding of the input CSV file. + -L LOCALE, --locale LOCALE + Specify the locale (en_US) of any formatted numbers. -S, --skipinitialspace Ignore whitespace immediately following the delimiter. -H, --no-header-row Specify that the input CSV file has no header row. diff --git a/docs/scripts/sql2csv.rst b/docs/scripts/sql2csv.rst index 1ea81e2..bfd3439 100644 --- a/docs/scripts/sql2csv.rst +++ b/docs/scripts/sql2csv.rst @@ -30,7 +30,7 @@ Executes arbitrary commands against a SQL database and outputs the results as a --query QUERY The SQL query to execute. If specified, it overrides FILE and STDIN. -e ENCODING, --encoding ENCODING - Specify the encoding the input query file. + Specify the encoding of the input query file. -H, --no-header-row Do not output column names. Examples
Parse non-US locale numbers Sometimes numeric data contains thousands separators, typically ',', '_' or in Europe ','. Also Europeans sometimes use ',' as the decimal point.
wireservice/csvkit
diff --git a/examples/test_locale.csv b/examples/test_locale.csv new file mode 100644 index 0000000..4924ddc --- /dev/null +++ b/examples/test_locale.csv @@ -0,0 +1,2 @@ +a,b,c +"1,7","200.000.000", diff --git a/examples/test_locale_converted.csv b/examples/test_locale_converted.csv new file mode 100644 index 0000000..3cd0f59 --- /dev/null +++ b/examples/test_locale_converted.csv @@ -0,0 +1,2 @@ +a,b,c +1.7,200000000, diff --git a/tests/test_utilities/test_in2csv.py b/tests/test_utilities/test_in2csv.py index 5bedf05..ce9382d 100644 --- a/tests/test_utilities/test_in2csv.py +++ b/tests/test_utilities/test_in2csv.py @@ -34,6 +34,9 @@ class TestIn2CSV(CSVKitTestCase, EmptyFileTests): self.assertEqual(e.exception.code, 0) + def test_locale(self): + self.assertConverted('csv', 'examples/test_locale.csv', 'examples/test_locale_converted.csv', ['--locale', 'de_DE']) + def test_convert_csv(self): self.assertConverted('csv', 'examples/testfixed_converted.csv', 'examples/testfixed_converted.csv')
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 5 }
1.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "agate-excel" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
agate==1.13.0 agate-dbf==0.2.3 agate-excel==0.4.1 agate-sql==0.7.2 babel==2.17.0 -e git+https://github.com/wireservice/csvkit.git@b69d7cd51f0e273564a3209d871bb9af3cfd7f42#egg=csvkit dbfread==2.0.7 et_xmlfile==2.0.0 exceptiongroup==1.2.2 greenlet==3.1.1 iniconfig==2.1.0 isodate==0.7.2 leather==0.4.0 olefile==0.47 openpyxl==3.1.5 packaging==24.2 parsedatetime==2.6 pluggy==1.5.0 pytest==8.3.5 python-slugify==8.0.4 pytimeparse==1.1.8 six==1.17.0 SQLAlchemy==2.0.40 text-unidecode==1.3 tomli==2.2.1 typing_extensions==4.13.0 xlrd==2.0.1
name: csvkit channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - agate==1.13.0 - agate-dbf==0.2.3 - agate-excel==0.4.1 - agate-sql==0.7.2 - babel==2.17.0 - dbfread==2.0.7 - et-xmlfile==2.0.0 - exceptiongroup==1.2.2 - greenlet==3.1.1 - iniconfig==2.1.0 - isodate==0.7.2 - leather==0.4.0 - olefile==0.47 - openpyxl==3.1.5 - packaging==24.2 - parsedatetime==2.6 - pluggy==1.5.0 - pytest==8.3.5 - python-slugify==8.0.4 - pytimeparse==1.1.8 - six==1.17.0 - sqlalchemy==2.0.40 - text-unidecode==1.3 - tomli==2.2.1 - typing-extensions==4.13.0 - xlrd==2.0.1 prefix: /opt/conda/envs/csvkit
[ "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_locale" ]
[ "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_dbf" ]
[ "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_csv", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_csv_with_skip_lines", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_geojson", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_json", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_ndjson", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_nested_json", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_xls", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_xls_with_sheet", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_xls_with_skip_lines", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_xlsx", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_xlsx_with_sheet", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_xlsx_with_skip_lines", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_csv_datetime_inference", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_csv_no_headers", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_csv_no_inference", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_empty", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_geojson_no_inference", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_json_no_inference", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_launch_new_instance", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_names_xls", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_names_xlsx", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_ndjson_no_inference", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_version", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_xls_no_inference", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_xlsx_no_inference" ]
[]
MIT License
991
[ "csvkit/utilities/sql2csv.py", "docs/common_arguments.rst", "CHANGELOG.rst", "csvkit/cli.py", "docs/scripts/sql2csv.rst" ]
[ "csvkit/utilities/sql2csv.py", "docs/common_arguments.rst", "CHANGELOG.rst", "csvkit/cli.py", "docs/scripts/sql2csv.rst" ]
wireservice__csvkit-779
508c14eb6203f49a7e21b4c3e2e89df64324c8ee
2017-01-28 20:42:40
e88daad61ed949edf11dfbf377eb347a9b969d47
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9dc61c3..98ccd17 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,8 @@ Improvements: * Add a :code:`--version` flag. * Add a :code:`--skip-lines` option to skip initial lines (e.g. comments, copyright notices, empty rows). * Add a :code:`--locale` option to set the locale of any formatted numbers. +* Add a :code:`--date-format` option to set a strptime date format string. +* Add a :code:`--datetime-format` option to set a strptime datetime format string. * :code:`-I` is the short option for :code:`--no-inference`. * :doc:`/scripts/csvjoin` supports :code:`--snifflimit` and :code:`--no-inference`. * :doc:`/scripts/csvstat` adds a :code:`--freq-count` option to set the maximum number of frequent values to display. diff --git a/csvkit/cli.py b/csvkit/cli.py index fdd77d4..57e7659 100644 --- a/csvkit/cli.py +++ b/csvkit/cli.py @@ -166,6 +166,12 @@ class CSVKitUtility(object): if 'S' not in self.override_flags: self.argparser.add_argument('-S', '--skipinitialspace', dest='skipinitialspace', action='store_true', help='Ignore whitespace immediately following the delimiter.') + if 'date-format' not in self.override_flags: + self.argparser.add_argument('--date-format', dest='date_format', + help='Specify a strptime date format string like "%%m/%%d/%%Y".') + if 'datetime-format' not in self.override_flags: + self.argparser.add_argument('--datetime-format', dest='datetime_format', + help='Specify a strptime datetime format string like "%%m/%%d/%%Y %%I:%%M %%p".') if 'H' not in self.override_flags: self.argparser.add_argument('-H', '--no-header-row', dest='no_header_row', action='store_true', help='Specify that the input CSV file has no header row. Will create default headers (a,b,c,...).') @@ -288,8 +294,8 @@ class CSVKitUtility(object): agate.Boolean(), agate.Number(locale=self.args.locale), agate.TimeDelta(), - agate.Date(), - agate.DateTime(), + agate.Date(date_format=self.args.date_format), + agate.DateTime(datetime_format=self.args.datetime_format), text_type ]) diff --git a/csvkit/utilities/csvclean.py b/csvkit/utilities/csvclean.py index 36b4aa5..e94e7ab 100644 --- a/csvkit/utilities/csvclean.py +++ b/csvkit/utilities/csvclean.py @@ -11,7 +11,7 @@ from csvkit.cleanup import RowChecker class CSVClean(CSVKitUtility): description = 'Fix common errors in a CSV file.' - override_flags = ['H', 'L'] + override_flags = ['H', 'L', 'date-format', 'datetime-format'] def add_arguments(self): self.argparser.add_argument('-n', '--dry-run', dest='dryrun', action='store_true', diff --git a/csvkit/utilities/csvcut.py b/csvkit/utilities/csvcut.py index a168c03..ed3dc84 100644 --- a/csvkit/utilities/csvcut.py +++ b/csvkit/utilities/csvcut.py @@ -16,7 +16,7 @@ from csvkit.cli import CSVKitUtility class CSVCut(CSVKitUtility): description = 'Filter and truncate CSV files. Like the Unix "cut" command, but for tabular data.' - override_flags = ['L'] + override_flags = ['L', 'date-format', 'datetime-format'] def add_arguments(self): self.argparser.add_argument('-n', '--names', dest='names_only', action='store_true', diff --git a/csvkit/utilities/csvformat.py b/csvkit/utilities/csvformat.py index 8228703..10c2242 100644 --- a/csvkit/utilities/csvformat.py +++ b/csvkit/utilities/csvformat.py @@ -7,7 +7,7 @@ from csvkit.cli import CSVKitUtility class CSVFormat(CSVKitUtility): description = 'Convert a CSV file to a custom output format.' - override_flags = ['l', 'zero', 'H', 'L'] + override_flags = ['l', 'zero', 'H', 'L', 'date-format', 'datetime-format'] def add_arguments(self): self.argparser.add_argument('-D', '--out-delimiter', dest='out_delimiter', diff --git a/csvkit/utilities/csvgrep.py b/csvkit/utilities/csvgrep.py index 02792ce..b2c013e 100644 --- a/csvkit/utilities/csvgrep.py +++ b/csvkit/utilities/csvgrep.py @@ -11,7 +11,7 @@ from csvkit.grep import FilteringCSVReader class CSVGrep(CSVKitUtility): description = 'Search CSV files. Like the Unix "grep" command, but for tabular data.' - override_flags = ['L'] + override_flags = ['L', 'date-format', 'datetime-format'] def add_arguments(self): self.argparser.add_argument('-n', '--names', dest='names_only', action='store_true', diff --git a/csvkit/utilities/csvjson.py b/csvkit/utilities/csvjson.py index 63d1689..9d50e83 100644 --- a/csvkit/utilities/csvjson.py +++ b/csvkit/utilities/csvjson.py @@ -37,7 +37,7 @@ class CSVJSON(CSVKitUtility): self.argparser.add_argument('-y', '--snifflimit', dest='sniff_limit', type=int, help='Limit CSV dialect sniffing to the specified number of bytes. Specify "0" to disable sniffing entirely.') self.argparser.add_argument('-I', '--no-inference', dest='no_inference', action='store_true', - help='Disable type inference when parsing CSV input.') + help='Disable type inference (and --locale, --date-format, --datetime-format) when parsing CSV input.') def main(self): # We need to do this dance here, because we aren't writing through agate. diff --git a/csvkit/utilities/csvstack.py b/csvkit/utilities/csvstack.py index a9a620d..bf1c00b 100644 --- a/csvkit/utilities/csvstack.py +++ b/csvkit/utilities/csvstack.py @@ -9,7 +9,7 @@ from csvkit.cli import CSVKitUtility, make_default_headers class CSVStack(CSVKitUtility): description = 'Stack up the rows from multiple CSV files, optionally adding a grouping value.' - override_flags = ['f', 'K', 'L'] + override_flags = ['f', 'K', 'L', 'date-format', 'datetime-format'] def add_arguments(self): self.argparser.add_argument(metavar="FILE", nargs='+', dest='input_paths', default=['-'], diff --git a/csvkit/utilities/csvstat.py b/csvkit/utilities/csvstat.py index 9bac46f..8a31720 100644 --- a/csvkit/utilities/csvstat.py +++ b/csvkit/utilities/csvstat.py @@ -63,7 +63,7 @@ OPERATIONS = OrderedDict([ class CSVStat(CSVKitUtility): description = 'Print descriptive statistics for each column in a CSV file.' - override_flags = ['l', 'L'] + override_flags = ['l', 'L', 'date-format', 'datetime-format'] def add_arguments(self): self.argparser.add_argument('--csv', dest='csv_output', action='store_true', diff --git a/csvkit/utilities/in2csv.py b/csvkit/utilities/in2csv.py index 7a4bc3c..08e7787 100644 --- a/csvkit/utilities/in2csv.py +++ b/csvkit/utilities/in2csv.py @@ -35,7 +35,7 @@ class In2CSV(CSVKitUtility): self.argparser.add_argument('-y', '--snifflimit', dest='sniff_limit', type=int, help='Limit CSV dialect sniffing to the specified number of bytes. Specify "0" to disable sniffing entirely.') self.argparser.add_argument('-I', '--no-inference', dest='no_inference', action='store_true', - help='Disable type inference when parsing CSV input.') + help='Disable type inference (and --locale, --date-format, --datetime-format) when parsing CSV input.') def main(self): # Determine the file type. diff --git a/csvkit/utilities/sql2csv.py b/csvkit/utilities/sql2csv.py index 1b56f52..c16fed3 100644 --- a/csvkit/utilities/sql2csv.py +++ b/csvkit/utilities/sql2csv.py @@ -10,7 +10,7 @@ from csvkit.cli import CSVKitUtility class SQL2CSV(CSVKitUtility): description = 'Execute an SQL query on a database and output the result to a CSV file.' - override_flags = 'f,b,d,e,H,K,L,p,q,S,t,u,z,zero'.split(',') + override_flags = 'f,b,d,e,H,K,L,p,q,S,t,u,z,date-format,datetime-format,zero'.split(',') def add_arguments(self): self.argparser.add_argument('--db', dest='connection_string', default='sqlite://', diff --git a/docs/common_arguments.rst b/docs/common_arguments.rst index 337ac0a..79edf46 100644 --- a/docs/common_arguments.rst +++ b/docs/common_arguments.rst @@ -29,6 +29,11 @@ All tools which accept CSV as input share a set of common command-line arguments Specify the locale (en_US) of any formatted numbers. -S, --skipinitialspace Ignore whitespace immediately following the delimiter. + --date-format DATE_FORMAT + Specify a strptime date format string like "%m/%d/%Y". + --datetime-format DATETIME_FORMAT + Specify a strptime datetime format string like + "%m/%d/%Y %I:%M %p". -H, --no-header-row Specify that the input CSV file has no header row. Will create default headers (A,B,C,...). -L SKIP_LINES, --skip-lines SKIP_LINES
Support date format hints Excel will output CSVs with dates in the user's locale, so a British user will see dates in the DD/MM/YYYY format, whilst an American user would see MM/DD/YYYY. Currently it appears that csvkit (although I've only really been using csvsql) will always try MM/DD/YYYY first, and if that fails to parse, then it will fall back to DD/MM/YYYY. The problem with this approach arises when you're using a DD/MM/YYYY formatted sheet and you have ambiguity in some dates. For example: 02/01/2014 31/12/2012 This will produce dates in the database of: 2014-01-02 (incorrectly parsed as MM/DD/YYYY) 2012-12-31 So you silently end up with a mixture of correct and incorrect dates, which is not ideal! Ideally there'd be an option one could pass to csvkit programs to specify a preference list for parsing dates. It'd be overkill to specify every format (I think), so having some abbreviations would suffice. For example: --date-formats "dmy,mdy" The default date parsing schema would then follow after this if the formats in the list did not match successfully. An extension to this may be to try to infer the date format by examining all rows globally and selecting the format that successfully parses them all (of course, this is still no guarantee of success as people may _only_ have ambiguous dates present).
wireservice/csvkit
diff --git a/examples/test_date_format.csv b/examples/test_date_format.csv new file mode 100644 index 0000000..8472a28 --- /dev/null +++ b/examples/test_date_format.csv @@ -0,0 +1,3 @@ +a +02/01/2014 +31/12/2012 diff --git a/examples/test_date_format_converted.csv b/examples/test_date_format_converted.csv new file mode 100644 index 0000000..4e6418b --- /dev/null +++ b/examples/test_date_format_converted.csv @@ -0,0 +1,3 @@ +a +2014-01-02 +2012-12-31 diff --git a/tests/test_utilities/test_in2csv.py b/tests/test_utilities/test_in2csv.py index 753bae4..bac977f 100644 --- a/tests/test_utilities/test_in2csv.py +++ b/tests/test_utilities/test_in2csv.py @@ -37,6 +37,9 @@ class TestIn2CSV(CSVKitTestCase, EmptyFileTests): def test_locale(self): self.assertConverted('csv', 'examples/test_locale.csv', 'examples/test_locale_converted.csv', ['--locale', 'de_DE']) + def test_date_format(self): + self.assertConverted('csv', 'examples/test_date_format.csv', 'examples/test_date_format_converted.csv', ['--date-format', '%d/%m/%Y']) + def test_convert_csv(self): self.assertConverted('csv', 'examples/testfixed_converted.csv', 'examples/testfixed_converted.csv')
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 1 }, "num_modified_files": 12 }
1.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "agate-excel" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
agate==1.13.0 agate-dbf==0.2.3 agate-excel==0.4.1 agate-sql==0.7.2 babel==2.17.0 -e git+https://github.com/wireservice/csvkit.git@508c14eb6203f49a7e21b4c3e2e89df64324c8ee#egg=csvkit dbfread==2.0.7 et_xmlfile==2.0.0 exceptiongroup==1.2.2 greenlet==3.1.1 iniconfig==2.1.0 isodate==0.7.2 leather==0.4.0 olefile==0.47 openpyxl==3.1.5 packaging==24.2 parsedatetime==2.6 pluggy==1.5.0 pytest==8.3.5 python-slugify==8.0.4 pytimeparse==1.1.8 six==1.17.0 SQLAlchemy==2.0.40 text-unidecode==1.3 tomli==2.2.1 typing_extensions==4.13.0 xlrd==2.0.1
name: csvkit channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - agate==1.13.0 - agate-dbf==0.2.3 - agate-excel==0.4.1 - agate-sql==0.7.2 - babel==2.17.0 - dbfread==2.0.7 - et-xmlfile==2.0.0 - exceptiongroup==1.2.2 - greenlet==3.1.1 - iniconfig==2.1.0 - isodate==0.7.2 - leather==0.4.0 - olefile==0.47 - openpyxl==3.1.5 - packaging==24.2 - parsedatetime==2.6 - pluggy==1.5.0 - pytest==8.3.5 - python-slugify==8.0.4 - pytimeparse==1.1.8 - six==1.17.0 - sqlalchemy==2.0.40 - text-unidecode==1.3 - tomli==2.2.1 - typing-extensions==4.13.0 - xlrd==2.0.1 prefix: /opt/conda/envs/csvkit
[ "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_date_format" ]
[ "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_dbf" ]
[ "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_csv", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_csv_with_skip_lines", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_geojson", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_json", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_ndjson", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_nested_json", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_xls", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_xls_with_sheet", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_xls_with_skip_lines", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_xlsx", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_xlsx_with_sheet", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_convert_xlsx_with_skip_lines", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_csv_datetime_inference", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_csv_no_headers", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_csv_no_inference", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_empty", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_geojson_no_inference", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_json_no_inference", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_launch_new_instance", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_locale", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_names_xls", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_names_xlsx", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_ndjson_no_inference", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_version", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_xls_no_inference", "tests/test_utilities/test_in2csv.py::TestIn2CSV::test_xlsx_no_inference" ]
[]
MIT License
992
[ "csvkit/utilities/csvformat.py", "csvkit/utilities/csvgrep.py", "csvkit/utilities/sql2csv.py", "csvkit/utilities/csvclean.py", "docs/common_arguments.rst", "CHANGELOG.rst", "csvkit/cli.py", "csvkit/utilities/csvstack.py", "csvkit/utilities/csvcut.py", "csvkit/utilities/csvjson.py", "csvkit/utilities/in2csv.py", "csvkit/utilities/csvstat.py" ]
[ "csvkit/utilities/csvformat.py", "csvkit/utilities/csvgrep.py", "csvkit/utilities/sql2csv.py", "csvkit/utilities/csvclean.py", "docs/common_arguments.rst", "CHANGELOG.rst", "csvkit/cli.py", "csvkit/utilities/csvstack.py", "csvkit/utilities/csvcut.py", "csvkit/utilities/csvjson.py", "csvkit/utilities/in2csv.py", "csvkit/utilities/csvstat.py" ]
mesonbuild__meson-1342
380b9157b8a282552e1463ca9a0e486e5b6319e2
2017-01-29 21:50:57
293520f55f13de5db95732a84dbd3637ba6c6163
diff --git a/man/meson.1 b/man/meson.1 index 0b2a3e4d8..d721e89c2 100644 --- a/man/meson.1 +++ b/man/meson.1 @@ -1,4 +1,4 @@ -.TH MESON "1" "January 2017" "meson 0.38.0" "User Commands" +.TH MESON "1" "December 2016" "meson 0.37.1" "User Commands" .SH NAME meson - a high productivity build system .SH DESCRIPTION diff --git a/man/mesonintrospect.1 b/man/mesonintrospect.1 index 8f9cfe805..a9ee2c237 100644 --- a/man/mesonintrospect.1 +++ b/man/mesonintrospect.1 @@ -1,4 +1,4 @@ -.TH MESONCONF "1" "January 2017" "mesonintrospect 0.38.0" "User Commands" +.TH MESONCONF "1" "December 2016" "mesonintrospect 0.37.1" "User Commands" .SH NAME mesonintrospect - a tool to extract information about a Meson build .SH DESCRIPTION diff --git a/man/wraptool.1 b/man/wraptool.1 index 35b56956a..e211ea3aa 100644 --- a/man/wraptool.1 +++ b/man/wraptool.1 @@ -1,4 +1,4 @@ -.TH WRAPTOOL "1" "January 2017" "meson 0.38.0" "User Commands" +.TH WRAPTOOL "1" "December 2016" "meson 0.37.1" "User Commands" .SH NAME wraptool - source dependency downloader .SH DESCRIPTION diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index cae40095e..02ea6ba22 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -1,4 +1,4 @@ -# Copyright 2012-2017 The Meson development team +# Copyright 2012-2016 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,9 +13,10 @@ # limitations under the License. import pickle, os, uuid -from .mesonlib import MesonException, default_libdir, default_libexecdir, default_prefix +from .mesonlib import MesonException, commonpath +from .mesonlib import default_libdir, default_libexecdir, default_prefix -version = '0.38.1' +version = '0.38.0.dev1' backendlist = ['ninja', 'vs2010', 'vs2015', 'xcode'] class UserOption: @@ -158,7 +159,7 @@ class CoreData: if option.endswith('dir') and os.path.isabs(value) and \ option not in builtin_dir_noprefix_options: # Value must be a subdir of the prefix - if os.path.commonpath([value, prefix]) != prefix: + if commonpath([value, prefix]) != prefix: m = 'The value of the {!r} option is {!r} which must be a ' \ 'subdir of the prefix {!r}.\nNote that if you pass a ' \ 'relative path, it is assumed to be a subdir of prefix.' @@ -194,9 +195,9 @@ class CoreData: elif optname in self.builtins: prefix = self.builtins['prefix'].value value = self.sanitize_dir_option_value(prefix, optname, value) - self.builtins[optname].set_value(value) else: raise RuntimeError('Tried to set unknown builtin option %s.' % optname) + self.builtins[optname].set_value(value) def load(filename): load_fail_msg = 'Coredata file {!r} is corrupted. Try with a fresh build tree.'.format(filename) diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 2ad43c823..f0b20e1bd 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -496,3 +496,28 @@ def Popen_safe(args, write=None, stderr=subprocess.PIPE, **kwargs): stderr=stderr, **kwargs) o, e = p.communicate(write) return p, o, e + +def commonpath(paths): + ''' + For use on Python 3.4 where os.path.commonpath is not available. + We currently use it everywhere so this receives enough testing. + ''' + # XXX: Replace me with os.path.commonpath when we start requiring Python 3.5 + import pathlib + if not paths: + raise ValueError('arg is an empty sequence') + common = pathlib.PurePath(paths[0]) + for path in paths[1:]: + new = [] + path = pathlib.PurePath(path) + for c, p in zip(common.parts, path.parts): + if c != p: + break + new.append(c) + # Don't convert '' into '.' + if not new: + common = '' + break + new = os.path.join(*new) + common = pathlib.PurePath(new) + return str(common) diff --git a/setup.py b/setup.py index 300ddf1bc..e9bbdb4f0 100644 --- a/setup.py +++ b/setup.py @@ -74,7 +74,7 @@ setup(name='meson', data_files=[('share/man/man1', ['man/meson.1', 'man/mesonconf.1', 'man/mesonintrospect.1', - 'man/mesontest.1', + 'main/mesontest.1', 'man/wraptool.1'])], classifiers=['Development Status :: 5 - Production/Stable', 'Environment :: Console',
AttributeError: 'module' object has no attribute 'commonpath' ```python Traceback (most recent call last): File "/builddir/build/BUILD/meson-0.38.0/mesonbuild/mesonmain.py", line 286, in run app.generate() File "/builddir/build/BUILD/meson-0.38.0/mesonbuild/mesonmain.py", line 160, in generate intr = interpreter.Interpreter(b, g) File "/builddir/build/BUILD/meson-0.38.0/mesonbuild/interpreter.py", line 1198, in __init__ self.parse_project() File "/builddir/build/BUILD/meson-0.38.0/mesonbuild/interpreterbase.py", line 111, in parse_project self.evaluate_codeblock(self.ast, end=1) File "/builddir/build/BUILD/meson-0.38.0/mesonbuild/interpreterbase.py", line 146, in evaluate_codeblock raise e File "/builddir/build/BUILD/meson-0.38.0/mesonbuild/interpreterbase.py", line 140, in evaluate_codeblock self.evaluate_statement(cur) File "/builddir/build/BUILD/meson-0.38.0/mesonbuild/interpreterbase.py", line 151, in evaluate_statement return self.function_call(cur) File "/builddir/build/BUILD/meson-0.38.0/mesonbuild/interpreterbase.py", line 372, in function_call return self.funcs[func_name](node, self.flatten(posargs), kwargs) File "/builddir/build/BUILD/meson-0.38.0/mesonbuild/interpreterbase.py", line 55, in wrapped return f(self, node, args, kwargs) File "/builddir/build/BUILD/meson-0.38.0/mesonbuild/interpreter.py", line 1581, in func_project self.parse_default_options(kwargs['default_options']) File "/builddir/build/BUILD/meson-0.38.0/mesonbuild/interpreter.py", line 1549, in parse_default_options self.coredata.set_builtin_option(key, value) File "/builddir/build/BUILD/meson-0.38.0/mesonbuild/coredata.py", line 196, in set_builtin_option value = self.sanitize_dir_option_value(prefix, optname, value) File "/builddir/build/BUILD/meson-0.38.0/mesonbuild/coredata.py", line 161, in sanitize_dir_option_value if os.path.commonpath([value, prefix]) != prefix: AttributeError: 'module' object has no attribute 'commonpath' ``` I think it happened after one of tests failed
mesonbuild/meson
diff --git a/run_tests.py b/run_tests.py index 2dfbaffad..005717e07 100755 --- a/run_tests.py +++ b/run_tests.py @@ -20,9 +20,11 @@ from mesonbuild import mesonlib if __name__ == '__main__': returncode = 0 + print('Running unittests.\n') if mesonlib.is_linux(): - print('Running unittests.\n') returncode += subprocess.call([sys.executable, 'run_unittests.py', '-v']) + else: + returncode += subprocess.call([sys.executable, 'run_unittests.py', '-v', 'InternalTests']) # Ubuntu packages do not have a binary without -6 suffix. if shutil.which('arm-linux-gnueabihf-gcc-6') and not platform.machine().startswith('arm'): print('Running cross compilation tests.\n') diff --git a/run_unittests.py b/run_unittests.py index a1d99f392..e8659f40a 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -153,6 +153,23 @@ class InternalTests(unittest.TestCase): a = ['-Ldir', '-Lbah'] + a self.assertEqual(a, ['-Ibar', '-Ifoo', '-Ibaz', '-I..', '-I.', '-Ldir', '-Lbah', '-Werror', '-O3', '-O2', '-Wall']) + def test_commonpath(self): + from os.path import sep + commonpath = mesonbuild.mesonlib.commonpath + self.assertRaises(ValueError, commonpath, []) + self.assertEqual(commonpath(['/usr', '/usr']), sep + 'usr') + self.assertEqual(commonpath(['/usr', '/usr/']), sep + 'usr') + self.assertEqual(commonpath(['/usr', '/usr/bin']), sep + 'usr') + self.assertEqual(commonpath(['/usr/', '/usr/bin']), sep + 'usr') + self.assertEqual(commonpath(['/usr/./', '/usr/bin']), sep + 'usr') + self.assertEqual(commonpath(['/usr/bin', '/usr/bin']), sep + 'usr' + sep + 'bin') + self.assertEqual(commonpath(['/usr//bin', '/usr/bin']), sep + 'usr' + sep + 'bin') + self.assertEqual(commonpath(['/usr/./bin', '/usr/bin']), sep + 'usr' + sep + 'bin') + self.assertEqual(commonpath(['/usr/local', '/usr/lib']), sep + 'usr') + self.assertEqual(commonpath(['/usr', '/bin']), sep) + self.assertEqual(commonpath(['/usr', 'bin']), '') + self.assertEqual(commonpath(['blam', 'bin']), '') + class LinuxlikeTests(unittest.TestCase): def setUp(self):
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 1 }, "num_modified_files": 6 }
0.38
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work -e git+https://github.com/mesonbuild/meson.git@380b9157b8a282552e1463ca9a0e486e5b6319e2#egg=meson packaging @ file:///croot/packaging_1734472117206/work pluggy @ file:///croot/pluggy_1733169602837/work pytest @ file:///croot/pytest_1738938843180/work tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
name: meson channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 prefix: /opt/conda/envs/meson
[ "run_unittests.py::InternalTests::test_commonpath" ]
[ "run_unittests.py::LinuxlikeTests::test_basic_soname", "run_unittests.py::LinuxlikeTests::test_build_by_default", "run_unittests.py::LinuxlikeTests::test_compiler_c_stds", "run_unittests.py::LinuxlikeTests::test_compiler_check_flags_order", "run_unittests.py::LinuxlikeTests::test_compiler_cpp_stds", "run_unittests.py::LinuxlikeTests::test_custom_soname", "run_unittests.py::LinuxlikeTests::test_custom_target_exe_data_deterministic", "run_unittests.py::LinuxlikeTests::test_install_introspection", "run_unittests.py::LinuxlikeTests::test_installed_modes", "run_unittests.py::LinuxlikeTests::test_installed_soname", "run_unittests.py::LinuxlikeTests::test_internal_include_order", "run_unittests.py::LinuxlikeTests::test_libdir_must_be_inside_prefix", "run_unittests.py::LinuxlikeTests::test_pic", "run_unittests.py::LinuxlikeTests::test_pkgconfig_gen", "run_unittests.py::LinuxlikeTests::test_run_target_files_path", "run_unittests.py::LinuxlikeTests::test_soname", "run_unittests.py::LinuxlikeTests::test_static_compile_order", "run_unittests.py::LinuxlikeTests::test_suite_selection", "run_unittests.py::LinuxlikeTests::test_uninstall", "run_unittests.py::LinuxlikeTests::test_vala_c_warnings" ]
[ "run_unittests.py::InternalTests::test_compiler_args_class", "run_unittests.py::InternalTests::test_mode_symbolic_to_bits", "run_unittests.py::InternalTests::test_version_number", "run_unittests.py::RewriterTests::test_basic", "run_unittests.py::RewriterTests::test_subdir" ]
[]
Apache License 2.0
994
[ "mesonbuild/mesonlib.py", "mesonbuild/coredata.py", "man/wraptool.1", "setup.py", "man/meson.1", "man/mesonintrospect.1" ]
[ "mesonbuild/mesonlib.py", "mesonbuild/coredata.py", "man/wraptool.1", "setup.py", "man/meson.1", "man/mesonintrospect.1" ]
eyeseast__python-frontmatter-31
e017a210fc4c9725c36fb970df03a32cd655aa77
2017-01-30 02:41:18
e017a210fc4c9725c36fb970df03a32cd655aa77
diff --git a/README.md b/README.md index 16153b1..a19316c 100644 --- a/README.md +++ b/README.md @@ -76,10 +76,10 @@ Write back to plain text, too: Or write to a file (or file-like object): - >>> from io import StringIO - >>> f = StringIO() + >>> from io import BytesIO + >>> f = BytesIO() >>> frontmatter.dump(post, f) - >>> print(f.getvalue()) # doctest: +NORMALIZE_WHITESPACE + >>> print(f.getvalue().decode('utf-8')) # doctest: +NORMALIZE_WHITESPACE --- excerpt: tl;dr layout: post diff --git a/docs/conf.py b/docs/conf.py index 6fffc9e..1f9fb46 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -16,9 +16,9 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) +import os +import sys +sys.path.insert(0, os.path.abspath('..')) # -- General configuration ------------------------------------------------ diff --git a/frontmatter/__init__.py b/frontmatter/__init__.py index 889882f..dd31fe3 100644 --- a/frontmatter/__init__.py +++ b/frontmatter/__init__.py @@ -40,16 +40,24 @@ if TOMLHandler is not None: handlers['+++'] = TOMLHandler() -def parse(text, **defaults): +def parse(text, encoding='utf-8', **defaults): """ Parse text with frontmatter, return metadata and content. Pass in optional metadata defaults as keyword args. If frontmatter is not found, returns an empty metadata dictionary (or defaults) and original text content. + + :: + + >>> with open('tests/hello-world.markdown') as f: + ... metadata, content = frontmatter.parse(f.read()) + >>> print(metadata['title']) + Hello, world! + """ # ensure unicode first - text = u(text).strip() + text = u(text, encoding).strip() # metadata starts with defaults metadata = defaults.copy() @@ -76,44 +84,86 @@ def parse(text, **defaults): return metadata, content.strip() -def load(fd, **defaults): +def load(fd, encoding='utf-8', **defaults): """ - Load and parse a file or filename, return a post. + Load and parse a file-like object or filename, + return a :py:class:`post <frontmatter.Post>`. + + :: + + >>> post = frontmatter.load('tests/hello-world.markdown') + >>> with open('tests/hello-world.markdown') as f: + ... post = frontmatter.load(f) + """ if hasattr(fd, 'read'): text = fd.read() else: - with codecs.open(fd, 'r', 'utf-8') as f: + with codecs.open(fd, 'r', encoding) as f: text = f.read() - return loads(text, **defaults) + return loads(text, encoding, **defaults) -def loads(text, **defaults): +def loads(text, encoding='utf-8', **defaults): """ - Parse text and return a post. + Parse text (binary or unicode) and return a :py:class:`post <frontmatter.Post>`. + + :: + + >>> with open('tests/hello-world.markdown') as f: + ... post = frontmatter.loads(f.read()) + """ - metadata, content = parse(text, **defaults) + metadata, content = parse(text, encoding, **defaults) return Post(content, **metadata) -def dump(post, fd, **kwargs): +def dump(post, fd, encoding='utf-8', **kwargs): """ - Serialize post to a string and dump to a file-like object. + Serialize :py:class:`post <frontmatter.Post>` to a string and write to a file-like object. + Text will be encoded on the way out (utf-8 by default). + + :: + + >>> from io import StringIO + >>> f = StringIO() + >>> frontmatter.dump(post, f) + >>> print(f.getvalue()) + --- + excerpt: tl;dr + layout: post + title: Hello, world! + --- + Well, hello there, world. + + """ - content = dumps(post, **kwargs) + content = dumps(post, **kwargs).encode(encoding) if hasattr(fd, 'write'): fd.write(content) else: - with codecs.open(fd, 'w', 'utf-8') as f: + with codecs.open(fd, 'w', encoding) as f: f.write(content) def dumps(post, **kwargs): """ - Serialize post to a string and return text. + Serialize a :py:class:`post <frontmatter.Post>` to a string and return text. + This always returns unicode text, which can then be encoded. + + :: + + >>> print(frontmatter.dumps(post)) + --- + excerpt: tl;dr + layout: post + title: Hello, world! + --- + Well, hello there, world. + """ kwargs.setdefault('Dumper', SafeDumper) kwargs.setdefault('default_flow_style', False)
Allow user to pass in an encoding when loading and dumping
eyeseast/python-frontmatter
diff --git a/test.py b/test.py index 07b2883..05fdb3c 100644 --- a/test.py +++ b/test.py @@ -44,7 +44,7 @@ class FrontmatterTest(unittest.TestCase): def test_unicode_post(self): "Ensure unicode is parsed correctly" - chinese = frontmatter.load('tests/chinese.txt') + chinese = frontmatter.load('tests/chinese.txt', 'utf-8') self.assertTrue(isinstance(chinese.content, six.text_type)) @@ -107,7 +107,7 @@ class FrontmatterTest(unittest.TestCase): def test_with_crlf_string(self): import codecs markdown_bytes = b'---\r\ntitle: "my title"\r\ncontent_type: "post"\r\npublished: no\r\n---\r\n\r\nwrite your content in markdown here' - loaded = frontmatter.loads(codecs.decode(markdown_bytes, 'utf-8')) + loaded = frontmatter.loads(markdown_bytes, 'utf-8') self.assertEqual(loaded['title'], 'my title') def test_dumping_with_custom_delimiters(self):
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 3 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup==1.2.2 iniconfig==2.1.0 packaging==24.2 pluggy==1.5.0 pytest==8.3.5 -e git+https://github.com/eyeseast/python-frontmatter.git@e017a210fc4c9725c36fb970df03a32cd655aa77#egg=python_frontmatter PyYAML==3.11 six==1.10.0 toml==0.9.1 tomli==2.2.1
name: python-frontmatter channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - exceptiongroup==1.2.2 - iniconfig==2.1.0 - packaging==24.2 - pluggy==1.5.0 - pytest==8.3.5 - pyyaml==3.11 - six==1.10.0 - toml==0.9.1 - tomli==2.2.1 prefix: /opt/conda/envs/python-frontmatter
[ "test.py::FrontmatterTest::test_unicode_post", "test.py::FrontmatterTest::test_with_crlf_string" ]
[]
[ "test.py::FrontmatterTest::test_all_the_tests", "test.py::FrontmatterTest::test_custom_handler", "test.py::FrontmatterTest::test_dumping_with_custom_delimiters", "test.py::FrontmatterTest::test_empty_frontmatter", "test.py::FrontmatterTest::test_json", "test.py::FrontmatterTest::test_no_frontmatter", "test.py::FrontmatterTest::test_pretty_dumping", "test.py::FrontmatterTest::test_to_dict", "test.py::FrontmatterTest::test_to_string", "test.py::FrontmatterTest::test_toml", "test.py::FrontmatterTest::test_with_markdown_content" ]
[]
MIT License
995
[ "docs/conf.py", "README.md", "frontmatter/__init__.py" ]
[ "docs/conf.py", "README.md", "frontmatter/__init__.py" ]
palantir__python-language-server-7
9ea92b5efb264bc564f60bfc7475883e60944bd0
2017-01-30 15:17:16
9ea92b5efb264bc564f60bfc7475883e60944bd0
diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000..d66bb32 --- /dev/null +++ b/circle.yml @@ -0,0 +1,3 @@ +machine: + post: + - pyenv global 2.7.11 3.6.0 diff --git a/pyls/providers/code_lens.py b/pyls/providers/code_lens.py deleted file mode 100644 index 3e97e68..0000000 --- a/pyls/providers/code_lens.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2017 Palantir Technologies, Inc. -import logging -from .base import JediProvider - -log = logging.getLogger(__name__) - - -class JediReferencesProvider(JediProvider): - """ Returns the references to whatever is under the cursor, if it's known """ - - def run(self, doc_uri, position, exclude_declaration=False): - usages = self.jedi_script(doc_uri, position).usages() - - if exclude_declaration: - # Filter out if the usage is the actual declaration of the thing - usages = [d for d in usages if not d.is_definition()] - - return [{ - 'uri': self.workspace.get_uri_like(doc_uri, d.module_path), - 'range': { - 'start': {'line': d.line - 1, 'character': d.column}, - 'end': {'line': d.line - 1, 'character': d.column + len(d.name)} - } - } for d in usages] diff --git a/pyls/providers/completion.py b/pyls/providers/completion.py index e432808..584fd6a 100644 --- a/pyls/providers/completion.py +++ b/pyls/providers/completion.py @@ -28,13 +28,11 @@ def sort_text(definition): """ Ensure builtins appear at the bottom. Description is of format <type>: <module>.<item> """ - mod = definition.description.split(":", 1)[1].strip() - if definition.in_builtin_module(): # It's a builtin, put it last return 'z' + definition.name - if '.' in mod and mod.rsplit(".", 1)[1].startswith("_"): + if definition.name.startswith("_"): # It's a 'hidden' func, put it next last return 'y' + definition.name diff --git a/pyls/providers/hover.py b/pyls/providers/hover.py index dc28016..74b7afa 100644 --- a/pyls/providers/hover.py +++ b/pyls/providers/hover.py @@ -9,16 +9,16 @@ class JediDocStringHoverProvider(JediProvider): """ Displays the docstring of whatever is under the cursor, if it's known """ def run(self, doc_uri, position): - completions = self.jedi_script(doc_uri, position).completions() + definitions = self.jedi_script(doc_uri, position).goto_definitions() document = self.workspace.get_document(doc_uri) word = document.word_at_position(position) # Find an exact match for a completion - completions = [c for c in completions if c.name == word] + definitions = [d for d in definitions if d.name == word] - if len(completions) == 0: + if len(definitions) == 0: # :( return {'contents': ''} # Maybe the docstring could be huuuuuuuuuuge... - return {'contents': completions[0].docstring() or ""} + return {'contents': definitions[0].docstring() or ""}
Implement continuous integration with CircleCi
palantir/python-language-server
diff --git a/test/providers/test_hover.py b/test/providers/test_hover.py index 107bd31..596e014 100644 --- a/test/providers/test_hover.py +++ b/test/providers/test_hover.py @@ -2,17 +2,17 @@ from pyls.providers.hover import JediDocStringHoverProvider DOC_URI = __file__ -DOC = """import sys +DOC = """ def main(): - print sys.stdin.read() - raise Exception() + \"\"\"hello world\"\"\" + pass """ def test_hover(workspace): - # Over 'Exception' in raise Exception() - hov_position = {'line': 4, 'character': 17} + # Over 'main' in def main(): + hov_position = {'line': 2, 'character': 6} # Over the blank second line no_hov_position = {'line': 1, 'character': 0} @@ -20,7 +20,7 @@ def test_hover(workspace): provider = JediDocStringHoverProvider(workspace) assert { - 'contents': 'Common base class for all non-exit exceptions.' + 'contents': 'main()\n\nhello world' } == provider.run(DOC_URI, hov_position) assert {'contents': ''} == provider.run(DOC_URI, no_hov_position)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_added_files", "has_removed_files", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 2 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[test]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "coverage", "pytest-cov" ], "pre_install": null, "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
cachetools==5.5.2 chardet==5.2.0 colorama==0.4.6 configparser==7.2.0 coverage==7.8.0 distlib==0.3.9 exceptiongroup==1.2.2 filelock==3.18.0 future==1.0.0 iniconfig==2.1.0 jedi==0.10.0 packaging==24.2 platformdirs==4.3.7 pluggy==1.5.0 pycodestyle==2.13.0 pyflakes==3.3.1 pyproject-api==1.9.0 pytest==8.3.5 pytest-cov==6.0.0 -e git+https://github.com/palantir/python-language-server.git@9ea92b5efb264bc564f60bfc7475883e60944bd0#egg=python_language_server tomli==2.2.1 tox==4.25.0 typing_extensions==4.13.0 versioneer==0.29 virtualenv==20.29.3 yapf==0.43.0
name: python-language-server channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - cachetools==5.5.2 - chardet==5.2.0 - colorama==0.4.6 - configparser==7.2.0 - coverage==7.8.0 - distlib==0.3.9 - exceptiongroup==1.2.2 - filelock==3.18.0 - future==1.0.0 - iniconfig==2.1.0 - jedi==0.10.0 - packaging==24.2 - platformdirs==4.3.7 - pluggy==1.5.0 - pycodestyle==2.13.0 - pyflakes==3.3.1 - pyproject-api==1.9.0 - pytest==8.3.5 - pytest-cov==6.0.0 - tomli==2.2.1 - tox==4.25.0 - typing-extensions==4.13.0 - versioneer==0.29 - virtualenv==20.29.3 - yapf==0.43.0 prefix: /opt/conda/envs/python-language-server
[ "test/providers/test_hover.py::test_hover" ]
[]
[]
[]
MIT License
996
[ "pyls/providers/hover.py", "pyls/providers/code_lens.py", "pyls/providers/completion.py", "circle.yml" ]
[ "pyls/providers/hover.py", "pyls/providers/code_lens.py", "pyls/providers/completion.py", "circle.yml" ]
Azure__msrest-for-python-12
cef4818746df436465cfc810723f79aa3a72da89
2017-01-31 01:03:14
cef4818746df436465cfc810723f79aa3a72da89
diff --git a/msrest/serialization.py b/msrest/serialization.py index ee81c21..6e2eb28 100644 --- a/msrest/serialization.py +++ b/msrest/serialization.py @@ -113,31 +113,38 @@ class Model(object): return base._subtype_map return {} + @classmethod + def _flatten_subtype(cls, key, objects): + if not '_subtype_map' in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. - We want to ignore any inheirited _subtype_maps. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. """ - try: - map = cls.__dict__.get('_subtype_map', {}) + for subtype_key in cls.__dict__.get('_subtype_map', {}).keys(): + subtype_value = None - for _type, _classes in map.items(): - classification = response.get(_type) - try: - return objects[_classes[classification]] - except KeyError: - pass + rest_api_response_key = _decode_attribute_map_key(cls._attribute_map[subtype_key]['key']) + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + if subtype_value: + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + return objects[flatten_mapping_type[subtype_value]] + return cls - for c in _classes: - try: - _cls = objects[_classes[c]] - return _cls._classify(response, objects) - except (KeyError, TypeError): - continue - raise TypeError("Object cannot be classified futher.") - except AttributeError: - raise TypeError("Object cannot be classified futher.") +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + :param str key: A key string from the generated code + """ + return key.replace('\\.', '.') def _convert_to_datatype(data, data_type, localtypes): if data is None: @@ -157,6 +164,7 @@ def _convert_to_datatype(data, data_type, localtypes): elif issubclass(data_obj, Enum): return data elif not isinstance(data, data_obj): + data_obj = data_obj._classify(data, localtypes) result = { key: _convert_to_datatype( data[key], @@ -195,7 +203,7 @@ class Serializer(object): "unique": lambda x, y: len(x) != len(set(x)), "multiple": lambda x, y: x % y != 0 } - flattten = re.compile(r"(?<!\\)\.") + flatten = re.compile(r"(?<!\\)\.") def __init__(self, classes=None): self.serialize_type = { @@ -241,14 +249,12 @@ class Serializer(object): try: attributes = target_obj._attribute_map - self._classify_data(target_obj, class_name, serialized) - for attr, map in attributes.items(): attr_name = attr debug_name = "{}.{}".format(class_name, attr_name) try: - keys = self.flattten.split(map['key']) - keys = [k.replace('\\.', '.') for k in keys] + keys = self.flatten.split(map['key']) + keys = [_decode_attribute_map_key(k) for k in keys] attr_type = map['type'] orig_attr = getattr(target_obj, attr) validation = target_obj._validation.get(attr_name, {}) @@ -278,18 +284,6 @@ class Serializer(object): else: return serialized - def _classify_data(self, target_obj, class_name, serialized): - """Check whether this object is a child and therefor needs to be - classified in the message. - """ - try: - for _type, _classes in target_obj._get_subtype_map().items(): - for ref, name in _classes.items(): - if name == class_name: - serialized[_type] = ref - except AttributeError: - pass # TargetObj has no _subtype_map so we don't need to classify. - def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. @@ -752,9 +746,9 @@ class Deserializer(object): while '.' in key: dict_keys = self.flatten.split(key) if len(dict_keys) == 1: - key = dict_keys[0].replace('\\.', '.') + key = _decode_attribute_map_key(dict_keys[0]) break - working_key = dict_keys[0].replace('\\.', '.') + working_key = _decode_attribute_map_key(dict_keys[0]) working_data = working_data.get(working_key, data) key = '.'.join(dict_keys[1:]) @@ -786,8 +780,8 @@ class Deserializer(object): try: target = target._classify(data, self.dependencies) - except (TypeError, AttributeError): - pass # Target has no subclasses, so can't classify further. + except AttributeError: + pass # Target is not a Model, no classify return target, target.__class__.__name__ def _unpack_content(self, raw_data):
Support building instance from dict with polymorphic object Currently the SDKs can accept a dict instead of a model and transform it to the right model automatically. This is not available if there is at any level a polymorphic object. This should be possible looking at `_subtype_map` to identify the right instance type FYI @annatisch @vishrutshah
Azure/msrest-for-python
diff --git a/test/unittest_serialization.py b/test/unittest_serialization.py index 166a375..4e35926 100644 --- a/test/unittest_serialization.py +++ b/test/unittest_serialization.py @@ -562,51 +562,56 @@ class TestRuntimeSerialized(unittest.TestCase): _attribute_map = { "animals":{"key":"Animals", "type":"[Animal]"}, - } + } - def __init__(self): - self.animals = None + def __init__(self, animals=None): + self.animals = animals class Animal(Model): _attribute_map = { - "name":{"key":"Name", "type":"str"} - } + "name":{"key":"Name", "type":"str"}, + "d_type":{"key":"dType", "type":"str"} + } _subtype_map = { - 'dType': {"cat":"Cat", "dog":"Dog"} - } + 'd_type': {"cat":"Cat", "dog":"Dog"} + } - def __init__(self): - self.name = None + def __init__(self, name=None): + self.name = name class Dog(Animal): _attribute_map = { "name":{"key":"Name", "type":"str"}, - "likes_dog_food":{"key":"likesDogFood","type":"bool"} + "likes_dog_food":{"key":"likesDogFood","type":"bool"}, + "d_type":{"key":"dType", "type":"str"} } - def __init__(self): - self.likes_dog_food = None - super(Dog, self).__init__() + def __init__(self, name=None, likes_dog_food=None): + self.likes_dog_food = likes_dog_food + super(Dog, self).__init__(name) + self.d_type = 'dog' class Cat(Animal): _attribute_map = { "name":{"key":"Name", "type":"str"}, "likes_mice":{"key":"likesMice","type":"bool"}, - "dislikes":{"key":"dislikes","type":"Animal"} + "dislikes":{"key":"dislikes","type":"Animal"}, + "d_type":{"key":"dType", "type":"str"} } _subtype_map = { - "dType":{"siamese":"Siamese"} + "d_type":{"siamese":"Siamese"} } - def __init__(self): - self.likes_mice = None - self.dislikes = None - super(Cat, self).__init__() + def __init__(self, name=None, likes_mice=None, dislikes = None): + self.likes_mice = likes_mice + self.dislikes = dislikes + super(Cat, self).__init__(name) + self.d_type = 'cat' class Siamese(Cat): @@ -614,12 +619,14 @@ class TestRuntimeSerialized(unittest.TestCase): "name":{"key":"Name", "type":"str"}, "likes_mice":{"key":"likesMice","type":"bool"}, "dislikes":{"key":"dislikes","type":"Animal"}, - "color":{"key":"Color", "type":"str"} + "color":{"key":"Color", "type":"str"}, + "d_type":{"key":"dType", "type":"str"} } - def __init__(self): - self.color = None - super(Siamese, self).__init__() + def __init__(self, name=None, likes_mice=None, dislikes = None, color=None): + self.color = color + super(Siamese, self).__init__(name, likes_mice, dislikes) + self.d_type = 'siamese' message = { "Animals": [ @@ -669,6 +676,40 @@ class TestRuntimeSerialized(unittest.TestCase): serialized = self.s._serialize(zoo) self.assertEqual(serialized, message) + old_dependencies = self.s.dependencies + self.s.dependencies = { + 'Zoo': Zoo, + 'Animal': Animal, + 'Dog': Dog, + 'Cat': Cat, + 'Siamese': Siamese + } + + serialized = self.s.body({ + "animals": [{ + "dType": "dog", + "likes_dog_food": True, + "name": "Fido" + },{ + "dType": "cat", + "likes_mice": False, + "dislikes": { + "dType": "dog", + "likes_dog_food": True, + "name": "Angry" + }, + "name": "Felix" + },{ + "dType": "siamese", + "color": "grey", + "likes_mice": True, + "name": "Finch" + }] + }, "Zoo") + self.assertEqual(serialized, message) + + self.s.dependencies = old_dependencies + class TestRuntimeDeserialized(unittest.TestCase): @@ -1100,48 +1141,72 @@ class TestRuntimeDeserialized(unittest.TestCase): _attribute_map = { "animals":{"key":"Animals", "type":"[Animal]"}, - } + } + + def __init__(self, animals=None): + self.animals = animals class Animal(Model): _attribute_map = { - "name":{"key":"Name", "type":"str"} - } - - _test_attr = 123 + "name":{"key":"Name", "type":"str"}, + "d_type":{"key":"dType", "type":"str"} + } _subtype_map = { - 'dType': {"cat":"Cat", "dog":"Dog"} - } + 'd_type': {"cat":"Cat", "dog":"Dog"} + } + + def __init__(self, name=None): + self.name = name class Dog(Animal): _attribute_map = { "name":{"key":"Name", "type":"str"}, - "likes_dog_food":{"key":"likesDogFood","type":"bool"} + "likes_dog_food":{"key":"likesDogFood","type":"bool"}, + "d_type":{"key":"dType", "type":"str"} } + def __init__(self, name=None, likes_dog_food=None): + self.likes_dog_food = likes_dog_food + super(Dog, self).__init__(name) + self.d_type = 'dog' + class Cat(Animal): _attribute_map = { "name":{"key":"Name", "type":"str"}, "likes_mice":{"key":"likesMice","type":"bool"}, - "dislikes":{"key":"dislikes","type":"Animal"} + "dislikes":{"key":"dislikes","type":"Animal"}, + "d_type":{"key":"dType", "type":"str"} } _subtype_map = { - "dType":{"siamese":"Siamese"} + "d_type":{"siamese":"Siamese"} } + def __init__(self, name=None, likes_mice=None, dislikes = None): + self.likes_mice = likes_mice + self.dislikes = dislikes + super(Cat, self).__init__(name) + self.d_type = 'cat' + class Siamese(Cat): _attribute_map = { "name":{"key":"Name", "type":"str"}, "likes_mice":{"key":"likesMice","type":"bool"}, "dislikes":{"key":"dislikes","type":"Animal"}, - "color":{"key":"Color", "type":"str"} + "color":{"key":"Color", "type":"str"}, + "d_type":{"key":"dType", "type":"str"} } + def __init__(self, name=None, likes_mice=None, dislikes = None, color=None): + self.color = color + super(Siamese, self).__init__(name, likes_mice, dislikes) + self.d_type = 'siamese' + message = { "Animals": [ { @@ -1188,5 +1253,49 @@ class TestRuntimeDeserialized(unittest.TestCase): self.assertEqual(animals[2].color, message['Animals'][2]["Color"]) self.assertTrue(animals[2].likes_mice) + def test_polymorphic_deserialization_with_escape(self): + + class Animal(Model): + + _attribute_map = { + "name":{"key":"Name", "type":"str"}, + "d_type":{"key":"odata\\.type", "type":"str"} + } + + _subtype_map = { + 'd_type': {"dog":"Dog"} + } + + def __init__(self, name=None): + self.name = name + + class Dog(Animal): + + _attribute_map = { + "name":{"key":"Name", "type":"str"}, + "likes_dog_food":{"key":"likesDogFood","type":"bool"}, + "d_type":{"key":"odata\\.type", "type":"str"} + } + + def __init__(self, name=None, likes_dog_food=None): + self.likes_dog_food = likes_dog_food + super(Dog, self).__init__(name) + self.d_type = 'dog' + + message = { + "odata.type": "dog", + "likesDogFood": True, + "Name": "Fido" + } + + self.d.dependencies = { + 'Animal':Animal, 'Dog':Dog} + + animal = self.d('Animal', message) + + self.assertIsInstance(animal, Dog) + self.assertTrue(animal.likes_dog_food) + + if __name__ == '__main__': unittest.main()
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 3, "issue_text_score": 2, "test_score": 0 }, "num_modified_files": 1 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "coverage", "flake8" ], "pre_install": null, "python": "3.5", "reqs_path": [ "dev_requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 chardet==5.0.0 charset-normalizer==2.0.12 coverage==6.2 flake8==5.0.4 httpretty==1.1.4 idna==3.10 importlib-metadata==4.2.0 iniconfig==1.1.1 isodate==0.6.1 mccabe==0.7.0 -e git+https://github.com/Azure/msrest-for-python.git@cef4818746df436465cfc810723f79aa3a72da89#egg=msrest oauthlib==3.2.2 packaging==21.3 pluggy==1.0.0 py==1.11.0 pycodestyle==2.9.1 pyflakes==2.5.0 pyparsing==3.1.4 pytest==7.0.1 requests==2.27.1 requests-oauthlib==2.0.0 six==1.17.0 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 zipp==3.6.0
name: msrest-for-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - chardet==5.0.0 - charset-normalizer==2.0.12 - coverage==6.2 - flake8==5.0.4 - httpretty==1.1.4 - idna==3.10 - importlib-metadata==4.2.0 - iniconfig==1.1.1 - isodate==0.6.1 - mccabe==0.7.0 - oauthlib==3.2.2 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pycodestyle==2.9.1 - pyflakes==2.5.0 - pyparsing==3.1.4 - pytest==7.0.1 - requests==2.27.1 - requests-oauthlib==2.0.0 - six==1.17.0 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/msrest-for-python
[ "test/unittest_serialization.py::TestRuntimeSerialized::test_polymorphic_serialization", "test/unittest_serialization.py::TestRuntimeDeserialized::test_polymorphic_deserialization", "test/unittest_serialization.py::TestRuntimeDeserialized::test_polymorphic_deserialization_with_escape" ]
[]
[ "test/unittest_serialization.py::TestModelDeserialization::test_response", "test/unittest_serialization.py::TestRuntimeSerialized::test_attr_bool", "test/unittest_serialization.py::TestRuntimeSerialized::test_attr_dict_simple", "test/unittest_serialization.py::TestRuntimeSerialized::test_attr_int", "test/unittest_serialization.py::TestRuntimeSerialized::test_attr_list_complex", "test/unittest_serialization.py::TestRuntimeSerialized::test_attr_list_simple", "test/unittest_serialization.py::TestRuntimeSerialized::test_attr_none", "test/unittest_serialization.py::TestRuntimeSerialized::test_attr_sequence", "test/unittest_serialization.py::TestRuntimeSerialized::test_attr_str", "test/unittest_serialization.py::TestRuntimeSerialized::test_empty_list", "test/unittest_serialization.py::TestRuntimeSerialized::test_obj_serialize_none", "test/unittest_serialization.py::TestRuntimeSerialized::test_obj_with_malformed_map", "test/unittest_serialization.py::TestRuntimeSerialized::test_obj_with_mismatched_map", "test/unittest_serialization.py::TestRuntimeSerialized::test_obj_without_attr_map", "test/unittest_serialization.py::TestRuntimeSerialized::test_serialize_datetime", "test/unittest_serialization.py::TestRuntimeSerialized::test_serialize_empty_iter", "test/unittest_serialization.py::TestRuntimeSerialized::test_serialize_json_obj", "test/unittest_serialization.py::TestRuntimeSerialized::test_serialize_object", "test/unittest_serialization.py::TestRuntimeSerialized::test_serialize_primitive_types", "test/unittest_serialization.py::TestRuntimeDeserialized::test_attr_bool", "test/unittest_serialization.py::TestRuntimeDeserialized::test_attr_int", "test/unittest_serialization.py::TestRuntimeDeserialized::test_attr_list_complex", "test/unittest_serialization.py::TestRuntimeDeserialized::test_attr_list_in_list", "test/unittest_serialization.py::TestRuntimeDeserialized::test_attr_list_simple", "test/unittest_serialization.py::TestRuntimeDeserialized::test_attr_none", "test/unittest_serialization.py::TestRuntimeDeserialized::test_attr_str", "test/unittest_serialization.py::TestRuntimeDeserialized::test_deserialize_datetime", "test/unittest_serialization.py::TestRuntimeDeserialized::test_deserialize_object", "test/unittest_serialization.py::TestRuntimeDeserialized::test_non_obj_deserialization", "test/unittest_serialization.py::TestRuntimeDeserialized::test_obj_with_malformed_map", "test/unittest_serialization.py::TestRuntimeDeserialized::test_obj_with_no_attr" ]
[]
MIT License
997
[ "msrest/serialization.py" ]
[ "msrest/serialization.py" ]
opsdroid__opsdroid-80
7673919fc9ea93eaf475c9258388894fdbd27955
2017-01-31 10:17:46
2cf677095e86f755a8366f285865debc389fc894
diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 0467be2..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,5 +0,0 @@ -include README.md -include LICENSE -graft opsdroid -include opsdroid/configuration/example_configuration.yaml -recursive-exclude * *.py[co] diff --git a/docs/configuration-reference.md b/docs/configuration-reference.md index 130a125..65bcd2b 100644 --- a/docs/configuration-reference.md +++ b/docs/configuration-reference.md @@ -23,11 +23,11 @@ _Config options of the connectors themselves differ between connectors, see the ```yaml connectors: - slack: + - name: slack token: "mysecretslacktoken" # conceptual connector - twitter: + - name: twitter oauth_key: "myoauthkey" secret_key: "myoauthsecret" ``` @@ -44,7 +44,7 @@ _Config options of the databases themselves differ between databases, see the da ```yaml databases: - mongo: + - name: mongo host: "mymongohost.mycompany.com" port: "27017" database: "opsdroid" @@ -62,11 +62,11 @@ All python logging levels are available in opsdroid. `logging` can be set to `de logging: debug connectors: - shell: + - name: shell skills: - hello: - seen: + - name: hello + - name: seen ``` ### `module-path` @@ -77,11 +77,11 @@ Set the path for opsdroid to use when installing skills. Defaults to the current module-path: "/etc/opsdroid/modules" connectors: - shell: + - name: shell skills: - hello: - seen: + - name: hello + - name: seen ``` ### `skills` @@ -92,8 +92,8 @@ _Config options of the skills themselves differ between skills, see the skill do ```yaml skills: - hello: - seen: + - name: hello + - name: seen ``` See [module options](#module-options) for installing custom skills. @@ -110,9 +110,9 @@ A git url to install the module from. ```yaml connectors: - slack: + - name: slack token: "mysecretslacktoken" - mynewconnector: + - name: mynewconnector repo: https://github.com/username/myconnector.git ``` @@ -122,7 +122,7 @@ A local path to install the module from. ```yaml skills: - myawesomeskill: + - name: myawesomeskill path: /home/me/src/opsdroid-skills/myawesomeskill ``` @@ -130,7 +130,7 @@ Or you can specify a single file. ```yaml skills: - myawesomeskill: + - name: myawesomeskill path: /home/me/src/opsdroid-skills/myawesomeskill/myskill.py ``` @@ -140,7 +140,7 @@ Set this to do a fresh git clone of the module whenever you start opsdroid. ```yaml databases: - mongodb: + - name: mongodb repo: https://github.com/username/mymongofork.git no-cache: true ``` diff --git a/docs/getting-started.md b/docs/getting-started.md index 89b891f..f9b2692 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -30,10 +30,10 @@ For example a simple barebones configuration would look like: ```yaml connectors: - shell: + - name: shell skills: - hello: + - name: hello ``` This tells opsdroid to use the [shell connector](https://github.com/opsdroid/connector-shell) and [hello skill](https://github.com/opsdroid/skill-hello) from the official module library. @@ -46,19 +46,19 @@ A more advanced config would like similar to the following: ```yaml connectors: - slack: + - name: slack token: "mysecretslacktoken" databases: - mongo: + - name: mongo host: "mymongohost.mycompany.com" port: "27017" database: "opsdroid" skills: - hello: - seen: - myawesomeskill: + - name: hello + - name: seen + - name: myawesomeskill repo: "https://github.com/username/myawesomeskill.git" ``` diff --git a/docs/parsers/api.ai.md b/docs/parsers/api.ai.md index ef147dc..71d0856 100644 --- a/docs/parsers/api.ai.md +++ b/docs/parsers/api.ai.md @@ -39,7 +39,7 @@ You can also set a `min-score` option to tell opsdroid to ignore any matches whi ```yaml parsers: - apiai: + - name: apiai access-token: "exampleaccesstoken123" min-score: 0.6 ``` diff --git a/opsdroid/configuration/example_configuration.yaml b/opsdroid/configuration/example_configuration.yaml index dd5a231..92a7c29 100644 --- a/opsdroid/configuration/example_configuration.yaml +++ b/opsdroid/configuration/example_configuration.yaml @@ -1,42 +1,54 @@ -# _ _ _ -# ___ _ __ ___ __| |_ __ ___ (_) __| | -# / _ \| '_ \/ __|/ _` | '__/ _ \| |/ _` | -# | (_) | |_) \__ \ (_| | | | (_) | | (_| | -# \___/| .__/|___/\__,_|_| \___/|_|\__,_| -# |_| -# __ _ -# ___ ___ _ __ / _(_) __ _ -# / __/ _ \| '_ \| |_| |/ _` | -# | (_| (_) | | | | _| | (_| | -# \___\___/|_| |_|_| |_|\__, | -# |___/ -# -# A default config file to use with opsdroid - -# Set the logging level +## _ _ _ +## ___ _ __ ___ __| |_ __ ___ (_) __| | +## / _ \| '_ \/ __|/ _` | '__/ _ \| |/ _` | +## | (_) | |_) \__ \ (_| | | | (_) | | (_| | +## \___/| .__/|___/\__,_|_| \___/|_|\__,_| +## |_| +## __ _ +## ___ ___ _ __ / _(_) __ _ +## / __/ _ \| '_ \| |_| |/ _` | +## | (_| (_) | | | | _| | (_| | +## \___\___/|_| |_|_| |_|\__, | +## |___/ +## +## A default config file to use with opsdroid + +## Set the logging level # logging: info -# Set the location for opsdroid to install modules +## Set the location for opsdroid to install modules # module-path: "." -# Connector modules +## Parsers +# parsers: +# - name: regex +# enabled: true +# +# - name: crontab +# enabled: true +# +# - name: apiai +# access-token: "youraccesstoken" +# min-score: 0.6 + +## Connector modules connectors: - shell: + - name: shell -# Database modules (optional) +## Database modules (optional) # databases: -# Skill modules +## Skill modules skills: - # Hello world (https://github.com/opsdroid/skill-hello) - hello: + ## Hello world (https://github.com/opsdroid/skill-hello) + - name: hello - # Last seen (https://github.com/opsdroid/skill-seen) - seen: + ## Last seen (https://github.com/opsdroid/skill-seen) + - name: seen - # Dance (https://github.com/opsdroid/skill-dance) - dance: + ## Dance (https://github.com/opsdroid/skill-dance) + - name: dance - # Loud noises (https://github.com/opsdroid/skill-loudnoises) - loudnoises: + ## Loud noises (https://github.com/opsdroid/skill-loudnoises) + - name: loudnoises diff --git a/opsdroid/const.py b/opsdroid/const.py index 688c79d..77f5b2c 100644 --- a/opsdroid/const.py +++ b/opsdroid/const.py @@ -1,6 +1,6 @@ """Constants used by OpsDroid.""" -__version__ = "0.5.1" +__version__ = "0.5.0" LOG_FILENAME = 'output.log' DEFAULT_GIT_URL = "https://github.com/opsdroid/" diff --git a/opsdroid/core.py b/opsdroid/core.py index 4308eb9..772073d 100644 --- a/opsdroid/core.py +++ b/opsdroid/core.py @@ -150,7 +150,17 @@ class OpsDroid(): tasks.append( self.eventloop.create_task(parse_regex(self, message))) - if "parsers" in self.config and "apiai" in self.config["parsers"]: - tasks.append( - self.eventloop.create_task(parse_apiai(self, message))) + if "parsers" in self.config: + logging.debug("Processing parsers") + parsers = self.config["parsers"] + + apiai = [p for p in parsers if p["name"] == "apiai"] + logging.debug("Checking apiai") + if len(apiai) == 1 and \ + ("enabled" not in apiai[0] or + apiai[0]["enabled"] is not False): + logging.debug("Parsing with apiai") + tasks.append( + self.eventloop.create_task( + parse_apiai(self, message, apiai[0]))) return tasks diff --git a/opsdroid/loader.py b/opsdroid/loader.py index 7965637..7d2158b 100644 --- a/opsdroid/loader.py +++ b/opsdroid/loader.py @@ -18,6 +18,7 @@ class Loader: """Setup object with opsdroid instance.""" self.opsdroid = opsdroid self.modules_directory = MODULES_DIRECTORY + self.current_import_config = None logging.debug("Loaded loader") @staticmethod @@ -154,12 +155,12 @@ class Loader: if not os.path.isdir(self.modules_directory): os.makedirs(self.modules_directory) - for module_name in modules.keys(): + for module in modules: # Set up module config - config = modules[module_name] + config = module config = {} if config is None else config - config["name"] = module_name + config["name"] = module["name"] config["type"] = modules_type config["module_path"] = self.build_module_path("import", config) config["install_path"] = self.build_module_path("install", config) @@ -173,6 +174,7 @@ class Loader: self._install_module(config) # Import module + self.current_import_config = config module = self.import_module(config) if module is not None: loaded_modules.append({ diff --git a/opsdroid/parsers/apiai.py b/opsdroid/parsers/apiai.py index 8cea8dd..cd6798b 100644 --- a/opsdroid/parsers/apiai.py +++ b/opsdroid/parsers/apiai.py @@ -28,13 +28,12 @@ async def call_apiai(message, config): return result -async def parse_apiai(opsdroid, message): +async def parse_apiai(opsdroid, message, config): """Parse a message against all apiai skills.""" # pylint: disable=broad-except # We want to catch all exceptions coming from a skill module and not # halt the application. If a skill throws an exception it just doesn't # give a response to the user, so an error response should be given. - config = opsdroid.config['parsers']['apiai'] if 'access-token' in config: result = await call_apiai(message, config) @@ -62,7 +61,8 @@ async def parse_apiai(opsdroid, message): result["result"]["intentName"]): message.apiai = result try: - await skill["skill"](opsdroid, message) + await skill["skill"](opsdroid, skill["config"], + message) except Exception: await message.respond( "Whoops there has been an error") diff --git a/opsdroid/parsers/crontab.py b/opsdroid/parsers/crontab.py index 49f9281..c7083d1 100644 --- a/opsdroid/parsers/crontab.py +++ b/opsdroid/parsers/crontab.py @@ -19,6 +19,6 @@ async def parse_crontab(opsdroid): for skill in opsdroid.skills: if "crontab" in skill and pycron.is_now(skill["crontab"]): try: - await skill["skill"](opsdroid, None) + await skill["skill"](opsdroid, skill["config"], None) except Exception: logging.exception("Exception when executing cron skill.") diff --git a/opsdroid/parsers/regex.py b/opsdroid/parsers/regex.py index a8500c0..bcefa2d 100644 --- a/opsdroid/parsers/regex.py +++ b/opsdroid/parsers/regex.py @@ -16,7 +16,7 @@ async def parse_regex(opsdroid, message): if regex: message.regex = regex try: - await skill["skill"](opsdroid, message) + await skill["skill"](opsdroid, skill["config"], message) except Exception: await message.respond( "Whoops there has been an error") diff --git a/opsdroid/skills.py b/opsdroid/skills.py index 5b4b7f3..7938a53 100644 --- a/opsdroid/skills.py +++ b/opsdroid/skills.py @@ -8,7 +8,9 @@ def match_regex(regex): def matcher(func): """Add decorated function to skills list for regex matching.""" for opsdroid in OpsDroid.instances: - opsdroid.skills.append({"regex": regex, "skill": func}) + opsdroid.skills.append({"regex": regex, "skill": func, + "config": + opsdroid.loader.current_import_config}) return func return matcher @@ -18,7 +20,9 @@ def match_apiai_action(action): def matcher(func): """Add decorated function to skills list for apiai matching.""" for opsdroid in OpsDroid.instances: - opsdroid.skills.append({"apiai_action": action, "skill": func}) + opsdroid.skills.append({"apiai_action": action, "skill": func, + "config": + opsdroid.loader.current_import_config}) return func return matcher @@ -28,7 +32,9 @@ def match_apiai_intent(intent): def matcher(func): """Add decorated function to skills list for apiai matching.""" for opsdroid in OpsDroid.instances: - opsdroid.skills.append({"apiai_intent": intent, "skill": func}) + opsdroid.skills.append({"apiai_intent": intent, "skill": func, + "config": + opsdroid.loader.current_import_config}) return func return matcher @@ -38,6 +44,8 @@ def match_crontab(crontab): def matcher(func): """Add decorated function to skills list for crontab matching.""" for opsdroid in OpsDroid.instances: - opsdroid.skills.append({"crontab": crontab, "skill": func}) + opsdroid.skills.append({"crontab": crontab, "skill": func, + "config": + opsdroid.loader.current_import_config}) return func return matcher diff --git a/setup.py b/setup.py index 93c131f..e341c5a 100644 --- a/setup.py +++ b/setup.py @@ -11,8 +11,6 @@ PACKAGES = find_packages(exclude=['tests', 'tests.*', 'modules', REQUIRES = [ 'pyyaml>=3.11,<4', - 'aiohttp>=1.2.0,<2', - 'pycron>=0.40', ] setup(
Change module configuration layout As suggested by @tpowellmeto `connectors`/`databases`/`skills` are all lists of modules. Therefore they should probably be a list in the configuration rather than a dictionary. This makes empty module configurations easier to read as they are not empty key/value pairs. Before ```yaml skills: hello: additionalconfigitem: "value" seen: dance: loudnoises: ``` After ```yaml skills: - name: hello additionalconfigitem: "value" - name: seen - name: dance - name: loudnoises ```
opsdroid/opsdroid
diff --git a/tests/test_core.py b/tests/test_core.py index b022f1b..0deff87 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -8,7 +8,7 @@ import importlib from opsdroid.core import OpsDroid from opsdroid.message import Message from opsdroid.connector import Connector -from opsdroid.skills import match_regex +from opsdroid.skills import match_regex, match_apiai_action class TestCore(unittest.TestCase): @@ -124,7 +124,7 @@ class TestCore(unittest.TestCase): class TestCoreAsync(asynctest.TestCase): """Test the async methods of the opsdroid core class.""" - async def test_parse(self): + async def test_parse_regex(self): with OpsDroid() as opsdroid: regex = r".*" skill = amock.CoroutineMock() @@ -136,3 +136,18 @@ class TestCoreAsync(asynctest.TestCase): for task in tasks: await task self.assertTrue(skill.called) + + async def test_parse_apiai(self): + with OpsDroid() as opsdroid: + opsdroid.config["parsers"] = [{"name": "apiai"}] + apiai_action = "" + skill = amock.CoroutineMock() + mock_connector = Connector({}) + decorator = match_apiai_action(apiai_action) + decorator(skill) + message = Message("Hello world", "user", "default", mock_connector) + with amock.patch('opsdroid.parsers.apiai.parse_apiai'): + tasks = await opsdroid.parse(message) + self.assertEqual(len(tasks), 2) # apiai and regex + for task in tasks: + await task diff --git a/tests/test_loader.py b/tests/test_loader.py index f1bb702..f88088e 100644 --- a/tests/test_loader.py +++ b/tests/test_loader.py @@ -76,6 +76,7 @@ class TestLoader(unittest.TestCase): open(config['install_path'] + ".py", 'w') ld.Loader.check_cache(config) self.assertFalse(os.path.isfile(config["install_path"] + ".py")) + shutil.rmtree(directory) def test_check_cache_leaves(self): config = {} @@ -139,7 +140,7 @@ class TestLoader(unittest.TestCase): opsdroid, loader = self.setup() modules_type = "test" - modules = {"testmodule": None} + modules = [{"name": "testmodule"}] mockedmodule = mock.Mock(return_value={"name": "testmodule"}) with mock.patch.object(loader, '_install_module') as mockinstall, \ @@ -170,6 +171,7 @@ class TestLoader(unittest.TestCase): logmock.assert_called_with( 'Module ' + config["name"] + ' already installed, skipping') + shutil.rmtree(config["install_path"]) def test_install_missing_local_module(self): opsdroid, loader = self.setup() @@ -199,12 +201,13 @@ class TestLoader(unittest.TestCase): def test_install_specific_local_git_module(self): opsdroid, loader = self.setup() + repo_path = "/tmp/testrepo" config = {"name": "testmodule", - "install_path": "/tmp/testrepo", + "install_path": repo_path, "repo": "https://github.com/rmccue/test-repository.git", "branch": "master"} loader._install_module(config) # Clone remote repo for testing with - config["repo"] = config["install_path"] + config["repo"] = config["install_path"] + "/.git" config["install_path"] = "/tmp/test_specific_local_module" with mock.patch('logging.debug'), \ mock.patch.object(loader, 'git_clone') as mockclone: @@ -212,11 +215,13 @@ class TestLoader(unittest.TestCase): mockclone.assert_called_with(config["repo"], config["install_path"], config["branch"]) + shutil.rmtree(repo_path) def test_install_specific_local_path_module(self): opsdroid, loader = self.setup() + repo_path = "/tmp/testrepo" config = {"name": "testmodule", - "install_path": "/tmp/testrepo", + "install_path": repo_path, "repo": "https://github.com/rmccue/test-repository.git", "branch": "master"} loader._install_module(config) # Clone remote repo for testing with @@ -227,6 +232,7 @@ class TestLoader(unittest.TestCase): as mockclone: loader._install_module(config) mockclone.assert_called_with(config) + shutil.rmtree(repo_path) def test_install_default_remote_module(self): opsdroid, loader = self.setup() @@ -243,21 +249,25 @@ class TestLoader(unittest.TestCase): mockdeps.assert_called_with( config["install_path"] + "/requirements.txt") + shutil.rmtree(config["install_path"]) + def test_install_local_module_dir(self): opsdroid, loader = self.setup() + base_path = "/tmp/long" config = {"name": "slack", "type": "connector", - "install_path": "/tmp/long/test/path/test", + "install_path": base_path + "/test/path/test", "path": "/tmp/install/from/here"} os.makedirs(config["path"], exist_ok=True) loader._install_local_module(config) self.assertTrue(os.path.isdir(config["install_path"])) + shutil.rmtree(base_path) def test_install_local_module_file(self): opsdroid, loader = self.setup() config = {"name": "slack", "type": "connector", - "install_path": "/tmp/test/test", + "install_path": "/tmp/test_local_module_file", "path": "/tmp/install/from/here.py"} directory, _ = os.path.split(config["path"]) os.makedirs(directory, exist_ok=True) @@ -265,12 +275,13 @@ class TestLoader(unittest.TestCase): loader._install_local_module(config) self.assertTrue(os.path.isfile( config["install_path"] + "/__init__.py")) + shutil.rmtree(config["install_path"]) def test_install_local_module_failure(self): opsdroid, loader = self.setup() config = {"name": "slack", "type": "connector", - "install_path": "/tmp/test/test", + "install_path": "/tmp/test_local_module_failure", "path": "/tmp/does/not/exist"} with mock.patch('logging.error') as logmock: loader._install_local_module(config) diff --git a/tests/test_parser_apiai.py b/tests/test_parser_apiai.py index 268e326..7537e1f 100644 --- a/tests/test_parser_apiai.py +++ b/tests/test_parser_apiai.py @@ -17,7 +17,7 @@ class TestParserApiai(asynctest.TestCase): async def test_call_apiai(self): mock_connector = Connector({}) message = Message("Hello world", "user", "default", mock_connector) - config = {'access-token': 'test'} + config = {'name': 'apiai', 'access-token': 'test'} result = amock.Mock() result.json = amock.CoroutineMock() result.json.return_value = { @@ -38,9 +38,9 @@ class TestParserApiai(asynctest.TestCase): async def test_parse_apiai(self): with OpsDroid() as opsdroid: - opsdroid.config['parsers'] = { - 'apiai': {'access-token': "test"} - } + opsdroid.config['parsers'] = [ + {'name': 'apiai', 'access-token': "test"} + ] mock_skill = amock.CoroutineMock() match_apiai_action('myaction')(mock_skill) @@ -58,15 +58,16 @@ class TestParserApiai(asynctest.TestCase): "errorType": "success" } } - await apiai.parse_apiai(opsdroid, message) + await apiai.parse_apiai(opsdroid, message, + opsdroid.config['parsers'][0]) self.assertTrue(mock_skill.called) async def test_parse_apiai_raises(self): with OpsDroid() as opsdroid: - opsdroid.config['parsers'] = { - 'apiai': {'access-token': "test"} - } + opsdroid.config['parsers'] = [ + {'name': 'apiai', 'access-token': "test"} + ] mock_skill = amock.CoroutineMock() mock_skill.side_effect = Exception() match_apiai_action('myaction')(mock_skill) @@ -85,15 +86,16 @@ class TestParserApiai(asynctest.TestCase): "errorType": "success" } } - await apiai.parse_apiai(opsdroid, message) + await apiai.parse_apiai(opsdroid, message, + opsdroid.config['parsers'][0]) self.assertTrue(mock_skill.called) async def test_parse_apiai_failure(self): with OpsDroid() as opsdroid: - opsdroid.config['parsers'] = { - 'apiai': {'access-token': "test"} - } + opsdroid.config['parsers'] = [ + {'name': 'apiai', 'access-token': "test"} + ] mock_skill = amock.CoroutineMock() match_apiai_action('myaction')(mock_skill) @@ -111,15 +113,16 @@ class TestParserApiai(asynctest.TestCase): "errorType": "not found" } } - await apiai.parse_apiai(opsdroid, message) + await apiai.parse_apiai(opsdroid, message, + opsdroid.config['parsers'][0]) self.assertFalse(mock_skill.called) async def test_parse_apiai_low_score(self): with OpsDroid() as opsdroid: - opsdroid.config['parsers'] = { - 'apiai': {'access-token': "test", "min-score": 0.8} - } + opsdroid.config['parsers'] = [ + {'name': 'apiai', 'access-token': "test", "min-score": 0.8} + ] mock_skill = amock.CoroutineMock() match_apiai_action('myaction')(mock_skill) @@ -137,6 +140,7 @@ class TestParserApiai(asynctest.TestCase): "errorType": "success" } } - await apiai.parse_apiai(opsdroid, message) + await apiai.parse_apiai(opsdroid, message, + opsdroid.config['parsers'][0]) self.assertFalse(mock_skill.called)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_removed_files", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 0, "test_score": 1 }, "num_modified_files": 12 }
0.5
{ "env_vars": null, "env_yml_path": null, "install": "pip3 install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov" ], "pre_install": [ "apt-get update", "apt-get install -y git" ], "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
aiohttp==1.3.5 aiosignal==1.2.0 async-timeout==4.0.2 asynctest==0.13.0 attrs==22.2.0 certifi==2021.5.30 chardet==5.0.0 charset-normalizer==3.0.1 coverage==6.2 frozenlist==1.2.0 idna==3.10 idna-ssl==1.1.0 importlib-metadata==4.8.3 iniconfig==1.1.1 multidict==5.2.0 -e git+https://github.com/opsdroid/opsdroid.git@7673919fc9ea93eaf475c9258388894fdbd27955#egg=opsdroid packaging==21.3 pluggy==1.0.0 py==1.11.0 pycron==3.0.0 pyparsing==3.1.4 pytest==7.0.1 pytest-cov==4.0.0 PyYAML==3.13 tomli==1.2.3 typing_extensions==4.1.1 yarl==0.9.8 zipp==3.6.0
name: opsdroid channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - aiohttp==1.3.5 - aiosignal==1.2.0 - async-timeout==4.0.2 - asynctest==0.13.0 - attrs==22.2.0 - chardet==5.0.0 - charset-normalizer==3.0.1 - coverage==6.2 - frozenlist==1.2.0 - idna==3.10 - idna-ssl==1.1.0 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - multidict==5.2.0 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pycron==3.0.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-cov==4.0.0 - pyyaml==3.13 - tomli==1.2.3 - typing-extensions==4.1.1 - yarl==0.9.8 - zipp==3.6.0 prefix: /opt/conda/envs/opsdroid
[ "tests/test_core.py::TestCoreAsync::test_parse_apiai", "tests/test_loader.py::TestLoader::test_load_modules", "tests/test_parser_apiai.py::TestParserApiai::test_parse_apiai", "tests/test_parser_apiai.py::TestParserApiai::test_parse_apiai_failure", "tests/test_parser_apiai.py::TestParserApiai::test_parse_apiai_low_score" ]
[ "tests/test_loader.py::TestLoader::test_load_non_existant_config_file", "tests/test_parser_apiai.py::TestParserApiai::test_parse_apiai_raises" ]
[ "tests/test_core.py::TestCore::test_core", "tests/test_core.py::TestCore::test_critical", "tests/test_core.py::TestCore::test_default_connector", "tests/test_core.py::TestCore::test_default_room", "tests/test_core.py::TestCore::test_exit", "tests/test_core.py::TestCore::test_load_config", "tests/test_core.py::TestCore::test_load_regex_skill", "tests/test_core.py::TestCore::test_multiple_opsdroids", "tests/test_core.py::TestCore::test_setup_modules", "tests/test_core.py::TestCore::test_start_connectors", "tests/test_core.py::TestCore::test_start_databases", "tests/test_core.py::TestCore::test_start_loop", "tests/test_core.py::TestCoreAsync::test_parse_regex", "tests/test_loader.py::TestLoader::test_build_module_path", "tests/test_loader.py::TestLoader::test_check_cache_leaves", "tests/test_loader.py::TestLoader::test_check_cache_removes_dir", "tests/test_loader.py::TestLoader::test_check_cache_removes_file", "tests/test_loader.py::TestLoader::test_git_clone", "tests/test_loader.py::TestLoader::test_import_module", "tests/test_loader.py::TestLoader::test_import_module_failure", "tests/test_loader.py::TestLoader::test_import_module_new", "tests/test_loader.py::TestLoader::test_install_default_remote_module", "tests/test_loader.py::TestLoader::test_install_existing_module", "tests/test_loader.py::TestLoader::test_install_local_module_dir", "tests/test_loader.py::TestLoader::test_install_local_module_failure", "tests/test_loader.py::TestLoader::test_install_local_module_file", "tests/test_loader.py::TestLoader::test_install_missing_local_module", "tests/test_loader.py::TestLoader::test_install_specific_local_git_module", "tests/test_loader.py::TestLoader::test_install_specific_local_path_module", "tests/test_loader.py::TestLoader::test_install_specific_remote_module", "tests/test_loader.py::TestLoader::test_load_broken_config_file", "tests/test_loader.py::TestLoader::test_load_config", "tests/test_loader.py::TestLoader::test_load_config_file", "tests/test_loader.py::TestLoader::test_load_empty_config", "tests/test_loader.py::TestLoader::test_pip_install_deps", "tests/test_parser_apiai.py::TestParserApiai::test_call_apiai" ]
[]
Apache License 2.0
998
[ "opsdroid/parsers/regex.py", "opsdroid/skills.py", "MANIFEST.in", "setup.py", "opsdroid/parsers/crontab.py", "opsdroid/const.py", "opsdroid/parsers/apiai.py", "opsdroid/configuration/example_configuration.yaml", "opsdroid/core.py", "docs/parsers/api.ai.md", "docs/getting-started.md", "docs/configuration-reference.md", "opsdroid/loader.py" ]
[ "opsdroid/parsers/regex.py", "opsdroid/skills.py", "MANIFEST.in", "setup.py", "opsdroid/parsers/crontab.py", "opsdroid/const.py", "opsdroid/parsers/apiai.py", "opsdroid/configuration/example_configuration.yaml", "opsdroid/core.py", "docs/parsers/api.ai.md", "docs/getting-started.md", "docs/configuration-reference.md", "opsdroid/loader.py" ]
jboss-dockerfiles__dogen-72
fca08f2027ef422c447cfd0f0def681b88a31890
2017-01-31 12:13:08
bc9263c5b683fdf901ac1646286ee3908b85dcdc
diff --git a/Dockerfile b/Dockerfile index c43d93e..c6d23f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.3 +FROM alpine:3.5 RUN apk add --update sudo bash py-setuptools git && rm -rf /var/cache/apk/* ENV DOGEN_VERSION master diff --git a/dogen/generator.py b/dogen/generator.py index 7205db8..7e10cc5 100644 --- a/dogen/generator.py +++ b/dogen/generator.py @@ -48,12 +48,12 @@ class Generator(object): self.ssl_verify to False. """ - self.log.debug("Fetching '%s' file..." % location) + self.log.info("Fetching '%s' file..." % location) if not output: output = tempfile.mktemp("-dogen") - self.log.debug("Fetched file will be saved as '%s'..." % output) + self.log.info("Fetched file will be saved as '%s'..." % os.path.basename(output)) with open(output, 'wb') as f: f.write(requests.get(location, verify=self.ssl_verify).content) @@ -289,7 +289,14 @@ class Generator(object): for source in self.cfg['sources']: url = source['url'] + target = source.get('target') + basename = os.path.basename(url) + + # In case we specify target name for the artifact - use it + if target: + basename = target + files.append(basename) filename = ("%s/%s" % (self.output, basename)) passed = False @@ -297,7 +304,8 @@ class Generator(object): if os.path.exists(filename): self.check_sum(filename, source['md5sum']) passed = True - except: + except Exception as e: + self.log.warn(str(e)) passed = False if not passed: @@ -306,9 +314,7 @@ class Generator(object): self.log.info("Using '%s' as cached location for sources" % sources_cache) url = "%s/%s" % (sources_cache, basename) - self.log.info("Downloading '%s'..." % url) - with open(filename, 'wb') as f: - f.write(requests.get(url, verify=self.ssl_verify).content) + self._fetch_file(url, filename) self.check_sum(filename, source['md5sum']) return files diff --git a/dogen/schema/kwalify_schema.yaml b/dogen/schema/kwalify_schema.yaml index 628631b..d308680 100644 --- a/dogen/schema/kwalify_schema.yaml +++ b/dogen/schema/kwalify_schema.yaml @@ -63,6 +63,7 @@ map: - map: url: {type: str} md5sum: {type: str} + target: {type: str} packages: seq: - {type: str}
Make it possible to rename the target artifact
jboss-dockerfiles/dogen
diff --git a/tests/test_unit_generate_configuration.py b/tests/test_unit_generate_configuration.py index adcbafd..bf26c55 100644 --- a/tests/test_unit_generate_configuration.py +++ b/tests/test_unit_generate_configuration.py @@ -262,3 +262,53 @@ class TestConfig(unittest.TestCase): generator.configure() generator._handle_scripts() # success if no stack trace thrown + + @mock.patch('dogen.generator.Generator.check_sum') + @mock.patch('dogen.generator.Generator._fetch_file') + def test_handling_sources(self, mock_fetch_file, mock_check_sum): + with self.descriptor as f: + f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b".encode()) + + generator = Generator(self.log, self.args) + generator.configure() + generator.handle_sources() + + mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/file.zip') + + @mock.patch('dogen.generator.os.path.exists', return_value=True) + @mock.patch('dogen.generator.Generator.check_sum') + @mock.patch('dogen.generator.Generator._fetch_file') + def test_handling_sources_when_local_file_exists_and_is_correct(self, mock_fetch_file, mock_check_sum, mock_path): + with self.descriptor as f: + f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b".encode()) + + generator = Generator(self.log, self.args) + generator.configure() + generator.handle_sources() + + self.assertEqual(mock_fetch_file.call_count, 0) + + @mock.patch('dogen.generator.os.path.exists', return_value=True) + @mock.patch('dogen.generator.Generator.check_sum', side_effect=[Exception("Bleh"), None]) + @mock.patch('dogen.generator.Generator._fetch_file') + def test_handling_sources_when_local_file_exists_and_is_broken(self, mock_fetch_file, mock_check_sum, mock_path): + with self.descriptor as f: + f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b".encode()) + + generator = Generator(self.log, self.args) + generator.configure() + generator.handle_sources() + + mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/file.zip') + + @mock.patch('dogen.generator.Generator.check_sum') + @mock.patch('dogen.generator.Generator._fetch_file') + def test_handling_sources_with_target_filename(self, mock_fetch_file, mock_check_sum): + with self.descriptor as f: + f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode()) + + generator = Generator(self.log, self.args) + generator.configure() + generator.handle_sources() + + mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/target.zip') diff --git a/tests/test_unit_generate_handle_files.py b/tests/test_unit_generate_handle_files.py index 51bd803..749eee1 100644 --- a/tests/test_unit_generate_handle_files.py +++ b/tests/test_unit_generate_handle_files.py @@ -41,8 +41,8 @@ class TestFetchFile(unittest.TestCase): mock_requests.assert_called_with('https://host/file.tmp', verify=None) mock_file().write.assert_called_once_with("file-content") - self.log.debug.assert_any_call("Fetching 'https://host/file.tmp' file...") - self.log.debug.assert_any_call("Fetched file will be saved as 'some-file'...") + self.log.info.assert_any_call("Fetching 'https://host/file.tmp' file...") + self.log.info.assert_any_call("Fetched file will be saved as 'some-file'...") @mock.patch('dogen.generator.tempfile.mktemp', return_value="tmpfile") @@ -56,8 +56,8 @@ class TestFetchFile(unittest.TestCase): mock_requests.assert_called_with('https://host/file.tmp', verify=None) mock_file().write.assert_called_once_with("file-content") - self.log.debug.assert_any_call("Fetching 'https://host/file.tmp' file...") - self.log.debug.assert_any_call("Fetched file will be saved as 'tmpfile'...") + self.log.info.assert_any_call("Fetching 'https://host/file.tmp' file...") + self.log.info.assert_any_call("Fetched file will be saved as 'tmpfile'...") class TestCustomTemplateHandling(unittest.TestCase): def setUp(self):
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 3 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "mock" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
certifi==2025.1.31 charset-normalizer==3.4.1 coverage==7.8.0 docopt==0.6.2 -e git+https://github.com/jboss-dockerfiles/dogen.git@fca08f2027ef422c447cfd0f0def681b88a31890#egg=dogen exceptiongroup==1.2.2 idna==3.10 iniconfig==2.1.0 Jinja2==3.1.6 MarkupSafe==3.0.2 mock==5.2.0 packaging==24.2 pluggy==1.5.0 pykwalify==1.8.0 pytest==8.3.5 pytest-cov==6.0.0 python-dateutil==2.9.0.post0 PyYAML==6.0.2 requests==2.32.3 ruamel.yaml==0.18.10 ruamel.yaml.clib==0.2.12 six==1.17.0 tomli==2.2.1 urllib3==2.3.0
name: dogen channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - certifi==2025.1.31 - charset-normalizer==3.4.1 - coverage==7.8.0 - docopt==0.6.2 - exceptiongroup==1.2.2 - idna==3.10 - iniconfig==2.1.0 - jinja2==3.1.6 - markupsafe==3.0.2 - mock==5.2.0 - packaging==24.2 - pluggy==1.5.0 - pykwalify==1.8.0 - pytest==8.3.5 - pytest-cov==6.0.0 - python-dateutil==2.9.0.post0 - pyyaml==6.0.2 - requests==2.32.3 - ruamel-yaml==0.18.10 - ruamel-yaml-clib==0.2.12 - six==1.17.0 - tomli==2.2.1 - urllib3==2.3.0 prefix: /opt/conda/envs/dogen
[ "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_when_local_file_exists_and_is_broken", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_target_filename", "tests/test_unit_generate_handle_files.py::TestFetchFile::test_fetching_with_filename", "tests/test_unit_generate_handle_files.py::TestFetchFile::test_fetching_with_tmpfile" ]
[]
[ "tests/test_unit_generate_configuration.py::TestConfig::test_custom_additional_scripts_in_cli_should_override_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_additional_scripts_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_exec", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_exec_not_env", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_user_not_default", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_user_not_env", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_scripts_dir_in_cli_should_override_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_scripts_dir_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_template_in_cli_should_override_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_template_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_default_script_exec", "tests/test_unit_generate_configuration.py::TestConfig::test_default_script_user", "tests/test_unit_generate_configuration.py::TestConfig::test_default_values", "tests/test_unit_generate_configuration.py::TestConfig::test_do_not_skip_ssl_verification_in_cli_false_should_override_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_do_not_skip_ssl_verification_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_env_provided_script_user", "tests/test_unit_generate_configuration.py::TestConfig::test_env_supplied_script_exec", "tests/test_unit_generate_configuration.py::TestConfig::test_fail_if_version_mismatch", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_when_local_file_exists_and_is_correct", "tests/test_unit_generate_configuration.py::TestConfig::test_no_scripts_defined", "tests/test_unit_generate_configuration.py::TestConfig::test_scripts_dir_found_by_convention", "tests/test_unit_generate_configuration.py::TestConfig::test_skip_ssl_verification_in_descriptor", "tests/test_unit_generate_handle_files.py::TestURL::test_local_file", "tests/test_unit_generate_handle_files.py::TestURL::test_remote_http_file", "tests/test_unit_generate_handle_files.py::TestURL::test_remote_https_file", "tests/test_unit_generate_handle_files.py::TestCustomTemplateHandling::test_do_not_fail_if_no_template_is_provided", "tests/test_unit_generate_handle_files.py::TestCustomTemplateHandling::test_fetch_template_success", "tests/test_unit_generate_handle_files.py::TestCustomTemplateHandling::test_fetch_template_with_error" ]
[]
MIT License
999
[ "dogen/schema/kwalify_schema.yaml", "Dockerfile", "dogen/generator.py" ]
[ "dogen/schema/kwalify_schema.yaml", "Dockerfile", "dogen/generator.py" ]
conjure-up__conjure-up-642
5bb8d5a83bbb3ea381d627fa277495b1abb0fbce
2017-01-31 13:35:05
33cca823b51a4f745145a7f5ecf0ceb0852f5bcf
diff --git a/conjureup/app.py b/conjureup/app.py index 2183f65..eab3469 100644 --- a/conjureup/app.py +++ b/conjureup/app.py @@ -317,6 +317,16 @@ def main(): _start() else: + if EventLoop.rows() < 43 or EventLoop.columns() < 132: + print("") + utils.warning( + "conjure-up is best viewed with a terminal geometry of " + "at least 132x43. Please increase the size of your terminal " + "before starting conjure-up.") + print("") + acknowledge = input("Do you wish to continue? [Y/n] ") + if 'N' in acknowledge or 'n' in acknowledge: + sys.exit(1) app.ui = ConjureUI() EventLoop.build_loop(app.ui, STYLES, unhandled_input=unhandled_input) diff --git a/conjureup/controllers/clouds/gui.py b/conjureup/controllers/clouds/gui.py index b63f6d8..8b441ff 100644 --- a/conjureup/controllers/clouds/gui.py +++ b/conjureup/controllers/clouds/gui.py @@ -1,7 +1,7 @@ from conjureup import controllers from conjureup.app_config import app from conjureup.controllers.clouds.common import list_clouds -from conjureup.telemetry import track_screen +from conjureup.telemetry import track_event, track_screen from conjureup.ui.views.cloud import CloudView @@ -20,6 +20,7 @@ class CloudsController: """ app.current_cloud = cloud + track_event("Cloud selection", app.current_cloud, "") return controllers.use('newcloud').render() def render(self): diff --git a/conjureup/ui/views/destroy_confirm.py b/conjureup/ui/views/destroy_confirm.py index 77683d7..a3226de 100644 --- a/conjureup/ui/views/destroy_confirm.py +++ b/conjureup/ui/views/destroy_confirm.py @@ -1,4 +1,5 @@ import datetime + from urwid import Columns, Filler, Frame, Pile, Text, WidgetWrap from conjureup.api.models import model_status diff --git a/ubuntui/ev.py b/ubuntui/ev.py index 3b5eab5..4c90b84 100644 --- a/ubuntui/ev.py +++ b/ubuntui/ev.py @@ -18,23 +18,22 @@ class EventLoop: """ loop = None alarms = {} + extra_opts = { + 'screen': urwid.raw_display.Screen(), + 'handle_mouse': True + } @classmethod def build_loop(cls, ui, palette, **kwargs): """ Builds eventloop """ - extra_opts = { - 'screen': urwid.raw_display.Screen(), - 'handle_mouse': True - } - extra_opts['screen'].set_terminal_properties(colors=256) - extra_opts['screen'].reset_default_terminal_palette() - extra_opts.update(**kwargs) + cls.extra_opts['screen'].set_terminal_properties(colors=256) + cls.extra_opts.update(**kwargs) evl = asyncio.get_event_loop() cls.loop = urwid.MainLoop(ui, palette, event_loop=urwid.AsyncioEventLoop(loop=evl), pop_ups=True, - **extra_opts) + **cls.extra_opts) @classmethod def exit(cls, err=0): @@ -85,3 +84,15 @@ class EventLoop: log.exception("Exception in ev.run():") raise return + + @classmethod + def rows(cls): + """ Returns rows + """ + return cls.extra_opts['screen'].get_cols_rows()[1] + + @classmethod + def columns(cls): + """ Returns columns + """ + return cls.extra_opts['screen'].get_cols_rows()[0]
Need warning about small terminal sizes affecting usability
conjure-up/conjure-up
diff --git a/test/test_controllers_clouds_gui.py b/test/test_controllers_clouds_gui.py index 933f81a..6798cfc 100644 --- a/test/test_controllers_clouds_gui.py +++ b/test/test_controllers_clouds_gui.py @@ -67,10 +67,15 @@ class CloudsGUIFinishTestCase(unittest.TestCase): self.cloudname = 'testcloudname' + self.track_event_patcher = patch( + 'conjureup.controllers.clouds.gui.track_event') + self.mock_track_event = self.track_event_patcher.start() + def tearDown(self): self.controllers_patcher.stop() self.render_patcher.stop() self.app_patcher.stop() + self.track_event_patcher.stop() def test_finish_no_controller(self): "clouds.finish without existing controller"
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 4 }
2.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "nose", "tox", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 -e git+https://github.com/conjure-up/conjure-up.git@5bb8d5a83bbb3ea381d627fa277495b1abb0fbce#egg=conjure_up distlib==0.3.9 filelock==3.4.1 idna==3.10 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig==1.1.1 Jinja2==3.0.3 juju-wait==2.8.4 MarkupSafe==2.0.1 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 platformdirs==2.4.0 pluggy==1.0.0 prettytable==2.5.0 progressbar2==3.55.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 python-utils==3.5.2 PyYAML==6.0.1 q==2.7 requests==2.27.1 requests-oauthlib==2.0.0 six==1.17.0 termcolor==1.1.0 toml==0.10.2 tomli==1.2.3 tox==3.28.0 typing_extensions==4.1.1 urllib3==1.26.20 urwid==2.1.2 virtualenv==20.17.1 wcwidth==0.2.13 ws4py==0.3.4 zipp==3.6.0
name: conjure-up channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - charset-normalizer==2.0.12 - distlib==0.3.9 - filelock==3.4.1 - idna==3.10 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - iniconfig==1.1.1 - jinja2==3.0.3 - juju-wait==2.8.4 - markupsafe==2.0.1 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - platformdirs==2.4.0 - pluggy==1.0.0 - prettytable==2.5.0 - progressbar2==3.55.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-utils==3.5.2 - pyyaml==6.0.1 - q==2.7 - requests==2.27.1 - requests-oauthlib==2.0.0 - six==1.17.0 - termcolor==1.1.0 - toml==0.10.2 - tomli==1.2.3 - tox==3.28.0 - typing-extensions==4.1.1 - urllib3==1.26.20 - urwid==2.1.2 - virtualenv==20.17.1 - wcwidth==0.2.13 - ws4py==0.3.4 - zipp==3.6.0 prefix: /opt/conda/envs/conjure-up
[ "test/test_controllers_clouds_gui.py::CloudsGUIFinishTestCase::test_finish_no_controller" ]
[]
[ "test/test_controllers_clouds_gui.py::CloudsGUIRenderTestCase::test_render" ]
[]
MIT License
1,000
[ "ubuntui/ev.py", "conjureup/ui/views/destroy_confirm.py", "conjureup/app.py", "conjureup/controllers/clouds/gui.py" ]
[ "ubuntui/ev.py", "conjureup/ui/views/destroy_confirm.py", "conjureup/app.py", "conjureup/controllers/clouds/gui.py" ]
Stranger6667__postmarker-81
f4e41e0cd842d9c5b638428fb7e9271211bb0db2
2017-02-01 08:39:52
d942c857e1f2c42d297983096280c894640c6440
codecov-io: # [Codecov](https://codecov.io/gh/Stranger6667/postmarker/pull/81?src=pr&el=h1) Report > Merging [#81](https://codecov.io/gh/Stranger6667/postmarker/pull/81?src=pr&el=desc) into [master](https://codecov.io/gh/Stranger6667/postmarker/commit/f4e41e0cd842d9c5b638428fb7e9271211bb0db2?src=pr&el=desc) will **not impact** coverage. ```diff @@ Coverage Diff @@ ## master #81 +/- ## ===================================== Coverage 100% 100% ===================================== Files 14 15 +1 Lines 507 537 +30 Branches 51 51 ===================================== + Hits 507 537 +30 ``` | [Impacted Files](https://codecov.io/gh/Stranger6667/postmarker/pull/81?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [postmarker/models/stats.py](https://codecov.io/gh/Stranger6667/postmarker/compare/f4e41e0cd842d9c5b638428fb7e9271211bb0db2...9f8a766234842bcced52e636aca2d993e7bf6f38?src=pr&el=tree#diff-cG9zdG1hcmtlci9tb2RlbHMvc3RhdHMucHk=) | `100% <100%> (ø)` | | | [postmarker/__init__.py](https://codecov.io/gh/Stranger6667/postmarker/compare/f4e41e0cd842d9c5b638428fb7e9271211bb0db2...9f8a766234842bcced52e636aca2d993e7bf6f38?src=pr&el=tree#diff-cG9zdG1hcmtlci9fX2luaXRfXy5weQ==) | `100% <100%> (ø)` | :white_check_mark: | | [postmarker/core.py](https://codecov.io/gh/Stranger6667/postmarker/compare/f4e41e0cd842d9c5b638428fb7e9271211bb0db2...9f8a766234842bcced52e636aca2d993e7bf6f38?src=pr&el=tree#diff-cG9zdG1hcmtlci9jb3JlLnB5) | `100% <100%> (ø)` | :white_check_mark: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/Stranger6667/postmarker/pull/81?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/Stranger6667/postmarker/pull/81?src=pr&el=footer). Last update [f4e41e0...9f8a766](https://codecov.io/gh/Stranger6667/postmarker/compare/f4e41e0cd842d9c5b638428fb7e9271211bb0db2...9f8a766234842bcced52e636aca2d993e7bf6f38?src=pr&el=footer&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/README.rst b/README.rst index 657bbba..f434803 100644 --- a/README.rst +++ b/README.rst @@ -77,7 +77,7 @@ Setup an email: There are a lot of features available. Check it out in our documentation! Here's just a few of them: - Support for sending Python email instances. -- Bounces, Domains, Templates, Status & Server API. +- Bounces, Domains, Templates, Status, Stats & Server API. - Django email backend. - Spam check API. diff --git a/docs/changelog.rst b/docs/changelog.rst index aaebab2..808978a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -3,6 +3,11 @@ Changelog ========= +0.7.0.dev0 - TBA +---------------- + +- Stats API. (`#72`_) + 0.6.2 - 02.01.2017 ------------------ @@ -91,6 +96,7 @@ Changelog .. _#78: https://github.com/Stranger6667/postmarker/issues/78 .. _#76: https://github.com/Stranger6667/postmarker/issues/76 +.. _#72: https://github.com/Stranger6667/postmarker/issues/72 .. _#64: https://github.com/Stranger6667/postmarker/issues/64 .. _#62: https://github.com/Stranger6667/postmarker/issues/62 .. _#60: https://github.com/Stranger6667/postmarker/issues/60 diff --git a/docs/index.rst b/docs/index.rst index cc46d34..9ca6d91 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -20,6 +20,7 @@ Contents: bounces server status + stats domains django spamcheck diff --git a/docs/stats.rst b/docs/stats.rst new file mode 100644 index 0000000..e57fba7 --- /dev/null +++ b/docs/stats.rst @@ -0,0 +1,36 @@ +.. _stats: + +Stats +===== + +The Stats API is available via the ``stats`` manager: + +.. code-block:: python + + >>> postmark.stats.overview(fromdate='2017-02-01') + { + 'BounceRate': 0.0, + 'Bounced': 0, + 'Opens': 50, + 'SMTPApiErrors': 0, + 'Sent': 93, + 'SpamComplaints': 0, + 'SpamComplaintsRate': 0.0, + 'TotalClicks': 0, + 'TotalTrackedLinksSent': 0, + 'Tracked': 93, + 'UniqueLinksClicked': 0, + 'UniqueOpens': 19, + 'WithClientRecorded': 13, + 'WithLinkTracking': 0, + 'WithOpenTracking': 93, + 'WithPlatformRecorded': 19, + 'WithReadTimeRecorded': 19 + } + >>> postmark.stats.sends(fromdate='2017-02-01') + { + 'Days': [ + {'Date': '2017-02-01', 'Sent': 2} + ], + 'Sent': 2 + } diff --git a/postmarker/__init__.py b/postmarker/__init__.py index 041b770..e2d156c 100644 --- a/postmarker/__init__.py +++ b/postmarker/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 -__version__ = '0.6.2' +__version__ = '0.7.0.dev0' diff --git a/postmarker/core.py b/postmarker/core.py index d1766fb..9d25763 100644 --- a/postmarker/core.py +++ b/postmarker/core.py @@ -9,6 +9,7 @@ from .models.bounces import BounceManager from .models.domains import DomainsManager from .models.emails import EmailManager from .models.server import ServerManager +from .models.stats import StatsManager from .models.status import StatusManager from .models.templates import TemplateManager @@ -51,6 +52,7 @@ class PostmarkClient(with_metaclass(ClientMeta)): DomainsManager, EmailManager, ServerManager, + StatsManager, StatusManager, TemplateManager, ) diff --git a/postmarker/models/stats.py b/postmarker/models/stats.py new file mode 100644 index 0000000..1691aa8 --- /dev/null +++ b/postmarker/models/stats.py @@ -0,0 +1,92 @@ +# coding: utf-8 +from .base import ModelManager + + +class StatsManager(ModelManager): + name = 'stats' + + def overview(self, tag=None, fromdate=None, todate=None): + """ + Gets a brief overview of statistics for all of your outbound email. + """ + return self.call('GET', '/stats/outbound', tag=tag, fromdate=fromdate, todate=todate) + + def sends(self, tag=None, fromdate=None, todate=None): + """ + Gets a total count of emails you’ve sent out. + """ + return self.call('GET', '/stats/outbound/sends', tag=tag, fromdate=fromdate, todate=todate) + + def bounces(self, tag=None, fromdate=None, todate=None): + """ + Gets total counts of emails you’ve sent out that have been returned as bounced. + """ + return self.call('GET', '/stats/outbound/bounces', tag=tag, fromdate=fromdate, todate=todate) + + def spam(self, tag=None, fromdate=None, todate=None): + """ + Gets a total count of recipients who have marked your email as spam. + """ + return self.call('GET', '/stats/outbound/spam', tag=tag, fromdate=fromdate, todate=todate) + + def tracked(self, tag=None, fromdate=None, todate=None): + """ + Gets a total count of emails you’ve sent with open tracking or link tracking enabled. + """ + return self.call('GET', '/stats/outbound/tracked', tag=tag, fromdate=fromdate, todate=todate) + + def opens(self, tag=None, fromdate=None, todate=None): + """ + Gets total counts of recipients who opened your emails. + This is only recorded when open tracking is enabled for that email. + """ + return self.call('GET', '/stats/outbound/opens', tag=tag, fromdate=fromdate, todate=todate) + + def opens_platforms(self, tag=None, fromdate=None, todate=None): + """ + Gets an overview of the platforms used to open your emails. + This is only recorded when open tracking is enabled for that email. + """ + return self.call('GET', '/stats/outbound/opens/platforms', tag=tag, fromdate=fromdate, todate=todate) + + def emailclients(self, tag=None, fromdate=None, todate=None): + """ + Gets an overview of the email clients used to open your emails. + This is only recorded when open tracking is enabled for that email. + """ + return self.call('GET', '/stats/outbound/opens/emailclients', tag=tag, fromdate=fromdate, todate=todate) + + def readtimes(self, tag=None, fromdate=None, todate=None): + """ + Gets the length of time that recipients read emails along with counts for each time. + This is only recorded when open tracking is enabled for that email. + Read time tracking stops at 20 seconds, so any read times above that will appear in the 20s+ field. + """ + return self.call('GET', '/stats/outbound/opens/readtimes', tag=tag, fromdate=fromdate, todate=todate) + + def clicks(self, tag=None, fromdate=None, todate=None): + """ + Gets total counts of unique links that were clicked. + """ + return self.call('GET', '/stats/outbound/clicks', tag=tag, fromdate=fromdate, todate=todate) + + def browserfamilies(self, tag=None, fromdate=None, todate=None): + """ + Gets an overview of the browsers used to open links in your emails. + This is only recorded when Link Tracking is enabled for that email. + """ + return self.call('GET', '/stats/outbound/clicks/browserfamilies', tag=tag, fromdate=fromdate, todate=todate) + + def clicks_platforms(self, tag=None, fromdate=None, todate=None): + """ + Gets an overview of the browser platforms used to open your emails. + This is only recorded when Link Tracking is enabled for that email. + """ + return self.call('GET', '/stats/outbound/clicks/platforms', tag=tag, fromdate=fromdate, todate=todate) + + def location(self, tag=None, fromdate=None, todate=None): + """ + Gets an overview of which part of the email links were clicked from (HTML or Text). + This is only recorded when Link Tracking is enabled for that email. + """ + return self.call('GET', '/stats/outbound/clicks/location', tag=tag, fromdate=fromdate, todate=todate)
Stats API http://developer.postmarkapp.com/developer-api-stats.html
Stranger6667/postmarker
diff --git a/tests/cassettes/stats.json b/tests/cassettes/stats.json new file mode 100644 index 0000000..27e2e73 --- /dev/null +++ b/tests/cassettes/stats.json @@ -0,0 +1,799 @@ +{ + "http_interactions": [ + { + "recorded_at": "2017-02-01T08:29:23", + "request": { + "body": { + "base64_string": "", + "encoding": "utf-8" + }, + "headers": { + "Accept": [ + "application/json" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" + ], + "User-Agent": [ + "Postmarker/0.7.0.dev0" + ], + "X-Postmark-Server-Token": [ + "SERVER_TOKEN" + ] + }, + "method": "GET", + "uri": "https://api.postmarkapp.com/stats/outbound?fromdate=2017-01-30" + }, + "response": { + "body": { + "base64_string": "H4sIAAAAAAAEAGWQyw6CMBBF/6VrYiDEBeyUuNNAAOO6KaNO6MtSVsZ/tw+iGJdz7s3MaZ+kA2lJWeQJ2atZMhhImSakO/XNTuPBGGWmQGLaUgtu3PiKpqJSQnOK0sbOL1p1e0PZ6Ff7O7UG6fpbx88SHzMsICtcUVnKK45sjBtj4YhynAJd9C5o72526i0wZQaPszzyhlN7VUaskiImLdChRwH/iT8QHFHePge81hd682C3vCU4xc9LX29XpLGhRwEAAA==", + "encoding": "utf-8" + }, + "headers": { + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Length": [ + "196" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 01 Feb 2017 08:29:22 GMT" + ], + "Server": [ + "unicorns-double-rainbow" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "url": "https://api.postmarkapp.com/stats/outbound?fromdate=2017-01-30" + } + }, + { + "recorded_at": "2017-02-01T08:29:23", + "request": { + "body": { + "base64_string": "", + "encoding": "utf-8" + }, + "headers": { + "Accept": [ + "application/json" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" + ], + "User-Agent": [ + "Postmarker/0.7.0.dev0" + ], + "X-Postmark-Server-Token": [ + "SERVER_TOKEN" + ] + }, + "method": "GET", + "uri": "https://api.postmarkapp.com/stats/outbound/sends?fromdate=2017-01-30" + }, + "response": { + "body": { + "base64_string": "H4sIAAAAAAAEAKtWckmsLFayiq4GMkpSlayUjAwMzXUNDHWNDZR0lIJT80qUrIzNa3Uw5Q3h8qYmGPJGQCVweaPaWBjT0rgWAJGKnXdzAAAA", + "encoding": "utf-8" + }, + "headers": { + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Length": [ + "81" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 01 Feb 2017 08:29:23 GMT" + ], + "Server": [ + "unicorns-double-rainbow" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "url": "https://api.postmarkapp.com/stats/outbound/sends?fromdate=2017-01-30" + } + }, + { + "recorded_at": "2017-02-01T08:29:23", + "request": { + "body": { + "base64_string": "", + "encoding": "utf-8" + }, + "headers": { + "Accept": [ + "application/json" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" + ], + "User-Agent": [ + "Postmarker/0.7.0.dev0" + ], + "X-Postmark-Server-Token": [ + "SERVER_TOKEN" + ] + }, + "method": "GET", + "uri": "https://api.postmarkapp.com/stats/outbound/bounces?fromdate=2017-01-30" + }, + "response": { + "body": { + "base64_string": "H4sIAAAAAAAEAKtWckmsLFayio6tBQBnJIrzCwAAAA==", + "encoding": "utf-8" + }, + "headers": { + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Length": [ + "31" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 01 Feb 2017 08:29:23 GMT" + ], + "Server": [ + "unicorns-double-rainbow" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "url": "https://api.postmarkapp.com/stats/outbound/bounces?fromdate=2017-01-30" + } + }, + { + "recorded_at": "2017-02-01T08:29:24", + "request": { + "body": { + "base64_string": "", + "encoding": "utf-8" + }, + "headers": { + "Accept": [ + "application/json" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" + ], + "User-Agent": [ + "Postmarker/0.7.0.dev0" + ], + "X-Postmark-Server-Token": [ + "SERVER_TOKEN" + ] + }, + "method": "GET", + "uri": "https://api.postmarkapp.com/stats/outbound/spam?fromdate=2017-01-30" + }, + "response": { + "body": { + "base64_string": "H4sIAAAAAAAEAKtWckmsLFayio6tBQBnJIrzCwAAAA==", + "encoding": "utf-8" + }, + "headers": { + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Length": [ + "31" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 01 Feb 2017 08:29:23 GMT" + ], + "Server": [ + "unicorns-double-rainbow" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "url": "https://api.postmarkapp.com/stats/outbound/spam?fromdate=2017-01-30" + } + }, + { + "recorded_at": "2017-02-01T08:29:24", + "request": { + "body": { + "base64_string": "", + "encoding": "utf-8" + }, + "headers": { + "Accept": [ + "application/json" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" + ], + "User-Agent": [ + "Postmarker/0.7.0.dev0" + ], + "X-Postmark-Server-Token": [ + "SERVER_TOKEN" + ] + }, + "method": "GET", + "uri": "https://api.postmarkapp.com/stats/outbound/tracked?fromdate=2017-01-30" + }, + "response": { + "body": { + "base64_string": "H4sIAAAAAAAEAKtWckmsLFayiq4GMkpSlayUjAwMzXUNDHWNDZR0lEKKEpOzU1OUrIzNa3UwlRgiKzE1wVBiBFSFrMSoNhaJZ2lcCwAfi9kTfwAAAA==", + "encoding": "utf-8" + }, + "headers": { + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Length": [ + "85" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 01 Feb 2017 08:29:23 GMT" + ], + "Server": [ + "unicorns-double-rainbow" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "url": "https://api.postmarkapp.com/stats/outbound/tracked?fromdate=2017-01-30" + } + }, + { + "recorded_at": "2017-02-01T08:29:24", + "request": { + "body": { + "base64_string": "", + "encoding": "utf-8" + }, + "headers": { + "Accept": [ + "application/json" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" + ], + "User-Agent": [ + "Postmarker/0.7.0.dev0" + ], + "X-Postmark-Server-Token": [ + "SERVER_TOKEN" + ] + }, + "method": "GET", + "uri": "https://api.postmarkapp.com/stats/outbound/opens?fromdate=2017-01-30" + }, + "response": { + "body": { + "base64_string": "H4sIAAAAAAAEAKtWckmsLFayiq4GMkpSlayUjAwMzXUNDHWNDZR0lPwLUvOAsmY6SqF5mYWlQHnjWh1MpYYIpcaWCLWGmIqNgOoRik2RzY1FCBsgmWFZCwBUQPR8pAAAAA==", + "encoding": "utf-8" + }, + "headers": { + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Length": [ + "97" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 01 Feb 2017 08:29:23 GMT" + ], + "Server": [ + "unicorns-double-rainbow" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "url": "https://api.postmarkapp.com/stats/outbound/opens?fromdate=2017-01-30" + } + }, + { + "recorded_at": "2017-02-01T08:29:24", + "request": { + "body": { + "base64_string": "", + "encoding": "utf-8" + }, + "headers": { + "Accept": [ + "application/json" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" + ], + "User-Agent": [ + "Postmarker/0.7.0.dev0" + ], + "X-Postmark-Server-Token": [ + "SERVER_TOKEN" + ] + }, + "method": "GET", + "uri": "https://api.postmarkapp.com/stats/outbound/opens/platforms?fromdate=2017-01-30" + }, + "response": { + "body": { + "base64_string": "H4sIAAAAAAAEAKtWckmsLFayiq4GMkpSlayUjAwMzXUNDHWNDZR0lFxSi7NL8guUrAx1lHzzkzJzUsHM0LzsvPzyPCC7VgdToyGyRiNk1ZjKjYA6lJCUGNfGImk2xmGraS0ApuqGybgAAAA=", + "encoding": "utf-8" + }, + "headers": { + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 01 Feb 2017 08:29:24 GMT" + ], + "Server": [ + "unicorns-double-rainbow" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "url": "https://api.postmarkapp.com/stats/outbound/opens/platforms?fromdate=2017-01-30" + } + }, + { + "recorded_at": "2017-02-01T08:29:24", + "request": { + "body": { + "base64_string": "", + "encoding": "utf-8" + }, + "headers": { + "Accept": [ + "application/json" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" + ], + "User-Agent": [ + "Postmarker/0.7.0.dev0" + ], + "X-Postmark-Server-Token": [ + "SERVER_TOKEN" + ] + }, + "method": "GET", + "uri": "https://api.postmarkapp.com/stats/outbound/opens/emailclients?fromdate=2017-01-30" + }, + "response": { + "body": { + "base64_string": "H4sIAAAAAAAEAKtWckmsLFayiq4GMkpSlayUjAwMzXUNDHWNDZR0lNxzEzNzlKwMdZRCMkrzUlKLkjKLUoD8Wh1M9YYI9WZo6o0w1BsBtSDUG9fGIuwyQNNsXAsAPCp2d6UAAAA=", + "encoding": "utf-8" + }, + "headers": { + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Length": [ + "101" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 01 Feb 2017 08:29:24 GMT" + ], + "Server": [ + "unicorns-double-rainbow" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "url": "https://api.postmarkapp.com/stats/outbound/opens/emailclients?fromdate=2017-01-30" + } + }, + { + "recorded_at": "2017-02-01T08:29:24", + "request": { + "body": { + "base64_string": "", + "encoding": "utf-8" + }, + "headers": { + "Accept": [ + "application/json" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" + ], + "User-Agent": [ + "Postmarker/0.7.0.dev0" + ], + "X-Postmark-Server-Token": [ + "SERVER_TOKEN" + ] + }, + "method": "GET", + "uri": "https://api.postmarkapp.com/stats/outbound/opens/readtimes?fromdate=2017-01-30" + }, + "response": { + "body": { + "base64_string": "H4sIAAAAAAAEAKtWckmsLFayiq4GMkpSlayUjAwMzXUNDHWNDZR0lAyAUoY6SoZmELo0LzsvvzwPyK7VwdRgCNRgZFCsrWRlpKNkUgymLCAaLSE8uH4zDP1GQCOUkFQY18ZiWE+k4YYGtQCghepl1wAAAA==", + "encoding": "utf-8" + }, + "headers": { + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Length": [ + "115" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 01 Feb 2017 08:29:24 GMT" + ], + "Server": [ + "unicorns-double-rainbow" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "url": "https://api.postmarkapp.com/stats/outbound/opens/readtimes?fromdate=2017-01-30" + } + }, + { + "recorded_at": "2017-02-01T08:29:25", + "request": { + "body": { + "base64_string": "", + "encoding": "utf-8" + }, + "headers": { + "Accept": [ + "application/json" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" + ], + "User-Agent": [ + "Postmarker/0.7.0.dev0" + ], + "X-Postmark-Server-Token": [ + "SERVER_TOKEN" + ] + }, + "method": "GET", + "uri": "https://api.postmarkapp.com/stats/outbound/clicks" + }, + "response": { + "body": { + "base64_string": "eyJEYXlzIjpbXX0=", + "encoding": "utf-8" + }, + "headers": { + "Cache-Control": [ + "private" + ], + "Content-Length": [ + "11" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 01 Feb 2017 08:29:24 GMT" + ], + "Server": [ + "unicorns-double-rainbow" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "url": "https://api.postmarkapp.com/stats/outbound/clicks" + } + }, + { + "recorded_at": "2017-02-01T08:29:25", + "request": { + "body": { + "base64_string": "", + "encoding": "utf-8" + }, + "headers": { + "Accept": [ + "application/json" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" + ], + "User-Agent": [ + "Postmarker/0.7.0.dev0" + ], + "X-Postmark-Server-Token": [ + "SERVER_TOKEN" + ] + }, + "method": "GET", + "uri": "https://api.postmarkapp.com/stats/outbound/clicks/browserfamilies" + }, + "response": { + "body": { + "base64_string": "eyJEYXlzIjpbXX0=", + "encoding": "utf-8" + }, + "headers": { + "Cache-Control": [ + "private" + ], + "Content-Length": [ + "11" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 01 Feb 2017 08:29:24 GMT" + ], + "Server": [ + "unicorns-double-rainbow" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "url": "https://api.postmarkapp.com/stats/outbound/clicks/browserfamilies" + } + }, + { + "recorded_at": "2017-02-01T08:29:25", + "request": { + "body": { + "base64_string": "", + "encoding": "utf-8" + }, + "headers": { + "Accept": [ + "application/json" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" + ], + "User-Agent": [ + "Postmarker/0.7.0.dev0" + ], + "X-Postmark-Server-Token": [ + "SERVER_TOKEN" + ] + }, + "method": "GET", + "uri": "https://api.postmarkapp.com/stats/outbound/clicks/platforms" + }, + "response": { + "body": { + "base64_string": "eyJEYXlzIjpbXX0=", + "encoding": "utf-8" + }, + "headers": { + "Cache-Control": [ + "private" + ], + "Content-Length": [ + "11" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 01 Feb 2017 08:29:25 GMT" + ], + "Server": [ + "unicorns-double-rainbow" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "url": "https://api.postmarkapp.com/stats/outbound/clicks/platforms" + } + }, + { + "recorded_at": "2017-02-01T08:29:25", + "request": { + "body": { + "base64_string": "", + "encoding": "utf-8" + }, + "headers": { + "Accept": [ + "application/json" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" + ], + "User-Agent": [ + "Postmarker/0.7.0.dev0" + ], + "X-Postmark-Server-Token": [ + "SERVER_TOKEN" + ] + }, + "method": "GET", + "uri": "https://api.postmarkapp.com/stats/outbound/clicks/location" + }, + "response": { + "body": { + "base64_string": "eyJEYXlzIjpbXX0=", + "encoding": "utf-8" + }, + "headers": { + "Cache-Control": [ + "private" + ], + "Content-Length": [ + "11" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 01 Feb 2017 08:29:25 GMT" + ], + "Server": [ + "unicorns-double-rainbow" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "url": "https://api.postmarkapp.com/stats/outbound/clicks/location" + } + } + ], + "recorded_with": "betamax/0.8.0" +} \ No newline at end of file diff --git a/tests/models/test_stats.py b/tests/models/test_stats.py new file mode 100644 index 0000000..4e2a1e2 --- /dev/null +++ b/tests/models/test_stats.py @@ -0,0 +1,138 @@ +# coding: utf-8 +import pytest + + +CASSETTE_NAME = 'stats' + + [email protected]('method, kwargs, expected', ( + ( + 'overview', + {'fromdate': '2017-01-30'}, + { + 'BounceRate': 0.0, + 'Bounced': 0, + 'Opens': 50, + 'SMTPApiErrors': 0, + 'Sent': 93, + 'SpamComplaints': 0, + 'SpamComplaintsRate': 0.0, + 'TotalClicks': 0, + 'TotalTrackedLinksSent': 0, + 'Tracked': 93, + 'UniqueLinksClicked': 0, + 'UniqueOpens': 19, + 'WithClientRecorded': 13, + 'WithLinkTracking': 0, + 'WithOpenTracking': 93, + 'WithPlatformRecorded': 19, + 'WithReadTimeRecorded': 19 + } + ), + ( + 'sends', + {'fromdate': '2017-01-30'}, + { + 'Days': [ + {'Date': '2017-01-30', 'Sent': 37}, + {'Date': '2017-01-31', 'Sent': 54}, + {'Date': '2017-02-01', 'Sent': 2} + ], + 'Sent': 93 + } + ), + ( + 'bounces', + {'fromdate': '2017-01-30'}, + {'Days': []} + ), + ( + 'spam', + {'fromdate': '2017-01-30'}, + {'Days': []} + ), + ( + 'tracked', + {'fromdate': '2017-01-30'}, + { + 'Days': [ + {'Date': '2017-01-30', 'Tracked': 37}, + {'Date': '2017-01-31', 'Tracked': 54}, + {'Date': '2017-02-01', 'Tracked': 2} + ], + 'Tracked': 93 + } + ), + ( + 'opens', + {'fromdate': '2017-01-30'}, + { + 'Days': [ + {'Date': '2017-01-30', 'Opens': 6, 'Unique': 3}, + {'Date': '2017-01-31', 'Opens': 39, 'Unique': 13}, + {'Date': '2017-02-01', 'Opens': 5, 'Unique': 3} + ], + 'Opens': 50, + 'Unique': 19 + } + ), + ( + 'opens_platforms', + {'fromdate': '2017-01-30'}, + { + 'Days': [ + {'Date': '2017-01-30', 'Desktop': 1, 'Mobile': 1, 'Unknown': 1}, + {'Date': '2017-01-31', 'Desktop': 2, 'Unknown': 11}, + {'Date': '2017-02-01', 'Unknown': 3} + ], + 'Desktop': 3, + 'Mobile': 1, + 'Unknown': 15 + } + ), + ( + 'emailclients', + {'fromdate': '2017-01-30'}, + { + 'Days': [ + {'Date': '2017-01-30', 'Gmail': 1, 'Thunderbird': 1}, + {'Date': '2017-01-31', 'Gmail': 6, 'Thunderbird': 2}, + {'Date': '2017-02-01', 'Gmail': 3} + ], + 'Gmail': 10, + 'Thunderbird': 3 + } + ), + ( + 'readtimes', + {'fromdate': '2017-01-30'}, + { + 'Days': [ + {'Date': '2017-01-30', '0s': 1, '16s': 1, 'unknown': 1}, + {'Date': '2017-01-31', '20s+': 2, '4s': 2, '8s': 1, '9s': 2, 'unknown': 6}, + {'Date': '2017-02-01', 'unknown': 3} + ], + '0s': 1, + '16s': 1, + '20s+': 2, + '4s': 2, + '8s': 1, + '9s': 2, + 'unknown': 10 + } + ), + ( + 'clicks', {}, {'Days': []} + ), + ( + 'browserfamilies', {}, {'Days': []} + ), + ( + 'clicks_platforms', {}, {'Days': []} + ), + ( + 'location', {}, {'Days': []} + ), +)) +def test_methods(postmark, method, kwargs, expected): + assert getattr(postmark.stats, method)(**kwargs) == expected
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks", "has_added_files", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 3, "issue_text_score": 3, "test_score": 3 }, "num_modified_files": 5 }
0.6
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "pytest-cov", "pytest-django", "betamax", "betamax_serializers", "mock" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work betamax==0.8.1 betamax-serializers==0.2.1 certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 idna==3.10 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work mock==5.2.0 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work -e git+https://github.com/Stranger6667/postmarker.git@f4e41e0cd842d9c5b638428fb7e9271211bb0db2#egg=postmarker py @ file:///opt/conda/conda-bld/py_1644396412707/work pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 pytest-cov==4.0.0 pytest-django==4.5.2 requests==2.27.1 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tomli==1.2.3 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: postmarker channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - betamax==0.8.1 - betamax-serializers==0.2.1 - charset-normalizer==2.0.12 - coverage==6.2 - idna==3.10 - mock==5.2.0 - pytest-cov==4.0.0 - pytest-django==4.5.2 - requests==2.27.1 - tomli==1.2.3 - urllib3==1.26.20 prefix: /opt/conda/envs/postmarker
[ "tests/models/test_stats.py::test_methods[overview-kwargs0-expected0]", "tests/models/test_stats.py::test_methods[sends-kwargs1-expected1]", "tests/models/test_stats.py::test_methods[bounces-kwargs2-expected2]", "tests/models/test_stats.py::test_methods[spam-kwargs3-expected3]", "tests/models/test_stats.py::test_methods[tracked-kwargs4-expected4]", "tests/models/test_stats.py::test_methods[opens-kwargs5-expected5]", "tests/models/test_stats.py::test_methods[opens_platforms-kwargs6-expected6]", "tests/models/test_stats.py::test_methods[emailclients-kwargs7-expected7]", "tests/models/test_stats.py::test_methods[readtimes-kwargs8-expected8]", "tests/models/test_stats.py::test_methods[clicks-kwargs9-expected9]", "tests/models/test_stats.py::test_methods[browserfamilies-kwargs10-expected10]", "tests/models/test_stats.py::test_methods[clicks_platforms-kwargs11-expected11]", "tests/models/test_stats.py::test_methods[location-kwargs12-expected12]" ]
[]
[]
[]
MIT License
1,001
[ "README.rst", "docs/stats.rst", "docs/changelog.rst", "postmarker/__init__.py", "postmarker/core.py", "docs/index.rst", "postmarker/models/stats.py" ]
[ "README.rst", "docs/stats.rst", "docs/changelog.rst", "postmarker/__init__.py", "postmarker/core.py", "docs/index.rst", "postmarker/models/stats.py" ]
F5Networks__f5-common-python-967
52861aea481189c805419221bd8e98114c364ee6
2017-02-02 14:25:35
3fab44fd13a35c1897649494cdae757d6020640f
diff --git a/f5/bigip/tm/asm/tasks.py b/f5/bigip/tm/asm/tasks.py index f669107..2b05f57 100644 --- a/f5/bigip/tm/asm/tasks.py +++ b/f5/bigip/tm/asm/tasks.py @@ -91,8 +91,8 @@ class Export_Policy_s(Collection): class Export_Policy(AsmResource): """BIG-IP® ASM Export Policy Resource.""" - def __init__(self, apply_policy_s): - super(Export_Policy, self).__init__(apply_policy_s) + def __init__(self, export_policy_s): + super(Export_Policy, self).__init__(export_policy_s) self._meta_data['required_json_kind'] =\ 'tm:asm:tasks:export-policy:export-policy-taskstate' self._meta_data['required_creation_parameters'] = set(( @@ -109,7 +109,33 @@ class Export_Policy(AsmResource): class Import_Policy_s(Collection): - pass + """BIG-IP® ASM Import Policy Collection.""" + def __init__(self, tasks): + super(Import_Policy_s, self).__init__(tasks) + self._meta_data['object_has_stats'] = False + self._meta_data['allowed_lazy_attributes'] = [Import_Policy] + self._meta_data['attribute_registry'] = { + 'tm:asm:tasks:import-policy:import-policy-taskstate': + Import_Policy} + + +class Import_Policy(AsmResource): + """BIG-IP® ASM Import Policy Resource.""" + def __init__(self, import_policy_s): + super(Import_Policy, self).__init__(import_policy_s) + self._meta_data['required_json_kind'] =\ + 'tm:asm:tasks:import-policy:import-policy-taskstate' + self._meta_data['required_creation_parameters'] = set(( + 'name', 'filename')) + + def modify(self, **kwargs): + """Modify is not supported for Apply Policy resource + + :raises: UnsupportedOperation + """ + raise UnsupportedOperation( + "%s does not support the modify method" % self.__class__.__name__ + ) class Check_Signatures_s(Collection):
Create 3 missing endpoints at /mgmt/tm/asm/tasks/ Hello Devs! Greatly enjoy using the SDK. Hopefully these endpoints can be added in the scope of next release :) ``` "reference": { "link": "https://localhost/mgmt/tm/asm/tasks/import-policy" } "reference": { "link": "https://localhost/mgmt/tm/asm/tasks/export-policy" } "reference": { "link": "https://localhost/mgmt/tm/asm/tasks/apply-policy" } ```
F5Networks/f5-common-python
diff --git a/f5/bigip/tm/asm/test/functional/test_tasks.py b/f5/bigip/tm/asm/test/functional/test_tasks.py index 9496415..3a4d7b8 100644 --- a/f5/bigip/tm/asm/test/functional/test_tasks.py +++ b/f5/bigip/tm/asm/test/functional/test_tasks.py @@ -21,6 +21,7 @@ from f5.bigip.tm.asm.tasks import Apply_Policy from f5.bigip.tm.asm.tasks import Check_Signature from f5.bigip.tm.asm.tasks import Export_Policy from f5.bigip.tm.asm.tasks import Export_Signature +from f5.bigip.tm.asm.tasks import Import_Policy from f5.bigip.tm.asm.tasks import Update_Signature from requests.exceptions import HTTPError @@ -136,6 +137,23 @@ def set_export_policy_test(request, mgmt_root, reference): return exp1 +def delete_import_policy(mgmt_root): + col = mgmt_root.tm.asm.tasks.import_policy_s.get_collection() + if len(col) > 0: + for i in col: + i.delete() + + +def set_import_policy_test(request, mgmt_root, name): + def teardown(): + delete_import_policy(mgmt_root) + + exp1 = mgmt_root.tm.asm.tasks.import_policy_s.import_policy \ + .create(filename=F, name=name) + request.addfinalizer(teardown) + return exp1 + + class TestApplyPolicy(object): def test_create_req_arg(self, request, mgmt_root, set_policy): reference = {'link': set_policy} @@ -274,6 +292,79 @@ class TestExportPolicy(object): assert isinstance(sc[0], Export_Policy) +class TestImportPolicy(object): + def test_create_req_arg(self, request, mgmt_root): + imp1 = set_import_policy_test(request, mgmt_root, 'fake_one') + endpoint = str(imp1.id) + base_uri = 'https://localhost/mgmt/tm/asm/tasks/import-policy/' + final_uri = base_uri+endpoint + assert imp1.filename == F + assert imp1.selfLink.startswith(final_uri) + assert imp1.status == 'NEW' + assert imp1.kind == \ + 'tm:asm:tasks:import-policy:import-policy-taskstate' + assert imp1.isBase64 is False + + def test_create_optional_args(self, mgmt_root): + imp1 = mgmt_root.tm.asm.tasks.import_policy_s.import_policy\ + .create(filename=F, isBase64=True, name='fake_one') + endpoint = str(imp1.id) + base_uri = 'https://localhost/mgmt/tm/asm/tasks/import-policy/' + final_uri = base_uri+endpoint + assert imp1.filename == F + assert imp1.selfLink.startswith(final_uri) + assert imp1.status == 'NEW' + assert imp1.kind == \ + 'tm:asm:tasks:import-policy:import-policy-taskstate' + assert imp1.isBase64 is True + + def test_refresh(self, request, mgmt_root): + imp1 = set_import_policy_test(request, mgmt_root, 'fake_one') + imp2 = mgmt_root.tm.asm.tasks.import_policy_s.import_policy\ + .load(id=imp1.id) + assert imp1.selfLink == imp2.selfLink + imp1.refresh() + assert imp1.selfLink == imp2.selfLink + + def test_load_no_object(self, mgmt_root): + with pytest.raises(HTTPError) as err: + mgmt_root.tm.asm.tasks.import_policy_s.import_policy \ + .load(id='Lx3553-321') + assert err.value.response.status_code == 404 + + def test_load(self, request, mgmt_root): + imp1 = set_import_policy_test(request, mgmt_root, 'fake_one') + imp2 = mgmt_root.tm.asm.tasks.import_policy_s.import_policy\ + .load(id=imp1.id) + assert imp1.selfLink == imp2.selfLink + + def test_delete(self, request, mgmt_root): + imp1 = set_import_policy_test(request, mgmt_root, 'fake_one') + hashid = str(imp1.id) + imp1.delete() + with pytest.raises(HTTPError) as err: + mgmt_root.tm.asm.tasks.import_policy_s.import_policy.load( + id=hashid) + assert err.value.response.status_code == 404 + + def test_policy_import_collection(self, request, mgmt_root): + imp1 = set_import_policy_test(request, mgmt_root, 'fake_one') + endpoint = str(imp1.id) + base_uri = 'https://localhost/mgmt/tm/asm/tasks/import-policy/' + final_uri = base_uri+endpoint + assert imp1.filename == F + assert imp1.selfLink.startswith(final_uri) + assert imp1.status == 'NEW' + assert imp1.kind == \ + 'tm:asm:tasks:import-policy:import-policy-taskstate' + assert imp1.isBase64 is False + + sc = mgmt_root.tm.asm.tasks.import_policy_s.get_collection() + assert isinstance(sc, list) + assert len(sc) + assert isinstance(sc[0], Import_Policy) + + class TestCheckSignature(object): def test_fetch(self, mgmt_root): chk1 = mgmt_root.tm.asm.tasks.check_signatures_s.check_signature\ diff --git a/f5/bigip/tm/asm/test/unit/test_tasks.py b/f5/bigip/tm/asm/test/unit/test_tasks.py index 7c4ec1b..be31d1d 100644 --- a/f5/bigip/tm/asm/test/unit/test_tasks.py +++ b/f5/bigip/tm/asm/test/unit/test_tasks.py @@ -19,6 +19,7 @@ from f5.bigip.tm.asm.tasks import Apply_Policy from f5.bigip.tm.asm.tasks import Check_Signature from f5.bigip.tm.asm.tasks import Export_Policy from f5.bigip.tm.asm.tasks import Export_Signature +from f5.bigip.tm.asm.tasks import Import_Policy from f5.bigip.tm.asm.tasks import Update_Signature from f5.sdk_exception import MissingRequiredCreationParameter from f5.sdk_exception import UnsupportedOperation @@ -60,6 +61,14 @@ def FakeExportPolicy(): return fake_exppol [email protected] +def FakeImportPolicy(): + fake_asm = mock.MagicMock() + fake_imppol = Import_Policy(fake_asm) + fake_imppol._meta_data['bigip'].tmos_version = '11.6.0' + return fake_imppol + + @pytest.fixture def FakeUpdateSignature(): fake_asm = mock.MagicMock() @@ -197,3 +206,29 @@ class TestExportPolicy(object): assert kind in list(iterkeys(test_meta)) assert Export_Policy in test_meta2 assert t._meta_data['object_has_stats'] is False + + +class TestImportPolicy(object): + def test_modify_raises(self, FakeImportPolicy): + with pytest.raises(UnsupportedOperation): + FakeImportPolicy.modify() + + def test_create_two(self, fakeicontrolsession): + b = ManagementRoot('192.168.1.1', 'admin', 'admin') + t1 = b.tm.asm.tasks.import_policy_s.import_policy + t2 = b.tm.asm.tasks.import_policy_s.import_policy + assert t1 is t2 + + def test_create_no_args(self, FakeImportPolicy): + with pytest.raises(MissingRequiredCreationParameter): + FakeImportPolicy.create() + + def test_collection(self, fakeicontrolsession): + b = ManagementRoot('192.168.1.1', 'admin', 'admin') + t = b.tm.asm.tasks.import_policy_s + test_meta = t._meta_data['attribute_registry'] + test_meta2 = t._meta_data['allowed_lazy_attributes'] + kind = 'tm:asm:tasks:import-policy:import-policy-taskstate' + assert kind in list(iterkeys(test_meta)) + assert Import_Policy in test_meta2 + assert t._meta_data['object_has_stats'] is False
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 1 }
2.2
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-xdist", "pytest-mock", "pytest-asyncio", "pytest-bdd", "pytest-benchmark", "pytest-randomly", "responses", "mock", "hypothesis", "freezegun", "trustme", "requests-mock", "requests", "tomlkit" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==25.3.0 certifi==2025.1.31 cffi==1.17.1 charset-normalizer==3.4.1 coverage==7.8.0 cryptography==44.0.2 exceptiongroup==1.2.2 execnet==2.1.1 f5-icontrol-rest==1.3.13 -e git+https://github.com/F5Networks/f5-common-python.git@52861aea481189c805419221bd8e98114c364ee6#egg=f5_sdk freezegun==1.5.1 gherkin-official==29.0.0 hypothesis==6.130.6 idna==3.10 importlib_metadata==8.6.1 iniconfig==2.1.0 Mako==1.3.9 MarkupSafe==3.0.2 mock==5.2.0 packaging==24.2 parse==1.20.2 parse_type==0.6.4 pluggy==1.5.0 py-cpuinfo==9.0.0 pycparser==2.22 pytest==8.3.5 pytest-asyncio==0.26.0 pytest-bdd==8.1.0 pytest-benchmark==5.1.0 pytest-cov==6.0.0 pytest-mock==3.14.0 pytest-randomly==3.16.0 pytest-xdist==3.6.1 python-dateutil==2.9.0.post0 PyYAML==6.0.2 requests==2.32.3 requests-mock==1.12.1 responses==0.25.7 six==1.17.0 sortedcontainers==2.4.0 tomli==2.2.1 tomlkit==0.13.2 trustme==1.2.1 typing_extensions==4.13.0 urllib3==2.3.0 zipp==3.21.0
name: f5-common-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==25.3.0 - certifi==2025.1.31 - cffi==1.17.1 - charset-normalizer==3.4.1 - coverage==7.8.0 - cryptography==44.0.2 - exceptiongroup==1.2.2 - execnet==2.1.1 - f5-icontrol-rest==1.3.13 - freezegun==1.5.1 - gherkin-official==29.0.0 - hypothesis==6.130.6 - idna==3.10 - importlib-metadata==8.6.1 - iniconfig==2.1.0 - mako==1.3.9 - markupsafe==3.0.2 - mock==5.2.0 - packaging==24.2 - parse==1.20.2 - parse-type==0.6.4 - pluggy==1.5.0 - py-cpuinfo==9.0.0 - pycparser==2.22 - pytest==8.3.5 - pytest-asyncio==0.26.0 - pytest-bdd==8.1.0 - pytest-benchmark==5.1.0 - pytest-cov==6.0.0 - pytest-mock==3.14.0 - pytest-randomly==3.16.0 - pytest-xdist==3.6.1 - python-dateutil==2.9.0.post0 - pyyaml==6.0.2 - requests==2.32.3 - requests-mock==1.12.1 - responses==0.25.7 - six==1.17.0 - sortedcontainers==2.4.0 - tomli==2.2.1 - tomlkit==0.13.2 - trustme==1.2.1 - typing-extensions==4.13.0 - urllib3==2.3.0 - zipp==3.21.0 prefix: /opt/conda/envs/f5-common-python
[ "f5/bigip/tm/asm/test/unit/test_tasks.py::TestExportSignature::test_create_two", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestExportSignature::test_create_no_args", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestExportSignature::test_modify_raises", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestExportSignature::test_collection", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestTasksOC::test_OC", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestCheckSignature::test_create_raises", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestCheckSignature::test_collection", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestCheckSignature::test_modify_raises", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestExportPolicy::test_collection", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestExportPolicy::test_modify_raises", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestExportPolicy::test_create_no_args", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestExportPolicy::test_create_two", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestUpdateSignature::test_modify_raises", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestUpdateSignature::test_create_raises", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestUpdateSignature::test_collection", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestApplyPolicy::test_create_two", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestApplyPolicy::test_collection", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestApplyPolicy::test_modify_raises", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestApplyPolicy::test_create_no_args", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestImportPolicy::test_modify_raises", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestImportPolicy::test_create_two", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestImportPolicy::test_create_no_args", "f5/bigip/tm/asm/test/unit/test_tasks.py::TestImportPolicy::test_collection" ]
[]
[]
[]
Apache License 2.0
1,002
[ "f5/bigip/tm/asm/tasks.py" ]
[ "f5/bigip/tm/asm/tasks.py" ]
scrapy__scrapy-2530
7dd7646e6563798d408b8062059e826f08256b39
2017-02-03 13:40:44
dfe6d3d59aa3de7a96c1883d0f3f576ba5994aa9
elacuesta: I fixed something that was making the build fail, please check it again @redapple redapple: Regarding tests, I believe you can adapt https://github.com/scrapy/scrapy/blob/master/tests/test_downloadermiddleware_httpproxy.py#L50 and the subsequent ones (i.e. instead of setting proxy as an envvar, set `"proxy"` meta on the request and check Proxy-Auth header value) elacuesta: Oh right, I was thinking about actually performing the requests, but I see now that checking the headers should be enough. Thanks Paul, I'll add tests similar to those 👍 codecov-io: # [Codecov](https://codecov.io/gh/scrapy/scrapy/pull/2530?src=pr&el=h1) Report > Merging [#2530](https://codecov.io/gh/scrapy/scrapy/pull/2530?src=pr&el=desc) into [master](https://codecov.io/gh/scrapy/scrapy/commit/3b8e6d4d820bf69ed3ad2e4d57eb6ca386323a5f?src=pr&el=desc) will **increase** coverage by `-0.02%`. ```diff @@ Coverage Diff @@ ## master #2530 +/- ## ========================================== - Coverage 83.49% 83.48% -0.02% ========================================== Files 161 161 Lines 8787 8792 +5 Branches 1289 1290 +1 ========================================== + Hits 7337 7340 +3 - Misses 1203 1204 +1 - Partials 247 248 +1 ``` | [Impacted Files](https://codecov.io/gh/scrapy/scrapy/pull/2530?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [scrapy/downloadermiddlewares/httpproxy.py](https://codecov.io/gh/scrapy/scrapy/compare/3b8e6d4d820bf69ed3ad2e4d57eb6ca386323a5f...90191a8a0fc87c37b03024baf04e3a9ef1b1d570?src=pr&el=tree#diff-c2NyYXB5L2Rvd25sb2FkZXJtaWRkbGV3YXJlcy9odHRwcHJveHkucHk=) | `95.91% <71.42%> (-4.09%)` | :x: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/scrapy/scrapy/pull/2530?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/scrapy/scrapy/pull/2530?src=pr&el=footer). Last update [3b8e6d4...37d781f](https://codecov.io/gh/scrapy/scrapy/compare/3b8e6d4d820bf69ed3ad2e4d57eb6ca386323a5f...37d781fdf43112e0e74d4fa0d43e2515a51ba3fd?el=footer&src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). elacuesta: Hi @redapple, I included some tests. I still have one doubt though. Should scrapy skip proxies based on `no_proxy` env var even for proxies set on `request.meta`? I think users would expect that explicitly setting a proxy in `meta` would override `no_proxy`, but I would like your opinion on this. Thank you! redapple: I would say that a valid `"proxy"` in `Request.meta` takes precedence over env vars. Documentation probably needs updating/clarifying regarding this. elacuesta: Thanks, I added a few lines to the docs explaining that, please check. Another question, if you don't mind: [this code](https://github.com/scrapy/scrapy/blob/master/scrapy/downloadermiddlewares/httpproxy.py#L23-L24) raises `NotConfigured` if there are no proxies set on `http_proxy`/`https_proxy` env vars, effectively disabling the middleware even for requests with `meta['proxy']`. Should we change that? redapple: Oh, nice catch. Indeed, checking "proxy" meta would require to have the middleware enabled all the time. I don't mind as long as the "no-pxoy set -> skip" case is fast enough. redapple: Another option could be to have an extra setting like `HTTPPROXY_CHECK_REQUEST_META` of some sort, but I am not sure I like it. elacuesta: ``` elif not self.proxies: return ``` after `if 'proxy' in request.meta` in the middleware's `process_request` would skip the processing after only two simple checks, I don't think that would have much performance penalty, what do you think? redapple: `elif not self.proxies` would leave early enough, indeed. elacuesta: What about a setting (like `HTTPPROXY_ENABLED`), allowing to completely disable the middleware? Not sure what should be the default value, though.
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index b95e0bad5..0a8a71e8e 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.3.2 +current_version = 1.3.1 commit = True tag = True tag_name = {new_version} diff --git a/docs/intro/tutorial.rst b/docs/intro/tutorial.rst index 3dc5ad2ed..8e14d1b7c 100644 --- a/docs/intro/tutorial.rst +++ b/docs/intro/tutorial.rst @@ -225,7 +225,7 @@ You will see something like:: [s] shelp() Shell help (print this help) [s] fetch(req_or_url) Fetch request (or URL) and update local objects [s] view(response) View response in a browser - >>> + >>> Using the shell, you can try selecting elements using `CSS`_ with the response object:: @@ -423,7 +423,7 @@ in the callback, as you can see below:: for quote in response.css('div.quote'): yield { 'text': quote.css('span.text::text').extract_first(), - 'author': quote.css('small.author::text').extract_first(), + 'author': quote.css('span small::text').extract_first(), 'tags': quote.css('div.tags a.tag::text').extract(), } @@ -522,7 +522,7 @@ page, extracting data from it:: for quote in response.css('div.quote'): yield { 'text': quote.css('span.text::text').extract_first(), - 'author': quote.css('small.author::text').extract_first(), + 'author': quote.css('span small::text').extract_first(), 'tags': quote.css('div.tags a.tag::text').extract(), } @@ -568,7 +568,7 @@ this time for scraping author information:: def parse(self, response): # follow links to author pages - for href in response.css('.author + a::attr(href)').extract(): + for href in response.css('.author+a::attr(href)').extract(): yield scrapy.Request(response.urljoin(href), callback=self.parse_author) @@ -624,7 +624,7 @@ option when running them:: scrapy crawl quotes -o quotes-humor.json -a tag=humor These arguments are passed to the Spider's ``__init__`` method and become -spider attributes by default. +spider attributes by default. In this example, the value provided for the ``tag`` argument will be available via ``self.tag``. You can use this to make your spider fetch only quotes @@ -647,7 +647,7 @@ with a specific tag, building the URL based on the argument:: for quote in response.css('div.quote'): yield { 'text': quote.css('span.text::text').extract_first(), - 'author': quote.css('small.author::text').extract_first(), + 'author': quote.css('span small a::text').extract_first(), } next_page = response.css('li.next a::attr(href)').extract_first() diff --git a/docs/news.rst b/docs/news.rst index ff1e4ce03..3c1d24561 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -3,16 +3,6 @@ Release notes ============= -Scrapy 1.3.2 (2017-02-13) -------------------------- - -Bug fixes -~~~~~~~~~ - -- Preserve crequest class when converting to/from dicts (utils.reqser) (:issue:`2510`). -- Use consistent selectors for author field in tutorial (:issue:`2551`). -- Fix TLS compatibility in Twisted 17+ (:issue:`2558`) - Scrapy 1.3.1 (2017-02-08) ------------------------- diff --git a/docs/topics/downloader-middleware.rst b/docs/topics/downloader-middleware.rst index 1ca78ccc6..0ef3fb071 100644 --- a/docs/topics/downloader-middleware.rst +++ b/docs/topics/downloader-middleware.rst @@ -681,7 +681,9 @@ HttpProxyMiddleware * ``no_proxy`` You can also set the meta key ``proxy`` per-request, to a value like - ``http://some_proxy_server:port``. + ``http://some_proxy_server:port`` or ``http://username:password@some_proxy_server:port``. + Keep in mind this value will take precedence over ``http_proxy``/``https_proxy`` + environment variables, and it will also ignore ``no_proxy`` environment variable. .. _urllib: https://docs.python.org/2/library/urllib.html .. _urllib2: https://docs.python.org/2/library/urllib2.html @@ -949,8 +951,16 @@ enable it for :ref:`broad crawls <topics-broad-crawls>`. HttpProxyMiddleware settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. setting:: HTTPPROXY_ENABLED .. setting:: HTTPPROXY_AUTH_ENCODING +HTTPPROXY_ENABLED +^^^^^^^^^^^^^^^^^ + +Default: ``True`` + +Whether or not to enable the :class:`HttpProxyMiddleware`. + HTTPPROXY_AUTH_ENCODING ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/scrapy/VERSION b/scrapy/VERSION index 1892b9267..3a3cd8cc8 100644 --- a/scrapy/VERSION +++ b/scrapy/VERSION @@ -1,1 +1,1 @@ -1.3.2 +1.3.1 diff --git a/scrapy/core/downloader/tls.py b/scrapy/core/downloader/tls.py index 498e3d60f..955b7630c 100644 --- a/scrapy/core/downloader/tls.py +++ b/scrapy/core/downloader/tls.py @@ -1,8 +1,6 @@ import logging from OpenSSL import SSL -from scrapy import twisted_version - logger = logging.getLogger(__name__) @@ -20,17 +18,11 @@ openssl_methods = { METHOD_TLSv12: getattr(SSL, 'TLSv1_2_METHOD', 6), # TLS 1.2 only } -if twisted_version >= (14, 0, 0): - # ClientTLSOptions requires a recent-enough version of Twisted. - # Not having ScrapyClientTLSOptions should not matter for older - # Twisted versions because it is not used in the fallback - # ScrapyClientContextFactory. +# ClientTLSOptions requires a recent-enough version of Twisted +try: # taken from twisted/twisted/internet/_sslverify.py - try: - # XXX: this try-except is not needed in Twisted 17.0.0+ because - # it requires pyOpenSSL 0.16+. from OpenSSL.SSL import SSL_CB_HANDSHAKE_DONE, SSL_CB_HANDSHAKE_START except ImportError: SSL_CB_HANDSHAKE_START = 0x10 @@ -38,17 +30,10 @@ if twisted_version >= (14, 0, 0): from twisted.internet.ssl import AcceptableCiphers from twisted.internet._sslverify import (ClientTLSOptions, + _maybeSetHostNameIndication, verifyHostname, VerificationError) - if twisted_version < (17, 0, 0): - from twisted.internet._sslverify import _maybeSetHostNameIndication - set_tlsext_host_name = _maybeSetHostNameIndication - else: - def set_tlsext_host_name(connection, hostNameBytes): - connection.set_tlsext_host_name(hostNameBytes) - - class ScrapyClientTLSOptions(ClientTLSOptions): """ SSL Client connection creator ignoring certificate verification errors @@ -61,7 +46,7 @@ if twisted_version >= (14, 0, 0): def _identityVerifyingInfoCallback(self, connection, where, ret): if where & SSL_CB_HANDSHAKE_START: - set_tlsext_host_name(connection, self._hostnameBytes) + _maybeSetHostNameIndication(connection, self._hostnameBytes) elif where & SSL_CB_HANDSHAKE_DONE: try: verifyHostname(connection, self._hostnameASCII) @@ -77,3 +62,8 @@ if twisted_version >= (14, 0, 0): self._hostnameASCII, repr(e))) DEFAULT_CIPHERS = AcceptableCiphers.fromOpenSSLCipherString('DEFAULT') + +except ImportError: + # ImportError should not matter for older Twisted versions + # as the above is not used in the fallback ScrapyClientContextFactory + pass diff --git a/scrapy/downloadermiddlewares/httpproxy.py b/scrapy/downloadermiddlewares/httpproxy.py index 98c87aa9c..0d5320bf8 100644 --- a/scrapy/downloadermiddlewares/httpproxy.py +++ b/scrapy/downloadermiddlewares/httpproxy.py @@ -20,23 +20,25 @@ class HttpProxyMiddleware(object): for type, url in getproxies().items(): self.proxies[type] = self._get_proxy(url, type) - if not self.proxies: - raise NotConfigured - @classmethod def from_crawler(cls, crawler): + if not crawler.settings.getbool('HTTPPROXY_ENABLED'): + raise NotConfigured auth_encoding = crawler.settings.get('HTTPPROXY_AUTH_ENCODING') return cls(auth_encoding) + def _basic_auth_header(self, username, password): + user_pass = to_bytes( + '%s:%s' % (unquote(username), unquote(password)), + encoding=self.auth_encoding) + return base64.b64encode(user_pass).strip() + def _get_proxy(self, url, orig_type): proxy_type, user, password, hostport = _parse_proxy(url) proxy_url = urlunparse((proxy_type or orig_type, hostport, '', '', '', '')) if user: - user_pass = to_bytes( - '%s:%s' % (unquote(user), unquote(password)), - encoding=self.auth_encoding) - creds = base64.b64encode(user_pass).strip() + creds = self._basic_auth_header(user, password) else: creds = None @@ -45,6 +47,15 @@ class HttpProxyMiddleware(object): def process_request(self, request, spider): # ignore if proxy is already set if 'proxy' in request.meta: + if request.meta['proxy'] is None: + return + # extract credentials if present + creds, proxy_url = self._get_proxy(request.meta['proxy'], '') + request.meta['proxy'] = proxy_url + if creds and not request.headers.get('Proxy-Authorization'): + request.headers['Proxy-Authorization'] = b'Basic ' + creds + return + elif not self.proxies: return parsed = urlparse_cached(request) diff --git a/scrapy/settings/default_settings.py b/scrapy/settings/default_settings.py index 24714a7a8..cb88bc2bf 100644 --- a/scrapy/settings/default_settings.py +++ b/scrapy/settings/default_settings.py @@ -174,6 +174,7 @@ HTTPCACHE_DBM_MODULE = 'anydbm' if six.PY2 else 'dbm' HTTPCACHE_POLICY = 'scrapy.extensions.httpcache.DummyPolicy' HTTPCACHE_GZIP = False +HTTPPROXY_ENABLED = True HTTPPROXY_AUTH_ENCODING = 'latin-1' IMAGES_STORE_S3_ACL = 'private' diff --git a/scrapy/utils/reqser.py b/scrapy/utils/reqser.py index 2fceb0d94..7e1e99e48 100644 --- a/scrapy/utils/reqser.py +++ b/scrapy/utils/reqser.py @@ -5,7 +5,6 @@ import six from scrapy.http import Request from scrapy.utils.python import to_unicode, to_native_str -from scrapy.utils.misc import load_object def request_to_dict(request, spider=None): @@ -33,8 +32,6 @@ def request_to_dict(request, spider=None): 'priority': request.priority, 'dont_filter': request.dont_filter, } - if type(request) is not Request: - d['_class'] = request.__module__ + '.' + request.__class__.__name__ return d @@ -50,8 +47,7 @@ def request_from_dict(d, spider=None): eb = d['errback'] if eb and spider: eb = _get_method(spider, eb) - request_cls = load_object(d['_class']) if '_class' in d else Request - return request_cls( + return Request( url=to_native_str(d['url']), callback=cb, errback=eb, diff --git a/tox.ini b/tox.ini index bbf50b733..0fdea11bb 100644 --- a/tox.ini +++ b/tox.ini @@ -21,16 +21,16 @@ passenv = commands = py.test --cov=scrapy --cov-report= {posargs:scrapy tests} -[testenv:trusty] +[testenv:precise] basepython = python2.7 deps = pyOpenSSL==0.13 - lxml==3.3.3 - Twisted==13.2.0 - boto==2.20.1 - Pillow==2.3.0 + lxml==2.3.2 + Twisted==11.1.0 + boto==2.2.2 + Pillow<2.0 cssselect==0.9.1 - zope.interface==4.0.5 + zope.interface==3.6.1 -rtests/requirements.txt [testenv:jessie]
Scrapy ignores proxy credentials when using "proxy" meta key Code `yield Request(link, meta={'proxy': 'http://user:password@ip:port’})` ignores user:password. Problem is solved by using header "Proxy-Authorization" with base64, but it is better to implement it inside Scrapy.
scrapy/scrapy
diff --git a/tests/test_downloadermiddleware_httpproxy.py b/tests/test_downloadermiddleware_httpproxy.py index 2b26431a4..c77179ceb 100644 --- a/tests/test_downloadermiddleware_httpproxy.py +++ b/tests/test_downloadermiddleware_httpproxy.py @@ -1,11 +1,14 @@ import os import sys +from functools import partial from twisted.trial.unittest import TestCase, SkipTest from scrapy.downloadermiddlewares.httpproxy import HttpProxyMiddleware from scrapy.exceptions import NotConfigured from scrapy.http import Response, Request from scrapy.spiders import Spider +from scrapy.crawler import Crawler +from scrapy.settings import Settings spider = Spider('foo') @@ -20,9 +23,10 @@ class TestDefaultHeadersMiddleware(TestCase): def tearDown(self): os.environ = self._oldenv - def test_no_proxies(self): - os.environ = {} - self.assertRaises(NotConfigured, HttpProxyMiddleware) + def test_not_enabled(self): + settings = Settings({'HTTPPROXY_ENABLED': False}) + crawler = Crawler(spider, settings) + self.assertRaises(NotConfigured, partial(HttpProxyMiddleware.from_crawler, crawler)) def test_no_enviroment_proxies(self): os.environ = {'dummy_proxy': 'reset_env_and_do_not_raise'} @@ -47,6 +51,13 @@ class TestDefaultHeadersMiddleware(TestCase): self.assertEquals(req.url, url) self.assertEquals(req.meta.get('proxy'), proxy) + def test_proxy_precedence_meta(self): + os.environ['http_proxy'] = 'https://proxy.com' + mw = HttpProxyMiddleware() + req = Request('http://scrapytest.org', meta={'proxy': 'https://new.proxy:3128'}) + assert mw.process_request(req, spider) is None + self.assertEquals(req.meta, {'proxy': 'https://new.proxy:3128'}) + def test_proxy_auth(self): os.environ['http_proxy'] = 'https://user:pass@proxy:3128' mw = HttpProxyMiddleware() @@ -54,6 +65,11 @@ class TestDefaultHeadersMiddleware(TestCase): assert mw.process_request(req, spider) is None self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic dXNlcjpwYXNz') + # proxy from request.meta + req = Request('http://scrapytest.org', meta={'proxy': 'https://username:password@proxy:3128'}) + assert mw.process_request(req, spider) is None + self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) + self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic dXNlcm5hbWU6cGFzc3dvcmQ=') def test_proxy_auth_empty_passwd(self): os.environ['http_proxy'] = 'https://user:@proxy:3128' @@ -62,6 +78,11 @@ class TestDefaultHeadersMiddleware(TestCase): assert mw.process_request(req, spider) is None self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic dXNlcjo=') + # proxy from request.meta + req = Request('http://scrapytest.org', meta={'proxy': 'https://username:@proxy:3128'}) + assert mw.process_request(req, spider) is None + self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) + self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic dXNlcm5hbWU6') def test_proxy_auth_encoding(self): # utf-8 encoding @@ -72,6 +93,12 @@ class TestDefaultHeadersMiddleware(TestCase): self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic bcOhbjpwYXNz') + # proxy from request.meta + req = Request('http://scrapytest.org', meta={'proxy': u'https://\u00FCser:pass@proxy:3128'}) + assert mw.process_request(req, spider) is None + self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) + self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic w7xzZXI6cGFzcw==') + # default latin-1 encoding mw = HttpProxyMiddleware(auth_encoding='latin-1') req = Request('http://scrapytest.org') @@ -79,15 +106,21 @@ class TestDefaultHeadersMiddleware(TestCase): self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic beFuOnBhc3M=') + # proxy from request.meta, latin-1 encoding + req = Request('http://scrapytest.org', meta={'proxy': u'https://\u00FCser:pass@proxy:3128'}) + assert mw.process_request(req, spider) is None + self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) + self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic /HNlcjpwYXNz') + def test_proxy_already_seted(self): - os.environ['http_proxy'] = http_proxy = 'https://proxy.for.http:3128' + os.environ['http_proxy'] = 'https://proxy.for.http:3128' mw = HttpProxyMiddleware() req = Request('http://noproxy.com', meta={'proxy': None}) assert mw.process_request(req, spider) is None assert 'proxy' in req.meta and req.meta['proxy'] is None def test_no_proxy(self): - os.environ['http_proxy'] = http_proxy = 'https://proxy.for.http:3128' + os.environ['http_proxy'] = 'https://proxy.for.http:3128' mw = HttpProxyMiddleware() os.environ['no_proxy'] = '*' @@ -104,3 +137,9 @@ class TestDefaultHeadersMiddleware(TestCase): req = Request('http://noproxy.com') assert mw.process_request(req, spider) is None assert 'proxy' not in req.meta + + # proxy from meta['proxy'] takes precedence + os.environ['no_proxy'] = '*' + req = Request('http://noproxy.com', meta={'proxy': 'http://proxy.com'}) + assert mw.process_request(req, spider) is None + self.assertEquals(req.meta, {'proxy': 'http://proxy.com'}) diff --git a/tests/test_utils_reqser.py b/tests/test_utils_reqser.py index 5b889ab5d..a62f13e21 100644 --- a/tests/test_utils_reqser.py +++ b/tests/test_utils_reqser.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import unittest -from scrapy.http import Request, FormRequest +from scrapy.http import Request from scrapy.spiders import Spider from scrapy.utils.reqser import request_to_dict, request_from_dict @@ -42,7 +42,6 @@ class RequestSerializationTest(unittest.TestCase): self._assert_same_request(request, request2) def _assert_same_request(self, r1, r2): - self.assertEqual(r1.__class__, r2.__class__) self.assertEqual(r1.url, r2.url) self.assertEqual(r1.callback, r2.callback) self.assertEqual(r1.errback, r2.errback) @@ -55,12 +54,6 @@ class RequestSerializationTest(unittest.TestCase): self.assertEqual(r1.priority, r2.priority) self.assertEqual(r1.dont_filter, r2.dont_filter) - def test_request_class(self): - r = FormRequest("http://www.example.com") - self._assert_serializes_ok(r, spider=self.spider) - r = CustomRequest("http://www.example.com") - self._assert_serializes_ok(r, spider=self.spider) - def test_callback_serialization(self): r = Request("http://www.example.com", callback=self.spider.parse_item, errback=self.spider.handle_error) @@ -84,7 +77,3 @@ class TestSpider(Spider): def handle_error(self, failure): pass - - -class CustomRequest(Request): - pass
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks", "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 10 }
1.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==25.3.0 Automat==24.8.1 cffi==1.17.1 constantly==23.10.4 cryptography==44.0.2 cssselect==1.3.0 exceptiongroup==1.2.2 hyperlink==21.0.0 idna==3.10 incremental==24.7.2 iniconfig==2.1.0 jmespath==1.0.1 lxml==5.3.1 packaging==24.2 parsel==1.10.0 pluggy==1.5.0 pyasn1==0.6.1 pyasn1_modules==0.4.2 pycparser==2.22 PyDispatcher==2.0.7 pyOpenSSL==25.0.0 pytest==8.3.5 queuelib==1.7.0 -e git+https://github.com/scrapy/scrapy.git@7dd7646e6563798d408b8062059e826f08256b39#egg=Scrapy service-identity==24.2.0 six==1.17.0 tomli==2.2.1 Twisted==24.11.0 typing_extensions==4.13.0 w3lib==2.3.1 zope.interface==7.2
name: scrapy channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==25.3.0 - automat==24.8.1 - cffi==1.17.1 - constantly==23.10.4 - cryptography==44.0.2 - cssselect==1.3.0 - exceptiongroup==1.2.2 - hyperlink==21.0.0 - idna==3.10 - incremental==24.7.2 - iniconfig==2.1.0 - jmespath==1.0.1 - lxml==5.3.1 - packaging==24.2 - parsel==1.10.0 - pluggy==1.5.0 - pyasn1==0.6.1 - pyasn1-modules==0.4.2 - pycparser==2.22 - pydispatcher==2.0.7 - pyopenssl==25.0.0 - pytest==8.3.5 - queuelib==1.7.0 - service-identity==24.2.0 - six==1.17.0 - tomli==2.2.1 - twisted==24.11.0 - typing-extensions==4.13.0 - w3lib==2.3.1 - zope-interface==7.2 prefix: /opt/conda/envs/scrapy
[ "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_proxy_auth", "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_proxy_auth_empty_passwd", "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_proxy_auth_encoding" ]
[]
[ "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_enviroment_proxies", "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_no_enviroment_proxies", "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_no_proxy", "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_not_enabled", "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_proxy_already_seted", "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_proxy_precedence_meta", "tests/test_utils_reqser.py::RequestSerializationTest::test_all_attributes", "tests/test_utils_reqser.py::RequestSerializationTest::test_basic", "tests/test_utils_reqser.py::RequestSerializationTest::test_callback_serialization", "tests/test_utils_reqser.py::RequestSerializationTest::test_latin1_body", "tests/test_utils_reqser.py::RequestSerializationTest::test_unserializable_callback1", "tests/test_utils_reqser.py::RequestSerializationTest::test_unserializable_callback2", "tests/test_utils_reqser.py::RequestSerializationTest::test_utf8_body" ]
[]
BSD 3-Clause "New" or "Revised" License
1,003
[ "docs/topics/downloader-middleware.rst", "scrapy/core/downloader/tls.py", "scrapy/downloadermiddlewares/httpproxy.py", "docs/news.rst", "scrapy/settings/default_settings.py", ".bumpversion.cfg", "docs/intro/tutorial.rst", "tox.ini", "scrapy/VERSION", "scrapy/utils/reqser.py" ]
[ "docs/topics/downloader-middleware.rst", "scrapy/core/downloader/tls.py", "scrapy/downloadermiddlewares/httpproxy.py", "docs/news.rst", "scrapy/settings/default_settings.py", ".bumpversion.cfg", "docs/intro/tutorial.rst", "tox.ini", "scrapy/VERSION", "scrapy/utils/reqser.py" ]
OddBloke__ubuntu-standalone-builder-33
4930aaa0713dd1ea1a7bb598ffcb75de30b2d381
2017-02-03 17:37:45
4930aaa0713dd1ea1a7bb598ffcb75de30b2d381
diff --git a/generate_build_config.py b/generate_build_config.py index 3fcfe42..09a71fe 100755 --- a/generate_build_config.py +++ b/generate_build_config.py @@ -30,7 +30,7 @@ runcmd: - {homedir}/launchpad-buildd/mount-chroot $BUILD_ID - {homedir}/launchpad-buildd/update-debian-chroot $BUILD_ID {ppa_conf} -- {homedir}/launchpad-buildd/buildlivefs --arch amd64 --project ubuntu-cpc --series xenial --build-id $BUILD_ID +- {homedir}/launchpad-buildd/buildlivefs --arch amd64 --project ubuntu-cpc --series xenial --build-id $BUILD_ID --datestamp ubuntu-standalone-builder-$(date +%s) - {homedir}/launchpad-buildd/umount-chroot $BUILD_ID - mkdir {homedir}/images - mv $CHROOT_ROOT/build/livecd.ubuntu-cpc.* {homedir}/images
Set a serial in /etc/cloud/build.info in built images This should make it clear that they are custom-built images.
OddBloke/ubuntu-standalone-builder
diff --git a/tests.py b/tests.py index 5f83236..1b55bfa 100644 --- a/tests.py +++ b/tests.py @@ -65,6 +65,13 @@ class TestWriteCloudConfig(object): assert '- export BUILD_ID=output' in \ write_cloud_config_in_memory().splitlines() + def test_serial_includes_ubuntu_standalone_builder( + self, write_cloud_config_in_memory): + buildlivefs_line = [ + line for line in write_cloud_config_in_memory().splitlines() + if 'buildlivefs' in line][0] + assert '--datestamp ubuntu-standalone-builder' in buildlivefs_line + def test_write_files_not_included_by_default( self, write_cloud_config_in_memory): cloud_config = yaml.load(write_cloud_config_in_memory())
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 1 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-mock", "pyyaml", "six" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 importlib-metadata==4.8.3 iniconfig==1.1.1 packaging==21.3 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 pytest-mock==3.6.1 PyYAML==6.0.1 six==1.17.0 tomli==1.2.3 typing_extensions==4.1.1 -e git+https://github.com/OddBloke/ubuntu-standalone-builder.git@4930aaa0713dd1ea1a7bb598ffcb75de30b2d381#egg=ubuntu_standalone_builder zipp==3.6.0
name: ubuntu-standalone-builder channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-mock==3.6.1 - pyyaml==6.0.1 - six==1.17.0 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/ubuntu-standalone-builder
[ "tests.py::TestWriteCloudConfig::test_serial_includes_ubuntu_standalone_builder" ]
[ "tests.py::TestWriteCloudConfig::test_written_output_is_yaml", "tests.py::TestWriteCloudConfig::test_write_files_not_included_by_default", "tests.py::TestWriteCloudConfig::test_binary_hook_filter_included", "tests.py::TestWriteCloudConfig::test_binary_hook_sequence_is_lower_than_030", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_write_files_stanza_count_produced_for_customisation_script[customisation_script_tmpdir0]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_write_files_stanza_count_produced_for_customisation_script[customisation_script_tmpdir1]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_write_files_stanza_count_produced_for_customisation_script[customisation_script_tmpdir2]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_owned_by_root[customisation_script_tmpdir0]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_owned_by_root[customisation_script_tmpdir1]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_owned_by_root[customisation_script_tmpdir2]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_is_executable_by_root[customisation_script_tmpdir0]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_is_executable_by_root[customisation_script_tmpdir1]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_is_executable_by_root[customisation_script_tmpdir2]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_placed_in_correct_directory[customisation_script_tmpdir0]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_placed_in_correct_directory[customisation_script_tmpdir1]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_placed_in_correct_directory[customisation_script_tmpdir2]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_is_an_appropriate_hook[customisation_script_tmpdir0]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_is_an_appropriate_hook[customisation_script_tmpdir1]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_is_an_appropriate_hook[customisation_script_tmpdir2]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_marked_as_base64[customisation_script_tmpdir0]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_marked_as_base64[customisation_script_tmpdir1]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_marked_as_base64[customisation_script_tmpdir2]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_is_included_in_template_as_base64[customisation_script_tmpdir0]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_is_included_in_template_as_base64[customisation_script_tmpdir1]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_customisation_script_is_included_in_template_as_base64[customisation_script_tmpdir2]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_empty_customisation_script_doesnt_produce_write_files_stanza[customisation_script_tmpdir0]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_empty_customisation_script_doesnt_produce_write_files_stanza[customisation_script_tmpdir1]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_empty_customisation_script_doesnt_produce_write_files_stanza[customisation_script_tmpdir2]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_setup_teardown_sequence_numbers[customisation_script_tmpdir0]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_setup_teardown_sequence_numbers[customisation_script_tmpdir2]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_setup_teardown_content_matches_template[customisation_script_tmpdir0-setup]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_setup_teardown_content_matches_template[customisation_script_tmpdir0-teardown]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_setup_teardown_content_matches_template[customisation_script_tmpdir2-setup]", "tests.py::TestWriteCloudConfigWithCustomisationScript::test_setup_teardown_content_matches_template[customisation_script_tmpdir2-teardown]" ]
[ "tests.py::TestGetPPASnippet::test_unknown_url", "tests.py::TestGetPPASnippet::test_public_ppa", "tests.py::TestGetPPASnippet::test_https_not_private_ppa", "tests.py::TestGetPPASnippet::test_private_ppa_no_key", "tests.py::TestGetPPASnippet::test_private_ppa_with_key", "tests.py::TestWriteCloudConfig::test_writes_to_file", "tests.py::TestWriteCloudConfig::test_written_output_is_cloud_config", "tests.py::TestWriteCloudConfig::test_default_build_id_is_output", "tests.py::TestWriteCloudConfig::test_no_ppa_included_by_default", "tests.py::TestWriteCloudConfig::test_daily_image_used", "tests.py::TestWriteCloudConfig::test_latest_daily_image_used", "tests.py::TestWriteCloudConfig::test_ppa_snippet_included", "tests.py::TestMain::test_main_exits_nonzero_with_too_many_cli_arguments", "tests.py::TestMain::test_main_passes_arguments_to_write_cloud_config" ]
[]
Apache License 2.0
1,004
[ "generate_build_config.py" ]
[ "generate_build_config.py" ]
pre-commit__pre-commit-hooks-172
46251c9523506b68419aefdf5ff6ff2fbc4506a4
2017-02-07 17:38:17
20f04626a1ee7eb34955d775a37aa9a56a0a7448
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f261e54..a3bb7a4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ - repo: https://github.com/pre-commit/pre-commit-hooks - sha: 9ba5af45ce2d29b64c9a348a6fcff5553eea1f2c + sha: v0.7.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -13,12 +13,12 @@ - id: requirements-txt-fixer - id: flake8 - repo: https://github.com/pre-commit/pre-commit - sha: 8dba3281d5051060755459dcf88e28fc26c27526 + sha: v0.12.2 hooks: - id: validate_config - id: validate_manifest - repo: https://github.com/asottile/reorder_python_imports - sha: 3d86483455ab5bd06cc1069fdd5ac57be5463f10 + sha: v0.3.1 hooks: - id: reorder-python-imports language_version: python2.7 diff --git a/pre_commit_hooks/trailing_whitespace_fixer.py b/pre_commit_hooks/trailing_whitespace_fixer.py index fa9b7dd..d23d58d 100644 --- a/pre_commit_hooks/trailing_whitespace_fixer.py +++ b/pre_commit_hooks/trailing_whitespace_fixer.py @@ -10,10 +10,14 @@ from pre_commit_hooks.util import cmd_output def _fix_file(filename, is_markdown): with open(filename, mode='rb') as file_processed: lines = file_processed.readlines() - lines = [_process_line(line, is_markdown) for line in lines] - with open(filename, mode='wb') as file_processed: - for line in lines: - file_processed.write(line) + newlines = [_process_line(line, is_markdown) for line in lines] + if newlines != lines: + with open(filename, mode='wb') as file_processed: + for line in newlines: + file_processed.write(line) + return True + else: + return False def _process_line(line, is_markdown): @@ -55,8 +59,9 @@ def fix_trailing_whitespace(argv=None): parser.error('--markdown-linebreak-ext requires a non-empty argument') all_markdown = '*' in md_args # normalize all extensions; split at ',', lowercase, and force 1 leading '.' - md_exts = ['.' + x.lower().lstrip('.') - for x in ','.join(md_args).split(',')] + md_exts = [ + '.' + x.lower().lstrip('.') for x in ','.join(md_args).split(',') + ] # reject probable "eaten" filename as extension (skip leading '.' with [1:]) for ext in md_exts: @@ -69,10 +74,11 @@ def fix_trailing_whitespace(argv=None): return_code = 0 for bad_whitespace_file in bad_whitespace_files: - print('Fixing {0}'.format(bad_whitespace_file)) _, extension = os.path.splitext(bad_whitespace_file.lower()) - _fix_file(bad_whitespace_file, all_markdown or extension in md_exts) - return_code = 1 + md = all_markdown or extension in md_exts + if _fix_file(bad_whitespace_file, md): + print('Fixing {}'.format(bad_whitespace_file)) + return_code = 1 return return_code
DOS ending files fail, claim they are rewritten, but don't change file contents (trailing-whitespace-fixer)
pre-commit/pre-commit-hooks
diff --git a/tests/trailing_whitespace_fixer_test.py b/tests/trailing_whitespace_fixer_test.py index 3a72ccb..eb2a1d0 100644 --- a/tests/trailing_whitespace_fixer_test.py +++ b/tests/trailing_whitespace_fixer_test.py @@ -20,6 +20,22 @@ def test_fixes_trailing_whitespace(input_s, expected, tmpdir): assert path.read() == expected +def test_ok_with_dos_line_endings(tmpdir): + filename = tmpdir.join('f') + filename.write_binary(b'foo\r\nbar\r\nbaz\r\n') + ret = fix_trailing_whitespace((filename.strpath,)) + assert filename.read_binary() == b'foo\r\nbar\r\nbaz\r\n' + assert ret == 0 + + +def test_markdown_ok(tmpdir): + filename = tmpdir.join('foo.md') + filename.write_binary(b'foo \n') + ret = fix_trailing_whitespace((filename.strpath,)) + assert filename.read_binary() == b'foo \n' + assert ret == 0 + + # filename, expected input, expected output MD_TESTS_1 = ( ('foo.md', 'foo \nbar \n ', 'foo \nbar\n\n'),
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 0 }, "num_modified_files": 2 }
0.7
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": [ "requirements-dev.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 autopep8==2.0.4 certifi==2021.5.30 cfgv==3.3.1 coverage==6.2 distlib==0.3.9 filelock==3.4.1 flake8==2.5.5 identify==2.4.4 importlib-metadata==4.2.0 importlib-resources==5.2.3 iniconfig==1.1.1 mccabe==0.4.0 mock==5.2.0 nodeenv==1.6.0 packaging==21.3 pep8==1.7.1 platformdirs==2.4.0 pluggy==1.0.0 pre-commit==2.17.0 -e git+https://github.com/pre-commit/pre-commit-hooks.git@46251c9523506b68419aefdf5ff6ff2fbc4506a4#egg=pre_commit_hooks py==1.11.0 pycodestyle==2.10.0 pyflakes==1.0.0 pyparsing==3.1.4 pytest==7.0.1 PyYAML==6.0.1 simplejson==3.20.1 six==1.17.0 toml==0.10.2 tomli==1.2.3 typing_extensions==4.1.1 virtualenv==20.16.2 zipp==3.6.0
name: pre-commit-hooks channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - autopep8==2.0.4 - cfgv==3.3.1 - coverage==6.2 - distlib==0.3.9 - filelock==3.4.1 - flake8==2.5.5 - identify==2.4.4 - importlib-metadata==4.2.0 - importlib-resources==5.2.3 - iniconfig==1.1.1 - mccabe==0.4.0 - mock==5.2.0 - nodeenv==1.6.0 - packaging==21.3 - pep8==1.7.1 - platformdirs==2.4.0 - pluggy==1.0.0 - pre-commit==2.17.0 - py==1.11.0 - pycodestyle==2.10.0 - pyflakes==1.0.0 - pyparsing==3.1.4 - pytest==7.0.1 - pyyaml==6.0.1 - simplejson==3.20.1 - six==1.17.0 - toml==0.10.2 - tomli==1.2.3 - typing-extensions==4.1.1 - virtualenv==20.16.2 - zipp==3.6.0 prefix: /opt/conda/envs/pre-commit-hooks
[ "tests/trailing_whitespace_fixer_test.py::test_ok_with_dos_line_endings", "tests/trailing_whitespace_fixer_test.py::test_markdown_ok" ]
[]
[ "tests/trailing_whitespace_fixer_test.py::test_fixes_trailing_whitespace[foo", "tests/trailing_whitespace_fixer_test.py::test_fixes_trailing_whitespace[bar\\t\\nbaz\\t\\n-bar\\nbaz\\n]", "tests/trailing_whitespace_fixer_test.py::test_fixes_trailing_markdown_whitespace[foo.md-foo", "tests/trailing_whitespace_fixer_test.py::test_fixes_trailing_markdown_whitespace[bar.Markdown-bar", "tests/trailing_whitespace_fixer_test.py::test_fixes_trailing_markdown_whitespace[.md-baz", "tests/trailing_whitespace_fixer_test.py::test_fixes_trailing_markdown_whitespace[txt-foo", "tests/trailing_whitespace_fixer_test.py::test_markdown_linebreak_ext_opt[foo.txt-foo", "tests/trailing_whitespace_fixer_test.py::test_markdown_linebreak_ext_opt[bar.Markdown-bar", "tests/trailing_whitespace_fixer_test.py::test_markdown_linebreak_ext_opt[bar.MD-bar", "tests/trailing_whitespace_fixer_test.py::test_markdown_linebreak_ext_opt[.txt-baz", "tests/trailing_whitespace_fixer_test.py::test_markdown_linebreak_ext_opt[txt-foo", "tests/trailing_whitespace_fixer_test.py::test_markdown_linebreak_ext_opt_all[foo.baz-foo", "tests/trailing_whitespace_fixer_test.py::test_markdown_linebreak_ext_opt_all[bar-bar", "tests/trailing_whitespace_fixer_test.py::test_markdown_linebreak_ext_badopt[--]", "tests/trailing_whitespace_fixer_test.py::test_markdown_linebreak_ext_badopt[a.b]", "tests/trailing_whitespace_fixer_test.py::test_markdown_linebreak_ext_badopt[a/b]", "tests/trailing_whitespace_fixer_test.py::test_no_markdown_linebreak_ext_opt[bar.md-bar", "tests/trailing_whitespace_fixer_test.py::test_no_markdown_linebreak_ext_opt[bar.markdown-baz", "tests/trailing_whitespace_fixer_test.py::test_returns_zero_for_no_changes", "tests/trailing_whitespace_fixer_test.py::test_preserve_non_utf8_file" ]
[]
MIT License
1,005
[ "pre_commit_hooks/trailing_whitespace_fixer.py", ".pre-commit-config.yaml" ]
[ "pre_commit_hooks/trailing_whitespace_fixer.py", ".pre-commit-config.yaml" ]
google__mobly-107
b4362eda0c8148644812849cdb9c741e35d5750d
2017-02-07 20:40:24
b4362eda0c8148644812849cdb9c741e35d5750d
adorokhine: Review status: 0 of 2 files reviewed at latest revision, 7 unresolved discussions, some commit checks failed. --- *[mobly/controllers/android_device.py, line 155 at r1](https://reviewable.io:443/reviews/google/mobly/107#-KcVCw_pSPnznkgrgh2R:-KcVCw_pSPnznkgrgh2S:bp84v0n) ([raw file](https://github.com/google/mobly/blob/cc3837b019da67485846e10e4b65d2a80c7779b1/mobly/controllers/android_device.py#L155)):* > ```Python > else: > ad.log.exception('Skipping this optional device because some ' > 'services failed to start: %s', e) > ``` for ad.log.exception, exception is automatically logged so don't need %s, e --- *[mobly/controllers/android_device.py, line 242 at r1](https://reviewable.io:443/reviews/google/mobly/107#-KcVDCYP1feDwGCUUqvJ:-KcVDCYP1feDwGCUUqvK:bnrq4kl) ([raw file](https://github.com/google/mobly/blob/cc3837b019da67485846e10e4b65d2a80c7779b1/mobly/controllers/android_device.py#L242)):* > ```Python > if is_required: > raise > ad.log.warning('Skipping this optional device due to error.') > ``` You no longer need to say what error it was? --- *[mobly/controllers/android_device.py, line 376 at r1](https://reviewable.io:443/reviews/google/mobly/107#-KcVDfbkUdqpf3kzfjrO:-KcVDfblO3BELNVkZXmf:bleaqiq) ([raw file](https://github.com/google/mobly/blob/cc3837b019da67485846e10e4b65d2a80c7779b1/mobly/controllers/android_device.py#L376)):* > ```Python > self.log = AndroidDeviceLoggerAdapter(logging.getLogger(), > {'tag': self.serial}) > self.Error = _generate_error_class(self.log.extra['tag']) > ``` How do we extend this? ie to differentiate bluetooth_utils.Error('Device failed to connect') from wifi_utils.Error('Device failed to connect')? --- *[mobly/controllers/android_device.py, line 394 at r1](https://reviewable.io:443/reviews/google/mobly/107#-KcVDrQVJzkuY5hYCRvK:-KcVDrQWBf3vvpGCtl44:b9kun1o) ([raw file](https://github.com/google/mobly/blob/cc3837b019da67485846e10e4b65d2a80c7779b1/mobly/controllers/android_device.py#L394)):* > ```Python > > By default, the tag is the serial of the device, but sometimes it may > be more descriptive to use a different tag of the user's choose. > ``` The user's choose --- *[mobly/controllers/android_device.py, line 399 at r1](https://reviewable.io:443/reviews/google/mobly/107#-KcVDunSLydX9J8zUmvx:-KcVDunTNMJzCxXETSMi:bpstgh1) ([raw file](https://github.com/google/mobly/blob/cc3837b019da67485846e10e4b65d2a80c7779b1/mobly/controllers/android_device.py#L399)):* > ```Python > By default, the device's serial number is used: > 'INFO [AndroidDevice|abcdefg12345] One pending call ringing.' > By calling `ad.set_prefix_tag('Caller')`, the user can customize the > ``` Doesn't match the actual method name --- *[mobly/controllers/android_device.py, line 516 at r1](https://reviewable.io:443/reviews/google/mobly/107#-KcVEA9hEnvBdvpK7Uy0:-KcVEA9i99rP1NP-sBx6:b-gwoogj) ([raw file](https://github.com/google/mobly/blob/cc3837b019da67485846e10e4b65d2a80c7779b1/mobly/controllers/android_device.py#L516)):* > ```Python > if hasattr(self, k): > raise self.Error( > 'Attribute %s already exists, cannot set again.') > ``` %s not formatted? --- *[mobly/controllers/android_device.py, line 548 at r1](https://reviewable.io:443/reviews/google/mobly/107#-KcVEFCMxb274QhQcAZk:-KcVEFCMxb274QhQcAZl:buqy7ru) ([raw file](https://github.com/google/mobly/blob/cc3837b019da67485846e10e4b65d2a80c7779b1/mobly/controllers/android_device.py#L548)):* > ```Python > # Should not load snippet with the same attribute more than once. > if name in self._snippet_clients: > raise self.Error( > ``` We're now no longer telling the user this was a SnippetError. Can we have that back? That was useful info --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/107)* <!-- Sent from Reviewable.io --> xpconanfan: Review status: 0 of 2 files reviewed at latest revision, 7 unresolved discussions, some commit checks failed. --- *[mobly/controllers/android_device.py, line 155 at r1](https://reviewable.io:443/reviews/google/mobly/107#-KcVCw_pSPnznkgrgh2R:-KcVIGVZ1M0fEhtj8uHg:bb6un1j) ([raw file](https://github.com/google/mobly/blob/cc3837b019da67485846e10e4b65d2a80c7779b1/mobly/controllers/android_device.py#L155)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> for ad.log.exception, exception is automatically logged so don't need %s, e </blockquote></details> Done --- *[mobly/controllers/android_device.py, line 242 at r1](https://reviewable.io:443/reviews/google/mobly/107#-KcVDCYP1feDwGCUUqvJ:-KcVIHA27Gfg84-lzuEe:bb6un1j) ([raw file](https://github.com/google/mobly/blob/cc3837b019da67485846e10e4b65d2a80c7779b1/mobly/controllers/android_device.py#L242)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> You no longer need to say what error it was? </blockquote></details> Done --- *[mobly/controllers/android_device.py, line 376 at r1](https://reviewable.io:443/reviews/google/mobly/107#-KcVDfbkUdqpf3kzfjrO:-KcVII98a20SRjzLUpPf:b-eo07wu) ([raw file](https://github.com/google/mobly/blob/cc3837b019da67485846e10e4b65d2a80c7779b1/mobly/controllers/android_device.py#L376)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> How do we extend this? ie to differentiate bluetooth_utils.Error('Device failed to connect') from wifi_utils.Error('Device failed to connect')? </blockquote></details> How do we differentiate today? Doesn't seem to be a problem specific to this change? --- *[mobly/controllers/android_device.py, line 394 at r1](https://reviewable.io:443/reviews/google/mobly/107#-KcVDrQVJzkuY5hYCRvK:-KcVI_MWa3Jpzx6ykOBi:bb6un1j) ([raw file](https://github.com/google/mobly/blob/cc3837b019da67485846e10e4b65d2a80c7779b1/mobly/controllers/android_device.py#L394)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> The user's choose </blockquote></details> Done --- *[mobly/controllers/android_device.py, line 399 at r1](https://reviewable.io:443/reviews/google/mobly/107#-KcVDunSLydX9J8zUmvx:-KcVId1q8qOl7N3Jxw2l:bb6un1j) ([raw file](https://github.com/google/mobly/blob/cc3837b019da67485846e10e4b65d2a80c7779b1/mobly/controllers/android_device.py#L399)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> Doesn't match the actual method name </blockquote></details> Done --- *[mobly/controllers/android_device.py, line 516 at r1](https://reviewable.io:443/reviews/google/mobly/107#-KcVEA9hEnvBdvpK7Uy0:-KcVIrgY5f6BwcnuLuqN:bb6un1j) ([raw file](https://github.com/google/mobly/blob/cc3837b019da67485846e10e4b65d2a80c7779b1/mobly/controllers/android_device.py#L516)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> %s not formatted? </blockquote></details> Done --- *[mobly/controllers/android_device.py, line 548 at r1](https://reviewable.io:443/reviews/google/mobly/107#-KcVEFCMxb274QhQcAZk:-KcVNHQV5CbkJ4abKyvA:bb6un1j) ([raw file](https://github.com/google/mobly/blob/cc3837b019da67485846e10e4b65d2a80c7779b1/mobly/controllers/android_device.py#L548)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> We're now no longer telling the user this was a SnippetError. Can we have that back? That was useful info </blockquote></details> Done --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/107)* <!-- Sent from Reviewable.io --> xpconanfan: Ping adorokhine: Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. --- *[mobly/controllers/android_device.py, line 55 at r3](https://reviewable.io:443/reviews/google/mobly/107#-Keb5oHRIXDbUc-naq49:-Keb5oHS8h-BZPo1EXCv:b-f06rqw) ([raw file](https://github.com/google/mobly/blob/d5e96ea3a401277d359d8c1456785b92a0b63067/mobly/controllers/android_device.py#L55)):* > ```Python > > > def _generate_error_class(tag, error_name): > ``` Instead of doing this complex exception class manipulation which doesn't help users, can we just change `__repr__` to the log tag so you can throw it into arbitrary exceptions? `raise MyException(ad, 'Something bad happened')` --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/107)* <!-- Sent from Reviewable.io --> xpconanfan: Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. --- *[mobly/controllers/android_device.py, line 55 at r3](https://reviewable.io:443/reviews/google/mobly/107#-Keb5oHRIXDbUc-naq49:-KebAO3RWIqxxqQPPpfB:bhhmiss) ([raw file](https://github.com/google/mobly/blob/d5e96ea3a401277d359d8c1456785b92a0b63067/mobly/controllers/android_device.py#L55)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> Instead of doing this complex exception class manipulation which doesn't help users, can we just change `__repr__` to the log tag so you can throw it into arbitrary exceptions? `raise MyException(ad, 'Something bad happened')` </blockquote></details> I tried and we can't. `repr` value does not change. --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/107)* <!-- Sent from Reviewable.io --> adorokhine: Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. --- *[mobly/controllers/android_device.py, line 55 at r3](https://reviewable.io:443/reviews/google/mobly/107#-Keb5oHRIXDbUc-naq49:-KebOVg6c_pBFQA-l3k-:b-jhayew) ([raw file](https://github.com/google/mobly/blob/d5e96ea3a401277d359d8c1456785b92a0b63067/mobly/controllers/android_device.py#L55)):* <details><summary><i>Previously, xpconanfan (Ang Li) wrote…</i></summary><blockquote> I tried and we can't. `repr` value does not change. </blockquote></details> I'm not sure what you mean by 'repr value does not change'? Mind sharing a code snippet of what you tried? --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/107)* <!-- Sent from Reviewable.io --> xpconanfan: Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. --- *[mobly/controllers/android_device.py, line 55 at r3](https://reviewable.io:443/reviews/google/mobly/107#-Keb5oHRIXDbUc-naq49:-KebSuS1J4wwPaF5NQbK:b-ie466z) ([raw file](https://github.com/google/mobly/blob/d5e96ea3a401277d359d8c1456785b92a0b63067/mobly/controllers/android_device.py#L55)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> I'm not sure what you mean by 'repr value does not change'? Mind sharing a code snippet of what you tried? </blockquote></details> Nvm, there was a bug in the code I used to try. Done --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/107)* <!-- Sent from Reviewable.io --> adorokhine: Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. --- *[mobly/controllers/android_device.py, line 53 at r4](https://reviewable.io:443/reviews/google/mobly/107#-KeeYOfb4WvMXMwaepwT:-KeeYOfcs0OskUJpoPSt:buscggs) ([raw file](https://github.com/google/mobly/blob/c287393948cb53d2fedfcfd062092705578f593e/mobly/controllers/android_device.py#L53)):* > ```Python > > > class DeviceError(Error): > ``` DeviceError shouldn't be necessary at all after the __repr__ implementation, so let's simplify by removing it and just throwing a regular exception like users would do it. It'll be a good example to follow. --- *[mobly/controllers/android_device.py, line 408 at r4](https://reviewable.io:443/reviews/google/mobly/107#-KeeYChvRdxHpIQ4RRik:-KeeYChwGzsdZ85Fpw19:bnn81je) ([raw file](https://github.com/google/mobly/blob/c287393948cb53d2fedfcfd062092705578f593e/mobly/controllers/android_device.py#L408)):* > ```Python > By default, the device's serial number is used: > 'INFO [AndroidDevice|abcdefg12345] One pending call ringing.' > By calling `ad.set_debug_tag('Caller')`, the user can customize the > ``` Is it set_debug_tag? Or just debug_tag('caller')? --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/107)* <!-- Sent from Reviewable.io --> xpconanfan: Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. --- *[mobly/controllers/android_device.py, line 53 at r4](https://reviewable.io:443/reviews/google/mobly/107#-KeeYOfb4WvMXMwaepwT:-KeeZDHIj56_yGLokelk:b-ho4n7x) ([raw file](https://github.com/google/mobly/blob/c287393948cb53d2fedfcfd062092705578f593e/mobly/controllers/android_device.py#L53)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> DeviceError shouldn't be necessary at all after the __repr__ implementation, so let's simplify by removing it and just throwing a regular exception like users would do it. It'll be a good example to follow. </blockquote></details> I specifically want this error class so the msg is easier to read. The default repr msg is quite ugly since it's just a tuple of reprs. I want msg from AndroidDevice object to be cleaner than that. Also this error serves as a distinction between errors from `android_device` module and `AndroidDevice` class. --- *[mobly/controllers/android_device.py, line 408 at r4](https://reviewable.io:443/reviews/google/mobly/107#-KeeYChvRdxHpIQ4RRik:-Kee_DhNzRaTFzGFT9Ru:b-896fix) ([raw file](https://github.com/google/mobly/blob/c287393948cb53d2fedfcfd062092705578f593e/mobly/controllers/android_device.py#L408)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> Is it set_debug_tag? Or just debug_tag('caller')? </blockquote></details> Done. --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/107)* <!-- Sent from Reviewable.io --> adorokhine: Reviewed 1 of 2 files at r4, 3 of 3 files at r5. Review status: all files reviewed at latest revision, 8 unresolved discussions. --- *[mobly/controllers/android_device.py, line 53 at r4](https://reviewable.io:443/reviews/google/mobly/107#-KeeYOfb4WvMXMwaepwT:-Kf9MrMjYIpNn_oii9kS:b-1pjh3z) ([raw file](https://github.com/google/mobly/blob/c287393948cb53d2fedfcfd062092705578f593e/mobly/controllers/android_device.py#L53)):* <details><summary><i>Previously, xpconanfan (Ang Li) wrote…</i></summary><blockquote> I specifically want this error class so the msg is easier to read. The default repr msg is quite ugly since it's just a tuple of reprs. I want msg from AndroidDevice object to be cleaner than that. Also this error serves as a distinction between errors from `android_device` module and `AndroidDevice` class. </blockquote></details> Sure, if it's just a regular exception not meant for introspective/dynamic manipulation can we drop the generic *args and just make it a regular exception with `__init__(self, ad, msg)`, and drop the massaging of the args tuple? --- *[mobly/controllers/android_device.py, line 92 at r5](https://reviewable.io:443/reviews/google/mobly/107#-Kf9N9ojBOB2HUR5U8_C:-Kf9N9ojBOB2HUR5U8_D:b-9v83il) ([raw file](https://github.com/google/mobly/blob/286b1966226f81b00ffb562cb660f6ef8254877d/mobly/controllers/android_device.py#L92)):* > ```Python > for ad in ads: > if ad.serial not in connected_ads: > raise ad._error('Android device is specified in config but is not ' > ``` Does ad._error still exist? Directly raising the exception is preferred from my side. --- *[mobly/controllers/android_device.py, line 383 at r5](https://reviewable.io:443/reviews/google/mobly/107#-Kf9O1dtGo40qBoVR8If:-Kf9O1duz07yq2S8swhh:b-5xklzx) ([raw file](https://github.com/google/mobly/blob/286b1966226f81b00ffb562cb660f6ef8254877d/mobly/controllers/android_device.py#L383)):* > ```Python > > def __repr__(self): > return "<AndroidDevice|%s>" % self.debug_tag > ``` Copy of LOG_TAG_TEMPLATE but with different choice of brackets? We should just reuse LOG_TAG_TEMPLATE for this. --- *[mobly/controllers/android_device.py, line 686 at r5](https://reviewable.io:443/reviews/google/mobly/107#-Kf9OPNaZO5YL36F6EF4:-Kf9OPNb9iEkdO2Eecin:b9i1bsi) ([raw file](https://github.com/google/mobly/blob/286b1966226f81b00ffb562cb660f6ef8254877d/mobly/controllers/android_device.py#L686)):* > ```Python > """ > if not self.adb_logcat_file_path: > raise DeviceError(self, > ``` Trailing whitespace, here and elsewhere. Is this what yapf produced? --- *[mobly/controllers/android_device.py, line 900 at r5](https://reviewable.io:443/reviews/google/mobly/107#-Kf9Ok5GnXdu4dmnRKAE:-Kf9Ok5GnXdu4dmnRKAF:b49kzb9) ([raw file](https://github.com/google/mobly/blob/286b1966226f81b00ffb562cb660f6ef8254877d/mobly/controllers/android_device.py#L900)):* > ```Python > > def process(self, msg, kwargs): > msg = _LOG_TAG_TEMPLATE % (self.extra['tag'], msg) > ``` Would it be wise to stop distinguishing between the prefix and tag and just let the user supply the whole thing? If someone extended AndroidDevice they'd be unable to change the class name currently. Plus the documentation is confusing this way because tag and prefix and related but not quite the same. --- *[mobly/controllers/android_device_lib/jsonrpc_client_base.py, line 191 at r5](https://reviewable.io:443/reviews/google/mobly/107#-Kf9P8mHjksbul80CbWP:-Kf9P8mHjksbul80CbWQ:b-26gels) ([raw file](https://github.com/google/mobly/blob/286b1966226f81b00ffb562cb660f6ef8254877d/mobly/controllers/android_device_lib/jsonrpc_client_base.py#L191)):* > ```Python > raise AppStartError('%s failed to start on %s.' % > (self.app_name, self._adb.serial)) > self.log.debug('Successfully started %s', self.app_name) > ``` This will never execute --- *[tests/mobly/controllers/android_device_test.py, line 421 at r5](https://reviewable.io:443/reviews/google/mobly/107#-Kf9PGC6BdGrKQymsST_:-Kf9PGC6BdGrKQymsSTa:bqugfe1) ([raw file](https://github.com/google/mobly/blob/286b1966226f81b00ffb562cb660f6ef8254877d/tests/mobly/controllers/android_device_test.py#L421)):* > ```Python > self.assertFalse(hasattr(ad, 'snippet')) > > @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy', return_value=mock_android_device.MockAdbProxy(1)) > ``` Has this been through yapf? --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/107)* <!-- Sent from Reviewable.io -->
diff --git a/mobly/controllers/android_device.py b/mobly/controllers/android_device.py index afe5a79..79d3f16 100644 --- a/mobly/controllers/android_device.py +++ b/mobly/controllers/android_device.py @@ -35,6 +35,7 @@ from mobly.controllers.android_device_lib import snippet_client MOBLY_CONTROLLER_CONFIG_NAME = 'AndroidDevice' ANDROID_DEVICE_PICK_ALL_TOKEN = '*' +_DEBUG_PREFIX_TEMPLATE = '[AndroidDevice|%s] %s' # Key name for adb logcat extra params in config file. ANDROID_DEVICE_ADB_LOGCAT_PARAM_KEY = 'adb_logcat_param' @@ -49,12 +50,16 @@ class Error(signals.ControllerError): pass -class SnippetError(signals.ControllerError): - """Raised when somethig wrong with snippet happens.""" +class DeviceError(Error): + """Raised for errors from within an AndroidDevice object.""" + def __init__(self, ad, msg): + new_msg = '%s %s' % (repr(ad), msg) + super(DeviceError, self).__init__(new_msg) -class DoesNotExistError(Error): - """Raised when something that does not exist is referenced.""" + +class SnippetError(DeviceError): + """Raised for errors related to Mobly snippet.""" def create(configs): @@ -83,8 +88,8 @@ def create(configs): for ad in ads: if ad.serial not in connected_ads: - raise DoesNotExistError('Android device %s is specified in config' - ' but is not attached.' % ad.serial) + raise DeviceError(ad, 'Android device is specified in config but ' + ' is not attached.') _start_services_on_ads(ads) return ads @@ -133,15 +138,15 @@ def _start_services_on_ads(ads): running_ads.append(ad) try: ad.start_services() - except Exception as e: + except Exception: is_required = getattr(ad, KEY_DEVICE_REQUIRED, True) if is_required: ad.log.exception('Failed to start some services, abort!') destroy(running_ads) raise else: - logging.warning('Skipping device %s because some service ' - 'failed to start: %s', ad.serial, e) + ad.log.exception('Skipping this optional device because some ' + 'services failed to start.') def _parse_device_list(device_list_str, key): @@ -225,10 +230,10 @@ def get_instances_with_configs(configs): try: ad = AndroidDevice(serial) ad.load_config(c) - except Exception as e: + except Exception: if is_required: raise - logging.warning('Skipping device %s due to error: %s', serial, e) + ad.log.exception('Skipping this optional device due to error.') continue results.append(ad) return results @@ -344,8 +349,8 @@ class AndroidDevice(object): android device should be stored. log: A logger adapted from root logger with an added prefix specific to an AndroidDevice instance. The default prefix is - [AndroidDevice|<serial>]. Use self.set_logger_prefix_tag to use - a different tag in the prefix. + [AndroidDevice|<serial>]. Use self.set_debug_tag to use a + different tag in the prefix. adb_logcat_file_path: A string that's the full path to the adb logcat file collected, if any. adb: An AdbProxy object used for interacting with the device via adb. @@ -358,8 +363,9 @@ class AndroidDevice(object): # logging.log_path only exists when this is used in an Mobly test run. log_path_base = getattr(logging, 'log_path', '/tmp/logs') self.log_path = os.path.join(log_path_base, 'AndroidDevice%s' % serial) + self._debug_tag = self.serial self.log = AndroidDeviceLoggerAdapter(logging.getLogger(), - {'tag': self.serial}) + {'tag': self.debug_tag}) self.sl4a = None self.ed = None self._adb_logcat_process = None @@ -372,22 +378,36 @@ class AndroidDevice(object): # names, values are the clients: {<attr name string>: <client object>}. self._snippet_clients = {} - def set_logger_prefix_tag(self, tag): - """Set a tag for the log line prefix of this instance. + def __repr__(self): + return "<AndroidDevice|%s>" % self.debug_tag - By default, the tag is the serial of the device, but sometimes having - the serial number in the log line doesn't help much with debugging. It - could be more helpful if users can mark the role of the device instead. + @property + def debug_tag(self): + """A string that represents a device object in debug info. Default value + is the device serial. - For example, instead of marking the serial number: - 'INFO [AndroidDevice|abcdefg12345] One pending call ringing.' + This will be used as part of the prefix of debugging messages emitted by + this device object, like log lines and the message of DeviceError. + """ + return self._debug_tag - marking the role of the device here is more useful here: - 'INFO [AndroidDevice|Caller] One pending call ringing.' + @debug_tag.setter + def debug_tag(self, tag): + """Setter for the debug tag. - Args: - tag: A string that is the tag to use. + By default, the tag is the serial of the device, but sometimes it may + be more descriptive to use a different tag of the user's choice. + + Changing debug tag changes part of the prefix of debug info emitted by + this object, like log lines and the message of DeviceError. + + Example: + By default, the device's serial number is used: + 'INFO [AndroidDevice|abcdefg12345] One pending call ringing.' + The tag can be customized with `ad.debug_tag = 'Caller'`: + 'INFO [AndroidDevice|Caller] One pending call ringing.' """ + self._debug_tag = tag self.log.extra['tag'] = tag def start_services(self): @@ -542,8 +562,9 @@ class AndroidDevice(object): """ for k, v in config.items(): if hasattr(self, k): - raise Error('Attempting to set existing attribute %s on %s' % - (k, self.serial)) + raise DeviceError(self, ( + 'Attribute %s already exists with value %s, cannot set ' + 'again.') % (k, getattr(self, k))) setattr(self, k, v) def root_adb(self): @@ -576,17 +597,21 @@ class AndroidDevice(object): # Should not load snippet with the same attribute more than once. if name in self._snippet_clients: raise SnippetError( + self, 'Attribute "%s" is already registered with package "%s", it ' 'cannot be used again.' % (name, self._snippet_clients[name].package)) # Should not load snippet with an existing attribute. if hasattr(self, name): - raise SnippetError('Attribute "%s" already exists, please use a ' - 'different name.' % name) + raise SnippetError( + self, + 'Attribute "%s" already exists, please use a different name.' % + name) # Should not load the same snippet package more than once. for client_name, client in self._snippet_clients.items(): if package == client.package: raise SnippetError( + self, 'Snippet package "%s" has already been loaded under name' ' "%s".' % (package, client_name)) host_port = utils.get_available_host_port() @@ -660,9 +685,9 @@ class AndroidDevice(object): period. """ if not self.adb_logcat_file_path: - raise Error( - 'Attempting to cat adb log when none has been collected on ' - 'Android device %s.' % self.serial) + raise DeviceError( + self, + 'Attempting to cat adb log when none has been collected.') end_time = mobly_logger.get_log_line_timestamp() self.log.debug('Extracting adb log from logcat.') adb_excerpt_path = os.path.join(self.log_path, 'AdbLogExcerpts') @@ -704,8 +729,9 @@ class AndroidDevice(object): save the logcat in a file. """ if self._adb_logcat_process: - raise Error('Android device %s already has an adb logcat thread ' - 'going on. Cannot start another one.' % self.serial) + raise DeviceError( + self, + 'Logcat thread is already running, cannot start another one.') # Disable adb log spam filter for rootable. Have to stop and clear # settings first because 'start' doesn't support --clear option before # Android N. @@ -728,9 +754,7 @@ class AndroidDevice(object): """Stops the adb logcat collection subprocess. """ if not self._adb_logcat_process: - raise Error( - 'Android device %s does not have an ongoing adb logcat ' - 'collection.' % self.serial) + raise DeviceError(self, 'No ongoing adb logcat collection found.') utils.stop_standing_subprocess(self._adb_logcat_process) self._adb_logcat_process = None @@ -764,8 +788,7 @@ class AndroidDevice(object): if new_br: out = self.adb.shell('bugreportz').decode('utf-8') if not out.startswith('OK'): - raise Error('Failed to take bugreport on %s: %s' % - (self.serial, out)) + raise DeviceError(self, 'Failed to take bugreport: %s' % out) br_out_path = out.split(':')[1].strip() self.adb.pull('%s %s' % (br_out_path, full_out_path)) else: @@ -826,7 +849,7 @@ class AndroidDevice(object): # process, which is normal. Ignoring these errors. pass time.sleep(5) - raise Error('Device %s booting process timed out.' % self.serial) + raise DeviceError(self, 'Booting process timed out.') def _get_active_snippet_info(self): """Collects information on currently active snippet clients. @@ -878,5 +901,5 @@ class AndroidDeviceLoggerAdapter(logging.LoggerAdapter): """ def process(self, msg, kwargs): - msg = '[AndroidDevice|%s] %s' % (self.extra['tag'], msg) + msg = _DEBUG_PREFIX_TEMPLATE % (self.extra['tag'], msg) return (msg, kwargs) diff --git a/mobly/controllers/android_device_lib/callback_handler.py b/mobly/controllers/android_device_lib/callback_handler.py index 7c648c2..9df09c0 100644 --- a/mobly/controllers/android_device_lib/callback_handler.py +++ b/mobly/controllers/android_device_lib/callback_handler.py @@ -18,6 +18,12 @@ import time from mobly.controllers.android_device_lib import snippet_event +# The max timeout cannot be larger than the max time the socket waits for a +# response message. Otherwise, the socket would timeout before the Rpc call +# does, leaving both server and client in unknown states. +MAX_TIMEOUT = 60 * 10 +DEFAULT_TIMEOUT = 120 # two minutes + class Error(Exception): pass @@ -56,7 +62,7 @@ class CallbackHandler(object): self.ret_value = ret_value self._method_name = method_name - def waitAndGet(self, event_name, timeout=None): + def waitAndGet(self, event_name, timeout=DEFAULT_TIMEOUT): """Blocks until an event of the specified name has been received and return the event, or timeout. @@ -68,9 +74,15 @@ class CallbackHandler(object): SnippetEvent, the oldest entry of the specified event. Raises: + Error: If the specified timeout is longer than the max timeout + supported. TimeoutError: The expected event does not occur within time limit. """ if timeout: + if timeout > MAX_TIMEOUT: + raise Error( + 'Specified timeout %s is longer than max timeout %s.' % + (timeout, MAX_TIMEOUT)) timeout *= 1000 # convert to milliseconds for java side try: raw_event = self._event_client.eventWaitAndGet(self._id, @@ -78,11 +90,56 @@ class CallbackHandler(object): except Exception as e: if 'EventSnippetException: timeout.' in str(e): raise TimeoutError( - 'Timeout waiting for event "%s" triggered by %s (%s).' - % (event_name, self._method_name, self._id)) + 'Timeout waiting for event "%s" triggered by %s (%s).' % + (event_name, self._method_name, self._id)) raise return snippet_event.from_dict(raw_event) + def waitForEvent(self, event_name, predicate, timeout=DEFAULT_TIMEOUT): + """Wait for an event of a specific name that satisfies the predicate. + + This call will block until the expected event has been received or time + out. + + The predicate function defines the condition the event is expected to + satisfy. It takes an event and returns True if the condition is + satisfied, False otherwise. + + Note all events of the same name that are received but don't satisfy + the predicate will be discarded and not be available for further + consumption. + + Args: + event_name: string, the name of the event to wait for. + predicate: function, a function that takes an event (dictionary) and + returns a bool. + timeout: float, default is 120s. + + Returns: + dictionary, the event that satisfies the predicate if received. + + Raises: + TimeoutError: raised if no event that satisfies the predicate is + received after timeout seconds. + """ + deadline = time.time() + timeout + while time.time() <= deadline: + # Calculate the max timeout for the next event rpc call. + rpc_timeout = deadline - time.time() + if rpc_timeout < 0: + break + try: + event = self.waitAndGet(event_name, rpc_timeout) + except TimeoutError: + # Ignoring TimeoutError since we need to throw one with a more + # specific message. + break + if predicate(event): + return event + raise TimeoutError( + 'Timed out after %ss waiting for an "%s" event that satisfies the ' + 'predicate "%s".' % (timeout, event_name, predicate.__name__)) + def getAll(self, event_name): """Gets all the events of a certain name that have been received so far. This is a non-blocking call. diff --git a/mobly/controllers/android_device_lib/jsonrpc_client_base.py b/mobly/controllers/android_device_lib/jsonrpc_client_base.py index bb4b5ed..187ec1c 100644 --- a/mobly/controllers/android_device_lib/jsonrpc_client_base.py +++ b/mobly/controllers/android_device_lib/jsonrpc_client_base.py @@ -39,6 +39,7 @@ Response: from builtins import str import json +import logging import socket import threading import time @@ -53,7 +54,10 @@ APP_START_WAIT_TIME = 15 UNKNOWN_UID = -1 # Maximum time to wait for the socket to open on the device. -_SOCKET_TIMEOUT = 60 +_SOCKET_CONNECTION_TIMEOUT = 60 + +# Maximum time to wait for a response message on the socket. +_SOCKET_READ_TIMEOUT = callback_handler.MAX_TIMEOUT class Error(Exception): @@ -70,9 +74,9 @@ class ApiError(Error): class ProtocolError(Error): """Raised when there is some error in exchanging data with server.""" - NO_RESPONSE_FROM_HANDSHAKE = "No response from handshake." - NO_RESPONSE_FROM_SERVER = "No response from server." - MISMATCHED_API_ID = "Mismatched API id." + NO_RESPONSE_FROM_HANDSHAKE = 'No response from handshake.' + NO_RESPONSE_FROM_SERVER = 'No response from server.' + MISMATCHED_API_ID = 'Mismatched API id.' class JsonRpcCommand(object): @@ -102,7 +106,12 @@ class JsonRpcClientBase(object): uid: (int) The uid of this session. """ - def __init__(self, host_port, device_port, app_name, adb_proxy): + def __init__(self, + host_port, + device_port, + app_name, + adb_proxy, + log=logging.getLogger()): """ Args: host_port: (int) The host port of this RPC client. @@ -121,6 +130,7 @@ class JsonRpcClientBase(object): self._counter = None self._lock = threading.Lock() self._event_client = None + self._log = log def __del__(self): self.close() @@ -178,6 +188,7 @@ class JsonRpcClientBase(object): for _ in range(wait_time): time.sleep(1) if self._is_app_running(): + self.log.debug('Successfully started %s', self.app_name) return raise AppStartError('%s failed to start on %s.' % (self.app_name, self._adb.serial)) @@ -186,9 +197,9 @@ class JsonRpcClientBase(object): """Opens a connection to a JSON RPC server. Opens a connection to a remote client. The connection attempt will time - out if it takes longer than _SOCKET_TIMEOUT seconds. Each subsequent - operation over this socket will time out after _SOCKET_TIMEOUT seconds - as well. + out if it takes longer than _SOCKET_CONNECTION_TIMEOUT seconds. Each + subsequent operation over this socket will time out after + _SOCKET_READ_TIMEOUT seconds as well. Args: uid: int, The uid of the session to join, or UNKNOWN_UID to start a @@ -202,8 +213,8 @@ class JsonRpcClientBase(object): """ self._counter = self._id_counter() self._conn = socket.create_connection(('127.0.0.1', self.host_port), - _SOCKET_TIMEOUT) - self._conn.settimeout(_SOCKET_TIMEOUT) + _SOCKET_CONNECTION_TIMEOUT) + self._conn.settimeout(_SOCKET_READ_TIMEOUT) self._client = self._conn.makefile(mode='brw') resp = self._cmd(cmd, uid) diff --git a/mobly/controllers/android_device_lib/sl4a_client.py b/mobly/controllers/android_device_lib/sl4a_client.py index ef5583e..ba31e0f 100644 --- a/mobly/controllers/android_device_lib/sl4a_client.py +++ b/mobly/controllers/android_device_lib/sl4a_client.py @@ -57,4 +57,4 @@ class Sl4aClient(jsonrpc_client_base.JsonRpcClientBase): "pm list package | grep com.googlecode.android_scripting"): raise jsonrpc_client_base.AppStartError( '%s is not installed on %s' % ( - self.app_name, self._adb.getprop('ro.boot.serialno'))) + self.app_name, self._adb.serial)) diff --git a/mobly/controllers/android_device_lib/snippet_client.py b/mobly/controllers/android_device_lib/snippet_client.py index 7c3ca01..f3ffade 100644 --- a/mobly/controllers/android_device_lib/snippet_client.py +++ b/mobly/controllers/android_device_lib/snippet_client.py @@ -54,10 +54,11 @@ class SnippetClient(jsonrpc_client_base.JsonRpcClientBase): host_port=host_port, device_port=host_port, app_name=package, - adb_proxy=adb_proxy) + adb_proxy=adb_proxy, + log=log) self.package = package - self._serial = self._adb.getprop('ro.boot.serialno') self.log = log + self._serial = self._adb.serial def _do_start_app(self): """Overrides superclass."""
[Android Device] Identify the device in exceptions thrown from a device instance. Right now we have to manually add the device serial every time we throw an exception from inside AndroidDevice, which is tedious and annoying. We should have a better way to handle this, perhaps an inner exception class.
google/mobly
diff --git a/tests/mobly/controllers/android_device_lib/callback_handler_test.py b/tests/mobly/controllers/android_device_lib/callback_handler_test.py index d121fe8..c3493f9 100755 --- a/tests/mobly/controllers/android_device_lib/callback_handler_test.py +++ b/tests/mobly/controllers/android_device_lib/callback_handler_test.py @@ -37,6 +37,10 @@ class CallbackHandlerTest(unittest.TestCase): """Unit tests for mobly.controllers.android_device_lib.callback_handler. """ + def test_timeout_value(self): + self.assertGreaterEqual(jsonrpc_client_base._SOCKET_READ_TIMEOUT, + callback_handler.MAX_TIMEOUT) + def test_event_dict_to_snippet_event(self): mock_event_client = mock.Mock() mock_event_client.eventWaitAndGet = mock.Mock( @@ -54,7 +58,8 @@ class CallbackHandlerTest(unittest.TestCase): def test_wait_and_get_timeout(self): mock_event_client = mock.Mock() - java_timeout_msg = 'com.google.android.mobly.snippet.event.EventSnippet$EventSnippetException: timeout.' + java_timeout_msg = ('com.google.android.mobly.snippet.event.' + 'EventSnippet$EventSnippetException: timeout.') mock_event_client.eventWaitAndGet = mock.Mock( side_effect=jsonrpc_client_base.ApiError(java_timeout_msg)) handler = callback_handler.CallbackHandler( @@ -67,6 +72,41 @@ class CallbackHandlerTest(unittest.TestCase): expected_msg): handler.waitAndGet('ha') + def test_wait_for_event(self): + mock_event_client = mock.Mock() + mock_event_client.eventWaitAndGet = mock.Mock( + return_value=MOCK_RAW_EVENT) + handler = callback_handler.CallbackHandler( + callback_id=MOCK_CALLBACK_ID, + event_client=mock_event_client, + ret_value=None, + method_name=None) + + def some_condition(event): + return event.data['successful'] + + event = handler.waitForEvent('AsyncTaskResult', some_condition, 0.01) + + def test_wait_for_event_negative(self): + mock_event_client = mock.Mock() + mock_event_client.eventWaitAndGet = mock.Mock( + return_value=MOCK_RAW_EVENT) + handler = callback_handler.CallbackHandler( + callback_id=MOCK_CALLBACK_ID, + event_client=mock_event_client, + ret_value=None, + method_name=None) + expected_msg = ( + 'Timed out after 0.01s waiting for an "AsyncTaskResult" event that' + ' satisfies the predicate "some_condition".') + + def some_condition(event): + return False + + with self.assertRaisesRegexp(callback_handler.TimeoutError, + expected_msg): + handler.waitForEvent('AsyncTaskResult', some_condition, 0.01) + if __name__ == "__main__": unittest.main() diff --git a/tests/mobly/controllers/android_device_test.py b/tests/mobly/controllers/android_device_test.py index d66b4dc..38247cb 100755 --- a/tests/mobly/controllers/android_device_test.py +++ b/tests/mobly/controllers/android_device_test.py @@ -206,7 +206,7 @@ class AndroidDeviceTest(unittest.TestCase): """ mock_serial = 1 ad = android_device.AndroidDevice(serial=mock_serial) - expected_msg = "Failed to take bugreport on 1: OMG I died!" + expected_msg = ".* Failed to take bugreport." with self.assertRaisesRegexp(android_device.Error, expected_msg): ad.take_bug_report("test_something", "sometime") @@ -244,8 +244,7 @@ class AndroidDeviceTest(unittest.TestCase): """ mock_serial = 1 ad = android_device.AndroidDevice(serial=mock_serial) - expected_msg = ("Android device .* does not have an ongoing adb logcat" - " collection.") + expected_msg = ".* No ongoing adb logcat collection found." # Expect error if stop is called before start. with self.assertRaisesRegexp(android_device.Error, expected_msg): @@ -261,8 +260,8 @@ class AndroidDeviceTest(unittest.TestCase): start_proc_mock.assert_called_with(adb_cmd % (ad.serial, expected_log_path)) self.assertEqual(ad.adb_logcat_file_path, expected_log_path) - expected_msg = ("Android device .* already has an adb logcat thread " - "going on. Cannot start another one.") + expected_msg = ('Logcat thread is already running, cannot start another' + ' one.') # Expect error if start is called back to back. with self.assertRaisesRegexp(android_device.Error, expected_msg): @@ -289,8 +288,7 @@ class AndroidDeviceTest(unittest.TestCase): mock_serial = 1 ad = android_device.AndroidDevice(serial=mock_serial) ad.adb_logcat_param = "-b radio" - expected_msg = ("Android device .* does not have an ongoing adb logcat" - " collection.") + expected_msg = '.* No ongoing adb logcat collection found.' # Expect error if stop is called before start. with self.assertRaisesRegexp(android_device.Error, expected_msg): @@ -324,8 +322,8 @@ class AndroidDeviceTest(unittest.TestCase): mock_serial = 1 ad = android_device.AndroidDevice(serial=mock_serial) # Expect error if attempted to cat adb log before starting adb logcat. - expected_msg = ("Attempting to cat adb log when none has been " - "collected on Android device .*") + expected_msg = (".* Attempting to cat adb log when none" + " has been collected.") with self.assertRaisesRegexp(android_device.Error, expected_msg): ad.cat_adb_log("some_test", MOCK_ADB_LOGCAT_BEGIN_TIME) @@ -370,7 +368,7 @@ class AndroidDeviceTest(unittest.TestCase): ad.load_snippet('snippet', MOCK_SNIPPET_PACKAGE_NAME) expected_msg = ('Snippet package "%s" has already been loaded under ' 'name "snippet".') % MOCK_SNIPPET_PACKAGE_NAME - with self.assertRaisesRegexp(android_device.SnippetError, + with self.assertRaisesRegexp(android_device.Error, expected_msg): ad.load_snippet('snippet2', MOCK_SNIPPET_PACKAGE_NAME) @@ -388,7 +386,7 @@ class AndroidDeviceTest(unittest.TestCase): expected_msg = ('Attribute "%s" is already registered with package ' '"%s", it cannot be used again.') % ( 'snippet', MOCK_SNIPPET_PACKAGE_NAME) - with self.assertRaisesRegexp(android_device.SnippetError, + with self.assertRaisesRegexp(android_device.Error, expected_msg): ad.load_snippet('snippet', MOCK_SNIPPET_PACKAGE_NAME + 'haha') @@ -403,7 +401,7 @@ class AndroidDeviceTest(unittest.TestCase): ad = android_device.AndroidDevice(serial=1) expected_msg = ('Attribute "%s" already exists, please use a different' ' name') % 'adb' - with self.assertRaisesRegexp(android_device.SnippetError, + with self.assertRaisesRegexp(android_device.Error, expected_msg): ad.load_snippet('adb', MOCK_SNIPPET_PACKAGE_NAME) @@ -420,6 +418,30 @@ class AndroidDeviceTest(unittest.TestCase): ad.stop_services() self.assertFalse(hasattr(ad, 'snippet')) + @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy', + return_value=mock_android_device.MockAdbProxy(1)) + @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy', + return_value=mock_android_device.MockFastbootProxy(1)) + def test_AndroidDevice_debug_tag(self, MockFastboot, MockAdbProxy): + mock_serial = 1 + ad = android_device.AndroidDevice(serial=mock_serial) + self.assertEqual(ad.debug_tag, 1) + try: + raise android_device.DeviceError(ad, 'Something') + except android_device.DeviceError as e: + self.assertEqual('<AndroidDevice|1> Something', str(e)) + # Verify that debug tag's setter updates the debug prefix correctly. + ad.debug_tag = 'Mememe' + try: + raise android_device.DeviceError(ad, 'Something') + except android_device.DeviceError as e: + self.assertEqual('<AndroidDevice|Mememe> Something', str(e)) + # Verify that repr is changed correctly. + try: + raise Exception(ad, 'Something') + except Exception as e: + self.assertEqual("(<AndroidDevice|Mememe>, 'Something')", str(e)) + if __name__ == "__main__": unittest.main()
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 5 }
1.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y adb" ], "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work future==1.0.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work -e git+https://github.com/google/mobly.git@b4362eda0c8148644812849cdb9c741e35d5750d#egg=mobly mock==1.0.1 packaging @ file:///croot/packaging_1734472117206/work pluggy @ file:///croot/pluggy_1733169602837/work pytest @ file:///croot/pytest_1738938843180/work pytz==2025.2 PyYAML==6.0.2 tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
name: mobly channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - future==1.0.0 - mock==1.0.1 - pytz==2025.2 - pyyaml==6.0.2 prefix: /opt/conda/envs/mobly
[ "tests/mobly/controllers/android_device_lib/callback_handler_test.py::CallbackHandlerTest::test_timeout_value", "tests/mobly/controllers/android_device_lib/callback_handler_test.py::CallbackHandlerTest::test_wait_for_event", "tests/mobly/controllers/android_device_lib/callback_handler_test.py::CallbackHandlerTest::test_wait_for_event_negative", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_cat_adb_log", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_debug_tag", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet_dup_attribute_name", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet_dup_package", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet_dup_snippet_name", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_bug_report_fail", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_logcat", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_logcat_with_user_param" ]
[]
[ "tests/mobly/controllers/android_device_lib/callback_handler_test.py::CallbackHandlerTest::test_event_dict_to_snippet_event", "tests/mobly/controllers/android_device_lib/callback_handler_test.py::CallbackHandlerTest::test_wait_and_get_timeout", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_build_info", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_instantiation", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_snippet_cleanup", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_bug_report", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_bug_report_fallback", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_empty_config", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_not_list_config", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_pickup_all", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_no_match", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_success_with_serial", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_success_with_serial_and_extra_field", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_too_many_matches", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_start_services_on_ads" ]
[]
Apache License 2.0
1,006
[ "mobly/controllers/android_device_lib/snippet_client.py", "mobly/controllers/android_device.py", "mobly/controllers/android_device_lib/jsonrpc_client_base.py", "mobly/controllers/android_device_lib/callback_handler.py", "mobly/controllers/android_device_lib/sl4a_client.py" ]
[ "mobly/controllers/android_device_lib/snippet_client.py", "mobly/controllers/android_device.py", "mobly/controllers/android_device_lib/jsonrpc_client_base.py", "mobly/controllers/android_device_lib/callback_handler.py", "mobly/controllers/android_device_lib/sl4a_client.py" ]
ipython__ipython-10263
06e6b58e0f7878296ee655c825e8a764999a5cc8
2017-02-09 00:05:51
f51c975b99c91b91f6f455acd8dc335509c078f2
diff --git a/IPython/core/completer.py b/IPython/core/completer.py index d2637c4bb..80aafee41 100644 --- a/IPython/core/completer.py +++ b/IPython/core/completer.py @@ -622,8 +622,27 @@ def get__all__entries(obj): return [cast_unicode_py2(w) for w in words if isinstance(w, str)] -def match_dict_keys(keys, prefix, delims): - """Used by dict_key_matches, matching the prefix to a list of keys""" +def match_dict_keys(keys: List[str], prefix: str, delims: str): + """Used by dict_key_matches, matching the prefix to a list of keys + + Parameters + ========== + keys: + list of keys in dictionary currently being completed. + prefix: + Part of the text already typed by the user. e.g. `mydict[b'fo` + delims: + String of delimiters to consider when finding the current key. + + Returns + ======= + + A tuple of three elements: ``quote``, ``token_start``, ``matched``, with + ``quote`` being the quote that need to be used to close current string. + ``token_start`` the position where the replacement should start occurring, + ``matches`` a list of replacement/completion + + """ if not prefix: return None, 0, [repr(k) for k in keys if isinstance(k, (str, bytes))] @@ -639,7 +658,6 @@ def match_dict_keys(keys, prefix, delims): token_start = token_match.start() token_prefix = token_match.group() - # TODO: support bytes in Py3k matched = [] for key in keys: try: @@ -652,7 +670,7 @@ def match_dict_keys(keys, prefix, delims): # reformat remainder of key to begin with prefix rem = key[len(prefix_str):] # force repr wrapped in ' - rem_repr = repr(rem + '"') + rem_repr = repr(rem + '"') if isinstance(rem, str) else repr(rem + b'"') if rem_repr.startswith('u') and prefix[0] not in 'uU': # Found key is unicode, but prefix is Py2 string. # Therefore attempt to interpret key as string.
Dict key completion with bytes keys raises Dict key tab completion raises when trying to complete a prefix of a bytes literal that is a valid key in the dict, as below. This issue persists after `pip install --upgrade ipython`. ``` python Python 3.4.3 (default, Mar 3 2015, 10:49:33) Type "copyright", "credits" or "license" for more information. IPython 3.2.1 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: foo = {b'spam': True, 'ham': False} In [2]: foo['s<TAB> %%script %%system %store set stat+tlrc.BRIK.gz str symptoms.csv %%sh %save %sx setattr stat+tlrc.HEAD sum %%svg %sc %system slice staticmethod sun_et_al_seeds.txt %%sx %set_env scripts/ sorted stims/ super In [2]: foo['h<TAB> %%html %hist %history ham hasattr hash help hex In [2]: foo[b'h<TAB> %%html %hist %history hasattr hash help hex In [2]: foo[b's<TAB>Traceback (most recent call last): File "/home/schwabacher/lib/python3.4/site-packages/IPython/core/completer.py", line 1092, in complete self.matches.extend(matcher(text)) File "/home/schwabacher/lib/python3.4/site-packages/IPython/core/completer.py", line 917, in dict_key_matches closing_quote, token_offset, matches = match_dict_keys(keys, prefix, self.splitter.delims) File "/home/schwabacher/lib/python3.4/site-packages/IPython/core/completer.py", line 449, in match_dict_keys rem_repr = repr(rem + '"') TypeError: can't concat bytes to str If you suspect this is an IPython bug, please report it at: https://github.com/ipython/ipython/issues or send an email to the mailing list at [email protected] You can print a more detailed traceback right now with "%tb", or use "%debug" to interactively debug it. Extra-detailed tracebacks for bug-reporting purposes can be enabled via: %config Application.verbose_crash=True %%script %%system %store set stat+tlrc.BRIK.gz str symptoms.csv %%sh %save %sx setattr stat+tlrc.HEAD sum %%svg %sc %system slice staticmethod sun_et_al_seeds.txt %%sx %set_env scripts/ sorted stims/ super ```
ipython/ipython
diff --git a/IPython/core/tests/test_completer.py b/IPython/core/tests/test_completer.py index dab79ecad..cd193b934 100644 --- a/IPython/core/tests/test_completer.py +++ b/IPython/core/tests/test_completer.py @@ -20,7 +20,7 @@ from IPython.utils.generics import complete_object from IPython.testing import decorators as dec -from IPython.core.completer import Completion, provisionalcompleter +from IPython.core.completer import Completion, provisionalcompleter, match_dict_keys from nose.tools import assert_in, assert_not_in #----------------------------------------------------------------------------- @@ -526,7 +526,28 @@ def test_magic_completion_order(): # Order of user variable and line and cell magics with same name: text, matches = c.complete('timeit') - nt.assert_equal(matches, ["timeit", "%timeit","%%timeit"]) + nt.assert_equal(matches, ["timeit", "%timeit", "%%timeit"]) + +def test_match_dict_keys(): + """ + Test that match_dict_keys works on a couple of use case does return what + expected, and does not crash + """ + delims = ' \t\n`!@#$^&*()=+[{]}\\|;:\'",<>?' + + + keys = ['foo', b'far'] + assert match_dict_keys(keys, "b'", delims=delims) == ("'", 2 ,['far']) + assert match_dict_keys(keys, "b'f", delims=delims) == ("'", 2 ,['far']) + assert match_dict_keys(keys, 'b"', delims=delims) == ('"', 2 ,['far']) + assert match_dict_keys(keys, 'b"f', delims=delims) == ('"', 2 ,['far']) + + assert match_dict_keys(keys, "'", delims=delims) == ("'", 1 ,['foo']) + assert match_dict_keys(keys, "'f", delims=delims) == ("'", 1 ,['foo']) + assert match_dict_keys(keys, '"', delims=delims) == ('"', 1 ,['foo']) + assert match_dict_keys(keys, '"f', delims=delims) == ('"', 1 ,['foo']) + + match_dict_keys def test_dict_key_completion_string():
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 0 }, "num_modified_files": 1 }
5.2
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[test]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-xdist", "pytest-mock", "pytest-asyncio" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 decorator==5.1.1 entrypoints==0.4 execnet==1.9.0 idna==3.10 importlib-metadata==4.8.3 iniconfig==1.1.1 ipykernel==5.5.6 -e git+https://github.com/ipython/ipython.git@06e6b58e0f7878296ee655c825e8a764999a5cc8#egg=ipython ipython-genutils==0.2.0 jedi==0.19.2 jsonschema==3.2.0 jupyter-client==7.1.2 jupyter-core==4.9.2 nbformat==5.1.3 nest-asyncio==1.6.0 nose==1.3.7 numpy==1.19.5 packaging==21.3 parso==0.8.4 pexpect==4.9.0 pickleshare==0.7.5 pluggy==1.0.0 prompt-toolkit==1.0.18 ptyprocess==0.7.0 py==1.11.0 Pygments==2.14.0 pyparsing==3.1.4 pyrsistent==0.18.0 pytest==7.0.1 pytest-asyncio==0.16.0 pytest-cov==4.0.0 pytest-mock==3.6.1 pytest-xdist==3.0.2 python-dateutil==2.9.0.post0 pyzmq==25.1.2 requests==2.27.1 simplegeneric==0.8.1 six==1.17.0 testpath==0.6.0 tomli==1.2.3 tornado==6.1 traitlets==4.3.3 typing==3.7.4.3 typing_extensions==4.1.1 urllib3==1.26.20 wcwidth==0.2.13 zipp==3.6.0
name: ipython channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - charset-normalizer==2.0.12 - coverage==6.2 - decorator==5.1.1 - entrypoints==0.4 - execnet==1.9.0 - idna==3.10 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - ipykernel==5.5.6 - ipython-genutils==0.2.0 - jedi==0.19.2 - jsonschema==3.2.0 - jupyter-client==7.1.2 - jupyter-core==4.9.2 - nbformat==5.1.3 - nest-asyncio==1.6.0 - nose==1.3.7 - numpy==1.19.5 - packaging==21.3 - parso==0.8.4 - pexpect==4.9.0 - pickleshare==0.7.5 - pluggy==1.0.0 - prompt-toolkit==1.0.18 - ptyprocess==0.7.0 - py==1.11.0 - pygments==2.14.0 - pyparsing==3.1.4 - pyrsistent==0.18.0 - pytest==7.0.1 - pytest-asyncio==0.16.0 - pytest-cov==4.0.0 - pytest-mock==3.6.1 - pytest-xdist==3.0.2 - python-dateutil==2.9.0.post0 - pyzmq==25.1.2 - requests==2.27.1 - simplegeneric==0.8.1 - six==1.17.0 - testpath==0.6.0 - tomli==1.2.3 - tornado==6.1 - traitlets==4.3.3 - typing==3.7.4.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - wcwidth==0.2.13 - zipp==3.6.0 prefix: /opt/conda/envs/ipython
[ "IPython/core/tests/test_completer.py::test_match_dict_keys" ]
[ "IPython/core/tests/test_completer.py::test_custom_completion_error", "IPython/core/tests/test_completer.py::test_unicode_completions", "IPython/core/tests/test_completer.py::test_latex_completions", "IPython/core/tests/test_completer.py::test_back_latex_completion", "IPython/core/tests/test_completer.py::test_back_unicode_completion", "IPython/core/tests/test_completer.py::test_forward_unicode_completion", "IPython/core/tests/test_completer.py::test_no_ascii_back_completion", "IPython/core/tests/test_completer.py::test_abspath_file_completions", "IPython/core/tests/test_completer.py::test_local_file_completions", "IPython/core/tests/test_completer.py::test_omit__names", "IPython/core/tests/test_completer.py::test_limit_to__all__False_ok", "IPython/core/tests/test_completer.py::test_func_kw_completions", "IPython/core/tests/test_completer.py::test_default_arguments_from_docstring", "IPython/core/tests/test_completer.py::test_line_magics", "IPython/core/tests/test_completer.py::test_cell_magics", "IPython/core/tests/test_completer.py::test_line_cell_magics", "IPython/core/tests/test_completer.py::test_magic_completion_order", "IPython/core/tests/test_completer.py::test_dict_key_completion_string", "IPython/core/tests/test_completer.py::test_dict_key_completion_contexts", "IPython/core/tests/test_completer.py::test_dict_key_completion_bytes", "IPython/core/tests/test_completer.py::test_dict_key_completion_unicode_py3", "IPython/core/tests/test_completer.py::test_struct_array_key_completion", "IPython/core/tests/test_completer.py::test_dict_key_completion_invalids", "IPython/core/tests/test_completer.py::test_object_key_completion", "IPython/core/tests/test_completer.py::test_aimport_module_completer", "IPython/core/tests/test_completer.py::test_nested_import_module_completer", "IPython/core/tests/test_completer.py::test_import_module_completer", "IPython/core/tests/test_completer.py::test_from_module_completer" ]
[ "IPython/core/tests/test_completer.py::test_protect_filename", "IPython/core/tests/test_completer.py::test_line_split", "IPython/core/tests/test_completer.py::CompletionSplitterTestCase::test_delim_setting", "IPython/core/tests/test_completer.py::CompletionSplitterTestCase::test_spaces", "IPython/core/tests/test_completer.py::test_has_open_quotes1", "IPython/core/tests/test_completer.py::test_has_open_quotes2", "IPython/core/tests/test_completer.py::test_has_open_quotes3", "IPython/core/tests/test_completer.py::test_has_open_quotes4", "IPython/core/tests/test_completer.py::test_get__all__entries_ok", "IPython/core/tests/test_completer.py::test_get__all__entries_no__all__ok", "IPython/core/tests/test_completer.py::test_tryimport" ]
[]
BSD 3-Clause "New" or "Revised" License
1,007
[ "IPython/core/completer.py" ]
[ "IPython/core/completer.py" ]
kumar303__mohawk-36
cacfa3c2c792a065adb812aded5b8daa5b0362aa
2017-02-09 05:46:49
23d1009a8f601c64d0b0f6e1ca5f45aaa3d9e60e
kumar303: Hmm. I think I agree with https://github.com/hueniverse/hawk/issues/151 i.e. raise an error if an ext contains a backslash. I guess we could do the same thing for escaped quotes? I can't think of any realistic scenarios for using those characters. thusoy: Yeah, I can’t see any use for it either. I’ll modify this to raise an error on invalid content in the header. Have a splendid day! Tarjei > On Feb 9, 2017, at 08:39, Kumar McMillan <[email protected]> wrote: > > Hmm. I think I agree with hueniverse/hawk#151 i.e. raise an error if an ext contains a backslash. I guess we could do the same thing for escaped quotes? I can't think of any realistic scenarios for using those characters. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub, or mute the thread. > thusoy: Okay, disallowed escaping and introduced a test for duplicate values. Should be good to go now. thusoy: Yes, yes and yes on cleanup, adding to the changelog and releasing as 1.0.0. See my comments for some discussion points though. kumar303: Whoops, you noticed the backslash handling for bewits in that other patch (which I forgot about). Could you make backslashes raise an exception there too for consistency? The test for it is here: https://github.com/kumar303/mohawk/blob/master/mohawk/tests.py#L687 I guess both of the `ext` processor functions should be sharing code but if that's a hassle to refactor don't worry about it. thusoy: Couldn't come up in any other ways to structure the code for clarity, but reworded the comments, let me know if it's still muddy. Didn't have time to look at the bewit stuff this time around, maybe in a couple of days. While the incoming headers are now validated for no escapes I think we still allow it outgoing? Should probably be symmetric. thusoy: I also added the unparsed header as part of the args to the parse exception raised. I think generally we should aim to keep the failing property in the args and not inside the error message, since it's pretty much inaccessible to developers there, much more useful stuff can be done if it can be extracted, and it's convention in python to add the exceptional value to the exception args. It would still be logged as part of the traceback, and it would be possible to extract programmatically. kumar303: > While the incoming headers are now validated for no escapes I think we still allow it outgoing? Should probably be symmetric. I agree, can you file an issue? kumar303: Don't worry about changing the bewit code in this patch. I filed https://github.com/kumar303/mohawk/issues/41 so that it can be done in a different patch. thusoy: @kumar303 I added a test case for the exception message, and found an untested path that was failing due to some variables that had been renamed. thusoy: Make that two untested paths. Both have tests now. kumar303: Thanks. Looks like this unittest code needs slight adjustments for python 2.6 thusoy: Bah, 2.6... Fixed (hopefully). I'll squash them when you're satisfied to make review easier. thusoy: @kumar303 We're all green. thusoy: Rebased and stopped doing anything about backslashes in bewits. Currently we just ignore it (no tests for invalid values), but ideally there should probably be tests and explicit failures for invalid values. kumar303: Hi. Sorry for the delay. I've been traveling for work but I should be able to do another review shortly.
diff --git a/docs/index.rst b/docs/index.rst index 89c0753..c2970a5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -106,6 +106,11 @@ TODO Changelog --------- +- **UNRELEASED** + - **Breaking**: Escape characters in header values are no longer allowed, + potentially breaking clients that depend on this behavior. + - Introduced max limit of 4096 characters in the Authorization header + - **0.3.4** (2017-01-07) - Fixed ``AttributeError`` exception diff --git a/mohawk/base.py b/mohawk/base.py index 1ce1c2b..2c0a9bf 100644 --- a/mohawk/base.py +++ b/mohawk/base.py @@ -152,6 +152,7 @@ class Resource: def __init__(self, **kw): self.credentials = kw.pop('credentials') + self.credentials['id'] = prepare_header_val(self.credentials['id']) self.method = kw.pop('method').upper() self.content = kw.pop('content', None) self.content_type = kw.pop('content_type', None) diff --git a/mohawk/bewit.py b/mohawk/bewit.py index d6dff2c..ed8c3fe 100644 --- a/mohawk/bewit.py +++ b/mohawk/bewit.py @@ -7,7 +7,8 @@ import six from .base import Resource from .util import (calculate_mac, - utc_now) + utc_now, + validate_header_attr) from .exc import (CredentialsLookupError, InvalidBewit, MacMismatch, @@ -40,25 +41,15 @@ def get_bewit(resource): if resource.ext is None: ext = '' else: + validate_header_attr(resource.ext, name='ext') ext = resource.ext - # Strip out \ from the client id - # since that can break parsing the response - # NB that the canonical implementation does not do this as of - # Oct 28, 2015, so this could break compat. - # We can leave \ in ext since validators can limit how many \ they split - # on (although again, the canonical implementation does not do this) - client_id = six.text_type(resource.credentials['id']) - if "\\" in client_id: - log.warning("Stripping backslash character(s) '\\' from client_id") - client_id = client_id.replace("\\", "") - # b64encode works only with bytes in python3, but all of our parameters are # in unicode, so we need to encode them. The cleanest way to do this that # works in both python 2 and 3 is to use string formatting to get a # unicode string, and then explicitly encode it to bytes. inner_bewit = u"{id}\\{exp}\\{mac}\\{ext}".format( - id=client_id, + id=resource.credentials['id'], exp=resource.timestamp, mac=mac, ext=ext, @@ -83,10 +74,10 @@ def parse_bewit(bewit): :type bewit: str """ decoded_bewit = b64decode(bewit).decode('ascii') - bewit_parts = decoded_bewit.split("\\", 3) + bewit_parts = decoded_bewit.split("\\") if len(bewit_parts) != 4: raise InvalidBewit('Expected 4 parts to bewit: %s' % decoded_bewit) - return bewittuple(*decoded_bewit.split("\\", 3)) + return bewittuple(*bewit_parts) def strip_bewit(url): diff --git a/mohawk/util.py b/mohawk/util.py index 46a28e9..bb8a14e 100644 --- a/mohawk/util.py +++ b/mohawk/util.py @@ -19,6 +19,8 @@ from .exc import ( HAWK_VER = 1 +HAWK_HEADER_RE = re.compile(r'(?P<key>\w+)=\"(?P<value>[^\"\\]*)\"\s*(?:,\s*|$)') +MAX_LENGTH = 4096 log = logging.getLogger(__name__) allowable_header_keys = set(['id', 'ts', 'tsm', 'nonce', 'hash', 'error', 'ext', 'mac', 'app', 'dlg']) @@ -149,45 +151,42 @@ def parse_authorization_header(auth_header): 'Hawk id="dh37fgj492je", ts="1367076201", nonce="NPHgnG", ext="and welcome!", mac="CeWHy4d9kbLGhDlkyw2Nh3PJ7SDOdZDa267KH4ZaNMY="' """ - attributes = {} + if len(auth_header) > MAX_LENGTH: + raise BadHeaderValue('Header exceeds maximum length of {max_length}'.format( + max_length=MAX_LENGTH)) # Make sure we have a unicode object for consistency. if isinstance(auth_header, six.binary_type): auth_header = auth_header.decode('utf8') - parts = auth_header.split(',') - auth_scheme_parts = parts[0].split(' ') - if 'hawk' != auth_scheme_parts[0].lower(): + scheme, attributes_string = auth_header.split(' ', 1) + + if scheme.lower() != 'hawk': raise HawkFail("Unknown scheme '{scheme}' when parsing header" - .format(scheme=auth_scheme_parts[0].lower())) + .format(scheme=scheme)) + - # Replace 'Hawk key: value' with 'key: value' - # which matches the rest of parts - parts[0] = auth_scheme_parts[1] + attributes = {} - for part in parts: - attr_parts = part.split('=') - key = attr_parts[0].strip() + def replace_attribute(match): + """Extract the next key="value"-pair in the header.""" + key = match.group('key') + value = match.group('value') if key not in allowable_header_keys: raise HawkFail("Unknown Hawk key '{key}' when parsing header" .format(key=key)) - - if len(attr_parts) > 2: - attr_parts[1] = '='.join(attr_parts[1:]) - - # Chop of quotation marks - value = attr_parts[1] - - if attr_parts[1].find('"') == 0: - value = attr_parts[1][1:] - - if value.find('"') > -1: - value = value[0:-1] - validate_header_attr(value, name=key) - value = unescape_header_attr(value) + if key in attributes: + raise BadHeaderValue('Duplicate key in header: {key}'.format(key=key)) attributes[key] = value + # Iterate over all the key="value"-pairs in the header, replace them with + # an empty string, and store the extracted attribute in the attributes + # dict. Correctly formed headers will then leave nothing unparsed (''). + unparsed_header = HAWK_HEADER_RE.sub(replace_attribute, attributes_string) + if unparsed_header != '': + raise BadHeaderValue("Couldn't parse Hawk header", unparsed_header) + log.debug('parsed Hawk header: {header} into: \n{parsed}' .format(header=auth_header, parsed=pprint.pformat(attributes))) return attributes @@ -222,7 +221,7 @@ def utc_now(offset_in_seconds=0.0): # Allowed value characters: # !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9, \, " _header_attribute_chars = re.compile( - r"^[ a-zA-Z0-9_\!#\$%&'\(\)\*\+,\-\./\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$") + r"^[ a-zA-Z0-9_\!#\$%&'\(\)\*\+,\-\./\:;<\=>\?@\[\]\^`\{\|\}~]*$") def validate_header_attr(val, name=None): @@ -232,36 +231,14 @@ def validate_header_attr(val, name=None): .format(name=name or '?', val=repr(val))) -def escape_header_attr(val): - - # Ensure we are working with Unicode for consistency. - if isinstance(val, six.binary_type): - val = val.decode('utf8') - - # Escape quotes and slash like the hawk reference code. - val = val.replace('\\', '\\\\') - val = val.replace('"', '\\"') - val = val.replace('\n', '\\n') - return val - - -def unescape_header_attr(val): - # Un-do the hawk escaping. - val = val.replace('\\n', '\n') - val = val.replace('\\\\', '\\').replace('\\"', '"') - return val - - def prepare_header_val(val): - val = escape_header_attr(val) + if isinstance(val, six.binary_type): + val = val.decode('utf-8') validate_header_attr(val) return val def normalize_header_attr(val): - if not val: - val = '' - - # Normalize like the hawk reference code. - val = escape_header_attr(val) + if isinstance(val, six.binary_type): + return val.decode('utf-8') return val
Commas in header values break parsing The parser tries to split the entire header `Hawk id="something", key="value"` on commas to separate the fields, thus any field with comma in it will cause breakage. ``` python def test_ext_with_all_valid_characters(self): valid_characters = "!#$%&'()*+,-./:;<=>?@[]^_`{|}~ azAZ09" sender = self.Sender(ext=valid_characters) self.receive(sender.request_header) parsed = parse_authorization_header(sender.request_header) eq_(parsed['ext'], valid_characters) ``` Discovered when working on #33
kumar303/mohawk
diff --git a/mohawk/tests.py b/mohawk/tests.py index eedafd8..52b5226 100644 --- a/mohawk/tests.py +++ b/mohawk/tests.py @@ -12,6 +12,7 @@ from .base import Resource from .exc import (AlreadyProcessed, BadHeaderValue, CredentialsLookupError, + HawkFail, InvalidCredentials, MacMismatch, MisComputedContentHash, @@ -313,17 +314,21 @@ class TestSender(Base): header = sn.request_header.replace('my external data', 'TAMPERED') self.receive(header) + @raises(BadHeaderValue) + def test_duplicate_keys(self): + sn = self.Sender(ext='someext') + header = sn.request_header + ', ext="otherext"' + self.receive(header) + + @raises(BadHeaderValue) def test_ext_with_quotes(self): sn = self.Sender(ext='quotes=""') self.receive(sn.request_header) - parsed = parse_authorization_header(sn.request_header) - eq_(parsed['ext'], 'quotes=""') + @raises(BadHeaderValue) def test_ext_with_new_line(self): sn = self.Sender(ext="new line \n in the middle") self.receive(sn.request_header) - parsed = parse_authorization_header(sn.request_header) - eq_(parsed['ext'], "new line \n in the middle") def test_ext_with_equality_sign(self): sn = self.Sender(ext="foo=bar&foo2=bar2;foo3=bar3") @@ -331,19 +336,47 @@ class TestSender(Base): parsed = parse_authorization_header(sn.request_header) eq_(parsed['ext'], "foo=bar&foo2=bar2;foo3=bar3") + @raises(HawkFail) + def test_non_hawk_scheme(self): + parse_authorization_header('Basic user:base64pw') + + @raises(HawkFail) + def test_invalid_key(self): + parse_authorization_header('Hawk mac="validmac" unknownkey="value"') + + def test_ext_with_all_valid_characters(self): + valid_characters = "!#$%&'()*+,-./:;<=>?@[]^_`{|}~ azAZ09_" + sender = self.Sender(ext=valid_characters) + parsed = parse_authorization_header(sender.request_header) + eq_(parsed['ext'], valid_characters) + @raises(BadHeaderValue) def test_ext_with_illegal_chars(self): self.Sender(ext="something like \t is illegal") + def test_unparseable_header(self): + try: + parse_authorization_header('Hawk mac="somemac", unparseable') + except BadHeaderValue as exc: + error_msg = str(exc) + self.assertTrue("Couldn't parse Hawk header" in error_msg) + self.assertTrue("unparseable" in error_msg) + else: + self.fail('should raise') + @raises(BadHeaderValue) def test_ext_with_illegal_unicode(self): self.Sender(ext=u'Ivan Kristi\u0107') + @raises(BadHeaderValue) + def test_too_long_header(self): + sn = self.Sender(ext='a'*5000) + self.receive(sn.request_header) + @raises(BadHeaderValue) def test_ext_with_illegal_utf8(self): # This isn't allowed because the escaped byte chars are out of - # range. It's a little odd but this is what the Node lib does - # implicitly with its regex. + # range. self.Sender(ext=u'Ivan Kristi\u0107'.encode('utf8')) def test_app_ok(self): @@ -689,19 +722,24 @@ class TestBewit(Base): expected = '123456\\1356420707\\kscxwNR2tJpP1T1zDLNPbB5UiKIU9tOSJXTUdG7X9h8=\\xandyandz' eq_(b64decode(bewit).decode('ascii'), expected) - def test_bewit_with_ext_and_backslashes(self): - credentials = self.credentials - credentials['id'] = '123\\456' + @raises(BadHeaderValue) + def test_bewit_with_invalid_ext(self): res = Resource(url='https://example.com/somewhere/over/the/rainbow', method='GET', credentials=self.credentials, timestamp=1356420407 + 300, nonce='', - ext='xand\\yandz' - ) - bewit = get_bewit(res) + ext='xand\\yandz') + get_bewit(res) - expected = '123456\\1356420707\\b82LLIxG5UDkaChLU953mC+SMrbniV1sb8KiZi9cSsc=\\xand\\yandz' - eq_(b64decode(bewit).decode('ascii'), expected) + @raises(BadHeaderValue) + def test_bewit_with_backslashes_in_id(self): + credentials = self.credentials + credentials['id'] = '123\\456' + res = Resource(url='https://example.com/somewhere/over/the/rainbow', + method='GET', credentials=self.credentials, + timestamp=1356420407 + 300, + nonce='') + get_bewit(res) def test_bewit_with_port(self): res = Resource(url='https://example.com:8080/somewhere/over/the/rainbow', @@ -759,14 +797,11 @@ class TestBewit(Base): self.assertEqual(bewit.mac, 'IGYmLgIqLrCe8CxvKPs4JlWIA+UjWJJouwgARiVhCAg=') self.assertEqual(bewit.ext, 'xandyandz') + @raises(InvalidBewit) def test_parse_bewit_with_ext_and_backslashes(self): bewit = b'123456\\1356420707\\IGYmLgIqLrCe8CxvKPs4JlWIA+UjWJJouwgARiVhCAg=\\xand\\yandz' bewit = urlsafe_b64encode(bewit).decode('ascii') - bewit = parse_bewit(bewit) - self.assertEqual(bewit.id, '123456') - self.assertEqual(bewit.expiration, '1356420707') - self.assertEqual(bewit.mac, 'IGYmLgIqLrCe8CxvKPs4JlWIA+UjWJJouwgARiVhCAg=') - self.assertEqual(bewit.ext, 'xand\\yandz') + parse_bewit(bewit) @raises(InvalidBewit) def test_parse_invalid_bewit_with_only_one_part(self): @@ -798,6 +833,7 @@ class TestBewit(Base): }) self.assertTrue(check_bewit(url, credential_lookup=credential_lookup, now=1356420407 + 10)) + @raises(InvalidBewit) def test_validate_bewit_with_ext_and_backslashes(self): bewit = b'123456\\1356420707\\b82LLIxG5UDkaChLU953mC+SMrbniV1sb8KiZi9cSsc=\\xand\\yandz' bewit = urlsafe_b64encode(bewit).decode('ascii') @@ -805,7 +841,7 @@ class TestBewit(Base): credential_lookup = self.make_credential_lookup({ self.credentials['id']: self.credentials, }) - self.assertTrue(check_bewit(url, credential_lookup=credential_lookup, now=1356420407 + 10)) + check_bewit(url, credential_lookup=credential_lookup, now=1356420407 + 10) @raises(TokenExpired) def test_validate_expired_bewit(self):
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 2 }, "num_modified_files": 4 }
0.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "nose", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements/dev.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.16 babel==2.17.0 backports.tarfile==1.2.0 certifi==2025.1.31 cffi==1.17.1 charset-normalizer==3.4.1 cryptography==44.0.2 docutils==0.21.2 exceptiongroup==1.2.2 id==1.5.0 idna==3.10 imagesize==1.4.1 importlib_metadata==8.6.1 iniconfig==2.1.0 jaraco.classes==3.4.0 jaraco.context==6.0.1 jaraco.functools==4.1.0 jeepney==0.9.0 Jinja2==3.1.6 keyring==25.6.0 markdown-it-py==3.0.0 MarkupSafe==3.0.2 mdurl==0.1.2 mock==5.2.0 -e git+https://github.com/kumar303/mohawk.git@cacfa3c2c792a065adb812aded5b8daa5b0362aa#egg=mohawk more-itertools==10.6.0 nh3==0.2.21 nose==1.3.7 packaging==24.2 pluggy==1.5.0 pycparser==2.22 Pygments==2.19.1 pytest==8.3.5 readme_renderer==44.0 requests==2.32.3 requests-toolbelt==1.0.0 rfc3986==2.0.0 rich==14.0.0 SecretStorage==3.3.3 six==1.17.0 snowballstemmer==2.2.0 Sphinx==7.4.7 sphinx-rtd-theme==3.0.2 sphinxcontrib-applehelp==2.0.0 sphinxcontrib-devhelp==2.0.0 sphinxcontrib-htmlhelp==2.1.0 sphinxcontrib-jquery==4.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==2.0.0 sphinxcontrib-serializinghtml==2.0.0 tomli==2.2.1 twine==6.1.0 typing_extensions==4.13.0 urllib3==2.3.0 zipp==3.21.0
name: mohawk channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.16 - babel==2.17.0 - backports-tarfile==1.2.0 - certifi==2025.1.31 - cffi==1.17.1 - charset-normalizer==3.4.1 - cryptography==44.0.2 - docutils==0.21.2 - exceptiongroup==1.2.2 - id==1.5.0 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==8.6.1 - iniconfig==2.1.0 - jaraco-classes==3.4.0 - jaraco-context==6.0.1 - jaraco-functools==4.1.0 - jeepney==0.9.0 - jinja2==3.1.6 - keyring==25.6.0 - markdown-it-py==3.0.0 - markupsafe==3.0.2 - mdurl==0.1.2 - mock==5.2.0 - more-itertools==10.6.0 - nh3==0.2.21 - nose==1.3.7 - packaging==24.2 - pluggy==1.5.0 - pycparser==2.22 - pygments==2.19.1 - pytest==8.3.5 - readme-renderer==44.0 - requests==2.32.3 - requests-toolbelt==1.0.0 - rfc3986==2.0.0 - rich==14.0.0 - secretstorage==3.3.3 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==7.4.7 - sphinx-rtd-theme==3.0.2 - sphinxcontrib-applehelp==2.0.0 - sphinxcontrib-devhelp==2.0.0 - sphinxcontrib-htmlhelp==2.1.0 - sphinxcontrib-jquery==4.1 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==2.0.0 - sphinxcontrib-serializinghtml==2.0.0 - tomli==2.2.1 - twine==6.1.0 - typing-extensions==4.13.0 - urllib3==2.3.0 - zipp==3.21.0 prefix: /opt/conda/envs/mohawk
[ "mohawk/tests.py::TestSender::test_duplicate_keys", "mohawk/tests.py::TestSender::test_ext_with_all_valid_characters", "mohawk/tests.py::TestSender::test_ext_with_new_line", "mohawk/tests.py::TestSender::test_ext_with_quotes", "mohawk/tests.py::TestSender::test_invalid_key", "mohawk/tests.py::TestSender::test_too_long_header", "mohawk/tests.py::TestSender::test_unparseable_header", "mohawk/tests.py::TestBewit::test_bewit_with_backslashes_in_id", "mohawk/tests.py::TestBewit::test_bewit_with_invalid_ext", "mohawk/tests.py::TestBewit::test_parse_bewit_with_ext_and_backslashes", "mohawk/tests.py::TestBewit::test_validate_bewit_with_ext_and_backslashes" ]
[]
[ "mohawk/tests.py::TestConfig::test_no_algo", "mohawk/tests.py::TestConfig::test_no_credentials", "mohawk/tests.py::TestConfig::test_no_id", "mohawk/tests.py::TestConfig::test_no_key", "mohawk/tests.py::TestConfig::test_non_dict_credentials", "mohawk/tests.py::TestSender::test_app_ok", "mohawk/tests.py::TestSender::test_bad_ext", "mohawk/tests.py::TestSender::test_bad_secret", "mohawk/tests.py::TestSender::test_cannot_skip_content_only", "mohawk/tests.py::TestSender::test_cannot_skip_content_type_only", "mohawk/tests.py::TestSender::test_dlg_ok", "mohawk/tests.py::TestSender::test_expired_exception_reports_localtime", "mohawk/tests.py::TestSender::test_expired_ts", "mohawk/tests.py::TestSender::test_ext_with_equality_sign", "mohawk/tests.py::TestSender::test_ext_with_illegal_chars", "mohawk/tests.py::TestSender::test_ext_with_illegal_unicode", "mohawk/tests.py::TestSender::test_ext_with_illegal_utf8", "mohawk/tests.py::TestSender::test_get_ok", "mohawk/tests.py::TestSender::test_hash_tampering", "mohawk/tests.py::TestSender::test_invalid_credentials", "mohawk/tests.py::TestSender::test_localtime_offset", "mohawk/tests.py::TestSender::test_localtime_skew", "mohawk/tests.py::TestSender::test_missing_payload_details", "mohawk/tests.py::TestSender::test_non_ascii_content", "mohawk/tests.py::TestSender::test_non_hawk_scheme", "mohawk/tests.py::TestSender::test_nonce_fail", "mohawk/tests.py::TestSender::test_nonce_ok", "mohawk/tests.py::TestSender::test_post_content_ok", "mohawk/tests.py::TestSender::test_post_content_type_ok", "mohawk/tests.py::TestSender::test_post_content_type_with_trailing_charset", "mohawk/tests.py::TestSender::test_post_ok", "mohawk/tests.py::TestSender::test_skip_payload_hashing", "mohawk/tests.py::TestSender::test_tamper_with_content", "mohawk/tests.py::TestSender::test_tamper_with_content_type", "mohawk/tests.py::TestSender::test_tamper_with_host", "mohawk/tests.py::TestSender::test_tamper_with_method", "mohawk/tests.py::TestSender::test_tamper_with_path", "mohawk/tests.py::TestSender::test_tamper_with_port", "mohawk/tests.py::TestSender::test_tamper_with_query", "mohawk/tests.py::TestSender::test_tamper_with_scheme", "mohawk/tests.py::TestSender::test_tampered_app", "mohawk/tests.py::TestSender::test_tampered_dlg", "mohawk/tests.py::TestSender::test_unexpected_algorithm", "mohawk/tests.py::TestSender::test_unknown_id", "mohawk/tests.py::TestReceiver::test_cannot_receive_empty_content_only", "mohawk/tests.py::TestReceiver::test_cannot_receive_empty_content_type_only", "mohawk/tests.py::TestReceiver::test_get_ok", "mohawk/tests.py::TestReceiver::test_invalid_credentials_lookup", "mohawk/tests.py::TestReceiver::test_missing_authorization", "mohawk/tests.py::TestReceiver::test_post_ok", "mohawk/tests.py::TestReceiver::test_receive_wrong_content", "mohawk/tests.py::TestReceiver::test_receive_wrong_content_type", "mohawk/tests.py::TestReceiver::test_receive_wrong_method", "mohawk/tests.py::TestReceiver::test_receive_wrong_url", "mohawk/tests.py::TestReceiver::test_respond_with_bad_ts_skew_ok", "mohawk/tests.py::TestReceiver::test_respond_with_expired_ts", "mohawk/tests.py::TestReceiver::test_respond_with_ext", "mohawk/tests.py::TestReceiver::test_respond_with_unhashed_content", "mohawk/tests.py::TestReceiver::test_respond_with_wrong_app", "mohawk/tests.py::TestReceiver::test_respond_with_wrong_content", "mohawk/tests.py::TestReceiver::test_respond_with_wrong_content_type", "mohawk/tests.py::TestReceiver::test_respond_with_wrong_dlg", "mohawk/tests.py::TestReceiver::test_respond_with_wrong_method", "mohawk/tests.py::TestReceiver::test_respond_with_wrong_nonce", "mohawk/tests.py::TestReceiver::test_respond_with_wrong_url", "mohawk/tests.py::TestReceiver::test_unexpected_unhashed_content", "mohawk/tests.py::TestSendAndReceive::test", "mohawk/tests.py::TestBewit::test_bewit", "mohawk/tests.py::TestBewit::test_bewit_invalid_method", "mohawk/tests.py::TestBewit::test_bewit_with_binary_id", "mohawk/tests.py::TestBewit::test_bewit_with_ext", "mohawk/tests.py::TestBewit::test_bewit_with_nonce", "mohawk/tests.py::TestBewit::test_bewit_with_port", "mohawk/tests.py::TestBewit::test_parse_bewit", "mohawk/tests.py::TestBewit::test_parse_bewit_with_ext", "mohawk/tests.py::TestBewit::test_parse_invalid_bewit_with_only_one_part", "mohawk/tests.py::TestBewit::test_parse_invalid_bewit_with_only_two_parts", "mohawk/tests.py::TestBewit::test_strip_bewit", "mohawk/tests.py::TestBewit::test_strip_url_without_bewit", "mohawk/tests.py::TestBewit::test_validate_bewit", "mohawk/tests.py::TestBewit::test_validate_bewit_with_ext", "mohawk/tests.py::TestBewit::test_validate_bewit_with_unknown_credentials", "mohawk/tests.py::TestBewit::test_validate_expired_bewit" ]
[]
BSD 3-Clause "New" or "Revised" License
1,008
[ "mohawk/bewit.py", "docs/index.rst", "mohawk/util.py", "mohawk/base.py" ]
[ "mohawk/bewit.py", "docs/index.rst", "mohawk/util.py", "mohawk/base.py" ]
andialbrecht__sqlparse-323
d67c442db4fd8b60a97440e84b9c21e80e4e958c
2017-02-09 09:16:34
08cb6dab214dc638190c6e8f8d3b331b38bbd238
diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py index 1fd07c1..d68b4ae 100644 --- a/sqlparse/keywords.py +++ b/sqlparse/keywords.py @@ -167,6 +167,7 @@ KEYWORDS = { 'COMMIT': tokens.Keyword.DML, 'COMMITTED': tokens.Keyword, 'COMPLETION': tokens.Keyword, + 'CONCURRENTLY': tokens.Keyword, 'CONDITION_NUMBER': tokens.Keyword, 'CONNECT': tokens.Keyword, 'CONNECTION': tokens.Keyword,
Support CONCURRENTLY keyword in CREATE INDEX statements When parsing a statement like `CREATE INDEX CONCURRENTLY name ON ...`, "CONCURRENTLY name" is returned as a single identifier
andialbrecht/sqlparse
diff --git a/tests/test_regressions.py b/tests/test_regressions.py index cf88419..cc553c2 100644 --- a/tests/test_regressions.py +++ b/tests/test_regressions.py @@ -343,3 +343,16 @@ def test_issue315_utf8_by_default(): if PY2: tformatted = tformatted.decode('utf-8') assert formatted == tformatted + + +def test_issue322_concurrently_is_keyword(): + s = 'CREATE INDEX CONCURRENTLY myindex ON mytable(col1);' + p = sqlparse.parse(s)[0] + + assert len(p.tokens) == 12 + assert p.tokens[0].ttype is T.Keyword.DDL # CREATE + assert p.tokens[2].ttype is T.Keyword # INDEX + assert p.tokens[4].ttype is T.Keyword # CONCURRENTLY + assert p.tokens[4].value == 'CONCURRENTLY' + assert isinstance(p.tokens[6], sql.Identifier) + assert p.tokens[6].value == 'myindex'
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 1 }
0.2
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "pytest-cov" ], "pre_install": null, "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
coverage==7.8.0 exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work packaging @ file:///croot/packaging_1734472117206/work pluggy @ file:///croot/pluggy_1733169602837/work pytest @ file:///croot/pytest_1738938843180/work pytest-cov==6.0.0 -e git+https://github.com/andialbrecht/sqlparse.git@d67c442db4fd8b60a97440e84b9c21e80e4e958c#egg=sqlparse tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
name: sqlparse channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - coverage==7.8.0 - pytest-cov==6.0.0 prefix: /opt/conda/envs/sqlparse
[ "tests/test_regressions.py::test_issue322_concurrently_is_keyword" ]
[]
[ "tests/test_regressions.py::test_issue9", "tests/test_regressions.py::test_issue13", "tests/test_regressions.py::test_issue26[--hello]", "tests/test_regressions.py::test_issue26[--", "tests/test_regressions.py::test_issue26[--hello\\n]", "tests/test_regressions.py::test_issue26[--]", "tests/test_regressions.py::test_issue26[--\\n]", "tests/test_regressions.py::test_issue34[create]", "tests/test_regressions.py::test_issue34[CREATE]", "tests/test_regressions.py::test_issue35", "tests/test_regressions.py::test_issue38", "tests/test_regressions.py::test_issue39", "tests/test_regressions.py::test_issue40", "tests/test_regressions.py::test_issue78[get_name-z-select", "tests/test_regressions.py::test_issue78[get_real_name-y-select", "tests/test_regressions.py::test_issue78[get_parent_name-x-select", "tests/test_regressions.py::test_issue78[get_alias-z-select", "tests/test_regressions.py::test_issue78[get_typecast-text-select", "tests/test_regressions.py::test_issue83", "tests/test_regressions.py::test_comment_encoding_when_reindent", "tests/test_regressions.py::test_parse_sql_with_binary", "tests/test_regressions.py::test_dont_alias_keywords", "tests/test_regressions.py::test_format_accepts_encoding", "tests/test_regressions.py::test_stream", "tests/test_regressions.py::test_issue90", "tests/test_regressions.py::test_except_formatting", "tests/test_regressions.py::test_null_with_as", "tests/test_regressions.py::test_issue190_open_file", "tests/test_regressions.py::test_issue193_splitting_function", "tests/test_regressions.py::test_issue194_splitting_function", "tests/test_regressions.py::test_issue186_get_type", "tests/test_regressions.py::test_issue212_py2unicode", "tests/test_regressions.py::test_issue213_leadingws", "tests/test_regressions.py::test_issue227_gettype_cte", "tests/test_regressions.py::test_issue207_runaway_format", "tests/test_regressions.py::test_token_next_doesnt_ignore_skip_cm", "tests/test_regressions.py::test_issue284_as_grouping[SELECT", "tests/test_regressions.py::test_issue284_as_grouping[AS]", "tests/test_regressions.py::test_issue315_utf8_by_default" ]
[]
BSD 3-Clause "New" or "Revised" License
1,009
[ "sqlparse/keywords.py" ]
[ "sqlparse/keywords.py" ]
watson-developer-cloud__python-sdk-159
c0671178ffc648fc5fea8b48e0c81b8859304182
2017-02-09 21:57:06
78cf905b5c539a29da4af553dd1cf06834d08261
diff --git a/examples/notebooks/conversation_v1.ipynb b/examples/notebooks/conversation_v1.ipynb new file mode 100644 index 00000000..73515bc7 --- /dev/null +++ b/examples/notebooks/conversation_v1.ipynb @@ -0,0 +1,366 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "import json\n", + "import sys\n", + "import os\n", + "sys.path.append(os.path.join(os.getcwd(),'..','..'))\n", + "import watson_developer_cloud" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": true, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "USERNAME = os.environ.get('CONVERSATION_USERNAME','<USERNAME>')\n", + "PASSWORD = os.environ.get('CONVERSATION_PASSWORD','<PASSWORD>')" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "conversation = watson_developer_cloud.ConversationV1(username=USERNAME,\n", + " password=PASSWORD,\n", + " version='2016-09-20')" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'pagination': {'refresh_url': '/v1/workspaces?version=2016-09-20'},\n", + " 'workspaces': [{'created': '2017-02-09T19:46:26.792Z',\n", + " 'description': 'yo dawg',\n", + " 'language': 'en',\n", + " 'metadata': None,\n", + " 'name': 'development',\n", + " 'updated': '2017-02-09T20:00:38.558Z',\n", + " 'workspace_id': '8c8ee3b3-6149-4bc0-ba66-6517fd6c976a'}]}" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "conversation.list_workspaces()" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'my experimental workspace', 'created': '2017-02-09T21:48:35.245Z', 'updated': '2017-02-09T21:48:35.245Z', 'language': 'en', 'metadata': None, 'description': 'an experimental workspace', 'workspace_id': 'dbd1211f-3abb-4165-8a67-8bfa95410aa9'}\n" + ] + } + ], + "source": [ + "new_workspace = conversation.create_workspace(name='my experimental workspace',\n", + " description='an experimental workspace',\n", + " language='en',\n", + " intents=[{\n", + " \"intent\": \"orderpizza\",\n", + " \"examples\": [\n", + " {\n", + " \"text\": \"can I order a pizza?\"\n", + " },\n", + " {\n", + " \"text\": \"I want to order a pizza\"\n", + " },\n", + " {\n", + " \"text\": \"pizza order\"\n", + " },\n", + " {\n", + " \"text\": \"pizza to go\"\n", + " }\n", + " ],\n", + " \"description\": \"pizza intents\"\n", + " }\n", + " ],\n", + " dialog_nodes=[{'conditions': '#orderpizza',\n", + " 'context': None,\n", + " 'description': None,\n", + " 'dialog_node': 'YesYouCan',\n", + " 'go_to': None,\n", + " 'metadata': None,\n", + " 'output': {'text': {'selection_policy': 'random',\n", + " 'values': \n", + " ['Yes You can!', 'Of course!']}},\n", + " 'parent': None,\n", + " 'previous_sibling': None,}])\n", + "print(new_workspace)" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'created': '2017-02-09T21:48:35.245Z',\n", + " 'description': 'an experimental workspace',\n", + " 'language': 'en',\n", + " 'metadata': None,\n", + " 'name': 'my experimental workspace',\n", + " 'status': 'Training',\n", + " 'updated': '2017-02-09T21:48:35.245Z',\n", + " 'workspace_id': 'dbd1211f-3abb-4165-8a67-8bfa95410aa9'}" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "conversation.get_workspace(workspace_id=new_workspace['workspace_id'])" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'created': '2017-02-09T21:39:30.390Z',\n", + " 'description': 'an experimental workspace',\n", + " 'language': 'en',\n", + " 'metadata': None,\n", + " 'name': 'changed name',\n", + " 'updated': '2017-02-09T21:39:59.124Z',\n", + " 'workspace_id': '66e78807-13fa-47ae-9251-dd8c89c8fd19'}" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "new_workspace['name'] = 'changed name'\n", + "conversation.update_workspace(new_workspace['workspace_id'], name=new_workspace['name'])" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'counterexamples': [],\n", + " 'created': '2017-02-09T21:48:35.245Z',\n", + " 'description': 'an experimental workspace',\n", + " 'dialog_nodes': [{'conditions': '#orderpizza',\n", + " 'context': None,\n", + " 'created': '2017-02-09T21:48:35.245Z',\n", + " 'description': None,\n", + " 'dialog_node': 'YesYouCan',\n", + " 'go_to': None,\n", + " 'metadata': None,\n", + " 'output': {'text': {'selection_policy': 'random',\n", + " 'values': ['Yes You can!', 'Of course!']}},\n", + " 'parent': None,\n", + " 'previous_sibling': None,\n", + " 'updated': '2017-02-09T21:48:35.245Z'}],\n", + " 'entities': [],\n", + " 'intents': [{'created': '2017-02-09T21:48:35.245Z',\n", + " 'description': 'pizza intents',\n", + " 'examples': [{'created': '2017-02-09T21:48:35.245Z',\n", + " 'text': 'can I order a pizza?',\n", + " 'updated': '2017-02-09T21:48:35.245Z'},\n", + " {'created': '2017-02-09T21:48:35.245Z',\n", + " 'text': 'I want to order a pizza',\n", + " 'updated': '2017-02-09T21:48:35.245Z'},\n", + " {'created': '2017-02-09T21:48:35.245Z',\n", + " 'text': 'pizza order',\n", + " 'updated': '2017-02-09T21:48:35.245Z'},\n", + " {'created': '2017-02-09T21:48:35.245Z',\n", + " 'text': 'pizza to go',\n", + " 'updated': '2017-02-09T21:48:35.245Z'}],\n", + " 'intent': 'orderpizza',\n", + " 'updated': '2017-02-09T21:48:35.245Z'}],\n", + " 'language': 'en',\n", + " 'metadata': None,\n", + " 'name': 'my experimental workspace',\n", + " 'status': 'Available',\n", + " 'updated': '2017-02-09T21:48:35.245Z',\n", + " 'workspace_id': 'dbd1211f-3abb-4165-8a67-8bfa95410aa9'}" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "conversation.get_workspace(new_workspace['workspace_id'], export=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"intents\": [\n", + " {\n", + " \"intent\": \"orderpizza\",\n", + " \"confidence\": 1\n", + " }\n", + " ],\n", + " \"entities\": [],\n", + " \"input\": {\n", + " \"text\": \"can I order a pizza?\"\n", + " },\n", + " \"output\": {\n", + " \"log_messages\": [],\n", + " \"text\": [\n", + " \"Of course!\"\n", + " ],\n", + " \"nodes_visited\": [\n", + " \"YesYouCan\"\n", + " ]\n", + " },\n", + " \"context\": {\n", + " \"conversation_id\": \"972f212d-be0f-47fd-a82d-a6f917e16cfd\",\n", + " \"system\": {\n", + " \"dialog_stack\": [\n", + " {\n", + " \"dialog_node\": \"root\"\n", + " }\n", + " ],\n", + " \"dialog_turn_counter\": 1,\n", + " \"dialog_request_counter\": 1,\n", + " \"_node_output_map\": {\n", + " \"YesYouCan\": [\n", + " 0,\n", + " 1,\n", + " 0\n", + " ]\n", + " }\n", + " }\n", + " },\n", + " \"alternate_intents\": false\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.message(workspace_id=new_workspace['workspace_id'],\n", + " message_input={'text': 'can I order a pizza?'})\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{}" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "conversation.delete_workspace(new_workspace['workspace_id'])" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.0" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/watson_developer_cloud/conversation_v1.py b/watson_developer_cloud/conversation_v1.py index 51fa0564..408c225b 100644 --- a/watson_developer_cloud/conversation_v1.py +++ b/watson_developer_cloud/conversation_v1.py @@ -30,6 +30,130 @@ class ConversationV1(WatsonDeveloperCloudService): **kwargs) self.version = version + def list_workspaces(self): + """ + List workspaces available. + This includes pagination info. + """ + params = {'version': self.version} + return self.request(method='GET', + url='/v1/workspaces', + params=params, + accept_json=True) + + def get_workspace(self, workspace_id, export=False): + """ + Get a specific workspace + :param: workspace_id the guid of the workspace + :param: export (optional) return all workspace data + """ + params = {'version': self.version} + if export: + params['export'] = True + + return self.request(method='GET', + url='/v1/workspaces/{0}'.format(workspace_id), + params=params, + accept_json=True) + + def delete_workspace(self, workspace_id): + """ + Deletes a given workspace. + :param: workspace_id the guid of the workspace_id + """ + params = {'version': self.version} + return self.request(method='DELETE', + url='/v1/workspaces/{0}'.format(workspace_id), + params=params, + accept_json=True) + + def create_workspace(self, name, description, language, + intents=None, + entities=None, + dialog_nodes=None, + counterexamples=None, + metadata=None): + """ + Create a new workspace + :param name: Name of the workspace + :param description: description of the worksspace + :param language: language code + :param entities: an array of entities (optional) + :param dialog_nodes: an array of dialog notes (optional) + :param counterexamples: an array of counterexamples (optional) + :param metadata: metadata dictionary (optional) + """ + payload = {'name': name, + 'description': description, + 'language': language} + if intents is not None: + payload['intents'] = intents + + if entities is not None: + payload['entities'] = entities + + if dialog_nodes is not None: + payload['dialog_nodes'] = dialog_nodes + + if counterexamples is not None: + payload['counterexamples'] = counterexamples + + if metadata is not None: + payload['metadata'] = metadata + + params = {'version': self.version} + return self.request(method='POST', + url='/v1/workspaces', + json=payload, + params=params, + accept_json=True) + + def update_workspace(self, workspace_id, + name=None, + description=None, + language=None, + intents=None, + entities=None, + dialog_nodes=None, + counterexamples=None, + metadata=None): + """ + Update an existing workspace + :param workspace_id: the guid of the workspace to update + :param name: Name of the workspace + :param description: description of the worksspace + :param language: language code + :param entities: an array of entities (optional) + :param dialog_nodes: an array of dialog notes (optional) + :param counterexamples: an array of counterexamples (optional) + :param metadata: metadata dictionary (optional) + """ + params = {'version': self.version} + payload = {'name': name, + 'description': description, + 'language': language} + if intents is not None: + payload['intents'] = intents + + if entities is not None: + payload['entities'] = entities + + if dialog_nodes is not None: + payload['dialog_nodes'] = dialog_nodes + + if counterexamples is not None: + payload['counterexamples'] = counterexamples + + if metadata is not None: + payload['metadata'] = metadata + + params = {'version': self.version} + return self.request(method='POST', + url='/v1/workspaces/{0}'.format(workspace_id), + json=payload, + params=params, + accept_json=True) + def message(self, workspace_id, message_input=None, context=None, entities=None, intents=None, output=None, alternate_intents=False):
Python SDK requires Conversation API implementation for 'workspaces' endpoint. The new Conversation endpoint supports the management of workspaces via the /workspaces API endpoint. This functionality needs to be implemented ASAP https://watson-api-explorer.mybluemix.net/apis/conversation-v1
watson-developer-cloud/python-sdk
diff --git a/test/test_conversation_v1.py b/test/test_conversation_v1.py index 527044c4..fb8d494a 100644 --- a/test/test_conversation_v1.py +++ b/test/test_conversation_v1.py @@ -1,39 +1,235 @@ +import json import responses import watson_developer_cloud +platform_url = "https://gateway.watsonplatform.net" +conversation_path = "/conversation/api/v1" +base_url = "{0}{1}".format(platform_url, conversation_path) + + [email protected] +def test_list_worksapces(): + workspace_url = "{0}{1}".format(base_url, "/workspaces") + message_response = {"workspaces": [], + "pagination": { + "refresh_url": + "/v1/workspaces?version=2016-09-20"}} + responses.add(responses.GET, workspace_url, + body=json.dumps(message_response), status=200, + content_type='application/json') + conversation = watson_developer_cloud.ConversationV1(username="username", + password="password", + version='2016-09-20') + workspaces = conversation.list_workspaces() + assert 'workspaces' in workspaces + assert len(workspaces['workspaces']) == 0 + + [email protected] +def test_get_workspace(): + workspace_url = "{0}{1}/boguswid".format(base_url, "/workspaces") + message_response = { + "name": "development", + "created": "2017-02-09T18:41:19.890Z", + "updated": "2017-02-09T18:41:19.890Z", + "language": "en", + "metadata": None, + "description": "this is a workspace", + "workspace_id": "boguswid", + "status": 'Training', + } + responses.add(responses.GET, workspace_url, + body=json.dumps(message_response), status=200, + content_type='application/json') + conversation = watson_developer_cloud.ConversationV1(username="username", + password="password", + version='2016-09-20') + workspace = conversation.get_workspace(workspace_id='boguswid') + assert workspace['name'] == 'development' + assert workspace['workspace_id'] == 'boguswid' + assert workspace['status'] == 'Training' + + workspace = conversation.get_workspace(workspace_id='boguswid', + export=True) + assert workspace['status'] == 'Training' + + [email protected] +def test_delete_workspace(): + workspace_url = "{0}{1}/boguswid".format(base_url, "/workspaces") + message_response = {} + responses.add(responses.DELETE, workspace_url, + body=json.dumps(message_response), status=200, + content_type='application/json') + conversation = watson_developer_cloud.ConversationV1(username="username", + password="password", + version='2016-09-20') + workspace = conversation.delete_workspace(workspace_id='boguswid') + assert len(responses.calls) == 1 + assert workspace == {} + + [email protected] +def test_create_workspace(): + workspace_data = { + "name": "development", + "intents": [ + { + "intent": "orderpizza", + "examples": [ + { + "text": "can I order a pizza?" + }, { + "text": "want order a pizza" + }, { + "text": "pizza order" + }, { + "text": "pizza to go" + }], + "description": None + }], + "entities": [{'entity': 'just for testing'}], + "language": "en", + "metadata": {'thing': 'something'}, + "description": "this is a development workspace", + "dialog_nodes": [{'conditions': '#orderpizza', + 'context': None, + 'description': None, + 'dialog_node': 'YesYouCan', + 'go_to': None, + 'metadata': None, + 'output': {'text': {'selection_policy': 'random', + 'values': ['Yes You can!', 'Of course!']}}, + 'parent': None, + 'previous_sibling': None}], + "counterexamples": [{'counter': 'counterexamples for test'}] + } + + workspace_url = "{0}{1}".format(base_url, "/workspaces") + message_response = workspace_data + message_response["workspace_id"] = 'bogusid' + responses.add(responses.POST, workspace_url, + body=json.dumps(message_response), status=200, + content_type='application/json') + conversation = watson_developer_cloud.ConversationV1(username="username", + password="password", + version='2016-09-20') + workspace = conversation.create_workspace(name=workspace_data['name'], + description=workspace_data['description'], + language=workspace_data['language'], + intents=workspace_data['intents'], + metadata=workspace_data['metadata'], + counterexamples=workspace_data['counterexamples'], + dialog_nodes=workspace_data['dialog_nodes'], + entities=workspace_data['entities']) + assert workspace == message_response + assert len(responses.calls) == 1 + + [email protected] +def test_update_workspace(): + workspace_data = { + "name": "development", + "intents": [ + { + "intent": "orderpizza", + "examples": [ + { + "text": "can I order a pizza?" + }, { + "text": "want order a pizza" + }, { + "text": "pizza order" + }, { + "text": "pizza to go" + }], + "description": None + }], + "entities": [], + "language": "en", + "metadata": {}, + "description": "this is a development workspace", + "dialog_nodes": [], + "counterexamples": [], + "workspace_id": 'boguswid' + } + + workspace_url = "{0}{1}".format(base_url, "/workspaces/boguswid") + message_response = workspace_data + responses.add(responses.POST, workspace_url, + body=json.dumps(message_response), status=200, + content_type='application/json') + conversation = watson_developer_cloud.ConversationV1(username="username", + password="password", + version='2016-09-20') + workspace = conversation.update_workspace('boguswid', + name=workspace_data['name'], + description=workspace_data['description'], + language=workspace_data['language'], + intents=workspace_data['intents'], + metadata=workspace_data['metadata'], + counterexamples=workspace_data['counterexamples'], + dialog_nodes=workspace_data['dialog_nodes'], + entities=workspace_data['entities']) + assert len(responses.calls) == 1 + assert workspace == message_response + + @responses.activate def test_message(): -# Ranker endpoints conversation = watson_developer_cloud.ConversationV1(username="username", password="password", version='2016-09-20') workspace_id = 'f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec' - message_url = 'https://gateway.watsonplatform.net/conversation/api/v1/workspaces/%s/message' % workspace_id - message_url1 = 'https://gateway.watsonplatform.net/conversation/api/v1/workspaces/%s/message?version=2016-09-20' % workspace_id - message_response = '{"context":{"conversation_id":"1b7b67c0-90ed-45dc-8508-9488bc483d5b","system":{"dialog_stack":["root"],"dialog_turn_counter":1,"dialog_request_counter":1}},"intents":[],"entities":[],"input":{}}' + message_url = '%s/workspaces/%s/message' % (base_url, workspace_id) + url1_str = '%s/workspaces/%s/message?version=2016-09-20' + message_url1 = url1_str % (base_url, workspace_id) + message_response = {"context": { + "conversation_id": + "1b7b67c0-90ed-45dc-8508-9488bc483d5b", + "system": {"dialog_stack": + ["root"], + "dialog_turn_counter": 1, + "dialog_request_counter": 1}}, + "intents": [], + "entities": [], + "input": {}} responses.add(responses.POST, message_url, - body=message_response, status=200, - content_type='application/json') + body=json.dumps(message_response), + status=200, + content_type='application/json') - message = conversation.message(workspace_id=workspace_id, message_input={'text': 'Turn on the lights'}, context=None) + message = conversation.message(workspace_id=workspace_id, + message_input={'text': + 'Turn on the lights'}, + context=None) assert message is not None assert responses.calls[0].request.url == message_url1 - assert responses.calls[0].response.text == message_response + assert responses.calls[0].response.text == json.dumps(message_response) - # test context +# test context responses.add(responses.POST, message_url, - body=message_response, status=200, - content_type='application/json') + body=message_response, status=200, + content_type='application/json') - message = conversation.message(workspace_id=workspace_id, message_input={'text': 'Turn on the lights'}, context={'context': {'conversation_id':'1b7b67c0-90ed-45dc-8508-9488bc483d5b', 'system': {'dialog_stack':['root'], 'dialog_turn_counter':2, 'dialog_request_counter':1}}}) + message_ctx = {'context': + {'conversation_id': '1b7b67c0-90ed-45dc-8508-9488bc483d5b', + 'system': { + 'dialog_stack': ['root'], + 'dialog_turn_counter': 2, + 'dialog_request_counter': 1}}} + message = conversation.message(workspace_id=workspace_id, + message_input={'text': + 'Turn on the lights'}, + context=json.dumps(message_ctx)) assert message is not None assert responses.calls[1].request.url == message_url1 - assert responses.calls[1].response.text == message_response + assert responses.calls[1].response.text == json.dumps(message_response) assert len(responses.calls) == 2
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks", "has_added_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 3, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 1 }
0.24
{ "env_vars": null, "env_yml_path": null, "install": "pip install --editable .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "responses", "python_dotenv", "pylint", "coverage", "codecov", "pytest-cov", "recommonmark", "Sphinx", "bumpversion" ], "pre_install": null, "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 astroid==2.11.7 attrs==22.2.0 Babel==2.11.0 bump2version==1.0.1 bumpversion==0.6.0 certifi==2021.5.30 charset-normalizer==2.0.12 codecov==2.1.13 commonmark==0.9.1 coverage==6.2 dill==0.3.4 docutils==0.18.1 idna==3.10 imagesize==1.4.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isort==5.10.1 Jinja2==3.0.3 lazy-object-proxy==1.7.1 MarkupSafe==2.0.1 mccabe==0.7.0 packaging==21.3 platformdirs==2.4.0 pluggy==1.0.0 py==1.11.0 Pygments==2.14.0 pylint==2.13.9 pyparsing==3.1.4 pysolr==3.10.0 pytest==7.0.1 pytest-cov==4.0.0 python-dotenv==0.20.0 pytz==2025.2 recommonmark==0.7.1 requests==2.27.1 responses==0.17.0 six==1.17.0 snowballstemmer==2.2.0 Sphinx==5.3.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 tomli==1.2.3 typed-ast==1.5.5 typing_extensions==4.1.1 urllib3==1.26.20 -e git+https://github.com/watson-developer-cloud/python-sdk.git@c0671178ffc648fc5fea8b48e0c81b8859304182#egg=watson_developer_cloud wrapt==1.16.0 zipp==3.6.0
name: python-sdk channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - argparse==1.4.0 - astroid==2.11.7 - attrs==22.2.0 - babel==2.11.0 - bump2version==1.0.1 - bumpversion==0.6.0 - charset-normalizer==2.0.12 - codecov==2.1.13 - commonmark==0.9.1 - coverage==6.2 - dill==0.3.4 - docutils==0.18.1 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isort==5.10.1 - jinja2==3.0.3 - lazy-object-proxy==1.7.1 - markupsafe==2.0.1 - mccabe==0.7.0 - packaging==21.3 - platformdirs==2.4.0 - pluggy==1.0.0 - py==1.11.0 - pygments==2.14.0 - pylint==2.13.9 - pyparsing==3.1.4 - pysolr==3.10.0 - pytest==7.0.1 - pytest-cov==4.0.0 - python-dotenv==0.20.0 - pytz==2025.2 - recommonmark==0.7.1 - requests==2.27.1 - responses==0.17.0 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==5.3.0 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - tomli==1.2.3 - typed-ast==1.5.5 - typing-extensions==4.1.1 - urllib3==1.26.20 - wrapt==1.16.0 - zipp==3.6.0 prefix: /opt/conda/envs/python-sdk
[ "test/test_conversation_v1.py::test_list_worksapces", "test/test_conversation_v1.py::test_get_workspace", "test/test_conversation_v1.py::test_delete_workspace", "test/test_conversation_v1.py::test_create_workspace", "test/test_conversation_v1.py::test_update_workspace" ]
[ "test/test_conversation_v1.py::test_message" ]
[]
[]
Apache License 2.0
1,010
[ "watson_developer_cloud/conversation_v1.py", "examples/notebooks/conversation_v1.ipynb" ]
[ "watson_developer_cloud/conversation_v1.py", "examples/notebooks/conversation_v1.ipynb" ]
pre-commit__pre-commit-hooks-175
20f04626a1ee7eb34955d775a37aa9a56a0a7448
2017-02-10 13:28:28
20f04626a1ee7eb34955d775a37aa9a56a0a7448
diff --git a/pre_commit_hooks/detect_aws_credentials.py b/pre_commit_hooks/detect_aws_credentials.py index b0826ca..42758f0 100644 --- a/pre_commit_hooks/detect_aws_credentials.py +++ b/pre_commit_hooks/detect_aws_credentials.py @@ -95,6 +95,12 @@ def main(argv=None): 'secret keys from' ) ) + parser.add_argument( + '--allow-missing-credentials', + dest='allow_missing_credentials', + action='store_true', + help='Allow hook to pass when no credentials are detected.' + ) args = parser.parse_args(argv) credential_files = set(args.credential_files) @@ -111,6 +117,9 @@ def main(argv=None): # the set of keys. keys |= get_aws_secrets_from_env() + if not keys and args.allow_missing_credentials: + return 0 + if not keys: print( 'No AWS keys were found in the configured credential files and '
detect-aws-credentials fails when no credentials are set As part of our developer setup, each person installs the pre-commit and inherits the project's hooks, but not everyone has aws credentials set up, so `detect-aws-credentials` will product a failure when the individual hasn't set any keys file or has any exported to their env. https://github.com/pre-commit/pre-commit-hooks/blob/20f04626a1ee7eb34955d775a37aa9a56a0a7448/pre_commit_hooks/detect_aws_credentials.py#L112 I'm not sure of the best way to handle this within the current logic - I'd rather exit 0 with a passing warning than fail, since this then forces the individual to go and set up a credentials file, even if they don't use one. I guess the "simple" workaround is to `export AWS_SECRET_ACCESS_KEY="RANDOMSTRINGTHATNEVERTEXISTSINMYCODE!!"` before running the pre-commit hooks, but this seems wrong.
pre-commit/pre-commit-hooks
diff --git a/tests/detect_aws_credentials_test.py b/tests/detect_aws_credentials_test.py index 9c2fda7..943a3f8 100644 --- a/tests/detect_aws_credentials_test.py +++ b/tests/detect_aws_credentials_test.py @@ -130,3 +130,17 @@ def test_non_existent_credentials(mock_secrets_env, mock_secrets_file, capsys): 'and environment variables.\nPlease ensure you have the ' 'correct setting for --credentials-file\n' ) + + +@patch('pre_commit_hooks.detect_aws_credentials.get_aws_secrets_from_file') +@patch('pre_commit_hooks.detect_aws_credentials.get_aws_secrets_from_env') +def test_non_existent_credentials_with_allow_flag(mock_secrets_env, mock_secrets_file): + """Test behavior with no configured AWS secrets and flag to allow when missing.""" + mock_secrets_env.return_value = set() + mock_secrets_file.return_value = set() + ret = main(( + get_resource_path('aws_config_without_secrets.ini'), + "--credentials-file=testing/resources/credentailsfilethatdoesntexist", + "--allow-missing-credentials" + )) + assert ret == 0
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 1 }, "num_modified_files": 1 }
0.7
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio pre-commit", "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": [ "requirements-dev.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 autopep8==2.0.4 certifi==2021.5.30 cfgv==3.3.1 coverage==6.2 distlib==0.3.9 execnet==1.9.0 filelock==3.4.1 flake8==2.5.5 identify==2.4.4 importlib-metadata==4.2.0 importlib-resources==5.2.3 iniconfig==1.1.1 mccabe==0.4.0 mock==5.2.0 nodeenv==1.6.0 packaging==21.3 pep8==1.7.1 platformdirs==2.4.0 pluggy==1.0.0 pre-commit==2.17.0 -e git+https://github.com/pre-commit/pre-commit-hooks.git@20f04626a1ee7eb34955d775a37aa9a56a0a7448#egg=pre_commit_hooks py==1.11.0 pycodestyle==2.10.0 pyflakes==1.0.0 pyparsing==3.1.4 pytest==7.0.1 pytest-asyncio==0.16.0 pytest-cov==4.0.0 pytest-mock==3.6.1 pytest-xdist==3.0.2 PyYAML==6.0.1 simplejson==3.20.1 six==1.17.0 toml==0.10.2 tomli==1.2.3 typing_extensions==4.1.1 virtualenv==20.16.2 zipp==3.6.0
name: pre-commit-hooks channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - autopep8==2.0.4 - cfgv==3.3.1 - coverage==6.2 - distlib==0.3.9 - execnet==1.9.0 - filelock==3.4.1 - flake8==2.5.5 - identify==2.4.4 - importlib-metadata==4.2.0 - importlib-resources==5.2.3 - iniconfig==1.1.1 - mccabe==0.4.0 - mock==5.2.0 - nodeenv==1.6.0 - packaging==21.3 - pep8==1.7.1 - platformdirs==2.4.0 - pluggy==1.0.0 - pre-commit==2.17.0 - py==1.11.0 - pycodestyle==2.10.0 - pyflakes==1.0.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-asyncio==0.16.0 - pytest-cov==4.0.0 - pytest-mock==3.6.1 - pytest-xdist==3.0.2 - pyyaml==6.0.1 - simplejson==3.20.1 - six==1.17.0 - toml==0.10.2 - tomli==1.2.3 - typing-extensions==4.1.1 - virtualenv==20.16.2 - zipp==3.6.0 prefix: /opt/conda/envs/pre-commit-hooks
[ "tests/detect_aws_credentials_test.py::test_non_existent_credentials_with_allow_flag" ]
[]
[ "tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars0-values0]", "tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars1-values1]", "tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars2-values2]", "tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars3-values3]", "tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars4-values4]", "tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars5-values5]", "tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars6-values6]", "tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars7-values7]", "tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars8-values8]", "tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_env[env_vars0-values0]", "tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_env[env_vars1-values1]", "tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_env[env_vars2-values2]", "tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_env[env_vars3-values3]", "tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_env[env_vars4-values4]", "tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_env[env_vars5-values5]", "tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_env[env_vars6-values6]", "tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_file[aws_config_with_secret.ini-expected_keys0]", "tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_file[aws_config_with_session_token.ini-expected_keys1]", "tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_file[aws_config_with_secret_and_session_token.ini-expected_keys2]", "tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_file[aws_config_with_multiple_sections.ini-expected_keys3]", "tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_file[aws_config_without_secrets.ini-expected_keys4]", "tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_file[nonsense.txt-expected_keys5]", "tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_file[ok_json.json-expected_keys6]", "tests/detect_aws_credentials_test.py::test_detect_aws_credentials[aws_config_with_secret.ini-1]", "tests/detect_aws_credentials_test.py::test_detect_aws_credentials[aws_config_with_session_token.ini-1]", "tests/detect_aws_credentials_test.py::test_detect_aws_credentials[aws_config_with_multiple_sections.ini-1]", "tests/detect_aws_credentials_test.py::test_detect_aws_credentials[aws_config_without_secrets.ini-0]", "tests/detect_aws_credentials_test.py::test_detect_aws_credentials[nonsense.txt-0]", "tests/detect_aws_credentials_test.py::test_detect_aws_credentials[ok_json.json-0]", "tests/detect_aws_credentials_test.py::test_non_existent_credentials" ]
[]
MIT License
1,011
[ "pre_commit_hooks/detect_aws_credentials.py" ]
[ "pre_commit_hooks/detect_aws_credentials.py" ]
jaysonsantos__jinja-assets-compressor-47
13dd55cecae3f0ca16b9a52a59be5087c0bf9f36
2017-02-10 20:39:13
13dd55cecae3f0ca16b9a52a59be5087c0bf9f36
diff --git a/jac/base.py b/jac/base.py index aab7298..8dc9708 100644 --- a/jac/base.py +++ b/jac/base.py @@ -49,7 +49,7 @@ class Compressor(object): ), ) - if os.path.exists(cached_file): + if not self.config.compressor_debug and os.path.exists(cached_file): filename = os.path.join( u(self.config.compressor_static_prefix), os.path.basename(cached_file), @@ -79,13 +79,6 @@ class Compressor(object): msg = u('Unsupported type of compression {0}').format(mimetype) raise RuntimeError(msg) - text = self.get_contents(text) - compressed = compressor.compile(text, - mimetype=mimetype, - cwd=cwd, - uri_cwd=uri_cwd, - debug=self.config.compressor_debug) - if not self.config.compressor_debug: outfile = cached_file else: @@ -98,14 +91,27 @@ class Compressor(object): ), ) - if assets.get(outfile) is None: - assets[outfile] = u('') - assets[outfile] += u("\n") + compressed + if os.path.exists(outfile): + assets[outfile] = None + continue + + text = self.get_contents(text) + compressed = compressor.compile(text, + mimetype=mimetype, + cwd=cwd, + uri_cwd=uri_cwd, + debug=self.config.compressor_debug) + + if not os.path.exists(outfile): + if assets.get(outfile) is None: + assets[outfile] = u('') + assets[outfile] += u("\n") + compressed blocks = u('') for outfile, asset in assets.items(): - with open(outfile, 'w', encoding='utf-8') as fh: - fh.write(asset) + if not os.path.exists(outfile): + with open(outfile, 'w', encoding='utf-8') as fh: + fh.write(asset) filename = os.path.join( u(self.config.compressor_static_prefix), os.path.basename(outfile), diff --git a/jac/contrib/flask.py b/jac/contrib/flask.py index 7111d19..4c53060 100644 --- a/jac/contrib/flask.py +++ b/jac/contrib/flask.py @@ -84,8 +84,8 @@ class JAC(object): app.jinja_env.compressor_offline_compress = app.config.get('COMPRESSOR_OFFLINE_COMPRESS', False) app.jinja_env.compressor_follow_symlinks = app.config.get('COMPRESSOR_FOLLOW_SYMLINKS', False) app.jinja_env.compressor_debug = app.config.get('COMPRESSOR_DEBUG', False) - app.jinja_env.compressor_output_dir = app.config.get('COMPRESSOR_OUTPUT_DIR') or app.static_folder - app.jinja_env.compressor_static_prefix = app.config.get('COMPRESSOR_STATIC_PREFIX') or app.static_url_path + app.jinja_env.compressor_output_dir = app.config.get('COMPRESSOR_OUTPUT_DIR') or os.path.join(app.static_folder, 'sdist') + app.jinja_env.compressor_static_prefix = app.config.get('COMPRESSOR_STATIC_PREFIX') or app.static_url_path + '/sdist' app.jinja_env.compressor_classes = app.config.get('COMPRESSOR_CLASSES', { 'text/css': LessCompressor, 'text/coffeescript': CoffeeScriptCompressor,
This tool is too slow, how to improve?
jaysonsantos/jinja-assets-compressor
diff --git a/tests/contrib/test_flask.py b/tests/contrib/test_flask.py index 6bf6bbe..0c11cdd 100644 --- a/tests/contrib/test_flask.py +++ b/tests/contrib/test_flask.py @@ -22,20 +22,24 @@ def test_flask_extension_jinja_env_add_extension(mocked_flask_app): def test_flask_extension_jinja_env_compressor_output_dir(mocked_flask_app): mocked_flask_app.static_folder = '/static/folder' + mocked_flask_app.static_url_path = '/static' mocked_flask_app.config = dict() ext = JAC() ext.init_app(mocked_flask_app) - assert mocked_flask_app.jinja_env.compressor_output_dir == '/static/folder' + assert mocked_flask_app.jinja_env.compressor_output_dir == '/static/folder/sdist' + assert mocked_flask_app.jinja_env.compressor_static_prefix == '/static/sdist' def test_flask_extension_jinja_env_static_prefix(mocked_flask_app): + mocked_flask_app.static_folder = '/static/folder' mocked_flask_app.static_url_path = '/static-url' mocked_flask_app.config = dict() ext = JAC() ext.init_app(mocked_flask_app) - assert mocked_flask_app.jinja_env.compressor_static_prefix == '/static-url' + assert mocked_flask_app.jinja_env.compressor_output_dir == '/static/folder/sdist' + assert mocked_flask_app.jinja_env.compressor_static_prefix == '/static-url/sdist' def test_flask_extension_jinja_env_source_dirs(mocked_flask_app):
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 3, "test_score": 2 }, "num_modified_files": 2 }
0.15
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "mock" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
beautifulsoup4==4.5.1 exceptiongroup==1.2.2 iniconfig==2.1.0 -e git+https://github.com/jaysonsantos/jinja-assets-compressor.git@13dd55cecae3f0ca16b9a52a59be5087c0bf9f36#egg=jac Jinja2==3.1.6 MarkupSafe==3.0.2 mock==5.2.0 ordereddict==1.1 packaging==24.2 pluggy==1.5.0 pytest==8.3.5 rjsmin==1.0.12 six==1.10.0 tomli==2.2.1
name: jinja-assets-compressor channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - beautifulsoup4==4.5.1 - exceptiongroup==1.2.2 - iniconfig==2.1.0 - jinja2==3.1.6 - markupsafe==3.0.2 - mock==5.2.0 - ordereddict==1.1 - packaging==24.2 - pluggy==1.5.0 - pytest==8.3.5 - rjsmin==1.0.12 - six==1.10.0 - tomli==2.2.1 prefix: /opt/conda/envs/jinja-assets-compressor
[ "tests/contrib/test_flask.py::test_flask_extension_jinja_env_compressor_output_dir", "tests/contrib/test_flask.py::test_flask_extension_jinja_env_static_prefix" ]
[]
[ "tests/contrib/test_flask.py::test_flask_extension_init_self_app", "tests/contrib/test_flask.py::test_flask_extension_jinja_env_add_extension", "tests/contrib/test_flask.py::test_flask_extension_jinja_env_source_dirs" ]
[]
MIT License
1,013
[ "jac/base.py", "jac/contrib/flask.py" ]
[ "jac/base.py", "jac/contrib/flask.py" ]
elastic__elasticsearch-dsl-py-585
d291eb55ef01f6bfa02835dcfd90276d5cd8871e
2017-02-11 00:32:49
7c1dad0f99957db9ebb9bfe10cf72cf1a8ec3fb3
diff --git a/elasticsearch_dsl/index.py b/elasticsearch_dsl/index.py index 3d6af0e..9237377 100644 --- a/elasticsearch_dsl/index.py +++ b/elasticsearch_dsl/index.py @@ -31,7 +31,8 @@ class Index(object): :arg using: connection alias to use, defaults to ``'default'`` """ i = Index(name, using=using or self._using) - for attr in ('_doc_types', '_mappings', '_settings', '_aliases'): + for attr in ('_doc_types', '_mappings', '_settings', '_aliases', + '_analysis'): setattr(i, attr, getattr(self, attr).copy()) return i diff --git a/setup.py b/setup.py index 661276a..bdf9a33 100644 --- a/setup.py +++ b/setup.py @@ -60,4 +60,6 @@ setup( test_suite = "test_elasticsearch_dsl.run_tests.run_all", tests_require=tests_require, + + extras_require={'develop': tests_require}, )
Index.clone() does not copy Index._analysis I am not sure if it's intended or not but `Index.clone()` does not copy `_analysis` attribute.
elastic/elasticsearch-dsl-py
diff --git a/test_elasticsearch_dsl/test_index.py b/test_elasticsearch_dsl/test_index.py index d2faaad..17aa6b7 100644 --- a/test_elasticsearch_dsl/test_index.py +++ b/test_elasticsearch_dsl/test_index.py @@ -27,6 +27,24 @@ def test_cloned_index_has_copied_settings_and_using(): assert i._settings == i2._settings assert i._settings is not i2._settings +def test_cloned_index_has_analysis_attribute(): + """ + Regression test for Issue #582 in which `Index.clone()` was not copying + over the `_analysis` attribute. + """ + client = object() + i = Index('my-index', using=client) + + random_analyzer_name = ''.join((choice(string.ascii_letters) for _ in range(100))) + random_analyzer = analyzer(random_analyzer_name, tokenizer="standard", filter="standard") + + i.analyzer(random_analyzer) + + i2 = i.clone('my-clone-index') + + assert i.to_dict()['settings']['analysis'] == i2.to_dict()['settings']['analysis'] + + def test_settings_are_saved(): i = Index('i') i.settings(number_of_replicas=0)
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 2 }
5.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e '.[develop]'", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "mock", "pytz", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 elasticsearch==5.5.3 -e git+https://github.com/elastic/elasticsearch-dsl-py.git@d291eb55ef01f6bfa02835dcfd90276d5cd8871e#egg=elasticsearch_dsl importlib-metadata==4.8.3 iniconfig==1.1.1 mock==5.2.0 packaging==21.3 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 pytz==2025.2 six==1.17.0 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 zipp==3.6.0
name: elasticsearch-dsl-py channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - elasticsearch==5.5.3 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - mock==5.2.0 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pytz==2025.2 - six==1.17.0 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/elasticsearch-dsl-py
[ "test_elasticsearch_dsl/test_index.py::test_cloned_index_has_analysis_attribute" ]
[]
[ "test_elasticsearch_dsl/test_index.py::test_search_is_limited_to_index_name", "test_elasticsearch_dsl/test_index.py::test_cloned_index_has_copied_settings_and_using", "test_elasticsearch_dsl/test_index.py::test_settings_are_saved", "test_elasticsearch_dsl/test_index.py::test_registered_doc_type_included_in_to_dict", "test_elasticsearch_dsl/test_index.py::test_registered_doc_type_included_in_search", "test_elasticsearch_dsl/test_index.py::test_aliases_add_to_object", "test_elasticsearch_dsl/test_index.py::test_aliases_returned_from_to_dict", "test_elasticsearch_dsl/test_index.py::test_analyzers_added_to_object", "test_elasticsearch_dsl/test_index.py::test_analyzers_returned_from_to_dict" ]
[]
Apache License 2.0
1,014
[ "elasticsearch_dsl/index.py", "setup.py" ]
[ "elasticsearch_dsl/index.py", "setup.py" ]
PedalPi__PluginsManager-11
749de55874f446519f7ebd01aacef38d1b810bb0
2017-02-12 03:42:30
749de55874f446519f7ebd01aacef38d1b810bb0
codecov-io: # [Codecov](https://codecov.io/gh/PedalPi/PluginsManager/pull/11?src=pr&el=h1) Report > Merging [#11](https://codecov.io/gh/PedalPi/PluginsManager/pull/11?src=pr&el=desc) into [master](https://codecov.io/gh/PedalPi/PluginsManager/commit/749de55874f446519f7ebd01aacef38d1b810bb0?src=pr&el=desc) will **increase** coverage by `0.7%`. > The diff coverage is `100%`. ```diff @@ Coverage Diff @@ ## master #11 +/- ## ========================================= + Coverage 89.06% 89.76% +0.7% ========================================= Files 28 28 Lines 750 772 +22 ========================================= + Hits 668 693 +25 + Misses 82 79 -3 ``` | [Impacted Files](https://codecov.io/gh/PedalPi/PluginsManager/pull/11?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [pluginsmanager/model/system/system_output.py](https://codecov.io/gh/PedalPi/PluginsManager/compare/749de55874f446519f7ebd01aacef38d1b810bb0...8965388b99714afb09dc03d6992ef064b8552ff4?src=pr&el=tree#diff-cGx1Z2luc21hbmFnZXIvbW9kZWwvc3lzdGVtL3N5c3RlbV9vdXRwdXQucHk=) | `100% <100%> (ø)` | :white_check_mark: | | [pluginsmanager/model/updates_observer.py](https://codecov.io/gh/PedalPi/PluginsManager/compare/749de55874f446519f7ebd01aacef38d1b810bb0...8965388b99714afb09dc03d6992ef064b8552ff4?src=pr&el=tree#diff-cGx1Z2luc21hbmFnZXIvbW9kZWwvdXBkYXRlc19vYnNlcnZlci5weQ==) | `100% <100%> (ø)` | :white_check_mark: | | [pluginsmanager/model/system/system_input.py](https://codecov.io/gh/PedalPi/PluginsManager/compare/749de55874f446519f7ebd01aacef38d1b810bb0...8965388b99714afb09dc03d6992ef064b8552ff4?src=pr&el=tree#diff-cGx1Z2luc21hbmFnZXIvbW9kZWwvc3lzdGVtL3N5c3RlbV9pbnB1dC5weQ==) | `100% <100%> (ø)` | :white_check_mark: | | [pluginsmanager/model/output.py](https://codecov.io/gh/PedalPi/PluginsManager/compare/749de55874f446519f7ebd01aacef38d1b810bb0...8965388b99714afb09dc03d6992ef064b8552ff4?src=pr&el=tree#diff-cGx1Z2luc21hbmFnZXIvbW9kZWwvb3V0cHV0LnB5) | `100% <100%> (ø)` | :white_check_mark: | | [pluginsmanager/model/input.py](https://codecov.io/gh/PedalPi/PluginsManager/compare/749de55874f446519f7ebd01aacef38d1b810bb0...8965388b99714afb09dc03d6992ef064b8552ff4?src=pr&el=tree#diff-cGx1Z2luc21hbmFnZXIvbW9kZWwvaW5wdXQucHk=) | `100% <100%> (ø)` | :white_check_mark: | | [pluginsmanager/mod_host/mod_host.py](https://codecov.io/gh/PedalPi/PluginsManager/compare/749de55874f446519f7ebd01aacef38d1b810bb0...8965388b99714afb09dc03d6992ef064b8552ff4?src=pr&el=tree#diff-cGx1Z2luc21hbmFnZXIvbW9kX2hvc3QvbW9kX2hvc3QucHk=) | `78.08% <100%> (-1.63%)` | :x: | | [pluginsmanager/banks_manager.py](https://codecov.io/gh/PedalPi/PluginsManager/compare/749de55874f446519f7ebd01aacef38d1b810bb0...8965388b99714afb09dc03d6992ef064b8552ff4?src=pr&el=tree#diff-cGx1Z2luc21hbmFnZXIvYmFua3NfbWFuYWdlci5weQ==) | `100% <ø> (+7.14%)` | :white_check_mark: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/PedalPi/PluginsManager/pull/11?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/PedalPi/PluginsManager/pull/11?src=pr&el=footer). Last update [749de55...6ad84c4](https://codecov.io/gh/PedalPi/PluginsManager/compare/749de55874f446519f7ebd01aacef38d1b810bb0...6ad84c46c9c4e1be387c3e872a07eb7149220db9?el=footer&src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/Readme.rst b/Readme.rst index 4502fd9..b6ebb43 100644 --- a/Readme.rst +++ b/Readme.rst @@ -136,10 +136,7 @@ Connecting *mode one*: .. code-block:: python - # For connect output system effects, use - pedalboard.connections.append(Connection(sys_effect.outputs[0], reverb.inputs[0])) - # Instead of - #sys_effect.outputs[0].connect(reverb.inputs[0]) + sys_effect.outputs[0].connect(reverb.inputs[0]) reverb.outputs[0].connect(fuzz.inputs[0]) reverb.outputs[1].connect(fuzz.inputs[0]) @@ -163,6 +160,13 @@ Connecting *mode two*: pedalboard.connections.append(Connection(reverb2.outputs[0], sys_effect.inputs[0])) pedalboard.connections.append(Connection(reverb2.outputs[0], sys_effect.inputs[1])) +.. warning:: + + If you need connect system_output with system_input directly (for a bypass, as example), only the + second mode will works:: + + pedalboard.connections.append(Connection(sys_effect.outputs[0], sys_effect.inputs[0])) + Set effect status (enable/disable bypass) and param value .. code-block:: python diff --git a/pluginsmanager/mod_host/mod_host.py b/pluginsmanager/mod_host/mod_host.py index 2933e69..8a38ff6 100644 --- a/pluginsmanager/mod_host/mod_host.py +++ b/pluginsmanager/mod_host/mod_host.py @@ -108,19 +108,25 @@ class ModHost(UpdatesObserver): def pedalboard(self, pedalboard): self.on_current_pedalboard_changed(pedalboard) + def __del__(self): + self._remove_pedalboard(self.pedalboard) + #################################### # Observer #################################### def on_current_pedalboard_changed(self, pedalboard): if self.pedalboard is not None: - for effect in self.pedalboard.effects: - self.on_effect_updated(effect, UpdateType.DELETED) + self._remove_pedalboard(self.pedalboard) self._pedalboard = pedalboard for effect in pedalboard.effects: self.on_effect_updated(effect, UpdateType.CREATED) + def _remove_pedalboard(self, pedalboard): + for effect in pedalboard.effects: + self.on_effect_updated(effect, UpdateType.DELETED) + def on_bank_updated(self, bank, update_type, **kwargs): if self.pedalboard is not None \ and bank != self.pedalboard.bank: @@ -162,7 +168,7 @@ class ModHost(UpdatesObserver): self.host.set_param_value(param) def on_connection_updated(self, connection, update_type): - if connection.input.effect.pedalboard != self.pedalboard: + if connection not in self.pedalboard.connections: return if update_type == UpdateType.CREATED: diff --git a/pluginsmanager/model/input.py b/pluginsmanager/model/input.py index 66a8f73..00290d1 100644 --- a/pluginsmanager/model/input.py +++ b/pluginsmanager/model/input.py @@ -39,6 +39,8 @@ class Input(metaclass=ABCMeta): self.observer = MagicMock() + self._unique_for_all_pedalboards = False + @property def effect(self): """ diff --git a/pluginsmanager/model/output.py b/pluginsmanager/model/output.py index 3429434..2830864 100644 --- a/pluginsmanager/model/output.py +++ b/pluginsmanager/model/output.py @@ -1,6 +1,6 @@ from abc import ABCMeta, abstractmethod -from pluginsmanager.model.connection import Connection +from pluginsmanager.model.connection import Connection, ConnectionError from unittest.mock import MagicMock @@ -39,6 +39,8 @@ class Output(metaclass=ABCMeta): self.observer = MagicMock() + self._unique_for_all_pedalboards = False + @property def effect(self): """ @@ -58,9 +60,21 @@ class Output(metaclass=ABCMeta): >>> Connection(driver_output, reverb_input) in driver.effect.connections True + .. note:: + + This method does not work for all cases. + class:`SystemOutput` can not be connected with class:`SystemInput` this way. + For this case, use :: + + >>> pedalboard.connections.append(Connection(system_output, system_input)) + :param Input effect_input: Input that will be connected with it """ - self.effect.pedalboard.connections.append(Connection(self, effect_input)) + if self._unique_for_all_pedalboards and effect_input._unique_for_all_pedalboards: + error = "Isn't possible connect this way. Please use pedalboard.connect(Connection(output, input))" + raise ConnectionError(error) + + effect_input.effect.pedalboard.connections.append(Connection(self, effect_input)) def disconnect(self, effect_input): """ @@ -74,8 +88,20 @@ class Output(metaclass=ABCMeta): >>> Connection(driver_output, reverb_input) in driver.effect.connections False + .. note:: + + This method does not work for all cases. + class:`SystemOutput` can not be disconnected with class:`SystemInput` this way. + For this case, use :: + + >>> pedalboard.connections.remove(Connection(system_output, system_input)) + :param Input effect_input: Input that will be disconnected with it """ + if self._unique_for_all_pedalboards and effect_input._unique_for_all_pedalboards: + error = "Isn't possible connect this way. Please use pedalboard.connect(Connection(output, input))" + raise ConnectionError(error) + self.effect.pedalboard.connections.remove(Connection(self, effect_input)) @property diff --git a/pluginsmanager/model/system/system_input.py b/pluginsmanager/model/system/system_input.py index a9dc781..1751756 100644 --- a/pluginsmanager/model/system/system_input.py +++ b/pluginsmanager/model/system/system_input.py @@ -6,6 +6,7 @@ class SystemInput(Input): def __init__(self, effect, input): super(SystemInput, self).__init__(effect) self._input = input + self._unique_for_all_pedalboards = True def __str__(self): return self._input diff --git a/pluginsmanager/model/system/system_output.py b/pluginsmanager/model/system/system_output.py index 6e74db1..ebcdc09 100644 --- a/pluginsmanager/model/system/system_output.py +++ b/pluginsmanager/model/system/system_output.py @@ -6,6 +6,7 @@ class SystemOutput(Output): def __init__(self, effect, output): super(SystemOutput, self).__init__(effect) self._output = output + self._unique_for_all_pedalboards = True def __str__(self): return self._output diff --git a/pluginsmanager/model/updates_observer.py b/pluginsmanager/model/updates_observer.py index 31f6da2..8769330 100644 --- a/pluginsmanager/model/updates_observer.py +++ b/pluginsmanager/model/updates_observer.py @@ -12,6 +12,17 @@ class UpdatesObserver(metaclass=ABCMeta): example of a manager is :class:`BanksManager`. """ + def __init__(self): + self.manager = None + + def __enter__(self): + if self.manager is not None: + self.manager.enter_scope(self) + + def __exit__(self, type, value, traceback): + if self.manager is not None: + self.manager.exit_scope() + @abstractmethod def on_bank_updated(self, bank, update_type, **kwargs): """
Connections with sys_effect doesn't work For test https://gist.github.com/SrMouraSilva/f7a3904f3984bcaec7e15c60039bc3c3 # Error 1 ## Description ```python > sys_effect.outputs[0].connect(reverb.inputs[0]) Traceback (most recent call last): File "<input>", line 1, in <module> File "/home/paulo/PycharmProjects/PedalPi-Raspberry/pluginsmanager/pluginsmanager/model/output.py", line 63, in connect self.effect.pedalboard.connections.append(Connection(self, effect_input)) AttributeError: 'NoneType' object has no attribute 'connections' ``` ## Cause This error occurs because of the fact that system_effects can not be added to pedalboards ## Other method for use If this error is occurring with you, the following method works. ```python # For connect output system effects, use pedalboard.connections.append(Connection(sys_effect.outputs[0], reverb.inputs[0])) # Instead of #sys_effect.outputs[0].connect(reverb.inputs[0]) ``` #
PedalPi/PluginsManager
diff --git a/test/banks_manager_test.py b/test/banks_manager_test.py index 9a5adb9..2b64c5e 100644 --- a/test/banks_manager_test.py +++ b/test/banks_manager_test.py @@ -75,3 +75,11 @@ class BanksManagerTest(unittest.TestCase): manager.banks.remove(bank2) observer.on_bank_updated.assert_called_with(bank2, UpdateType.DELETED, index=0, origin=manager) + + def test_initial_banks(self): + banks = [Bank('Bank 1'), Bank('Bank 1')] + + manager = BanksManager(banks) + + for original_bank, bank_managed in zip(banks, manager.banks): + self.assertEqual(original_bank, bank_managed) diff --git a/test/example.py b/test/example.py new file mode 100644 index 0000000..6f90063 --- /dev/null +++ b/test/example.py @@ -0,0 +1,51 @@ +from pluginsmanager.banks_manager import BanksManager +from pluginsmanager.mod_host.mod_host import ModHost + +from pluginsmanager.model.bank import Bank +from pluginsmanager.model.pedalboard import Pedalboard +from pluginsmanager.model.connection import Connection + +from pluginsmanager.model.lv2.lv2_effect_builder import Lv2EffectBuilder + +from pluginsmanager.model.system.system_effect import SystemEffect + + +if __name__ == '__main__': + manager = BanksManager() + + bank = Bank('Bank 1') + manager.append(bank) + + + mod_host = ModHost('raspberrypi.local') + mod_host.connect() + manager.register(mod_host) + + + pedalboard = Pedalboard('Rocksmith') + bank.append(pedalboard) + + mod_host.pedalboard = pedalboard + + builder = Lv2EffectBuilder() + + reverb = builder.build('http://calf.sourceforge.net/plugins/Reverb') + fuzz = builder.build('http://guitarix.sourceforge.net/plugins/gx_fuzz_#fuzz_') + reverb2 = builder.build('http://calf.sourceforge.net/plugins/Reverb') + + pedalboard.append(reverb) + pedalboard.append(fuzz) + pedalboard.append(reverb2) + + sys_effect = SystemEffect('system', ['capture_1'], ['playback_1', 'playback_2']) + + pedalboard.connections.append(Connection(sys_effect.outputs[0], reverb.inputs[0])) + + reverb.outputs[0].connect(fuzz.inputs[0]) + reverb.outputs[1].connect(fuzz.inputs[0]) + fuzz.outputs[0].connect(reverb2.inputs[0]) + reverb.outputs[0].connect(reverb2.inputs[0]) + + # Causes error + reverb2.outputs[0].connect(sys_effect.inputs[0]) + reverb2.outputs[0].connect(sys_effect.inputs[1]) diff --git a/test/model/output_test.py b/test/model/output_test.py index d91b910..7efddc3 100644 --- a/test/model/output_test.py +++ b/test/model/output_test.py @@ -6,6 +6,9 @@ from pluginsmanager.model.lv2.lv2_effect_builder import Lv2EffectBuilder from pluginsmanager.model.pedalboard import Pedalboard from pluginsmanager.model.update_type import UpdateType +from pluginsmanager.model.system.system_effect import SystemEffect + +from pluginsmanager.model.connection import ConnectionError class OutputTest(unittest.TestCase): @@ -81,3 +84,21 @@ class OutputTest(unittest.TestCase): reverb.outputs[1].disconnect(reverb2.inputs[0]) pedalboard.observer.on_connection_updated.assert_not_called() + + def test_connect_system_effect(self): + sys_effect = SystemEffect('system', ['capture_1'], ['playback_1', 'playback_2']) + + effect_output = sys_effect.outputs[0] + effect_input = sys_effect.inputs[0] + + with self.assertRaises(ConnectionError): + effect_output.connect(effect_input) + + def test_disconnect_system_effect(self): + sys_effect = SystemEffect('system', ['capture_1'], ['playback_1', 'playback_2']) + + effect_output = sys_effect.outputs[0] + effect_input = sys_effect.inputs[0] + + with self.assertRaises(ConnectionError): + effect_output.disconnect(effect_input) diff --git a/test/model/updates_observer_test.py b/test/model/updates_observer_test.py new file mode 100644 index 0000000..1608639 --- /dev/null +++ b/test/model/updates_observer_test.py @@ -0,0 +1,52 @@ +import unittest +from unittest.mock import MagicMock + +from pluginsmanager.banks_manager import BanksManager +from pluginsmanager.model.bank import Bank +from pluginsmanager.model.update_type import UpdateType +from pluginsmanager.model.updates_observer import UpdatesObserver + + +class Observer(UpdatesObserver): + + def on_bank_updated(self, bank, update_type, **kwargs): + pass + + def on_pedalboard_updated(self, pedalboard, update_type, **kwargs): + pass + + def on_effect_updated(self, effect, update_type, **kwargs): + pass + + def on_effect_status_toggled(self, effect): + pass + + def on_param_value_changed(self, param): + pass + + def on_connection_updated(self, connection, update_type): + pass + + +class UpdatesObserverTest(unittest.TestCase): + + def test_notify(self): + observer1 = Observer() + observer1.on_bank_updated = MagicMock() + observer2 = Observer() + observer2.on_bank_updated = MagicMock() + observer3 = Observer() + observer3.on_bank_updated = MagicMock() + + manager = BanksManager() + manager.register(observer1) + manager.register(observer2) + manager.register(observer3) + + bank = Bank('Bank 1') + with observer1: + manager.banks.append(bank) + + observer1.on_bank_updated.assert_not_called() + observer2.on_bank_updated.assert_called_with(bank, UpdateType.CREATED, index=0, origin=manager) + observer3.on_bank_updated.assert_called_with(bank, UpdateType.CREATED, index=0, origin=manager)
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 2 }, "num_modified_files": 7 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "JACK-Client", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work certifi==2021.5.30 cffi==1.15.1 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work JACK-Client==0.5.3 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work -e git+https://github.com/PedalPi/PluginsManager.git@749de55874f446519f7ebd01aacef38d1b810bb0#egg=PedalPi_PluginsManager pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work pycparser==2.21 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 toml @ file:///tmp/build/80754af9/toml_1616166611790/work typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: PluginsManager channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - cffi==1.15.1 - jack-client==0.5.3 - pycparser==2.21 prefix: /opt/conda/envs/PluginsManager
[ "test/model/output_test.py::OutputTest::test_connect_system_effect", "test/model/output_test.py::OutputTest::test_disconnect_system_effect", "test/model/updates_observer_test.py::UpdatesObserverTest::test_notify" ]
[]
[ "test/banks_manager_test.py::BanksManagerTest::test_initial_banks", "test/banks_manager_test.py::BanksManagerTest::test_observers", "test/model/output_test.py::OutputTest::test_connect", "test/model/output_test.py::OutputTest::test_disconnect", "test/model/output_test.py::OutputTest::test_disconnect_connection_not_created" ]
[]
Apache License 2.0
1,015
[ "pluginsmanager/model/updates_observer.py", "pluginsmanager/model/system/system_input.py", "pluginsmanager/mod_host/mod_host.py", "pluginsmanager/model/output.py", "pluginsmanager/model/system/system_output.py", "Readme.rst", "pluginsmanager/model/input.py" ]
[ "pluginsmanager/model/updates_observer.py", "pluginsmanager/model/system/system_input.py", "pluginsmanager/mod_host/mod_host.py", "pluginsmanager/model/output.py", "pluginsmanager/model/system/system_output.py", "Readme.rst", "pluginsmanager/model/input.py" ]
contentful__contentful.py-10
09ad94fa14d2262ddafc9f0a0c29728e6618b148
2017-02-13 14:21:11
09ad94fa14d2262ddafc9f0a0c29728e6618b148
grncdr: Thanks for pointing this out @Anton-2 :+1:
diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e7d2ab..c0cd794 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # CHANGELOG ## Unreleased +### Added +* Add wrapper object around array-like endpoints [#9](https://github.com/contentful/contentful.py/issues/9) + +### Fixed +* Fix exception thrown on Entry not found [#8](https://github.com/contentful/contentful.py/issues/8) ## v1.0.3 ### Fixed diff --git a/contentful/array.py b/contentful/array.py new file mode 100644 index 0000000..84745f4 --- /dev/null +++ b/contentful/array.py @@ -0,0 +1,41 @@ +""" +contentful.array +~~~~~~~~~~~~~~~~ + +This module implements the Array class. + +API Reference: https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction/collection-resources-and-pagination + +:copyright: (c) 2017 by Contentful GmbH. +:license: MIT, see LICENSE for more details. +""" + + +class Array(object): + """ + API Reference: https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction/collection-resources-and-pagination + """ + + def __init__(self, json, items): + self.items = items + self.skip = json.get('skip', 0) + self.limit = json.get('limit', 100) + self.total = json.get('total', 0) + + def __iter__(self): + for item in self.items: + yield item + + def __getitem__(self, index): + return self.items[index] + + def __len__(self): + return len(self.items) + + def __repr__(self): + return "<Array size='{0}' total='{1}' limit='{2}' skip='{3}'>".format( + len(self), + self.total, + self.limit, + self.skip + ) diff --git a/contentful/client.py b/contentful/client.py index a0d24c2..adc9e0b 100644 --- a/contentful/client.py +++ b/contentful/client.py @@ -2,7 +2,7 @@ import requests import sys from re import sub from .utils import ConfigurationException, retry_request -from .errors import get_error, RateLimitExceededError +from .errors import get_error, RateLimitExceededError, EntryNotFoundError from .resource_builder import ResourceBuilder from .content_type_cache import ContentTypeCache @@ -185,11 +185,16 @@ class Client(object): query = {} self._normalize_select(query) - query.update({'sys.id': entry_id}) - return self._get( - '/entries', - query - )[0] + try: + query.update({'sys.id': entry_id}) + return self._get( + '/entries', + query + )[0] + except IndexError: + raise EntryNotFoundError( + "Entry not found for ID: '{0}'".format(entry_id) + ) def entries(self, query=None): """Fetches all Entries from the Space (up to the set limit, can be modified in `query`). diff --git a/contentful/errors.py b/contentful/errors.py index 8ecf7d6..5c002a1 100644 --- a/contentful/errors.py +++ b/contentful/errors.py @@ -71,6 +71,13 @@ class ServiceUnavailableError(HTTPError): pass +class EntryNotFoundError(Exception): + """ + Error for entry not found. + """ + pass + + def get_error(response): """Gets Error by HTTP Status Code""" diff --git a/contentful/resource_builder.py b/contentful/resource_builder.py index fda4cbd..79cd4e8 100644 --- a/contentful/resource_builder.py +++ b/contentful/resource_builder.py @@ -1,4 +1,5 @@ # Classes imported here are meant to be used via globals() on build +from .array import Array # noqa: F401 from .entry import Entry # noqa: F401 from .asset import Asset # noqa: F401 from .space import Space # noqa: F401 @@ -60,7 +61,7 @@ class ResourceBuilder(object): item, includes=includes ) for item in self.json['items']] - return items + return Array(self.json, items) def _build_item(self, item, includes=None): if includes is None: diff --git a/fixtures/client/array_endpoints.yaml b/fixtures/client/array_endpoints.yaml new file mode 100644 index 0000000..f2d72a4 --- /dev/null +++ b/fixtures/client/array_endpoints.yaml @@ -0,0 +1,185 @@ +interactions: +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: [gzip] + Authorization: [Bearer b4c0n73n7fu1] + Connection: [keep-alive] + Content-Type: [application/vnd.contentful.delivery.v1+json] + User-Agent: [PythonContentfulClient/1.0.3] + method: GET + uri: https://cdn.contentful.com/spaces/cfexampleapi/content_types + response: + body: + string: !!binary | + H4sIAAAAAAAAA+1YTVPbMBC98ytSnxuPZRuT+AahTDOlvSSndjgotgKayB+1FUrK8N+7kmNHsh0m + mBCmgC+JvPrYt2u9fdL9Ua9n5Kvc8Hv38BcafJUSaBmnWYZXBrx7+Cz68IRjBu9d2coXNIWGJRuM + RpRDC1lFm3ISiQl/yQmLaWuryJXyFAdiqbJH8VLxRbyQL0ufLmm8MMSamwdWjxfTtc8TOWOtAw0F + nGBO7nCUMoJTKlCVz0P1X+IsHqMYg/hwPAvm4WjhRZa7HE8mOR5/U+avHBslMScxl34o0wQZwZyE + pyI6hm0ht2/ZfRtNkeO7tu84pmUNf6oDlmn4tAEZuaU5TWIR/rX7FQ4jpHnK8OqCEiZjEONo417R + grcjyleVD0ZI8iCjKS/mjJeMlXiMuZhnk1gRKi11RdC0RUSfaqEf6vLSUuZ1Su64ljaDJQFm9C8R + fs8xy4maVCMjv5c0k0aeLXUbgMYztmVgAl8qJKSctC33LZACSC3JdAclTBG9Flv1uQIIGUjN+UND + W4O8kr/rj+M/3pQ3ywirEX3qHnT6lte3T6a27buej1wTOc6jexAGDGHfTtGxjyzf9swBGmgDlD3o + dNyDXzVQH5uwZROqxKTtp3InnivMpXXYA8s0KegFaIbRBcnbWeayadLrdDeGeR4sbc2y6KuZUxh+ + sopmCdPAgfUWOB4KHlCkLCsFRQmaAqLakZtphK/1kl/Vm3HT9OJBa5SjWsV5Ssza1E49Yup8Uopt + xNBpnhO+Req8sZoQJteqiiqzvKMqq1UEx3SHOsHXVVlVEVzfsX2EzIFzsq0i2B0rwrkCqVYPjDOc + LT5tJNu71WVvvyR0Y7cGcewup/dYER7hopLc34omBZm/P/6xzcGx/agi9foIyWPksW8h33XMgWdt + 4x+vI/+MFEh1/vlOkj/m6/NPo9Ye+Fj4odcqjba7XgsSlmw7SjdNZSVvkY+H4rQddeiM5PwioyQO + 2xX8Gdh7bR2qy4L63dahAOpHB0VAfol5Jm8A14p807HleDajGb8J4caw9Wx21motoZ/DnZc+buc7 + kufVqx2xMTrffjADU4+Ree3+qoQ2hpuj6/rd0X7QNeiv2+UWo7fbwYHpdcA189oN3fsQUPAdXx09 + HP0DN/FAjM0XAAA= + headers: + Accept-Ranges: [bytes] + Access-Control-Allow-Headers: ['Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent'] + Access-Control-Allow-Methods: ['GET,HEAD,OPTIONS'] + Access-Control-Allow-Origin: ['*'] + Access-Control-Expose-Headers: [Etag] + Access-Control-Max-Age: ['86400'] + Age: ['53'] + Cache-Control: [max-age=0] + Connection: [keep-alive] + Content-Encoding: [gzip] + Content-Length: ['866'] + Content-Type: [application/vnd.contentful.delivery.v1+json] + Date: ['Mon, 13 Feb 2017 14:10:04 GMT'] + ETag: [W/"ef8728464e25e9fddfec5884589bf332"] + Server: [Contentful] + Vary: [Accept-Encoding] + Via: [1.1 varnish] + X-Cache: [HIT] + X-Cache-Hits: ['1'] + X-Content-Type-Options: [nosniff, nosniff] + X-Contentful-Request-Id: [b94922bc172712270b4a97d08c184b28] + X-Served-By: [cache-lax8630-LAX] + X-Timer: ['S1486995004.864675,VS0,VE0'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: [gzip] + Authorization: [Bearer b4c0n73n7fu1] + Connection: [keep-alive] + Content-Type: [application/vnd.contentful.delivery.v1+json] + User-Agent: [PythonContentfulClient/1.0.3] + method: GET + uri: https://cdn.contentful.com/spaces/cfexampleapi/entries + response: + body: + string: !!binary | + H4sIAAAAAAAAA+1aW3ObRhR+z69QeelDK7S7LNc3RXUc11XdVHKdpO1kECwSFgICKLbSyX/vWYTQ + gtBlZDtxNWU8HnE5y+7yfef+z4tWS0oXqWS1/oGfcJItYgZnUjdJ7IUE1778yJ/JoswO4DpG+Wk6 + 9WM4W54E/szP8nvLcz9jMz7in/mIy3Frr8lflca2w9+1emJ5UZgMv5BfXE3qFz+cSnwC60MK4Nqw + mPQgH7H2gO/y9Tgeu7dnccDs2OfLWh1fyt/5QpeHtJSZ2HG8cOxMGLGcylmYJQvxhpMwO2Nul++E + RBBW2khrE31IiEU1iyAZ6/i9KDCP3ZoAxm1sDLFqqYaFiIywURFI2Cc/9aMQXmAIc3WiMGNhVuzB + 421mTxi3eUthZ/buZBA5dpAjioXt68FKoNxsyfNZ4K4ByD+AFNqzXOQ1/wCtXvULBP6UreFVfDBn + wtjn0TwZs2Q9p78ruxRECR9zzHEt3BixNHuV+CzkMHm83avjI1/XElbhwg45qvbu3chPsokL080R + hZQ2Rm1iDIliIQR/P+T/xbUE/qd8a7AI5Zk9flyWddOUiZwQllYypnltxdUl5woI/If1g3o27P/+ + eRqYl30azRb9u8vu1dQ/SlvQNiJtgodYsSixVF3WVbJTW4CA0SbKEFMuoKgyQfo2baE8B22BM/Ni + 5Hhub6rNEJ1fDAapfXG5nwQPUiC/RKELClNcP6hK0BE1qge5Vm2DkiYqNXRs5odKiKBogb8BsNZq + qVhWkaFidW06TgzY2mWY2e/e2q8Hi4s7o6+xiGhXl0cBG5QWBks4RKZFVYvoMtXVncDOBcAMggCQ + QdFlA201g+Q5ANuNxk+M4p8i0ODCUl2WOokfZ0tfQErnzqR1m0bhX+FddCc+6H9N3Y/v0X38dk7j + wfmAXs2ng8XN+fU2gp8YYfSPf7wMerfxzZmhXaUsomjcPXt3FGFESwD4N2SiVvFf9xtBgLaxOkSG + Bb4m4X4j2mYJngVhvoklGNhh61UCjpefOtHBBgHDdlJsUqyqKD8Ez6q0B6CjdJ2axDxdgzC2k9xP + PwrRG5GQQfZFQty30YcY/FvTQroMe/usEX2QN/8gR+a84QM0BkKBndrj0N4TBEXAhKpNEWMNbOom + j17BCu+KNbw81gjnQSDYplUIYp6Yhqf9a5wqcZT512d9ck6j6burjxVju0pS1CM/qZ4ZqPr6VAV4 + aztdor0CQmZADP2+WWbgm2j4lyyBXNChqh0rMkXUVJWlq2/q6hrEa0+fyCoE3khTi6dO1uNf5SQE + Jh+M56p+x6asYmUnnkEA9AvNXXzTUkwZka2xq/BZpG+G56fX779CTuigRFdi++EouksFnANcPT+d + 7FH5haDIj6+f+tqTHxLQV8198RiS+7k8m7ov96UoujDOVw2Bdmf2Tswijhm+f714rby5upk7lze9 + Xnd8cX6Ug1gNeYgik1oE0xDylNkyxWoQ+N8gQsr4NzvxRT0hOTtyX0RWIN1FsFnEObpAotIeUkM2 + VE3D9GTtoOeHFRfiSCNIsEzVahRex/DSCJpDrFlQ8UFYJuZWI6g9hzzXZD6zwyfOdL2qbX8t0/WK + 2UnA0rRlu58Ay/OEJd+1fmIeFG9Y0oq8VswrK1AekkU91BgnlSMIZvPEFPQt7MRR+rgWsENGydwd + oEDOluSlS8WCmJ1ooMCr1QtBHz8Lh+7pc7Y/1za/huSXNjizJVx/bM3sqR9+3xpVLn8nfr2v6sjk + 0CmVPDQBbFP4cD2vskp+6ARzWGRZWZGWZcJVG8C6EQAeFjsOigJuUzNA45N5tXFHQwA3VntaAvh0 + dzYFiAsuOiCW0ywltyS7KzFk2UqxUS/dSAlUqyQYyWCFxRAK3rtpP0rOEd3CVDZxxX6AiMA6wYLw + DWouyleW2lSY5zvvZ8tyfq0oAbdqEA99h7Vi3+Fquh6t5EOIxXa+wIQ3mEidTo70VC6iPW8ewM9Z + R2zg6DRvf8dxMFFMR1MMlRKDeUTzKDYQODWqQgxsdID3TL6Nx5X55FPPbD+odiGsgOl/5pMF58ik + QiG1uNvEyuLWne9mEy5pLPtiVggqbk+YP57wciJVVCRQjd9e0y0/E1EFk/X8gP1adEhsW1A1VJby + aXZuY7atVLUyfatXrb/NCZC1oY+HI3nV6XQIPXnCgvBiu6pZCpWJVufaJj0LEdXC2CJUVrRK0rtK + T1JRHI9Bz6bWmQI7D6Oe0n//W3j7fniRTrsXF9P5PEp7adpRDGJTw/Vs4oyw5lDdhl868fQRUUYe + Mjurj3B3JP9MUzGrRIDlHEA/om+wFgRL9immfjT5di7pfwZy3VUY2por+mD27TeOJfsgYwQZRqpV + PNinZl/N+3sU4tFJkLE33bcDwx+gd73+tfamfzPuAO1cg0BMTj2EKUamolHH8VTHMLFLXLfD916O + wyNsHkHUyFs6xeMQzhWdoDXBknNYw0dzbttqGunGVy28qcGLPUl7t5nMfyjh6MGEKy3khkhzTg5m + 9hjmriF//jikG8daZnfvbmhvNhjPZx8Jm17POqZrI8fFwDVoFhsZrk4UqjDDVG2EXA3jDp/PBygb + fCAqiu8/eAn4a8eREFoQNi3YISSEN9e5Kxo+uH00CQ9d3ZGkzOf1N/z/8uLLi38BPhkZmqMuAAA= + headers: + Accept-Ranges: [bytes] + Access-Control-Allow-Headers: ['Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent'] + Access-Control-Allow-Methods: ['GET,HEAD,OPTIONS'] + Access-Control-Allow-Origin: ['*'] + Access-Control-Expose-Headers: [Etag] + Access-Control-Max-Age: ['86400'] + Age: ['18'] + Cache-Control: [max-age=0] + Connection: [keep-alive] + Content-Encoding: [gzip] + Content-Length: ['1994'] + Content-Type: [application/vnd.contentful.delivery.v1+json] + Date: ['Mon, 13 Feb 2017 14:10:05 GMT'] + ETag: [W/"99a8e30d72be57f854b871f602fcd069"] + Server: [Contentful] + Vary: [Accept-Encoding] + Via: [1.1 varnish] + X-Cache: [HIT] + X-Cache-Hits: ['1'] + X-Content-Type-Options: [nosniff, nosniff] + X-Contentful-Request-Id: [bf468d5a87d01dc61edee253f7d7a3c3] + X-Served-By: [cache-lax8622-LAX] + X-Timer: ['S1486995005.594333,VS0,VE0'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: [gzip] + Authorization: [Bearer b4c0n73n7fu1] + Connection: [keep-alive] + Content-Type: [application/vnd.contentful.delivery.v1+json] + User-Agent: [PythonContentfulClient/1.0.3] + method: GET + uri: https://cdn.contentful.com/spaces/cfexampleapi/assets + response: + body: + string: !!binary | + H4sIAAAAAAAAA+WXS3PaMBDH7/kUjM8F6+XnjaEzadombQYySdPpZIQsg4JtVCw30Ey+eyUbgu3Q + vHto64sl4dXuf1c/r7ne63SsfJVbYedaD/VErSTXM6u/WNCVpddu3phn1FzRRK+TcpbPhNQTUE4S + kQqlZxBUc6F4ajb8Wm5YbdvyUnrKJWXG1eaJarEWi1koFzcxfRTZzDI+t5f2ns1G65iH5Y6tB0Rk + 5LCYL2kqE06lMKo2183tuNRZXVZlA5dgKc8KIof7Q/KpmA1Xp/snH2r7b5OV51zVf2ALThWP+iYv + FgIQdyHsAncEgpA4IQQ9AMB53aCQUdsAdaE/gjhEXghJL4Bew2DBf4hczDPtwK1FnswZTcoC8qx7 + MtxIvRVnxYIn0bbeRrClhKps3s4n9fxZEc/ZQkhV+bEywXhHCqaKReOxWJTmjUIWC3NcLNsWKZ3w + vMfmmeKZiotED1O7Xg97d6JtxiDCAXOx7xDk8xi5MYE+gAFwMPKhb0c63N6lnDRKroNWVCRNiaXM + XPw0YToIBQS3T4mJsqWhNLoSkZoaK7863usjUt6sKReTqakxwQ5onMvtuVoTtLHTBUj4EU3LGu0W + sE7V5lSXCbQvJZ9sD+5m++q+ru5fjNqUSrlitMHQ7ZvoYbhA0AVoBEnouCEmPeQ2WbkL19pAowhD + RHrYhb+DC70aXO+Mxs6gKfKl6ODD88/Z5fnoIJ/1Dw5mRTHPB3luYx9R4kcxRWwMXUY8qkceir0x + wuMYBPYm4VfP4CcIcPBUfJDXIq5ODw68Z8Bzj4T/kKBsRbPXA4g81J3axLUMat0JvhpAR1ria/ND + JtJVtH91SgbpcFKk3xGfnaR2EFHAIhhg1/fg2I88hAnmfuBQACIXQtvEcqHzfYEcIJcX8UK/0Xsy + e2IrgugOF1b5ur+vE2mPTfrqKOkfn4HS49TspMpo3n5DrUf/Slu6pLPGh85LWtIjiXJChEIc9Ijr + /vmW9L6l76XdiEwTxY/7Z0NfDMGXweGJe3x4OrF1L4p85EJCYgAJBBorwljsMD+AEYoi2+T56fQg + QPwWCg/Ts/6XsvszDrrwGfTsjv7JtGjP3/Zu9n4BW7fFIpMNAAA= + headers: + Accept-Ranges: [bytes] + Access-Control-Allow-Headers: ['Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent'] + Access-Control-Allow-Methods: ['GET,HEAD,OPTIONS'] + Access-Control-Allow-Origin: ['*'] + Access-Control-Expose-Headers: [Etag] + Access-Control-Max-Age: ['86400'] + Age: ['0'] + Cache-Control: [max-age=0] + Connection: [keep-alive] + Content-Encoding: [gzip] + Content-Length: ['836'] + Content-Type: [application/vnd.contentful.delivery.v1+json] + Date: ['Mon, 13 Feb 2017 14:10:06 GMT'] + ETag: [W/"0f9f9fcfb240e8720d2a78b2264c213c"] + Server: [Contentful] + Vary: [Accept-Encoding] + Via: [1.1 varnish] + X-Cache: [MISS] + X-Cache-Hits: ['0'] + X-Content-Type-Options: [nosniff, nosniff] + X-Contentful-Request-Id: [7fde83d6db46d0331d22db161b0bca8c] + X-Served-By: [cache-lax8621-LAX] + X-Timer: ['S1486995006.391064,VS0,VE145'] + status: {code: 200, message: OK} +version: 1 diff --git a/fixtures/client/entry_not_found.yaml b/fixtures/client/entry_not_found.yaml new file mode 100644 index 0000000..a56495c --- /dev/null +++ b/fixtures/client/entry_not_found.yaml @@ -0,0 +1,40 @@ +interactions: +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: [gzip] + Authorization: [Bearer b4c0n73n7fu1] + Connection: [keep-alive] + Content-Type: [application/vnd.contentful.delivery.v1+json] + User-Agent: [PythonContentfulClient/1.0.3] + method: GET + uri: https://cdn.contentful.com/spaces/cfexampleapi/entries?sys.id=foobar + response: + body: {string: "{\n \"sys\": {\n \"type\": \"Array\"\n },\n \"total\": 0,\n + \ \"skip\": 0,\n \"limit\": 100,\n \"items\": []\n}\n"} + headers: + Accept-Ranges: [bytes] + Access-Control-Allow-Headers: ['Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent'] + Access-Control-Allow-Methods: ['GET,HEAD,OPTIONS'] + Access-Control-Allow-Origin: ['*'] + Access-Control-Expose-Headers: [Etag] + Access-Control-Max-Age: ['86400'] + Age: ['0'] + Cache-Control: [max-age=0] + Connection: [keep-alive] + Content-Length: ['97'] + Content-Type: [application/vnd.contentful.delivery.v1+json] + Date: ['Mon, 13 Feb 2017 14:18:07 GMT'] + ETag: ['"29f2c21be26360c424f617d8592cf6f9"'] + Server: [Contentful] + Vary: [Accept-Encoding] + Via: [1.1 varnish] + X-Cache: [MISS] + X-Cache-Hits: ['0'] + X-Content-Type-Options: [nosniff, nosniff] + X-Contentful-Request-Id: [5e471b217bc3de8d9a5d2885121bb591] + X-Served-By: [cache-lax8632-LAX] + X-Timer: ['S1486995487.436734,VS0,VE321'] + status: {code: 200, message: OK} +version: 1
IndexError using client.entry when no entry with given id exists This will throw a somewhat confusing IndexError when no entry with the id exists. ```python client.entry('1234') ``` This is because the entry function assumes something will always exist and tries to return the first item in the result. ```python return self._get( '/entries', query )[0] ``` I propose adding a more descriptive exception, i.e. ```EntryNotFound```. If you like this idea I can submit a PR for it.
contentful/contentful.py
diff --git a/tests/array_test.py b/tests/array_test.py new file mode 100644 index 0000000..7491d72 --- /dev/null +++ b/tests/array_test.py @@ -0,0 +1,59 @@ +from unittest import TestCase +from contentful.array import Array +from contentful.entry import Entry + + +class ArrayTest(TestCase): + def test_asset(self): + entry = Entry({ + 'sys': { + 'space': { + 'sys': { + 'type': 'Link', + 'linkType': 'Space', + 'id': 'foo' + } + }, + 'contentType': { + 'sys': { + 'type': 'Link', + 'linkType': 'ContentType', + 'id': 'foo' + } + }, + 'type': 'Entry', + 'createdAt': '2016-06-06', + 'updatedAt': '2016-06-06', + 'deletedAt': '2016-06-06', + 'id': 'foobar', + 'version': 1 + }, + 'fields': { + 'name': 'foobar', + 'date': '2016-06-06' + } + }) + array = Array({ + 'sys': { + 'type': 'Array' + }, + 'items': [ + entry.raw + ], + 'total': 11, + 'skip': 10, + 'limit': 10 + }, + [entry]) + + self.assertEqual(len(array), 1) + self.assertEqual(array.total, 11) + self.assertEqual(array.skip, 10) + self.assertEqual(array.limit, 10) + self.assertEqual(array[0], entry) + self.assertEqual(str(array), "<Array size='1' total='11' limit='10' skip='10'>") + for e in array: + # testing __iter__ + # should be only one, so assert is valid + self.assertEqual(e, entry) + diff --git a/tests/client_test.py b/tests/client_test.py index 87ed2d5..978ef64 100644 --- a/tests/client_test.py +++ b/tests/client_test.py @@ -4,6 +4,7 @@ import vcr from unittest import TestCase from contentful.client import Client from contentful.content_type_cache import ContentTypeCache +from contentful.errors import EntryNotFoundError class ClientTest(TestCase): @@ -50,6 +51,11 @@ class ClientTest(TestCase): self.assertEqual(str(entry), "<Entry[cat] id='nyancat'>") self.assertEqual(str(entry.best_friend), "<Entry[cat] id='happycat'>") + @vcr.use_cassette('fixtures/client/entry_not_found.yaml') + def test_client_entry_not_found(self): + client = Client('cfexampleapi', 'b4c0n73n7fu1', content_type_cache=False) + self.assertRaises(EntryNotFoundError, client.entry, 'foobar') + @vcr.use_cassette('fixtures/client/entries.yaml') def test_client_entries(self): client = Client('cfexampleapi', 'b4c0n73n7fu1', content_type_cache=False) @@ -87,6 +93,13 @@ class ClientTest(TestCase): self.assertEqual(str(sync), "<SyncPage next_sync_token='w5ZGw6JFwqZmVcKsE8Kow4grw45QdybCnV_Cg8OASMKpwo1UY8K8bsKFwqJrw7DDhcKnM2RDOVbDt1E-wo7CnDjChMKKGsK1wrzCrBzCqMOpZAwOOcOvCcOAwqHDv0XCiMKaOcOxZA8BJUzDr8K-wo1lNx7DnHE'>") self.assertEqual(str(sync.items[0]), "<Entry[1t9IbcfdCk6m04uISSsaIK] id='5ETMRzkl9KM4omyMwKAOki'>") + @vcr.use_cassette('fixtures/client/array_endpoints.yaml') + def test_client_creates_wrapped_arrays(self): + client = Client('cfexampleapi', 'b4c0n73n7fu1', content_type_cache=False) + self.assertEquals(str(client.content_types()), "<Array size='4' total='4' limit='100' skip='0'>") + self.assertEquals(str(client.entries()), "<Array size='10' total='10' limit='100' skip='0'>") + self.assertEquals(str(client.assets()), "<Array size='4' total='4' limit='100' skip='0'>") + # Integration Tests @vcr.use_cassette('fixtures/integration/issue-4.yaml')
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_added_files", "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 4 }
1.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
appnope==0.1.0 attrs==22.2.0 certifi==2021.5.30 -e git+https://github.com/contentful/contentful.py.git@09ad94fa14d2262ddafc9f0a0c29728e6618b148#egg=contentful decorator==4.0.10 importlib-metadata==4.8.3 iniconfig==1.1.1 ipython-genutils==0.2.0 packaging==21.3 pexpect==4.2.1 pickleshare==0.7.4 pluggy==1.0.0 prompt-toolkit==1.0.9 ptyprocess==0.5.1 py==1.11.0 Pygments==2.1.3 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.6.0 PyYAML==3.12 requests==2.12.1 simplegeneric==0.8.1 six==1.10.0 tomli==1.2.3 traitlets==4.3.1 typing_extensions==4.1.1 vcrpy==1.10.3 wcwidth==0.1.7 wrapt==1.10.8 zipp==3.6.0
name: contentful.py channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - appnope==0.1.0 - attrs==22.2.0 - decorator==4.0.10 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - ipython-genutils==0.2.0 - packaging==21.3 - pexpect==4.2.1 - pickleshare==0.7.4 - pluggy==1.0.0 - prompt-toolkit==1.0.9 - ptyprocess==0.5.1 - py==1.11.0 - pygments==2.1.3 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.6.0 - pyyaml==3.12 - requests==2.12.1 - simplegeneric==0.8.1 - six==1.10.0 - tomli==1.2.3 - traitlets==4.3.1 - typing-extensions==4.1.1 - vcrpy==1.10.3 - wcwidth==0.1.7 - wrapt==1.10.8 - zipp==3.6.0 prefix: /opt/conda/envs/contentful.py
[ "tests/array_test.py::ArrayTest::test_asset", "tests/client_test.py::ClientTest::test_client_asset", "tests/client_test.py::ClientTest::test_client_assets", "tests/client_test.py::ClientTest::test_client_can_avoid_caching_content_types", "tests/client_test.py::ClientTest::test_client_creates_a_content_type_cache", "tests/client_test.py::ClientTest::test_client_creates_wrapped_arrays", "tests/client_test.py::ClientTest::test_client_entries", "tests/client_test.py::ClientTest::test_client_entries_select", "tests/client_test.py::ClientTest::test_client_entry", "tests/client_test.py::ClientTest::test_client_entry_not_found", "tests/client_test.py::ClientTest::test_client_get_content_type", "tests/client_test.py::ClientTest::test_client_get_content_types", "tests/client_test.py::ClientTest::test_client_get_space", "tests/client_test.py::ClientTest::test_client_sync", "tests/client_test.py::ClientTest::test_entries_dont_fail_with_unicode_characters" ]
[]
[]
[]
MIT License
1,016
[ "fixtures/client/entry_not_found.yaml", "contentful/errors.py", "CHANGELOG.md", "fixtures/client/array_endpoints.yaml", "contentful/resource_builder.py", "contentful/client.py", "contentful/array.py" ]
[ "fixtures/client/entry_not_found.yaml", "contentful/errors.py", "CHANGELOG.md", "fixtures/client/array_endpoints.yaml", "contentful/resource_builder.py", "contentful/client.py", "contentful/array.py" ]
Azure__azure-cli-2053
27816f4891c85592ad6f06bcc94008fa7d144b69
2017-02-13 16:48:43
1576ec67f5029db062579da230902a559acbb9fe
diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_help.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_help.py index 8f73d9966..540d6aab1 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_help.py +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_help.py @@ -235,22 +235,22 @@ helps['vm'] = """ type: group short-summary: Provision Linux and Windows virtual machines in minutes """ -helps['vm access'] = """ +helps['vm user'] = """ type: group - short-summary: Manage user access + short-summary: Manage users """ -helps['vm access delete-linux-user'] = """ +helps['vm user delete'] = """ type: command long-summary: > Delete a user account without logging into to the VM directly. examples: - name: Delete User - text: az vm access delete-linux-user -u username -n vm-name -r group_name + text: az vm user delete -u username -n vm-name -r group_name {0} -""".format(vm_ids_example.format('Delete User by VM Ids', 'az vm access delete-linux-user -u username')) +""".format(vm_ids_example.format('Delete User by VM Ids', 'az vm user delete -u username')) -helps['vm access reset-linux-ssh'] = """ +helps['vm user reset-ssh'] = """ type: command short-summary: Reset the SSH configuration. long-summary: > @@ -258,29 +258,21 @@ helps['vm access reset-linux-ssh'] = """ default values. The user account (name, password or SSH keys) will not be changed. examples: - name: Reset SSH - text: az vm access reset-linux-ssh -n vm-name -r group_name + text: az vm user reset-ssh -n vm-name -r group_name {0} -""".format(vm_ids_example.format('Reset SSH by VM Ids', 'vm access reset-linux-ssh')) +""".format(vm_ids_example.format('Reset SSH by VM Ids', 'vm user reset-ssh')) -helps['vm access set-linux-user'] = """ +helps['vm user update'] = """ type: command long-summary: Note, the user will have an admin's privilege. - examples: - - name: Set Linux User Access - text: az vm access set-linux-user -u username --ssh-key-value "$(< ~/.ssh/id_rsa.pub)" -n vm-name -r group_name -{0} -""".format(vm_ids_example.format('Set Linux User Access by VM Ids', 'vm access set-linux-user -u username ' - '--ssh-key-value "$(< ~/.ssh/id_rsa.pub)"')) - -helps['vm access reset-windows-admin'] = """ - type: command - long-summary: Note, this resets the admin's credentials. You can't add a new admin. examples: - name: Reset Windows Admin - text: az vm access reset-windows-admin -u username -p password -n vm-name -g resource_group_name + text: az vm user update -u username -p password -n vm-name -g resource_group_name + - name: Set Linux User + text: az vm user update -u username --ssh-key-value "$(< ~/.ssh/id_rsa.pub)" -n vm-name -r group_name {0} -""".format(vm_ids_example.format('Reset Windows Admin by VM Ids', 'vm access reset-windows-admin -u username -p ' - 'password')) +""".format(vm_ids_example.format('Set Linux User by VM Ids', 'vm user update -u username ' + '--ssh-key-value "$(< ~/.ssh/id_rsa.pub)"')) helps['vm availability-set'] = """ type: group diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_params.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_params.py index 37b56abbb..7644fde22 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_params.py +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_params.py @@ -80,8 +80,8 @@ register_cli_argument('vm availability-set create', 'availability_set_name', nam register_cli_argument('vm availability-set create', 'unmanaged', action='store_true', help='contained VMs should use unmanaged disks') register_cli_argument('vm availability-set create', 'validate', help='Generate and validate the ARM template without creating any resources.', action='store_true') -register_cli_argument('vm access', 'username', options_list=('--username', '-u'), help='The user name') -register_cli_argument('vm access', 'password', options_list=('--password', '-p'), help='The user password') +register_cli_argument('vm user', 'username', options_list=('--username', '-u'), help='The user name') +register_cli_argument('vm user', 'password', options_list=('--password', '-p'), help='The user password') register_cli_argument('acs', 'name', arg_type=name_arg_type) register_cli_argument('acs', 'orchestrator_type', **enum_choice_list(ContainerServiceOchestratorTypes)) diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/commands.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/commands.py index b29b3cc8a..8e555ca23 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/commands.py +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/commands.py @@ -121,10 +121,9 @@ cli_command(__name__, 'vmss nic list-vm-nics', 'azure.mgmt.network.operations.ne cli_command(__name__, 'vmss nic show', 'azure.mgmt.network.operations.network_interfaces_operations#NetworkInterfacesOperations.get_virtual_machine_scale_set_network_interface', cf_ni) # VM Access -cli_command(__name__, 'vm access set-linux-user', custom_path.format('set_linux_user')) -cli_command(__name__, 'vm access delete-linux-user', custom_path.format('delete_linux_user')) -cli_command(__name__, 'vm access reset-linux-ssh', custom_path.format('reset_linux_ssh')) -cli_command(__name__, 'vm access reset-windows-admin', custom_path.format('reset_windows_admin')) +cli_command(__name__, 'vm user update', custom_path.format('set_user')) +cli_command(__name__, 'vm user delete', custom_path.format('delete_user')) +cli_command(__name__, 'vm user reset-ssh', custom_path.format('reset_linux_ssh')) # # VM Availability Set cli_command(__name__, 'vm availability-set create', custom_path.format('create_av_set'), transform=transform_av_set_output) diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py index a61084931..75f5c79e8 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py @@ -598,41 +598,51 @@ def capture_vm(resource_group_name, vm_name, vhd_name_prefix, print(json.dumps(result.output, indent=2)) # pylint: disable=no-member -def reset_windows_admin( - resource_group_name, vm_name, username, password): - '''Update the password. - You can only change the password. Adding a new user is not supported. +def set_user(resource_group_name, vm_name, username, password=None, ssh_key_value=None): + '''Update or Add(only on Linux VM) users + :param username: user name + :param password: user password. + :param ssh_key_value: SSH public key file value or public key file path ''' vm = get_vm(resource_group_name, vm_name, 'instanceView') + if _is_linx_vm(vm): + return _set_linux_user(resource_group_name, vm_name, username, password, ssh_key_value) + else: + if ssh_key_value: + raise CLIError('SSH key is not appliable on a Windows VM') + return _reset_windows_admin(resource_group_name, vm, username, password) - client = _compute_client_factory() - from azure.mgmt.compute.models import VirtualMachineExtension +def delete_user( + resource_group_name, vm_name, username): + '''Remove a user(not supported on Windows VM) + :param username: user name + ''' + vm = get_vm(resource_group_name, vm_name, 'instanceView') + if not _is_linx_vm(vm): + raise CLIError('Deleting a user is not supported on Windows VM') + poller = _update_linux_access_extension(resource_group_name, vm_name, + {'remove_user': username}) + return ExtensionUpdateLongRunningOperation('deleting user', 'done')(poller) - extension_name = _WINDOWS_ACCESS_EXT - publisher, version, auto_upgrade = _get_access_extension_upgrade_info( - vm.resources, extension_name) - ext = VirtualMachineExtension(vm.location, # pylint: disable=no-member - publisher=publisher, - virtual_machine_extension_type=extension_name, - protected_settings={'Password': password}, - type_handler_version=version, - settings={'UserName': username}, - auto_upgrade_minor_version=auto_upgrade) +def reset_linux_ssh(resource_group_name, vm_name): + '''Reset the SSH configuration In Linux VM''' + vm = get_vm(resource_group_name, vm_name, 'instanceView') + if not _is_linx_vm(vm): + raise CLIError('Resetting SSH is not supported in Windows VM') + poller = _update_linux_access_extension(resource_group_name, vm_name, + {'reset_ssh': True}) + return ExtensionUpdateLongRunningOperation('resetting SSH', 'done')(poller) - poller = client.virtual_machine_extensions.create_or_update(resource_group_name, vm_name, - _ACCESS_EXT_HANDLER_NAME, ext) - return ExtensionUpdateLongRunningOperation('resetting admin', 'done')(poller) +def _is_linx_vm(vm): + os_type = vm.storage_profile.os_disk.os_type.value + return os_type.lower() == 'linux' -def set_linux_user( + +def _set_linux_user( resource_group_name, vm_name, username, password=None, ssh_key_value=None): - '''create or update a user credential - :param username: user name - :param password: user password. - :param ssh_key_value: SSH key file value or key file path - ''' protected_settings = {} protected_settings['username'] = username if password: @@ -648,19 +658,30 @@ def set_linux_user( return ExtensionUpdateLongRunningOperation('setting user', 'done')(poller) -def delete_linux_user( - resource_group_name, vm_name, username): - '''Remove the user ''' - poller = _update_linux_access_extension(resource_group_name, vm_name, - {'remove_user': username}) - return ExtensionUpdateLongRunningOperation('deleting user', 'done')(poller) +def _reset_windows_admin( + resource_group_name, vm, username, password): + '''Update the password. + You can only change the password. Adding a new user is not supported. + ''' + client = _compute_client_factory() + from azure.mgmt.compute.models import VirtualMachineExtension -def reset_linux_ssh(resource_group_name, vm_name): - '''Reset the SSH configuration''' - poller = _update_linux_access_extension(resource_group_name, vm_name, - {'reset_ssh': True}) - return ExtensionUpdateLongRunningOperation('resetting SSH', 'done')(poller) + extension_name = _WINDOWS_ACCESS_EXT + publisher, version, auto_upgrade = _get_access_extension_upgrade_info( + vm.resources, extension_name) + + ext = VirtualMachineExtension(vm.location, # pylint: disable=no-member + publisher=publisher, + virtual_machine_extension_type=extension_name, + protected_settings={'Password': password}, + type_handler_version=version, + settings={'UserName': username}, + auto_upgrade_minor_version=auto_upgrade) + + poller = client.virtual_machine_extensions.create_or_update(resource_group_name, vm.name, + _ACCESS_EXT_HANDLER_NAME, ext) + return ExtensionUpdateLongRunningOperation('resetting admin', 'done')(poller) def _update_linux_access_extension(resource_group_name, vm_name, protected_settings):
VM Access: command renaming This is polishing like change regarding 4 existing commands under `vm access`, including `delete-linux-user`, `reset-linux-ssh`, `reset-windows-admin`, `set-linux-user`. The naming oddness reflects the service function difference between windows and linux vm, particularly on windows vm, you will not be able to add/rename/delete users, even though the API invoke always succeeds but nothing really happens at vm side The change details are: 1. Rename category `vm access` to `vm user` 2. Collapse into 3 commands `delete`: delete a user from linux vm `update`: for windows vm, you can only update the admin password, for linux vm, you can add, or change both username and password, also you can upload public ssh key `reset-ssh`: reset linux vm’s SSH configurations
Azure/azure-cli
diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/recordings/test_vm_create_state_modifications.yaml b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/recordings/test_vm_create_state_modifications.yaml index 4d2a3c12b..02382f28f 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/recordings/test_vm_create_state_modifications.yaml +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/recordings/test_vm_create_state_modifications.yaml @@ -6,10 +6,10 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [5e5c8ed8-e757-11e6-a5f3-64510658e3b3] + x-ms-client-request-id: [37d14674-f0e6-11e6-8bdc-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines?api-version=2016-04-30-preview response: @@ -17,7 +17,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:48:31 GMT'] + Date: ['Sun, 12 Feb 2017 05:43:45 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] @@ -31,20 +31,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [5e9a4be6-e757-11e6-9eef-64510658e3b3] + x-ms-client-request-id: [385d70c8-f0e6-11e6-8a3d-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage?api-version=2016-09-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage","namespace":"Microsoft.Storage","resourceTypes":[{"resourceType":"storageAccounts","locations":["East + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage","namespace":"Microsoft.Storage","authorization":{"applicationId":"a6aa9161-5291-40bb-8c5c-923b567bee3b","roleDefinitionId":"070ab87f-0efc-4423-b18b-756f3bdb0236"},"resourceTypes":[{"resourceType":"storageAccounts","locations":["East US","East US 2","East US 2 (Stage)","West US","West Europe","East Asia","Southeast Asia","Japan East","Japan West","North Central US","South Central US","Central US","North Europe","Brazil South","Australia East","Australia Southeast","South India","Central India","West India","Canada East","Canada Central","West US 2","West Central US","UK South","UK West"],"apiVersions":["2016-12-01","2016-05-01","2016-01-01","2015-06-15","2015-05-01-preview"],"capabilities":"CrossResourceGroupResourceMove, - CrossSubscriptionResourceMove"},{"resourceType":"operations","locations":[],"apiVersions":["2016-12-01","2016-05-01","2016-01-01","2015-06-15","2015-05-01-preview"]},{"resourceType":"storageAccounts/listAccountSas","locations":[],"apiVersions":["2016-12-01","2016-05-01"]},{"resourceType":"usages","locations":[],"apiVersions":["2016-12-01","2016-05-01","2016-01-01","2015-06-15","2015-05-01-preview"]},{"resourceType":"checkNameAvailability","locations":[],"apiVersions":["2016-12-01","2016-05-01","2016-01-01","2015-06-15","2015-05-01-preview"]},{"resourceType":"storageAccounts/services","locations":["East + CrossSubscriptionResourceMove"},{"resourceType":"operations","locations":[],"apiVersions":["2016-12-01","2016-05-01","2016-01-01","2015-06-15","2015-05-01-preview"]},{"resourceType":"storageAccounts/listAccountSas","locations":[],"apiVersions":["2016-12-01","2016-05-01"]},{"resourceType":"storageAccounts/listServiceSas","locations":[],"apiVersions":["2016-12-01","2016-05-01"]},{"resourceType":"locations","locations":[],"apiVersions":["2016-12-01","2016-07-01"]},{"resourceType":"locations/deleteVirtualNetworkOrSubnets","locations":[],"apiVersions":["2016-12-01","2016-07-01"]},{"resourceType":"usages","locations":[],"apiVersions":["2016-12-01","2016-05-01","2016-01-01","2015-06-15","2015-05-01-preview"]},{"resourceType":"checkNameAvailability","locations":[],"apiVersions":["2016-12-01","2016-05-01","2016-01-01","2015-06-15","2015-05-01-preview"]},{"resourceType":"storageAccounts/services","locations":["East US","West US","East US 2 (Stage)","West Europe","North Europe","East Asia","Southeast Asia","Japan East","Japan West","North Central US","South Central US","East US 2","Central US","Australia East","Australia Southeast","Brazil South","South @@ -58,12 +58,12 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:48:31 GMT'] + Date: ['Sun, 12 Feb 2017 05:43:45 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Vary: [Accept-Encoding] - content-length: ['2194'] + content-length: ['2634'] status: {code: 200, message: OK} - request: body: null @@ -72,20 +72,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [5ea9dd2c-e757-11e6-a7df-64510658e3b3] + x-ms-client-request-id: [387e5538-f0e6-11e6-9cad-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Storage/storageAccounts/ab394fvkdj34?api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Storage/storageAccounts/ab394fvkdj39?api-version=2016-12-01 response: - body: {string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.Storage/storageAccounts/ab394fvkdj34'' + body: {string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.Storage/storageAccounts/ab394fvkdj39'' under resource group ''cli_test_vm_state_mod'' was not found."}}'} headers: Cache-Control: [no-cache] Content-Length: ['177'] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:48:32 GMT'] + Date: ['Sun, 12 Feb 2017 05:43:46 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] @@ -98,10 +98,10 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [5f1491da-e757-11e6-a87a-64510658e3b3] + x-ms-client-request-id: [38b37392-f0e6-11e6-9f60-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network?api-version=2016-09-01 response: @@ -185,7 +185,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:48:31 GMT'] + Date: ['Sun, 12 Feb 2017 05:43:46 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] @@ -199,10 +199,10 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [5f32b194-e757-11e6-99f3-64510658e3b3] + x-ms-client-request-id: [38e22bf0-f0e6-11e6-bfcf-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg?api-version=2016-12-01 response: @@ -212,7 +212,7 @@ interactions: Cache-Control: [no-cache] Content-Length: ['176'] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:48:32 GMT'] + Date: ['Sun, 12 Feb 2017 05:43:46 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] @@ -225,10 +225,10 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [5f9976a2-e757-11e6-ac06-64510658e3b3] + x-ms-client-request-id: [391554ba-f0e6-11e6-ae69-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network?api-version=2016-09-01 response: @@ -312,7 +312,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:48:32 GMT'] + Date: ['Sun, 12 Feb 2017 05:43:46 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] @@ -326,10 +326,10 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [5fb66012-e757-11e6-888a-64510658e3b3] + x-ms-client-request-id: [393a4ba6-f0e6-11e6-9255-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Network/publicIPAddresses/mypubip?api-version=2016-12-01 response: @@ -339,70 +339,69 @@ interactions: Cache-Control: [no-cache] Content-Length: ['174'] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:48:33 GMT'] + Date: ['Sun, 12 Feb 2017 05:43:46 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] x-ms-failure-cause: [gateway] status: {code: 404, message: Not Found} - request: - body: '{"properties": {"parameters": {}, "mode": "Incremental", "template": {"parameters": - {}, "resources": [{"apiVersion": "2015-06-15", "tags": {"secondtag": "2", "firsttag": - "1", "thirdtag": ""}, "location": "eastus", "name": "ab394fvkdj34", "properties": - {"accountType": "Standard_LRS"}, "type": "Microsoft.Storage/storageAccounts", - "dependsOn": []}, {"apiVersion": "2015-06-15", "tags": {"secondtag": "2", "firsttag": - "1", "thirdtag": ""}, "location": "eastus", "name": "myvnet", "properties": - {"subnets": [{"name": "vm-state-modSubnet", "properties": {"addressPrefix": - "10.0.0.0/24"}}], "addressSpace": {"addressPrefixes": ["10.0.0.0/16"]}}, "type": - "Microsoft.Network/virtualNetworks", "dependsOn": []}, {"apiVersion": "2015-06-15", - "tags": {"secondtag": "2", "firsttag": "1", "thirdtag": ""}, "location": "eastus", - "name": "mynsg", "properties": {"securityRules": [{"name": "default-allow-ssh", - "properties": {"sourcePortRange": "*", "direction": "Inbound", "protocol": "Tcp", - "destinationAddressPrefix": "*", "sourceAddressPrefix": "*", "priority": 1000, - "access": "Allow", "destinationPortRange": "22"}}]}, "type": "Microsoft.Network/networkSecurityGroups", - "dependsOn": []}, {"apiVersion": "2015-06-15", "tags": {"secondtag": "2", "firsttag": - "1", "thirdtag": ""}, "location": "eastus", "name": "mypubip", "properties": - {"publicIPAllocationMethod": "dynamic"}, "type": "Microsoft.Network/publicIPAddresses", - "dependsOn": []}, {"apiVersion": "2015-06-15", "tags": {"secondtag": "2", "firsttag": - "1", "thirdtag": ""}, "location": "eastus", "name": "vm-state-modVMNic", "properties": - {"networkSecurityGroup": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg"}, - "ipConfigurations": [{"name": "ipconfigvm-state-mod", "properties": {"subnet": - {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/vm-state-modSubnet"}, - "privateIPAllocationMethod": "Dynamic", "publicIPAddress": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/publicIPAddresses/mypubip"}}}]}, - "type": "Microsoft.Network/networkInterfaces", "dependsOn": ["Microsoft.Network/virtualNetworks/myvnet", - "Microsoft.Network/networkSecurityGroups/mynsg", "Microsoft.Network/publicIpAddresses/mypubip"]}, - {"apiVersion": "2016-04-30-preview", "tags": {"secondtag": "2", "firsttag": - "1", "thirdtag": ""}, "location": "eastus", "name": "vm-state-mod", "properties": - {"storageProfile": {"imageReference": {"sku": "14.04.4-LTS", "version": "latest", - "offer": "UbuntuServer", "publisher": "Canonical"}, "osDisk": {"createOption": - "fromImage", "name": "osdisk_67DTRZjyk0", "vhd": {"uri": "https://ab394fvkdj34.blob.core.windows.net/vhds/osdisk_67DTRZjyk0.vhd"}, - "caching": "ReadWrite"}}, "osProfile": {"adminUsername": "ubuntu", "computerName": - "vm-state-mod", "adminPassword": "testPassword0"}, "networkProfile": {"networkInterfaces": - [{"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic"}]}, - "hardwareProfile": {"vmSize": "Standard_DS1"}}, "type": "Microsoft.Compute/virtualMachines", - "dependsOn": ["Microsoft.Storage/storageAccounts/ab394fvkdj34", "Microsoft.Network/networkInterfaces/vm-state-modVMNic"]}], - "variables": {}, "contentVersion": "1.0.0.0", "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", - "outputs": {}}}}' + body: '{"properties": {"mode": "Incremental", "parameters": {}, "template": {"resources": + [{"location": "eastus", "dependsOn": [], "tags": {"firsttag": "1", "thirdtag": + "", "secondtag": "2"}, "properties": {"accountType": "Standard_LRS"}, "apiVersion": + "2015-06-15", "type": "Microsoft.Storage/storageAccounts", "name": "ab394fvkdj39"}, + {"location": "eastus", "dependsOn": [], "tags": {"firsttag": "1", "thirdtag": + "", "secondtag": "2"}, "properties": {"subnets": [{"properties": {"addressPrefix": + "10.0.0.0/24"}, "name": "vm-state-modSubnet"}], "addressSpace": {"addressPrefixes": + ["10.0.0.0/16"]}}, "apiVersion": "2015-06-15", "type": "Microsoft.Network/virtualNetworks", + "name": "myvnet"}, {"location": "eastus", "dependsOn": [], "tags": {"firsttag": + "1", "thirdtag": "", "secondtag": "2"}, "properties": {"securityRules": [{"properties": + {"destinationPortRange": "22", "sourcePortRange": "*", "direction": "Inbound", + "priority": 1000, "protocol": "Tcp", "sourceAddressPrefix": "*", "access": "Allow", + "destinationAddressPrefix": "*"}, "name": "default-allow-ssh"}]}, "apiVersion": + "2015-06-15", "type": "Microsoft.Network/networkSecurityGroups", "name": "mynsg"}, + {"location": "eastus", "dependsOn": [], "tags": {"firsttag": "1", "thirdtag": + "", "secondtag": "2"}, "properties": {"publicIPAllocationMethod": "dynamic"}, + "apiVersion": "2015-06-15", "type": "Microsoft.Network/publicIPAddresses", "name": + "mypubip"}, {"location": "eastus", "dependsOn": ["Microsoft.Network/virtualNetworks/myvnet", + "Microsoft.Network/networkSecurityGroups/mynsg", "Microsoft.Network/publicIpAddresses/mypubip"], + "tags": {"firsttag": "1", "thirdtag": "", "secondtag": "2"}, "properties": {"ipConfigurations": + [{"properties": {"publicIPAddress": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/publicIPAddresses/mypubip"}, + "privateIPAllocationMethod": "Dynamic", "subnet": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/vm-state-modSubnet"}}, + "name": "ipconfigvm-state-mod"}], "networkSecurityGroup": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg"}}, + "apiVersion": "2015-06-15", "type": "Microsoft.Network/networkInterfaces", "name": + "vm-state-modVMNic"}, {"location": "eastus", "dependsOn": ["Microsoft.Storage/storageAccounts/ab394fvkdj39", + "Microsoft.Network/networkInterfaces/vm-state-modVMNic"], "tags": {"firsttag": + "1", "thirdtag": "", "secondtag": "2"}, "properties": {"storageProfile": {"imageReference": + {"offer": "UbuntuServer", "sku": "14.04.4-LTS", "publisher": "Canonical", "version": + "latest"}, "osDisk": {"createOption": "fromImage", "caching": "ReadWrite", "name": + "osdisk_vJe7inxoHG", "vhd": {"uri": "https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd"}}}, + "osProfile": {"computerName": "vm-state-mod", "adminUsername": "ubuntu", "adminPassword": + "testPassword0"}, "networkProfile": {"networkInterfaces": [{"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic"}]}, + "hardwareProfile": {"vmSize": "Standard_DS1"}}, "apiVersion": "2016-04-30-preview", + "type": "Microsoft.Compute/virtualMachines", "name": "vm-state-mod"}], "outputs": + {}, "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", "variables": {}, "parameters": {}}}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Length: ['3631'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [6009aff8-e757-11e6-9744-64510658e3b3] + x-ms-client-request-id: [3969e538-f0e6-11e6-835a-f4b7e2e85440] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2016-09-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/vm_deploy_xrHrrbhV41SEKZiOipzmvVPO1zMJozb3","name":"vm_deploy_xrHrrbhV41SEKZiOipzmvVPO1zMJozb3","properties":{"parameters":{},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2017-01-31T01:48:36.2881495Z","duration":"PT1.3075055S","correlationId":"9d473581-4d54-4dc4-bc63-388b215b4a2f","providers":[{"namespace":"Microsoft.Storage","resourceTypes":[{"resourceType":"storageAccounts","locations":["eastus"]}]},{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["eastus"]},{"resourceType":"networkSecurityGroups","locations":["eastus"]},{"resourceType":"publicIPAddresses","locations":["eastus"]},{"resourceType":"networkInterfaces","locations":["eastus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["eastus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/virtualNetworks/myvnet","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"myvnet"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"mynsg"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/publicIpAddresses/mypubip","resourceType":"Microsoft.Network/publicIpAddresses","resourceName":"mypubip"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm-state-modVMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Storage/storageAccounts/ab394fvkdj34","resourceType":"Microsoft.Storage/storageAccounts","resourceName":"ab394fvkdj34"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm-state-modVMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm-state-mod"}]}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/vm_deploy_GCPYqmrEK0QpIkC7H2aWP0QraNuR8nAg","name":"vm_deploy_GCPYqmrEK0QpIkC7H2aWP0QraNuR8nAg","properties":{"parameters":{},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2017-02-12T05:43:49.9044643Z","duration":"PT1.3828799S","correlationId":"ca4d3d0f-20a3-4d6f-ac9c-d0a91fb15595","providers":[{"namespace":"Microsoft.Storage","resourceTypes":[{"resourceType":"storageAccounts","locations":["eastus"]}]},{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["eastus"]},{"resourceType":"networkSecurityGroups","locations":["eastus"]},{"resourceType":"publicIPAddresses","locations":["eastus"]},{"resourceType":"networkInterfaces","locations":["eastus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["eastus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/virtualNetworks/myvnet","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"myvnet"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"mynsg"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/publicIpAddresses/mypubip","resourceType":"Microsoft.Network/publicIpAddresses","resourceName":"mypubip"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm-state-modVMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Storage/storageAccounts/ab394fvkdj39","resourceType":"Microsoft.Storage/storageAccounts","resourceName":"ab394fvkdj39"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm-state-modVMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm-state-mod"}]}}'} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/vm_deploy_xrHrrbhV41SEKZiOipzmvVPO1zMJozb3/operationStatuses/08587157795704970241?api-version=2016-09-01'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/vm_deploy_GCPYqmrEK0QpIkC7H2aWP0QraNuR8nAg/operationStatuses/08587147286569560904?api-version=2016-09-01'] Cache-Control: [no-cache] Content-Length: ['2722'] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:48:36 GMT'] + Date: ['Sun, 12 Feb 2017 05:43:50 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] @@ -415,18 +414,18 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [6009aff8-e757-11e6-9744-64510658e3b3] + x-ms-client-request-id: [3969e538-f0e6-11e6-835a-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587157795704970241?api-version=2016-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587147286569560904?api-version=2016-09-01 response: body: {string: '{"status":"Running"}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:49:06 GMT'] + Date: ['Sun, 12 Feb 2017 05:44:20 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] @@ -440,18 +439,18 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [6009aff8-e757-11e6-9744-64510658e3b3] + x-ms-client-request-id: [3969e538-f0e6-11e6-835a-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587157795704970241?api-version=2016-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587147286569560904?api-version=2016-09-01 response: body: {string: '{"status":"Running"}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:49:36 GMT'] + Date: ['Sun, 12 Feb 2017 05:44:50 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] @@ -465,18 +464,18 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [6009aff8-e757-11e6-9744-64510658e3b3] + x-ms-client-request-id: [3969e538-f0e6-11e6-835a-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587157795704970241?api-version=2016-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587147286569560904?api-version=2016-09-01 response: body: {string: '{"status":"Running"}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:50:08 GMT'] + Date: ['Sun, 12 Feb 2017 05:45:21 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] @@ -490,18 +489,43 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [6009aff8-e757-11e6-9744-64510658e3b3] + x-ms-client-request-id: [3969e538-f0e6-11e6-835a-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587157795704970241?api-version=2016-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587147286569560904?api-version=2016-09-01 + response: + body: {string: '{"status":"Running"}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Sun, 12 Feb 2017 05:45:51 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Vary: [Accept-Encoding] + content-length: ['20'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [3969e538-f0e6-11e6-835a-f4b7e2e85440] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587147286569560904?api-version=2016-09-01 response: body: {string: '{"status":"Succeeded"}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:50:38 GMT'] + Date: ['Sun, 12 Feb 2017 05:46:22 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] @@ -515,23 +539,23 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [6009aff8-e757-11e6-9744-64510658e3b3] + x-ms-client-request-id: [3969e538-f0e6-11e6-835a-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2016-09-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/vm_deploy_xrHrrbhV41SEKZiOipzmvVPO1zMJozb3","name":"vm_deploy_xrHrrbhV41SEKZiOipzmvVPO1zMJozb3","properties":{"parameters":{},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-01-31T01:50:25.2599028Z","duration":"PT1M50.2792588S","correlationId":"9d473581-4d54-4dc4-bc63-388b215b4a2f","providers":[{"namespace":"Microsoft.Storage","resourceTypes":[{"resourceType":"storageAccounts","locations":["eastus"]}]},{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["eastus"]},{"resourceType":"networkSecurityGroups","locations":["eastus"]},{"resourceType":"publicIPAddresses","locations":["eastus"]},{"resourceType":"networkInterfaces","locations":["eastus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["eastus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/virtualNetworks/myvnet","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"myvnet"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"mynsg"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/publicIpAddresses/mypubip","resourceType":"Microsoft.Network/publicIpAddresses","resourceName":"mypubip"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm-state-modVMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Storage/storageAccounts/ab394fvkdj34","resourceType":"Microsoft.Storage/storageAccounts","resourceName":"ab394fvkdj34"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm-state-modVMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm-state-mod"}],"outputs":{},"outputResources":[{"id":"Microsoft.Compute/virtualMachines/vm-state-mod"},{"id":"Microsoft.Network/networkInterfaces/vm-state-modVMNic"},{"id":"Microsoft.Network/networkSecurityGroups/mynsg"},{"id":"Microsoft.Network/publicIPAddresses/mypubip"},{"id":"Microsoft.Network/virtualNetworks/myvnet"},{"id":"Microsoft.Storage/storageAccounts/ab394fvkdj34"}]}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Resources/deployments/vm_deploy_GCPYqmrEK0QpIkC7H2aWP0QraNuR8nAg","name":"vm_deploy_GCPYqmrEK0QpIkC7H2aWP0QraNuR8nAg","properties":{"parameters":{},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-02-12T05:45:53.8740153Z","duration":"PT2M5.3524309S","correlationId":"ca4d3d0f-20a3-4d6f-ac9c-d0a91fb15595","providers":[{"namespace":"Microsoft.Storage","resourceTypes":[{"resourceType":"storageAccounts","locations":["eastus"]}]},{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["eastus"]},{"resourceType":"networkSecurityGroups","locations":["eastus"]},{"resourceType":"publicIPAddresses","locations":["eastus"]},{"resourceType":"networkInterfaces","locations":["eastus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["eastus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/virtualNetworks/myvnet","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"myvnet"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"mynsg"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/publicIpAddresses/mypubip","resourceType":"Microsoft.Network/publicIpAddresses","resourceName":"mypubip"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm-state-modVMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Storage/storageAccounts/ab394fvkdj39","resourceType":"Microsoft.Storage/storageAccounts","resourceName":"ab394fvkdj39"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm-state-modVMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm-state-mod"}],"outputs":{},"outputResources":[{"id":"Microsoft.Compute/virtualMachines/vm-state-mod"},{"id":"Microsoft.Network/networkInterfaces/vm-state-modVMNic"},{"id":"Microsoft.Network/networkSecurityGroups/mynsg"},{"id":"Microsoft.Network/publicIPAddresses/mypubip"},{"id":"Microsoft.Network/virtualNetworks/myvnet"},{"id":"Microsoft.Storage/storageAccounts/ab394fvkdj39"}]}}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:50:38 GMT'] + Date: ['Sun, 12 Feb 2017 05:46:23 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Vary: [Accept-Encoding] - content-length: ['3092'] + content-length: ['3091'] status: {code: 200, message: OK} - request: body: null @@ -540,21 +564,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ab2a8848-e757-11e6-8c82-64510658e3b3] + x-ms-client-request-id: [970c5b68-f0e6-11e6-bde4-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?api-version=2016-04-30-preview&$expand=instanceView + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?$expand=instanceView&api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"c05b0fe2-cdfc-47e5-903a-d751c65b9ff9\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"987654cb-f4fa-4426-8f3f-c9fda42418e2\"\ ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1\"\r\n\ \ },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_67DTRZjyk0\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj34.blob.core.windows.net/vhds/osdisk_67DTRZjyk0.vhd\"\ + \ \"name\": \"osdisk_vJe7inxoHG\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd\"\ \r\n },\r\n \"caching\": \"ReadWrite\"\r\n },\r\n \ \ \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\"\ : \"vm-state-mod\",\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ @@ -566,35 +590,35 @@ interactions: ,\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"\ Ready\",\r\n \"message\": \"GuestAgent is running and accepting\ - \ new configurations.\",\r\n \"time\": \"2017-01-31T01:50:19+00:00\"\ + \ new configurations.\",\r\n \"time\": \"2017-02-12T05:46:14+00:00\"\ \r\n }\r\n ],\r\n \"extensionHandlers\": []\r\n \ - \ },\r\n \"disks\": [\r\n {\r\n \"name\": \"osdisk_67DTRZjyk0\"\ + \ },\r\n \"disks\": [\r\n {\r\n \"name\": \"osdisk_vJe7inxoHG\"\ ,\r\n \"statuses\": [\r\n {\r\n \"code\"\ : \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\ \n \"displayStatus\": \"Provisioning succeeded\",\r\n \ - \ \"time\": \"2017-01-31T01:49:01.3353712+00:00\"\r\n }\r\ - \n ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ - \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ - \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ - ,\r\n \"time\": \"2017-01-31T01:50:16.5864467+00:00\"\r\n \ + \ \"time\": \"2017-02-12T05:44:15.585184+00:00\"\r\n }\r\n\ + \ ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ + \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"\ + level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ + ,\r\n \"time\": \"2017-02-12T05:45:48.9983754+00:00\"\r\n \ \ },\r\n {\r\n \"code\": \"PowerState/running\",\r\n \ \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\ \n }\r\n ]\r\n }\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines\"\ - ,\r\n \"location\": \"eastus\",\r\n \"tags\": {\r\n \"secondtag\": \"\ - 2\",\r\n \"firsttag\": \"1\",\r\n \"thirdtag\": \"\"\r\n },\r\n \"\ + ,\r\n \"location\": \"eastus\",\r\n \"tags\": {\r\n \"firsttag\": \"\ + 1\",\r\n \"thirdtag\": \"\",\r\n \"secondtag\": \"2\"\r\n },\r\n \"\ id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ ,\r\n \"name\": \"vm-state-mod\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:50:39 GMT'] + Date: ['Sun, 12 Feb 2017 05:46:24 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['2658'] + content-length: ['2657'] status: {code: 200, message: OK} - request: body: null @@ -603,22 +627,22 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ab6e3506-e757-11e6-9228-64510658e3b3] + x-ms-client-request-id: [97576e30-f0e6-11e6-96f0-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic?api-version=2016-09-01 response: body: {string: "{\r\n \"name\": \"vm-state-modVMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic\"\ - ,\r\n \"etag\": \"W/\\\"3be07300-6bd1-4626-be83-90e031e30af4\\\"\",\r\n \ - \ \"location\": \"eastus\",\r\n \"tags\": {\r\n \"secondtag\": \"2\",\r\ - \n \"firsttag\": \"1\",\r\n \"thirdtag\": \"\"\r\n },\r\n \"properties\"\ + ,\r\n \"etag\": \"W/\\\"660a02ba-0fdc-4c61-b81b-36b95f924280\\\"\",\r\n \ + \ \"location\": \"eastus\",\r\n \"tags\": {\r\n \"firsttag\": \"1\",\r\ + \n \"thirdtag\": \"\",\r\n \"secondtag\": \"2\"\r\n },\r\n \"properties\"\ : {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\":\ - \ \"e6b58fcc-ade7-45f7-90aa-229fd05a9043\",\r\n \"ipConfigurations\": [\r\ + \ \"ce57e1c9-7a60-4522-ae9f-caa6e8ab89d9\",\r\n \"ipConfigurations\": [\r\ \n {\r\n \"name\": \"ipconfigvm-state-mod\",\r\n \"id\"\ : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic/ipConfigurations/ipconfigvm-state-mod\"\ - ,\r\n \"etag\": \"W/\\\"3be07300-6bd1-4626-be83-90e031e30af4\\\"\"\ + ,\r\n \"etag\": \"W/\\\"660a02ba-0fdc-4c61-b81b-36b95f924280\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\ : \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\ @@ -627,8 +651,8 @@ interactions: \r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\ : \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\ \ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\ - internalDomainNameSuffix\": \"sypdqf4j0vjevmtntsvp4wudnc.bx.internal.cloudapp.net\"\ - \r\n },\r\n \"macAddress\": \"00-0D-3A-18-E4-71\",\r\n \"enableAcceleratedNetworking\"\ + internalDomainNameSuffix\": \"p0lcxouumadebajqyramln5cjf.bx.internal.cloudapp.net\"\ + \r\n },\r\n \"macAddress\": \"00-0D-3A-10-39-46\",\r\n \"enableAcceleratedNetworking\"\ : false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\ : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg\"\ \r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \ @@ -638,8 +662,8 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:50:40 GMT'] - ETag: [W/"3be07300-6bd1-4626-be83-90e031e30af4"] + Date: ['Sun, 12 Feb 2017 05:46:24 GMT'] + ETag: [W/"660a02ba-0fdc-4c61-b81b-36b95f924280"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -655,35 +679,35 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ab8ca5f4-e757-11e6-ab44-64510658e3b3] + x-ms-client-request-id: [978ac18a-f0e6-11e6-b65f-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/publicIPAddresses/mypubip?api-version=2016-09-01 response: body: {string: "{\r\n \"name\": \"mypubip\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/publicIPAddresses/mypubip\"\ - ,\r\n \"etag\": \"W/\\\"07b533e2-d567-4d5d-a2f0-abd0418e485c\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"56c2f566-d599-41f2-aeba-f43e3df53e38\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n \"location\": \"\ - eastus\",\r\n \"tags\": {\r\n \"secondtag\": \"2\",\r\n \"firsttag\"\ - : \"1\",\r\n \"thirdtag\": \"\"\r\n },\r\n \"properties\": {\r\n \"\ - provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"b7e37011-797b-469a-b1b9-d34ab5f33d3a\"\ - ,\r\n \"ipAddress\": \"40.71.99.3\",\r\n \"publicIPAddressVersion\"\ + eastus\",\r\n \"tags\": {\r\n \"firsttag\": \"1\",\r\n \"thirdtag\"\ + : \"\",\r\n \"secondtag\": \"2\"\r\n },\r\n \"properties\": {\r\n \ + \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"42e08a80-8dd0-4de5-9118-890ede4f1dc8\"\ + ,\r\n \"ipAddress\": \"40.121.214.78\",\r\n \"publicIPAddressVersion\"\ : \"IPv4\",\r\n \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\"\ : 4,\r\n \"ipConfiguration\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic/ipConfigurations/ipconfigvm-state-mod\"\ \r\n }\r\n }\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:50:40 GMT'] - ETag: [W/"07b533e2-d567-4d5d-a2f0-abd0418e485c"] + Date: ['Sun, 12 Feb 2017 05:46:25 GMT'] + ETag: [W/"56c2f566-d599-41f2-aeba-f43e3df53e38"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['919'] + content-length: ['922'] status: {code: 200, message: OK} - request: body: null @@ -692,22 +716,22 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ac01c374-e757-11e6-b873-64510658e3b3] + x-ms-client-request-id: [9834922c-f0e6-11e6-9a87-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines?api-version=2016-04-30-preview response: body: {string: "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \ - \ \"vmId\": \"c05b0fe2-cdfc-47e5-903a-d751c65b9ff9\",\r\n \"hardwareProfile\"\ + \ \"vmId\": \"987654cb-f4fa-4426-8f3f-c9fda42418e2\",\r\n \"hardwareProfile\"\ : {\r\n \"vmSize\": \"Standard_DS1\"\r\n },\r\n \"\ storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\"\ : \"Canonical\",\r\n \"offer\": \"UbuntuServer\",\r\n \ \ \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\n \ \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\"\ - ,\r\n \"name\": \"osdisk_67DTRZjyk0\",\r\n \"createOption\"\ - : \"FromImage\",\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj34.blob.core.windows.net/vhds/osdisk_67DTRZjyk0.vhd\"\ + ,\r\n \"name\": \"osdisk_vJe7inxoHG\",\r\n \"createOption\"\ + : \"FromImage\",\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd\"\ \r\n },\r\n \"caching\": \"ReadWrite\"\r\n \ \ },\r\n \"dataDisks\": []\r\n },\r\n \"osProfile\"\ : {\r\n \"computerName\": \"vm-state-mod\",\r\n \"adminUsername\"\ @@ -716,14 +740,14 @@ interactions: \ \"networkProfile\": {\"networkInterfaces\":[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic\"\ }]},\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \ \ \"type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\":\ - \ \"eastus\",\r\n \"tags\": {\r\n \"secondtag\": \"2\",\r\n \ - \ \"firsttag\": \"1\",\r\n \"thirdtag\": \"\"\r\n },\r\n\ + \ \"eastus\",\r\n \"tags\": {\r\n \"firsttag\": \"1\",\r\n \ + \ \"thirdtag\": \"\",\r\n \"secondtag\": \"2\"\r\n },\r\n\ \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ ,\r\n \"name\": \"vm-state-mod\"\r\n }\r\n ]\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:50:41 GMT'] + Date: ['Sun, 12 Feb 2017 05:46:26 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -739,21 +763,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ac863128-e757-11e6-b516-64510658e3b3] + x-ms-client-request-id: [98f8f362-f0e6-11e6-afeb-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"c05b0fe2-cdfc-47e5-903a-d751c65b9ff9\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"987654cb-f4fa-4426-8f3f-c9fda42418e2\"\ ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1\"\r\n\ \ },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_67DTRZjyk0\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj34.blob.core.windows.net/vhds/osdisk_67DTRZjyk0.vhd\"\ + \ \"name\": \"osdisk_vJe7inxoHG\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd\"\ \r\n },\r\n \"caching\": \"ReadWrite\"\r\n },\r\n \ \ \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\"\ : \"vm-state-mod\",\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ @@ -762,13 +786,13 @@ interactions: :[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic\"\ }]},\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"type\": \"\ Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n \"\ - tags\": {\r\n \"secondtag\": \"2\",\r\n \"firsttag\": \"1\",\r\n \ - \ \"thirdtag\": \"\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ + tags\": {\r\n \"firsttag\": \"1\",\r\n \"thirdtag\": \"\",\r\n \"\ + secondtag\": \"2\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ ,\r\n \"name\": \"vm-state-mod\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:50:42 GMT'] + Date: ['Sun, 12 Feb 2017 05:46:27 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -784,21 +808,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ad06b4fa-e757-11e6-90f1-64510658e3b3] + x-ms-client-request-id: [99a820fe-f0e6-11e6-b8c1-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?api-version=2016-04-30-preview&$expand=instanceView + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?$expand=instanceView&api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"c05b0fe2-cdfc-47e5-903a-d751c65b9ff9\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"987654cb-f4fa-4426-8f3f-c9fda42418e2\"\ ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1\"\r\n\ \ },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_67DTRZjyk0\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj34.blob.core.windows.net/vhds/osdisk_67DTRZjyk0.vhd\"\ + \ \"name\": \"osdisk_vJe7inxoHG\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd\"\ \r\n },\r\n \"caching\": \"ReadWrite\"\r\n },\r\n \ \ \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\"\ : \"vm-state-mod\",\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ @@ -810,35 +834,35 @@ interactions: ,\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"\ Ready\",\r\n \"message\": \"GuestAgent is running and accepting\ - \ new configurations.\",\r\n \"time\": \"2017-01-31T01:50:19+00:00\"\ + \ new configurations.\",\r\n \"time\": \"2017-02-12T05:46:14+00:00\"\ \r\n }\r\n ],\r\n \"extensionHandlers\": []\r\n \ - \ },\r\n \"disks\": [\r\n {\r\n \"name\": \"osdisk_67DTRZjyk0\"\ + \ },\r\n \"disks\": [\r\n {\r\n \"name\": \"osdisk_vJe7inxoHG\"\ ,\r\n \"statuses\": [\r\n {\r\n \"code\"\ : \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\ \n \"displayStatus\": \"Provisioning succeeded\",\r\n \ - \ \"time\": \"2017-01-31T01:49:01.3353712+00:00\"\r\n }\r\ - \n ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ - \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ - \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ - ,\r\n \"time\": \"2017-01-31T01:50:16.5864467+00:00\"\r\n \ + \ \"time\": \"2017-02-12T05:44:15.585184+00:00\"\r\n }\r\n\ + \ ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ + \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"\ + level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ + ,\r\n \"time\": \"2017-02-12T05:45:48.9983754+00:00\"\r\n \ \ },\r\n {\r\n \"code\": \"PowerState/running\",\r\n \ \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\ \n }\r\n ]\r\n }\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines\"\ - ,\r\n \"location\": \"eastus\",\r\n \"tags\": {\r\n \"secondtag\": \"\ - 2\",\r\n \"firsttag\": \"1\",\r\n \"thirdtag\": \"\"\r\n },\r\n \"\ + ,\r\n \"location\": \"eastus\",\r\n \"tags\": {\r\n \"firsttag\": \"\ + 1\",\r\n \"thirdtag\": \"\",\r\n \"secondtag\": \"2\"\r\n },\r\n \"\ id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ ,\r\n \"name\": \"vm-state-mod\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:50:43 GMT'] + Date: ['Sun, 12 Feb 2017 05:46:28 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['2658'] + content-length: ['2657'] status: {code: 200, message: OK} - request: body: null @@ -847,21 +871,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ad83108a-e757-11e6-bcad-64510658e3b3] + x-ms-client-request-id: [9a745c36-f0e6-11e6-8719-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?api-version=2016-04-30-preview&$expand=instanceView + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?$expand=instanceView&api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"c05b0fe2-cdfc-47e5-903a-d751c65b9ff9\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"987654cb-f4fa-4426-8f3f-c9fda42418e2\"\ ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1\"\r\n\ \ },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_67DTRZjyk0\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj34.blob.core.windows.net/vhds/osdisk_67DTRZjyk0.vhd\"\ + \ \"name\": \"osdisk_vJe7inxoHG\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd\"\ \r\n },\r\n \"caching\": \"ReadWrite\"\r\n },\r\n \ \ \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\"\ : \"vm-state-mod\",\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ @@ -873,50 +897,113 @@ interactions: ,\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"\ Ready\",\r\n \"message\": \"GuestAgent is running and accepting\ - \ new configurations.\",\r\n \"time\": \"2017-01-31T01:50:19+00:00\"\ + \ new configurations.\",\r\n \"time\": \"2017-02-12T05:46:14+00:00\"\ \r\n }\r\n ],\r\n \"extensionHandlers\": []\r\n \ - \ },\r\n \"disks\": [\r\n {\r\n \"name\": \"osdisk_67DTRZjyk0\"\ + \ },\r\n \"disks\": [\r\n {\r\n \"name\": \"osdisk_vJe7inxoHG\"\ ,\r\n \"statuses\": [\r\n {\r\n \"code\"\ : \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\ \n \"displayStatus\": \"Provisioning succeeded\",\r\n \ - \ \"time\": \"2017-01-31T01:49:01.3353712+00:00\"\r\n }\r\ - \n ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ - \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ - \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ - ,\r\n \"time\": \"2017-01-31T01:50:16.5864467+00:00\"\r\n \ + \ \"time\": \"2017-02-12T05:44:15.585184+00:00\"\r\n }\r\n\ + \ ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ + \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"\ + level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ + ,\r\n \"time\": \"2017-02-12T05:45:48.9983754+00:00\"\r\n \ \ },\r\n {\r\n \"code\": \"PowerState/running\",\r\n \ \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\ \n }\r\n ]\r\n }\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines\"\ - ,\r\n \"location\": \"eastus\",\r\n \"tags\": {\r\n \"secondtag\": \"\ - 2\",\r\n \"firsttag\": \"1\",\r\n \"thirdtag\": \"\"\r\n },\r\n \"\ + ,\r\n \"location\": \"eastus\",\r\n \"tags\": {\r\n \"firsttag\": \"\ + 1\",\r\n \"thirdtag\": \"\",\r\n \"secondtag\": \"2\"\r\n },\r\n \"\ id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ ,\r\n \"name\": \"vm-state-mod\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:50:43 GMT'] + Date: ['Sun, 12 Feb 2017 05:46:30 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['2658'] + content-length: ['2657'] status: {code: 200, message: OK} - request: - body: '{"properties": {"settings": {}, "protectedSettings": {"username": "foouser1", - "password": "Foo12345"}, "typeHandlerVersion": "1.4", "type": "VMAccessForLinux", - "publisher": "Microsoft.OSTCExtensions"}, "location": "eastus"}' + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [9aa900ec-f0e6-11e6-9e94-f4b7e2e85440] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?$expand=instanceView&api-version=2016-04-30-preview + response: + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"987654cb-f4fa-4426-8f3f-c9fda42418e2\"\ + ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1\"\r\n\ + \ },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ + \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ + ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ + \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ + \ \"name\": \"osdisk_vJe7inxoHG\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd\"\ + \r\n },\r\n \"caching\": \"ReadWrite\"\r\n },\r\n \ + \ \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\"\ + : \"vm-state-mod\",\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ + : {\r\n \"disablePasswordAuthentication\": false\r\n },\r\n \ + \ \"secrets\": []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\"\ + :[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic\"\ + }]},\r\n \"provisioningState\": \"Succeeded\",\r\n \"instanceView\"\ + : {\r\n \"vmAgent\": {\r\n \"vmAgentVersion\": \"WALinuxAgent-2.0.16\"\ + ,\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ + ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"\ + Ready\",\r\n \"message\": \"GuestAgent is running and accepting\ + \ new configurations.\",\r\n \"time\": \"2017-02-12T05:46:14+00:00\"\ + \r\n }\r\n ],\r\n \"extensionHandlers\": []\r\n \ + \ },\r\n \"disks\": [\r\n {\r\n \"name\": \"osdisk_vJe7inxoHG\"\ + ,\r\n \"statuses\": [\r\n {\r\n \"code\"\ + : \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\ + \n \"displayStatus\": \"Provisioning succeeded\",\r\n \ + \ \"time\": \"2017-02-12T05:44:15.585184+00:00\"\r\n }\r\n\ + \ ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ + \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"\ + level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ + ,\r\n \"time\": \"2017-02-12T05:45:48.9983754+00:00\"\r\n \ + \ },\r\n {\r\n \"code\": \"PowerState/running\",\r\n \ + \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\ + \n }\r\n ]\r\n }\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines\"\ + ,\r\n \"location\": \"eastus\",\r\n \"tags\": {\r\n \"firsttag\": \"\ + 1\",\r\n \"thirdtag\": \"\",\r\n \"secondtag\": \"2\"\r\n },\r\n \"\ + id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ + ,\r\n \"name\": \"vm-state-mod\"\r\n}"} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Sun, 12 Feb 2017 05:46:31 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['2657'] + status: {code: 200, message: OK} +- request: + body: '{"properties": {"type": "VMAccessForLinux", "publisher": "Microsoft.OSTCExtensions", + "typeHandlerVersion": "1.4", "settings": {}, "protectedSettings": {"username": + "foouser1", "password": "Foo12345"}}, "location": "eastus"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Length: ['223'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ada7165a-e757-11e6-89a8-64510658e3b3] + x-ms-client-request-id: [9ade41cc-f0e6-11e6-98e8-f4b7e2e85440] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/extensions/enablevmaccess?api-version=2016-04-30-preview response: @@ -927,16 +1014,16 @@ interactions: ,\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/extensions/enablevmaccess\"\ ,\r\n \"name\": \"enablevmaccess\"\r\n}"} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/16861409-4feb-46bd-8967-cabe6fe6ebaa?api-version=2016-04-30-preview'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/82676c56-ec04-4dda-b567-c2eba87ee971?api-version=2016-04-30-preview'] Cache-Control: [no-cache] Content-Length: ['541'] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:50:45 GMT'] + Date: ['Sun, 12 Feb 2017 05:46:33 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] status: {code: 201, message: Created} - request: body: null @@ -945,20 +1032,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ada7165a-e757-11e6-89a8-64510658e3b3] + x-ms-client-request-id: [9ade41cc-f0e6-11e6-98e8-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/16861409-4feb-46bd-8967-cabe6fe6ebaa?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/82676c56-ec04-4dda-b567-c2eba87ee971?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"startTime\": \"2017-01-31T01:50:45.1178448+00:00\",\r\ - \n \"status\": \"InProgress\",\r\n \"name\": \"16861409-4feb-46bd-8967-cabe6fe6ebaa\"\ + body: {string: "{\r\n \"startTime\": \"2017-02-12T05:46:31.6093826+00:00\",\r\ + \n \"status\": \"InProgress\",\r\n \"name\": \"82676c56-ec04-4dda-b567-c2eba87ee971\"\ \r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:51:15 GMT'] + Date: ['Sun, 12 Feb 2017 05:47:03 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -974,20 +1061,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ada7165a-e757-11e6-89a8-64510658e3b3] + x-ms-client-request-id: [9ade41cc-f0e6-11e6-98e8-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/16861409-4feb-46bd-8967-cabe6fe6ebaa?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/82676c56-ec04-4dda-b567-c2eba87ee971?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"startTime\": \"2017-01-31T01:50:45.1178448+00:00\",\r\ - \n \"status\": \"InProgress\",\r\n \"name\": \"16861409-4feb-46bd-8967-cabe6fe6ebaa\"\ + body: {string: "{\r\n \"startTime\": \"2017-02-12T05:46:31.6093826+00:00\",\r\ + \n \"status\": \"InProgress\",\r\n \"name\": \"82676c56-ec04-4dda-b567-c2eba87ee971\"\ \r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:51:46 GMT'] + Date: ['Sun, 12 Feb 2017 05:47:34 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -1003,20 +1090,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ada7165a-e757-11e6-89a8-64510658e3b3] + x-ms-client-request-id: [9ade41cc-f0e6-11e6-98e8-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/16861409-4feb-46bd-8967-cabe6fe6ebaa?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/82676c56-ec04-4dda-b567-c2eba87ee971?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"startTime\": \"2017-01-31T01:50:45.1178448+00:00\",\r\ - \n \"endTime\": \"2017-01-31T01:51:53.7611856+00:00\",\r\n \"status\": \"\ - Succeeded\",\r\n \"name\": \"16861409-4feb-46bd-8967-cabe6fe6ebaa\"\r\n}"} + body: {string: "{\r\n \"startTime\": \"2017-02-12T05:46:31.6093826+00:00\",\r\ + \n \"endTime\": \"2017-02-12T05:47:42.9996786+00:00\",\r\n \"status\": \"\ + Succeeded\",\r\n \"name\": \"82676c56-ec04-4dda-b567-c2eba87ee971\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:52:16 GMT'] + Date: ['Sun, 12 Feb 2017 05:48:05 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -1032,10 +1119,10 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ada7165a-e757-11e6-89a8-64510658e3b3] + x-ms-client-request-id: [9ade41cc-f0e6-11e6-98e8-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/extensions/enablevmaccess?api-version=2016-04-30-preview response: @@ -1048,7 +1135,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:52:17 GMT'] + Date: ['Sun, 12 Feb 2017 05:48:05 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -1064,21 +1151,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [e5e21f42-e757-11e6-8f88-64510658e3b3] + x-ms-client-request-id: [d3f2deb6-f0e6-11e6-9304-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?api-version=2016-04-30-preview&$expand=instanceView + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?$expand=instanceView&api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"c05b0fe2-cdfc-47e5-903a-d751c65b9ff9\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"987654cb-f4fa-4426-8f3f-c9fda42418e2\"\ ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1\"\r\n\ \ },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_67DTRZjyk0\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj34.blob.core.windows.net/vhds/osdisk_67DTRZjyk0.vhd\"\ + \ \"name\": \"osdisk_vJe7inxoHG\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd\"\ \r\n },\r\n \"caching\": \"ReadWrite\"\r\n },\r\n \ \ \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\"\ : \"vm-state-mod\",\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ @@ -1090,17 +1177,17 @@ interactions: ,\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"\ Ready\",\r\n \"message\": \"GuestAgent is running and accepting\ - \ new configurations.\",\r\n \"time\": \"2017-01-31T01:52:11+00:00\"\ + \ new configurations.\",\r\n \"time\": \"2017-02-12T05:48:05+00:00\"\ \r\n }\r\n ],\r\n \"extensionHandlers\": [\r\n \ \ {\r\n \"type\": \"Microsoft.OSTCExtensions.VMAccessForLinux\"\ ,\r\n \"typeHandlerVersion\": \"1.4.6.0\",\r\n \"status\"\ : {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \ \"level\": \"Info\",\r\n \"displayStatus\": \"Ready\"\ \r\n }\r\n }\r\n ]\r\n },\r\n \"disks\"\ - : [\r\n {\r\n \"name\": \"osdisk_67DTRZjyk0\",\r\n \ + : [\r\n {\r\n \"name\": \"osdisk_vJe7inxoHG\",\r\n \ \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ ,\r\n \"level\": \"Info\",\r\n \"displayStatus\"\ - : \"Provisioning succeeded\",\r\n \"time\": \"2017-01-31T01:50:45.2741093+00:00\"\ + : \"Provisioning succeeded\",\r\n \"time\": \"2017-02-12T05:46:31.7968432+00:00\"\ \r\n }\r\n ]\r\n }\r\n ],\r\n \"extensions\"\ : [\r\n {\r\n \"name\": \"enablevmaccess\",\r\n \"\ type\": \"Microsoft.OSTCExtensions.VMAccessForLinux\",\r\n \"typeHandlerVersion\"\ @@ -1111,11 +1198,11 @@ interactions: \ ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"\ level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ - ,\r\n \"time\": \"2017-01-31T01:51:53.7455752+00:00\"\r\n \ - \ },\r\n {\r\n \"code\": \"PowerState/running\",\r\n \ - \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\ - \n }\r\n ]\r\n }\r\n },\r\n \"resources\": [\r\n {\r\n\ - \ \"properties\": {\r\n \"publisher\": \"Microsoft.OSTCExtensions\"\ + ,\r\n \"time\": \"2017-02-12T05:47:42.98407+00:00\"\r\n },\r\ + \n {\r\n \"code\": \"PowerState/running\",\r\n \"\ + level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\n \ + \ }\r\n ]\r\n }\r\n },\r\n \"resources\": [\r\n {\r\n \ + \ \"properties\": {\r\n \"publisher\": \"Microsoft.OSTCExtensions\"\ ,\r\n \"type\": \"VMAccessForLinux\",\r\n \"typeHandlerVersion\"\ : \"1.4\",\r\n \"autoUpgradeMinorVersion\": false,\r\n \"settings\"\ : {},\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \ @@ -1123,35 +1210,116 @@ interactions: location\": \"eastus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/extensions/enablevmaccess\"\ ,\r\n \"name\": \"enablevmaccess\"\r\n }\r\n ],\r\n \"type\": \"\ Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n \"\ - tags\": {\r\n \"secondtag\": \"2\",\r\n \"firsttag\": \"1\",\r\n \ - \ \"thirdtag\": \"\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ + tags\": {\r\n \"firsttag\": \"1\",\r\n \"thirdtag\": \"\",\r\n \"\ + secondtag\": \"2\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ ,\r\n \"name\": \"vm-state-mod\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:52:18 GMT'] + Date: ['Sun, 12 Feb 2017 05:48:06 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['4054'] + content-length: ['4052'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [d4365952-f0e6-11e6-a7ed-f4b7e2e85440] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?$expand=instanceView&api-version=2016-04-30-preview + response: + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"987654cb-f4fa-4426-8f3f-c9fda42418e2\"\ + ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1\"\r\n\ + \ },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ + \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ + ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ + \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ + \ \"name\": \"osdisk_vJe7inxoHG\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd\"\ + \r\n },\r\n \"caching\": \"ReadWrite\"\r\n },\r\n \ + \ \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\"\ + : \"vm-state-mod\",\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ + : {\r\n \"disablePasswordAuthentication\": false\r\n },\r\n \ + \ \"secrets\": []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\"\ + :[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic\"\ + }]},\r\n \"provisioningState\": \"Succeeded\",\r\n \"instanceView\"\ + : {\r\n \"vmAgent\": {\r\n \"vmAgentVersion\": \"WALinuxAgent-2.0.16\"\ + ,\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ + ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"\ + Ready\",\r\n \"message\": \"GuestAgent is running and accepting\ + \ new configurations.\",\r\n \"time\": \"2017-02-12T05:48:05+00:00\"\ + \r\n }\r\n ],\r\n \"extensionHandlers\": [\r\n \ + \ {\r\n \"type\": \"Microsoft.OSTCExtensions.VMAccessForLinux\"\ + ,\r\n \"typeHandlerVersion\": \"1.4.6.0\",\r\n \"status\"\ + : {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ + \ \"level\": \"Info\",\r\n \"displayStatus\": \"Ready\"\ + \r\n }\r\n }\r\n ]\r\n },\r\n \"disks\"\ + : [\r\n {\r\n \"name\": \"osdisk_vJe7inxoHG\",\r\n \ + \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ + ,\r\n \"level\": \"Info\",\r\n \"displayStatus\"\ + : \"Provisioning succeeded\",\r\n \"time\": \"2017-02-12T05:46:31.7968432+00:00\"\ + \r\n }\r\n ]\r\n }\r\n ],\r\n \"extensions\"\ + : [\r\n {\r\n \"name\": \"enablevmaccess\",\r\n \"\ + type\": \"Microsoft.OSTCExtensions.VMAccessForLinux\",\r\n \"typeHandlerVersion\"\ + : \"1.4.6.0\",\r\n \"statuses\": [\r\n {\r\n \ + \ \"code\": \"ProvisioningState/succeeded\",\r\n \"level\"\ + : \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ + ,\r\n \"message\": \"Enable succeeded.\"\r\n }\r\n\ + \ ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ + \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"\ + level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ + ,\r\n \"time\": \"2017-02-12T05:47:42.98407+00:00\"\r\n },\r\ + \n {\r\n \"code\": \"PowerState/running\",\r\n \"\ + level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\n \ + \ }\r\n ]\r\n }\r\n },\r\n \"resources\": [\r\n {\r\n \ + \ \"properties\": {\r\n \"publisher\": \"Microsoft.OSTCExtensions\"\ + ,\r\n \"type\": \"VMAccessForLinux\",\r\n \"typeHandlerVersion\"\ + : \"1.4\",\r\n \"autoUpgradeMinorVersion\": false,\r\n \"settings\"\ + : {},\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \ + \ \"type\": \"Microsoft.Compute/virtualMachines/extensions\",\r\n \"\ + location\": \"eastus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/extensions/enablevmaccess\"\ + ,\r\n \"name\": \"enablevmaccess\"\r\n }\r\n ],\r\n \"type\": \"\ + Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n \"\ + tags\": {\r\n \"firsttag\": \"1\",\r\n \"thirdtag\": \"\",\r\n \"\ + secondtag\": \"2\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ + ,\r\n \"name\": \"vm-state-mod\"\r\n}"} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Sun, 12 Feb 2017 05:48:06 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['4052'] status: {code: 200, message: OK} - request: - body: '{"properties": {"settings": {}, "protectedSettings": {"remove_user": "foouser1"}, - "typeHandlerVersion": "1.4", "type": "VMAccessForLinux", "publisher": "Microsoft.OSTCExtensions"}, - "location": "eastus"}' + body: '{"properties": {"type": "VMAccessForLinux", "publisher": "Microsoft.OSTCExtensions", + "typeHandlerVersion": "1.4", "settings": {}, "protectedSettings": {"remove_user": + "foouser1"}}, "location": "eastus"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Length: ['202'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [e61a5a5e-e757-11e6-99d5-64510658e3b3] + x-ms-client-request-id: [d46b8f92-f0e6-11e6-9fbf-f4b7e2e85440] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/extensions/enablevmaccess?api-version=2016-04-30-preview response: @@ -1162,10 +1330,10 @@ interactions: ,\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/extensions/enablevmaccess\"\ ,\r\n \"name\": \"enablevmaccess\"\r\n}"} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/870a2d3e-46b7-4648-9585-bcc6e310ba5a?api-version=2016-04-30-preview'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/dff2744e-8e45-4d8a-a15a-01345258887a?api-version=2016-04-30-preview'] Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:52:18 GMT'] + Date: ['Sun, 12 Feb 2017 05:48:07 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -1173,7 +1341,7 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['541'] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 200, message: OK} - request: body: null @@ -1182,20 +1350,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [e61a5a5e-e757-11e6-99d5-64510658e3b3] + x-ms-client-request-id: [d46b8f92-f0e6-11e6-9fbf-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/870a2d3e-46b7-4648-9585-bcc6e310ba5a?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/dff2744e-8e45-4d8a-a15a-01345258887a?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"startTime\": \"2017-01-31T01:52:18.8551059+00:00\",\r\ - \n \"status\": \"InProgress\",\r\n \"name\": \"870a2d3e-46b7-4648-9585-bcc6e310ba5a\"\ + body: {string: "{\r\n \"startTime\": \"2017-02-12T05:48:06.9081253+00:00\",\r\ + \n \"status\": \"InProgress\",\r\n \"name\": \"dff2744e-8e45-4d8a-a15a-01345258887a\"\ \r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:52:49 GMT'] + Date: ['Sun, 12 Feb 2017 05:48:38 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -1211,20 +1379,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [e61a5a5e-e757-11e6-99d5-64510658e3b3] + x-ms-client-request-id: [d46b8f92-f0e6-11e6-9fbf-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/870a2d3e-46b7-4648-9585-bcc6e310ba5a?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/dff2744e-8e45-4d8a-a15a-01345258887a?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"startTime\": \"2017-01-31T01:52:18.8551059+00:00\",\r\ - \n \"endTime\": \"2017-01-31T01:53:09.2209873+00:00\",\r\n \"status\": \"\ - Succeeded\",\r\n \"name\": \"870a2d3e-46b7-4648-9585-bcc6e310ba5a\"\r\n}"} + body: {string: "{\r\n \"startTime\": \"2017-02-12T05:48:06.9081253+00:00\",\r\ + \n \"endTime\": \"2017-02-12T05:49:04.5020297+00:00\",\r\n \"status\": \"\ + Succeeded\",\r\n \"name\": \"dff2744e-8e45-4d8a-a15a-01345258887a\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:53:19 GMT'] + Date: ['Sun, 12 Feb 2017 05:49:09 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -1240,10 +1408,10 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [e61a5a5e-e757-11e6-99d5-64510658e3b3] + x-ms-client-request-id: [d46b8f92-f0e6-11e6-9fbf-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/extensions/enablevmaccess?api-version=2016-04-30-preview response: @@ -1256,7 +1424,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:53:20 GMT'] + Date: ['Sun, 12 Feb 2017 05:49:09 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -1272,22 +1440,22 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [0b480828-e758-11e6-b578-64510658e3b3] + x-ms-client-request-id: [fa5f6b68-f0e6-11e6-8fdb-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg?api-version=2016-09-01 response: body: {string: "{\r\n \"name\": \"mynsg\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg\"\ - ,\r\n \"etag\": \"W/\\\"28d54eeb-7a37-4c03-bbc9-cf3a410e8a4b\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"f840d38f-2f24-41e3-a905-418460ca43b5\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\ - : \"eastus\",\r\n \"tags\": {\r\n \"secondtag\": \"2\",\r\n \"firsttag\"\ - : \"1\",\r\n \"thirdtag\": \"\"\r\n },\r\n \"properties\": {\r\n \"\ - provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"9242b078-27f4-45f7-b283-d429f44f8da3\"\ + : \"eastus\",\r\n \"tags\": {\r\n \"firsttag\": \"1\",\r\n \"thirdtag\"\ + : \"\",\r\n \"secondtag\": \"2\"\r\n },\r\n \"properties\": {\r\n \ + \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"a3630384-b524-4b44-9778-641c0a70063b\"\ ,\r\n \"securityRules\": [\r\n {\r\n \"name\": \"default-allow-ssh\"\ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg/securityRules/default-allow-ssh\"\ - ,\r\n \"etag\": \"W/\\\"28d54eeb-7a37-4c03-bbc9-cf3a410e8a4b\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f840d38f-2f24-41e3-a905-418460ca43b5\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"protocol\": \"Tcp\",\r\n \"sourcePortRange\": \"\ *\",\r\n \"destinationPortRange\": \"22\",\r\n \"sourceAddressPrefix\"\ @@ -1296,7 +1464,7 @@ interactions: : \"Inbound\"\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\"\ : [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\"\ : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg/defaultSecurityRules/AllowVnetInBound\"\ - ,\r\n \"etag\": \"W/\\\"28d54eeb-7a37-4c03-bbc9-cf3a410e8a4b\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f840d38f-2f24-41e3-a905-418460ca43b5\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -1306,7 +1474,7 @@ interactions: \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\ \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ - ,\r\n \"etag\": \"W/\\\"28d54eeb-7a37-4c03-bbc9-cf3a410e8a4b\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f840d38f-2f24-41e3-a905-418460ca43b5\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -1315,7 +1483,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg/defaultSecurityRules/DenyAllInBound\"\ - ,\r\n \"etag\": \"W/\\\"28d54eeb-7a37-4c03-bbc9-cf3a410e8a4b\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f840d38f-2f24-41e3-a905-418460ca43b5\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -1324,7 +1492,7 @@ interactions: access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg/defaultSecurityRules/AllowVnetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"28d54eeb-7a37-4c03-bbc9-cf3a410e8a4b\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f840d38f-2f24-41e3-a905-418460ca43b5\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\ \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ @@ -1333,7 +1501,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg/defaultSecurityRules/AllowInternetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"28d54eeb-7a37-4c03-bbc9-cf3a410e8a4b\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f840d38f-2f24-41e3-a905-418460ca43b5\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -1342,7 +1510,7 @@ interactions: \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \ \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkSecurityGroups/mynsg/defaultSecurityRules/DenyAllOutBound\"\ - ,\r\n \"etag\": \"W/\\\"28d54eeb-7a37-4c03-bbc9-cf3a410e8a4b\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f840d38f-2f24-41e3-a905-418460ca43b5\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -1355,8 +1523,8 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:53:21 GMT'] - ETag: [W/"28d54eeb-7a37-4c03-bbc9-cf3a410e8a4b"] + Date: ['Sun, 12 Feb 2017 05:49:11 GMT'] + ETag: [W/"f840d38f-2f24-41e3-a905-418460ca43b5"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -1372,35 +1540,35 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [0bbd156e-e758-11e6-afb0-64510658e3b3] + x-ms-client-request-id: [fb178e74-f0e6-11e6-be24-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/publicIPAddresses/mypubip?api-version=2016-09-01 response: body: {string: "{\r\n \"name\": \"mypubip\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/publicIPAddresses/mypubip\"\ - ,\r\n \"etag\": \"W/\\\"3ed35929-892b-4a38-9250-af542a8c97e1\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"2d92028c-3228-454b-bf81-a4487d157c3d\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n \"location\": \"\ - eastus\",\r\n \"tags\": {\r\n \"secondtag\": \"2\",\r\n \"firsttag\"\ - : \"1\",\r\n \"thirdtag\": \"\"\r\n },\r\n \"properties\": {\r\n \"\ - provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"b7e37011-797b-469a-b1b9-d34ab5f33d3a\"\ - ,\r\n \"ipAddress\": \"40.71.99.3\",\r\n \"publicIPAddressVersion\"\ + eastus\",\r\n \"tags\": {\r\n \"firsttag\": \"1\",\r\n \"thirdtag\"\ + : \"\",\r\n \"secondtag\": \"2\"\r\n },\r\n \"properties\": {\r\n \ + \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"42e08a80-8dd0-4de5-9118-890ede4f1dc8\"\ + ,\r\n \"ipAddress\": \"40.121.214.78\",\r\n \"publicIPAddressVersion\"\ : \"IPv4\",\r\n \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\"\ : 4,\r\n \"ipConfiguration\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic/ipConfigurations/ipconfigvm-state-mod\"\ \r\n }\r\n }\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:53:22 GMT'] - ETag: [W/"3ed35929-892b-4a38-9250-af542a8c97e1"] + Date: ['Sun, 12 Feb 2017 05:49:12 GMT'] + ETag: [W/"2d92028c-3228-454b-bf81-a4487d157c3d"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['919'] + content-length: ['922'] status: {code: 200, message: OK} - request: body: null @@ -1409,23 +1577,23 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [0c26bf36-e758-11e6-b46b-64510658e3b3] + x-ms-client-request-id: [fba559b4-f0e6-11e6-aee4-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/virtualNetworks/myvnet?api-version=2016-09-01 response: body: {string: "{\r\n \"name\": \"myvnet\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/virtualNetworks/myvnet\"\ - ,\r\n \"etag\": \"W/\\\"4142f211-8cc9-4553-9ca0-cf512339d274\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"52d0a7ac-f50d-4791-a551-ddb52fbec08f\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"eastus\"\ - ,\r\n \"tags\": {\r\n \"secondtag\": \"2\",\r\n \"firsttag\": \"1\"\ - ,\r\n \"thirdtag\": \"\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"resourceGuid\": \"17381e96-d5c9-4a52-b26d-9caaff5a836a\"\ + ,\r\n \"tags\": {\r\n \"firsttag\": \"1\",\r\n \"thirdtag\": \"\",\r\ + \n \"secondtag\": \"2\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"resourceGuid\": \"ba2b967e-6094-4006-8130-c440c5b7e24d\"\ ,\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"\ 10.0.0.0/16\"\r\n ]\r\n },\r\n \"subnets\": [\r\n {\r\n \ \ \"name\": \"vm-state-modSubnet\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/vm-state-modSubnet\"\ - ,\r\n \"etag\": \"W/\\\"4142f211-8cc9-4553-9ca0-cf512339d274\\\"\"\ + ,\r\n \"etag\": \"W/\\\"52d0a7ac-f50d-4791-a551-ddb52fbec08f\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \"ipConfigurations\"\ : [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic/ipConfigurations/ipconfigvm-state-mod\"\ @@ -1434,8 +1602,8 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:53:23 GMT'] - ETag: [W/"4142f211-8cc9-4553-9ca0-cf512339d274"] + Date: ['Sun, 12 Feb 2017 05:49:13 GMT'] + ETag: [W/"52d0a7ac-f50d-4791-a551-ddb52fbec08f"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -1451,20 +1619,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [0ca1819c-e758-11e6-8070-64510658e3b3] + x-ms-client-request-id: [fc3f9368-f0e6-11e6-a44c-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Storage/storageAccounts/ab394fvkdj34?api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Storage/storageAccounts/ab394fvkdj39?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Storage/storageAccounts/ab394fvkdj34","kind":"Storage","location":"eastus","name":"ab394fvkdj34","properties":{"creationTime":"2017-01-31T01:48:40.0006563Z","primaryEndpoints":{"blob":"https://ab394fvkdj34.blob.core.windows.net/","file":"https://ab394fvkdj34.file.core.windows.net/","queue":"https://ab394fvkdj34.queue.core.windows.net/","table":"https://ab394fvkdj34.table.core.windows.net/"},"primaryLocation":"eastus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{"firsttag":"1","secondtag":"2","thirdtag":""},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Storage/storageAccounts/ab394fvkdj39","kind":"Storage","location":"eastus","name":"ab394fvkdj39","properties":{"creationTime":"2017-02-12T05:43:51.9016036Z","primaryEndpoints":{"blob":"https://ab394fvkdj39.blob.core.windows.net/","file":"https://ab394fvkdj39.file.core.windows.net/","queue":"https://ab394fvkdj39.queue.core.windows.net/","table":"https://ab394fvkdj39.table.core.windows.net/"},"primaryLocation":"eastus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{"firsttag":"1","secondtag":"2","thirdtag":""},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Tue, 31 Jan 2017 01:53:23 GMT'] + Date: ['Sun, 12 Feb 2017 05:49:14 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -1481,25 +1649,25 @@ interactions: Connection: [keep-alive] Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [0d196178-e758-11e6-8f81-64510658e3b3] + x-ms-client-request-id: [fce5aa3e-f0e6-11e6-b8b1-f4b7e2e85440] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/powerOff?api-version=2016-04-30-preview response: body: {string: ''} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/51777e61-5a04-448c-8f2f-f0ef96142b8b?api-version=2016-04-30-preview'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/3278ac2a-6a35-47c4-97ca-1cfe33455cfb?api-version=2016-04-30-preview'] Cache-Control: [no-cache] Content-Length: ['0'] - Date: ['Tue, 31 Jan 2017 01:53:24 GMT'] + Date: ['Sun, 12 Feb 2017 05:49:15 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/51777e61-5a04-448c-8f2f-f0ef96142b8b?monitor=true&api-version=2016-04-30-preview'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/3278ac2a-6a35-47c4-97ca-1cfe33455cfb?monitor=true&api-version=2016-04-30-preview'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 202, message: Accepted} - request: body: null @@ -1508,27 +1676,27 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [0d196178-e758-11e6-8f81-64510658e3b3] + x-ms-client-request-id: [fce5aa3e-f0e6-11e6-b8b1-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/51777e61-5a04-448c-8f2f-f0ef96142b8b?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/3278ac2a-6a35-47c4-97ca-1cfe33455cfb?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"startTime\": \"2017-01-31T01:53:24.2680711+00:00\",\r\ - \n \"endTime\": \"2017-01-31T01:53:31.3774374+00:00\",\r\n \"status\": \"\ - Succeeded\",\r\n \"name\": \"51777e61-5a04-448c-8f2f-f0ef96142b8b\"\r\n}"} + body: {string: "{\r\n \"startTime\": \"2017-02-12T05:49:14.564512+00:00\",\r\n\ + \ \"endTime\": \"2017-02-12T05:49:35.7363746+00:00\",\r\n \"status\": \"\ + Succeeded\",\r\n \"name\": \"3278ac2a-6a35-47c4-97ca-1cfe33455cfb\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:53:54 GMT'] + Date: ['Sun, 12 Feb 2017 05:49:46 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['184'] + content-length: ['183'] status: {code: 200, message: OK} - request: body: null @@ -1537,21 +1705,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [1fc594ae-e758-11e6-9407-64510658e3b3] + x-ms-client-request-id: [10526b62-f0e7-11e6-ad77-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?api-version=2016-04-30-preview&$expand=instanceView + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?$expand=instanceView&api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"c05b0fe2-cdfc-47e5-903a-d751c65b9ff9\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"987654cb-f4fa-4426-8f3f-c9fda42418e2\"\ ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1\"\r\n\ \ },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_67DTRZjyk0\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj34.blob.core.windows.net/vhds/osdisk_67DTRZjyk0.vhd\"\ + \ \"name\": \"osdisk_vJe7inxoHG\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd\"\ \r\n },\r\n \"caching\": \"ReadWrite\"\r\n },\r\n \ \ \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\"\ : \"vm-state-mod\",\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ @@ -1563,17 +1731,17 @@ interactions: ,\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"\ Ready\",\r\n \"message\": \"GuestAgent is running and accepting\ - \ new configurations.\",\r\n \"time\": \"2017-01-31T01:53:06+00:00\"\ + \ new configurations.\",\r\n \"time\": \"2017-02-12T05:49:26+00:00\"\ \r\n }\r\n ],\r\n \"extensionHandlers\": [\r\n \ \ {\r\n \"type\": \"Microsoft.OSTCExtensions.VMAccessForLinux\"\ ,\r\n \"typeHandlerVersion\": \"1.4.6.0\",\r\n \"status\"\ : {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \ \"level\": \"Info\",\r\n \"displayStatus\": \"Ready\"\ \r\n }\r\n }\r\n ]\r\n },\r\n \"disks\"\ - : [\r\n {\r\n \"name\": \"osdisk_67DTRZjyk0\",\r\n \ + : [\r\n {\r\n \"name\": \"osdisk_vJe7inxoHG\",\r\n \ \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ ,\r\n \"level\": \"Info\",\r\n \"displayStatus\"\ - : \"Provisioning succeeded\",\r\n \"time\": \"2017-01-31T01:52:18.90203+00:00\"\ + : \"Provisioning succeeded\",\r\n \"time\": \"2017-02-12T05:48:06.9549916+00:00\"\ \r\n }\r\n ]\r\n }\r\n ],\r\n \"extensions\"\ : [\r\n {\r\n \"name\": \"enablevmaccess\",\r\n \"\ type\": \"Microsoft.OSTCExtensions.VMAccessForLinux\",\r\n \"typeHandlerVersion\"\ @@ -1584,7 +1752,7 @@ interactions: \ ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"\ level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ - ,\r\n \"time\": \"2017-01-31T01:53:31.3618102+00:00\"\r\n \ + ,\r\n \"time\": \"2017-02-12T05:49:35.7207789+00:00\"\r\n \ \ },\r\n {\r\n \"code\": \"PowerState/stopped\",\r\n \ \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM stopped\"\r\ \n }\r\n ]\r\n }\r\n },\r\n \"resources\": [\r\n {\r\n\ @@ -1596,20 +1764,20 @@ interactions: location\": \"eastus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/extensions/enablevmaccess\"\ ,\r\n \"name\": \"enablevmaccess\"\r\n }\r\n ],\r\n \"type\": \"\ Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n \"\ - tags\": {\r\n \"secondtag\": \"2\",\r\n \"firsttag\": \"1\",\r\n \ - \ \"thirdtag\": \"\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ + tags\": {\r\n \"firsttag\": \"1\",\r\n \"thirdtag\": \"\",\r\n \"\ + secondtag\": \"2\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ ,\r\n \"name\": \"vm-state-mod\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:53:55 GMT'] + Date: ['Sun, 12 Feb 2017 05:49:47 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['4052'] + content-length: ['4054'] status: {code: 200, message: OK} - request: body: null @@ -1619,25 +1787,25 @@ interactions: Connection: [keep-alive] Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [20415364-e758-11e6-9e6e-64510658e3b3] + x-ms-client-request-id: [10eb7d90-f0e7-11e6-92d4-f4b7e2e85440] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/start?api-version=2016-04-30-preview response: body: {string: ''} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/631ced5c-0378-495e-8553-f41ed04a1348?api-version=2016-04-30-preview'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/ead6983b-5066-4a9b-9767-bd9926fadbcf?api-version=2016-04-30-preview'] Cache-Control: [no-cache] Content-Length: ['0'] - Date: ['Tue, 31 Jan 2017 01:53:56 GMT'] + Date: ['Sun, 12 Feb 2017 05:49:49 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/631ced5c-0378-495e-8553-f41ed04a1348?monitor=true&api-version=2016-04-30-preview'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/ead6983b-5066-4a9b-9767-bd9926fadbcf?monitor=true&api-version=2016-04-30-preview'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1195'] status: {code: 202, message: Accepted} - request: body: null @@ -1646,27 +1814,27 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [20415364-e758-11e6-9e6e-64510658e3b3] + x-ms-client-request-id: [10eb7d90-f0e7-11e6-92d4-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/631ced5c-0378-495e-8553-f41ed04a1348?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/ead6983b-5066-4a9b-9767-bd9926fadbcf?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"startTime\": \"2017-01-31T01:53:56.1276273+00:00\",\r\ - \n \"endTime\": \"2017-01-31T01:54:24.3465608+00:00\",\r\n \"status\": \"\ - Succeeded\",\r\n \"name\": \"631ced5c-0378-495e-8553-f41ed04a1348\"\r\n}"} + body: {string: "{\r\n \"startTime\": \"2017-02-12T05:49:48.1426357+00:00\",\r\ + \n \"endTime\": \"2017-02-12T05:50:16.332209+00:00\",\r\n \"status\": \"\ + Succeeded\",\r\n \"name\": \"ead6983b-5066-4a9b-9767-bd9926fadbcf\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:54:26 GMT'] + Date: ['Sun, 12 Feb 2017 05:50:19 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['184'] + content-length: ['183'] status: {code: 200, message: OK} - request: body: null @@ -1675,21 +1843,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [32ec4d86-e758-11e6-b588-64510658e3b3] + x-ms-client-request-id: [23cd025e-f0e7-11e6-9ade-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?api-version=2016-04-30-preview&$expand=instanceView + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?$expand=instanceView&api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"c05b0fe2-cdfc-47e5-903a-d751c65b9ff9\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"987654cb-f4fa-4426-8f3f-c9fda42418e2\"\ ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1\"\r\n\ \ },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_67DTRZjyk0\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj34.blob.core.windows.net/vhds/osdisk_67DTRZjyk0.vhd\"\ + \ \"name\": \"osdisk_vJe7inxoHG\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd\"\ \r\n },\r\n \"caching\": \"ReadWrite\"\r\n },\r\n \ \ \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\"\ : \"vm-state-mod\",\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ @@ -1701,17 +1869,17 @@ interactions: ,\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"\ Ready\",\r\n \"message\": \"GuestAgent is running and accepting\ - \ new configurations.\",\r\n \"time\": \"2017-01-31T01:53:06+00:00\"\ + \ new configurations.\",\r\n \"time\": \"2017-02-12T05:49:26+00:00\"\ \r\n }\r\n ],\r\n \"extensionHandlers\": [\r\n \ \ {\r\n \"type\": \"Microsoft.OSTCExtensions.VMAccessForLinux\"\ ,\r\n \"typeHandlerVersion\": \"1.4.6.0\",\r\n \"status\"\ : {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \ \"level\": \"Info\",\r\n \"displayStatus\": \"Ready\"\ \r\n }\r\n }\r\n ]\r\n },\r\n \"disks\"\ - : [\r\n {\r\n \"name\": \"osdisk_67DTRZjyk0\",\r\n \ + : [\r\n {\r\n \"name\": \"osdisk_vJe7inxoHG\",\r\n \ \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ ,\r\n \"level\": \"Info\",\r\n \"displayStatus\"\ - : \"Provisioning succeeded\",\r\n \"time\": \"2017-01-31T01:52:18.90203+00:00\"\ + : \"Provisioning succeeded\",\r\n \"time\": \"2017-02-12T05:48:06.9549916+00:00\"\ \r\n }\r\n ]\r\n }\r\n ],\r\n \"extensions\"\ : [\r\n {\r\n \"name\": \"enablevmaccess\",\r\n \"\ type\": \"Microsoft.OSTCExtensions.VMAccessForLinux\",\r\n \"typeHandlerVersion\"\ @@ -1722,7 +1890,7 @@ interactions: \ ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"\ level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ - ,\r\n \"time\": \"2017-01-31T01:54:24.3309239+00:00\"\r\n \ + ,\r\n \"time\": \"2017-02-12T05:50:16.3166082+00:00\"\r\n \ \ },\r\n {\r\n \"code\": \"PowerState/running\",\r\n \ \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\ \n }\r\n ]\r\n }\r\n },\r\n \"resources\": [\r\n {\r\n\ @@ -1734,20 +1902,20 @@ interactions: location\": \"eastus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/extensions/enablevmaccess\"\ ,\r\n \"name\": \"enablevmaccess\"\r\n }\r\n ],\r\n \"type\": \"\ Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n \"\ - tags\": {\r\n \"secondtag\": \"2\",\r\n \"firsttag\": \"1\",\r\n \ - \ \"thirdtag\": \"\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ + tags\": {\r\n \"firsttag\": \"1\",\r\n \"thirdtag\": \"\",\r\n \"\ + secondtag\": \"2\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ ,\r\n \"name\": \"vm-state-mod\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:54:27 GMT'] + Date: ['Sun, 12 Feb 2017 05:50:21 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['4052'] + content-length: ['4054'] status: {code: 200, message: OK} - request: body: null @@ -1757,25 +1925,25 @@ interactions: Connection: [keep-alive] Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [3368d5a4-e758-11e6-a23a-64510658e3b3] + x-ms-client-request-id: [245ac4d4-f0e7-11e6-8ba2-f4b7e2e85440] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/restart?api-version=2016-04-30-preview response: body: {string: ''} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/d45ced79-e80d-41b6-b878-d2d50f589784?api-version=2016-04-30-preview'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/b6f1231e-54c9-4bf2-8f06-1b67ac36ac96?api-version=2016-04-30-preview'] Cache-Control: [no-cache] Content-Length: ['0'] - Date: ['Tue, 31 Jan 2017 01:54:28 GMT'] + Date: ['Sun, 12 Feb 2017 05:50:22 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/d45ced79-e80d-41b6-b878-d2d50f589784?monitor=true&api-version=2016-04-30-preview'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/b6f1231e-54c9-4bf2-8f06-1b67ac36ac96?monitor=true&api-version=2016-04-30-preview'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1194'] status: {code: 202, message: Accepted} - request: body: null @@ -1784,27 +1952,27 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [3368d5a4-e758-11e6-a23a-64510658e3b3] + x-ms-client-request-id: [245ac4d4-f0e7-11e6-8ba2-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/d45ced79-e80d-41b6-b878-d2d50f589784?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/b6f1231e-54c9-4bf2-8f06-1b67ac36ac96?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"startTime\": \"2017-01-31T01:54:28.5341193+00:00\",\r\ - \n \"endTime\": \"2017-01-31T01:54:28.674706+00:00\",\r\n \"status\": \"\ - Succeeded\",\r\n \"name\": \"d45ced79-e80d-41b6-b878-d2d50f589784\"\r\n}"} + body: {string: "{\r\n \"startTime\": \"2017-02-12T05:50:20.7697427+00:00\",\r\ + \n \"endTime\": \"2017-02-12T05:50:20.9259994+00:00\",\r\n \"status\": \"\ + Succeeded\",\r\n \"name\": \"b6f1231e-54c9-4bf2-8f06-1b67ac36ac96\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:54:59 GMT'] + Date: ['Sun, 12 Feb 2017 05:50:52 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['183'] + content-length: ['184'] status: {code: 200, message: OK} - request: body: null @@ -1813,21 +1981,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [4623b454-e758-11e6-bf56-64510658e3b3] + x-ms-client-request-id: [3738741e-f0e7-11e6-9cc5-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?api-version=2016-04-30-preview&$expand=instanceView + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?$expand=instanceView&api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"c05b0fe2-cdfc-47e5-903a-d751c65b9ff9\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"987654cb-f4fa-4426-8f3f-c9fda42418e2\"\ ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1\"\r\n\ \ },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_67DTRZjyk0\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj34.blob.core.windows.net/vhds/osdisk_67DTRZjyk0.vhd\"\ + \ \"name\": \"osdisk_vJe7inxoHG\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd\"\ \r\n },\r\n \"caching\": \"ReadWrite\"\r\n },\r\n \ \ \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\"\ : \"vm-state-mod\",\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ @@ -1839,17 +2007,17 @@ interactions: ,\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"\ Ready\",\r\n \"message\": \"GuestAgent is running and accepting\ - \ new configurations.\",\r\n \"time\": \"2017-01-31T01:53:06+00:00\"\ + \ new configurations.\",\r\n \"time\": \"2017-02-12T05:49:26+00:00\"\ \r\n }\r\n ],\r\n \"extensionHandlers\": [\r\n \ \ {\r\n \"type\": \"Microsoft.OSTCExtensions.VMAccessForLinux\"\ ,\r\n \"typeHandlerVersion\": \"1.4.6.0\",\r\n \"status\"\ : {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \ \"level\": \"Info\",\r\n \"displayStatus\": \"Ready\"\ \r\n }\r\n }\r\n ]\r\n },\r\n \"disks\"\ - : [\r\n {\r\n \"name\": \"osdisk_67DTRZjyk0\",\r\n \ + : [\r\n {\r\n \"name\": \"osdisk_vJe7inxoHG\",\r\n \ \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ ,\r\n \"level\": \"Info\",\r\n \"displayStatus\"\ - : \"Provisioning succeeded\",\r\n \"time\": \"2017-01-31T01:52:18.90203+00:00\"\ + : \"Provisioning succeeded\",\r\n \"time\": \"2017-02-12T05:48:06.9549916+00:00\"\ \r\n }\r\n ]\r\n }\r\n ],\r\n \"extensions\"\ : [\r\n {\r\n \"name\": \"enablevmaccess\",\r\n \"\ type\": \"Microsoft.OSTCExtensions.VMAccessForLinux\",\r\n \"typeHandlerVersion\"\ @@ -1860,7 +2028,7 @@ interactions: \ ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"\ level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ - ,\r\n \"time\": \"2017-01-31T01:54:28.6590578+00:00\"\r\n \ + ,\r\n \"time\": \"2017-02-12T05:50:20.9103557+00:00\"\r\n \ \ },\r\n {\r\n \"code\": \"PowerState/running\",\r\n \ \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\ \n }\r\n ]\r\n }\r\n },\r\n \"resources\": [\r\n {\r\n\ @@ -1872,20 +2040,20 @@ interactions: location\": \"eastus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/extensions/enablevmaccess\"\ ,\r\n \"name\": \"enablevmaccess\"\r\n }\r\n ],\r\n \"type\": \"\ Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n \"\ - tags\": {\r\n \"secondtag\": \"2\",\r\n \"firsttag\": \"1\",\r\n \ - \ \"thirdtag\": \"\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ + tags\": {\r\n \"firsttag\": \"1\",\r\n \"thirdtag\": \"\",\r\n \"\ + secondtag\": \"2\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ ,\r\n \"name\": \"vm-state-mod\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:54:59 GMT'] + Date: ['Sun, 12 Feb 2017 05:50:53 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['4052'] + content-length: ['4054'] status: {code: 200, message: OK} - request: body: null @@ -1895,25 +2063,25 @@ interactions: Connection: [keep-alive] Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [46a23488-e758-11e6-a317-64510658e3b3] + x-ms-client-request-id: [37ce7000-f0e7-11e6-a701-f4b7e2e85440] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/deallocate?api-version=2016-04-30-preview response: body: {string: ''} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/017a81b6-7a63-4ccc-92fa-19681fb2f8da?api-version=2016-04-30-preview'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/8ab02d35-1e86-4bbf-9033-742c7ed3d158?api-version=2016-04-30-preview'] Cache-Control: [no-cache] Content-Length: ['0'] - Date: ['Tue, 31 Jan 2017 01:55:00 GMT'] + Date: ['Sun, 12 Feb 2017 05:50:54 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/017a81b6-7a63-4ccc-92fa-19681fb2f8da?monitor=true&api-version=2016-04-30-preview'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/8ab02d35-1e86-4bbf-9033-742c7ed3d158?monitor=true&api-version=2016-04-30-preview'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1193'] status: {code: 202, message: Accepted} - request: body: null @@ -1922,20 +2090,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [46a23488-e758-11e6-a317-64510658e3b3] + x-ms-client-request-id: [37ce7000-f0e7-11e6-a701-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/017a81b6-7a63-4ccc-92fa-19681fb2f8da?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8ab02d35-1e86-4bbf-9033-742c7ed3d158?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"startTime\": \"2017-01-31T01:55:00.7530654+00:00\",\r\ - \n \"status\": \"InProgress\",\r\n \"name\": \"017a81b6-7a63-4ccc-92fa-19681fb2f8da\"\ + body: {string: "{\r\n \"startTime\": \"2017-02-12T05:50:53.4414801+00:00\",\r\ + \n \"status\": \"InProgress\",\r\n \"name\": \"8ab02d35-1e86-4bbf-9033-742c7ed3d158\"\ \r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:55:31 GMT'] + Date: ['Sun, 12 Feb 2017 05:51:25 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -1951,49 +2119,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [46a23488-e758-11e6-a317-64510658e3b3] + x-ms-client-request-id: [37ce7000-f0e7-11e6-a701-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/017a81b6-7a63-4ccc-92fa-19681fb2f8da?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8ab02d35-1e86-4bbf-9033-742c7ed3d158?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"startTime\": \"2017-01-31T01:55:00.7530654+00:00\",\r\ - \n \"status\": \"InProgress\",\r\n \"name\": \"017a81b6-7a63-4ccc-92fa-19681fb2f8da\"\ - \r\n}"} + body: {string: "{\r\n \"startTime\": \"2017-02-12T05:50:53.4414801+00:00\",\r\ + \n \"endTime\": \"2017-02-12T05:51:54.1306338+00:00\",\r\n \"status\": \"\ + Succeeded\",\r\n \"name\": \"8ab02d35-1e86-4bbf-9033-742c7ed3d158\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:56:01 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['134'] - status: {code: 200, message: OK} -- request: - body: null - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] - accept-language: [en-US] - x-ms-client-request-id: [46a23488-e758-11e6-a317-64510658e3b3] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/017a81b6-7a63-4ccc-92fa-19681fb2f8da?api-version=2016-04-30-preview - response: - body: {string: "{\r\n \"startTime\": \"2017-01-31T01:55:00.7530654+00:00\",\r\ - \n \"endTime\": \"2017-01-31T01:56:21.3629272+00:00\",\r\n \"status\": \"\ - Succeeded\",\r\n \"name\": \"017a81b6-7a63-4ccc-92fa-19681fb2f8da\"\r\n}"} - headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:56:32 GMT'] + Date: ['Sun, 12 Feb 2017 05:51:55 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -2009,21 +2148,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [7db41e0a-e758-11e6-a805-64510658e3b3] + x-ms-client-request-id: [5d2a0590-f0e7-11e6-b251-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?api-version=2016-04-30-preview&$expand=instanceView + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?$expand=instanceView&api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"c05b0fe2-cdfc-47e5-903a-d751c65b9ff9\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"987654cb-f4fa-4426-8f3f-c9fda42418e2\"\ ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1\"\r\n\ \ },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_67DTRZjyk0\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj34.blob.core.windows.net/vhds/osdisk_67DTRZjyk0.vhd\"\ + \ \"name\": \"osdisk_vJe7inxoHG\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd\"\ \r\n },\r\n \"caching\": \"ReadWrite\"\r\n },\r\n \ \ \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\"\ : \"vm-state-mod\",\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ @@ -2035,17 +2174,17 @@ interactions: ,\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"\ Ready\",\r\n \"message\": \"GuestAgent is running and accepting\ - \ new configurations.\",\r\n \"time\": \"2017-01-31T01:53:06+00:00\"\ + \ new configurations.\",\r\n \"time\": \"2017-02-12T05:49:26+00:00\"\ \r\n }\r\n ],\r\n \"extensionHandlers\": [\r\n \ \ {\r\n \"type\": \"Microsoft.OSTCExtensions.VMAccessForLinux\"\ ,\r\n \"typeHandlerVersion\": \"1.4.6.0\",\r\n \"status\"\ : {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \ \"level\": \"Info\",\r\n \"displayStatus\": \"Ready\"\ \r\n }\r\n }\r\n ]\r\n },\r\n \"disks\"\ - : [\r\n {\r\n \"name\": \"osdisk_67DTRZjyk0\",\r\n \ + : [\r\n {\r\n \"name\": \"osdisk_vJe7inxoHG\",\r\n \ \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ ,\r\n \"level\": \"Info\",\r\n \"displayStatus\"\ - : \"Provisioning succeeded\",\r\n \"time\": \"2017-01-31T01:56:21.3316848+00:00\"\ + : \"Provisioning succeeded\",\r\n \"time\": \"2017-02-12T05:51:54.1150027+00:00\"\ \r\n }\r\n ]\r\n }\r\n ],\r\n \"extensions\"\ : [\r\n {\r\n \"name\": \"enablevmaccess\",\r\n \"\ type\": \"Microsoft.OSTCExtensions.VMAccessForLinux\",\r\n \"typeHandlerVersion\"\ @@ -2056,9 +2195,9 @@ interactions: \ ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"\ level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ - ,\r\n \"time\": \"2017-01-31T01:56:21.347299+00:00\"\r\n },\r\ - \n {\r\n \"code\": \"PowerState/deallocated\",\r\n \ - \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM deallocated\"\ + ,\r\n \"time\": \"2017-02-12T05:51:54.1150027+00:00\"\r\n \ + \ },\r\n {\r\n \"code\": \"PowerState/deallocated\",\r\n \ + \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM deallocated\"\ \r\n }\r\n ]\r\n }\r\n },\r\n \"resources\": [\r\n {\r\ \n \"properties\": {\r\n \"publisher\": \"Microsoft.OSTCExtensions\"\ ,\r\n \"type\": \"VMAccessForLinux\",\r\n \"typeHandlerVersion\"\ @@ -2068,20 +2207,20 @@ interactions: location\": \"eastus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/extensions/enablevmaccess\"\ ,\r\n \"name\": \"enablevmaccess\"\r\n }\r\n ],\r\n \"type\": \"\ Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n \"\ - tags\": {\r\n \"secondtag\": \"2\",\r\n \"firsttag\": \"1\",\r\n \ - \ \"thirdtag\": \"\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ + tags\": {\r\n \"firsttag\": \"1\",\r\n \"thirdtag\": \"\",\r\n \"\ + secondtag\": \"2\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ ,\r\n \"name\": \"vm-state-mod\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:56:32 GMT'] + Date: ['Sun, 12 Feb 2017 05:51:57 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['4061'] + content-length: ['4062'] status: {code: 200, message: OK} - request: body: null @@ -2090,21 +2229,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [7e3ed706-e758-11e6-ab70-64510658e3b3] + x-ms-client-request-id: [5dbb5350-f0e7-11e6-8f1e-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"c05b0fe2-cdfc-47e5-903a-d751c65b9ff9\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"987654cb-f4fa-4426-8f3f-c9fda42418e2\"\ ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1\"\r\n\ \ },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_67DTRZjyk0\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj34.blob.core.windows.net/vhds/osdisk_67DTRZjyk0.vhd\"\ + \ \"name\": \"osdisk_vJe7inxoHG\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd\"\ \r\n },\r\n \"caching\": \"ReadWrite\"\r\n },\r\n \ \ \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\"\ : \"vm-state-mod\",\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ @@ -2120,13 +2259,13 @@ interactions: location\": \"eastus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/extensions/enablevmaccess\"\ ,\r\n \"name\": \"enablevmaccess\"\r\n }\r\n ],\r\n \"type\": \"\ Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n \"\ - tags\": {\r\n \"secondtag\": \"2\",\r\n \"firsttag\": \"1\",\r\n \ - \ \"thirdtag\": \"\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ + tags\": {\r\n \"firsttag\": \"1\",\r\n \"thirdtag\": \"\",\r\n \"\ + secondtag\": \"2\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ ,\r\n \"name\": \"vm-state-mod\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:56:34 GMT'] + Date: ['Sun, 12 Feb 2017 05:51:57 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -2136,35 +2275,36 @@ interactions: content-length: ['2091'] status: {code: 200, message: OK} - request: - body: '{"properties": {"storageProfile": {"dataDisks": [], "osDisk": {"createOption": - "fromImage", "caching": "ReadWrite", "osType": "Linux", "vhd": {"uri": "https://ab394fvkdj34.blob.core.windows.net/vhds/osdisk_67DTRZjyk0.vhd"}, - "name": "osdisk_67DTRZjyk0"}, "imageReference": {"sku": "14.04.4-LTS", "publisher": - "Canonical", "offer": "UbuntuServer", "version": "latest"}}, "hardwareProfile": - {"vmSize": "Standard_A4"}, "networkProfile": {"networkInterfaces": [{"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic"}]}, - "osProfile": {"adminUsername": "ubuntu", "computerName": "vm-state-mod", "secrets": - [], "linuxConfiguration": {"disablePasswordAuthentication": false}}}, "tags": - {"secondtag": "2", "firsttag": "1", "thirdtag": ""}, "location": "eastus"}' + body: '{"tags": {"firsttag": "1", "thirdtag": "", "secondtag": "2"}, "properties": + {"osProfile": {"computerName": "vm-state-mod", "adminUsername": "ubuntu", "linuxConfiguration": + {"disablePasswordAuthentication": false}, "secrets": []}, "storageProfile": + {"dataDisks": [], "imageReference": {"offer": "UbuntuServer", "sku": "14.04.4-LTS", + "publisher": "Canonical", "version": "latest"}, "osDisk": {"createOption": "fromImage", + "caching": "ReadWrite", "osType": "Linux", "name": "osdisk_vJe7inxoHG", "vhd": + {"uri": "https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd"}}}, + "networkProfile": {"networkInterfaces": [{"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Network/networkInterfaces/vm-state-modVMNic"}]}, + "hardwareProfile": {"vmSize": "Standard_A4"}}, "location": "eastus"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Length: ['864'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [7e8283da-e758-11e6-85ab-64510658e3b3] + x-ms-client-request-id: [5df11468-f0e7-11e6-8a51-f4b7e2e85440] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"c05b0fe2-cdfc-47e5-903a-d751c65b9ff9\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"987654cb-f4fa-4426-8f3f-c9fda42418e2\"\ ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_A4\"\r\n \ \ },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_67DTRZjyk0\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj34.blob.core.windows.net/vhds/osdisk_67DTRZjyk0.vhd\"\ + \ \"name\": \"osdisk_vJe7inxoHG\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd\"\ \r\n },\r\n \"caching\": \"ReadWrite\"\r\n },\r\n \ \ \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\"\ : \"vm-state-mod\",\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ @@ -2180,14 +2320,14 @@ interactions: location\": \"eastus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/extensions/enablevmaccess\"\ ,\r\n \"name\": \"enablevmaccess\"\r\n }\r\n ],\r\n \"type\": \"\ Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n \"\ - tags\": {\r\n \"secondtag\": \"2\",\r\n \"firsttag\": \"1\",\r\n \ - \ \"thirdtag\": \"\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ + tags\": {\r\n \"firsttag\": \"1\",\r\n \"thirdtag\": \"\",\r\n \"\ + secondtag\": \"2\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ ,\r\n \"name\": \"vm-state-mod\"\r\n}"} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/f8cc0c65-495e-4e14-bca1-ed8361052504?api-version=2016-04-30-preview'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/9e9da7f3-8cb4-4e5f-8a00-a1beceaf3f70?api-version=2016-04-30-preview'] Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:56:35 GMT'] + Date: ['Sun, 12 Feb 2017 05:52:00 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -2195,7 +2335,7 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['2089'] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1192'] status: {code: 200, message: OK} - request: body: null @@ -2204,20 +2344,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [7e8283da-e758-11e6-85ab-64510658e3b3] + x-ms-client-request-id: [5df11468-f0e7-11e6-8a51-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/f8cc0c65-495e-4e14-bca1-ed8361052504?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/9e9da7f3-8cb4-4e5f-8a00-a1beceaf3f70?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"startTime\": \"2017-01-31T01:56:35.1442898+00:00\",\r\ - \n \"endTime\": \"2017-01-31T01:56:37.4567701+00:00\",\r\n \"status\": \"\ - Succeeded\",\r\n \"name\": \"f8cc0c65-495e-4e14-bca1-ed8361052504\"\r\n}"} + body: {string: "{\r\n \"startTime\": \"2017-02-12T05:51:58.0680938+00:00\",\r\ + \n \"endTime\": \"2017-02-12T05:52:01.8649535+00:00\",\r\n \"status\": \"\ + Succeeded\",\r\n \"name\": \"9e9da7f3-8cb4-4e5f-8a00-a1beceaf3f70\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:57:05 GMT'] + Date: ['Sun, 12 Feb 2017 05:52:31 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -2233,21 +2373,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [7e8283da-e758-11e6-85ab-64510658e3b3] + x-ms-client-request-id: [5df11468-f0e7-11e6-8a51-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"c05b0fe2-cdfc-47e5-903a-d751c65b9ff9\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"987654cb-f4fa-4426-8f3f-c9fda42418e2\"\ ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_A4\"\r\n \ \ },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_67DTRZjyk0\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj34.blob.core.windows.net/vhds/osdisk_67DTRZjyk0.vhd\"\ + \ \"name\": \"osdisk_vJe7inxoHG\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"vhd\": {\r\n \"uri\": \"https://ab394fvkdj39.blob.core.windows.net/vhds/osdisk_vJe7inxoHG.vhd\"\ \r\n },\r\n \"caching\": \"ReadWrite\"\r\n },\r\n \ \ \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\"\ : \"vm-state-mod\",\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ @@ -2263,13 +2403,13 @@ interactions: location\": \"eastus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod/extensions/enablevmaccess\"\ ,\r\n \"name\": \"enablevmaccess\"\r\n }\r\n ],\r\n \"type\": \"\ Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n \"\ - tags\": {\r\n \"secondtag\": \"2\",\r\n \"firsttag\": \"1\",\r\n \ - \ \"thirdtag\": \"\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ + tags\": {\r\n \"firsttag\": \"1\",\r\n \"thirdtag\": \"\",\r\n \"\ + secondtag\": \"2\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod\"\ ,\r\n \"name\": \"vm-state-mod\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:57:06 GMT'] + Date: ['Sun, 12 Feb 2017 05:52:31 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -2286,25 +2426,25 @@ interactions: Connection: [keep-alive] Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [925f7b6c-e758-11e6-a93b-64510658e3b3] + x-ms-client-request-id: [7200f51e-f0e7-11e6-baeb-f4b7e2e85440] method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines/vm-state-mod?api-version=2016-04-30-preview response: body: {string: ''} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/272cdb62-8809-4e73-8c09-d2f9ab08481f?api-version=2016-04-30-preview'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/605826a3-1a1f-4bd6-b17a-9e0b5b6e0c10?api-version=2016-04-30-preview'] Cache-Control: [no-cache] Content-Length: ['0'] - Date: ['Tue, 31 Jan 2017 01:57:07 GMT'] + Date: ['Sun, 12 Feb 2017 05:52:32 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/272cdb62-8809-4e73-8c09-d2f9ab08481f?monitor=true&api-version=2016-04-30-preview'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/eastus/operations/605826a3-1a1f-4bd6-b17a-9e0b5b6e0c10?monitor=true&api-version=2016-04-30-preview'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 202, message: Accepted} - request: body: null @@ -2313,20 +2453,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [925f7b6c-e758-11e6-a93b-64510658e3b3] + x-ms-client-request-id: [7200f51e-f0e7-11e6-baeb-f4b7e2e85440] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/272cdb62-8809-4e73-8c09-d2f9ab08481f?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/605826a3-1a1f-4bd6-b17a-9e0b5b6e0c10?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"startTime\": \"2017-01-31T01:57:07.9729421+00:00\",\r\ - \n \"endTime\": \"2017-01-31T01:57:18.2855126+00:00\",\r\n \"status\": \"\ - Succeeded\",\r\n \"name\": \"272cdb62-8809-4e73-8c09-d2f9ab08481f\"\r\n}"} + body: {string: "{\r\n \"startTime\": \"2017-02-12T05:52:31.2086772+00:00\",\r\ + \n \"endTime\": \"2017-02-12T05:52:41.7242553+00:00\",\r\n \"status\": \"\ + Succeeded\",\r\n \"name\": \"605826a3-1a1f-4bd6-b17a-9e0b5b6e0c10\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:57:38 GMT'] + Date: ['Sun, 12 Feb 2017 05:53:02 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -2342,10 +2482,10 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 - computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b2+dev] + User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 + computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a5aced64-e758-11e6-af68-64510658e3b3] + x-ms-client-request-id: [85784e10-f0e7-11e6-93fe-f4b7e2e85440] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod/providers/Microsoft.Compute/virtualMachines?api-version=2016-04-30-preview response: @@ -2353,7 +2493,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 31 Jan 2017 01:57:39 GMT'] + Date: ['Sun, 12 Feb 2017 05:53:05 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py index ed05c1fcb..69e4aa2dc 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py @@ -386,7 +386,7 @@ class VMCreateAndStateModificationsScenarioTest(ResourceGroupVCRTestBase): # py self.vm_name = 'vm-state-mod' self.nsg_name = 'mynsg' self.ip_name = 'mypubip' - self.storage_name = 'ab394fvkdj34' + self.storage_name = 'ab394fvkdj39' self.vnet_name = 'myvnet' def test_vm_create_state_modifications(self): @@ -432,8 +432,8 @@ class VMCreateAndStateModificationsScenarioTest(ResourceGroupVCRTestBase): # py ]) self._check_vm_power_state('PowerState/running') - self.cmd('vm access set-linux-user -g {} -n {} -u foouser1 -p Foo12345 '.format(self.resource_group, self.vm_name)) - self.cmd('vm access delete-linux-user -g {} -n {} -u foouser1'.format(self.resource_group, self.vm_name)) + self.cmd('vm user update -g {} -n {} -u foouser1 -p Foo12345 '.format(self.resource_group, self.vm_name)) + self.cmd('vm user delete -g {} -n {} -u foouser1'.format(self.resource_group, self.vm_name)) self.cmd('network nsg show --resource-group {} --name {}'.format( self.resource_group, self.nsg_name), checks=[
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": -1, "issue_text_score": 0, "test_score": -1 }, "num_modified_files": 4 }
0.1
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc libssl-dev libffi-dev" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==1.2.7 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==1.4.9 attrs==22.2.0 autopep8==1.2.4 azure-batch==1.1.0 -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_documentdb&subdirectory=src/command_modules/azure-cli-documentdb -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@27816f4891c85592ad6f06bcc94008fa7d144b69#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.4 azure-core==1.24.2 azure-graphrbac==0.30.0rc6 azure-keyvault==0.1.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==2.0.0 azure-mgmt-compute==0.33.0 azure-mgmt-containerregistry==0.1.1 azure-mgmt-dns==0.30.0rc6 azure-mgmt-documentdb==0.1.0 azure-mgmt-iothub==0.2.1 azure-mgmt-keyvault==0.30.0 azure-mgmt-network==0.30.0 azure-mgmt-nspkg==3.0.2 azure-mgmt-redis==1.0.0 azure-mgmt-resource==0.30.2 azure-mgmt-sql==0.2.0 azure-mgmt-storage==0.31.0 azure-mgmt-trafficmanager==0.30.0rc6 azure-mgmt-web==0.30.1 azure-nspkg==3.0.2 azure-storage==0.33.0 certifi==2021.5.30 cffi==1.15.1 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.7.1 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.5.4 pyOpenSSL==16.1.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 PyYAML==3.11 requests==2.9.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.5 tomli==1.2.3 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 wrapt==1.16.0 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==1.2.7 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==1.4.9 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==1.1.0 - azure-common==1.1.4 - azure-core==1.24.2 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.1.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==2.0.0 - azure-mgmt-compute==0.33.0 - azure-mgmt-containerregistry==0.1.1 - azure-mgmt-dns==0.30.0rc6 - azure-mgmt-documentdb==0.1.0 - azure-mgmt-iothub==0.2.1 - azure-mgmt-keyvault==0.30.0 - azure-mgmt-network==0.30.0 - azure-mgmt-nspkg==3.0.2 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==0.30.2 - azure-mgmt-sql==0.2.0 - azure-mgmt-storage==0.31.0 - azure-mgmt-trafficmanager==0.30.0rc6 - azure-mgmt-web==0.30.1 - azure-nspkg==3.0.2 - azure-storage==0.33.0 - cffi==1.15.1 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.7.1 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.5.4 - pyopenssl==16.1.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pyyaml==3.11 - requests==2.9.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.5 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - wrapt==1.16.0 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMCreateAndStateModificationsScenarioTest::test_vm_create_state_modifications" ]
[ "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMAvailSetScenarioTest::test_vm_availset" ]
[ "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMImageListByAliasesScenarioTest::test_vm_image_list_by_alias", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMUsageScenarioTest::test_vm_usage", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMImageListThruServiceScenarioTest::test_vm_images_list_thru_services", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMOpenPortTest::test_vm_open_port", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMShowListSizesListIPAddressesScenarioTest::test_vm_show_list_sizes_list_ip_addresses", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMSizeListScenarioTest::test_vm_size_list", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMImageListOffersScenarioTest::test_vm_image_list_offers", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMImageListPublishersScenarioTest::test_vm_image_list_publishers", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMImageListSkusScenarioTest::test_vm_image_list_skus", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMImageShowScenarioTest::test_vm_image_show", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMGeneralizeScenarioTest::test_vm_generalize", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMCreateFromUnmanagedDiskTest::test_create_vm_from_unmanaged_disk", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMManagedDiskScenarioTest::test_managed_disk", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMNoWaitScenarioTest::test_vm_create_no_wait", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMExtensionScenarioTest::test_vm_extension", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMMachineExtensionImageScenarioTest::test_vm_machine_extension_image", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMExtensionImageSearchScenarioTest::test_vm_extension_image_search", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMCreateUbuntuScenarioTest::test_vm_create_ubuntu", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMMultiNicScenarioTest::test_vm_create_multi_nics", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMCreateNoneOptionsTest::test_vm_create_none_options", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMBootDiagnostics::test_vm_boot_diagnostics", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMSSExtensionInstallTest::test_vmss_extension", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::DiagnosticsExtensionInstallTest::test_diagnostics_extension_install", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMCreateExistingOptions::test_vm_create_existing_options", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMCreateCustomIP::test_vm_create_custom_ip", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMUnmanagedDataDiskTest::test_vm_data_unmanaged_disk", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMCreateCustomDataScenarioTest::test_vm_create_custom_data", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::AzureContainerServiceScenarioTest::test_acs_create_update", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMSSCreateAndModify::test_vmss_create_and_modify", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMSSCreateOptions::test_vmss_create_options", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMSSCreateNoneOptionsTest::test_vmss_create_none_options", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMSSCreateExistingOptions::test_vmss_create_existing_options", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMSSVMsScenarioTest::test_vmss_vms", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMSSCustomDataScenarioTest::test_vmss_create_custom_data", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/test_vm_commands.py::VMSSNicScenarioTest::test_vmss_nics" ]
[]
MIT License
1,017
[ "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_help.py", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_params.py", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/commands.py", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py" ]
[ "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_help.py", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_params.py", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/commands.py", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py" ]
rabitt__pysox-41
45ae6164cd5da402e063d7d5487b3ebaf895dd4d
2017-02-13 18:42:33
8a6748d32b6917d5ef920895fbfc734dda21f294
diff --git a/sox/transform.py b/sox/transform.py index af48b40..54e1ccd 100644 --- a/sox/transform.py +++ b/sox/transform.py @@ -234,7 +234,7 @@ class Transformer(object): input_format.extend(['-t', '{}'.format(file_type)]) if rate is not None: - input_format.extend(['-r', '{}'.format(rate)]) + input_format.extend(['-r', '{:f}'.format(rate)]) if bits is not None: input_format.extend(['-b', '{}'.format(bits)]) @@ -358,7 +358,7 @@ class Transformer(object): output_format.extend(['-t', '{}'.format(file_type)]) if rate is not None: - output_format.extend(['-r', '{}'.format(rate)]) + output_format.extend(['-r', '{:f}'.format(rate)]) if bits is not None: output_format.extend(['-b', '{}'.format(bits)]) @@ -458,7 +458,7 @@ class Transformer(object): raise ValueError("width_q must be a positive number.") effect_args = [ - 'allpass', '{}'.format(frequency), '{}q'.format(width_q) + 'allpass', '{:f}'.format(frequency), '{:f}q'.format(width_q) ] self.effects.extend(effect_args) @@ -500,7 +500,7 @@ class Transformer(object): if constant_skirt: effect_args.append('-c') - effect_args.extend(['{}'.format(frequency), '{}q'.format(width_q)]) + effect_args.extend(['{:f}'.format(frequency), '{:f}q'.format(width_q)]) self.effects.extend(effect_args) self.effects_log.append('bandpass') @@ -534,7 +534,7 @@ class Transformer(object): raise ValueError("width_q must be a positive number.") effect_args = [ - 'bandreject', '{}'.format(frequency), '{}q'.format(width_q) + 'bandreject', '{:f}'.format(frequency), '{:f}q'.format(width_q) ] self.effects.extend(effect_args) @@ -575,8 +575,8 @@ class Transformer(object): raise ValueError("width_q must be a positive number.") effect_args = [ - 'bass', '{}'.format(gain_db), '{}'.format(frequency), - '{}s'.format(slope) + 'bass', '{:f}'.format(gain_db), '{:f}'.format(frequency), + '{:f}s'.format(slope) ] self.effects.extend(effect_args) @@ -669,7 +669,7 @@ class Transformer(object): t_start = round(start_times[i] - last, 2) t_end = round(end_times[i] - start_times[i], 2) effect_args.append( - '{},{},{}'.format(t_start, cents[i], t_end) + '{:f},{:f},{:f}'.format(t_start, cents[i], t_end) ) last = end_times[i] @@ -677,7 +677,6 @@ class Transformer(object): self.effects_log.append('bend') return self - def biquad(self, b, a): '''Apply a biquad IIR filter with the given coefficients. @@ -712,8 +711,9 @@ class Transformer(object): raise ValueError('all elements of a must be numbers.') effect_args = [ - 'biquad', '{}'.format(b[0]), '{}'.format(b[1]), '{}'.format(b[2]), - '{}'.format(a[0]), '{}'.format(a[1]), '{}'.format(a[2]) + 'biquad', '{:f}'.format(b[0]), '{:f}'.format(b[1]), + '{:f}'.format(b[2]), '{:f}'.format(a[0]), + '{:f}'.format(a[1]), '{:f}'.format(a[2]) ] self.effects.extend(effect_args) @@ -860,10 +860,10 @@ class Transformer(object): for i in range(n_voices): effect_args.extend([ - '{}'.format(delays[i]), - '{}'.format(decays[i]), - '{}'.format(speeds[i]), - '{}'.format(depths[i]), + '{:f}'.format(delays[i]), + '{:f}'.format(decays[i]), + '{:f}'.format(speeds[i]), + '{:f}'.format(depths[i]), '-{}'.format(shapes[i]) ]) @@ -935,17 +935,17 @@ class Transformer(object): transfer_list = [] for point in tf_points: transfer_list.extend([ - "{}".format(point[0]), "{}".format(point[1]) + "{:f}".format(point[0]), "{:f}".format(point[1]) ]) effect_args = [ 'compand', - "{},{}".format(attack_time, decay_time) + "{:f},{:f}".format(attack_time, decay_time) ] if soft_knee_db is not None: effect_args.append( - "{}:{}".format(soft_knee_db, ",".join(transfer_list)) + "{:f}:{}".format(soft_knee_db, ",".join(transfer_list)) ) else: effect_args.append(",".join(transfer_list)) @@ -971,7 +971,7 @@ class Transformer(object): if not is_number(amount) or amount < 0 or amount > 100: raise ValueError('amount must be a number between 0 and 100.') - effect_args = ['contrast', '{}'.format(amount)] + effect_args = ['contrast', '{:f}'.format(amount)] self.effects.extend(effect_args) self.effects_log.append('contrast') @@ -1029,7 +1029,7 @@ class Transformer(object): if not is_number(shift) or shift < -2 or shift > 2: raise ValueError('shift must be a number between -2 and 2.') - effect_args = ['dcshift', '{}'.format(shift)] + effect_args = ['dcshift', '{:f}'.format(shift)] self.effects.extend(effect_args) self.effects_log.append('dcshift') @@ -1079,7 +1079,7 @@ class Transformer(object): raise ValueError("positions must be positive nubmers") effect_args = ['delay'] - effect_args.extend(['{}'.format(p) for p in positions]) + effect_args.extend(['{:f}'.format(p) for p in positions]) self.effects.extend(effect_args) self.effects_log.append('delay') @@ -1188,7 +1188,7 @@ class Transformer(object): "the elements of decays must be between 0 and 1" ) - effect_args = ['echo', '{}'.format(gain_in), '{}'.format(gain_out)] + effect_args = ['echo', '{:f}'.format(gain_in), '{:f}'.format(gain_out)] for i in range(n_echos): effect_args.extend([ @@ -1257,12 +1257,14 @@ class Transformer(object): "the elements of decays must be between 0 and 1" ) - effect_args = ['echos', '{}'.format(gain_in), '{}'.format(gain_out)] + effect_args = [ + 'echos', '{:f}'.format(gain_in), '{:f}'.format(gain_out) + ] for i in range(n_echos): effect_args.extend([ - '{}'.format(delays[i]), - '{}'.format(decays[i]) + '{:f}'.format(delays[i]), + '{:f}'.format(decays[i]) ]) self.effects.extend(effect_args) @@ -1299,9 +1301,9 @@ class Transformer(object): effect_args = [ 'equalizer', - '{}'.format(frequency), - '{}q'.format(width_q), - '{}'.format(gain_db) + '{:f}'.format(frequency), + '{:f}q'.format(width_q), + '{:f}'.format(gain_db) ] self.effects.extend(effect_args) self.effects_log.append('equalizer') @@ -1346,13 +1348,13 @@ class Transformer(object): if fade_in_len > 0: effect_args.extend([ - 'fade', str(fade_shape), str(fade_in_len) + 'fade', '{}'.format(fade_shape), '{:f}'.format(fade_in_len) ]) if fade_out_len > 0: effect_args.extend([ - 'reverse', 'fade', str(fade_shape), - str(fade_out_len), 'reverse' + 'reverse', 'fade', '{}'.format(fade_shape), + '{:f}'.format(fade_out_len), 'reverse' ]) if len(effect_args) > 0: @@ -1377,7 +1379,7 @@ class Transformer(object): raise ValueError("coefficients must be numbers.") effect_args = ['fir'] - effect_args.extend(['{}'.format(c) for c in coefficients]) + effect_args.extend(['{:f}'.format(c) for c in coefficients]) self.effects.extend(effect_args) self.effects_log.append('fir') @@ -1431,13 +1433,13 @@ class Transformer(object): effect_args = [ 'flanger', - '{}'.format(delay), - '{}'.format(depth), - '{}'.format(regen), - '{}'.format(width), - '{}'.format(speed), + '{:f}'.format(delay), + '{:f}'.format(depth), + '{:f}'.format(regen), + '{:f}'.format(width), + '{:f}'.format(speed), '{}'.format(shape), - '{}'.format(phase), + '{:f}'.format(phase), '{}'.format(interp) ] @@ -1500,7 +1502,7 @@ class Transformer(object): if limiter: effect_args.append('-l') - effect_args.append('{}'.format(gain_db)) + effect_args.append('{:f}'.format(gain_db)) self.effects.extend(effect_args) self.effects_log.append('gain') @@ -1536,11 +1538,11 @@ class Transformer(object): raise ValueError("n_poles must be 1 or 2.") effect_args = [ - 'highpass', '-{}'.format(n_poles), '{}'.format(frequency) + 'highpass', '-{}'.format(n_poles), '{:f}'.format(frequency) ] if n_poles == 2: - effect_args.append('{}q'.format(width_q)) + effect_args.append('{:f}q'.format(width_q)) self.effects.extend(effect_args) self.effects_log.append('highpass') @@ -1577,11 +1579,11 @@ class Transformer(object): raise ValueError("n_poles must be 1 or 2.") effect_args = [ - 'lowpass', '-{}'.format(n_poles), '{}'.format(frequency) + 'lowpass', '-{}'.format(n_poles), '{:f}'.format(frequency) ] if n_poles == 2: - effect_args.append('{}q'.format(width_q)) + effect_args.append('{:f}q'.format(width_q)) self.effects.extend(effect_args) self.effects_log.append('lowpass') @@ -1650,8 +1652,8 @@ class Transformer(object): effect_args = [ 'loudness', - '{}'.format(gain_db), - '{}'.format(reference_level) + '{:f}'.format(gain_db), + '{:f}'.format(reference_level) ] self.effects.extend(effect_args) self.effects_log.append('loudness') @@ -1789,9 +1791,9 @@ class Transformer(object): for i in range(n_bands): if i > 0: - effect_args.append('{}'.format(crossover_frequencies[i - 1])) + effect_args.append('{:f}'.format(crossover_frequencies[i - 1])) - intermed_args = ["{},{}".format(attack_time[i], decay_time[i])] + intermed_args = ["{:f},{:f}".format(attack_time[i], decay_time[i])] tf_points_band = tf_points[i] tf_points_band = sorted( @@ -1801,18 +1803,18 @@ class Transformer(object): transfer_list = [] for point in tf_points_band: transfer_list.extend([ - "{}".format(point[0]), "{}".format(point[1]) + "{:f}".format(point[0]), "{:f}".format(point[1]) ]) if soft_knee_db[i] is not None: intermed_args.append( - "{}:{}".format(soft_knee_db[i], ",".join(transfer_list)) + "{:f}:{}".format(soft_knee_db[i], ",".join(transfer_list)) ) else: intermed_args.append(",".join(transfer_list)) if gain[i] is not None: - intermed_args.append("{}".format(gain[i])) + intermed_args.append("{:f}".format(gain[i])) effect_args.append('"{}"'.format(' '.join(intermed_args))) @@ -1839,7 +1841,7 @@ class Transformer(object): effect_args = [ 'norm', - '{}'.format(db_level) + '{:f}'.format(db_level) ] self.effects.extend(effect_args) self.effects_log.append('norm') @@ -1878,8 +1880,8 @@ class Transformer(object): effect_args = [ 'overdrive', - '{}'.format(gain_db), - '{}'.format(colour) + '{:f}'.format(gain_db), + '{:f}'.format(colour) ] self.effects.extend(effect_args) self.effects_log.append('overdrive') @@ -1910,8 +1912,8 @@ class Transformer(object): effect_args = [ 'pad', - '{}'.format(start_duration), - '{}'.format(end_duration) + '{:f}'.format(start_duration), + '{:f}'.format(end_duration) ] self.effects.extend(effect_args) self.effects_log.append('pad') @@ -1963,11 +1965,11 @@ class Transformer(object): effect_args = [ 'phaser', - '{}'.format(gain_in), - '{}'.format(gain_out), - '{}'.format(delay), - '{}'.format(decay), - '{}'.format(speed) + '{:f}'.format(gain_in), + '{:f}'.format(gain_out), + '{:f}'.format(delay), + '{:f}'.format(decay), + '{:f}'.format(speed) ] if modulation_shape == 'sinusoidal': @@ -2017,7 +2019,7 @@ class Transformer(object): if quick: effect_args.append('-q') - effect_args.append('{}'.format(n_semitones * 100.)) + effect_args.append('{:f}'.format(n_semitones * 100.)) self.effects.extend(effect_args) self.effects_log.append('pitch') @@ -2039,14 +2041,6 @@ class Transformer(object): * m : Medium, * h : High (default), * v : Very high - silence_threshold : float - Silence threshold as percentage of maximum sample amplitude. - min_silence_duration : float - The minimum ammount of time in seconds required for a region to be - considered non-silent. - buffer_around_silence : bool - If True, leaves a buffer of min_silence_duration around removed - silent regions. See Also -------- @@ -2065,7 +2059,7 @@ class Transformer(object): effect_args = [ 'rate', '-{}'.format(quality), - '{}'.format(samplerate) + '{:f}'.format(samplerate) ] self.effects.extend(effect_args) self.effects_log.append('rate') @@ -2229,12 +2223,12 @@ class Transformer(object): effect_args.append('-w') effect_args.extend([ - '{}'.format(reverberance), - '{}'.format(high_freq_damping), - '{}'.format(room_scale), - '{}'.format(stereo_depth), - '{}'.format(pre_delay), - '{}'.format(wet_gain) + '{:f}'.format(reverberance), + '{:f}'.format(high_freq_damping), + '{:f}'.format(room_scale), + '{:f}'.format(stereo_depth), + '{:f}'.format(pre_delay), + '{:f}'.format(wet_gain) ]) self.effects.extend(effect_args) @@ -2309,15 +2303,15 @@ class Transformer(object): effect_args.extend([ '1', - '{}'.format(min_silence_duration), - '{}%'.format(silence_threshold) + '{:f}'.format(min_silence_duration), + '{:f}%'.format(silence_threshold) ]) if location == 0: effect_args.extend([ '-1', - '{}'.format(min_silence_duration), - '{}%'.format(silence_threshold) + '{:f}'.format(min_silence_duration), + '{:f}%'.format(silence_threshold) ]) if location == -1: @@ -2436,32 +2430,36 @@ class Transformer(object): raise ValueError("phase response must be between 0 and 100") effect_args = ['sinc'] - effect_args.extend(['-a', '{}'.format(stop_band_attenuation)]) + effect_args.extend(['-a', '{:f}'.format(stop_band_attenuation)]) if phase_response is not None: - effect_args.extend(['-p', '{}'.format(phase_response)]) + effect_args.extend(['-p', '{:f}'.format(phase_response)]) if filter_type == 'high': if transition_bw is not None: - effect_args.extend(['-t', '{}'.format(transition_bw)]) - effect_args.append('{}'.format(cutoff_freq)) + effect_args.extend(['-t', '{:f}'.format(transition_bw)]) + effect_args.append('{:f}'.format(cutoff_freq)) elif filter_type == 'low': - effect_args.append('-{}'.format(cutoff_freq)) + effect_args.append('-{:f}'.format(cutoff_freq)) if transition_bw is not None: - effect_args.extend(['-t', '{}'.format(transition_bw)]) + effect_args.extend(['-t', '{:f}'.format(transition_bw)]) else: if is_number(transition_bw): - effect_args.extend(['-t', '{}'.format(transition_bw)]) + effect_args.extend(['-t', '{:f}'.format(transition_bw)]) elif isinstance(transition_bw, list): - effect_args.extend(['-t', '{}'.format(transition_bw[0])]) + effect_args.extend(['-t', '{:f}'.format(transition_bw[0])]) if filter_type == 'pass': - effect_args.append('{}-{}'.format(cutoff_freq[0], cutoff_freq[1])) + effect_args.append( + '{:f}-{:f}'.format(cutoff_freq[0], cutoff_freq[1]) + ) elif filter_type == 'reject': - effect_args.append('{}-{}'.format(cutoff_freq[1], cutoff_freq[0])) + effect_args.append( + '{:f}-{:f}'.format(cutoff_freq[1], cutoff_freq[0]) + ) if isinstance(transition_bw, list): - effect_args.extend(['-t', '{}'.format(transition_bw[1])]) + effect_args.extend(['-t', '{:f}'.format(transition_bw[1])]) self.effects.extend(effect_args) self.effects_log.append('sinc') @@ -2497,7 +2495,7 @@ class Transformer(object): "Using an extreme factor. Quality of results will be poor" ) - effect_args = ['speed', '{}'.format(factor)] + effect_args = ['speed', '{:f}'.format(factor)] self.effects.extend(effect_args) self.effects_log.append('speed') @@ -2564,7 +2562,7 @@ class Transformer(object): "window must be a positive number." ) - effect_args = ['stretch', '{}'.format(factor), '{}'.format(window)] + effect_args = ['stretch', '{:f}'.format(factor), '{:f}'.format(window)] self.effects.extend(effect_args) self.effects_log.append('stretch') @@ -2628,7 +2626,7 @@ class Transformer(object): if audio_type is not None: effect_args.append('-{}'.format(audio_type)) - effect_args.append('{}'.format(factor)) + effect_args.append('{:f}'.format(factor)) self.effects.extend(effect_args) self.effects_log.append('tempo') @@ -2669,8 +2667,8 @@ class Transformer(object): raise ValueError("width_q must be a positive number.") effect_args = [ - 'treble', '{}'.format(gain_db), '{}'.format(frequency), - '{}s'.format(slope) + 'treble', '{:f}'.format(gain_db), '{:f}'.format(frequency), + '{:f}s'.format(slope) ] self.effects.extend(effect_args) @@ -2709,8 +2707,8 @@ class Transformer(object): effect_args = [ 'tremolo', - '{}'.format(speed), - '{}'.format(depth) + '{:f}'.format(speed), + '{:f}'.format(depth) ] self.effects.extend(effect_args) @@ -2738,8 +2736,8 @@ class Transformer(object): effect_args = [ 'trim', - '{}'.format(start_time), - '{}'.format(end_time - start_time) + '{:f}'.format(start_time), + '{:f}'.format(end_time - start_time) ] self.effects.extend(effect_args) @@ -2851,11 +2849,11 @@ class Transformer(object): effect_args.extend([ 'vad', - '-t', '{}'.format(activity_threshold), - '-T', '{}'.format(min_activity_duration), - '-s', '{}'.format(initial_search_buffer), - '-g', '{}'.format(max_gap), - '-p', '{}'.format(initial_pad) + '-t', '{:f}'.format(activity_threshold), + '-T', '{:f}'.format(min_activity_duration), + '-s', '{:f}'.format(initial_search_buffer), + '-g', '{:f}'.format(max_gap), + '-p', '{:f}'.format(initial_pad) ]) if location == -1: diff --git a/sox/version.py b/sox/version.py index de43582..4dbfbf3 100644 --- a/sox/version.py +++ b/sox/version.py @@ -3,4 +3,4 @@ """Version info""" short_version = '1.2' -version = '1.2.5' +version = '1.2.6'
SoX doesn't seem to like scientific notation Pysox needs to format its floats to not be scientific notation when formatting arguments for SoX, otherwise SoX seems to choke. I received `` SoxError: Stdout: Stderr: sox FAIL pad: usage: {length[@position]} `` when pysox was calling SoX with these arguments: ``['sox', '-D', '-V2', u'../data/raw/scaper_audio/siren_wailing/5_siren_police.wav', '-c', '1', '/var/folders/xv/6nccdc7151j71bhvzlrvjhqm0000gp/T/tmpYCzbyz.wav', 'rate', '-h', '44100', 'trim', '0', '6.501565999', 'fade', 'q', '0.01', 'reverse', 'fade', 'q', '0.01', 'reverse', 'norm', '-7.36679718537', 'pad', '3.498434', '1.00000008274e-09']`` Note the `'1.00000008274e-09'` at the end. When this number was changed to `'0.00000000100000008274'`, this error went away, and when changed to a different sci notation number, e.g. `'1.0e-3'`, the problem persisted.
rabitt/pysox
diff --git a/tests/test_transform.py b/tests/test_transform.py index 2c4f3d8..8d4ae6e 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -165,7 +165,17 @@ class TestTransformSetInputFormat(unittest.TestCase): def test_rate(self): self.tfm.set_input_format(rate=44100) actual = self.tfm.input_format - expected = ['-r', '44100'] + expected = ['-r', '44100.000000'] + self.assertEqual(expected, actual) + + actual_result = self.tfm.build(INPUT_FILE, OUTPUT_FILE) + expected_result = True + self.assertEqual(expected_result, actual_result) + + def test_rate_scinotation(self): + self.tfm.set_input_format(rate=1.0e3) + actual = self.tfm.input_format + expected = ['-r', '1000.000000'] self.assertEqual(expected, actual) actual_result = self.tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -276,7 +286,17 @@ class TestTransformSetOutputFormat(unittest.TestCase): def test_rate(self): self.tfm.set_output_format(rate=44100) actual = self.tfm.output_format - expected = ['-r', '44100'] + expected = ['-r', '44100.000000'] + self.assertEqual(expected, actual) + + actual_result = self.tfm.build(INPUT_FILE, OUTPUT_FILE) + expected_result = True + self.assertEqual(expected_result, actual_result) + + def test_rate_scinotation(self): + self.tfm.set_output_format(rate=1.0e3) + actual = self.tfm.output_format + expected = ['-r', '1000.000000'] self.assertEqual(expected, actual) actual_result = self.tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -411,10 +431,10 @@ class TestTransformerAllpass(unittest.TestCase): def test_default(self): tfm = new_transformer() - tfm.allpass(500.0) + tfm.allpass(500) actual_args = tfm.effects - expected_args = ['allpass', '500.0', '2.0q'] + expected_args = ['allpass', '500.000000', '2.000000q'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -443,7 +463,7 @@ class TestTransformerBandpass(unittest.TestCase): tfm.bandpass(500.0) actual_args = tfm.effects - expected_args = ['bandpass', '500.0', '2.0q'] + expected_args = ['bandpass', '500.000000', '2.000000q'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -459,7 +479,7 @@ class TestTransformerBandpass(unittest.TestCase): tfm.bandpass(500.0, constant_skirt=True) actual_args = tfm.effects - expected_args = ['bandpass', '-c', '500.0', '2.0q'] + expected_args = ['bandpass', '-c', '500.000000', '2.000000q'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -493,7 +513,7 @@ class TestTransformerBandreject(unittest.TestCase): tfm.bandreject(500.0) actual_args = tfm.effects - expected_args = ['bandreject', '500.0', '2.0q'] + expected_args = ['bandreject', '500.000000', '2.000000q'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -522,7 +542,7 @@ class TestTransformerBass(unittest.TestCase): tfm.bass(-20.0) actual_args = tfm.effects - expected_args = ['bass', '-20.0', '100.0', '0.5s'] + expected_args = ['bass', '-20.000000', '100.000000', '0.500000s'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -561,9 +581,9 @@ class TestTransformerBend(unittest.TestCase): 'bend', '-f', '25', '-o', '16', - '0.35,180,0.25', - '0.15,740,0.53', - '0.0,-540,0.3' + '0.350000,180.000000,0.250000', + '0.150000,740.000000,0.530000', + '0.000000,-540.000000,0.300000' ] self.assertEqual(expected_args, actual_args) @@ -670,9 +690,9 @@ class TestTransformerBend(unittest.TestCase): 'bend', '-f', '50', '-o', '16', - '0.35,180,0.25', - '0.15,740,0.53', - '0.0,-540,0.3' + '0.350000,180.000000,0.250000', + '0.150000,740.000000,0.530000', + '0.000000,-540.000000,0.300000' ] self.assertEqual(expected_args, actual_args) @@ -698,9 +718,9 @@ class TestTransformerBend(unittest.TestCase): 'bend', '-f', '25', '-o', '31', - '0.35,180,0.25', - '0.15,740,0.53', - '0.0,-540,0.3' + '0.350000,180.000000,0.250000', + '0.150000,740.000000,0.530000', + '0.000000,-540.000000,0.300000' ] self.assertEqual(expected_args, actual_args) @@ -723,7 +743,10 @@ class TestTransformerBiquad(unittest.TestCase): tfm.biquad([0, 0, 0], [1, 0, 0]) actual_args = tfm.effects - expected_args = ['biquad', '0', '0', '0', '1', '0', '0'] + expected_args = [ + 'biquad', '0.000000', '0.000000', '0.000000', + '1.000000', '0.000000', '0.000000' + ] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -828,7 +851,8 @@ class TestTransformerChorus(unittest.TestCase): # check only the first 3 args - the rest are randomized actual_args = tfm.effects expected_args = [ - 'chorus', '0.5', '0.9', '50.0', '0.32', '0.25', '2.0', '-t' + 'chorus', '0.5', '0.9', '50.000000', + '0.320000', '0.250000', '2.000000', '-t' ] self.assertEqual(expected_args, actual_args) @@ -938,7 +962,7 @@ class TestTransformerContrast(unittest.TestCase): tfm.contrast() actual_args = tfm.effects - expected_args = ['contrast', '75'] + expected_args = ['contrast', '75.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -972,7 +996,11 @@ class TestTransformerCompand(unittest.TestCase): tfm.compand() actual_args = tfm.effects - expected_args = ['compand', '0.3,0.8', '6.0:-70,-70,-60,-20,0,0'] + expected_args = [ + 'compand', '0.300000,0.800000', + '6.000000:-70.000000,-70.000000,-60.000000,' + + '-20.000000,0.000000,0.000000' + ] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -988,7 +1016,11 @@ class TestTransformerCompand(unittest.TestCase): tfm.compand(attack_time=0.5) actual_args = tfm.effects - expected_args = ['compand', '0.5,0.8', '6.0:-70,-70,-60,-20,0,0'] + expected_args = [ + 'compand', '0.500000,0.800000', + '6.000000:-70.000000,-70.000000,-60.000000,' + + '-20.000000,0.000000,0.000000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1010,7 +1042,11 @@ class TestTransformerCompand(unittest.TestCase): tfm.compand(decay_time=0.5) actual_args = tfm.effects - expected_args = ['compand', '0.3,0.5', '6.0:-70,-70,-60,-20,0,0'] + expected_args = [ + 'compand', '0.300000,0.500000', + '6.000000:-70.000000,-70.000000,-60.000000,' + + '-20.000000,0.000000,0.000000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1032,7 +1068,10 @@ class TestTransformerCompand(unittest.TestCase): tfm.compand(attack_time=1.0, decay_time=0.5) actual_args = tfm.effects - expected_args = ['compand', '1.0,0.5', '6.0:-70,-70,-60,-20,0,0'] + expected_args = [ + 'compand', '1.000000,0.500000', + '6.000000:-70.000000,-70.000000,-60.000000,' + + '-20.000000,0.000000,0.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1044,7 +1083,11 @@ class TestTransformerCompand(unittest.TestCase): tfm.compand(soft_knee_db=-2) actual_args = tfm.effects - expected_args = ['compand', '0.3,0.8', '-2:-70,-70,-60,-20,0,0'] + expected_args = [ + 'compand', '0.300000,0.800000', + '-2.000000:-70.000000,-70.000000,-60.000000,' + + '-20.000000,0.000000,0.000000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1056,7 +1099,10 @@ class TestTransformerCompand(unittest.TestCase): tfm.compand(soft_knee_db=None) actual_args = tfm.effects - expected_args = ['compand', '0.3,0.8', '-70,-70,-60,-20,0,0'] + expected_args = [ + 'compand', '0.300000,0.800000', + '-70.000000,-70.000000,-60.000000,-20.000000,0.000000,0.000000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1074,7 +1120,9 @@ class TestTransformerCompand(unittest.TestCase): actual_args = tfm.effects expected_args = [ - 'compand', '0.3,0.8', '6.0:-70,-60,-60,-20,-40,-40,0,-4' + 'compand', '0.300000,0.800000', + '6.000000:-70.000000,-60.000000,-60.000000,-20.000000,' + + '-40.000000,-40.000000,0.000000,-4.000000' ] self.assertEqual(expected_args, actual_args) @@ -1142,7 +1190,7 @@ class TestTransformerConvert(unittest.TestCase): tfm.convert(samplerate=8000) actual_args = tfm.effects - expected_args = ['rate', '-h', '8000'] + expected_args = ['rate', '-h', '8000.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -1205,7 +1253,7 @@ class TestTransformerDcshift(unittest.TestCase): tfm.dcshift() actual_args = tfm.effects - expected_args = ['dcshift', '0.0'] + expected_args = ['dcshift', '0.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -1258,7 +1306,7 @@ class TestTransformerDelay(unittest.TestCase): tfm.delay([1.0]) actual_args = tfm.effects - expected_args = ['delay', '1.0'] + expected_args = ['delay', '1.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -1274,7 +1322,7 @@ class TestTransformerDelay(unittest.TestCase): tfm.delay([0.0, 1.0]) actual_args = tfm.effects - expected_args = ['delay', '0.0', '1.0'] + expected_args = ['delay', '0.000000', '1.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -1358,7 +1406,7 @@ class TestTransformerEcho(unittest.TestCase): tfm.echo() actual_args = tfm.effects - expected_args = ['echo', '0.8', '0.9', '60', '0.4'] + expected_args = ['echo', '0.800000', '0.900000', '60', '0.4'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -1374,7 +1422,7 @@ class TestTransformerEcho(unittest.TestCase): tfm.echo(gain_in=1.0) actual_args = tfm.effects - expected_args = ['echo', '1.0', '0.9', '60', '0.4'] + expected_args = ['echo', '1.000000', '0.900000', '60', '0.4'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1391,7 +1439,7 @@ class TestTransformerEcho(unittest.TestCase): tfm.echo(gain_out=1.0) actual_args = tfm.effects - expected_args = ['echo', '0.8', '1.0', '60', '0.4'] + expected_args = ['echo', '0.800000', '1.000000', '60', '0.4'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1408,7 +1456,9 @@ class TestTransformerEcho(unittest.TestCase): tfm.echo(n_echos=2, delays=[60, 60], decays=[0.4, 0.4]) actual_args = tfm.effects - expected_args = ['echo', '0.8', '0.9', '60', '0.4', '60', '0.4'] + expected_args = [ + 'echo', '0.800000', '0.900000', '60', '0.4', '60', '0.4' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1425,7 +1475,9 @@ class TestTransformerEcho(unittest.TestCase): tfm.echo(n_echos=2, delays=[1, 600], decays=[0.4, 0.4]) actual_args = tfm.effects - expected_args = ['echo', '0.8', '0.9', '1', '0.4', '600', '0.4'] + expected_args = [ + 'echo', '0.800000', '0.900000', '1', '0.4', '600', '0.4' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1452,7 +1504,9 @@ class TestTransformerEcho(unittest.TestCase): tfm.echo(n_echos=2, delays=[60, 60], decays=[0.1, 1.0]) actual_args = tfm.effects - expected_args = ['echo', '0.8', '0.9', '60', '0.1', '60', '1.0'] + expected_args = [ + 'echo', '0.800000', '0.900000', '60', '0.1', '60', '1.0' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1482,7 +1536,9 @@ class TestTransformerEchos(unittest.TestCase): tfm.echos() actual_args = tfm.effects - expected_args = ['echos', '0.8', '0.9', '60', '0.4'] + expected_args = [ + 'echos', '0.800000', '0.900000', '60.000000', '0.400000' + ] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -1498,7 +1554,9 @@ class TestTransformerEchos(unittest.TestCase): tfm.echos(gain_in=1.0) actual_args = tfm.effects - expected_args = ['echos', '1.0', '0.9', '60', '0.4'] + expected_args = [ + 'echos', '1.000000', '0.900000', '60.000000', '0.400000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1515,7 +1573,9 @@ class TestTransformerEchos(unittest.TestCase): tfm.echos(gain_out=1.0) actual_args = tfm.effects - expected_args = ['echos', '0.8', '1.0', '60', '0.4'] + expected_args = [ + 'echos', '0.800000', '1.000000', '60.000000', '0.400000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1532,7 +1592,10 @@ class TestTransformerEchos(unittest.TestCase): tfm.echos(n_echos=2, delays=[60, 60], decays=[0.4, 0.4]) actual_args = tfm.effects - expected_args = ['echos', '0.8', '0.9', '60', '0.4', '60', '0.4'] + expected_args = [ + 'echos', '0.800000', '0.900000', '60.000000', '0.400000', + '60.000000', '0.400000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1549,7 +1612,10 @@ class TestTransformerEchos(unittest.TestCase): tfm.echos(n_echos=2, delays=[1, 600], decays=[0.4, 0.4]) actual_args = tfm.effects - expected_args = ['echos', '0.8', '0.9', '1', '0.4', '600', '0.4'] + expected_args = [ + 'echos', '0.800000', '0.900000', '1.000000', '0.400000', + '600.000000', '0.400000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1576,7 +1642,10 @@ class TestTransformerEchos(unittest.TestCase): tfm.echos(n_echos=2, delays=[60, 60], decays=[0.1, 1.0]) actual_args = tfm.effects - expected_args = ['echos', '0.8', '0.9', '60', '0.1', '60', '1.0'] + expected_args = [ + 'echos', '0.800000', '0.900000', '60.000000', '0.100000', + '60.000000', '1.000000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1606,7 +1675,7 @@ class TestTransformerEqualizer(unittest.TestCase): tfm.equalizer(500.0, 2, 3) actual_args = tfm.effects - expected_args = ['equalizer', '500.0', '2q', '3'] + expected_args = ['equalizer', '500.000000', '2.000000q', '3.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -1640,7 +1709,7 @@ class TestTransformerFade(unittest.TestCase): tfm.fade(fade_in_len=0.5) actual_args = tfm.effects - expected_args = ['fade', 'q', '0.5'] + expected_args = ['fade', 'q', '0.500000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -1656,7 +1725,7 @@ class TestTransformerFade(unittest.TestCase): tfm.fade(fade_in_len=1.2) actual_args = tfm.effects - expected_args = ['fade', 'q', '1.2'] + expected_args = ['fade', 'q', '1.200000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1673,7 +1742,7 @@ class TestTransformerFade(unittest.TestCase): tfm.fade(fade_out_len=3) actual_args = tfm.effects - expected_args = ['reverse', 'fade', 'q', '3', 'reverse'] + expected_args = ['reverse', 'fade', 'q', '3.000000', 'reverse'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1690,7 +1759,7 @@ class TestTransformerFade(unittest.TestCase): tfm.fade(fade_shape='p', fade_in_len=1.5) actual_args = tfm.effects - expected_args = ['fade', 'p', '1.5'] + expected_args = ['fade', 'p', '1.500000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1711,7 +1780,8 @@ class TestTransformerFir(unittest.TestCase): actual_args = tfm.effects expected_args = [ - 'fir', '0.0195', '-0.082', '0.234', '0.891', '-0.145', '0.043' + 'fir', '0.019500', '-0.082000', '0.234000', '0.891000', + '-0.145000', '0.043000' ] self.assertEqual(expected_args, actual_args) @@ -1742,7 +1812,8 @@ class TestTransformerFlanger(unittest.TestCase): actual_args = tfm.effects expected_args = [ - 'flanger', '0', '2', '0', '71', '0.5', 'sine', '25', 'linear' + 'flanger', '0.000000', '2.000000', '0.000000', '71.000000', + '0.500000', 'sine', '25.000000', 'linear' ] self.assertEqual(expected_args, actual_args) @@ -1760,7 +1831,8 @@ class TestTransformerFlanger(unittest.TestCase): actual_args = tfm.effects expected_args = [ - 'flanger', '10', '2', '0', '71', '0.5', 'sine', '25', 'linear' + 'flanger', '10.000000', '2.000000', '0.000000', '71.000000', + '0.500000', 'sine', '25.000000', 'linear' ] self.assertEqual(expected_args, actual_args) @@ -1779,7 +1851,8 @@ class TestTransformerFlanger(unittest.TestCase): actual_args = tfm.effects expected_args = [ - 'flanger', '0', '0', '0', '71', '0.5', 'sine', '25', 'linear' + 'flanger', '0.000000', '0.000000', '0.000000', '71.000000', + '0.500000', 'sine', '25.000000', 'linear' ] self.assertEqual(expected_args, actual_args) @@ -1798,7 +1871,8 @@ class TestTransformerFlanger(unittest.TestCase): actual_args = tfm.effects expected_args = [ - 'flanger', '0', '2', '-95', '71', '0.5', 'sine', '25', 'linear' + 'flanger', '0.000000', '2.000000', '-95.000000', '71.000000', + '0.500000', 'sine', '25.000000', 'linear' ] self.assertEqual(expected_args, actual_args) @@ -1817,7 +1891,8 @@ class TestTransformerFlanger(unittest.TestCase): actual_args = tfm.effects expected_args = [ - 'flanger', '0', '2', '0', '0', '0.5', 'sine', '25', 'linear' + 'flanger', '0.000000', '2.000000', '0.000000', '0.000000', + '0.500000', 'sine', '25.000000', 'linear' ] self.assertEqual(expected_args, actual_args) @@ -1836,7 +1911,8 @@ class TestTransformerFlanger(unittest.TestCase): actual_args = tfm.effects expected_args = [ - 'flanger', '0', '2', '0', '71', '10', 'sine', '25', 'linear' + 'flanger', '0.000000', '2.000000', '0.000000', '71.000000', + '10.000000', 'sine', '25.000000', 'linear' ] self.assertEqual(expected_args, actual_args) @@ -1855,7 +1931,8 @@ class TestTransformerFlanger(unittest.TestCase): actual_args = tfm.effects expected_args = [ - 'flanger', '0', '2', '0', '71', '0.5', 'triangle', '25', 'linear' + 'flanger', '0.000000', '2.000000', '0.000000', '71.000000', + '0.500000', 'triangle', '25.000000', 'linear' ] self.assertEqual(expected_args, actual_args) @@ -1874,7 +1951,8 @@ class TestTransformerFlanger(unittest.TestCase): actual_args = tfm.effects expected_args = [ - 'flanger', '0', '2', '0', '71', '0.5', 'sine', '95', 'linear' + 'flanger', '0.000000', '2.000000', '0.000000', '71.000000', + '0.500000', 'sine', '95.000000', 'linear' ] self.assertEqual(expected_args, actual_args) @@ -1893,7 +1971,8 @@ class TestTransformerFlanger(unittest.TestCase): actual_args = tfm.effects expected_args = [ - 'flanger', '0', '2', '0', '71', '0.5', 'sine', '25', 'quadratic' + 'flanger', '0.000000', '2.000000', '0.000000', '71.000000', + '0.500000', 'sine', '25.000000', 'quadratic' ] self.assertEqual(expected_args, actual_args) @@ -1914,7 +1993,7 @@ class TestTransformerGain(unittest.TestCase): tfm.gain() actual_args = tfm.effects - expected_args = ['gain', '-n', '0.0'] + expected_args = ['gain', '-n', '0.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -1930,7 +2009,7 @@ class TestTransformerGain(unittest.TestCase): tfm.gain(gain_db=6) actual_args = tfm.effects - expected_args = ['gain', '-n', '6'] + expected_args = ['gain', '-n', '6.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1947,7 +2026,7 @@ class TestTransformerGain(unittest.TestCase): tfm.gain(normalize=False) actual_args = tfm.effects - expected_args = ['gain', '0.0'] + expected_args = ['gain', '0.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1964,7 +2043,7 @@ class TestTransformerGain(unittest.TestCase): tfm.gain(limiter=True) actual_args = tfm.effects - expected_args = ['gain', '-n', '-l', '0.0'] + expected_args = ['gain', '-n', '-l', '0.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -1981,7 +2060,7 @@ class TestTransformerGain(unittest.TestCase): tfm.gain(balance='B') actual_args = tfm.effects - expected_args = ['gain', '-B', '-n', '0.0'] + expected_args = ['gain', '-B', '-n', '0.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2001,7 +2080,7 @@ class TestTransformerHighpass(unittest.TestCase): tfm.highpass(1000.0) actual_args = tfm.effects - expected_args = ['highpass', '-2', '1000.0', '0.707q'] + expected_args = ['highpass', '-2', '1000.000000', '0.707000q'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -2017,7 +2096,7 @@ class TestTransformerHighpass(unittest.TestCase): tfm.highpass(1000.0, n_poles=1) actual_args = tfm.effects - expected_args = ['highpass', '-1', '1000.0'] + expected_args = ['highpass', '-1', '1000.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -2100,7 +2179,7 @@ class TestTransformerLowpass(unittest.TestCase): tfm.lowpass(1000.0) actual_args = tfm.effects - expected_args = ['lowpass', '-2', '1000.0', '0.707q'] + expected_args = ['lowpass', '-2', '1000.000000', '0.707000q'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -2116,7 +2195,7 @@ class TestTransformerLowpass(unittest.TestCase): tfm.lowpass(1000.0, n_poles=1) actual_args = tfm.effects - expected_args = ['lowpass', '-1', '1000.0'] + expected_args = ['lowpass', '-1', '1000.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -2150,7 +2229,7 @@ class TestTransformerLoudness(unittest.TestCase): tfm.loudness() actual_args = tfm.effects - expected_args = ['loudness', '-10.0', '65.0'] + expected_args = ['loudness', '-10.000000', '65.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -2166,7 +2245,7 @@ class TestTransformerLoudness(unittest.TestCase): tfm.loudness(gain_db=0) actual_args = tfm.effects - expected_args = ['loudness', '0', '65.0'] + expected_args = ['loudness', '0.000000', '65.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2183,7 +2262,7 @@ class TestTransformerLoudness(unittest.TestCase): tfm.loudness(reference_level=50) actual_args = tfm.effects - expected_args = ['loudness', '-10.0', '50'] + expected_args = ['loudness', '-10.000000', '50.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2210,9 +2289,11 @@ class TestTransformerMcompand(unittest.TestCase): actual_args = tfm.effects expected_args = [ 'mcompand', - '"0.005,0.1 6.0:-47,-40,-34,-34,-17,-33,0,0"', - '1600', - '"0.000625,0.0125 -47,-40,-34,-34,-15,-33,0,0"' + '"0.005000,0.100000 6.000000:-47.000000,-40.000000,-34.000000,' + '-34.000000,-17.000000,-33.000000,0.000000,0.000000"', + '1600.000000', + '"0.000625,0.012500 -47.000000,-40.000000,-34.000000,-34.000000,' + '-15.000000,-33.000000,0.000000,0.000000"' ] self.assertEqual(expected_args, actual_args) @@ -2237,7 +2318,8 @@ class TestTransformerMcompand(unittest.TestCase): actual_args = tfm.effects expected_args = [ 'mcompand', - '"0.005,0.1 6.0:-47,-40,-34,-34,-17,-33,0,0"' + '"0.005000,0.100000 6.000000:-47.000000,-40.000000,-34.000000,' + '-34.000000,-17.000000,-33.000000,0.000000,0.000000"' ] self.assertEqual(expected_args, actual_args) @@ -2257,9 +2339,11 @@ class TestTransformerMcompand(unittest.TestCase): actual_args = tfm.effects expected_args = [ 'mcompand', - '"0.005,0.1 6.0:-47,-40,-34,-34,-17,-33,0,0"', - '100', - '"0.000625,0.0125 -47,-40,-34,-34,-15,-33,0,0"' + '"0.005000,0.100000 6.000000:-47.000000,-40.000000,-34.000000,' + '-34.000000,-17.000000,-33.000000,0.000000,0.000000"', + '100.000000', + '"0.000625,0.012500 -47.000000,-40.000000,-34.000000,-34.000000,' + '-15.000000,-33.000000,0.000000,0.000000"' ] self.assertEqual(expected_args, actual_args) @@ -2284,9 +2368,11 @@ class TestTransformerMcompand(unittest.TestCase): actual_args = tfm.effects expected_args = [ 'mcompand', - '"0.5,0.1 6.0:-47,-40,-34,-34,-17,-33,0,0"', - '1600', - '"0.0625,0.0125 -47,-40,-34,-34,-15,-33,0,0"' + '"0.500000,0.100000 6.000000:-47.000000,-40.000000,-34.000000,' + '-34.000000,-17.000000,-33.000000,0.000000,0.000000"', + '1600.000000', + '"0.062500,0.012500 -47.000000,-40.000000,-34.000000,-34.000000,' + '-15.000000,-33.000000,0.000000,0.000000"' ] self.assertEqual(expected_args, actual_args) @@ -2321,9 +2407,11 @@ class TestTransformerMcompand(unittest.TestCase): actual_args = tfm.effects expected_args = [ 'mcompand', - '"0.005,0.001 6.0:-47,-40,-34,-34,-17,-33,0,0"', - '1600', - '"0.000625,0.5 -47,-40,-34,-34,-15,-33,0,0"' + '"0.005000,0.001000 6.000000:-47.000000,-40.000000,-34.000000,' + '-34.000000,-17.000000,-33.000000,0.000000,0.000000"', + '1600.000000', + '"0.000625,0.500000 -47.000000,-40.000000,-34.000000,-34.000000,' + '-15.000000,-33.000000,0.000000,0.000000"' ] self.assertEqual(expected_args, actual_args) @@ -2358,9 +2446,11 @@ class TestTransformerMcompand(unittest.TestCase): actual_args = tfm.effects expected_args = [ 'mcompand', - '"0.005,0.1 -2:-47,-40,-34,-34,-17,-33,0,0"', - '1600', - '"0.000625,0.0125 -5:-47,-40,-34,-34,-15,-33,0,0"' + '"0.005000,0.100000 -2.000000:-47.000000,-40.000000,-34.000000,' + '-34.000000,-17.000000,-33.000000,0.000000,0.000000"', + '1600.000000', + '"0.000625,0.012500 -5.000000:-47.000000,-40.000000,-34.000000,' + '-34.000000,-15.000000,-33.000000,0.000000,0.000000"' ] self.assertEqual(expected_args, actual_args) @@ -2375,9 +2465,11 @@ class TestTransformerMcompand(unittest.TestCase): actual_args = tfm.effects expected_args = [ 'mcompand', - '"0.005,0.1 -47,-40,-34,-34,-17,-33,0,0"', - '1600', - '"0.000625,0.0125 -47,-40,-34,-34,-15,-33,0,0"' + '"0.005000,0.100000 -47.000000,-40.000000,-34.000000,-34.000000,' + '-17.000000,-33.000000,0.000000,0.000000"', + '1600.000000', + '"0.000625,0.012500 -47.000000,-40.000000,-34.000000,-34.000000,' + '-15.000000,-33.000000,0.000000,0.000000"' ] self.assertEqual(expected_args, actual_args) @@ -2412,9 +2504,10 @@ class TestTransformerMcompand(unittest.TestCase): actual_args = tfm.effects expected_args = [ 'mcompand', - '"0.005,0.1 6.0:-70,-60,-60,-20,-40,-40,0,-4"', - '1600', - '"0.000625,0.0125 -70,-60,0,-4"' + '"0.005000,0.100000 6.000000:-70.000000,-60.000000,-60.000000,' + '-20.000000,-40.000000,-40.000000,0.000000,-4.000000"', + '1600.000000', + '"0.000625,0.012500 -70.000000,-60.000000,0.000000,-4.000000"' ] self.assertEqual(expected_args, actual_args) @@ -2478,9 +2571,11 @@ class TestTransformerMcompand(unittest.TestCase): actual_args = tfm.effects expected_args = [ 'mcompand', - '"0.005,0.1 6.0:-47,-40,-34,-34,-17,-33,0,0 3.0"', - '1600', - '"0.000625,0.0125 -47,-40,-34,-34,-15,-33,0,0 -1.0"' + '"0.005000,0.100000 6.000000:-47.000000,-40.000000,-34.000000,' + '-34.000000,-17.000000,-33.000000,0.000000,0.000000 3.000000"', + '1600.000000', + '"0.000625,0.012500 -47.000000,-40.000000,-34.000000,-34.000000,' + '-15.000000,-33.000000,0.000000,0.000000 -1.000000"' ] self.assertEqual(expected_args, actual_args) @@ -2510,7 +2605,7 @@ class TestTransformerNorm(unittest.TestCase): tfm.norm() actual_args = tfm.effects - expected_args = ['norm', '-3.0'] + expected_args = ['norm', '-3.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -2526,7 +2621,7 @@ class TestTransformerNorm(unittest.TestCase): tfm.norm(db_level=0) actual_args = tfm.effects - expected_args = ['norm', '0'] + expected_args = ['norm', '0.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2565,7 +2660,7 @@ class TestTransformerOverdrive(unittest.TestCase): tfm.overdrive() actual_args = tfm.effects - expected_args = ['overdrive', '20.0', '20.0'] + expected_args = ['overdrive', '20.000000', '20.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -2581,7 +2676,7 @@ class TestTransformerOverdrive(unittest.TestCase): tfm.overdrive(gain_db=2) actual_args = tfm.effects - expected_args = ['overdrive', '2', '20.0'] + expected_args = ['overdrive', '2.000000', '20.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2598,7 +2693,7 @@ class TestTransformerOverdrive(unittest.TestCase): tfm.overdrive(colour=0) actual_args = tfm.effects - expected_args = ['overdrive', '20.0', '0'] + expected_args = ['overdrive', '20.000000', '0.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2618,7 +2713,7 @@ class TestTransformerPad(unittest.TestCase): tfm.pad() actual_args = tfm.effects - expected_args = ['pad', '0.0', '0.0'] + expected_args = ['pad', '0.000000', '0.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -2634,7 +2729,7 @@ class TestTransformerPad(unittest.TestCase): tfm.pad(start_duration=3) actual_args = tfm.effects - expected_args = ['pad', '3', '0.0'] + expected_args = ['pad', '3.000000', '0.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2651,7 +2746,7 @@ class TestTransformerPad(unittest.TestCase): tfm.pad(end_duration=0.2) actual_args = tfm.effects - expected_args = ['pad', '0.0', '0.2'] + expected_args = ['pad', '0.000000', '0.200000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2671,7 +2766,10 @@ class TestTransformerPhaser(unittest.TestCase): tfm.phaser() actual_args = tfm.effects - expected_args = ['phaser', '0.8', '0.74', '3', '0.4', '0.5', '-s'] + expected_args = [ + 'phaser', '0.800000', '0.740000', '3.000000', '0.400000', + '0.500000', '-s' + ] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -2687,7 +2785,9 @@ class TestTransformerPhaser(unittest.TestCase): tfm.phaser(gain_in=0.5) actual_args = tfm.effects - expected_args = ['phaser', '0.5', '0.74', '3', '0.4', '0.5', '-s'] + expected_args = [ + 'phaser', '0.500000', '0.740000', '3.000000', '0.400000', + '0.500000', '-s'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2704,7 +2804,9 @@ class TestTransformerPhaser(unittest.TestCase): tfm.phaser(gain_out=1.0) actual_args = tfm.effects - expected_args = ['phaser', '0.8', '1.0', '3', '0.4', '0.5', '-s'] + expected_args = [ + 'phaser', '0.800000', '1.000000', '3.000000', '0.400000', + '0.500000', '-s'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2721,7 +2823,10 @@ class TestTransformerPhaser(unittest.TestCase): tfm.phaser(delay=5) actual_args = tfm.effects - expected_args = ['phaser', '0.8', '0.74', '5', '0.4', '0.5', '-s'] + expected_args = [ + 'phaser', '0.800000', '0.740000', '5.000000', '0.400000', + '0.500000', '-s' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2738,7 +2843,10 @@ class TestTransformerPhaser(unittest.TestCase): tfm.phaser(decay=0.1) actual_args = tfm.effects - expected_args = ['phaser', '0.8', '0.74', '3', '0.1', '0.5', '-s'] + expected_args = [ + 'phaser', '0.800000', '0.740000', '3.000000', '0.100000', + '0.500000', '-s' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2755,7 +2863,10 @@ class TestTransformerPhaser(unittest.TestCase): tfm.phaser(speed=2) actual_args = tfm.effects - expected_args = ['phaser', '0.8', '0.74', '3', '0.4', '2', '-s'] + expected_args = [ + 'phaser', '0.800000', '0.740000', '3.000000', '0.400000', + '2.000000', '-s' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2772,7 +2883,10 @@ class TestTransformerPhaser(unittest.TestCase): tfm.phaser(modulation_shape='triangular') actual_args = tfm.effects - expected_args = ['phaser', '0.8', '0.74', '3', '0.4', '0.5', '-t'] + expected_args = [ + 'phaser', '0.800000', '0.740000', '3.000000', '0.400000', + '0.500000', '-t' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2792,7 +2906,7 @@ class TestTransformerPitch(unittest.TestCase): tfm.pitch(0.0) actual_args = tfm.effects - expected_args = ['pitch', '0.0'] + expected_args = ['pitch', '0.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -2808,7 +2922,7 @@ class TestTransformerPitch(unittest.TestCase): tfm.pitch(-3.0) actual_args = tfm.effects - expected_args = ['pitch', '-300.0'] + expected_args = ['pitch', '-300.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2820,7 +2934,7 @@ class TestTransformerPitch(unittest.TestCase): tfm.pitch(13.0) actual_args = tfm.effects - expected_args = ['pitch', '1300.0'] + expected_args = ['pitch', '1300.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2837,7 +2951,7 @@ class TestTransformerPitch(unittest.TestCase): tfm.pitch(1.0, quick=True) actual_args = tfm.effects - expected_args = ['pitch', '-q', '100.0'] + expected_args = ['pitch', '-q', '100.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2857,7 +2971,7 @@ class TestTransformerRate(unittest.TestCase): tfm.rate(48000) actual_args = tfm.effects - expected_args = ['rate', '-h', '48000'] + expected_args = ['rate', '-h', '48000.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -2873,7 +2987,7 @@ class TestTransformerRate(unittest.TestCase): tfm.rate(1000.5) actual_args = tfm.effects - expected_args = ['rate', '-h', '1000.5'] + expected_args = ['rate', '-h', '1000.500000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -2890,7 +3004,7 @@ class TestTransformerRate(unittest.TestCase): tfm.rate(44100.0, quality='q') actual_args = tfm.effects - expected_args = ['rate', '-q', '44100.0'] + expected_args = ['rate', '-q', '44100.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3027,7 +3141,10 @@ class TestTransformerReverb(unittest.TestCase): tfm.reverb() actual_args = tfm.effects - expected_args = ['reverb', '50', '50', '100', '100', '0', '0'] + expected_args = [ + 'reverb', '50.000000', '50.000000', '100.000000', '100.000000', + '0.000000', '0.000000' + ] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -3043,7 +3160,10 @@ class TestTransformerReverb(unittest.TestCase): tfm.reverb(reverberance=90) actual_args = tfm.effects - expected_args = ['reverb', '90', '50', '100', '100', '0', '0'] + expected_args = [ + 'reverb', '90.000000', '50.000000', '100.000000', '100.000000', + '0.000000', '0.000000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3060,7 +3180,10 @@ class TestTransformerReverb(unittest.TestCase): tfm.reverb(high_freq_damping=10) actual_args = tfm.effects - expected_args = ['reverb', '50', '10', '100', '100', '0', '0'] + expected_args = [ + 'reverb', '50.000000', '10.000000', '100.000000', '100.000000', + '0.000000', '0.000000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3077,7 +3200,10 @@ class TestTransformerReverb(unittest.TestCase): tfm.reverb(room_scale=10) actual_args = tfm.effects - expected_args = ['reverb', '50', '50', '10', '100', '0', '0'] + expected_args = [ + 'reverb', '50.000000', '50.000000', '10.000000', '100.000000', + '0.000000', '0.000000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3094,7 +3220,10 @@ class TestTransformerReverb(unittest.TestCase): tfm.reverb(stereo_depth=50) actual_args = tfm.effects - expected_args = ['reverb', '50', '50', '100', '50', '0', '0'] + expected_args = [ + 'reverb', '50.000000', '50.000000', '100.000000', '50.000000', + '0.000000', '0.000000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3111,7 +3240,10 @@ class TestTransformerReverb(unittest.TestCase): tfm.reverb(pre_delay=10) actual_args = tfm.effects - expected_args = ['reverb', '50', '50', '100', '100', '10', '0'] + expected_args = [ + 'reverb', '50.000000', '50.000000', '100.000000', '100.000000', + '10.000000', '0.000000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3128,7 +3260,10 @@ class TestTransformerReverb(unittest.TestCase): tfm.reverb(wet_gain=5) actual_args = tfm.effects - expected_args = ['reverb', '50', '50', '100', '100', '0', '5'] + expected_args = [ + 'reverb', '50.000000', '50.000000', '100.000000', '100.000000', + '0.000000', '5.000000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3145,7 +3280,10 @@ class TestTransformerReverb(unittest.TestCase): tfm.reverb(wet_only=True) actual_args = tfm.effects - expected_args = ['reverb', '-w', '50', '50', '100', '100', '0', '0'] + expected_args = [ + 'reverb', '-w', '50.000000', '50.000000', '100.000000', + '100.000000', '0.000000', '0.000000' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3184,7 +3322,10 @@ class TestTransformerSilence(unittest.TestCase): tfm.silence() actual_args = tfm.effects - expected_args = ['silence', '1', '0.1', '0.1%', '-1', '0.1', '0.1%'] + expected_args = [ + 'silence', '1', '0.100000', '0.100000%', + '-1', '0.100000', '0.100000%' + ] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -3200,7 +3341,7 @@ class TestTransformerSilence(unittest.TestCase): tfm.silence(location=1) actual_args = tfm.effects - expected_args = ['silence', '1', '0.1', '0.1%'] + expected_args = ['silence', '1', '0.100000', '0.100000%'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3212,7 +3353,9 @@ class TestTransformerSilence(unittest.TestCase): tfm.silence(location=-1) actual_args = tfm.effects - expected_args = ['reverse', 'silence', '1', '0.1', '0.1%', 'reverse'] + expected_args = [ + 'reverse', 'silence', '1', '0.100000', '0.100000%', 'reverse' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3229,7 +3372,10 @@ class TestTransformerSilence(unittest.TestCase): tfm.silence(silence_threshold=10.5) actual_args = tfm.effects - expected_args = ['silence', '1', '0.1', '10.5%', '-1', '0.1', '10.5%'] + expected_args = [ + 'silence', '1', '0.100000', '10.500000%', + '-1', '0.100000', '10.500000%' + ] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3251,7 +3397,9 @@ class TestTransformerSilence(unittest.TestCase): tfm.silence(min_silence_duration=2) actual_args = tfm.effects - expected_args = ['silence', '1', '2', '0.1%', '-1', '2', '0.1%'] + expected_args = [ + 'silence', '1', '2.000000', '0.100000%', + '-1', '2.000000', '0.100000%'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3269,7 +3417,8 @@ class TestTransformerSilence(unittest.TestCase): actual_args = tfm.effects expected_args = [ - 'silence', '-l', '1', '0.1', '0.1%', '-1', '0.1', '0.1%' + 'silence', '-l', '1', '0.100000', '0.100000%', + '-1', '0.100000', '0.100000%' ] self.assertEqual(expected_args, actual_args) @@ -3290,7 +3439,7 @@ class TestTransformerSinc(unittest.TestCase): tfm.sinc() actual_args = tfm.effects - expected_args = ['sinc', '-a', '120', '3000'] + expected_args = ['sinc', '-a', '120.000000', '3000.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -3306,7 +3455,7 @@ class TestTransformerSinc(unittest.TestCase): tfm.sinc(filter_type='low') actual_args = tfm.effects - expected_args = ['sinc', '-a', '120', '-3000'] + expected_args = ['sinc', '-a', '120.000000', '-3000.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3318,7 +3467,7 @@ class TestTransformerSinc(unittest.TestCase): tfm.sinc(filter_type='pass', cutoff_freq=[3000, 4000]) actual_args = tfm.effects - expected_args = ['sinc', '-a', '120', '3000-4000'] + expected_args = ['sinc', '-a', '120.000000', '3000.000000-4000.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3330,7 +3479,7 @@ class TestTransformerSinc(unittest.TestCase): tfm.sinc(filter_type='reject', cutoff_freq=[3000, 4000]) actual_args = tfm.effects - expected_args = ['sinc', '-a', '120', '4000-3000'] + expected_args = ['sinc', '-a', '120.000000', '4000.000000-3000.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3347,7 +3496,7 @@ class TestTransformerSinc(unittest.TestCase): tfm.sinc(cutoff_freq=300.4) actual_args = tfm.effects - expected_args = ['sinc', '-a', '120', '300.4'] + expected_args = ['sinc', '-a', '120.000000', '300.400000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3359,7 +3508,7 @@ class TestTransformerSinc(unittest.TestCase): tfm.sinc(filter_type='pass', cutoff_freq=[300.4, 1000]) actual_args = tfm.effects - expected_args = ['sinc', '-a', '120', '300.4-1000'] + expected_args = ['sinc', '-a', '120.000000', '300.400000-1000.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3371,7 +3520,7 @@ class TestTransformerSinc(unittest.TestCase): tfm.sinc(filter_type='pass', cutoff_freq=[1000, 300.4]) actual_args = tfm.effects - expected_args = ['sinc', '-a', '120', '300.4-1000'] + expected_args = ['sinc', '-a', '120.000000', '300.400000-1000.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3413,7 +3562,7 @@ class TestTransformerSinc(unittest.TestCase): tfm.sinc(stop_band_attenuation=60) actual_args = tfm.effects - expected_args = ['sinc', '-a', '60', '3000'] + expected_args = ['sinc', '-a', '60.000000', '3000.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3430,7 +3579,9 @@ class TestTransformerSinc(unittest.TestCase): tfm.sinc(filter_type='high', transition_bw=100) actual_args = tfm.effects - expected_args = ['sinc', '-a', '120', '-t', '100', '3000'] + expected_args = [ + 'sinc', '-a', '120.000000', '-t', '100.000000', '3000.000000' + ] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -3446,7 +3597,9 @@ class TestTransformerSinc(unittest.TestCase): tfm.sinc(filter_type='low', transition_bw=100) actual_args = tfm.effects - expected_args = ['sinc', '-a', '120', '-3000', '-t', '100'] + expected_args = [ + 'sinc', '-a', '120.000000', '-3000.000000', '-t', '100.000000' + ] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -3464,7 +3617,10 @@ class TestTransformerSinc(unittest.TestCase): ) actual_args = tfm.effects - expected_args = ['sinc', '-a', '120', '-t', '100', '3000-4000'] + expected_args = [ + 'sinc', '-a', '120.000000', '-t', '100.000000', + '3000.000000-4000.000000' + ] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -3484,7 +3640,8 @@ class TestTransformerSinc(unittest.TestCase): actual_args = tfm.effects expected_args = [ - 'sinc', '-a', '120', '-t', '100', '3000-4000', '-t', '200' + 'sinc', '-a', '120.000000', '-t', '100.000000', + '3000.000000-4000.000000', '-t', '200.000000' ] self.assertEqual(expected_args, actual_args) @@ -3532,7 +3689,9 @@ class TestTransformerSinc(unittest.TestCase): tfm.sinc(phase_response=0) actual_args = tfm.effects - expected_args = ['sinc', '-a', '120', '-p', '0', '3000'] + expected_args = [ + 'sinc', '-a', '120.000000', '-p', '0.000000', '3000.000000' + ] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -3548,7 +3707,9 @@ class TestTransformerSinc(unittest.TestCase): tfm.sinc(phase_response=25) actual_args = tfm.effects - expected_args = ['sinc', '-a', '120', '-p', '25', '3000'] + expected_args = [ + 'sinc', '-a', '120.000000', '-p', '25.000000', '3000.000000' + ] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -3564,7 +3725,9 @@ class TestTransformerSinc(unittest.TestCase): tfm.sinc(phase_response=100) actual_args = tfm.effects - expected_args = ['sinc', '-a', '120', '-p', '100', '3000'] + expected_args = [ + 'sinc', '-a', '120.000000', '-p', '100.000000', '3000.000000' + ] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -3598,7 +3761,7 @@ class TestTransformerSpeed(unittest.TestCase): tfm.speed(1.5) actual_args = tfm.effects - expected_args = ['speed', '1.5'] + expected_args = ['speed', '1.500000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -3614,7 +3777,7 @@ class TestTransformerSpeed(unittest.TestCase): tfm.speed(0.7) actual_args = tfm.effects - expected_args = ['speed', '0.7'] + expected_args = ['speed', '0.700000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3626,7 +3789,7 @@ class TestTransformerSpeed(unittest.TestCase): tfm.speed(2.5) actual_args = tfm.effects - expected_args = ['speed', '2.5'] + expected_args = ['speed', '2.500000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3665,7 +3828,7 @@ class TestTransformerStretch(unittest.TestCase): tfm.stretch(1.1) actual_args = tfm.effects - expected_args = ['stretch', '1.1', '20'] + expected_args = ['stretch', '1.100000', '20.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -3681,7 +3844,7 @@ class TestTransformerStretch(unittest.TestCase): tfm.stretch(0.7) actual_args = tfm.effects - expected_args = ['stretch', '0.7', '20'] + expected_args = ['stretch', '0.700000', '20.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3693,7 +3856,7 @@ class TestTransformerStretch(unittest.TestCase): tfm.stretch(0.2) actual_args = tfm.effects - expected_args = ['stretch', '0.2', '20'] + expected_args = ['stretch', '0.200000', '20.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3710,7 +3873,7 @@ class TestTransformerStretch(unittest.TestCase): tfm.stretch(0.99, window=10) actual_args = tfm.effects - expected_args = ['stretch', '0.99', '10'] + expected_args = ['stretch', '0.990000', '10.000000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3730,7 +3893,7 @@ class TestTransformerTempo(unittest.TestCase): tfm.tempo(1.1) actual_args = tfm.effects - expected_args = ['tempo', '1.1'] + expected_args = ['tempo', '1.100000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -3746,7 +3909,7 @@ class TestTransformerTempo(unittest.TestCase): tfm.tempo(0.9) actual_args = tfm.effects - expected_args = ['tempo', '0.9'] + expected_args = ['tempo', '0.900000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3758,7 +3921,7 @@ class TestTransformerTempo(unittest.TestCase): tfm.tempo(0.1) actual_args = tfm.effects - expected_args = ['tempo', '0.1'] + expected_args = ['tempo', '0.100000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3775,7 +3938,7 @@ class TestTransformerTempo(unittest.TestCase): tfm.tempo(1.5, audio_type='m') actual_args = tfm.effects - expected_args = ['tempo', '-m', '1.5'] + expected_args = ['tempo', '-m', '1.500000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3792,7 +3955,7 @@ class TestTransformerTempo(unittest.TestCase): tfm.tempo(1.5, quick=True) actual_args = tfm.effects - expected_args = ['tempo', '-q', '1.5'] + expected_args = ['tempo', '-q', '1.500000'] self.assertEqual(expected_args, actual_args) actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE) @@ -3812,7 +3975,7 @@ class TestTransformerTreble(unittest.TestCase): tfm.treble(20.0) actual_args = tfm.effects - expected_args = ['treble', '20.0', '3000.0', '0.5s'] + expected_args = ['treble', '20.000000', '3000.000000', '0.500000s'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -3846,7 +4009,7 @@ class TestTransformerTremolo(unittest.TestCase): tfm.tremolo() actual_args = tfm.effects - expected_args = ['tremolo', '6.0', '40.0'] + expected_args = ['tremolo', '6.000000', '40.000000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -3875,7 +4038,7 @@ class TestTransformerTrim(unittest.TestCase): tfm.trim(0, 8.5) actual_args = tfm.effects - expected_args = ['trim', '0', '8.5'] + expected_args = ['trim', '0.000000', '8.500000'] self.assertEqual(expected_args, actual_args) actual_log = tfm.effects_log @@ -3949,11 +4112,11 @@ class TestTransformerVad(unittest.TestCase): actual_args = tfm.effects expected_args = [ 'norm', 'vad', - '-t', '7.0', - '-T', '0.25', - '-s', '1.0', - '-g', '0.25', - '-p', '0.0' + '-t', '7.000000', + '-T', '0.250000', + '-s', '1.000000', + '-g', '0.250000', + '-p', '0.000000' ] self.assertEqual(expected_args, actual_args) @@ -3974,11 +4137,11 @@ class TestTransformerVad(unittest.TestCase): 'norm', 'reverse', 'vad', - '-t', '7.0', - '-T', '0.25', - '-s', '1.0', - '-g', '0.25', - '-p', '0.0', + '-t', '7.000000', + '-T', '0.250000', + '-s', '1.000000', + '-g', '0.250000', + '-p', '0.000000', 'reverse' ] self.assertEqual(expected_args, actual_args) @@ -3998,11 +4161,11 @@ class TestTransformerVad(unittest.TestCase): actual_args = tfm.effects expected_args = [ 'vad', - '-t', '7.0', - '-T', '0.25', - '-s', '1.0', - '-g', '0.25', - '-p', '0.0' + '-t', '7.000000', + '-T', '0.250000', + '-s', '1.000000', + '-g', '0.250000', + '-p', '0.000000' ] self.assertEqual(expected_args, actual_args)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 2 }
1.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[tests]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "pytest-cov", "pytest-pep8" ], "pre_install": [ "apt-get update", "apt-get install -y gcc sox" ], "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
coverage==7.8.0 exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work execnet==2.1.1 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work packaging @ file:///croot/packaging_1734472117206/work pep8==1.7.1 pluggy @ file:///croot/pluggy_1733169602837/work pytest @ file:///croot/pytest_1738938843180/work pytest-cache==1.0 pytest-cov==6.0.0 pytest-pep8==1.0.6 -e git+https://github.com/rabitt/pysox.git@45ae6164cd5da402e063d7d5487b3ebaf895dd4d#egg=sox tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
name: pysox channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - coverage==7.8.0 - execnet==2.1.1 - pep8==1.7.1 - pytest-cache==1.0 - pytest-cov==6.0.0 - pytest-pep8==1.0.6 prefix: /opt/conda/envs/pysox
[ "tests/test_transform.py::TestTransformSetInputFormat::test_rate", "tests/test_transform.py::TestTransformSetInputFormat::test_rate_scinotation", "tests/test_transform.py::TestTransformSetOutputFormat::test_rate", "tests/test_transform.py::TestTransformSetOutputFormat::test_rate_scinotation", "tests/test_transform.py::TestTransformerAllpass::test_default", "tests/test_transform.py::TestTransformerBandpass::test_constant_skirt", "tests/test_transform.py::TestTransformerBandpass::test_default", "tests/test_transform.py::TestTransformerBandreject::test_default", "tests/test_transform.py::TestTransformerBass::test_default", "tests/test_transform.py::TestTransformerBend::test_default", "tests/test_transform.py::TestTransformerBend::test_frame_rate_valid", "tests/test_transform.py::TestTransformerBend::test_oversample_rate_valid", "tests/test_transform.py::TestTransformerBiquad::test_default", "tests/test_transform.py::TestTransformerChorus::test_explicit_args", "tests/test_transform.py::TestTransformerContrast::test_default", "tests/test_transform.py::TestTransformerCompand::test_attack_bigger_decay", "tests/test_transform.py::TestTransformerCompand::test_attack_time_valid", "tests/test_transform.py::TestTransformerCompand::test_decay_time_valid", "tests/test_transform.py::TestTransformerCompand::test_default", "tests/test_transform.py::TestTransformerCompand::test_soft_knee_none", "tests/test_transform.py::TestTransformerCompand::test_soft_knee_valid", "tests/test_transform.py::TestTransformerCompand::test_tf_points_valid", "tests/test_transform.py::TestTransformerConvert::test_samplerate_valid", "tests/test_transform.py::TestTransformerDcshift::test_default", "tests/test_transform.py::TestTransformerDelay::test_default", "tests/test_transform.py::TestTransformerDelay::test_default_three_channel", "tests/test_transform.py::TestTransformerEcho::test_decays_valid", "tests/test_transform.py::TestTransformerEcho::test_default", "tests/test_transform.py::TestTransformerEcho::test_delays_valid", "tests/test_transform.py::TestTransformerEcho::test_gain_in_valid", "tests/test_transform.py::TestTransformerEcho::test_gain_out_valid", "tests/test_transform.py::TestTransformerEcho::test_n_echos_valid", "tests/test_transform.py::TestTransformerEchos::test_decays_valid", "tests/test_transform.py::TestTransformerEchos::test_default", "tests/test_transform.py::TestTransformerEchos::test_delays_valid", "tests/test_transform.py::TestTransformerEchos::test_gain_in_valid", "tests/test_transform.py::TestTransformerEchos::test_gain_out_valid", "tests/test_transform.py::TestTransformerEchos::test_n_echos_valid", "tests/test_transform.py::TestTransformerEqualizer::test_default", "tests/test_transform.py::TestTransformerFade::test_default", "tests/test_transform.py::TestTransformerFade::test_fade_in_valid", "tests/test_transform.py::TestTransformerFade::test_fade_out_valid", "tests/test_transform.py::TestTransformerFade::test_fade_shape_valid", "tests/test_transform.py::TestTransformerFir::test_default", "tests/test_transform.py::TestTransformerFlanger::test_default", "tests/test_transform.py::TestTransformerFlanger::test_flanger_delay_valid", "tests/test_transform.py::TestTransformerFlanger::test_flanger_depth_valid", "tests/test_transform.py::TestTransformerFlanger::test_flanger_interp_valid", "tests/test_transform.py::TestTransformerFlanger::test_flanger_phase_valid", "tests/test_transform.py::TestTransformerFlanger::test_flanger_regen_valid", "tests/test_transform.py::TestTransformerFlanger::test_flanger_shape_valid", "tests/test_transform.py::TestTransformerFlanger::test_flanger_speed_valid", "tests/test_transform.py::TestTransformerFlanger::test_flanger_width_valid", "tests/test_transform.py::TestTransformerGain::test_balance_valid", "tests/test_transform.py::TestTransformerGain::test_default", "tests/test_transform.py::TestTransformerGain::test_gain_db_valid", "tests/test_transform.py::TestTransformerGain::test_limiter_valid", "tests/test_transform.py::TestTransformerGain::test_normalize_valid", "tests/test_transform.py::TestTransformerHighpass::test_default", "tests/test_transform.py::TestTransformerHighpass::test_one_pole", "tests/test_transform.py::TestTransformerLowpass::test_default", "tests/test_transform.py::TestTransformerLowpass::test_one_pole", "tests/test_transform.py::TestTransformerLoudness::test_default", "tests/test_transform.py::TestTransformerLoudness::test_gain_db_valid", "tests/test_transform.py::TestTransformerLoudness::test_reference_level_valid", "tests/test_transform.py::TestTransformerMcompand::test_attack_time_valid", "tests/test_transform.py::TestTransformerMcompand::test_crossover_frequencies_valid", "tests/test_transform.py::TestTransformerMcompand::test_decay_time_valid", "tests/test_transform.py::TestTransformerMcompand::test_default", "tests/test_transform.py::TestTransformerMcompand::test_gain_valid", "tests/test_transform.py::TestTransformerMcompand::test_n_bands_valid", "tests/test_transform.py::TestTransformerMcompand::test_soft_knee_none", "tests/test_transform.py::TestTransformerMcompand::test_soft_knee_valid", "tests/test_transform.py::TestTransformerMcompand::test_tf_points_valid", "tests/test_transform.py::TestTransformerNorm::test_db_level_valid", "tests/test_transform.py::TestTransformerNorm::test_default", "tests/test_transform.py::TestTransformerOverdrive::test_colour_valid", "tests/test_transform.py::TestTransformerOverdrive::test_default", "tests/test_transform.py::TestTransformerOverdrive::test_gain_db_valid", "tests/test_transform.py::TestTransformerPad::test_default", "tests/test_transform.py::TestTransformerPad::test_end_duration_valid", "tests/test_transform.py::TestTransformerPad::test_start_duration_valid", "tests/test_transform.py::TestTransformerPhaser::test_decay_valid", "tests/test_transform.py::TestTransformerPhaser::test_default", "tests/test_transform.py::TestTransformerPhaser::test_delay_valid", "tests/test_transform.py::TestTransformerPhaser::test_gain_in_valid", "tests/test_transform.py::TestTransformerPhaser::test_gain_out_valid", "tests/test_transform.py::TestTransformerPhaser::test_modulation_shape_valid", "tests/test_transform.py::TestTransformerPhaser::test_speed_valid", "tests/test_transform.py::TestTransformerPitch::test_default", "tests/test_transform.py::TestTransformerPitch::test_n_semitones_valid", "tests/test_transform.py::TestTransformerPitch::test_n_semitones_warning", "tests/test_transform.py::TestTransformerPitch::test_quick_valid", "tests/test_transform.py::TestTransformerRate::test_default", "tests/test_transform.py::TestTransformerRate::test_quality_valid", "tests/test_transform.py::TestTransformerRate::test_samplerate_valid", "tests/test_transform.py::TestTransformerReverb::test_default", "tests/test_transform.py::TestTransformerReverb::test_high_freq_damping_valid", "tests/test_transform.py::TestTransformerReverb::test_pre_delay_valid", "tests/test_transform.py::TestTransformerReverb::test_reverberance_valid", "tests/test_transform.py::TestTransformerReverb::test_room_scale_valid", "tests/test_transform.py::TestTransformerReverb::test_stereo_depth_valid", "tests/test_transform.py::TestTransformerReverb::test_wet_gain_valid", "tests/test_transform.py::TestTransformerReverb::test_wet_only_valid", "tests/test_transform.py::TestTransformerSilence::test_buffer_around_silence_valid", "tests/test_transform.py::TestTransformerSilence::test_default", "tests/test_transform.py::TestTransformerSilence::test_location_beginning", "tests/test_transform.py::TestTransformerSilence::test_location_end", "tests/test_transform.py::TestTransformerSilence::test_min_silence_duration_valid", "tests/test_transform.py::TestTransformerSilence::test_silence_threshold_valid", "tests/test_transform.py::TestTransformerSinc::test_cutoff_freq_valid_float", "tests/test_transform.py::TestTransformerSinc::test_cutoff_freq_valid_list", "tests/test_transform.py::TestTransformerSinc::test_cutoff_freq_valid_unordered", "tests/test_transform.py::TestTransformerSinc::test_default", "tests/test_transform.py::TestTransformerSinc::test_filter_type_valid_low", "tests/test_transform.py::TestTransformerSinc::test_filter_type_valid_pass", "tests/test_transform.py::TestTransformerSinc::test_filter_type_valid_reject", "tests/test_transform.py::TestTransformerSinc::test_phase_response_valid_high", "tests/test_transform.py::TestTransformerSinc::test_phase_response_valid_low", "tests/test_transform.py::TestTransformerSinc::test_phase_response_valid_mid", "tests/test_transform.py::TestTransformerSinc::test_stop_band_attenuation_valid", "tests/test_transform.py::TestTransformerSinc::test_transition_bw_valid_high", "tests/test_transform.py::TestTransformerSinc::test_transition_bw_valid_low", "tests/test_transform.py::TestTransformerSinc::test_transition_bw_valid_pass_float", "tests/test_transform.py::TestTransformerSinc::test_transition_bw_valid_pass_list", "tests/test_transform.py::TestTransformerSpeed::test_default", "tests/test_transform.py::TestTransformerSpeed::test_factor_valid", "tests/test_transform.py::TestTransformerSpeed::test_factor_valid_extreme", "tests/test_transform.py::TestTransformerStretch::test_default", "tests/test_transform.py::TestTransformerStretch::test_factor_extreme", "tests/test_transform.py::TestTransformerStretch::test_factor_valid", "tests/test_transform.py::TestTransformerStretch::test_window_valid", "tests/test_transform.py::TestTransformerTempo::test_audio_type_valid", "tests/test_transform.py::TestTransformerTempo::test_default", "tests/test_transform.py::TestTransformerTempo::test_factor_valid", "tests/test_transform.py::TestTransformerTempo::test_factor_warning", "tests/test_transform.py::TestTransformerTempo::test_quick_valid", "tests/test_transform.py::TestTransformerTreble::test_default", "tests/test_transform.py::TestTransformerTremolo::test_default", "tests/test_transform.py::TestTransformerTrim::test_default", "tests/test_transform.py::TestTransformerVad::test_default", "tests/test_transform.py::TestTransformerVad::test_end_location", "tests/test_transform.py::TestTransformerVad::test_no_normalize" ]
[]
[ "tests/test_transform.py::TestTransformDefault::test_effects", "tests/test_transform.py::TestTransformDefault::test_effects_log", "tests/test_transform.py::TestTransformDefault::test_globals", "tests/test_transform.py::TestTransformDefault::test_input_format", "tests/test_transform.py::TestTransformDefault::test_output_format", "tests/test_transform.py::TestTransformSetGlobals::test_defaults", "tests/test_transform.py::TestTransformSetGlobals::test_dither", "tests/test_transform.py::TestTransformSetGlobals::test_dither_invalid", "tests/test_transform.py::TestTransformSetGlobals::test_guard", "tests/test_transform.py::TestTransformSetGlobals::test_guard_invalid", "tests/test_transform.py::TestTransformSetGlobals::test_multithread", "tests/test_transform.py::TestTransformSetGlobals::test_multithread_invalid", "tests/test_transform.py::TestTransformSetGlobals::test_replay_gain", "tests/test_transform.py::TestTransformSetGlobals::test_replay_gain_invalid", "tests/test_transform.py::TestTransformSetGlobals::test_verbosity", "tests/test_transform.py::TestTransformSetGlobals::test_verbosity_invalid", "tests/test_transform.py::TestTransformSetInputFormat::test_bits", "tests/test_transform.py::TestTransformSetInputFormat::test_bits_invalid", "tests/test_transform.py::TestTransformSetInputFormat::test_bits_invalid2", "tests/test_transform.py::TestTransformSetInputFormat::test_channels", "tests/test_transform.py::TestTransformSetInputFormat::test_channels_invalid", "tests/test_transform.py::TestTransformSetInputFormat::test_channels_invalid2", "tests/test_transform.py::TestTransformSetInputFormat::test_defaults", "tests/test_transform.py::TestTransformSetInputFormat::test_encoding", "tests/test_transform.py::TestTransformSetInputFormat::test_encoding_invalid", "tests/test_transform.py::TestTransformSetInputFormat::test_file_type", "tests/test_transform.py::TestTransformSetInputFormat::test_file_type_invalid", "tests/test_transform.py::TestTransformSetInputFormat::test_ignore_length", "tests/test_transform.py::TestTransformSetInputFormat::test_ignore_length_invalid", "tests/test_transform.py::TestTransformSetInputFormat::test_rate_invalid", "tests/test_transform.py::TestTransformSetInputFormat::test_rate_invalid2", "tests/test_transform.py::TestTransformSetOutputFormat::test_append_comments", "tests/test_transform.py::TestTransformSetOutputFormat::test_append_comments_invalid", "tests/test_transform.py::TestTransformSetOutputFormat::test_bits", "tests/test_transform.py::TestTransformSetOutputFormat::test_bits_invalid", "tests/test_transform.py::TestTransformSetOutputFormat::test_bits_invalid2", "tests/test_transform.py::TestTransformSetOutputFormat::test_channels", "tests/test_transform.py::TestTransformSetOutputFormat::test_channels_invalid", "tests/test_transform.py::TestTransformSetOutputFormat::test_channels_invalid2", "tests/test_transform.py::TestTransformSetOutputFormat::test_comments", "tests/test_transform.py::TestTransformSetOutputFormat::test_comments_invalid", "tests/test_transform.py::TestTransformSetOutputFormat::test_defaults", "tests/test_transform.py::TestTransformSetOutputFormat::test_encoding", "tests/test_transform.py::TestTransformSetOutputFormat::test_encoding_invalid", "tests/test_transform.py::TestTransformSetOutputFormat::test_file_type", "tests/test_transform.py::TestTransformSetOutputFormat::test_file_type_invalid", "tests/test_transform.py::TestTransformSetOutputFormat::test_rate_invalid", "tests/test_transform.py::TestTransformSetOutputFormat::test_rate_invalid2", "tests/test_transform.py::TestTransformerBuild::test_failed_sox", "tests/test_transform.py::TestTransformerBuild::test_input_output_equal", "tests/test_transform.py::TestTransformerBuild::test_invalid", "tests/test_transform.py::TestTransformerBuild::test_valid", "tests/test_transform.py::TestTransformerBuild::test_valid_spacey", "tests/test_transform.py::TestTransformerPreview::test_valid", "tests/test_transform.py::TestTransformerAllpass::test_frequency_invalid", "tests/test_transform.py::TestTransformerAllpass::test_width_q_invalid", "tests/test_transform.py::TestTransformerBandpass::test_constant_skirt_invalid", "tests/test_transform.py::TestTransformerBandpass::test_frequency_invalid", "tests/test_transform.py::TestTransformerBandpass::test_width_q_invalid", "tests/test_transform.py::TestTransformerBandreject::test_frequency_invalid", "tests/test_transform.py::TestTransformerBandreject::test_width_q_invalid", "tests/test_transform.py::TestTransformerBass::test_frequency_invalid", "tests/test_transform.py::TestTransformerBass::test_gain_db_invalid", "tests/test_transform.py::TestTransformerBass::test_slope_invalid", "tests/test_transform.py::TestTransformerBend::test_cents_invalid_len", "tests/test_transform.py::TestTransformerBend::test_cents_invalid_nonlist", "tests/test_transform.py::TestTransformerBend::test_cents_invalid_vals", "tests/test_transform.py::TestTransformerBend::test_end_times_invalid_len", "tests/test_transform.py::TestTransformerBend::test_end_times_invalid_nonlist", "tests/test_transform.py::TestTransformerBend::test_end_times_invalid_order", "tests/test_transform.py::TestTransformerBend::test_end_times_invalid_vals", "tests/test_transform.py::TestTransformerBend::test_frame_rate_invalid", "tests/test_transform.py::TestTransformerBend::test_n_bends_invalid", "tests/test_transform.py::TestTransformerBend::test_overlapping_intervals", "tests/test_transform.py::TestTransformerBend::test_oversample_rate_invalid", "tests/test_transform.py::TestTransformerBend::test_start_greater_end", "tests/test_transform.py::TestTransformerBend::test_start_times_invalid_len", "tests/test_transform.py::TestTransformerBend::test_start_times_invalid_nonlist", "tests/test_transform.py::TestTransformerBend::test_start_times_invalid_order", "tests/test_transform.py::TestTransformerBend::test_start_times_invalid_vals", "tests/test_transform.py::TestTransformerBiquad::test_a_non_num", "tests/test_transform.py::TestTransformerBiquad::test_a_nonlist", "tests/test_transform.py::TestTransformerBiquad::test_a_wrong_len", "tests/test_transform.py::TestTransformerBiquad::test_b_non_num", "tests/test_transform.py::TestTransformerBiquad::test_b_nonlist", "tests/test_transform.py::TestTransformerBiquad::test_b_wrong_len", "tests/test_transform.py::TestTransformerChannels::test_default", "tests/test_transform.py::TestTransformerChannels::test_invalid_nchannels", "tests/test_transform.py::TestTransformerChorus::test_default", "tests/test_transform.py::TestTransformerChorus::test_invalid_decays", "tests/test_transform.py::TestTransformerChorus::test_invalid_decays_vals", "tests/test_transform.py::TestTransformerChorus::test_invalid_decays_wronglen", "tests/test_transform.py::TestTransformerChorus::test_invalid_delays", "tests/test_transform.py::TestTransformerChorus::test_invalid_delays_vals", "tests/test_transform.py::TestTransformerChorus::test_invalid_delays_wronglen", "tests/test_transform.py::TestTransformerChorus::test_invalid_depths", "tests/test_transform.py::TestTransformerChorus::test_invalid_depths_vals", "tests/test_transform.py::TestTransformerChorus::test_invalid_depths_wronglen", "tests/test_transform.py::TestTransformerChorus::test_invalid_gain_in", "tests/test_transform.py::TestTransformerChorus::test_invalid_gain_out", "tests/test_transform.py::TestTransformerChorus::test_invalid_n_voices", "tests/test_transform.py::TestTransformerChorus::test_invalid_shapes", "tests/test_transform.py::TestTransformerChorus::test_invalid_shapes_vals", "tests/test_transform.py::TestTransformerChorus::test_invalid_shapes_wronglen", "tests/test_transform.py::TestTransformerChorus::test_invalid_speeds", "tests/test_transform.py::TestTransformerChorus::test_invalid_speeds_vals", "tests/test_transform.py::TestTransformerChorus::test_invalid_speeds_wronglen", "tests/test_transform.py::TestTransformerContrast::test_invalid_amount_big", "tests/test_transform.py::TestTransformerContrast::test_invalid_amount_neg", "tests/test_transform.py::TestTransformerContrast::test_invalid_amount_nonnum", "tests/test_transform.py::TestTransformerCompand::test_attack_time_invalid_neg", "tests/test_transform.py::TestTransformerCompand::test_attack_time_invalid_nonnum", "tests/test_transform.py::TestTransformerCompand::test_decay_time_invalid_neg", "tests/test_transform.py::TestTransformerCompand::test_decay_time_invalid_nonnum", "tests/test_transform.py::TestTransformerCompand::test_soft_knee_invalid", "tests/test_transform.py::TestTransformerCompand::test_tf_points_empty", "tests/test_transform.py::TestTransformerCompand::test_tf_points_nonlist", "tests/test_transform.py::TestTransformerCompand::test_tf_points_nontuples", "tests/test_transform.py::TestTransformerCompand::test_tf_points_tup_dups", "tests/test_transform.py::TestTransformerCompand::test_tf_points_tup_len", "tests/test_transform.py::TestTransformerCompand::test_tf_points_tup_nonnum", "tests/test_transform.py::TestTransformerCompand::test_tf_points_tup_nonnum2", "tests/test_transform.py::TestTransformerCompand::test_tf_points_tup_positive", "tests/test_transform.py::TestTransformerConvert::test_bitdepth_invalid", "tests/test_transform.py::TestTransformerConvert::test_bitdepth_valid", "tests/test_transform.py::TestTransformerConvert::test_channels_invalid1", "tests/test_transform.py::TestTransformerConvert::test_channels_invalid2", "tests/test_transform.py::TestTransformerConvert::test_channels_valid", "tests/test_transform.py::TestTransformerConvert::test_default", "tests/test_transform.py::TestTransformerConvert::test_samplerate_invalid", "tests/test_transform.py::TestTransformerDcshift::test_invalid_shift_big", "tests/test_transform.py::TestTransformerDcshift::test_invalid_shift_neg", "tests/test_transform.py::TestTransformerDcshift::test_invalid_shift_nonnum", "tests/test_transform.py::TestTransformerDeemph::test_default", "tests/test_transform.py::TestTransformerDelay::test_invalid_position_type", "tests/test_transform.py::TestTransformerDelay::test_invalid_position_vals", "tests/test_transform.py::TestTransformerDownsample::test_default", "tests/test_transform.py::TestTransformerDownsample::test_invalid_factor_neg", "tests/test_transform.py::TestTransformerDownsample::test_invalid_factor_nonnum", "tests/test_transform.py::TestTransformerEarwax::test_default", "tests/test_transform.py::TestTransformerEcho::test_decays_invalid_len", "tests/test_transform.py::TestTransformerEcho::test_decays_invalid_type", "tests/test_transform.py::TestTransformerEcho::test_decays_invalid_vals", "tests/test_transform.py::TestTransformerEcho::test_delays_invalid_len", "tests/test_transform.py::TestTransformerEcho::test_delays_invalid_type", "tests/test_transform.py::TestTransformerEcho::test_delays_invalid_vals", "tests/test_transform.py::TestTransformerEcho::test_gain_in_invalid", "tests/test_transform.py::TestTransformerEcho::test_gain_out_invalid", "tests/test_transform.py::TestTransformerEcho::test_n_echos_invalid", "tests/test_transform.py::TestTransformerEchos::test_decays_invalid_len", "tests/test_transform.py::TestTransformerEchos::test_decays_invalid_type", "tests/test_transform.py::TestTransformerEchos::test_decays_invalid_vals", "tests/test_transform.py::TestTransformerEchos::test_delays_invalid_len", "tests/test_transform.py::TestTransformerEchos::test_delays_invalid_type", "tests/test_transform.py::TestTransformerEchos::test_delays_invalid_vals", "tests/test_transform.py::TestTransformerEchos::test_gain_in_invalid", "tests/test_transform.py::TestTransformerEchos::test_gain_out_invalid", "tests/test_transform.py::TestTransformerEchos::test_n_echos_invalid", "tests/test_transform.py::TestTransformerEqualizer::test_frequency_invalid", "tests/test_transform.py::TestTransformerEqualizer::test_gain_db_invalid", "tests/test_transform.py::TestTransformerEqualizer::test_width_q_invalid", "tests/test_transform.py::TestTransformerFade::test_fade_in_invalid", "tests/test_transform.py::TestTransformerFade::test_fade_out_invalid", "tests/test_transform.py::TestTransformerFade::test_fade_shape_invalid", "tests/test_transform.py::TestTransformerFir::test_invalid_coeffs_nonlist", "tests/test_transform.py::TestTransformerFir::test_invalid_coeffs_vals", "tests/test_transform.py::TestTransformerFlanger::test_flanger_delay_invalid", "tests/test_transform.py::TestTransformerFlanger::test_flanger_depth_invalid", "tests/test_transform.py::TestTransformerFlanger::test_flanger_interp_invalid", "tests/test_transform.py::TestTransformerFlanger::test_flanger_phase_invalid", "tests/test_transform.py::TestTransformerFlanger::test_flanger_regen_invalid", "tests/test_transform.py::TestTransformerFlanger::test_flanger_shape_invalid", "tests/test_transform.py::TestTransformerFlanger::test_flanger_speed_invalid", "tests/test_transform.py::TestTransformerFlanger::test_flanger_width_invalid", "tests/test_transform.py::TestTransformerGain::test_balance_invalid", "tests/test_transform.py::TestTransformerGain::test_gain_db_invalid", "tests/test_transform.py::TestTransformerGain::test_limiter_invalid", "tests/test_transform.py::TestTransformerGain::test_normalize_invalid", "tests/test_transform.py::TestTransformerHighpass::test_frequency_invalid", "tests/test_transform.py::TestTransformerHighpass::test_n_poles_invalid", "tests/test_transform.py::TestTransformerHighpass::test_width_q_invalid", "tests/test_transform.py::TestTransformerHilbert::test_default", "tests/test_transform.py::TestTransformerHilbert::test_num_taps_invalid", "tests/test_transform.py::TestTransformerHilbert::test_num_taps_invalid_even", "tests/test_transform.py::TestTransformerHilbert::test_num_taps_valid", "tests/test_transform.py::TestTransformerLowpass::test_frequency_invalid", "tests/test_transform.py::TestTransformerLowpass::test_n_poles_invalid", "tests/test_transform.py::TestTransformerLowpass::test_width_q_invalid", "tests/test_transform.py::TestTransformerLoudness::test_gain_db_invalid", "tests/test_transform.py::TestTransformerLoudness::test_reference_level_invalid", "tests/test_transform.py::TestTransformerLoudness::test_reference_level_oorange", "tests/test_transform.py::TestTransformerMcompand::test_attack_time_invalid_len", "tests/test_transform.py::TestTransformerMcompand::test_attack_time_invalid_neg", "tests/test_transform.py::TestTransformerMcompand::test_attack_time_invalid_nonnum", "tests/test_transform.py::TestTransformerMcompand::test_attack_time_invalid_type", "tests/test_transform.py::TestTransformerMcompand::test_crossover_frequencies_invalid", "tests/test_transform.py::TestTransformerMcompand::test_crossover_frequencies_invalid_vals", "tests/test_transform.py::TestTransformerMcompand::test_decay_time_invalid_len", "tests/test_transform.py::TestTransformerMcompand::test_decay_time_invalid_neg", "tests/test_transform.py::TestTransformerMcompand::test_decay_time_invalid_nonnum", "tests/test_transform.py::TestTransformerMcompand::test_decay_time_invalid_type", "tests/test_transform.py::TestTransformerMcompand::test_gain_len_invalid", "tests/test_transform.py::TestTransformerMcompand::test_gain_values_invalid", "tests/test_transform.py::TestTransformerMcompand::test_n_bands_invalid", "tests/test_transform.py::TestTransformerMcompand::test_soft_knee_db_invalid_len", "tests/test_transform.py::TestTransformerMcompand::test_soft_knee_db_invalid_type", "tests/test_transform.py::TestTransformerMcompand::test_soft_knee_invalid", "tests/test_transform.py::TestTransformerMcompand::test_tf_points_elt_empty", "tests/test_transform.py::TestTransformerMcompand::test_tf_points_elt_nonlist", "tests/test_transform.py::TestTransformerMcompand::test_tf_points_elt_nontuples", "tests/test_transform.py::TestTransformerMcompand::test_tf_points_elt_tup_len", "tests/test_transform.py::TestTransformerMcompand::test_tf_points_elt_tup_nonnum", "tests/test_transform.py::TestTransformerMcompand::test_tf_points_tup_dups", "tests/test_transform.py::TestTransformerMcompand::test_tf_points_tup_nonnum2", "tests/test_transform.py::TestTransformerMcompand::test_tf_points_tup_positive", "tests/test_transform.py::TestTransformerMcompand::test_tf_points_wrong_len", "tests/test_transform.py::TestTransformerNorm::test_db_level_invalid", "tests/test_transform.py::TestTransformerOops::test_default", "tests/test_transform.py::TestTransformerOverdrive::test_colour_invalid", "tests/test_transform.py::TestTransformerOverdrive::test_gain_db_invalid", "tests/test_transform.py::TestTransformerPad::test_end_duration_invalid", "tests/test_transform.py::TestTransformerPad::test_start_duration_invalid", "tests/test_transform.py::TestTransformerPhaser::test_decay_invalid", "tests/test_transform.py::TestTransformerPhaser::test_delay_invalid", "tests/test_transform.py::TestTransformerPhaser::test_gain_in_invalid", "tests/test_transform.py::TestTransformerPhaser::test_gain_out_invalid", "tests/test_transform.py::TestTransformerPhaser::test_modulation_shape_invalid", "tests/test_transform.py::TestTransformerPhaser::test_speed_invalid", "tests/test_transform.py::TestTransformerPitch::test_n_semitones_invalid", "tests/test_transform.py::TestTransformerPitch::test_quick_invalid", "tests/test_transform.py::TestTransformerRate::test_quality_invalid", "tests/test_transform.py::TestTransformerRate::test_samplerate_invalid", "tests/test_transform.py::TestTransformerRemix::test_default", "tests/test_transform.py::TestTransformerRemix::test_num_channels_valid", "tests/test_transform.py::TestTransformerRemix::test_num_output_channels_invalid", "tests/test_transform.py::TestTransformerRemix::test_remix_dict_invalid", "tests/test_transform.py::TestTransformerRemix::test_remix_dict_invalid2", "tests/test_transform.py::TestTransformerRemix::test_remix_dict_invalid3", "tests/test_transform.py::TestTransformerRemix::test_remix_dict_invalid4", "tests/test_transform.py::TestTransformerRemix::test_remix_dictionary_none", "tests/test_transform.py::TestTransformerRemix::test_remix_dictionary_valid", "tests/test_transform.py::TestTransformerRepeat::test_count_invalid", "tests/test_transform.py::TestTransformerRepeat::test_count_invalid_fmt", "tests/test_transform.py::TestTransformerRepeat::test_count_valid", "tests/test_transform.py::TestTransformerRepeat::test_default", "tests/test_transform.py::TestTransformerReverb::test_high_freq_damping_invalid", "tests/test_transform.py::TestTransformerReverb::test_pre_delay_invalid", "tests/test_transform.py::TestTransformerReverb::test_reverberance_invalid", "tests/test_transform.py::TestTransformerReverb::test_room_scale_invalid", "tests/test_transform.py::TestTransformerReverb::test_stereo_depth_invalid", "tests/test_transform.py::TestTransformerReverb::test_wet_gain_invalid", "tests/test_transform.py::TestTransformerReverb::test_wet_only_invalid", "tests/test_transform.py::TestTransformerReverse::test_default", "tests/test_transform.py::TestTransformerSilence::test_buffer_around_silence_invalid", "tests/test_transform.py::TestTransformerSilence::test_location_invalid", "tests/test_transform.py::TestTransformerSilence::test_min_silence_duration_invalid", "tests/test_transform.py::TestTransformerSilence::test_silence_threshold_invalid", "tests/test_transform.py::TestTransformerSilence::test_silence_threshold_invalid2", "tests/test_transform.py::TestTransformerSinc::test_cutoff_freq_invalid", "tests/test_transform.py::TestTransformerSinc::test_cutoff_freq_invalid_high", "tests/test_transform.py::TestTransformerSinc::test_cutoff_freq_invalid_list", "tests/test_transform.py::TestTransformerSinc::test_cutoff_freq_invalid_list_len", "tests/test_transform.py::TestTransformerSinc::test_cutoff_freq_invalid_number", "tests/test_transform.py::TestTransformerSinc::test_cutoff_freq_invalid_reject", "tests/test_transform.py::TestTransformerSinc::test_filter_type_invalid", "tests/test_transform.py::TestTransformerSinc::test_phase_response_invalid", "tests/test_transform.py::TestTransformerSinc::test_phase_response_invalid_large", "tests/test_transform.py::TestTransformerSinc::test_phase_response_invalid_small", "tests/test_transform.py::TestTransformerSinc::test_stop_band_attenuation_invalid", "tests/test_transform.py::TestTransformerSinc::test_transition_bw_invalid", "tests/test_transform.py::TestTransformerSinc::test_transition_bw_invalid_float", "tests/test_transform.py::TestTransformerSinc::test_transition_bw_invalid_list_elt", "tests/test_transform.py::TestTransformerSinc::test_transition_bw_invalid_low", "tests/test_transform.py::TestTransformerSinc::test_transition_bw_linvalid_list_len", "tests/test_transform.py::TestTransformerSpeed::test_factor_invalid", "tests/test_transform.py::TestTransformerSwap::test_default", "tests/test_transform.py::TestTransformerStretch::test_factor_invalid", "tests/test_transform.py::TestTransformerStretch::test_window_invalid", "tests/test_transform.py::TestTransformerTempo::test_audio_type_invalid", "tests/test_transform.py::TestTransformerTempo::test_factor_invalid", "tests/test_transform.py::TestTransformerTempo::test_quick_invalid", "tests/test_transform.py::TestTransformerTreble::test_frequency_invalid", "tests/test_transform.py::TestTransformerTreble::test_gain_db_invalid", "tests/test_transform.py::TestTransformerTreble::test_slope_invalid", "tests/test_transform.py::TestTransformerTremolo::test_depth_invalid", "tests/test_transform.py::TestTransformerTremolo::test_speed_invalid", "tests/test_transform.py::TestTransformerTrim::test_invalid_end_time", "tests/test_transform.py::TestTransformerTrim::test_invalid_start_time", "tests/test_transform.py::TestTransformerTrim::test_invalid_time_pair", "tests/test_transform.py::TestTransformerUpsample::test_default", "tests/test_transform.py::TestTransformerUpsample::test_invalid_factor_decimal", "tests/test_transform.py::TestTransformerUpsample::test_invalid_factor_neg", "tests/test_transform.py::TestTransformerUpsample::test_invalid_factor_nonnum", "tests/test_transform.py::TestTransformerVad::test_invalid_activity_threshold", "tests/test_transform.py::TestTransformerVad::test_invalid_initial_pad", "tests/test_transform.py::TestTransformerVad::test_invalid_initial_search_buffer", "tests/test_transform.py::TestTransformerVad::test_invalid_location", "tests/test_transform.py::TestTransformerVad::test_invalid_max_gap", "tests/test_transform.py::TestTransformerVad::test_invalid_min_activity_duration", "tests/test_transform.py::TestTransformerVad::test_invalid_normalize" ]
[]
BSD 3-Clause "New" or "Revised" License
1,018
[ "sox/transform.py", "sox/version.py" ]
[ "sox/transform.py", "sox/version.py" ]
bear__python-twitter-439
c28e9fb02680f30c9c56019f6836c2b47fa1d73a
2017-02-14 01:01:12
c28e9fb02680f30c9c56019f6836c2b47fa1d73a
diff --git a/twitter/api.py b/twitter/api.py index 94ec354..d41a648 100644 --- a/twitter/api.py +++ b/twitter/api.py @@ -1026,6 +1026,7 @@ class Api(object): parameters['attachment_url'] = attachment_url if media: + chunked_types = ['video/mp4', 'video/quicktime', 'image/gif'] media_ids = [] if isinstance(media, int): media_ids.append(media) @@ -1041,9 +1042,8 @@ class Api(object): _, _, file_size, media_type = parse_media_file(media_file) if media_type == 'image/gif' or media_type == 'video/mp4': raise TwitterError( - 'You cannot post more than 1 GIF or 1 video in a ' - 'single status.') - if file_size > self.chunk_size: + 'You cannot post more than 1 GIF or 1 video in a single status.') + if file_size > self.chunk_size or media_type in chunked_types: media_id = self.UploadMediaChunked( media=media_file, additional_owners=media_additional_owners, @@ -1055,13 +1055,11 @@ class Api(object): media_category=media_category) media_ids.append(media_id) else: - _, _, file_size, _ = parse_media_file(media) - if file_size > self.chunk_size: - media_ids.append( - self.UploadMediaChunked(media, media_additional_owners)) + _, _, file_size, media_type = parse_media_file(media) + if file_size > self.chunk_size or media_type in chunked_types: + media_ids.append(self.UploadMediaChunked(media, media_additional_owners)) else: - media_ids.append( - self.UploadMediaSimple(media, media_additional_owners)) + media_ids.append(self.UploadMediaSimple(media, media_additional_owners)) parameters['media_ids'] = ','.join([str(mid) for mid in media_ids]) if latitude is not None and longitude is not None: @@ -1263,7 +1261,7 @@ class Api(object): try: media_fp.close() - except: + except Exception as e: pass return True diff --git a/twitter/twitter_utils.py b/twitter/twitter_utils.py index 0b2af5b..66ce8b2 100644 --- a/twitter/twitter_utils.py +++ b/twitter/twitter_utils.py @@ -223,8 +223,8 @@ def parse_media_file(passed_media): # Otherwise, if a file object was passed in the first place, # create the standard reference to media_file (i.e., rename it to fp). else: - if passed_media.mode != 'rb': - raise TwitterError({'message': 'File mode must be "rb".'}) + if passed_media.mode not in ['rb', 'rb+', 'w+b']: + raise TwitterError('File mode must be "rb" or "rb+"') filename = os.path.basename(passed_media.name) data_file = passed_media @@ -233,7 +233,7 @@ def parse_media_file(passed_media): try: data_file.seek(0) - except: + except Exception as e: pass media_type = mimetypes.guess_type(os.path.basename(filename))[0]
Issue with PostUpdate and <1MB mp4 media files When trying post an update using the following code: ```python api = twitter.Api(options) api.VerifyCredentials() api.PostUpdate('My status', media='/my/local/file.mp4') ``` Twitter would respond with the error 'media type unrecognized'. The call worked sometimes but not always but I was finally able to narrow down the issue to the size of the mp4 file. While searching for the error message I found this http://stackoverflow.com/a/32250580. According to the author if the upload is a video file (mp4) it must always be uploaded via the chunked upload API endpoint. I was unable to verify this in the Twitter API docs (like here: https://dev.twitter.com/rest/media/uploading-media.html) but once I added a smaller chunk_size to my init (chunk_size=1024*16) all PostUpdate calls worked as expected. This (to me) is a dirty fix but it works for me and it should work for anyone else with a similar issue. The question is should the library here be updated to automatically reduce the chunk size when uploading mp4 files? I am not sure as I was unable to find any other information in the Twitter docs as to this mp4 chunked upload only restriction. But if the linked article is correct there should probably be some logic added into the PostUpdate code that would take into account if the video file is < 1MB in size.
bear/python-twitter
diff --git a/tests/test_api_30.py b/tests/test_api_30.py index b966c70..67d7b33 100644 --- a/tests/test_api_30.py +++ b/tests/test_api_30.py @@ -2,9 +2,15 @@ from __future__ import unicode_literals, print_function import json +import os import re import sys +from tempfile import NamedTemporaryFile import unittest +try: + from unittest.mock import patch +except ImportError: + from mock import patch import warnings import twitter @@ -1713,3 +1719,16 @@ class ApiTest(unittest.TestCase): with warnings.catch_warnings(record=True) as w: resp = self.api.UpdateBackgroundImage(image='testdata/168NQ.jpg') self.assertTrue(issubclass(w[0].category, DeprecationWarning)) + + @responses.activate + @patch('twitter.api.Api.UploadMediaChunked') + def test_UploadSmallVideoUsesChunkedData(self, mocker): + responses.add(POST, DEFAULT_URL, body='{}') + video = NamedTemporaryFile(suffix='.mp4') + video.write(b'10' * 1024) + video.seek(0, 0) + + resp = self.api.PostUpdate('test', media=video) + assert os.path.getsize(video.name) <= 1024 * 1024 + assert isinstance(resp, twitter.Status) + assert twitter.api.Api.UploadMediaChunked.called
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_media", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 1 }, "num_modified_files": 2 }
3.2
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov" ], "pre_install": null, "python": "3.9", "reqs_path": [ "requirements.txt", "requirements.testing.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
build==1.2.2.post1 cachetools==5.5.2 certifi==2025.1.31 chardet==5.2.0 charset-normalizer==3.4.1 check-manifest==0.50 codecov==2.1.13 colorama==0.4.6 coverage==7.8.0 coveralls==4.0.1 distlib==0.3.9 docopt==0.6.2 exceptiongroup==1.2.2 filelock==3.18.0 future==1.0.0 idna==3.10 importlib_metadata==8.6.1 iniconfig==2.1.0 mccabe==0.7.0 mock==5.2.0 oauthlib==3.2.2 packaging==24.2 platformdirs==4.3.7 pluggy==1.5.0 pycodestyle==2.13.0 pyproject-api==1.9.0 pyproject_hooks==1.2.0 pytest==8.3.5 pytest-cov==6.0.0 pytest-runner==6.0.1 -e git+https://github.com/bear/python-twitter.git@c28e9fb02680f30c9c56019f6836c2b47fa1d73a#egg=python_twitter PyYAML==6.0.2 requests==2.32.3 requests-oauthlib==2.0.0 responses==0.25.7 six==1.17.0 tomli==2.2.1 tox==4.25.0 tox-pyenv==1.1.0 typing_extensions==4.13.0 urllib3==2.3.0 virtualenv==20.29.3 zipp==3.21.0
name: python-twitter channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - build==1.2.2.post1 - cachetools==5.5.2 - certifi==2025.1.31 - chardet==5.2.0 - charset-normalizer==3.4.1 - check-manifest==0.50 - codecov==2.1.13 - colorama==0.4.6 - coverage==7.8.0 - coveralls==4.0.1 - distlib==0.3.9 - docopt==0.6.2 - exceptiongroup==1.2.2 - filelock==3.18.0 - future==1.0.0 - idna==3.10 - importlib-metadata==8.6.1 - iniconfig==2.1.0 - mccabe==0.7.0 - mock==5.2.0 - oauthlib==3.2.2 - packaging==24.2 - platformdirs==4.3.7 - pluggy==1.5.0 - pycodestyle==2.13.0 - pyproject-api==1.9.0 - pyproject-hooks==1.2.0 - pytest==8.3.5 - pytest-cov==6.0.0 - pytest-runner==6.0.1 - pyyaml==6.0.2 - requests==2.32.3 - requests-oauthlib==2.0.0 - responses==0.25.7 - six==1.17.0 - tomli==2.2.1 - tox==4.25.0 - tox-pyenv==1.1.0 - typing-extensions==4.13.0 - urllib3==2.3.0 - virtualenv==20.29.3 - zipp==3.21.0 prefix: /opt/conda/envs/python-twitter
[ "tests/test_api_30.py::ApiTest::test_UploadSmallVideoUsesChunkedData" ]
[]
[ "tests/test_api_30.py::ApiTest::testApiRaisesAuthErrors", "tests/test_api_30.py::ApiTest::testApiSetUp", "tests/test_api_30.py::ApiTest::testCreateBlock", "tests/test_api_30.py::ApiTest::testCreateFavorite", "tests/test_api_30.py::ApiTest::testCreateList", "tests/test_api_30.py::ApiTest::testCreateListsMember", "tests/test_api_30.py::ApiTest::testCreateListsMemberMultiple", "tests/test_api_30.py::ApiTest::testCreateMute", "tests/test_api_30.py::ApiTest::testCreateSubscription", "tests/test_api_30.py::ApiTest::testDestroyBlock", "tests/test_api_30.py::ApiTest::testDestroyDirectMessage", "tests/test_api_30.py::ApiTest::testDestroyFavorite", "tests/test_api_30.py::ApiTest::testDestroyList", "tests/test_api_30.py::ApiTest::testDestroyListsMember", "tests/test_api_30.py::ApiTest::testDestroyListsMemberMultiple", "tests/test_api_30.py::ApiTest::testDestroyMute", "tests/test_api_30.py::ApiTest::testDestroyStatus", "tests/test_api_30.py::ApiTest::testDestroySubscription", "tests/test_api_30.py::ApiTest::testFriendsErrorChecking", "tests/test_api_30.py::ApiTest::testGetBlocks", "tests/test_api_30.py::ApiTest::testGetBlocksIDs", "tests/test_api_30.py::ApiTest::testGetBlocksIDsPaged", "tests/test_api_30.py::ApiTest::testGetBlocksPaged", "tests/test_api_30.py::ApiTest::testGetDirectMessages", "tests/test_api_30.py::ApiTest::testGetFavorites", "tests/test_api_30.py::ApiTest::testGetFollowerIDsPaged", "tests/test_api_30.py::ApiTest::testGetFollowers", "tests/test_api_30.py::ApiTest::testGetFollowersIDs", "tests/test_api_30.py::ApiTest::testGetFollowersPaged", "tests/test_api_30.py::ApiTest::testGetFriendIDs", "tests/test_api_30.py::ApiTest::testGetFriendIDsPaged", "tests/test_api_30.py::ApiTest::testGetFriends", "tests/test_api_30.py::ApiTest::testGetFriendsAdditionalParams", "tests/test_api_30.py::ApiTest::testGetFriendsPaged", "tests/test_api_30.py::ApiTest::testGetFriendsPagedUID", "tests/test_api_30.py::ApiTest::testGetFriendsWithLimit", "tests/test_api_30.py::ApiTest::testGetHelpConfiguration", "tests/test_api_30.py::ApiTest::testGetHomeTimeline", "tests/test_api_30.py::ApiTest::testGetHomeTimelineWithExclusions", "tests/test_api_30.py::ApiTest::testGetListMembers", "tests/test_api_30.py::ApiTest::testGetListMembersPaged", "tests/test_api_30.py::ApiTest::testGetListTimeline", "tests/test_api_30.py::ApiTest::testGetLists", "tests/test_api_30.py::ApiTest::testGetListsList", "tests/test_api_30.py::ApiTest::testGetMemberships", "tests/test_api_30.py::ApiTest::testGetMentions", "tests/test_api_30.py::ApiTest::testGetMutes", "tests/test_api_30.py::ApiTest::testGetMutesIDs", "tests/test_api_30.py::ApiTest::testGetRetweeters", "tests/test_api_30.py::ApiTest::testGetRetweets", "tests/test_api_30.py::ApiTest::testGetRetweetsCount", "tests/test_api_30.py::ApiTest::testGetSeachRawQuery", "tests/test_api_30.py::ApiTest::testGetSearch", "tests/test_api_30.py::ApiTest::testGetSearchGeocode", "tests/test_api_30.py::ApiTest::testGetSentDirectMessages", "tests/test_api_30.py::ApiTest::testGetShortUrlLength", "tests/test_api_30.py::ApiTest::testGetStatus", "tests/test_api_30.py::ApiTest::testGetStatusExtraParams", "tests/test_api_30.py::ApiTest::testGetStatusOembed", "tests/test_api_30.py::ApiTest::testGetStatusWithExtAltText", "tests/test_api_30.py::ApiTest::testGetSubscriptions", "tests/test_api_30.py::ApiTest::testGetSubscriptionsSN", "tests/test_api_30.py::ApiTest::testGetTrendsCurrent", "tests/test_api_30.py::ApiTest::testGetUser", "tests/test_api_30.py::ApiTest::testGetUserSuggestion", "tests/test_api_30.py::ApiTest::testGetUserSuggestionCategories", "tests/test_api_30.py::ApiTest::testGetUserTimeSinceMax", "tests/test_api_30.py::ApiTest::testGetUserTimelineByScreenName", "tests/test_api_30.py::ApiTest::testGetUserTimelineByUserID", "tests/test_api_30.py::ApiTest::testGetUserTimelineCount", "tests/test_api_30.py::ApiTest::testGetUsersSearch", "tests/test_api_30.py::ApiTest::testLookupFriendship", "tests/test_api_30.py::ApiTest::testLookupFriendshipBlockMute", "tests/test_api_30.py::ApiTest::testLookupFriendshipMute", "tests/test_api_30.py::ApiTest::testMuteBlockParamsAndErrors", "tests/test_api_30.py::ApiTest::testPostDirectMessage", "tests/test_api_30.py::ApiTest::testPostMediaMetadata", "tests/test_api_30.py::ApiTest::testPostUpdate", "tests/test_api_30.py::ApiTest::testPostUpdateExtraParams", "tests/test_api_30.py::ApiTest::testPostUpdateWithMedia", "tests/test_api_30.py::ApiTest::testPostUploadMediaChunkedAppend", "tests/test_api_30.py::ApiTest::testPostUploadMediaChunkedAppendNonASCIIFilename", "tests/test_api_30.py::ApiTest::testPostUploadMediaChunkedFinalize", "tests/test_api_30.py::ApiTest::testPostUploadMediaChunkedInit", "tests/test_api_30.py::ApiTest::testSetAndClearCredentials", "tests/test_api_30.py::ApiTest::testShowFriendship", "tests/test_api_30.py::ApiTest::testShowSubscription", "tests/test_api_30.py::ApiTest::testUpdateBanner", "tests/test_api_30.py::ApiTest::testUpdateBanner400Error", "tests/test_api_30.py::ApiTest::testUpdateBanner422Error", "tests/test_api_30.py::ApiTest::testUsersLookup", "tests/test_api_30.py::ApiTest::testVerifyCredentials", "tests/test_api_30.py::ApiTest::testVerifyCredentialsIncludeEmail", "tests/test_api_30.py::ApiTest::test_UpdateBackgroundImage_deprecation" ]
[]
Apache License 2.0
1,019
[ "twitter/api.py", "twitter/twitter_utils.py" ]
[ "twitter/api.py", "twitter/twitter_utils.py" ]
swaroopch__edn_format-36
0616eb18781cd9d9394683b806b0b3033b47f371
2017-02-14 10:07:46
7a3865c6d7ddc1a8d2d8ecb4114f11ed8b96fda8
diff --git a/edn_format/edn_lex.py b/edn_format/edn_lex.py index 42fdea7..e3b729e 100644 --- a/edn_format/edn_lex.py +++ b/edn_format/edn_lex.py @@ -193,13 +193,13 @@ def t_BOOLEAN(t): def t_FLOAT(t): - r"""[+-]?\d+\.\d+[M]?([eE][+-]?\d+)?""" + r"""[+-]?\d+(?:\.\d+([eE][+-]?\d+)?|([eE][+-]?\d+))M?""" e_value = 0 if 'e' in t.value or 'E' in t.value: - matches = re.search('[eE]([+-]?\d+)$', t.value) + matches = re.search('[eE]([+-]?\d+)M?$', t.value) if matches is None: raise SyntaxError('Invalid float : {}'.format(t.value)) - e_value = int(matches.group()[1:]) + e_value = int(matches.group(1)) if t.value.endswith('M'): t.value = decimal.Decimal(t.value[:-1]) * pow(1, e_value) else:
issue parsing big numbers specifically `45e+43` and `45.4e+43M`
swaroopch/edn_format
diff --git a/tests.py b/tests.py index c77c273..437c2fd 100644 --- a/tests.py +++ b/tests.py @@ -143,7 +143,8 @@ class EdnTest(unittest.TestCase): ["+123N", "123"], ["123.2", "123.2"], ["+32.23M", "32.23M"], - ["3.23e10", "32300000000.0"] + ["3.23e10", "32300000000.0"], + ["3e10", "30000000000.0"], ] for literal in EDN_LITERALS: @@ -195,6 +196,8 @@ class EdnTest(unittest.TestCase): "32.23M", "-32.23M", "3.23e-10", + "3e+20", + "3E+20M", '["abc"]', '[1]', '[1 "abc"]',
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 0 }, "num_modified_files": 1 }
0.5
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
-e git+https://github.com/swaroopch/edn_format.git@0616eb18781cd9d9394683b806b0b3033b47f371#egg=edn_format exceptiongroup==1.2.2 iniconfig==2.1.0 packaging==24.2 pluggy==1.5.0 ply==3.10 pyRFC3339==0.2 pytest==8.3.5 pytz==2016.10 tomli==2.2.1
name: edn_format channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - exceptiongroup==1.2.2 - iniconfig==2.1.0 - packaging==24.2 - pluggy==1.5.0 - ply==3.10 - pyrfc3339==0.2 - pytest==8.3.5 - pytz==2016.10 - tomli==2.2.1 prefix: /opt/conda/envs/edn_format
[ "tests.py::EdnTest::test_round_trip_conversion", "tests.py::EdnTest::test_round_trip_same" ]
[]
[ "tests.py::ConsoleTest::test_dumping", "tests.py::EdnTest::test_dump", "tests.py::EdnTest::test_keyword_keys", "tests.py::EdnTest::test_lexer", "tests.py::EdnTest::test_parser", "tests.py::EdnTest::test_proper_unicode_escape", "tests.py::EdnTest::test_round_trip_inst_short", "tests.py::EdnTest::test_round_trip_sets", "tests.py::EdnInstanceTest::test_equality", "tests.py::EdnInstanceTest::test_hashing" ]
[]
Apache License 2.0
1,020
[ "edn_format/edn_lex.py" ]
[ "edn_format/edn_lex.py" ]
scrapy__scrapy-2564
afac3fd2c28ac5b16e7e3c95fca5acd1334f8c58
2017-02-14 15:22:22
dfe6d3d59aa3de7a96c1883d0f3f576ba5994aa9
kmike: While XmlItemExporter works with text files, I'm not sure it is intentional. For example, 'encoding' argument doesn't work properly with XmlItemExporter + text files. elacuesta: Right, the following: ``` from io import StringIO with StringIO(u'') as f: exporter = XmlItemExporter(f, encoding='utf8') exporter.start_exporting() exporter.export_item({'some': u'valûe'}) exporter.finish_exporting() print(f.getvalue()) ``` Fails in python 2, it seems like the binary mode is more consistent. I'll add the note to the `XmlItemExporter` as well. Thanks!
diff --git a/docs/topics/downloader-middleware.rst b/docs/topics/downloader-middleware.rst index 0ef3fb071..1ca78ccc6 100644 --- a/docs/topics/downloader-middleware.rst +++ b/docs/topics/downloader-middleware.rst @@ -681,9 +681,7 @@ HttpProxyMiddleware * ``no_proxy`` You can also set the meta key ``proxy`` per-request, to a value like - ``http://some_proxy_server:port`` or ``http://username:password@some_proxy_server:port``. - Keep in mind this value will take precedence over ``http_proxy``/``https_proxy`` - environment variables, and it will also ignore ``no_proxy`` environment variable. + ``http://some_proxy_server:port``. .. _urllib: https://docs.python.org/2/library/urllib.html .. _urllib2: https://docs.python.org/2/library/urllib2.html @@ -951,16 +949,8 @@ enable it for :ref:`broad crawls <topics-broad-crawls>`. HttpProxyMiddleware settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. setting:: HTTPPROXY_ENABLED .. setting:: HTTPPROXY_AUTH_ENCODING -HTTPPROXY_ENABLED -^^^^^^^^^^^^^^^^^ - -Default: ``True`` - -Whether or not to enable the :class:`HttpProxyMiddleware`. - HTTPPROXY_AUTH_ENCODING ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/topics/exporters.rst b/docs/topics/exporters.rst index af469eb7b..85c73222d 100644 --- a/docs/topics/exporters.rst +++ b/docs/topics/exporters.rst @@ -225,7 +225,8 @@ XmlItemExporter Exports Items in XML format to the specified file object. - :param file: the file-like object to use for exporting the data. + :param file: the file-like object to use for exporting the data. Its ``write`` method should + accept ``bytes`` (a disk file opened in binary mode, a ``io.BytesIO`` object, etc) :param root_element: The name of root element in the exported XML. :type root_element: str @@ -281,7 +282,8 @@ CsvItemExporter CSV columns and their order. The :attr:`export_empty_fields` attribute has no effect on this exporter. - :param file: the file-like object to use for exporting the data. + :param file: the file-like object to use for exporting the data. Its ``write`` method should + accept ``bytes`` (a disk file opened in binary mode, a ``io.BytesIO`` object, etc) :param include_headers_line: If enabled, makes the exporter output a header line with the field names taken from @@ -312,7 +314,8 @@ PickleItemExporter Exports Items in pickle format to the given file-like object. - :param file: the file-like object to use for exporting the data. + :param file: the file-like object to use for exporting the data. Its ``write`` method should + accept ``bytes`` (a disk file opened in binary mode, a ``io.BytesIO`` object, etc) :param protocol: The pickle protocol to use. :type protocol: int @@ -333,7 +336,8 @@ PprintItemExporter Exports Items in pretty print format to the specified file object. - :param file: the file-like object to use for exporting the data. + :param file: the file-like object to use for exporting the data. Its ``write`` method should + accept ``bytes`` (a disk file opened in binary mode, a ``io.BytesIO`` object, etc) The additional keyword arguments of this constructor are passed to the :class:`BaseItemExporter` constructor. @@ -356,7 +360,8 @@ JsonItemExporter arguments to the `JSONEncoder`_ constructor, so you can use any `JSONEncoder`_ constructor argument to customize this exporter. - :param file: the file-like object to use for exporting the data. + :param file: the file-like object to use for exporting the data. Its ``write`` method should + accept ``bytes`` (a disk file opened in binary mode, a ``io.BytesIO`` object, etc) A typical output of this exporter would be:: @@ -386,7 +391,8 @@ JsonLinesItemExporter the `JSONEncoder`_ constructor, so you can use any `JSONEncoder`_ constructor argument to customize this exporter. - :param file: the file-like object to use for exporting the data. + :param file: the file-like object to use for exporting the data. Its ``write`` method should + accept ``bytes`` (a disk file opened in binary mode, a ``io.BytesIO`` object, etc) A typical output of this exporter would be:: diff --git a/scrapy/downloadermiddlewares/httpproxy.py b/scrapy/downloadermiddlewares/httpproxy.py index 0d5320bf8..98c87aa9c 100644 --- a/scrapy/downloadermiddlewares/httpproxy.py +++ b/scrapy/downloadermiddlewares/httpproxy.py @@ -20,25 +20,23 @@ class HttpProxyMiddleware(object): for type, url in getproxies().items(): self.proxies[type] = self._get_proxy(url, type) + if not self.proxies: + raise NotConfigured + @classmethod def from_crawler(cls, crawler): - if not crawler.settings.getbool('HTTPPROXY_ENABLED'): - raise NotConfigured auth_encoding = crawler.settings.get('HTTPPROXY_AUTH_ENCODING') return cls(auth_encoding) - def _basic_auth_header(self, username, password): - user_pass = to_bytes( - '%s:%s' % (unquote(username), unquote(password)), - encoding=self.auth_encoding) - return base64.b64encode(user_pass).strip() - def _get_proxy(self, url, orig_type): proxy_type, user, password, hostport = _parse_proxy(url) proxy_url = urlunparse((proxy_type or orig_type, hostport, '', '', '', '')) if user: - creds = self._basic_auth_header(user, password) + user_pass = to_bytes( + '%s:%s' % (unquote(user), unquote(password)), + encoding=self.auth_encoding) + creds = base64.b64encode(user_pass).strip() else: creds = None @@ -47,15 +45,6 @@ class HttpProxyMiddleware(object): def process_request(self, request, spider): # ignore if proxy is already set if 'proxy' in request.meta: - if request.meta['proxy'] is None: - return - # extract credentials if present - creds, proxy_url = self._get_proxy(request.meta['proxy'], '') - request.meta['proxy'] = proxy_url - if creds and not request.headers.get('Proxy-Authorization'): - request.headers['Proxy-Authorization'] = b'Basic ' + creds - return - elif not self.proxies: return parsed = urlparse_cached(request) diff --git a/scrapy/settings/default_settings.py b/scrapy/settings/default_settings.py index cb88bc2bf..24714a7a8 100644 --- a/scrapy/settings/default_settings.py +++ b/scrapy/settings/default_settings.py @@ -174,7 +174,6 @@ HTTPCACHE_DBM_MODULE = 'anydbm' if six.PY2 else 'dbm' HTTPCACHE_POLICY = 'scrapy.extensions.httpcache.DummyPolicy' HTTPCACHE_GZIP = False -HTTPPROXY_ENABLED = True HTTPPROXY_AUTH_ENCODING = 'latin-1' IMAGES_STORE_S3_ACL = 'private'
CsvItemExporter fails on py3 ``` from scrapy.exporters import CsvItemExporter with open('temp.csv', 'w') as f: exporter = CsvItemExporter(f) exporter.start_exporting() exporter.export_item({'a': 'b'}) exporter.finish_exporting() ``` The previous snippet works fine on python 2, however the following error appears when running on python 3: ``` Traceback (most recent call last): File "exporter.py", line 5, in <module> exporter.export_item({'a': 'b'}) File "/Users/eugenio/.../venv/lib/python3.5/site-packages/scrapy/exporters.py", line 206, in export_item self._write_headers_and_set_fields_to_export(item) File "/Users/eugenio/.../venv/lib/python3.5/site-packages/scrapy/exporters.py", line 230, in _write_headers_and_set_fields_to_export self.csv_writer.writerow(row) TypeError: write() argument must be str, not bytes ``` Am I missing something? Thanks!
scrapy/scrapy
diff --git a/tests/test_downloadermiddleware_httpproxy.py b/tests/test_downloadermiddleware_httpproxy.py index c77179ceb..2b26431a4 100644 --- a/tests/test_downloadermiddleware_httpproxy.py +++ b/tests/test_downloadermiddleware_httpproxy.py @@ -1,14 +1,11 @@ import os import sys -from functools import partial from twisted.trial.unittest import TestCase, SkipTest from scrapy.downloadermiddlewares.httpproxy import HttpProxyMiddleware from scrapy.exceptions import NotConfigured from scrapy.http import Response, Request from scrapy.spiders import Spider -from scrapy.crawler import Crawler -from scrapy.settings import Settings spider = Spider('foo') @@ -23,10 +20,9 @@ class TestDefaultHeadersMiddleware(TestCase): def tearDown(self): os.environ = self._oldenv - def test_not_enabled(self): - settings = Settings({'HTTPPROXY_ENABLED': False}) - crawler = Crawler(spider, settings) - self.assertRaises(NotConfigured, partial(HttpProxyMiddleware.from_crawler, crawler)) + def test_no_proxies(self): + os.environ = {} + self.assertRaises(NotConfigured, HttpProxyMiddleware) def test_no_enviroment_proxies(self): os.environ = {'dummy_proxy': 'reset_env_and_do_not_raise'} @@ -51,13 +47,6 @@ class TestDefaultHeadersMiddleware(TestCase): self.assertEquals(req.url, url) self.assertEquals(req.meta.get('proxy'), proxy) - def test_proxy_precedence_meta(self): - os.environ['http_proxy'] = 'https://proxy.com' - mw = HttpProxyMiddleware() - req = Request('http://scrapytest.org', meta={'proxy': 'https://new.proxy:3128'}) - assert mw.process_request(req, spider) is None - self.assertEquals(req.meta, {'proxy': 'https://new.proxy:3128'}) - def test_proxy_auth(self): os.environ['http_proxy'] = 'https://user:pass@proxy:3128' mw = HttpProxyMiddleware() @@ -65,11 +54,6 @@ class TestDefaultHeadersMiddleware(TestCase): assert mw.process_request(req, spider) is None self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic dXNlcjpwYXNz') - # proxy from request.meta - req = Request('http://scrapytest.org', meta={'proxy': 'https://username:password@proxy:3128'}) - assert mw.process_request(req, spider) is None - self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) - self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic dXNlcm5hbWU6cGFzc3dvcmQ=') def test_proxy_auth_empty_passwd(self): os.environ['http_proxy'] = 'https://user:@proxy:3128' @@ -78,11 +62,6 @@ class TestDefaultHeadersMiddleware(TestCase): assert mw.process_request(req, spider) is None self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic dXNlcjo=') - # proxy from request.meta - req = Request('http://scrapytest.org', meta={'proxy': 'https://username:@proxy:3128'}) - assert mw.process_request(req, spider) is None - self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) - self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic dXNlcm5hbWU6') def test_proxy_auth_encoding(self): # utf-8 encoding @@ -93,12 +72,6 @@ class TestDefaultHeadersMiddleware(TestCase): self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic bcOhbjpwYXNz') - # proxy from request.meta - req = Request('http://scrapytest.org', meta={'proxy': u'https://\u00FCser:pass@proxy:3128'}) - assert mw.process_request(req, spider) is None - self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) - self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic w7xzZXI6cGFzcw==') - # default latin-1 encoding mw = HttpProxyMiddleware(auth_encoding='latin-1') req = Request('http://scrapytest.org') @@ -106,21 +79,15 @@ class TestDefaultHeadersMiddleware(TestCase): self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic beFuOnBhc3M=') - # proxy from request.meta, latin-1 encoding - req = Request('http://scrapytest.org', meta={'proxy': u'https://\u00FCser:pass@proxy:3128'}) - assert mw.process_request(req, spider) is None - self.assertEquals(req.meta, {'proxy': 'https://proxy:3128'}) - self.assertEquals(req.headers.get('Proxy-Authorization'), b'Basic /HNlcjpwYXNz') - def test_proxy_already_seted(self): - os.environ['http_proxy'] = 'https://proxy.for.http:3128' + os.environ['http_proxy'] = http_proxy = 'https://proxy.for.http:3128' mw = HttpProxyMiddleware() req = Request('http://noproxy.com', meta={'proxy': None}) assert mw.process_request(req, spider) is None assert 'proxy' in req.meta and req.meta['proxy'] is None def test_no_proxy(self): - os.environ['http_proxy'] = 'https://proxy.for.http:3128' + os.environ['http_proxy'] = http_proxy = 'https://proxy.for.http:3128' mw = HttpProxyMiddleware() os.environ['no_proxy'] = '*' @@ -137,9 +104,3 @@ class TestDefaultHeadersMiddleware(TestCase): req = Request('http://noproxy.com') assert mw.process_request(req, spider) is None assert 'proxy' not in req.meta - - # proxy from meta['proxy'] takes precedence - os.environ['no_proxy'] = '*' - req = Request('http://noproxy.com', meta={'proxy': 'http://proxy.com'}) - assert mw.process_request(req, spider) is None - self.assertEquals(req.meta, {'proxy': 'http://proxy.com'})
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 3, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 4 }
1.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-xdist" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==25.3.0 Automat==24.8.1 cffi==1.17.1 constantly==23.10.4 coverage==7.8.0 cryptography==44.0.2 cssselect==1.3.0 exceptiongroup==1.2.2 execnet==2.1.1 hyperlink==21.0.0 idna==3.10 incremental==24.7.2 iniconfig==2.1.0 jmespath==1.0.1 lxml==5.3.1 packaging==24.2 parsel==1.10.0 pluggy==1.5.0 pyasn1==0.6.1 pyasn1_modules==0.4.2 pycparser==2.22 PyDispatcher==2.0.7 pyOpenSSL==25.0.0 pytest==8.3.5 pytest-cov==6.0.0 pytest-xdist==3.6.1 queuelib==1.7.0 -e git+https://github.com/scrapy/scrapy.git@afac3fd2c28ac5b16e7e3c95fca5acd1334f8c58#egg=Scrapy service-identity==24.2.0 six==1.17.0 tomli==2.2.1 Twisted==24.11.0 typing_extensions==4.13.0 w3lib==2.3.1 zope.interface==7.2
name: scrapy channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==25.3.0 - automat==24.8.1 - cffi==1.17.1 - constantly==23.10.4 - coverage==7.8.0 - cryptography==44.0.2 - cssselect==1.3.0 - exceptiongroup==1.2.2 - execnet==2.1.1 - hyperlink==21.0.0 - idna==3.10 - incremental==24.7.2 - iniconfig==2.1.0 - jmespath==1.0.1 - lxml==5.3.1 - packaging==24.2 - parsel==1.10.0 - pluggy==1.5.0 - pyasn1==0.6.1 - pyasn1-modules==0.4.2 - pycparser==2.22 - pydispatcher==2.0.7 - pyopenssl==25.0.0 - pytest==8.3.5 - pytest-cov==6.0.0 - pytest-xdist==3.6.1 - queuelib==1.7.0 - service-identity==24.2.0 - six==1.17.0 - tomli==2.2.1 - twisted==24.11.0 - typing-extensions==4.13.0 - w3lib==2.3.1 - zope-interface==7.2 prefix: /opt/conda/envs/scrapy
[ "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_no_proxies" ]
[]
[ "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_enviroment_proxies", "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_no_enviroment_proxies", "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_no_proxy", "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_proxy_already_seted", "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_proxy_auth", "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_proxy_auth_empty_passwd", "tests/test_downloadermiddleware_httpproxy.py::TestDefaultHeadersMiddleware::test_proxy_auth_encoding" ]
[]
BSD 3-Clause "New" or "Revised" License
1,021
[ "docs/topics/downloader-middleware.rst", "docs/topics/exporters.rst", "scrapy/downloadermiddlewares/httpproxy.py", "scrapy/settings/default_settings.py" ]
[ "docs/topics/downloader-middleware.rst", "docs/topics/exporters.rst", "scrapy/downloadermiddlewares/httpproxy.py", "scrapy/settings/default_settings.py" ]
zopefoundation__ZConfig-19
010cb2b2d4d2cdc8cd327f9f46a987024cac5b67
2017-02-14 15:38:17
648fc674631ab28c7268aba114804020f8d7ebec
diff --git a/CHANGES.rst b/CHANGES.rst index d089805..77d7934 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -13,6 +13,9 @@ Change History for ZConfig - BaseLoader is now an abstract class that cannot be instantiated. +- Allow ``nan``, ``inf`` and ``-inf`` values for floats in + configurations. See https://github.com/zopefoundation/ZConfig/issues/16. + 3.1.0 (2015-10-17) ------------------ diff --git a/ZConfig/datatypes.py b/ZConfig/datatypes.py index 1b33ecb..3dce2ef 100644 --- a/ZConfig/datatypes.py +++ b/ZConfig/datatypes.py @@ -280,13 +280,9 @@ class SocketConnectionAddress(SocketAddress): def float_conversion(v): - # float() will accept both bytes and unicode on both 2 and 3 - is_str = isinstance(v, text_type) or isinstance(v, binary_type) - if is_str: - if v.lower() in (u"inf", u"-inf", u"nan", b'inf', b'-inf', b'nan'): - raise ValueError(repr(v) + " is not a portable float representation") return float(v) + class IpaddrOrHostname(RegularExpressionConversion): def __init__(self): # IP address regex from the Perl Cookbook, Recipe 6.23 (revised ed.)
Simplify float conversion See https://github.com/zopefoundation/ZConfig/pull/13#discussion_r100796977
zopefoundation/ZConfig
diff --git a/ZConfig/tests/support.py b/ZConfig/tests/support.py index 6094455..c583f97 100644 --- a/ZConfig/tests/support.py +++ b/ZConfig/tests/support.py @@ -24,12 +24,6 @@ from ZConfig.url import urljoin from ZConfig._compat import NStringIO as StringIO from ZConfig._compat import pathname2url -try: - __file__ -except NameError: # pragma: no cover - import sys - __file__ = sys.argv[0] - d = os.path.abspath(os.path.join(os.path.dirname(__file__), "input")) CONFIG_BASE = "file://%s/" % pathname2url(d) diff --git a/ZConfig/tests/test_datatypes.py b/ZConfig/tests/test_datatypes.py index 9ee8778..9419e74 100644 --- a/ZConfig/tests/test_datatypes.py +++ b/ZConfig/tests/test_datatypes.py @@ -23,12 +23,7 @@ import unittest import ZConfig.datatypes -try: - here = __file__ -except NameError: # pragma: no cover - here = sys.argv[0] - -here = os.path.abspath(here) +here = os.path.abspath(__file__) try: unicode @@ -91,15 +86,15 @@ class DatatypeTestCase(unittest.TestCase): raises(ValueError, convert, "0x234.1.9") raises(ValueError, convert, "0.9-") - # These are not portable representations; make sure they are - # disallowed everywhere for consistency. - raises(ValueError, convert, b"inf") - raises(ValueError, convert, b"-inf") - raises(ValueError, convert, b"nan") + # float handles inf/nan portably in both bytes and + # unicode on both Python 2.6+ and Python 3. Make sure conversion + # does too. + for literal in ("inf", "-inf", b"inf", b"-inf"): + eq(convert(literal), float(literal)) - raises(ValueError, convert, u"inf") - raises(ValueError, convert, u"-inf") - raises(ValueError, convert, u"nan") + # notably, nan is not equal to itself + self.assertNotEqual(convert("nan"), float("nan")) + self.assertNotEqual(convert(b"nan"), float(b"nan")) def test_datatype_identifier(self): convert = self.types.get("identifier") diff --git a/ZConfig/tests/test_loader.py b/ZConfig/tests/test_loader.py index 3ca5c66..b30505f 100644 --- a/ZConfig/tests/test_loader.py +++ b/ZConfig/tests/test_loader.py @@ -28,12 +28,7 @@ from ZConfig._compat import urllib2 from ZConfig.tests.support import CONFIG_BASE, TestHelper -try: - myfile = __file__ -except NameError: # pragma: no cover - myfile = sys.argv[0] - -myfile = os.path.abspath(myfile) +myfile = os.path.abspath(__file__) LIBRARY_DIR = os.path.join(os.path.dirname(myfile), "library")
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 2, "test_score": 0 }, "num_modified_files": 2 }
3.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[test]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "zope.testrunner", "nose", "coverage", "nosexcover", "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
coverage==7.8.0 exceptiongroup==1.2.2 iniconfig==2.1.0 nose==1.3.7 nosexcover==1.0.11 packaging==24.2 pluggy==1.5.0 pytest==8.3.5 tomli==2.2.1 -e git+https://github.com/zopefoundation/ZConfig.git@010cb2b2d4d2cdc8cd327f9f46a987024cac5b67#egg=ZConfig zope.exceptions==5.2 zope.interface==7.2 zope.testrunner==7.2
name: ZConfig channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - coverage==7.8.0 - exceptiongroup==1.2.2 - iniconfig==2.1.0 - nose==1.3.7 - nosexcover==1.0.11 - packaging==24.2 - pluggy==1.5.0 - pytest==8.3.5 - tomli==2.2.1 - zope-exceptions==5.2 - zope-interface==7.2 - zope-testrunner==7.2 prefix: /opt/conda/envs/ZConfig
[ "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_datatype_float" ]
[]
[ "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_byte_size", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_datatype_basickey", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_datatype_boolean", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_datatype_dotted_name", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_datatype_dotted_suffix", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_datatype_identifier", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_datatype_inet_address", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_datatype_inet_binding_address", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_datatype_inet_connection_address", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_datatype_integer", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_datatype_locale", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_datatype_port", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_datatype_socket_address", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_existing_directory", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_existing_dirpath", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_existing_file", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_existing_path", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_ipaddr_or_hostname", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_time_interval", "ZConfig/tests/test_datatypes.py::DatatypeTestCase::test_timedelta", "ZConfig/tests/test_datatypes.py::RegistryTestCase::test_get_fallback_basic_key", "ZConfig/tests/test_datatypes.py::RegistryTestCase::test_register_shadow", "ZConfig/tests/test_datatypes.py::RegistryTestCase::test_registry_does_not_mask_toplevel_imports", "ZConfig/tests/test_datatypes.py::test_suite", "ZConfig/tests/test_loader.py::LoaderTestCase::test_config_loader_abstract_schema", "ZConfig/tests/test_loader.py::LoaderTestCase::test_file_url_normalization", "ZConfig/tests/test_loader.py::LoaderTestCase::test_import_component_twice_1", "ZConfig/tests/test_loader.py::LoaderTestCase::test_import_component_twice_2", "ZConfig/tests/test_loader.py::LoaderTestCase::test_import_errors", "ZConfig/tests/test_loader.py::LoaderTestCase::test_import_from_package", "ZConfig/tests/test_loader.py::LoaderTestCase::test_import_from_package_extra_directory", "ZConfig/tests/test_loader.py::LoaderTestCase::test_import_from_package_with_directory_file", "ZConfig/tests/test_loader.py::LoaderTestCase::test_import_from_package_with_file", "ZConfig/tests/test_loader.py::LoaderTestCase::test_import_from_package_with_missing_file", "ZConfig/tests/test_loader.py::LoaderTestCase::test_import_two_components_one_package", "ZConfig/tests/test_loader.py::LoaderTestCase::test_isPath", "ZConfig/tests/test_loader.py::LoaderTestCase::test_schema_caching", "ZConfig/tests/test_loader.py::LoaderTestCase::test_schema_loader_source_errors", "ZConfig/tests/test_loader.py::LoaderTestCase::test_simple_import_using_prefix", "ZConfig/tests/test_loader.py::LoaderTestCase::test_simple_import_with_cache", "ZConfig/tests/test_loader.py::LoaderTestCase::test_url_from_file", "ZConfig/tests/test_loader.py::LoaderTestCase::test_urlsplit_urlunsplit", "ZConfig/tests/test_loader.py::TestNonExistentResources::test_nonexistent_file_ioerror", "ZConfig/tests/test_loader.py::TestNonExistentResources::test_nonexistent_file_oserror", "ZConfig/tests/test_loader.py::TestResourcesInZip::test_zip_import_component_from_config", "ZConfig/tests/test_loader.py::TestResourcesInZip::test_zip_import_component_from_schema", "ZConfig/tests/test_loader.py::TestOpenPackageResource::test_package_loader_resource_error", "ZConfig/tests/test_loader.py::TestOpenPackageResource::test_resource", "ZConfig/tests/test_loader.py::test_suite" ]
[]
Zope Public License 2.1
1,022
[ "ZConfig/datatypes.py", "CHANGES.rst" ]
[ "ZConfig/datatypes.py", "CHANGES.rst" ]
Azure__azure-cli-2078
efeceb146b93793ee93b2dc07e14ac58a782b45a
2017-02-14 22:35:29
1576ec67f5029db062579da230902a559acbb9fe
diff --git a/scripts/automation/commandlint/__init__.py b/scripts/automation/commandlint/__init__.py new file mode 100644 index 000000000..433670bfb --- /dev/null +++ b/scripts/automation/commandlint/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +"""Command linting automation code""" diff --git a/scripts/automation/commandlint/run.py b/scripts/automation/commandlint/run.py new file mode 100644 index 000000000..b60831923 --- /dev/null +++ b/scripts/automation/commandlint/run.py @@ -0,0 +1,90 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +from __future__ import print_function +import pkgutil + +import argparse +import os +import sys +import json +import yaml +from importlib import import_module + +from automation.utilities.path import filter_user_selected_modules_with_tests +from azure.cli.core.application import APPLICATION, Application +from azure.cli.core.application import Configuration +from azure.cli.core.commands import load_params, _update_command_definitions +from azure.cli.core.help_files import helps + + + +def dump_no_help(modules): + cmd_table = APPLICATION.configuration.get_command_table() + + exit_val = 0 + for cmd in cmd_table: + cmd_table[cmd].load_arguments() + + for mod in modules: + try: + import_module('azure.cli.command_modules.' + mod).load_params(mod) + except Exception as ex: + print("EXCEPTION: " + str(mod)) + + _update_command_definitions(cmd_table) + + command_list = [] + subgroups_list = [] + parameters = {} + for cmd in cmd_table: + if not cmd_table[cmd].description and cmd not in helps: + command_list.append(cmd) + exit_val = 1 + group_name = " ".join(cmd.split()[:-1]) + if group_name not in helps: + exit_val = 1 + if group_name not in subgroups_list: + subgroups_list.append(group_name) + + param_list = [] + for key in cmd_table[cmd].arguments: + if not cmd_table[cmd].arguments[key].type.settings.get('help'): + exit_val = 1 + param_list.append(cmd_table[cmd].arguments[key].name) + if param_list: + parameters[cmd] = param_list + + for cmd in helps: + diction_help = yaml.load(helps[cmd]) + if "short-summary" in diction_help and "type" in diction_help: + if diction_help["type"] == "command" and cmd in command_list: + command_list.remove(cmd) + elif diction_help["type"] == "group" and cmd in subgroups_list: + subgroups_list.remove(cmd) + if "parameters" in diction_help: + for param in diction_help["parameters"]: + if "short-summary" in param and param["name"].split()[0] in parameters: + parameters.pop(cmd, None) + + data = { + "subgroups" : subgroups_list, + "commands" : command_list, + "parameters" : parameters + } + + print(json.dumps(data, indent=2, sort_keys=True)) + + return exit_val + +if __name__ == '__main__': + try: + mods_ns_pkg = import_module('azure.cli.command_modules') + installed_command_modules = [modname for _, modname, _ in + pkgutil.iter_modules(mods_ns_pkg.__path__)] + except ImportError: + pass + exit_value = dump_no_help(installed_command_modules) + sys.exit(exit_value) + diff --git a/src/azure-cli-core/azure/cli/core/_util.py b/src/azure-cli-core/azure/cli/core/_util.py index 6b440e2cc..48841979b 100644 --- a/src/azure-cli-core/azure/cli/core/_util.py +++ b/src/azure-cli-core/azure/cli/core/_util.py @@ -169,8 +169,10 @@ def b64encode(s): return encoded.decode('latin-1') -def random_string(length=16, force_lower=False): +def random_string(length=16, force_lower=False, digits_only=False): from string import ascii_letters, digits, ascii_lowercase from random import choice - choice_set = ascii_lowercase + digits if force_lower else ascii_letters + digits + choice_set = digits + if not digits_only: + choice_set += ascii_lowercase if force_lower else ascii_letters return ''.join([choice(choice_set) for _ in range(length)]) diff --git a/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_help.py b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_help.py index 09655d5b5..21217c0bb 100644 --- a/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_help.py +++ b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_help.py @@ -223,6 +223,31 @@ helps['appservice web config hostname list'] = """ short-summary: list all hostname bindings """ +helps['appservice web config backup list'] = """ + type: command + short-summary: list all of an app's backups +""" + +helps['appservice web config backup create'] = """ + type: command + short-summary: create a backup of a web app +""" + +helps['appservice web config backup show'] = """ + type: command + short-summary: show a web app's backup schedule +""" + +helps['appservice web config backup update'] = """ + type: command + short-summary: configure a new backup schedule +""" + +helps['appservice web config backup restore'] = """ + type: command + short-summary: restore an app from a backup +""" + helps['appservice web browse'] = """ type: command short-summary: Open the web app in a browser diff --git a/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_params.py b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_params.py index 2cd36d2a5..0369a2fa7 100644 --- a/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_params.py +++ b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_params.py @@ -11,6 +11,8 @@ from azure.cli.core.commands.parameters import (resource_group_name_type, locati get_resource_name_completion_list, file_type, CliArgumentType, ignore_type, enum_choice_list) +from azure.mgmt.web.models import DatabaseType + from ._client_factory import web_client_factory def _generic_site_operation(resource_group_name, name, operation_name, slot=None, #pylint: disable=too-many-arguments @@ -107,6 +109,23 @@ register_cli_argument('appservice web config update', 'app_command_line', option register_cli_argument('appservice web config hostname', 'webapp', help="webapp name", completer=get_resource_name_completion_list('Microsoft.Web/sites'), id_part='name') register_cli_argument('appservice web config hostname', 'name', arg_type=name_arg_type, completer=get_hostname_completion_list, help="hostname assigned to the site, such as custom domains", id_part='child_name') +register_cli_argument('appservice web config backup', 'storage_account_url', help='URL with SAS token to the blob storage container', options_list=['--container-url']) +register_cli_argument('appservice web config backup', 'webapp_name', help='The name of the webapp') +register_cli_argument('appservice web config backup', 'db_name', help='Name of the database in the backup', arg_group='Database') +register_cli_argument('appservice web config backup', 'db_connection_string', help='Connection string for the database in the backup', arg_group='Database') +register_cli_argument('appservice web config backup', 'db_type', help='Type of database in the backup', arg_group='Database', **enum_choice_list(DatabaseType)) + +register_cli_argument('appservice web config backup create', 'backup_name', help='Name of the backup. If unspecified, the backup will be named with the webapp name and a timestamp') + +register_cli_argument('appservice web config backup update', 'frequency', help='How often to backup. Use a number followed by d or h, e.g. 5d = 5 days, 2h = 2 hours') +register_cli_argument('appservice web config backup update', 'keep_at_least_one_backup', help='Always keep one backup, regardless of how old it is', options_list=['--retain-one'], **enum_choice_list(two_states_switch)) +register_cli_argument('appservice web config backup update', 'retention_period_in_days', help='How many days to keep a backup before automatically deleting it. Set to 0 for indefinite retention', options_list=['--retention']) + +register_cli_argument('appservice web config backup restore', 'backup_name', help='Name of the backup to restore') +register_cli_argument('appservice web config backup restore', 'target_name', help='The name to use for the restored webapp. If unspecified, will default to the name that was used when the backup was created') +register_cli_argument('appservice web config backup restore', 'overwrite', help='Overwrite the source webapp, if --target-name is not specified', action='store_true') +register_cli_argument('appservice web config backup restore', 'ignore_hostname_conflict', help='Ignores custom hostnames stored in the backup', action='store_true') + register_cli_argument('appservice web source-control', 'manual_integration', action='store_true', help='disable automatic sync between source control and web') register_cli_argument('appservice web source-control', 'repo_url', help='repository url to pull the latest source from, e.g. https://github.com/foo/foo-web') register_cli_argument('appservice web source-control', 'branch', help='the branch name of the repository') diff --git a/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/commands.py b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/commands.py index d65548f44..13f4d13f8 100644 --- a/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/commands.py +++ b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/commands.py @@ -28,6 +28,11 @@ cli_command(__name__, 'appservice web config hostname delete', 'azure.cli.comman cli_command(__name__, 'appservice web config container update', 'azure.cli.command_modules.appservice.custom#update_container_settings') cli_command(__name__, 'appservice web config container delete', 'azure.cli.command_modules.appservice.custom#delete_container_settings') cli_command(__name__, 'appservice web config container show', 'azure.cli.command_modules.appservice.custom#show_container_settings') +cli_command(__name__, 'appservice web config backup list', 'azure.cli.command_modules.appservice.custom#list_backups') +cli_command(__name__, 'appservice web config backup show', 'azure.cli.command_modules.appservice.custom#show_backup_configuration') +cli_command(__name__, 'appservice web config backup create', 'azure.cli.command_modules.appservice.custom#create_backup') +cli_command(__name__, 'appservice web config backup update', 'azure.cli.command_modules.appservice.custom#update_backup_schedule') +cli_command(__name__, 'appservice web config backup restore', 'azure.cli.command_modules.appservice.custom#restore_backup') factory = lambda _: web_client_factory().web_apps cli_command(__name__, 'appservice web source-control config-local-git', 'azure.cli.command_modules.appservice.custom#enable_local_git') diff --git a/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/custom.py b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/custom.py index e14f621e5..a19a92f9a 100644 --- a/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/custom.py +++ b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/custom.py @@ -12,8 +12,12 @@ try: except ImportError: from urlparse import urlparse # pylint: disable=import-error +from msrestazure.azure_exceptions import CloudError + from azure.mgmt.web.models import (Site, SiteConfig, User, AppServicePlan, - SkuDescription, SslState, HostNameBinding) + SkuDescription, SslState, HostNameBinding, + BackupRequest, DatabaseBackupSetting, BackupSchedule, + RestoreRequest, FrequencyUnit) from azure.cli.core.commands.client_factory import get_mgmt_service_client from azure.cli.core.commands.arm import is_valid_resource_id, parse_resource_id @@ -293,6 +297,133 @@ def update_app_service_plan(instance, sku=None, number_of_workers=None, instance.admin_site_name = admin_site_name return instance +def show_backup_configuration(resource_group_name, webapp_name, slot=None): + try: + return _generic_site_operation(resource_group_name, webapp_name, + 'get_backup_configuration', slot) + except: + raise CLIError('Backup configuration not found') + +def list_backups(resource_group_name, webapp_name, slot=None): + return _generic_site_operation(resource_group_name, webapp_name, 'list_backups', + slot) + +def create_backup(resource_group_name, webapp_name, storage_account_url, + db_name=None, db_type=None, + db_connection_string=None, backup_name=None, slot=None): + client = web_client_factory() + if backup_name and backup_name.lower().endswith('.zip'): + backup_name = backup_name[:-4] + location = _get_location_from_webapp(client, resource_group_name, webapp_name) + db_setting = _create_db_setting(db_name, db_type, db_connection_string) + backup_request = BackupRequest(location, backup_request_name=backup_name, + storage_account_url=storage_account_url, databases=db_setting) + if slot: + return client.web_apps.backup_slot(resource_group_name, webapp_name, backup_request, slot) + else: + return client.web_apps.backup(resource_group_name, webapp_name, backup_request) + +def update_backup_schedule(resource_group_name, webapp_name, storage_account_url=None, + frequency=None, keep_at_least_one_backup=None, + retention_period_in_days=None, db_name=None, + db_connection_string=None, db_type=None, slot=None): + client = web_client_factory() + location = _get_location_from_webapp(client, resource_group_name, webapp_name) + configuration = None + + try: + configuration = _generic_site_operation(resource_group_name, webapp_name, + 'get_backup_configuration', slot) + except CloudError: + # No configuration set yet + if not all([storage_account_url, frequency, retention_period_in_days, + keep_at_least_one_backup]): + raise CLIError('No backup configuration found. A configuration must be created. ' + + 'Usage: --container-url URL --frequency TIME --retention DAYS ' + + '--retain-one TRUE/FALSE') + + # If arguments were not specified, use the values in the current backup schedule + if storage_account_url is None: + storage_account_url = configuration.storage_account_url + + if retention_period_in_days is None: + retention_period_in_days = configuration.backup_schedule.retention_period_in_days + + if keep_at_least_one_backup is None: + keep_at_least_one_backup = configuration.backup_schedule.keep_at_least_one_backup + else: + keep_at_least_one_backup = keep_at_least_one_backup.lower() == 'true' + + if frequency: + # Parse schedule frequency + frequency_num, frequency_unit = _parse_frequency(frequency) + else: + frequency_num = configuration.backup_schedule.frequency_interval + frequency_unit = configuration.backup_schedule.frequency_unit + + if configuration and configuration.databases: + db = configuration.databases[0] + db_type = db_type or db.database_type + db_name = db_name or db.name + db_connection_string = db_connection_string or db.connection_string + + db_setting = _create_db_setting(db_name, db_type, db_connection_string) + + backup_schedule = BackupSchedule(frequency_num, frequency_unit.name, + keep_at_least_one_backup, retention_period_in_days) + backup_request = BackupRequest(location, backup_schedule=backup_schedule, enabled=True, + storage_account_url=storage_account_url, databases=db_setting) + if slot: + return client.web_apps.update_backup_configuration_slot(resource_group_name, webapp_name, + backup_request, slot) + else: + return client.web_apps.update_backup_configuration(resource_group_name, webapp_name, + backup_request) + +def restore_backup(resource_group_name, webapp_name, storage_account_url, backup_name, + db_name=None, db_type=None, db_connection_string=None, + target_name=None, overwrite=None, ignore_hostname_conflict=None, slot=None): + client = web_client_factory() + storage_blob_name = backup_name + if not storage_blob_name.lower().endswith('.zip'): + storage_blob_name += '.zip' + location = _get_location_from_webapp(client, resource_group_name, webapp_name) + db_setting = _create_db_setting(db_name, db_type, db_connection_string) + restore_request = RestoreRequest(location, storage_account_url=storage_account_url, + blob_name=storage_blob_name, overwrite=overwrite, + site_name=target_name, databases=db_setting, + ignore_conflicting_host_names=ignore_hostname_conflict) + if slot: + return client.web_apps.restore(resource_group_name, webapp_name, 0, restore_request, slot) + else: + return client.web_apps.restore(resource_group_name, webapp_name, 0, restore_request) + +def _create_db_setting(db_name, db_type, db_connection_string): + if all([db_name, db_type, db_connection_string]): + return [DatabaseBackupSetting(db_type, db_name, connection_string=db_connection_string)] + elif any([db_name, db_type, db_connection_string]): + raise CLIError('usage error: --db-name NAME --db-type TYPE --db-connection-string STRING') + +def _parse_frequency(frequency): + unit_part = frequency.lower()[-1] + if unit_part == 'd': + frequency_unit = FrequencyUnit.day + elif unit_part == 'h': + # pylint: disable=redefined-variable-type + frequency_unit = FrequencyUnit.hour + else: + raise CLIError('Frequency must end with d or h for "day" or "hour"') + + try: + frequency_num = int(frequency[:-1]) + except ValueError: + raise CLIError('Frequency must start with a number') + + if frequency_num < 0: + raise CLIError('Frequency must be positive') + + return frequency_num, frequency_unit + def _normalize_sku(sku): sku = sku.upper() if sku == 'FREE': diff --git a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_help.py b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_help.py index 92cd9ecc3..091446abe 100644 --- a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_help.py +++ b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_help.py @@ -35,6 +35,11 @@ helps['storage account'] = """ short-summary: Manage storage accounts. """ +helps['storage account update'] = """ + type: command + short-summary: Update the properties of a storage account. +""" + helps['storage account keys'] = """ type: group short-summary: Manage storage account keys. diff --git a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/commands.py b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/commands.py index 0d1cc02b8..bc4536dcc 100644 --- a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/commands.py +++ b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/commands.py @@ -24,185 +24,182 @@ from azure.cli.command_modules.storage._validators import \ transform_url, transform_storage_list_output, transform_container_permission_output, create_boolean_result_output_transformer) from azure.cli.core.commands import cli_command +from azure.cli.core.commands.arm import cli_generic_update_command + +mgmt_path = 'azure.mgmt.storage.operations.storage_accounts_operations#StorageAccountsOperations.' +custom_path = 'azure.cli.command_modules.storage.custom#' +file_service_path = 'azure.storage.file.fileservice#FileService.' +block_blob_path = 'azure.storage.blob.blockblobservice#BlockBlobService.' +base_blob_path = 'azure.storage.blob.baseblobservice#BaseBlobService.' +table_path = 'azure.storage.table.tableservice#TableService.' +queue_path = 'azure.storage.queue.queueservice#QueueService.' # storage account commands factory = lambda kwargs: storage_client_factory().storage_accounts # noqa: E731 lambda vs def -cli_command(__name__, 'storage account check-name', 'azure.mgmt.storage.operations.storage_accounts_operations#StorageAccountsOperations.check_name_availability', factory) -cli_command(__name__, 'storage account delete', 'azure.mgmt.storage.operations.storage_accounts_operations#StorageAccountsOperations.delete', factory, confirmation=True) -cli_command(__name__, 'storage account show', 'azure.mgmt.storage.operations.storage_accounts_operations#StorageAccountsOperations.get_properties', factory) -cli_command(__name__, 'storage account create', 'azure.cli.command_modules.storage.custom#create_storage_account') -cli_command(__name__, 'storage account list', 'azure.cli.command_modules.storage.custom#list_storage_accounts') -cli_command(__name__, 'storage account show-usage', 'azure.cli.command_modules.storage.custom#show_storage_account_usage') -cli_command(__name__, 'storage account update', 'azure.cli.command_modules.storage.custom#set_storage_account_properties') -cli_command(__name__, 'storage account show-connection-string', 'azure.cli.command_modules.storage.custom#show_storage_account_connection_string') -cli_command(__name__, 'storage account keys renew', 'azure.mgmt.storage.operations.storage_accounts_operations#StorageAccountsOperations.regenerate_key', factory, transform=lambda x: x.keys) -cli_command(__name__, 'storage account keys list', 'azure.mgmt.storage.operations.storage_accounts_operations#StorageAccountsOperations.list_keys', factory, transform=lambda x: x.keys) +cli_command(__name__, 'storage account check-name', mgmt_path + 'check_name_availability', factory) +cli_command(__name__, 'storage account delete', mgmt_path + 'delete', factory, confirmation=True) +cli_command(__name__, 'storage account show', mgmt_path + 'get_properties', factory) +cli_command(__name__, 'storage account create', custom_path + 'create_storage_account') +cli_command(__name__, 'storage account list', custom_path + 'list_storage_accounts') +cli_command(__name__, 'storage account show-usage', custom_path + 'show_storage_account_usage') +cli_command(__name__, 'storage account show-connection-string', custom_path + 'show_storage_account_connection_string') +cli_command(__name__, 'storage account keys renew', mgmt_path + 'regenerate_key', factory, transform=lambda x: x.keys) +cli_command(__name__, 'storage account keys list', mgmt_path + 'list_keys', factory, transform=lambda x: x.keys) +cli_generic_update_command(__name__, 'storage account update', + mgmt_path + 'get_properties', + mgmt_path + 'create', factory, + custom_function_op=custom_path + 'update_storage_account') cli_storage_data_plane_command('storage account generate-sas', 'azure.storage.cloudstorageaccount#CloudStorageAccount.generate_shared_access_signature', cloud_storage_account_service_factory) # container commands factory = blob_data_service_factory -cli_storage_data_plane_command('storage container list', 'azure.storage.blob.blockblobservice#BlockBlobService.list_containers', factory, transform=transform_storage_list_output, table_transformer=transform_container_list) -cli_storage_data_plane_command('storage container delete', 'azure.storage.blob.blockblobservice#BlockBlobService.delete_container', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) -cli_storage_data_plane_command('storage container show', 'azure.storage.blob.blockblobservice#BlockBlobService.get_container_properties', factory, table_transformer=transform_container_show) -cli_storage_data_plane_command('storage container create', 'azure.storage.blob.blockblobservice#BlockBlobService.create_container', factory, transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) -cli_storage_data_plane_command('storage container generate-sas', 'azure.storage.blob.blockblobservice#BlockBlobService.generate_container_shared_access_signature', factory) -cli_storage_data_plane_command('storage container metadata update', 'azure.storage.blob.blockblobservice#BlockBlobService.set_container_metadata', factory) -cli_storage_data_plane_command('storage container metadata show', 'azure.storage.blob.blockblobservice#BlockBlobService.get_container_metadata', factory) -cli_storage_data_plane_command('storage container lease acquire', 'azure.storage.blob.blockblobservice#BlockBlobService.acquire_container_lease', factory) -cli_storage_data_plane_command('storage container lease renew', 'azure.storage.blob.blockblobservice#BlockBlobService.renew_container_lease', factory) -cli_storage_data_plane_command('storage container lease release', 'azure.storage.blob.blockblobservice#BlockBlobService.release_container_lease', factory) -cli_storage_data_plane_command('storage container lease change', 'azure.storage.blob.blockblobservice#BlockBlobService.change_container_lease', factory) -cli_storage_data_plane_command('storage container lease break', 'azure.storage.blob.blockblobservice#BlockBlobService.break_container_lease', factory) -cli_storage_data_plane_command('storage container exists', 'azure.storage.blob.baseblobservice#BaseBlobService.exists', factory, transform=create_boolean_result_output_transformer('exists'), table_transformer=transform_boolean_for_table) -cli_storage_data_plane_command('storage container set-permission', 'azure.storage.blob.baseblobservice#BaseBlobService.set_container_acl', factory) -cli_storage_data_plane_command('storage container show-permission', 'azure.storage.blob.baseblobservice#BaseBlobService.get_container_acl', factory, transform=transform_container_permission_output) -cli_storage_data_plane_command('storage container policy create', 'azure.cli.command_modules.storage.custom#create_acl_policy', factory) -cli_storage_data_plane_command('storage container policy delete', 'azure.cli.command_modules.storage.custom#delete_acl_policy', factory) -cli_storage_data_plane_command('storage container policy show', 'azure.cli.command_modules.storage.custom#get_acl_policy', factory) -cli_storage_data_plane_command('storage container policy list', 'azure.cli.command_modules.storage.custom#list_acl_policies', factory, table_transformer=transform_acl_list_output) -cli_storage_data_plane_command('storage container policy update', 'azure.cli.command_modules.storage.custom#set_acl_policy', factory) +cli_storage_data_plane_command('storage container list', block_blob_path + 'list_containers', factory, transform=transform_storage_list_output, table_transformer=transform_container_list) +cli_storage_data_plane_command('storage container delete', block_blob_path + 'delete_container', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) +cli_storage_data_plane_command('storage container show', block_blob_path + 'get_container_properties', factory, table_transformer=transform_container_show) +cli_storage_data_plane_command('storage container create', block_blob_path + 'create_container', factory, transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) +cli_storage_data_plane_command('storage container generate-sas', block_blob_path + 'generate_container_shared_access_signature', factory) +cli_storage_data_plane_command('storage container metadata update', block_blob_path + 'set_container_metadata', factory) +cli_storage_data_plane_command('storage container metadata show', block_blob_path + 'get_container_metadata', factory) +cli_storage_data_plane_command('storage container lease acquire', block_blob_path + 'acquire_container_lease', factory) +cli_storage_data_plane_command('storage container lease renew', block_blob_path + 'renew_container_lease', factory) +cli_storage_data_plane_command('storage container lease release', block_blob_path + 'release_container_lease', factory) +cli_storage_data_plane_command('storage container lease change', block_blob_path + 'change_container_lease', factory) +cli_storage_data_plane_command('storage container lease break', block_blob_path + 'break_container_lease', factory) +cli_storage_data_plane_command('storage container exists', base_blob_path + 'exists', factory, transform=create_boolean_result_output_transformer('exists'), table_transformer=transform_boolean_for_table) +cli_storage_data_plane_command('storage container set-permission', base_blob_path + 'set_container_acl', factory) +cli_storage_data_plane_command('storage container show-permission', base_blob_path + 'get_container_acl', factory, transform=transform_container_permission_output) +cli_storage_data_plane_command('storage container policy create', custom_path + 'create_acl_policy', factory) +cli_storage_data_plane_command('storage container policy delete', custom_path + 'delete_acl_policy', factory) +cli_storage_data_plane_command('storage container policy show', custom_path + 'get_acl_policy', factory) +cli_storage_data_plane_command('storage container policy list', custom_path + 'list_acl_policies', factory, table_transformer=transform_acl_list_output) +cli_storage_data_plane_command('storage container policy update', custom_path + 'set_acl_policy', factory) # blob commands -cli_storage_data_plane_command('storage blob list', 'azure.storage.blob.blockblobservice#BlockBlobService.list_blobs', factory, transform=transform_storage_list_output, table_transformer=transform_blob_output) -cli_storage_data_plane_command('storage blob delete', 'azure.storage.blob.blockblobservice#BlockBlobService.delete_blob', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) -cli_storage_data_plane_command('storage blob generate-sas', 'azure.storage.blob.blockblobservice#BlockBlobService.generate_blob_shared_access_signature', factory) -cli_storage_data_plane_command('storage blob url', 'azure.storage.blob.blockblobservice#BlockBlobService.make_blob_url', factory, transform=transform_url) -cli_storage_data_plane_command('storage blob snapshot', 'azure.storage.blob.blockblobservice#BlockBlobService.snapshot_blob', factory) -cli_storage_data_plane_command('storage blob show', 'azure.storage.blob.blockblobservice#BlockBlobService.get_blob_properties', factory, table_transformer=transform_blob_output) -cli_storage_data_plane_command('storage blob update', 'azure.storage.blob.blockblobservice#BlockBlobService.set_blob_properties', factory) -cli_storage_data_plane_command('storage blob exists', 'azure.storage.blob.baseblobservice#BaseBlobService.exists', factory, transform=create_boolean_result_output_transformer('exists')) -cli_storage_data_plane_command('storage blob download', 'azure.storage.blob.baseblobservice#BaseBlobService.get_blob_to_path', factory) -cli_storage_data_plane_command('storage blob upload', 'azure.cli.command_modules.storage.custom#upload_blob', factory) -cli_storage_data_plane_command('storage blob metadata show', 'azure.storage.blob.blockblobservice#BlockBlobService.get_blob_metadata', factory) -cli_storage_data_plane_command('storage blob metadata update', 'azure.storage.blob.blockblobservice#BlockBlobService.set_blob_metadata', factory) -cli_storage_data_plane_command('storage blob service-properties show', 'azure.storage.blob.baseblobservice#BaseBlobService.get_blob_service_properties', factory) -cli_storage_data_plane_command('storage blob lease acquire', 'azure.storage.blob.blockblobservice#BlockBlobService.acquire_blob_lease', factory) -cli_storage_data_plane_command('storage blob lease renew', 'azure.storage.blob.blockblobservice#BlockBlobService.renew_blob_lease', factory) -cli_storage_data_plane_command('storage blob lease release', 'azure.storage.blob.blockblobservice#BlockBlobService.release_blob_lease', factory) -cli_storage_data_plane_command('storage blob lease change', 'azure.storage.blob.blockblobservice#BlockBlobService.change_blob_lease', factory) -cli_storage_data_plane_command('storage blob lease break', 'azure.storage.blob.blockblobservice#BlockBlobService.break_blob_lease', factory) -cli_storage_data_plane_command('storage blob copy start', 'azure.storage.blob.blockblobservice#BlockBlobService.copy_blob', factory) +cli_storage_data_plane_command('storage blob list', block_blob_path + 'list_blobs', factory, transform=transform_storage_list_output, table_transformer=transform_blob_output) +cli_storage_data_plane_command('storage blob delete', block_blob_path + 'delete_blob', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) +cli_storage_data_plane_command('storage blob generate-sas', block_blob_path + 'generate_blob_shared_access_signature', factory) +cli_storage_data_plane_command('storage blob url', block_blob_path + 'make_blob_url', factory, transform=transform_url) +cli_storage_data_plane_command('storage blob snapshot', block_blob_path + 'snapshot_blob', factory) +cli_storage_data_plane_command('storage blob show', block_blob_path + 'get_blob_properties', factory, table_transformer=transform_blob_output) +cli_storage_data_plane_command('storage blob update', block_blob_path + 'set_blob_properties', factory) +cli_storage_data_plane_command('storage blob exists', base_blob_path + 'exists', factory, transform=create_boolean_result_output_transformer('exists')) +cli_storage_data_plane_command('storage blob download', base_blob_path + 'get_blob_to_path', factory) +cli_storage_data_plane_command('storage blob upload', custom_path + 'upload_blob', factory) +cli_storage_data_plane_command('storage blob metadata show', block_blob_path + 'get_blob_metadata', factory) +cli_storage_data_plane_command('storage blob metadata update', block_blob_path + 'set_blob_metadata', factory) +cli_storage_data_plane_command('storage blob service-properties show', base_blob_path + 'get_blob_service_properties', factory) +cli_storage_data_plane_command('storage blob lease acquire', block_blob_path + 'acquire_blob_lease', factory) +cli_storage_data_plane_command('storage blob lease renew', block_blob_path + 'renew_blob_lease', factory) +cli_storage_data_plane_command('storage blob lease release', block_blob_path + 'release_blob_lease', factory) +cli_storage_data_plane_command('storage blob lease change', block_blob_path + 'change_blob_lease', factory) +cli_storage_data_plane_command('storage blob lease break', block_blob_path + 'break_blob_lease', factory) +cli_storage_data_plane_command('storage blob copy start', block_blob_path + 'copy_blob', factory) cli_storage_data_plane_command('storage blob copy start-batch', 'azure.cli.command_modules.storage.blob#storage_blob_copy_batch', factory) -cli_storage_data_plane_command('storage blob copy cancel', 'azure.storage.blob.blockblobservice#BlockBlobService.abort_copy_blob', factory) - -cli_storage_data_plane_command('storage blob upload-batch', - 'azure.cli.command_modules.storage.blob#storage_blob_upload_batch', - factory) - -cli_storage_data_plane_command('storage blob download-batch', - 'azure.cli.command_modules.storage.blob#storage_blob_download_batch', - factory) +cli_storage_data_plane_command('storage blob copy cancel', block_blob_path + 'abort_copy_blob', factory) +cli_storage_data_plane_command('storage blob upload-batch', 'azure.cli.command_modules.storage.blob#storage_blob_upload_batch', factory) +cli_storage_data_plane_command('storage blob download-batch', 'azure.cli.command_modules.storage.blob#storage_blob_download_batch', factory) # share commands factory = file_data_service_factory -cli_storage_data_plane_command('storage share list', 'azure.storage.file.fileservice#FileService.list_shares', factory, transform=transform_storage_list_output, table_transformer=transform_share_list) -cli_storage_data_plane_command('storage share create', 'azure.storage.file.fileservice#FileService.create_share', factory, transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) -cli_storage_data_plane_command('storage share delete', 'azure.storage.file.fileservice#FileService.delete_share', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) -cli_storage_data_plane_command('storage share generate-sas', 'azure.storage.file.fileservice#FileService.generate_share_shared_access_signature', factory) -cli_storage_data_plane_command('storage share stats', 'azure.storage.file.fileservice#FileService.get_share_stats', factory) -cli_storage_data_plane_command('storage share show', 'azure.storage.file.fileservice#FileService.get_share_properties', factory) -cli_storage_data_plane_command('storage share update', 'azure.storage.file.fileservice#FileService.set_share_properties', factory) -cli_storage_data_plane_command('storage share metadata show', 'azure.storage.file.fileservice#FileService.get_share_metadata', factory) -cli_storage_data_plane_command('storage share metadata update', 'azure.storage.file.fileservice#FileService.set_share_metadata', factory) -cli_storage_data_plane_command('storage share exists', 'azure.storage.file.fileservice#FileService.exists', factory, transform=create_boolean_result_output_transformer('exists')) -cli_storage_data_plane_command('storage share policy create', 'azure.cli.command_modules.storage.custom#create_acl_policy', factory) -cli_storage_data_plane_command('storage share policy delete', 'azure.cli.command_modules.storage.custom#delete_acl_policy', factory) -cli_storage_data_plane_command('storage share policy show', 'azure.cli.command_modules.storage.custom#get_acl_policy', factory) -cli_storage_data_plane_command('storage share policy list', 'azure.cli.command_modules.storage.custom#list_acl_policies', factory, table_transformer=transform_acl_list_output) -cli_storage_data_plane_command('storage share policy update', 'azure.cli.command_modules.storage.custom#set_acl_policy', factory) +cli_storage_data_plane_command('storage share list', file_service_path + 'list_shares', factory, transform=transform_storage_list_output, table_transformer=transform_share_list) +cli_storage_data_plane_command('storage share create', file_service_path + 'create_share', factory, transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) +cli_storage_data_plane_command('storage share delete', file_service_path + 'delete_share', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) +cli_storage_data_plane_command('storage share generate-sas', file_service_path + 'generate_share_shared_access_signature', factory) +cli_storage_data_plane_command('storage share stats', file_service_path + 'get_share_stats', factory) +cli_storage_data_plane_command('storage share show', file_service_path + 'get_share_properties', factory) +cli_storage_data_plane_command('storage share update', file_service_path + 'set_share_properties', factory) +cli_storage_data_plane_command('storage share metadata show', file_service_path + 'get_share_metadata', factory) +cli_storage_data_plane_command('storage share metadata update', file_service_path + 'set_share_metadata', factory) +cli_storage_data_plane_command('storage share exists', file_service_path + 'exists', factory, transform=create_boolean_result_output_transformer('exists')) +cli_storage_data_plane_command('storage share policy create', custom_path + 'create_acl_policy', factory) +cli_storage_data_plane_command('storage share policy delete', custom_path + 'delete_acl_policy', factory) +cli_storage_data_plane_command('storage share policy show', custom_path + 'get_acl_policy', factory) +cli_storage_data_plane_command('storage share policy list', custom_path + 'list_acl_policies', factory, table_transformer=transform_acl_list_output) +cli_storage_data_plane_command('storage share policy update', custom_path + 'set_acl_policy', factory) # directory commands -cli_storage_data_plane_command('storage directory create', 'azure.storage.file.fileservice#FileService.create_directory', factory, transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) -cli_storage_data_plane_command('storage directory delete', 'azure.storage.file.fileservice#FileService.delete_directory', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) -cli_storage_data_plane_command('storage directory show', 'azure.storage.file.fileservice#FileService.get_directory_properties', factory, table_transformer=transform_file_output) -cli_storage_data_plane_command('storage directory list', 'azure.cli.command_modules.storage.custom#list_share_directories', factory, transform=transform_file_directory_result, table_transformer=transform_file_output) -cli_storage_data_plane_command('storage directory exists', 'azure.storage.file.fileservice#FileService.exists', factory, transform=create_boolean_result_output_transformer('exists')) -cli_storage_data_plane_command('storage directory metadata show', 'azure.storage.file.fileservice#FileService.get_directory_metadata', factory) -cli_storage_data_plane_command('storage directory metadata update', 'azure.storage.file.fileservice#FileService.set_directory_metadata', factory) +cli_storage_data_plane_command('storage directory create', file_service_path + 'create_directory', factory, transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) +cli_storage_data_plane_command('storage directory delete', file_service_path + 'delete_directory', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) +cli_storage_data_plane_command('storage directory show', file_service_path + 'get_directory_properties', factory, table_transformer=transform_file_output) +cli_storage_data_plane_command('storage directory list', custom_path + 'list_share_directories', factory, transform=transform_file_directory_result, table_transformer=transform_file_output) +cli_storage_data_plane_command('storage directory exists', file_service_path + 'exists', factory, transform=create_boolean_result_output_transformer('exists')) +cli_storage_data_plane_command('storage directory metadata show', file_service_path + 'get_directory_metadata', factory) +cli_storage_data_plane_command('storage directory metadata update', file_service_path + 'set_directory_metadata', factory) # file commands -cli_storage_data_plane_command('storage file list', 'azure.cli.command_modules.storage.custom#list_share_files', factory, transform=transform_file_directory_result, table_transformer=transform_file_output) -cli_storage_data_plane_command('storage file delete', 'azure.storage.file.fileservice#FileService.delete_file', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) -cli_storage_data_plane_command('storage file resize', 'azure.storage.file.fileservice#FileService.resize_file', factory) -cli_storage_data_plane_command('storage file url', 'azure.storage.file.fileservice#FileService.make_file_url', factory, transform=transform_url) -cli_storage_data_plane_command('storage file generate-sas', 'azure.storage.file.fileservice#FileService.generate_file_shared_access_signature', factory) -cli_storage_data_plane_command('storage file show', 'azure.storage.file.fileservice#FileService.get_file_properties', factory, table_transformer=transform_file_output) -cli_storage_data_plane_command('storage file update', 'azure.storage.file.fileservice#FileService.set_file_properties', factory) -cli_storage_data_plane_command('storage file exists', 'azure.storage.file.fileservice#FileService.exists', factory, transform=create_boolean_result_output_transformer('exists')) -cli_storage_data_plane_command('storage file download', 'azure.storage.file.fileservice#FileService.get_file_to_path', factory) -cli_storage_data_plane_command('storage file upload', 'azure.storage.file.fileservice#FileService.create_file_from_path', factory) -cli_storage_data_plane_command('storage file metadata show', 'azure.storage.file.fileservice#FileService.get_file_metadata', factory) -cli_storage_data_plane_command('storage file metadata update', 'azure.storage.file.fileservice#FileService.set_file_metadata', factory) -cli_storage_data_plane_command('storage file copy start', 'azure.storage.file.fileservice#FileService.copy_file', factory) -cli_storage_data_plane_command('storage file copy cancel', 'azure.storage.file.fileservice#FileService.abort_copy_file', factory) - -cli_storage_data_plane_command('storage file upload-batch', - 'azure.cli.command_modules.storage.file#storage_file_upload_batch', - factory) - -cli_storage_data_plane_command('storage file download-batch', - 'azure.cli.command_modules.storage.file#storage_file_download_batch', - factory) - -cli_storage_data_plane_command('storage file copy start-batch', - 'azure.cli.command_modules.storage.file#storage_file_copy_batch', - factory) +cli_storage_data_plane_command('storage file list', custom_path + 'list_share_files', factory, transform=transform_file_directory_result, table_transformer=transform_file_output) +cli_storage_data_plane_command('storage file delete', file_service_path + 'delete_file', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) +cli_storage_data_plane_command('storage file resize', file_service_path + 'resize_file', factory) +cli_storage_data_plane_command('storage file url', file_service_path + 'make_file_url', factory, transform=transform_url) +cli_storage_data_plane_command('storage file generate-sas', file_service_path + 'generate_file_shared_access_signature', factory) +cli_storage_data_plane_command('storage file show', file_service_path + 'get_file_properties', factory, table_transformer=transform_file_output) +cli_storage_data_plane_command('storage file update', file_service_path + 'set_file_properties', factory) +cli_storage_data_plane_command('storage file exists', file_service_path + 'exists', factory, transform=create_boolean_result_output_transformer('exists')) +cli_storage_data_plane_command('storage file download', file_service_path + 'get_file_to_path', factory) +cli_storage_data_plane_command('storage file upload', file_service_path + 'create_file_from_path', factory) +cli_storage_data_plane_command('storage file metadata show', file_service_path + 'get_file_metadata', factory) +cli_storage_data_plane_command('storage file metadata update', file_service_path + 'set_file_metadata', factory) +cli_storage_data_plane_command('storage file copy start', file_service_path + 'copy_file', factory) +cli_storage_data_plane_command('storage file copy cancel', file_service_path + 'abort_copy_file', factory) +cli_storage_data_plane_command('storage file upload-batch', 'azure.cli.command_modules.storage.file#storage_file_upload_batch', factory) +cli_storage_data_plane_command('storage file download-batch', 'azure.cli.command_modules.storage.file#storage_file_download_batch', factory) +cli_storage_data_plane_command('storage file copy start-batch', 'azure.cli.command_modules.storage.file#storage_file_copy_batch', factory) # table commands factory = table_data_service_factory -cli_storage_data_plane_command('storage table generate-sas', 'azure.storage.table.tableservice#TableService.generate_table_shared_access_signature', factory) -cli_storage_data_plane_command('storage table stats', 'azure.storage.table.tableservice#TableService.get_table_service_stats', factory) -cli_storage_data_plane_command('storage table list', 'azure.storage.table.tableservice#TableService.list_tables', factory, transform=transform_storage_list_output) -cli_storage_data_plane_command('storage table create', 'azure.storage.table.tableservice#TableService.create_table', factory, transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) -cli_storage_data_plane_command('storage table exists', 'azure.storage.table.tableservice#TableService.exists', factory, transform=create_boolean_result_output_transformer('exists')) -cli_storage_data_plane_command('storage table delete', 'azure.storage.table.tableservice#TableService.delete_table', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) -cli_storage_data_plane_command('storage table policy create', 'azure.cli.command_modules.storage.custom#create_acl_policy', factory) -cli_storage_data_plane_command('storage table policy delete', 'azure.cli.command_modules.storage.custom#delete_acl_policy', factory) -cli_storage_data_plane_command('storage table policy show', 'azure.cli.command_modules.storage.custom#get_acl_policy', factory) -cli_storage_data_plane_command('storage table policy list', 'azure.cli.command_modules.storage.custom#list_acl_policies', factory, table_transformer=transform_acl_list_output) -cli_storage_data_plane_command('storage table policy update', 'azure.cli.command_modules.storage.custom#set_acl_policy', factory) +cli_storage_data_plane_command('storage table generate-sas', table_path + 'generate_table_shared_access_signature', factory) +cli_storage_data_plane_command('storage table stats', table_path + 'get_table_service_stats', factory) +cli_storage_data_plane_command('storage table list', table_path + 'list_tables', factory, transform=transform_storage_list_output) +cli_storage_data_plane_command('storage table create', table_path + 'create_table', factory, transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) +cli_storage_data_plane_command('storage table exists', table_path + 'exists', factory, transform=create_boolean_result_output_transformer('exists')) +cli_storage_data_plane_command('storage table delete', table_path + 'delete_table', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) +cli_storage_data_plane_command('storage table policy create', custom_path + 'create_acl_policy', factory) +cli_storage_data_plane_command('storage table policy delete', custom_path + 'delete_acl_policy', factory) +cli_storage_data_plane_command('storage table policy show', custom_path + 'get_acl_policy', factory) +cli_storage_data_plane_command('storage table policy list', custom_path + 'list_acl_policies', factory, table_transformer=transform_acl_list_output) +cli_storage_data_plane_command('storage table policy update', custom_path + 'set_acl_policy', factory) # table entity commands -cli_storage_data_plane_command('storage entity query', 'azure.storage.table.tableservice#TableService.query_entities', factory, table_transformer=transform_entity_query_output) -cli_storage_data_plane_command('storage entity show', 'azure.storage.table.tableservice#TableService.get_entity', factory, table_transformer=transform_entity_show) -cli_storage_data_plane_command('storage entity insert', 'azure.cli.command_modules.storage.custom#insert_table_entity', factory) -cli_storage_data_plane_command('storage entity replace', 'azure.storage.table.tableservice#TableService.update_entity', factory) -cli_storage_data_plane_command('storage entity merge', 'azure.storage.table.tableservice#TableService.merge_entity', factory) -cli_storage_data_plane_command('storage entity delete', 'azure.storage.table.tableservice#TableService.delete_entity', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) +cli_storage_data_plane_command('storage entity query', table_path + 'query_entities', factory, table_transformer=transform_entity_query_output) +cli_storage_data_plane_command('storage entity show', table_path + 'get_entity', factory, table_transformer=transform_entity_show) +cli_storage_data_plane_command('storage entity insert', custom_path + 'insert_table_entity', factory) +cli_storage_data_plane_command('storage entity replace', table_path + 'update_entity', factory) +cli_storage_data_plane_command('storage entity merge', table_path + 'merge_entity', factory) +cli_storage_data_plane_command('storage entity delete', table_path + 'delete_entity', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) # queue commands factory = queue_data_service_factory -cli_storage_data_plane_command('storage queue generate-sas', 'azure.storage.queue.queueservice#QueueService.generate_queue_shared_access_signature', factory) -cli_storage_data_plane_command('storage queue stats', 'azure.storage.queue.queueservice#QueueService.get_queue_service_stats', factory) -cli_storage_data_plane_command('storage queue list', 'azure.storage.queue.queueservice#QueueService.list_queues', factory, transform=transform_storage_list_output) -cli_storage_data_plane_command('storage queue create', 'azure.storage.queue.queueservice#QueueService.create_queue', factory, transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) -cli_storage_data_plane_command('storage queue delete', 'azure.storage.queue.queueservice#QueueService.delete_queue', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) -cli_storage_data_plane_command('storage queue metadata show', 'azure.storage.queue.queueservice#QueueService.get_queue_metadata', factory) -cli_storage_data_plane_command('storage queue metadata update', 'azure.storage.queue.queueservice#QueueService.set_queue_metadata', factory) -cli_storage_data_plane_command('storage queue exists', 'azure.storage.queue.queueservice#QueueService.exists', factory, transform=create_boolean_result_output_transformer('exists')) -cli_storage_data_plane_command('storage queue policy create', 'azure.cli.command_modules.storage.custom#create_acl_policy', factory) -cli_storage_data_plane_command('storage queue policy delete', 'azure.cli.command_modules.storage.custom#delete_acl_policy', factory) -cli_storage_data_plane_command('storage queue policy show', 'azure.cli.command_modules.storage.custom#get_acl_policy', factory) -cli_storage_data_plane_command('storage queue policy list', 'azure.cli.command_modules.storage.custom#list_acl_policies', factory, table_transformer=transform_acl_list_output) -cli_storage_data_plane_command('storage queue policy update', 'azure.cli.command_modules.storage.custom#set_acl_policy', factory) +cli_storage_data_plane_command('storage queue generate-sas', queue_path + 'generate_queue_shared_access_signature', factory) +cli_storage_data_plane_command('storage queue stats', queue_path + 'get_queue_service_stats', factory) +cli_storage_data_plane_command('storage queue list', queue_path + 'list_queues', factory, transform=transform_storage_list_output) +cli_storage_data_plane_command('storage queue create', queue_path + 'create_queue', factory, transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) +cli_storage_data_plane_command('storage queue delete', queue_path + 'delete_queue', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) +cli_storage_data_plane_command('storage queue metadata show', queue_path + 'get_queue_metadata', factory) +cli_storage_data_plane_command('storage queue metadata update', queue_path + 'set_queue_metadata', factory) +cli_storage_data_plane_command('storage queue exists', queue_path + 'exists', factory, transform=create_boolean_result_output_transformer('exists')) +cli_storage_data_plane_command('storage queue policy create', custom_path + 'create_acl_policy', factory) +cli_storage_data_plane_command('storage queue policy delete', custom_path + 'delete_acl_policy', factory) +cli_storage_data_plane_command('storage queue policy show', custom_path + 'get_acl_policy', factory) +cli_storage_data_plane_command('storage queue policy list', custom_path + 'list_acl_policies', factory, table_transformer=transform_acl_list_output) +cli_storage_data_plane_command('storage queue policy update', custom_path + 'set_acl_policy', factory) # queue message commands -cli_storage_data_plane_command('storage message put', 'azure.storage.queue.queueservice#QueueService.put_message', factory) -cli_storage_data_plane_command('storage message get', 'azure.storage.queue.queueservice#QueueService.get_messages', factory, table_transformer=transform_message_show) -cli_storage_data_plane_command('storage message peek', 'azure.storage.queue.queueservice#QueueService.peek_messages', factory, table_transformer=transform_message_show) -cli_storage_data_plane_command('storage message delete', 'azure.storage.queue.queueservice#QueueService.delete_message', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) -cli_storage_data_plane_command('storage message clear', 'azure.storage.queue.queueservice#QueueService.clear_messages', factory) -cli_storage_data_plane_command('storage message update', 'azure.storage.queue.queueservice#QueueService.update_message', factory) +cli_storage_data_plane_command('storage message put', queue_path + 'put_message', factory) +cli_storage_data_plane_command('storage message get', queue_path + 'get_messages', factory, table_transformer=transform_message_show) +cli_storage_data_plane_command('storage message peek', queue_path + 'peek_messages', factory, table_transformer=transform_message_show) +cli_storage_data_plane_command('storage message delete', queue_path + 'delete_message', factory, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) +cli_storage_data_plane_command('storage message clear', queue_path + 'clear_messages', factory) +cli_storage_data_plane_command('storage message update', queue_path + 'update_message', factory) # cors commands -cli_storage_data_plane_command('storage cors list', 'azure.cli.command_modules.storage.custom#list_cors', None, transform=transform_cors_list_output) -cli_storage_data_plane_command('storage cors add', 'azure.cli.command_modules.storage.custom#add_cors', None) -cli_storage_data_plane_command('storage cors clear', 'azure.cli.command_modules.storage.custom#clear_cors', None) +cli_storage_data_plane_command('storage cors list', custom_path + 'list_cors', None, transform=transform_cors_list_output) +cli_storage_data_plane_command('storage cors add', custom_path + 'add_cors', None) +cli_storage_data_plane_command('storage cors clear', custom_path + 'clear_cors', None) # logging commands -cli_storage_data_plane_command('storage logging show', 'azure.cli.command_modules.storage.custom#get_logging', None, table_transformer=transform_logging_list_output) -cli_storage_data_plane_command('storage logging update', 'azure.cli.command_modules.storage.custom#set_logging', None) +cli_storage_data_plane_command('storage logging show', custom_path + 'get_logging', None, table_transformer=transform_logging_list_output) +cli_storage_data_plane_command('storage logging update', custom_path + 'set_logging', None) # metrics commands -cli_storage_data_plane_command('storage metrics show', 'azure.cli.command_modules.storage.custom#get_metrics', None, table_transformer=transform_metrics_list_output) -cli_storage_data_plane_command('storage metrics update', 'azure.cli.command_modules.storage.custom#set_metrics', None) +cli_storage_data_plane_command('storage metrics show', custom_path + 'get_metrics', None, table_transformer=transform_metrics_list_output) +cli_storage_data_plane_command('storage metrics update', custom_path + 'set_metrics', None) diff --git a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py index ae6d78923..b89a8e196 100644 --- a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py +++ b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py @@ -109,20 +109,21 @@ def create_storage_account(resource_group_name, account_name, sku, location, return scf.storage_accounts.create(resource_group_name, account_name, params) -def set_storage_account_properties( - resource_group_name, account_name, sku=None, tags=None, custom_domain=None, - encryption=None, access_tier=None): - ''' Update storage account property (only one at a time).''' +def update_storage_account(instance, sku=None, tags=None, custom_domain=None, + encryption=None, access_tier=None): from azure.mgmt.storage.models import \ - (StorageAccountUpdateParameters, Sku, CustomDomain, AccessTier) - scf = storage_client_factory() - params = StorageAccountUpdateParameters( - sku=Sku(sku) if sku else None, - tags=tags, - custom_domain=CustomDomain(custom_domain) if custom_domain else None, - encryption=encryption, - access_tier=AccessTier(access_tier) if access_tier else None) - return scf.storage_accounts.update(resource_group_name, account_name, params) + (StorageAccountCreateParameters, Sku, CustomDomain, AccessTier) + + params = StorageAccountCreateParameters( + sku=Sku(sku) if sku is not None else instance.sku, + kind=instance.kind, + location=instance.location, + tags=tags if tags is not None else instance.tags, + custom_domain=CustomDomain(custom_domain) if custom_domain is not None else instance.custom_domain, # pylint: disable=line-too-long + encryption=encryption if encryption is not None else instance.encryption, + access_tier=AccessTier(access_tier) if access_tier is not None else instance.access_tier + ) + return params @transfer_doc(BlockBlobService.create_blob_from_path)
[Storage] `storage account update` does not expose Generic Update arguments Recommend to support to add 1 tag, or support JSON input for the --tags. Here is the current script to add one tag. ``` NEW_TAGS=$(az storage account show -g "$resourceGroup" -n "$storageAccount" | jq -r "[.tags + {\"$key\": \"$value\"} | to_entries | .[] | if (.value | contains(\" \")) then .key + \"=\\\"\" + .value + \"\\\"\" else .key + \"=\" + .value end ] | join(\" \")") CMD="az storage account update -g $resourceGroup -n $storageAccount --tags $NEW_TAGS" eval $CMD ``` Do you have any recommendation?
Azure/azure-cli
diff --git a/src/azure-cli-core/azure/cli/core/test_utils/vcr_test_base.py b/src/azure-cli-core/azure/cli/core/test_utils/vcr_test_base.py index 55fd812cd..1db69b991 100644 --- a/src/azure-cli-core/azure/cli/core/test_utils/vcr_test_base.py +++ b/src/azure-cli-core/azure/cli/core/test_utils/vcr_test_base.py @@ -36,7 +36,7 @@ from azure.cli.main import main as cli_main from azure.cli.core import __version__ as core_version import azure.cli.core._debug as _debug from azure.cli.core._profile import Profile -from azure.cli.core._util import CLIError +from azure.cli.core._util import CLIError, random_string LIVE_TEST_CONTROL_ENV = 'AZURE_CLI_TEST_RUN_LIVE' COMMAND_COVERAGE_CONTROL_ENV = 'AZURE_CLI_TEST_COMMAND_COVERAGE' @@ -301,8 +301,7 @@ class VCRTestBase(unittest.TestCase): # pylint: disable=too-many-instance-attri request.uri = _scrub_deployment_name(request.uri) # replace random storage account name with dummy name - request.uri = re.sub('/vcrstorage([\\d]+).', - '/{}.'.format(MOCKED_STORAGE_ACCOUNT), request.uri) + request.uri = re.sub(r'(vcrstorage[\d]+)', MOCKED_STORAGE_ACCOUNT, request.uri) # prevents URI mismatch between Python 2 and 3 if request URI has extra / chars request.uri = re.sub('//', '/', request.uri) request.uri = re.sub('/', '//', request.uri, count=1) @@ -516,8 +515,8 @@ class StorageAccountVCRTestBase(VCRTestBase): @classmethod def generate_account_name(cls): - return 'vcrstorage{}'.format(''.join(choice(digits) for _ in range(12))) + return 'vcrstorage{}'.format(random_string(12, digits_only=True)) @classmethod def generate_random_tag(cls): - return '_{}_'.format(''.join((choice(ascii_lowercase + digits) for _ in range(4)))) + return '_{}_'.format(random_string(4, force_lower=True)) diff --git a/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/recordings/test_webapp_backup_config.yaml b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/recordings/test_webapp_backup_config.yaml new file mode 100644 index 000000000..f19bb6336 --- /dev/null +++ b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/recordings/test_webapp_backup_config.yaml @@ -0,0 +1,395 @@ +interactions: +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [6d24c5ae-f256-11e6-b0e3-98588a06bf8b] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest?api-version=2016-08-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest","name":"azurecli-webapp-backupconfigtest","type":"Microsoft.Web/sites","kind":"app","location":"West + US","tags":null,"properties":{"name":"azurecli-webapp-backupconfigtest","state":"Running","hostNames":["azurecli-webapp-backupconfigtest.azurewebsites.net"],"webSpace":"cli-webapp-backup-WestUSwebspace","selfLink":"https://waws-prod-bay-035.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/cli-webapp-backup-WestUSwebspace/sites/azurecli-webapp-backupconfigtest","repositorySiteName":"azurecli-webapp-backupconfigtest","owner":null,"usageState":"Normal","enabled":true,"adminEnabled":true,"enabledHostNames":["azurecli-webapp-backupconfigtest.azurewebsites.net","azurecli-webapp-backupconfigtest.scm.azurewebsites.net"],"siteProperties":{"metadata":null,"properties":[],"appSettings":null},"availabilityState":"Normal","sslCertificates":null,"csrs":[],"cers":null,"siteMode":null,"hostNameSslStates":[{"name":"azurecli-webapp-backupconfigtest.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Standard"},{"name":"azurecli-webapp-backupconfigtest.scm.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Repository"}],"computeMode":null,"serverFarm":null,"serverFarmId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/serverfarms/webapp-backup-plan","reserved":false,"lastModifiedTimeUtc":"2017-02-14T01:39:17.167","storageRecoveryDefaultState":"Running","contentAvailabilityState":"Normal","runtimeAvailabilityState":"Normal","siteConfig":null,"deploymentId":"azurecli-webapp-backupconfigtest","trafficManagerHostNames":null,"sku":"Standard","premiumAppDeployed":null,"scmSiteAlsoStopped":false,"targetSwapSlot":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"microService":"false","gatewaySiteName":null,"clientAffinityEnabled":true,"clientCertEnabled":false,"hostNamesDisabled":false,"domainVerificationIdentifiers":null,"kind":"app","outboundIpAddresses":"40.112.143.79,40.112.136.154,40.112.141.43,40.112.138.165","containerSize":0,"dailyMemoryTimeQuota":0,"suspendedTill":null,"siteDisabledReason":0,"functionExecutionUnitsCache":null,"maxNumberOfWorkers":null,"homeStamp":"waws-prod-bay-035","cloningInfo":null,"hostingEnvironmentId":null,"tags":null,"resourceGroup":"cli-webapp-backup","defaultHostName":"azurecli-webapp-backupconfigtest.azurewebsites.net","slotSwapStatus":null}}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json] + Date: ['Tue, 14 Feb 2017 01:39:30 GMT'] + ETag: ['"1D28663279D4BF0"'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + content-length: ['2872'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [6dcfed0c-f256-11e6-8bb3-98588a06bf8b] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest/config/backup/list?api-version=2016-08-01 + response: + body: {string: '{"Code":"NotFound","Message":"Backup configuration not found for + site ''azurecli-webapp-backupconfigtest'' with slot ''Production''","Target":null,"Details":[{"Message":"Backup + configuration not found for site ''azurecli-webapp-backupconfigtest'' with + slot ''Production''"},{"Code":"NotFound"},{"ErrorEntity":{"Code":"NotFound","Message":"Backup + configuration not found for site ''azurecli-webapp-backupconfigtest'' with + slot ''Production''","ExtendedCode":"04211","MessageTemplate":"Backup configuration + not found for site ''{0}'' with slot ''{1}''","Parameters":["azurecli-webapp-backupconfigtest","Production"],"InnerErrors":null}}],"Innererror":null}'} + headers: + Cache-Control: [no-cache] + Content-Length: ['638'] + Content-Type: [application/json; charset=utf-8] + Date: ['Tue, 14 Feb 2017 01:39:31 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11951'] + status: {code: 404, message: Not Found} +- request: + body: '{"properties": {"backupSchedule": {"frequencyInterval": 1, "retentionPeriodInDays": + 5, "keepAtLeastOneBackup": true, "frequencyUnit": "Day"}, "storageAccountUrl": + "https://azureclistore.blob.core.windows.net/sitebackups?sv=2015-04-05&sr=c&sig=%2FjH1lEtbm3uFqtMI%2BfFYwgrntOs1qhGnpGv9uRibJ7A%3D&se=2017-02-14T04%3A53%3A28Z&sp=rwdl", + "enabled": true}, "location": "West US"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['372'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [6e8a1f90-f256-11e6-94bb-98588a06bf8b] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest/config/backup?api-version=2016-08-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Tue, 14 Feb 2017 01:39:32 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + x-ms-ratelimit-remaining-subscription-writes: ['1194'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [6fa64ac0-f256-11e6-b6de-98588a06bf8b] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest/config/backup/list?api-version=2016-08-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest","name":"azurecli-webapp-backupconfigtest","type":"Microsoft.Web/sites","location":"West + US","tags":null,"properties":{"name":"azurecli-webapp-backupconfigtest","enabled":true,"storageAccountUrl":"https://azureclistore.blob.core.windows.net/sitebackups?sv=2015-04-05&sr=c&sig=%2FjH1lEtbm3uFqtMI%2BfFYwgrntOs1qhGnpGv9uRibJ7A%3D&se=2017-02-14T04%3A53%3A28Z&sp=rwdl","backupSchedule":{"frequencyInterval":1,"frequencyUnit":"Day","keepAtLeastOneBackup":true,"retentionPeriodInDays":5,"startTime":"2017-02-14T01:39:33.4251542","lastExecutionTime":"2017-02-14T01:39:33.7555589"},"databases":null,"type":"Default"}}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json] + Date: ['Tue, 14 Feb 2017 01:39:34 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + content-length: ['769'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11960'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [70abf17a-f256-11e6-921b-98588a06bf8b] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest?api-version=2016-08-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest","name":"azurecli-webapp-backupconfigtest","type":"Microsoft.Web/sites","kind":"app","location":"West + US","tags":null,"properties":{"name":"azurecli-webapp-backupconfigtest","state":"Running","hostNames":["azurecli-webapp-backupconfigtest.azurewebsites.net"],"webSpace":"cli-webapp-backup-WestUSwebspace","selfLink":"https://waws-prod-bay-035.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/cli-webapp-backup-WestUSwebspace/sites/azurecli-webapp-backupconfigtest","repositorySiteName":"azurecli-webapp-backupconfigtest","owner":null,"usageState":"Normal","enabled":true,"adminEnabled":true,"enabledHostNames":["azurecli-webapp-backupconfigtest.azurewebsites.net","azurecli-webapp-backupconfigtest.scm.azurewebsites.net"],"siteProperties":{"metadata":null,"properties":[],"appSettings":null},"availabilityState":"Normal","sslCertificates":null,"csrs":[],"cers":null,"siteMode":null,"hostNameSslStates":[{"name":"azurecli-webapp-backupconfigtest.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Standard"},{"name":"azurecli-webapp-backupconfigtest.scm.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Repository"}],"computeMode":null,"serverFarm":null,"serverFarmId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/serverfarms/webapp-backup-plan","reserved":false,"lastModifiedTimeUtc":"2017-02-14T01:39:17.167","storageRecoveryDefaultState":"Running","contentAvailabilityState":"Normal","runtimeAvailabilityState":"Normal","siteConfig":null,"deploymentId":"azurecli-webapp-backupconfigtest","trafficManagerHostNames":null,"sku":"Standard","premiumAppDeployed":null,"scmSiteAlsoStopped":false,"targetSwapSlot":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"microService":"false","gatewaySiteName":null,"clientAffinityEnabled":true,"clientCertEnabled":false,"hostNamesDisabled":false,"domainVerificationIdentifiers":null,"kind":"app","outboundIpAddresses":"40.112.143.79,40.112.136.154,40.112.141.43,40.112.138.165","containerSize":0,"dailyMemoryTimeQuota":0,"suspendedTill":null,"siteDisabledReason":0,"functionExecutionUnitsCache":null,"maxNumberOfWorkers":null,"homeStamp":"waws-prod-bay-035","cloningInfo":null,"hostingEnvironmentId":null,"tags":null,"resourceGroup":"cli-webapp-backup","defaultHostName":"azurecli-webapp-backupconfigtest.azurewebsites.net","slotSwapStatus":null}}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json] + Date: ['Tue, 14 Feb 2017 01:39:36 GMT'] + ETag: ['"1D28663279D4BF0"'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + content-length: ['2872'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [714da4c8-f256-11e6-a621-98588a06bf8b] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest/config/backup/list?api-version=2016-08-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest","name":"azurecli-webapp-backupconfigtest","type":"Microsoft.Web/sites","location":"West + US","tags":null,"properties":{"name":"azurecli-webapp-backupconfigtest","enabled":true,"storageAccountUrl":"https://azureclistore.blob.core.windows.net/sitebackups?sv=2015-04-05&sr=c&sig=%2FjH1lEtbm3uFqtMI%2BfFYwgrntOs1qhGnpGv9uRibJ7A%3D&se=2017-02-14T04%3A53%3A28Z&sp=rwdl","backupSchedule":{"frequencyInterval":1,"frequencyUnit":"Day","keepAtLeastOneBackup":true,"retentionPeriodInDays":5,"startTime":"2017-02-14T01:39:33.4251542","lastExecutionTime":"2017-02-14T01:39:33.7555589"},"databases":null,"type":"Default"}}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json] + Date: ['Tue, 14 Feb 2017 01:39:37 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + content-length: ['769'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11882'] + status: {code: 200, message: OK} +- request: + body: '{"properties": {"backupSchedule": {"frequencyInterval": 1, "retentionPeriodInDays": + 5, "keepAtLeastOneBackup": true, "frequencyUnit": "Day"}, "storageAccountUrl": + "https://azureclistore.blob.core.windows.net/sitebackups?sv=2015-04-05&sr=c&sig=%2FjH1lEtbm3uFqtMI%2BfFYwgrntOs1qhGnpGv9uRibJ7A%3D&se=2017-02-14T04%3A53%3A28Z&sp=rwdl", + "databases": [{"name": "cli-db", "databaseType": "SqlAzure", "connectionString": + "Server=tcp:cli-backup.database.windows.net,1433;Initial Catalog=cli-db;Persist + Security Info=False;User ID=cliuser;Password=cli!password1;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection + Timeout=30;"}], "enabled": true}, "location": "West US"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['692'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [71b978da-f256-11e6-bfdd-98588a06bf8b] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest/config/backup?api-version=2016-08-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Tue, 14 Feb 2017 01:39:37 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [72aeb7fa-f256-11e6-8f8a-98588a06bf8b] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest/config/backup/list?api-version=2016-08-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest","name":"azurecli-webapp-backupconfigtest","type":"Microsoft.Web/sites","location":"West + US","tags":null,"properties":{"name":"azurecli-webapp-backupconfigtest","enabled":true,"storageAccountUrl":"https://azureclistore.blob.core.windows.net/sitebackups?sv=2015-04-05&sr=c&sig=%2FjH1lEtbm3uFqtMI%2BfFYwgrntOs1qhGnpGv9uRibJ7A%3D&se=2017-02-14T04%3A53%3A28Z&sp=rwdl","backupSchedule":{"frequencyInterval":1,"frequencyUnit":"Day","keepAtLeastOneBackup":true,"retentionPeriodInDays":5,"startTime":"2017-02-14T01:39:33.4251542","lastExecutionTime":"2017-02-14T01:39:33.7555589"},"databases":[{"databaseType":"SqlAzure","name":"cli-db","connectionStringName":null,"connectionString":"Server=tcp:cli-backup.database.windows.net,1433;Initial + Catalog=cli-db;Persist Security Info=False;User ID=cliuser;Password=cli!password1;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection + Timeout=30;"}],"type":"Default"}}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json] + Date: ['Tue, 14 Feb 2017 01:39:39 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + content-length: ['1093'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11871'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [738ece5e-f256-11e6-ad4c-98588a06bf8b] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest?api-version=2016-08-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest","name":"azurecli-webapp-backupconfigtest","type":"Microsoft.Web/sites","kind":"app","location":"West + US","tags":null,"properties":{"name":"azurecli-webapp-backupconfigtest","state":"Running","hostNames":["azurecli-webapp-backupconfigtest.azurewebsites.net"],"webSpace":"cli-webapp-backup-WestUSwebspace","selfLink":"https://waws-prod-bay-035.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/cli-webapp-backup-WestUSwebspace/sites/azurecli-webapp-backupconfigtest","repositorySiteName":"azurecli-webapp-backupconfigtest","owner":null,"usageState":"Normal","enabled":true,"adminEnabled":true,"enabledHostNames":["azurecli-webapp-backupconfigtest.azurewebsites.net","azurecli-webapp-backupconfigtest.scm.azurewebsites.net"],"siteProperties":{"metadata":null,"properties":[],"appSettings":null},"availabilityState":"Normal","sslCertificates":null,"csrs":[],"cers":null,"siteMode":null,"hostNameSslStates":[{"name":"azurecli-webapp-backupconfigtest.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Standard"},{"name":"azurecli-webapp-backupconfigtest.scm.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Repository"}],"computeMode":null,"serverFarm":null,"serverFarmId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/serverfarms/webapp-backup-plan","reserved":false,"lastModifiedTimeUtc":"2017-02-14T01:39:17.167","storageRecoveryDefaultState":"Running","contentAvailabilityState":"Normal","runtimeAvailabilityState":"Normal","siteConfig":null,"deploymentId":"azurecli-webapp-backupconfigtest","trafficManagerHostNames":null,"sku":"Standard","premiumAppDeployed":null,"scmSiteAlsoStopped":false,"targetSwapSlot":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"microService":"false","gatewaySiteName":null,"clientAffinityEnabled":true,"clientCertEnabled":false,"hostNamesDisabled":false,"domainVerificationIdentifiers":null,"kind":"app","outboundIpAddresses":"40.112.143.79,40.112.136.154,40.112.141.43,40.112.138.165","containerSize":0,"dailyMemoryTimeQuota":0,"suspendedTill":null,"siteDisabledReason":0,"functionExecutionUnitsCache":null,"maxNumberOfWorkers":null,"homeStamp":"waws-prod-bay-035","cloningInfo":null,"hostingEnvironmentId":null,"tags":null,"resourceGroup":"cli-webapp-backup","defaultHostName":"azurecli-webapp-backupconfigtest.azurewebsites.net","slotSwapStatus":null}}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json] + Date: ['Tue, 14 Feb 2017 01:39:40 GMT'] + ETag: ['"1D28663279D4BF0"'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + content-length: ['2872'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [74045d24-f256-11e6-a6dd-98588a06bf8b] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest/config/backup/list?api-version=2016-08-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest","name":"azurecli-webapp-backupconfigtest","type":"Microsoft.Web/sites","location":"West + US","tags":null,"properties":{"name":"azurecli-webapp-backupconfigtest","enabled":true,"storageAccountUrl":"https://azureclistore.blob.core.windows.net/sitebackups?sv=2015-04-05&sr=c&sig=%2FjH1lEtbm3uFqtMI%2BfFYwgrntOs1qhGnpGv9uRibJ7A%3D&se=2017-02-14T04%3A53%3A28Z&sp=rwdl","backupSchedule":{"frequencyInterval":1,"frequencyUnit":"Day","keepAtLeastOneBackup":true,"retentionPeriodInDays":5,"startTime":"2017-02-14T01:39:33.4251542","lastExecutionTime":"2017-02-14T01:39:33.7555589"},"databases":[{"databaseType":"SqlAzure","name":"cli-db","connectionStringName":null,"connectionString":"Server=tcp:cli-backup.database.windows.net,1433;Initial + Catalog=cli-db;Persist Security Info=False;User ID=cliuser;Password=cli!password1;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection + Timeout=30;"}],"type":"Default"}}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json] + Date: ['Tue, 14 Feb 2017 01:39:41 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + content-length: ['1093'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11898'] + status: {code: 200, message: OK} +- request: + body: '{"properties": {"backupSchedule": {"frequencyInterval": 18, "retentionPeriodInDays": + 7, "keepAtLeastOneBackup": false, "frequencyUnit": "Hour"}, "storageAccountUrl": + "https://azureclistore.blob.core.windows.net/sitebackups?sv=2015-04-05&sr=c&sig=%2FjH1lEtbm3uFqtMI%2BfFYwgrntOs1qhGnpGv9uRibJ7A%3D&se=2017-02-14T04%3A53%3A28Z&sp=rwdl", + "databases": [{"name": "cli-db", "databaseType": "SqlAzure", "connectionString": + "Server=tcp:cli-backup.database.windows.net,1433;Initial Catalog=cli-db;Persist + Security Info=False;User ID=cliuser;Password=cli!password1;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection + Timeout=30;"}], "enabled": true}, "location": "West US"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['695'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [74945b34-f256-11e6-a0e4-98588a06bf8b] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest/config/backup?api-version=2016-08-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Tue, 14 Feb 2017 01:39:43 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [75ebf9f8-f256-11e6-a29b-98588a06bf8b] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest/config/backup/list?api-version=2016-08-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backupconfigtest","name":"azurecli-webapp-backupconfigtest","type":"Microsoft.Web/sites","location":"West + US","tags":null,"properties":{"name":"azurecli-webapp-backupconfigtest","enabled":true,"storageAccountUrl":"https://azureclistore.blob.core.windows.net/sitebackups?sv=2015-04-05&sr=c&sig=%2FjH1lEtbm3uFqtMI%2BfFYwgrntOs1qhGnpGv9uRibJ7A%3D&se=2017-02-14T04%3A53%3A28Z&sp=rwdl","backupSchedule":{"frequencyInterval":18,"frequencyUnit":"Hour","keepAtLeastOneBackup":false,"retentionPeriodInDays":7,"startTime":"2017-02-14T01:39:33.4251542","lastExecutionTime":"2017-02-14T01:39:44.6323705"},"databases":[{"databaseType":"SqlAzure","name":"cli-db","connectionStringName":null,"connectionString":"Server=tcp:cli-backup.database.windows.net,1433;Initial + Catalog=cli-db;Persist Security Info=False;User ID=cliuser;Password=cli!password1;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection + Timeout=30;"}],"type":"Default"}}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json] + Date: ['Tue, 14 Feb 2017 01:39:44 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + content-length: ['1096'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11880'] + status: {code: 200, message: OK} +version: 1 diff --git a/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/recordings/test_webapp_backup_restore.yaml b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/recordings/test_webapp_backup_restore.yaml new file mode 100644 index 000000000..85f99a642 --- /dev/null +++ b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/recordings/test_webapp_backup_restore.yaml @@ -0,0 +1,172 @@ +interactions: +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [b000d254-f252-11e6-acb4-98588a06bf8b] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backuptest2?api-version=2016-08-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backuptest2","name":"azurecli-webapp-backuptest2","type":"Microsoft.Web/sites","kind":"app","location":"West + US","tags":null,"properties":{"name":"azurecli-webapp-backuptest2","state":"Running","hostNames":["azurecli-webapp-backuptest2.azurewebsites.net"],"webSpace":"cli-webapp-backup-WestUSwebspace","selfLink":"https://waws-prod-bay-073.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/cli-webapp-backup-WestUSwebspace/sites/azurecli-webapp-backuptest2","repositorySiteName":"azurecli-webapp-backuptest2","owner":null,"usageState":"Normal","enabled":true,"adminEnabled":true,"enabledHostNames":["azurecli-webapp-backuptest2.azurewebsites.net","azurecli-webapp-backuptest2.scm.azurewebsites.net"],"siteProperties":{"metadata":null,"properties":[],"appSettings":null},"availabilityState":"Normal","sslCertificates":null,"csrs":[],"cers":null,"siteMode":null,"hostNameSslStates":[{"name":"azurecli-webapp-backuptest2.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Standard"},{"name":"azurecli-webapp-backuptest2.scm.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Repository"}],"computeMode":null,"serverFarm":null,"serverFarmId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/serverfarms/webapp-backup-plan","reserved":false,"lastModifiedTimeUtc":"2017-02-14T01:12:33.5766667","storageRecoveryDefaultState":"Running","contentAvailabilityState":"Normal","runtimeAvailabilityState":"Normal","siteConfig":null,"deploymentId":"azurecli-webapp-backuptest2","trafficManagerHostNames":null,"sku":"Standard","premiumAppDeployed":null,"scmSiteAlsoStopped":false,"targetSwapSlot":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"microService":"false","gatewaySiteName":null,"clientAffinityEnabled":true,"clientCertEnabled":false,"hostNamesDisabled":false,"domainVerificationIdentifiers":null,"kind":"app","outboundIpAddresses":"40.112.216.201,40.112.220.31,40.112.222.87,40.112.221.176","containerSize":0,"dailyMemoryTimeQuota":0,"suspendedTill":null,"siteDisabledReason":0,"functionExecutionUnitsCache":null,"maxNumberOfWorkers":null,"homeStamp":"waws-prod-bay-073","cloningInfo":null,"hostingEnvironmentId":null,"tags":null,"resourceGroup":"cli-webapp-backup","defaultHostName":"azurecli-webapp-backuptest2.azurewebsites.net","slotSwapStatus":null}}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json] + Date: ['Tue, 14 Feb 2017 01:12:43 GMT'] + ETag: ['"1D2865F6BCCD48B"'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + content-length: ['2816'] + status: {code: 200, message: OK} +- request: + body: '{"properties": {"name": "mybackup", "databases": [{"databaseType": "SqlAzure", + "name": "cli-db", "connectionString": "Server=tcp:cli-backup.database.windows.net,1433;Initial + Catalog=cli-db;Persist Security Info=False;User ID=cliuser;Password=cli!password1;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection + Timeout=30;"}], "storageAccountUrl": "https://azureclistore.blob.core.windows.net/sitebackups?sv=2015-04-05&sr=c&sig=%2FjH1lEtbm3uFqtMI%2BfFYwgrntOs1qhGnpGv9uRibJ7A%3D&se=2017-02-14T04%3A53%3A28Z&sp=rwdl"}, + "location": "West US"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['569'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [b05bc566-f252-11e6-b1de-98588a06bf8b] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backuptest2/backup?api-version=2016-08-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backuptest2","name":"azurecli-webapp-backuptest2","type":"Microsoft.Web/sites","location":"West + US","tags":null,"properties":{"id":434,"storageAccountUrl":"https://azureclistore.blob.core.windows.net/sitebackups?sv=2015-04-05&sr=c&sig=%2FjH1lEtbm3uFqtMI%2BfFYwgrntOs1qhGnpGv9uRibJ7A%3D&se=2017-02-14T04%3A53%3A28Z&sp=rwdl","blobName":"mybackup","name":"mybackup","status":"Created","sizeInBytes":0,"created":"2017-02-14T01:12:45.7288235Z","log":null,"databases":[{"databaseType":"SqlAzure","name":"cli-db","connectionStringName":null,"connectionString":"Server=tcp:cli-backup.database.windows.net,1433;Initial + Catalog=cli-db;Persist Security Info=False;User ID=cliuser;Password=cli!password1;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection + Timeout=30;"}],"scheduled":false,"correlationId":"3c7086b2-506d-40b3-90c8-58a396c516c7","websiteSizeInBytes":null}}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json] + Date: ['Tue, 14 Feb 2017 01:12:44 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + content-length: ['1035'] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [b149aeee-f252-11e6-b2c1-98588a06bf8b] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backuptest2/backups?api-version=2016-08-01 + response: + body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backuptest2/backups/434","name":"434","type":"Microsoft.Web/sites/backups","location":"West + US","tags":null,"properties":{"id":434,"storageAccountUrl":"https://azureclistore.blob.core.windows.net/sitebackups?sv=2015-04-05&sr=c&sig=%2FjH1lEtbm3uFqtMI%2BfFYwgrntOs1qhGnpGv9uRibJ7A%3D&se=2017-02-14T04%3A53%3A28Z&sp=rwdl","blobName":"mybackup.zip","name":"mybackup","status":"InProgress","sizeInBytes":0,"created":"2017-02-14T01:12:45.7288235","log":null,"databases":[{"databaseType":"SqlAzure","name":"cli-db","connectionStringName":null,"connectionString":"Server=tcp:cli-backup.database.windows.net,1433;Initial + Catalog=cli-db;Persist Security Info=False;User ID=cliuser;Password=cli!password1;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection + Timeout=30;"}],"scheduled":false,"correlationId":"3c7086b2-506d-40b3-90c8-58a396c516c7","websiteSizeInBytes":null}}],"nextLink":null,"id":null}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json] + Date: ['Tue, 14 Feb 2017 01:12:49 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + content-length: ['1075'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [66bb14ca-f253-11e6-bdc9-98588a06bf8b] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backuptest2?api-version=2016-08-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backuptest2","name":"azurecli-webapp-backuptest2","type":"Microsoft.Web/sites","kind":"app","location":"West + US","tags":null,"properties":{"name":"azurecli-webapp-backuptest2","state":"Running","hostNames":["azurecli-webapp-backuptest2.azurewebsites.net"],"webSpace":"cli-webapp-backup-WestUSwebspace","selfLink":"https://waws-prod-bay-073.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/cli-webapp-backup-WestUSwebspace/sites/azurecli-webapp-backuptest2","repositorySiteName":"azurecli-webapp-backuptest2","owner":null,"usageState":"Normal","enabled":true,"adminEnabled":true,"enabledHostNames":["azurecli-webapp-backuptest2.azurewebsites.net","azurecli-webapp-backuptest2.scm.azurewebsites.net"],"siteProperties":{"metadata":null,"properties":[],"appSettings":null},"availabilityState":"Normal","sslCertificates":null,"csrs":[],"cers":null,"siteMode":null,"hostNameSslStates":[{"name":"azurecli-webapp-backuptest2.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Standard"},{"name":"azurecli-webapp-backuptest2.scm.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Repository"}],"computeMode":null,"serverFarm":null,"serverFarmId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/serverfarms/webapp-backup-plan","reserved":false,"lastModifiedTimeUtc":"2017-02-14T01:12:33.5766667","storageRecoveryDefaultState":"Running","contentAvailabilityState":"Normal","runtimeAvailabilityState":"Normal","siteConfig":null,"deploymentId":"azurecli-webapp-backuptest2","trafficManagerHostNames":null,"sku":"Standard","premiumAppDeployed":null,"scmSiteAlsoStopped":false,"targetSwapSlot":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"microService":"false","gatewaySiteName":null,"clientAffinityEnabled":true,"clientCertEnabled":false,"hostNamesDisabled":false,"domainVerificationIdentifiers":null,"kind":"app","outboundIpAddresses":"40.112.216.201,40.112.220.31,40.112.222.87,40.112.221.176","containerSize":0,"dailyMemoryTimeQuota":0,"suspendedTill":null,"siteDisabledReason":0,"functionExecutionUnitsCache":null,"maxNumberOfWorkers":null,"homeStamp":"waws-prod-bay-073","cloningInfo":null,"hostingEnvironmentId":null,"tags":null,"resourceGroup":"cli-webapp-backup","defaultHostName":"azurecli-webapp-backuptest2.azurewebsites.net","slotSwapStatus":null}}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json] + Date: ['Tue, 14 Feb 2017 01:17:50 GMT'] + ETag: ['"1D2865F6BCCD48B"'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + content-length: ['2816'] + status: {code: 200, message: OK} +- request: + body: '{"properties": {"overwrite": true, "blobName": "mybackup.zip", "operationType": + "Default", "ignoreConflictingHostNames": true, "storageAccountUrl": "https://azureclistore.blob.core.windows.net/sitebackups?sv=2015-04-05&sr=c&sig=%2FjH1lEtbm3uFqtMI%2BfFYwgrntOs1qhGnpGv9uRibJ7A%3D&se=2017-02-14T04%3A53%3A28Z&sp=rwdl", + "databases": [{"databaseType": "SqlAzure", "name": "cli-db", "connectionString": + "Server=tcp:cli-backup.database.windows.net,1433;Initial Catalog=cli-db;Persist + Security Info=False;User ID=cliuser;Password=cli!password1;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection + Timeout=30;"}]}, "location": "West US"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['660'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 websitemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [6719b612-f253-11e6-a628-98588a06bf8b] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backuptest2/backups/0/restore?api-version=2016-08-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-webapp-backup/providers/Microsoft.Web/sites/azurecli-webapp-backuptest2","name":"azurecli-webapp-backuptest2","type":"Microsoft.Web/sites","location":"West + US","tags":null,"properties":{"operationId":"fe89f012-9458-4299-a6bc-0266dc2ef713"}}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json] + Date: ['Tue, 14 Feb 2017 01:17:51 GMT'] + ETag: ['"1D2865F6BCCD48B"'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Powered-By: [ASP.NET] + content-length: ['324'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 200, message: OK} +version: 1 diff --git a/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/test_webapp_commands.py b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/test_webapp_commands.py index 5d2bd18c2..7fbbb4192 100644 --- a/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/test_webapp_commands.py +++ b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/test_webapp_commands.py @@ -349,3 +349,117 @@ class WebappSlotScenarioTest(ResourceGroupVCRTestBase): JMESPathCheck('[0].name', self.webapp + '/' + slot), ]) self.cmd('appservice web deployment slot delete -g {} -n {} --slot {}'.format(self.resource_group, self.webapp, slot), checks=NoneCheck()) + +class WebappBackupConfigScenarioTest(ResourceGroupVCRTestBase): + + def __init__(self, test_method): + super(WebappBackupConfigScenarioTest, self).__init__(__file__, test_method, resource_group='cli-webapp-backup') + self.webapp_name = 'azurecli-webapp-backupconfigtest' + + def test_webapp_backup_config(self): + self.execute() + + def set_up(self): + super(WebappBackupConfigScenarioTest, self).set_up() + plan = 'webapp-backup-plan' + self.cmd('appservice plan create -g {} -n {} --sku S1'.format(self.resource_group, plan)) + self.cmd('appservice web create -g {} -n {} --plan {}'.format(self.resource_group, self.webapp_name, plan)) + + def body(self): + sas_url = 'https://azureclistore.blob.core.windows.net/sitebackups?sv=2015-04-05&sr=c&sig=%2FjH1lEtbm3uFqtMI%2BfFYwgrntOs1qhGnpGv9uRibJ7A%3D&se=2017-02-14T04%3A53%3A28Z&sp=rwdl' + frequency = '1d' + db_conn_str = 'Server=tcp:cli-backup.database.windows.net,1433;Initial Catalog=cli-db;Persist Security Info=False;User ID=cliuser;Password=cli!password1;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;' + retention_period = 5 + + # set without databases + self.cmd('appservice web config backup update -g {} --webapp-name {} --frequency {} --container-url {} --retain-one true --retention {}' + .format(self.resource_group, self.webapp_name, frequency, sas_url, retention_period), checks=NoneCheck()) + + checks = [ + JMESPathCheck('backupSchedule.frequencyInterval', 1), + JMESPathCheck('backupSchedule.frequencyUnit', 'Day'), + JMESPathCheck('backupSchedule.keepAtLeastOneBackup', True), + JMESPathCheck('backupSchedule.retentionPeriodInDays', retention_period) + ] + self.cmd('appservice web config backup show -g {} --webapp-name {}'.format(self.resource_group, self.webapp_name), checks=checks) + + # update with databases + database_name = 'cli-db' + database_type = 'SqlAzure' + self.cmd('appservice web config backup update -g {} --webapp-name {} --db-connection-string "{}" --db-name {} --db-type {} --retain-one true' + .format(self.resource_group, self.webapp_name, db_conn_str, database_name, database_type), checks=NoneCheck()) + + checks = [ + JMESPathCheck('backupSchedule.frequencyInterval', 1), + JMESPathCheck('backupSchedule.frequencyUnit', 'Day'), + JMESPathCheck('backupSchedule.keepAtLeastOneBackup', True), + JMESPathCheck('backupSchedule.retentionPeriodInDays', retention_period), + JMESPathCheck('databases[0].connectionString', db_conn_str), + JMESPathCheck('databases[0].databaseType', database_type), + JMESPathCheck('databases[0].name', database_name) + ] + self.cmd('appservice web config backup show -g {} --webapp-name {}'.format(self.resource_group, self.webapp_name), checks=checks) + + # update frequency and retention only + frequency = '18h' + retention_period = 7 + self.cmd('appservice web config backup update -g {} --webapp-name {} --frequency {} --retain-one false --retention {}' + .format(self.resource_group, self.webapp_name, frequency, retention_period), checks=NoneCheck()) + + checks = [ + JMESPathCheck('backupSchedule.frequencyInterval', 18), + JMESPathCheck('backupSchedule.frequencyUnit', 'Hour'), + JMESPathCheck('backupSchedule.keepAtLeastOneBackup', False), + JMESPathCheck('backupSchedule.retentionPeriodInDays', retention_period), + JMESPathCheck('databases[0].connectionString', db_conn_str), + JMESPathCheck('databases[0].databaseType', database_type), + JMESPathCheck('databases[0].name', database_name) + ] + self.cmd('appservice web config backup show -g {} --webapp-name {}'.format(self.resource_group, self.webapp_name), checks=checks) + +class WebappBackupRestoreScenarioTest(ResourceGroupVCRTestBase): + + def __init__(self, test_method): + super(WebappBackupRestoreScenarioTest, self).__init__(__file__, test_method, resource_group='cli-webapp-backup') + self.webapp_name = 'azurecli-webapp-backuptest2' + + def test_webapp_backup_restore(self): + self.execute() + + def set_up(self): + super(WebappBackupRestoreScenarioTest, self).set_up() + plan = 'webapp-backup-plan' + self.cmd('appservice plan create -g {} -n {} --sku S1'.format(self.resource_group, plan)) + self.cmd('appservice web create -g {} -n {} --plan {}'.format(self.resource_group, self.webapp_name, plan)) + + def body(self): + sas_url = 'https://azureclistore.blob.core.windows.net/sitebackups?sv=2015-04-05&sr=c&sig=%2FjH1lEtbm3uFqtMI%2BfFYwgrntOs1qhGnpGv9uRibJ7A%3D&se=2017-02-14T04%3A53%3A28Z&sp=rwdl' + db_conn_str = 'Server=tcp:cli-backup.database.windows.net,1433;Initial Catalog=cli-db;Persist Security Info=False;User ID=cliuser;Password=cli!password1;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;' + database_name = 'cli-db' + database_type = 'SqlAzure' + backup_name = 'mybackup' + + create_checks = [ + JMESPathCheck('backupItemName', backup_name), + JMESPathCheck('storageAccountUrl', sas_url), + JMESPathCheck('databases[0].connectionString', db_conn_str), + JMESPathCheck('databases[0].databaseType', database_type), + JMESPathCheck('databases[0].name', database_name) + ] + self.cmd('appservice web config backup create -g {} --webapp-name {} --container-url {} --db-connection-string "{}" --db-name {} --db-type {} --backup-name {}' + .format(self.resource_group, self.webapp_name, sas_url, db_conn_str, database_name, database_type, backup_name), checks=create_checks) + + list_checks = [ + JMESPathCheck('[-1].backupItemName', backup_name), + JMESPathCheck('[-1].storageAccountUrl', sas_url), + JMESPathCheck('[-1].databases[0].connectionString', db_conn_str), + JMESPathCheck('[-1].databases[0].databaseType', database_type), + JMESPathCheck('[-1].databases[0].name', database_name) + ] + self.cmd('appservice web config backup list -g {} --webapp-name {}'.format(self.resource_group, self.webapp_name), checks=list_checks) + + import time + time.sleep(300) # Allow plenty of time for a backup to finish -- database backup takes a while (skipped in playback) + + self.cmd('appservice web config backup restore -g {} --webapp-name {} --container-url {} --backup-name {} --db-connection-string "{}" --db-name {} --db-type {} --ignore-hostname-conflict --overwrite' + .format(self.resource_group, self.webapp_name, sas_url, backup_name, db_conn_str, database_name, database_type), checks=JMESPathCheck('name', self.webapp_name)) diff --git a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/recordings/test_storage_account_scenario.yaml b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/recordings/test_storage_account_scenario.yaml index ab58bc4e3..1c2f83a9e 100644 --- a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/recordings/test_storage_account_scenario.yaml +++ b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/recordings/test_storage_account_scenario.yaml @@ -7,10 +7,10 @@ interactions: Connection: [keep-alive] Content-Length: ['73'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c1dcadd8-ee5b-11e6-bf5a-3c15c2cf0610] + x-ms-client-request-id: [d3fbbbf4-f3c9-11e6-ab1b-74c63bed1137] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/checkNameAvailability?api-version=2016-12-01 response: @@ -20,7 +20,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:07:34 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:03 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -37,10 +37,10 @@ interactions: Connection: [keep-alive] Content-Length: ['73'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c2b4194c-ee5b-11e6-bff9-3c15c2cf0610] + x-ms-client-request-id: [d4c73850-f3c9-11e6-9371-74c63bed1137] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/checkNameAvailability?api-version=2016-12-01 response: @@ -50,7 +50,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:07:36 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:04 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -67,25 +67,25 @@ interactions: Connection: [keep-alive] Content-Length: ['74'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c389c682-ee5b-11e6-b8a0-3c15c2cf0610] + x-ms-client-request-id: [d58758a8-f3c9-11e6-93c6-74c63bed1137] method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete?api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: body: {string: ''} headers: Cache-Control: [no-cache] Content-Length: ['0'] - Date: ['Thu, 09 Feb 2017 00:07:37 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:07 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d/providers/Microsoft.Storage/operations/4b8be2ea-fae6-43bf-acd5-4fee2c7e6374?monitor=true&api-version=2016-12-01'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/9147d762-549f-4705-a5ac-dbf05b9c7a94?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] Retry-After: ['17'] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1192'] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] status: {code: 202, message: Accepted} - request: body: null @@ -94,84 +94,58 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c389c682-ee5b-11e6-b8a0-3c15c2cf0610] + x-ms-client-request-id: [d58758a8-f3c9-11e6-93c6-74c63bed1137] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/4b8be2ea-fae6-43bf-acd5-4fee2c7e6374?monitor=true&api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/9147d762-549f-4705-a5ac-dbf05b9c7a94?monitor=true&api-version=2016-12-01 response: - body: {string: ''} - headers: - Cache-Control: [no-cache] - Content-Length: ['0'] - Date: ['Thu, 09 Feb 2017 00:07:55 GMT'] - Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d/providers/Microsoft.Storage/operations/4b8be2ea-fae6-43bf-acd5-4fee2c7e6374?monitor=true&api-version=2016-12-01'] - Pragma: [no-cache] - Retry-After: ['17'] - Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - status: {code: 202, message: Accepted} -- request: - body: null - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] - accept-language: [en-US] - x-ms-client-request-id: [c389c682-ee5b-11e6-b8a0-3c15c2cf0610] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/4b8be2ea-fae6-43bf-acd5-4fee2c7e6374?monitor=true&api-version=2016-12-01 - response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete","kind":"Storage","location":"westus","name":"testcreatedelete","properties":{"creationTime":"2017-02-09T00:07:37.2213980Z","primaryEndpoints":{"blob":"https://testcreatedelete.blob.core.windows.net/","file":"https://testcreatedelete.file.core.windows.net/","queue":"https://testcreatedelete.queue.core.windows.net/","table":"https://testcreatedelete.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:13 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:24 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['740'] + content-length: ['776'] status: {code: 200, message: OK} - request: - body: '{"name": "testcreatedelete", "type": "Microsoft.Storage/storageAccounts"}' + body: '{"name": "vcrstorage733641907300", "type": "Microsoft.Storage/storageAccounts"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['73'] + Content-Length: ['79'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [da10d530-ee5b-11e6-83aa-3c15c2cf0610] + x-ms-client-request-id: [e1bebfcc-f3c9-11e6-a3b6-74c63bed1137] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/checkNameAvailability?api-version=2016-12-01 response: - body: {string: '{"message":"The storage account named testcreatedelete is already - taken.","nameAvailable":false,"reason":"AlreadyExists"} + body: {string: '{"message":"The storage account named vcrstorage733641907300 is + already taken.","nameAvailable":false,"reason":"AlreadyExists"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:15 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:26 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['122'] + content-length: ['128'] status: {code: 200, message: OK} - request: body: null @@ -180,27 +154,27 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [dadb2f74-ee5b-11e6-a045-3c15c2cf0610] + x-ms-client-request-id: [e25fb3ac-f3c9-11e6-9d53-74c63bed1137] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts?api-version=2016-12-01 response: - body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete","kind":"Storage","location":"westus","name":"testcreatedelete","properties":{"creationTime":"2017-02-09T00:07:37.2213980Z","primaryEndpoints":{"blob":"https://testcreatedelete.blob.core.windows.net/","file":"https://testcreatedelete.file.core.windows.net/","queue":"https://testcreatedelete.queue.core.windows.net/","table":"https://testcreatedelete.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"}]} + body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"}]} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:16 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:26 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['752'] + content-length: ['788'] status: {code: 200, message: OK} - request: body: null @@ -209,27 +183,27 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [dbba7e68-ee5b-11e6-aaa4-3c15c2cf0610] + x-ms-client-request-id: [e2e57f30-f3c9-11e6-b459-74c63bed1137] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete?api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete","kind":"Storage","location":"westus","name":"testcreatedelete","properties":{"creationTime":"2017-02-09T00:07:37.2213980Z","primaryEndpoints":{"blob":"https://testcreatedelete.blob.core.windows.net/","file":"https://testcreatedelete.file.core.windows.net/","queue":"https://testcreatedelete.queue.core.windows.net/","table":"https://testcreatedelete.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:18 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:27 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['740'] + content-length: ['776'] status: {code: 200, message: OK} - request: body: null @@ -238,21 +212,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [dca35368-ee5b-11e6-a34a-3c15c2cf0610] + x-ms-client-request-id: [e3620122-f3c9-11e6-9d80-74c63bed1137] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/usages?api-version=2016-12-01 response: body: {string: "{\r\n \"value\": [\r\n {\r\n \"unit\": \"Count\",\r\n\ - \ \"currentValue\": 58,\r\n \"limit\": 250,\r\n \"name\": {\r\ + \ \"currentValue\": 41,\r\n \"limit\": 250,\r\n \"name\": {\r\ \n \"value\": \"StorageAccounts\",\r\n \"localizedValue\": \"\ Storage Accounts\"\r\n }\r\n }\r\n ]\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:19 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:28 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -269,20 +243,20 @@ interactions: Connection: [keep-alive] Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [dd84a158-ee5b-11e6-99f2-3c15c2cf0610] + x-ms-client-request-id: [e3f246c6-f3c9-11e6-8348-74c63bed1137] method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete/listKeys?api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage/listKeys?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"Qnm0sK1WFJbrpqibPUbUxyT9tJZEhgYa6ccqe6pp1FwaCKVC05gLpMYF1fGbK4Eghbr3lDqu/owFEHtG5fUEKA=="},{"keyName":"key2","permissions":"Full","value":"09kvsAJkFw0sibG9sQlYwT6hhMRjieuiVOgYrX9r03ZD1atHscccJPNNZEPRC6WBIjn1j+s7DR2U+Iw8GdRNrQ=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"FvHhwyIgb9w4f9IP8q8hsco9YRMQx2Cmw7/twW6Z5BDSqV7E3glSpl6XjhGd4EBoH1y3Qs7ZydIzRdzXb5RUlA=="},{"keyName":"key2","permissions":"Full","value":"bl05+mAzQpLT0w07vniIWTHZfgxJ8M9ywLnk6NmJ0EsWmpa/QBeO9zK7AObh4pOmsIBgeQq7ibjoDYpLBjLxmw=="}]} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:20 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:29 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -290,7 +264,7 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['289'] - x-ms-ratelimit-remaining-subscription-writes: ['1189'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: body: null @@ -300,20 +274,20 @@ interactions: Connection: [keep-alive] Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [de616f3a-ee5b-11e6-a667-3c15c2cf0610] + x-ms-client-request-id: [e461e3c2-f3c9-11e6-a33d-74c63bed1137] method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete/listKeys?api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage/listKeys?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"Qnm0sK1WFJbrpqibPUbUxyT9tJZEhgYa6ccqe6pp1FwaCKVC05gLpMYF1fGbK4Eghbr3lDqu/owFEHtG5fUEKA=="},{"keyName":"key2","permissions":"Full","value":"09kvsAJkFw0sibG9sQlYwT6hhMRjieuiVOgYrX9r03ZD1atHscccJPNNZEPRC6WBIjn1j+s7DR2U+Iw8GdRNrQ=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"FvHhwyIgb9w4f9IP8q8hsco9YRMQx2Cmw7/twW6Z5BDSqV7E3glSpl6XjhGd4EBoH1y3Qs7ZydIzRdzXb5RUlA=="},{"keyName":"key2","permissions":"Full","value":"bl05+mAzQpLT0w07vniIWTHZfgxJ8M9ywLnk6NmJ0EsWmpa/QBeO9zK7AObh4pOmsIBgeQq7ibjoDYpLBjLxmw=="}]} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:22 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:31 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -321,24 +295,24 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['289'] - x-ms-ratelimit-remaining-subscription-writes: ['1189'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:23 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:33 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://testcreatedelete.blob.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.blob.core.windows.net/?restype=service&comp=properties response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Thu, 09 Feb 2017 00:08:23 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:31 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -347,19 +321,19 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:23 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:34 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://testcreatedelete.queue.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.queue.core.windows.net/?restype=service&comp=properties response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Cache-Control: [no-cache] Content-Type: [application/xml] - Date: ['Thu, 09 Feb 2017 00:08:22 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:32 GMT'] Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -370,18 +344,18 @@ interactions: Connection: [keep-alive] DataServiceVersion: [3.0;NetFx] MaxDataServiceVersion: ['3.0'] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:23 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:34 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://testcreatedelete.table.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.table.core.windows.net/?restype=service&comp=properties response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Thu, 09 Feb 2017 00:08:23 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:31 GMT'] Server: [Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -393,16 +367,16 @@ interactions: headers: Connection: [keep-alive] Content-Length: ['264'] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:24 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:35 GMT'] x-ms-version: ['2015-07-08'] method: PUT - uri: https://testcreatedelete.blob.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.blob.core.windows.net/?restype=service&comp=properties response: body: {string: ''} headers: - Date: ['Thu, 09 Feb 2017 00:08:24 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:32 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -411,18 +385,18 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:25 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:35 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://testcreatedelete.blob.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.blob.core.windows.net/?restype=service&comp=properties response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>true</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>true</Enabled><Days>1</Days></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Thu, 09 Feb 2017 00:08:25 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:32 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -431,19 +405,19 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:25 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:35 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://testcreatedelete.queue.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.queue.core.windows.net/?restype=service&comp=properties response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Cache-Control: [no-cache] Content-Type: [application/xml] - Date: ['Thu, 09 Feb 2017 00:08:24 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:33 GMT'] Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -454,18 +428,18 @@ interactions: Connection: [keep-alive] DataServiceVersion: [3.0;NetFx] MaxDataServiceVersion: ['3.0'] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:25 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:35 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://testcreatedelete.table.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.table.core.windows.net/?restype=service&comp=properties response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Thu, 09 Feb 2017 00:08:24 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:33 GMT'] Server: [Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -474,18 +448,18 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:26 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:36 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://testcreatedelete.blob.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.blob.core.windows.net/?restype=service&comp=properties response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>true</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>true</Enabled><Days>1</Days></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Thu, 09 Feb 2017 00:08:25 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:33 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -494,18 +468,18 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:26 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:36 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://testcreatedelete.file.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.file.core.windows.net/?restype=service&comp=properties response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Thu, 09 Feb 2017 00:08:25 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:33 GMT'] Server: [Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -514,19 +488,19 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:26 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:36 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://testcreatedelete.queue.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.queue.core.windows.net/?restype=service&comp=properties response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Cache-Control: [no-cache] Content-Type: [application/xml] - Date: ['Thu, 09 Feb 2017 00:08:25 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:34 GMT'] Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -537,18 +511,18 @@ interactions: Connection: [keep-alive] DataServiceVersion: [3.0;NetFx] MaxDataServiceVersion: ['3.0'] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:26 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:36 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://testcreatedelete.table.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.table.core.windows.net/?restype=service&comp=properties response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Thu, 09 Feb 2017 00:08:26 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:33 GMT'] Server: [Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -560,16 +534,16 @@ interactions: headers: Connection: [keep-alive] Content-Length: ['386'] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:27 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:37 GMT'] x-ms-version: ['2015-07-08'] method: PUT - uri: https://testcreatedelete.file.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.file.core.windows.net/?restype=service&comp=properties response: body: {string: ''} headers: - Date: ['Thu, 09 Feb 2017 00:08:27 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:34 GMT'] Server: [Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -578,18 +552,18 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:28 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:37 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://testcreatedelete.blob.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.blob.core.windows.net/?restype=service&comp=properties response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>true</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>true</Enabled><Days>1</Days></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Thu, 09 Feb 2017 00:08:28 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -598,18 +572,18 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:28 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:37 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://testcreatedelete.file.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.file.core.windows.net/?restype=service&comp=properties response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><HourMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>true</Enabled><Days>1</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>true</Enabled><Days>1</Days></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Thu, 09 Feb 2017 00:08:28 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:35 GMT'] Server: [Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -618,19 +592,19 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:28 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:37 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://testcreatedelete.queue.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.queue.core.windows.net/?restype=service&comp=properties response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Cache-Control: [no-cache] Content-Type: [application/xml] - Date: ['Thu, 09 Feb 2017 00:08:27 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:35 GMT'] Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -641,18 +615,18 @@ interactions: Connection: [keep-alive] DataServiceVersion: [3.0;NetFx] MaxDataServiceVersion: ['3.0'] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.6.0; Darwin 16.4.0) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [bf5a2912-ee5b-11e6-ad3b-3c15c2cf0610] - x-ms-date: ['Thu, 09 Feb 2017 00:08:28 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] + x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] + x-ms-date: ['Wed, 15 Feb 2017 21:58:38 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://testcreatedelete.table.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.table.core.windows.net/?restype=service&comp=properties response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Thu, 09 Feb 2017 00:08:28 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:35 GMT'] Server: [Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -663,506 +637,53 @@ interactions: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] + Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [e2d428fa-ee5b-11e6-a448-3c15c2cf0610] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/storageAccounts?api-version=2016-12-01 + x-ms-client-request-id: [e7dff490-f3c9-11e6-94b6-74c63bed1137] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage/listKeys?api-version=2016-12-01 response: - body: {string: "{\"value\":[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestrg_acs_pgzg_/providers/Microsoft.Storage/storageAccounts/00bt6plw4asw7uqagntpri0\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"00bt6plw4asw7uqagntpri0\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T06:31:00.4639213Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://00bt6plw4asw7uqagntpri0.blob.core.windows.net/\",\"file\"\ - :\"https://00bt6plw4asw7uqagntpri0.file.core.windows.net/\",\"queue\":\"https://00bt6plw4asw7uqagntpri0.queue.core.windows.net/\"\ - ,\"table\":\"https://00bt6plw4asw7uqagntpri0.table.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestdiagext_urrn_/providers/Microsoft.Storage/storageAccounts/542dddncyzly2testdiagvsa\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"542dddncyzly2testdiagvsa\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T19:01:36.1675808Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://542dddncyzly2testdiagvsa.blob.core.windows.net/\",\"\ - file\":\"https://542dddncyzly2testdiagvsa.file.core.windows.net/\",\"queue\"\ - :\"https://542dddncyzly2testdiagvsa.queue.core.windows.net/\",\"table\":\"\ - https://542dddncyzly2testdiagvsa.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestrg_acs_pgzg_/providers/Microsoft.Storage/storageAccounts/60bt6plw4asw7uqagntpri1\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"60bt6plw4asw7uqagntpri1\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T06:31:00.4839479Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://60bt6plw4asw7uqagntpri1.blob.core.windows.net/\",\"file\"\ - :\"https://60bt6plw4asw7uqagntpri1.file.core.windows.net/\",\"queue\":\"https://60bt6plw4asw7uqagntpri1.queue.core.windows.net/\"\ - ,\"table\":\"https://60bt6plw4asw7uqagntpri1.table.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_state_mod_le0n_/providers/Microsoft.Storage/storageAccounts/ab394fvkdj34\"\ - ,\"kind\":\"Storage\",\"location\":\"eastus\",\"name\":\"ab394fvkdj34\",\"\ - properties\":{\"creationTime\":\"2017-02-07T17:12:30.5210312Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://ab394fvkdj34.blob.core.windows.net/\",\"file\":\"https://ab394fvkdj34.file.core.windows.net/\"\ - ,\"queue\":\"https://ab394fvkdj34.queue.core.windows.net/\",\"table\":\"https://ab394fvkdj34.table.core.windows.net/\"\ - },\"primaryLocation\":\"eastus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{\"firsttag\":\"1\",\"secondtag\":\"2\",\"thirdtag\":\"\"},\"type\"\ - :\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_diagnostics_10x1_/providers/Microsoft.Storage/storageAccounts/ae94nvfl1k1\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"ae94nvfl1k1\",\"\ - properties\":{\"creationTime\":\"2017-02-07T17:02:23.3814953Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://ae94nvfl1k1.blob.core.windows.net/\",\"file\":\"https://ae94nvfl1k1.file.core.windows.net/\"\ - ,\"queue\":\"https://ae94nvfl1k1.queue.core.windows.net/\",\"table\":\"https://ae94nvfl1k1.table.core.windows.net/\"\ - },\"primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestdiagext_cua0_/providers/Microsoft.Storage/storageAccounts/bo7iba7zxg3bstestdiagvsa\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"bo7iba7zxg3bstestdiagvsa\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T19:50:50.0793552Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://bo7iba7zxg3bstestdiagvsa.blob.core.windows.net/\",\"\ - file\":\"https://bo7iba7zxg3bstestdiagvsa.file.core.windows.net/\",\"queue\"\ - :\"https://bo7iba7zxg3bstestdiagvsa.queue.core.windows.net/\",\"table\":\"\ - https://bo7iba7zxg3bstestdiagvsa.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestrg_acs_pgzg_/providers/Microsoft.Storage/storageAccounts/bt6plw4asw7uqagntpub\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"bt6plw4asw7uqagntpub\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T06:31:07.0434415Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://bt6plw4asw7uqagntpub.blob.core.windows.net/\",\"file\"\ - :\"https://bt6plw4asw7uqagntpub.file.core.windows.net/\",\"queue\":\"https://bt6plw4asw7uqagntpub.queue.core.windows.net/\"\ - ,\"table\":\"https://bt6plw4asw7uqagntpub.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestrg_acs_pgzg_/providers/Microsoft.Storage/storageAccounts/bt6plw4asw7uqdiag0\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"bt6plw4asw7uqdiag0\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T06:31:04.4737832Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://bt6plw4asw7uqdiag0.blob.core.windows.net/\",\"file\"\ - :\"https://bt6plw4asw7uqdiag0.file.core.windows.net/\",\"queue\":\"https://bt6plw4asw7uqdiag0.queue.core.windows.net/\"\ - ,\"table\":\"https://bt6plw4asw7uqdiag0.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestrg_acs_pgzg_/providers/Microsoft.Storage/storageAccounts/bt6plw4asw7uqmstr0\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"bt6plw4asw7uqmstr0\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T06:31:00.3989151Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://bt6plw4asw7uqmstr0.blob.core.windows.net/\",\"file\"\ - :\"https://bt6plw4asw7uqmstr0.file.core.windows.net/\",\"queue\":\"https://bt6plw4asw7uqmstr0.queue.core.windows.net/\"\ - ,\"table\":\"https://bt6plw4asw7uqmstr0.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestrg_acs_pgzg_/providers/Microsoft.Storage/storageAccounts/c0bt6plw4asw7uqagntpri2\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"c0bt6plw4asw7uqagntpri2\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T06:31:00.5539303Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://c0bt6plw4asw7uqagntpri2.blob.core.windows.net/\",\"file\"\ - :\"https://c0bt6plw4asw7uqagntpri2.file.core.windows.net/\",\"queue\":\"https://c0bt6plw4asw7uqagntpri2.queue.core.windows.net/\"\ - ,\"table\":\"https://c0bt6plw4asw7uqagntpri2.table.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestdiagext_urrn_/providers/Microsoft.Storage/storageAccounts/c5tq3vecq447atestdiagvsa\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"c5tq3vecq447atestdiagvsa\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T19:01:35.0602409Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://c5tq3vecq447atestdiagvsa.blob.core.windows.net/\",\"\ - file\":\"https://c5tq3vecq447atestdiagvsa.file.core.windows.net/\",\"queue\"\ - :\"https://c5tq3vecq447atestdiagvsa.queue.core.windows.net/\",\"table\":\"\ - https://c5tq3vecq447atestdiagvsa.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/xplattestvmqcreate4156/providers/Microsoft.Storage/storageAccounts/cli30357909863964826891\"\ - ,\"kind\":\"Storage\",\"location\":\"southeastasia\",\"name\":\"cli30357909863964826891\"\ - ,\"properties\":{\"creationTime\":\"2016-01-31T00:59:08.8999081Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://cli30357909863964826891.blob.core.windows.net/\",\"file\"\ - :\"https://cli30357909863964826891.file.core.windows.net/\",\"queue\":\"https://cli30357909863964826891.queue.core.windows.net/\"\ - ,\"table\":\"https://cli30357909863964826891.table.core.windows.net/\"},\"\ - primaryLocation\":\"southeastasia\",\"provisioningState\":\"Succeeded\",\"\ - statusOfPrimary\":\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\"\ - :\"Standard\"},\"tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"\ - },{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/vcr_resource_group_qnbm_/providers/Microsoft.Storage/storageAccounts/clibatchteststorage2\"\ - ,\"kind\":\"Storage\",\"location\":\"brazilsouth\",\"name\":\"clibatchteststorage2\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T18:04:05.6617953Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://clibatchteststorage2.blob.core.windows.net/\",\"file\"\ - :\"https://clibatchteststorage2.file.core.windows.net/\",\"queue\":\"https://clibatchteststorage2.queue.core.windows.net/\"\ - ,\"table\":\"https://clibatchteststorage2.table.core.windows.net/\"},\"primaryLocation\"\ - :\"brazilsouth\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"\ - available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ag2rg/providers/Microsoft.Storage/storageAccounts/clitest1021\"\ - ,\"kind\":\"Storage\",\"location\":\"northeurope\",\"name\":\"clitest1021\"\ - ,\"properties\":{\"creationTime\":\"2016-12-13T01:03:05.4510844Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://clitest1021.blob.core.windows.net/\",\"file\":\"https://clitest1021.file.core.windows.net/\"\ - ,\"queue\":\"https://clitest1021.queue.core.windows.net/\",\"table\":\"https://clitest1021.table.core.windows.net/\"\ - },\"primaryLocation\":\"northeurope\",\"provisioningState\":\"Succeeded\"\ - ,\"secondaryLocation\":\"westeurope\",\"statusOfPrimary\":\"available\",\"\ - statusOfSecondary\":\"available\"},\"sku\":{\"name\":\"Standard_GRS\",\"tier\"\ - :\"Standard\"},\"tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ag2rg/providers/Microsoft.Storage/storageAccounts/clitest1022\"\ - ,\"kind\":\"Storage\",\"location\":\"northeurope\",\"name\":\"clitest1022\"\ - ,\"properties\":{\"creationTime\":\"2016-12-13T01:11:48.5379793Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://clitest1022.blob.core.windows.net/\",\"file\":\"https://clitest1022.file.core.windows.net/\"\ - ,\"queue\":\"https://clitest1022.queue.core.windows.net/\",\"table\":\"https://clitest1022.table.core.windows.net/\"\ - },\"primaryLocation\":\"northeurope\",\"provisioningState\":\"Succeeded\"\ - ,\"secondaryLocation\":\"westeurope\",\"statusOfPrimary\":\"available\",\"\ - statusOfSecondary\":\"available\"},\"sku\":{\"name\":\"Standard_GRS\",\"tier\"\ - :\"Standard\"},\"tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zuppy22/providers/Microsoft.Storage/storageAccounts/cp2a644dncyoqsalinuxvm\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"cp2a644dncyoqsalinuxvm\"\ - ,\"properties\":{\"creationTime\":\"2016-08-05T08:35:15.7961990Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://cp2a644dncyoqsalinuxvm.blob.core.windows.net/\",\"file\"\ - :\"https://cp2a644dncyoqsalinuxvm.file.core.windows.net/\",\"queue\":\"https://cp2a644dncyoqsalinuxvm.queue.core.windows.net/\"\ - ,\"table\":\"https://cp2a644dncyoqsalinuxvm.table.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_vmss_diagnostics_extension_mnsl_/providers/Microsoft.Storage/storageAccounts/diagextensionsa\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"diagextensionsa\"\ - ,\"properties\":{\"creationTime\":\"2017-02-07T23:33:03.5884546Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://diagextensionsa.blob.core.windows.net/\",\"file\":\"\ - https://diagextensionsa.file.core.windows.net/\",\"queue\":\"https://diagextensionsa.queue.core.windows.net/\"\ - ,\"table\":\"https://diagextensionsa.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestdiagext_cua0_/providers/Microsoft.Storage/storageAccounts/diagextstorage\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"diagextstorage\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T19:57:16.5781818Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://diagextstorage.blob.core.windows.net/\",\"file\":\"https://diagextstorage.file.core.windows.net/\"\ - ,\"queue\":\"https://diagextstorage.queue.core.windows.net/\",\"table\":\"\ - https://diagextstorage.table.core.windows.net/\"},\"primaryLocation\":\"westus\"\ - ,\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"},\"\ - sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"type\"\ - :\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestdiagext_cua0_/providers/Microsoft.Storage/storageAccounts/eykeyznjcy2dotestdiagvsa\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"eykeyznjcy2dotestdiagvsa\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T19:50:43.1484178Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://eykeyznjcy2dotestdiagvsa.blob.core.windows.net/\",\"\ - file\":\"https://eykeyznjcy2dotestdiagvsa.file.core.windows.net/\",\"queue\"\ - :\"https://eykeyznjcy2dotestdiagvsa.queue.core.windows.net/\",\"table\":\"\ - https://eykeyznjcy2dotestdiagvsa.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/foostore102\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"foostore102\",\"\ - properties\":{\"creationTime\":\"2016-05-25T19:32:49.5192125Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://foostore102.blob.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_ZRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/foostore103\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"foostore103\",\"\ - properties\":{\"creationTime\":\"2016-05-25T23:52:18.1234838Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://foostore103.blob.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_ZRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/foostore12978\"\ - ,\"kind\":\"Storage\",\"location\":\"westeurope\",\"name\":\"foostore12978\"\ - ,\"properties\":{\"creationTime\":\"2016-04-29T06:55:06.4412159Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://foostore12978.blob.core.windows.net/\",\"file\":\"https://foostore12978.file.core.windows.net/\"\ - ,\"queue\":\"https://foostore12978.queue.core.windows.net/\",\"table\":\"\ - https://foostore12978.table.core.windows.net/\"},\"primaryLocation\":\"westeurope\"\ - ,\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"},\"\ - sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"type\"\ - :\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestrg_acs_pgzg_/providers/Microsoft.Storage/storageAccounts/i0bt6plw4asw7uqagntpri3\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"i0bt6plw4asw7uqagntpri3\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T06:31:00.4579203Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://i0bt6plw4asw7uqagntpri3.blob.core.windows.net/\",\"file\"\ - :\"https://i0bt6plw4asw7uqagntpri3.file.core.windows.net/\",\"queue\":\"https://i0bt6plw4asw7uqagntpri3.queue.core.windows.net/\"\ - ,\"table\":\"https://i0bt6plw4asw7uqagntpri3.table.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestdiagext_urrn_/providers/Microsoft.Storage/storageAccounts/iui2drv6evixotestdiagvsa\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"iui2drv6evixotestdiagvsa\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T19:01:35.6265324Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://iui2drv6evixotestdiagvsa.blob.core.windows.net/\",\"\ - file\":\"https://iui2drv6evixotestdiagvsa.file.core.windows.net/\",\"queue\"\ - :\"https://iui2drv6evixotestdiagvsa.queue.core.windows.net/\",\"table\":\"\ - https://iui2drv6evixotestdiagvsa.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestdiagext_urrn_/providers/Microsoft.Storage/storageAccounts/jl74wty3ksn3mtestdiagvsa\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"jl74wty3ksn3mtestdiagvsa\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T19:01:35.7865467Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://jl74wty3ksn3mtestdiagvsa.blob.core.windows.net/\",\"\ - file\":\"https://jl74wty3ksn3mtestdiagvsa.file.core.windows.net/\",\"queue\"\ - :\"https://jl74wty3ksn3mtestdiagvsa.queue.core.windows.net/\",\"table\":\"\ - https://jl74wty3ksn3mtestdiagvsa.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/psaug18/providers/Microsoft.Storage/storageAccounts/lo32ypes4rjmisalinuxvm\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"lo32ypes4rjmisalinuxvm\"\ - ,\"properties\":{\"creationTime\":\"2016-08-18T19:23:36.4170503Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://lo32ypes4rjmisalinuxvm.blob.core.windows.net/\",\"file\"\ - :\"https://lo32ypes4rjmisalinuxvm.file.core.windows.net/\",\"queue\":\"https://lo32ypes4rjmisalinuxvm.queue.core.windows.net/\"\ - ,\"table\":\"https://lo32ypes4rjmisalinuxvm.table.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestdiagext_cua0_/providers/Microsoft.Storage/storageAccounts/mmty3oughce6mtestdiagvsa\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"mmty3oughce6mtestdiagvsa\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T19:50:43.1303875Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://mmty3oughce6mtestdiagvsa.blob.core.windows.net/\",\"\ - file\":\"https://mmty3oughce6mtestdiagvsa.file.core.windows.net/\",\"queue\"\ - :\"https://mmty3oughce6mtestdiagvsa.queue.core.windows.net/\",\"table\":\"\ - https://mmty3oughce6mtestdiagvsa.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestrg_acs_pgzg_/providers/Microsoft.Storage/storageAccounts/o0bt6plw4asw7uqagntpri4\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"o0bt6plw4asw7uqagntpri4\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T06:31:04.8137869Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://o0bt6plw4asw7uqagntpri4.blob.core.windows.net/\",\"file\"\ - :\"https://o0bt6plw4asw7uqagntpri4.file.core.windows.net/\",\"queue\":\"https://o0bt6plw4asw7uqagntpri4.queue.core.windows.net/\"\ - ,\"table\":\"https://o0bt6plw4asw7uqagntpri4.table.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestdiagext_cua0_/providers/Microsoft.Storage/storageAccounts/orkikebuhshzutestdiagvsa\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"orkikebuhshzutestdiagvsa\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T19:50:43.1243879Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://orkikebuhshzutestdiagvsa.blob.core.windows.net/\",\"\ - file\":\"https://orkikebuhshzutestdiagvsa.file.core.windows.net/\",\"queue\"\ - :\"https://orkikebuhshzutestdiagvsa.queue.core.windows.net/\",\"table\":\"\ - https://orkikebuhshzutestdiagvsa.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestdiagext_urrn_/providers/Microsoft.Storage/storageAccounts/slaag2cthibuwtestdiagvsa\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"slaag2cthibuwtestdiagvsa\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T19:01:35.3625087Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://slaag2cthibuwtestdiagvsa.blob.core.windows.net/\",\"\ - file\":\"https://slaag2cthibuwtestdiagvsa.file.core.windows.net/\",\"queue\"\ - :\"https://slaag2cthibuwtestdiagvsa.queue.core.windows.net/\",\"table\":\"\ - https://slaag2cthibuwtestdiagvsa.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/testacc209\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"testacc209\",\"properties\"\ - :{\"creationTime\":\"2016-01-26T19:04:16.5466637Z\",\"primaryEndpoints\":{\"\ - blob\":\"https://testacc209.blob.core.windows.net/\",\"file\":\"https://testacc209.file.core.windows.net/\"\ - ,\"queue\":\"https://testacc209.queue.core.windows.net/\",\"table\":\"https://testacc209.table.core.windows.net/\"\ - },\"primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"testcreatedelete\"\ - ,\"properties\":{\"creationTime\":\"2017-02-09T00:07:37.2213980Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://testcreatedelete.blob.core.windows.net/\",\"file\":\"\ - https://testcreatedelete.file.core.windows.net/\",\"queue\":\"https://testcreatedelete.queue.core.windows.net/\"\ - ,\"table\":\"https://testcreatedelete.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/trdai_test_disposable/providers/Microsoft.Storage/storageAccounts/trdaitest03\"\ - ,\"kind\":\"Storage\",\"location\":\"southcentralus\",\"name\":\"trdaitest03\"\ - ,\"properties\":{\"creationTime\":\"2016-11-04T17:46:10.2954312Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://trdaitest03.blob.core.windows.net/\",\"file\":\"https://trdaitest03.file.core.windows.net/\"\ - ,\"queue\":\"https://trdaitest03.queue.core.windows.net/\",\"table\":\"https://trdaitest03.table.core.windows.net/\"\ - },\"primaryLocation\":\"southcentralus\",\"provisioningState\":\"Succeeded\"\ - ,\"statusOfPrimary\":\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"\ - tier\":\"Standard\"},\"tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"\ - },{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/trdai_test_disposable/providers/Microsoft.Storage/storageAccounts/trdaitest04\"\ - ,\"kind\":\"Storage\",\"location\":\"northeurope\",\"name\":\"trdaitest04\"\ - ,\"properties\":{\"creationTime\":\"2016-11-04T17:46:32.8224345Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://trdaitest04.blob.core.windows.net/\",\"file\":\"https://trdaitest04.file.core.windows.net/\"\ - ,\"queue\":\"https://trdaitest04.queue.core.windows.net/\",\"table\":\"https://trdaitest04.table.core.windows.net/\"\ - },\"primaryLocation\":\"northeurope\",\"provisioningState\":\"Succeeded\"\ - ,\"statusOfPrimary\":\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"\ - tier\":\"Standard\"},\"tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"\ - },{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_batch_blob_download_5x2e_/providers/Microsoft.Storage/storageAccounts/vcrstorage123016196722\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vcrstorage123016196722\"\ - ,\"properties\":{\"creationTime\":\"2017-01-31T23:31:09.7760020Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://vcrstorage123016196722.blob.core.windows.net/\",\"file\"\ - :\"https://vcrstorage123016196722.file.core.windows.net/\",\"queue\":\"https://vcrstorage123016196722.queue.core.windows.net/\"\ - ,\"table\":\"https://vcrstorage123016196722.table.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_batch_blob_download_4lmf_/providers/Microsoft.Storage/storageAccounts/vcrstorage133137457153\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vcrstorage133137457153\"\ - ,\"properties\":{\"creationTime\":\"2017-01-31T23:57:59.7225387Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://vcrstorage133137457153.blob.core.windows.net/\",\"file\"\ - :\"https://vcrstorage133137457153.file.core.windows.net/\",\"queue\":\"https://vcrstorage133137457153.queue.core.windows.net/\"\ - ,\"table\":\"https://vcrstorage133137457153.table.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_file_scenario_4txc_/providers/Microsoft.Storage/storageAccounts/vcrstorage200835743759\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vcrstorage200835743759\"\ - ,\"properties\":{\"creationTime\":\"2017-01-25T18:47:20.9694058Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://vcrstorage200835743759.blob.core.windows.net/\",\"file\"\ - :\"https://vcrstorage200835743759.file.core.windows.net/\",\"queue\":\"https://vcrstorage200835743759.queue.core.windows.net/\"\ - ,\"table\":\"https://vcrstorage200835743759.table.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_batch_blob_download_vj2e_/providers/Microsoft.Storage/storageAccounts/vcrstorage381378694239\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vcrstorage381378694239\"\ - ,\"properties\":{\"creationTime\":\"2017-01-31T23:57:28.8145308Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://vcrstorage381378694239.blob.core.windows.net/\",\"file\"\ - :\"https://vcrstorage381378694239.file.core.windows.net/\",\"queue\":\"https://vcrstorage381378694239.queue.core.windows.net/\"\ - ,\"table\":\"https://vcrstorage381378694239.table.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_batch_blob_download_45lz_/providers/Microsoft.Storage/storageAccounts/vcrstorage507967085394\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vcrstorage507967085394\"\ - ,\"properties\":{\"creationTime\":\"2017-01-31T23:51:23.8445151Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://vcrstorage507967085394.blob.core.windows.net/\",\"file\"\ - :\"https://vcrstorage507967085394.file.core.windows.net/\",\"queue\":\"https://vcrstorage507967085394.queue.core.windows.net/\"\ - ,\"table\":\"https://vcrstorage507967085394.table.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_file_scenario_s9o8_/providers/Microsoft.Storage/storageAccounts/vcrstorage624910385497\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vcrstorage624910385497\"\ - ,\"properties\":{\"creationTime\":\"2017-01-25T19:18:27.0436928Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://vcrstorage624910385497.blob.core.windows.net/\",\"file\"\ - :\"https://vcrstorage624910385497.file.core.windows.net/\",\"queue\":\"https://vcrstorage624910385497.queue.core.windows.net/\"\ - ,\"table\":\"https://vcrstorage624910385497.table.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_batch_blob_download_lecl_/providers/Microsoft.Storage/storageAccounts/vcrstorage677942157366\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vcrstorage677942157366\"\ - ,\"properties\":{\"creationTime\":\"2017-01-31T23:50:51.9630729Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://vcrstorage677942157366.blob.core.windows.net/\",\"file\"\ - :\"https://vcrstorage677942157366.file.core.windows.net/\",\"queue\":\"https://vcrstorage677942157366.queue.core.windows.net/\"\ - ,\"table\":\"https://vcrstorage677942157366.table.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_file_scenario_0yl2_/providers/Microsoft.Storage/storageAccounts/vcrstorage956090376869\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vcrstorage956090376869\"\ - ,\"properties\":{\"creationTime\":\"2017-01-25T19:21:05.4874186Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://vcrstorage956090376869.blob.core.windows.net/\",\"file\"\ - :\"https://vcrstorage956090376869.file.core.windows.net/\",\"queue\":\"https://vcrstorage956090376869.queue.core.windows.net/\"\ - ,\"table\":\"https://vcrstorage956090376869.table.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_multi_nic_vm_eltb_/providers/Microsoft.Storage/storageAccounts/vhd14851988611103\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vhd14851988611103\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T19:14:34.5787101Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://vhd14851988611103.blob.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Premium_LRS\",\"tier\":\"Premium\"},\"tags\":{},\"type\"\ - :\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestdiagext_cua0_/providers/Microsoft.Storage/storageAccounts/vhd14852011967911\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vhd14852011967911\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T19:53:29.0119552Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://vhd14852011967911.blob.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Premium_LRS\",\"tier\":\"Premium\"},\"tags\":{},\"type\"\ - :\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-test-disk_6ks0_/providers/Microsoft.Storage/storageAccounts/vhdstorage0xlzutz0gudb0a\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vhdstorage0xlzutz0gudb0a\"\ - ,\"properties\":{\"creationTime\":\"2017-02-08T00:34:38.4987629Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://vhdstorage0xlzutz0gudb0a.blob.core.windows.net/\",\"\ - file\":\"https://vhdstorage0xlzutz0gudb0a.file.core.windows.net/\",\"queue\"\ - :\"https://vhdstorage0xlzutz0gudb0a.queue.core.windows.net/\",\"table\":\"\ - https://vhdstorage0xlzutz0gudb0a.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-test-disk_778v_/providers/Microsoft.Storage/storageAccounts/vhdstorage7ehbes0uj1vpq5\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vhdstorage7ehbes0uj1vpq5\"\ - ,\"properties\":{\"creationTime\":\"2017-02-08T17:30:41.8685442Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://vhdstorage7ehbes0uj1vpq5.blob.core.windows.net/\",\"\ - file\":\"https://vhdstorage7ehbes0uj1vpq5.file.core.windows.net/\",\"queue\"\ - :\"https://vhdstorage7ehbes0uj1vpq5.queue.core.windows.net/\",\"table\":\"\ - https://vhdstorage7ehbes0uj1vpq5.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-test-disk_7h5k_/providers/Microsoft.Storage/storageAccounts/vhdstoragen7xg8027aoefmr\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vhdstoragen7xg8027aoefmr\"\ - ,\"properties\":{\"creationTime\":\"2017-02-07T18:12:01.6540434Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://vhdstoragen7xg8027aoefmr.blob.core.windows.net/\",\"\ - file\":\"https://vhdstoragen7xg8027aoefmr.file.core.windows.net/\",\"queue\"\ - :\"https://vhdstoragen7xg8027aoefmr.queue.core.windows.net/\",\"table\":\"\ - https://vhdstoragen7xg8027aoefmr.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_generalize_vm_yxzi_/providers/Microsoft.Storage/storageAccounts/vhdstorageptm1kf0vwqm1bp\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vhdstorageptm1kf0vwqm1bp\"\ - ,\"properties\":{\"creationTime\":\"2017-02-06T21:56:28.0446456Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://vhdstorageptm1kf0vwqm1bp.blob.core.windows.net/\"},\"\ - primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Premium_LRS\",\"tier\":\"Premium\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmss_create_and_modify_wnpp_/providers/Microsoft.Storage/storageAccounts/vmss1771s0\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vmss1771s0\",\"properties\"\ - :{\"creationTime\":\"2017-02-06T21:54:02.6033587Z\",\"primaryEndpoints\":{\"\ - blob\":\"https://vmss1771s0.blob.core.windows.net/\",\"file\":\"https://vmss1771s0.file.core.windows.net/\"\ - ,\"queue\":\"https://vmss1771s0.queue.core.windows.net/\",\"table\":\"https://vmss1771s0.table.core.windows.net/\"\ - },\"primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmss_create_and_modify_wnpp_/providers/Microsoft.Storage/storageAccounts/vmss1771s1\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vmss1771s1\",\"properties\"\ - :{\"creationTime\":\"2017-02-06T21:54:02.6013580Z\",\"primaryEndpoints\":{\"\ - blob\":\"https://vmss1771s1.blob.core.windows.net/\",\"file\":\"https://vmss1771s1.file.core.windows.net/\"\ - ,\"queue\":\"https://vmss1771s1.queue.core.windows.net/\",\"table\":\"https://vmss1771s1.table.core.windows.net/\"\ - },\"primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmss_create_and_modify_wnpp_/providers/Microsoft.Storage/storageAccounts/vmss1771s2\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vmss1771s2\",\"properties\"\ - :{\"creationTime\":\"2017-02-06T21:54:02.5933589Z\",\"primaryEndpoints\":{\"\ - blob\":\"https://vmss1771s2.blob.core.windows.net/\",\"file\":\"https://vmss1771s2.file.core.windows.net/\"\ - ,\"queue\":\"https://vmss1771s2.queue.core.windows.net/\",\"table\":\"https://vmss1771s2.table.core.windows.net/\"\ - },\"primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmss_create_and_modify_wnpp_/providers/Microsoft.Storage/storageAccounts/vmss1771s3\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vmss1771s3\",\"properties\"\ - :{\"creationTime\":\"2017-02-06T21:54:02.5803580Z\",\"primaryEndpoints\":{\"\ - blob\":\"https://vmss1771s3.blob.core.windows.net/\",\"file\":\"https://vmss1771s3.file.core.windows.net/\"\ - ,\"queue\":\"https://vmss1771s3.queue.core.windows.net/\",\"table\":\"https://vmss1771s3.table.core.windows.net/\"\ - },\"primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmss_create_and_modify_wnpp_/providers/Microsoft.Storage/storageAccounts/vmss1771s4\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vmss1771s4\",\"properties\"\ - :{\"creationTime\":\"2017-02-06T21:54:02.6233606Z\",\"primaryEndpoints\":{\"\ - blob\":\"https://vmss1771s4.blob.core.windows.net/\",\"file\":\"https://vmss1771s4.file.core.windows.net/\"\ - ,\"queue\":\"https://vmss1771s4.queue.core.windows.net/\",\"table\":\"https://vmss1771s4.table.core.windows.net/\"\ - },\"primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestdiagext_cua0_/providers/Microsoft.Storage/storageAccounts/vwwdoic4pwlrktestdiagvsa\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"vwwdoic4pwlrktestdiagvsa\"\ - ,\"properties\":{\"creationTime\":\"2017-01-23T19:50:43.0763832Z\",\"primaryEndpoints\"\ - :{\"blob\":\"https://vwwdoic4pwlrktestdiagvsa.blob.core.windows.net/\",\"\ - file\":\"https://vwwdoic4pwlrktestdiagvsa.file.core.windows.net/\",\"queue\"\ - :\"https://vwwdoic4pwlrktestdiagvsa.queue.core.windows.net/\",\"table\":\"\ - https://vwwdoic4pwlrktestdiagvsa.table.core.windows.net/\"},\"primaryLocation\"\ - :\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\":\"available\"\ - },\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"tags\":{},\"\ - type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/zitest\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"zitest\",\"properties\"\ - :{\"creationTime\":\"2016-05-03T20:07:05.3537460Z\",\"primaryEndpoints\":{\"\ - blob\":\"https://zitest.blob.core.windows.net/\",\"file\":\"https://zitest.file.core.windows.net/\"\ - ,\"queue\":\"https://zitest.queue.core.windows.net/\",\"table\":\"https://zitest.table.core.windows.net/\"\ - },\"primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/zitesta21\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"zitesta21\",\"properties\"\ - :{\"creationTime\":\"2016-08-23T20:01:18.8418933Z\",\"primaryEndpoints\":{\"\ - blob\":\"https://zitesta21.blob.core.windows.net/\",\"file\":\"https://zitesta21.file.core.windows.net/\"\ - ,\"queue\":\"https://zitesta21.queue.core.windows.net/\",\"table\":\"https://zitesta21.table.core.windows.net/\"\ - },\"primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/zitestb21\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"zitestb21\",\"properties\"\ - :{\"creationTime\":\"2016-08-23T20:10:50.2990885Z\",\"primaryEndpoints\":{\"\ - blob\":\"https://zitestb21.blob.core.windows.net/\",\"file\":\"https://zitestb21.file.core.windows.net/\"\ - ,\"queue\":\"https://zitestb21.queue.core.windows.net/\",\"table\":\"https://zitestb21.table.core.windows.net/\"\ - },\"primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"},{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/zitesty21\"\ - ,\"kind\":\"Storage\",\"location\":\"westus\",\"name\":\"zitesty21\",\"properties\"\ - :{\"creationTime\":\"2016-08-23T19:55:37.1159138Z\",\"primaryEndpoints\":{\"\ - blob\":\"https://zitesty21.blob.core.windows.net/\",\"file\":\"https://zitesty21.file.core.windows.net/\"\ - ,\"queue\":\"https://zitesty21.queue.core.windows.net/\",\"table\":\"https://zitesty21.table.core.windows.net/\"\ - },\"primaryLocation\":\"westus\",\"provisioningState\":\"Succeeded\",\"statusOfPrimary\"\ - :\"available\"},\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"\ - tags\":{},\"type\":\"Microsoft.Storage/storageAccounts\"}]}\n"} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"FvHhwyIgb9w4f9IP8q8hsco9YRMQx2Cmw7/twW6Z5BDSqV7E3glSpl6XjhGd4EBoH1y3Qs7ZydIzRdzXb5RUlA=="},{"keyName":"key2","permissions":"Full","value":"bl05+mAzQpLT0w07vniIWTHZfgxJ8M9ywLnk6NmJ0EsWmpa/QBeO9zK7AObh4pOmsIBgeQq7ibjoDYpLBjLxmw=="}]} + + '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:30 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:36 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['47919'] + content-length: ['289'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: - body: null + body: '{"keyName": "key1"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['0'] + Content-Length: ['19'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [e397b9de-ee5b-11e6-928a-3c15c2cf0610] + x-ms-client-request-id: [e876def8-f3c9-11e6-92c4-74c63bed1137] method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete/listKeys?api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage/regenerateKey?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"Qnm0sK1WFJbrpqibPUbUxyT9tJZEhgYa6ccqe6pp1FwaCKVC05gLpMYF1fGbK4Eghbr3lDqu/owFEHtG5fUEKA=="},{"keyName":"key2","permissions":"Full","value":"09kvsAJkFw0sibG9sQlYwT6hhMRjieuiVOgYrX9r03ZD1atHscccJPNNZEPRC6WBIjn1j+s7DR2U+Iw8GdRNrQ=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"l03UHMDSrRKgCV8svPY6KwOJkLebUO4Ga+hTp6OOmbfgGHErym9xC0cqiRv1EFwD1qGl4n6L2meRzgmIIvwDtw=="},{"keyName":"key2","permissions":"Full","value":"bl05+mAzQpLT0w07vniIWTHZfgxJ8M9ywLnk6NmJ0EsWmpa/QBeO9zK7AObh4pOmsIBgeQq7ibjoDYpLBjLxmw=="}]} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:30 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:37 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -1170,30 +691,30 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['289'] - x-ms-ratelimit-remaining-subscription-writes: ['1191'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: - body: null + body: '{"keyName": "key2"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['0'] + Content-Length: ['19'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [e4604ca8-ee5b-11e6-895f-3c15c2cf0610] + x-ms-client-request-id: [e8fa5966-f3c9-11e6-9f40-74c63bed1137] method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete/listKeys?api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage/regenerateKey?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"Qnm0sK1WFJbrpqibPUbUxyT9tJZEhgYa6ccqe6pp1FwaCKVC05gLpMYF1fGbK4Eghbr3lDqu/owFEHtG5fUEKA=="},{"keyName":"key2","permissions":"Full","value":"09kvsAJkFw0sibG9sQlYwT6hhMRjieuiVOgYrX9r03ZD1atHscccJPNNZEPRC6WBIjn1j+s7DR2U+Iw8GdRNrQ=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"l03UHMDSrRKgCV8svPY6KwOJkLebUO4Ga+hTp6OOmbfgGHErym9xC0cqiRv1EFwD1qGl4n6L2meRzgmIIvwDtw=="},{"keyName":"key2","permissions":"Full","value":"YfbqITRrz1Rtt8HMj/hKLxQDho6ZbojNZnjevh8Di8ZmWr4NYsneWY47IdSQTxUFSqrveoyrXwpp+xjNBVDVeA=="}]} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:32 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:38 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -1201,162 +722,190 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['289'] - x-ms-ratelimit-remaining-subscription-writes: ['1192'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: - body: '{"keyName": "key1"}' + body: null headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['19'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [e5456a62-ee5b-11e6-a096-3c15c2cf0610] - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete/regenerateKey?api-version=2016-12-01 + x-ms-client-request-id: [e971ec5a-f3c9-11e6-98df-74c63bed1137] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"nmZJp3gS+UOdrOtFMqFlZpwkMnU1yJz5VeFoX5oFsU/I56SRqcmYveJUV8aV9zNIKf+ZYfpoFmMI0jIlsoUZdg=="},{"keyName":"key2","permissions":"Full","value":"09kvsAJkFw0sibG9sQlYwT6hhMRjieuiVOgYrX9r03ZD1atHscccJPNNZEPRC6WBIjn1j+s7DR2U+Iw8GdRNrQ=="}]} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:33 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:39 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['289'] - x-ms-ratelimit-remaining-subscription-writes: ['1188'] + content-length: ['776'] status: {code: 200, message: OK} - request: - body: '{"keyName": "key2"}' + body: '{"sku": {"name": "Standard_LRS"}, "kind": "Storage", "tags": {"cat": "", + "foo": "bar"}, "location": "westus"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['19'] + Content-Length: ['109'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [e63782b4-ee5b-11e6-94c1-3c15c2cf0610] - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete/regenerateKey?api-version=2016-12-01 + x-ms-client-request-id: [e9ba9bba-f3c9-11e6-ad5f-74c63bed1137] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"nmZJp3gS+UOdrOtFMqFlZpwkMnU1yJz5VeFoX5oFsU/I56SRqcmYveJUV8aV9zNIKf+ZYfpoFmMI0jIlsoUZdg=="},{"keyName":"key2","permissions":"Full","value":"WHNE7cfg7bfsY9UFGG1rbxTxB41SZTAhwlzTUqhTQzAqKOsKVaJT8UfEoBRg2oLg5fGBLuiDm4pJdwKMxXRDhw=="}]} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{"cat":"","foo":"bar"},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:35 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:39 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['289'] - x-ms-ratelimit-remaining-subscription-writes: ['1188'] + content-length: ['796'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: - body: '{"tags": {"foo": "bar", "cat": ""}}' + body: null headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['35'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [e701ab8c-ee5b-11e6-83b7-3c15c2cf0610] - method: PATCH - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete?api-version=2016-12-01 + x-ms-client-request-id: [ea9f11d8-f3c9-11e6-aff0-74c63bed1137] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete","kind":"Storage","location":"westus","name":"testcreatedelete","properties":{"creationTime":"2017-02-09T00:07:37.2213980Z","primaryEndpoints":{"blob":"https://testcreatedelete.blob.core.windows.net/","file":"https://testcreatedelete.file.core.windows.net/","queue":"https://testcreatedelete.queue.core.windows.net/","table":"https://testcreatedelete.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{"cat":"","foo":"bar"},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{"cat":"","foo":"bar"},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:36 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:41 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['760'] - x-ms-ratelimit-remaining-subscription-writes: ['1191'] + content-length: ['796'] status: {code: 200, message: OK} - request: - body: '{"tags": {}}' + body: '{"sku": {"name": "Standard_GRS"}, "kind": "Storage", "tags": {}, "location": + "westus"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['12'] + Content-Length: ['86'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [e7f6cb00-ee5b-11e6-a689-3c15c2cf0610] - method: PATCH - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete?api-version=2016-12-01 + x-ms-client-request-id: [eae678e6-f3c9-11e6-9c30-74c63bed1137] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete","kind":"Storage","location":"westus","name":"testcreatedelete","properties":{"creationTime":"2017-02-09T00:07:37.2213980Z","primaryEndpoints":{"blob":"https://testcreatedelete.blob.core.windows.net/","file":"https://testcreatedelete.file.core.windows.net/","queue":"https://testcreatedelete.queue.core.windows.net/","table":"https://testcreatedelete.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","secondaryLocation":"eastus","statusOfPrimary":"available","statusOfSecondary":"available"},"sku":{"name":"Standard_GRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:38 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:41 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['740'] - x-ms-ratelimit-remaining-subscription-writes: ['1190'] + content-length: ['837'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: - body: '{"sku": {"name": "Standard_GRS"}}' + body: null headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['33'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [e8f08b4a-ee5b-11e6-bf14-3c15c2cf0610] - method: PATCH - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete?api-version=2016-12-01 + x-ms-client-request-id: [ebb69412-f3c9-11e6-90d2-74c63bed1137] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete","kind":"Storage","location":"westus","name":"testcreatedelete","properties":{"creationTime":"2017-02-09T00:07:37.2213980Z","primaryEndpoints":{"blob":"https://testcreatedelete.blob.core.windows.net/","file":"https://testcreatedelete.file.core.windows.net/","queue":"https://testcreatedelete.queue.core.windows.net/","table":"https://testcreatedelete.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","secondaryLocation":"eastus","statusOfPrimary":"available","statusOfSecondary":"available"},"sku":{"name":"Standard_GRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","secondaryLocation":"eastus","statusOfPrimary":"available","statusOfSecondary":"available"},"sku":{"name":"Standard_GRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:40 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:42 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['801'] - x-ms-ratelimit-remaining-subscription-writes: ['1187'] + content-length: ['837'] + status: {code: 200, message: OK} +- request: + body: '{"sku": {"name": "Standard_GRS"}, "kind": "Storage", "tags": {"test": "success"}, + "location": "westus"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['103'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + accept-language: [en-US] + x-ms-client-request-id: [ec0156a2-f3c9-11e6-accb-74c63bed1137] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","secondaryLocation":"eastus","statusOfPrimary":"available","statusOfSecondary":"available"},"sku":{"name":"Standard_GRS","tier":"Standard"},"tags":{"test":"success"},"type":"Microsoft.Storage/storageAccounts"} + + '} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json] + Date: ['Wed, 15 Feb 2017 21:58:43 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['853'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: body: null @@ -1366,36 +915,36 @@ interactions: Connection: [keep-alive] Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ea0831e8-ee5b-11e6-9c36-3c15c2cf0610] + x-ms-client-request-id: [ec90ffe8-f3c9-11e6-8acd-74c63bed1137] method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/testcreatedelete?api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: body: {string: ''} headers: Cache-Control: [no-cache] Content-Length: ['0'] - Date: ['Thu, 09 Feb 2017 00:08:42 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:45 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1189'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: - body: '{"name": "testcreatedelete", "type": "Microsoft.Storage/storageAccounts"}' + body: '{"name": "vcrstorage733641907300", "type": "Microsoft.Storage/storageAccounts"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['73'] + Content-Length: ['79'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [eb442d7a-ee5b-11e6-a223-3c15c2cf0610] + x-ms-client-request-id: [ed84472e-f3c9-11e6-b3f4-74c63bed1137] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/checkNameAvailability?api-version=2016-12-01 response: @@ -1405,7 +954,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:43 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:46 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -1422,10 +971,10 @@ interactions: Connection: [keep-alive] Content-Length: ['73'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.0 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ec0dbb9a-ee5b-11e6-8d8d-3c15c2cf0610] + x-ms-client-request-id: [ee15b978-f3c9-11e6-9fe3-74c63bed1137] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/checkNameAvailability?api-version=2016-12-01 response: @@ -1435,7 +984,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Thu, 09 Feb 2017 00:08:45 GMT'] + Date: ['Wed, 15 Feb 2017 21:58:47 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] diff --git a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py index 7f809251b..d88e11f1d 100644 --- a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py +++ b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py @@ -14,7 +14,7 @@ from azure.cli.command_modules.storage._factory import NO_CREDENTIALS_ERROR_MESS from azure.cli.core.test_utils.vcr_test_base import \ (VCRTestBase, ResourceGroupVCRTestBase, StorageAccountVCRTestBase, JMESPathCheck, NoneCheck, BooleanCheck, StringCheck) -from azure.cli.core._util import CLIError +from azure.cli.core._util import CLIError, random_string MOCK_ACCOUNT_KEY = '00000000' TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) @@ -34,7 +34,11 @@ class StorageAccountScenarioTest(ResourceGroupVCRTestBase): def __init__(self, test_method): super(StorageAccountScenarioTest, self).__init__(__file__, test_method, resource_group='test_storage_account_scenario') - self.account = 'testcreatedelete' + if not self.playback: + self.account = 'vcrstorage{}'.format(random_string(12, digits_only=True)) + else: + from azure.cli.core.test_utils.vcr_test_base import MOCKED_STORAGE_ACCOUNT + self.account = MOCKED_STORAGE_ACCOUNT def test_storage_account_scenario(self): self.execute() @@ -50,18 +54,17 @@ class StorageAccountScenarioTest(ResourceGroupVCRTestBase): JMESPathCheck('location', 'westus'), JMESPathCheck('sku.name', 'Standard_LRS') ]) + s.cmd('storage account check-name --name {}'.format(account), checks=[ JMESPathCheck('nameAvailable', False), JMESPathCheck('reason', 'AlreadyExists') ]) s.cmd('storage account list -g {}'.format(rg, account), checks=[ - JMESPathCheck('[0].name', account), JMESPathCheck('[0].location', 'westus'), JMESPathCheck('[0].sku.name', 'Standard_LRS'), JMESPathCheck('[0].resourceGroup', rg) ]) s.cmd('storage account show --resource-group {} --name {}'.format(rg, account), checks=[ - JMESPathCheck('name', account), JMESPathCheck('location', 'westus'), JMESPathCheck('sku.name', 'Standard_LRS'), JMESPathCheck('resourceGroup', rg) @@ -94,10 +97,11 @@ class StorageAccountScenarioTest(ResourceGroupVCRTestBase): JMESPathCheck('file.minute.enabled', False), ]) - sas = s.cmd('storage account generate-sas --resource-types o --services b --expiry 2046-12-' - '31T08:23Z --permissions r --https-only --account-name {}'.format(account)) - sas_keys = dict(pair.split('=') for pair in sas.split('&')) - assert u'sig' in sas_keys + # TODO: Re-enable this after figuring out why it won't play back successfully + # sas = s.cmd('storage account generate-sas --resource-types o --services b --expiry 2046-12-' + # '31T08:23Z --permissions r --https-only --account-name {}'.format(account)) + # sas_keys = dict(pair.split('=') for pair in sas.split('&')) + # assert u'sig' in sas_keys keys_result = s.cmd('storage account keys list -g {} -n {}'.format(rg, account)) key1 = keys_result[0] @@ -114,10 +118,12 @@ class StorageAccountScenarioTest(ResourceGroupVCRTestBase): assert key2 != keys_result[1] s.cmd('storage account update -g {} -n {} --tags foo=bar cat'.format(rg, account), checks=JMESPathCheck('tags', {'cat': '', 'foo': 'bar'})) - s.cmd('storage account update -g {} -n {} --tags'.format(rg, account), - checks=JMESPathCheck('tags', {})) - s.cmd('storage account update -g {} -n {} --sku Standard_GRS'.format(rg, account), - checks=JMESPathCheck('sku.name', 'Standard_GRS')) + s.cmd('storage account update -g {} -n {} --sku Standard_GRS --tags'.format(rg, account), checks=[ + JMESPathCheck('tags', {}), + JMESPathCheck('sku.name', 'Standard_GRS') + ]) + s.cmd('storage account update -g {} -n {} --set tags.test=success'.format(rg, account), + checks=JMESPathCheck('tags', {'test': 'success'})) s.cmd('storage account delete -g {} -n {} --yes'.format(rg, account)) s.cmd('storage account check-name --name {}'.format(account), checks=JMESPathCheck('nameAvailable', True)) result = s.cmd('storage account check-name --name teststorageomega --query "nameAvailable" -o tsv') diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/recordings/test_vm_create_existing_ids_options.yaml b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/recordings/test_vm_create_existing_ids_options.yaml index a9d5c097f..ca832775e 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/recordings/test_vm_create_existing_ids_options.yaml +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/recordings/test_vm_create_existing_ids_options.yaml @@ -6,14 +6,14 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 subscriptionclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [9f5b9430-f3b4-11e6-861e-74c63bed1137] + x-ms-client-request-id: [5b0bb991-f468-11e6-a617-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/locations?api-version=2016-06-01 response: - body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastasia","name":"eastasia","displayName":"East + body: {string: !!python/unicode '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastasia","name":"eastasia","displayName":"East Asia","longitude":"114.188","latitude":"22.267"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southeastasia","name":"southeastasia","displayName":"Southeast Asia","longitude":"103.833","latitude":"1.283"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/centralus","name":"centralus","displayName":"Central US","longitude":"-93.6208","latitude":"41.5908"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus","name":"eastus","displayName":"East @@ -41,25 +41,25 @@ interactions: Central","longitude":"126.9780","latitude":"37.5665"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/koreasouth","name":"koreasouth","displayName":"Korea South","longitude":"129.0756","latitude":"35.1796"}]}'} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:26:15 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['4523'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:52:51 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null headers: Connection: [close] Host: [raw.githubusercontent.com] - User-Agent: [Python-urllib/3.5] + User-Agent: [Python-urllib/2.7] method: GET uri: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json response: - body: {string: "{\n \"$schema\":\"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json\"\ + body: {string: !!python/unicode "{\n \"$schema\":\"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json\"\ ,\n \"contentVersion\":\"1.0.0.0\",\n \"parameters\":{},\n \"variables\"\ :{},\n \"resources\":[],\n\n \"outputs\":{\n \"aliases\":{\n \"\ metadata\":{\n \"description\":\"This list of aliases is used by Azure\ @@ -96,30 +96,30 @@ interactions: \ \"version\":\"latest\"\n }\n }\n }\n }\n }\n\ }\n"} headers: - Accept-Ranges: [bytes] - Access-Control-Allow-Origin: ['*'] - Cache-Control: [max-age=300] - Connection: [close] - Content-Length: ['2297'] - Content-Security-Policy: [default-src 'none'; style-src 'unsafe-inline'] - Content-Type: [text/plain; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:26:16 GMT'] - ETag: ['"db78eb36618a060181b32ac2de91b1733f382e01"'] - Expires: ['Wed, 15 Feb 2017 19:31:16 GMT'] - Source-Age: ['0'] - Strict-Transport-Security: [max-age=31536000] - Vary: ['Authorization,Accept-Encoding'] - Via: [1.1 varnish] - X-Cache: [MISS] - X-Cache-Hits: ['0'] - X-Content-Type-Options: [nosniff] - X-Fastly-Request-ID: [01db05c9bda9ce90c567c0bc9fa61758790ba500] - X-Frame-Options: [deny] - X-Geo-Block-List: [''] - X-GitHub-Request-Id: ['B398:7AF7:4906FE:4C277B:58A4AB57'] - X-Served-By: [cache-sea1046-SEA] - X-Timer: ['S1487186776.324802,VS0,VE94'] - X-XSS-Protection: [1; mode=block] + accept-ranges: [bytes] + access-control-allow-origin: ['*'] + cache-control: [max-age=300] + connection: [close] + content-length: ['2297'] + content-security-policy: [default-src 'none'; style-src 'unsafe-inline'] + content-type: [text/plain; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:52:53 GMT'] + etag: ['"db78eb36618a060181b32ac2de91b1733f382e01"'] + expires: ['Thu, 16 Feb 2017 16:57:53 GMT'] + source-age: ['13'] + strict-transport-security: [max-age=31536000] + vary: ['Authorization,Accept-Encoding'] + via: [1.1 varnish] + x-cache: [HIT] + x-cache-hits: ['1'] + x-content-type-options: [nosniff] + x-fastly-request-id: [6a8abed63b9939ddab146aa73290202342363abd] + x-frame-options: [deny] + x-geo-block-list: [''] + x-github-request-id: ['3798:623E:3EEAA59:40E9734:58A5D8D8'] + x-served-by: [cache-den6022-DEN] + x-timer: ['S1487263973.543534,VS0,VE0'] + x-xss-protection: [1; mode=block] status: {code: 200, message: OK} - request: body: null @@ -128,15 +128,15 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [9fcce6d2-f3b4-11e6-88f9-74c63bed1137] + x-ms-client-request-id: [5bda7b40-f468-11e6-b7b4-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage?api-version=2016-09-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage","namespace":"Microsoft.Storage","authorization":{"applicationId":"a6aa9161-5291-40bb-8c5c-923b567bee3b","roleDefinitionId":"070ab87f-0efc-4423-b18b-756f3bdb0236"},"resourceTypes":[{"resourceType":"storageAccounts","locations":["East + body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage","namespace":"Microsoft.Storage","authorization":{"applicationId":"a6aa9161-5291-40bb-8c5c-923b567bee3b","roleDefinitionId":"070ab87f-0efc-4423-b18b-756f3bdb0236"},"resourceTypes":[{"resourceType":"storageAccounts","locations":["East US","East US 2","East US 2 (Stage)","West US","West Europe","East Asia","Southeast Asia","Japan East","Japan West","North Central US","South Central US","Central US","North Europe","Brazil South","Australia East","Australia Southeast","South @@ -154,14 +154,14 @@ interactions: India","Central India","West India","Canada East","Canada Central","West US 2","West Central US","UK South","UK West"],"apiVersions":["2014-04-01"]}],"registrationState":"Registered"}'} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:26:15 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['2634'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:52:54 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -170,28 +170,28 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a00e2830-f3b4-11e6-ae8b-74c63bed1137] + x-ms-client-request-id: [5c8ab870-f468-11e6-bd2b-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Storage/storageAccounts/dummystorage.api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Storage/storageAccounts/vcrstorage01234560","kind":"Storage","location":"westus","name":"vcrstorage01234560","properties":{"creationTime":"2017-02-15T19:24:44.5739800Z","primaryEndpoints":{"blob":"https://vcrstorage01234560.blob.core.windows.net/","file":"https://vcrstorage01234560.file.core.windows.net/","queue":"https://vcrstorage01234560.queue.core.windows.net/","table":"https://vcrstorage01234560.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Storage/storageAccounts/vcrstorage01234560","kind":"Storage","location":"westus","name":"vcrstorage01234560","properties":{"creationTime":"2017-02-16T16:51:27.1270706Z","primaryEndpoints":{"blob":"https://vcrstorage01234560.blob.core.windows.net/","file":"https://vcrstorage01234560.file.core.windows.net/","queue":"https://vcrstorage01234560.queue.core.windows.net/","table":"https://vcrstorage01234560.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: - Cache-Control: [no-cache] - Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 19:26:17 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['754'] + content-type: [application/json] + date: ['Thu, 16 Feb 2017 16:52:54 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -200,15 +200,15 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a0966a5c-f3b4-11e6-bede-74c63bed1137] + x-ms-client-request-id: [5cce9f40-f468-11e6-b185-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute?api-version=2016-09-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute","namespace":"Microsoft.Compute","authorization":{"applicationId":"60e6cd67-9c8c-4951-9b3c-23c25a2169af","roleDefinitionId":"e4770acb-272e-4dc8-87f3-12f44a612224"},"resourceTypes":[{"resourceType":"availabilitySets","locations":["East + body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute","namespace":"Microsoft.Compute","authorization":{"applicationId":"60e6cd67-9c8c-4951-9b3c-23c25a2169af","roleDefinitionId":"e4770acb-272e-4dc8-87f3-12f44a612224"},"resourceTypes":[{"resourceType":"availabilitySets","locations":["East US","East US 2","West US","Central US","North Central US","South Central US","North Europe","West Europe","East Asia","Southeast Asia","Japan East","Japan West","Australia East","Australia Southeast","Brazil South","South India","Central India","West @@ -330,14 +330,14 @@ interactions: India","Canada Central","Canada East","West US 2","West Central US","UK South","UK West","Korea Central","Korea South"],"apiVersions":["2014-04-01"]}],"registrationState":"Registered"}'} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:26:17 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['12754'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:52:54 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -346,31 +346,31 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a0ee9822-f3b4-11e6-bd03-74c63bed1137] + x-ms-client-request-id: [5ce29c70-f468-11e6-8c8d-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/availabilitySets/vrfavailset?api-version=2017-03-30 response: - body: {string: "{\r\n \"properties\": {\r\n \"platformUpdateDomainCount\"\ + body: {string: !!python/unicode "{\r\n \"properties\": {\r\n \"platformUpdateDomainCount\"\ : 3,\r\n \"platformFaultDomainCount\": 3,\r\n \"virtualMachines\": []\r\ \n },\r\n \"type\": \"Microsoft.Compute/availabilitySets\",\r\n \"location\"\ : \"westus\",\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/availabilitySets/vrfavailset\"\ ,\r\n \"name\": \"vrfavailset\",\r\n \"sku\": {\r\n \"name\": \"Classic\"\ \r\n }\r\n}"} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:26:18 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['458'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:52:54 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -379,15 +379,15 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a16ef7cc-f3b4-11e6-90e0-74c63bed1137] + x-ms-client-request-id: [5d0f78cf-f468-11e6-b998-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network?api-version=2016-09-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network","namespace":"Microsoft.Network","authorization":{"applicationId":"2cf9eb86-36b5-49dc-86ae-9a63135dfa8c","roleDefinitionId":"13ba9ab4-19f0-4804-adc4-14ece36cc7a1"},"resourceTypes":[{"resourceType":"virtualNetworks","locations":["West + body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network","namespace":"Microsoft.Network","authorization":{"applicationId":"2cf9eb86-36b5-49dc-86ae-9a63135dfa8c","roleDefinitionId":"13ba9ab4-19f0-4804-adc4-14ece36cc7a1"},"resourceTypes":[{"resourceType":"virtualNetworks","locations":["West US","East US","North Europe","West Europe","East Asia","Southeast Asia","North Central US","South Central US","Central US","East US 2","Japan East","Japan West","Brazil South","Australia East","Australia Southeast","Central India","South @@ -465,14 +465,14 @@ interactions: India","Canada Central","Canada East","West Central US","West US 2","UK West","UK South","Korea Central","Korea South"],"apiVersions":["2016-12-01","2016-11-01","2016-10-01","2016-09-01","2016-08-01","2016-07-01","2016-06-01","2016-03-30","2015-06-15","2015-05-01-preview","2014-12-01-preview"],"capabilities":"None"},{"resourceType":"expressRouteServiceProviders","locations":[],"apiVersions":["2016-12-01","2016-11-01","2016-10-01","2016-09-01","2016-08-01","2016-07-01","2016-06-01","2016-03-30","2015-06-15","2015-05-01-preview","2014-12-01-preview"]}],"registrationState":"Registered"}'} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:26:19 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['11292'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:52:55 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -481,39 +481,40 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a1b902c2-f3b4-11e6-aa23-74c63bed1137] + x-ms-client-request-id: [5d24d591-f468-11e6-9333-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/virtualNetworks/vrfvnet?api-version=2016-12-01 response: - body: {string: "{\r\n \"name\": \"vrfvnet\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/virtualNetworks/vrfvnet\"\ - ,\r\n \"etag\": \"W/\\\"1f78eab0-67b4-4fdb-b74d-b6897dc4e7d0\\\"\",\r\n \ + body: {string: !!python/unicode "{\r\n \"name\": \"vrfvnet\",\r\n \"id\": \"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/virtualNetworks/vrfvnet\"\ + ,\r\n \"etag\": \"W/\\\"92f16ea2-10e6-4312-b1f9-bd3d929dac4c\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\"\ ,\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\":\ - \ \"Succeeded\",\r\n \"resourceGuid\": \"fae1adb5-75ad-4bc6-bbea-98db079ead50\"\ + \ \"Succeeded\",\r\n \"resourceGuid\": \"3d494197-230d-4492-8b13-db0c193d9ca8\"\ ,\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"\ 10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\"\ : []\r\n },\r\n \"subnets\": [\r\n {\r\n \"name\": \"vrfsubnet\"\ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/virtualNetworks/vrfvnet/subnets/vrfsubnet\"\ - ,\r\n \"etag\": \"W/\\\"1f78eab0-67b4-4fdb-b74d-b6897dc4e7d0\\\"\"\ + ,\r\n \"etag\": \"W/\\\"92f16ea2-10e6-4312-b1f9-bd3d929dac4c\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"addressPrefix\": \"10.0.0.0/24\"\r\n }\r\n }\r\ \n ],\r\n \"virtualNetworkPeerings\": []\r\n }\r\n}"} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:26:19 GMT'] - ETag: [W/"1f78eab0-67b4-4fdb-b74d-b6897dc4e7d0"] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['1096'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:52:55 GMT'] + etag: [W/"92f16ea2-10e6-4312-b1f9-bd3d929dac4c"] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -522,15 +523,15 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a249842e-f3b4-11e6-b8a4-74c63bed1137] + x-ms-client-request-id: [5d513cc0-f468-11e6-8401-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network?api-version=2016-09-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network","namespace":"Microsoft.Network","authorization":{"applicationId":"2cf9eb86-36b5-49dc-86ae-9a63135dfa8c","roleDefinitionId":"13ba9ab4-19f0-4804-adc4-14ece36cc7a1"},"resourceTypes":[{"resourceType":"virtualNetworks","locations":["West + body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network","namespace":"Microsoft.Network","authorization":{"applicationId":"2cf9eb86-36b5-49dc-86ae-9a63135dfa8c","roleDefinitionId":"13ba9ab4-19f0-4804-adc4-14ece36cc7a1"},"resourceTypes":[{"resourceType":"virtualNetworks","locations":["West US","East US","North Europe","West Europe","East Asia","Southeast Asia","North Central US","South Central US","Central US","East US 2","Japan East","Japan West","Brazil South","Australia East","Australia Southeast","Central India","South @@ -608,14 +609,14 @@ interactions: India","Canada Central","Canada East","West Central US","West US 2","UK West","UK South","Korea Central","Korea South"],"apiVersions":["2016-12-01","2016-11-01","2016-10-01","2016-09-01","2016-08-01","2016-07-01","2016-06-01","2016-03-30","2015-06-15","2015-05-01-preview","2014-12-01-preview"],"capabilities":"None"},{"resourceType":"expressRouteServiceProviders","locations":[],"apiVersions":["2016-12-01","2016-11-01","2016-10-01","2016-09-01","2016-08-01","2016-07-01","2016-06-01","2016-03-30","2015-06-15","2015-05-01-preview","2014-12-01-preview"]}],"registrationState":"Registered"}'} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:26:20 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['11292'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:52:56 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -624,22 +625,23 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a2910a68-f3b4-11e6-abe9-74c63bed1137] + x-ms-client-request-id: [5d6783de-f468-11e6-a80f-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg?api-version=2016-12-01 response: - body: {string: "{\r\n \"name\": \"vrfnsg\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg\"\ - ,\r\n \"etag\": \"W/\\\"c46a3c8a-978a-4728-b744-ec34ef74e1aa\\\"\",\r\n \ + body: {string: !!python/unicode "{\r\n \"name\": \"vrfnsg\",\r\n \"id\": \"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg\"\ + ,\r\n \"etag\": \"W/\\\"9cc07eb3-b48b-4bd5-b818-049f2e206fc4\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\ : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"resourceGuid\": \"36625ae3-04a7-454a-a715-6bf27e5a5ed1\"\ + : \"Succeeded\",\r\n \"resourceGuid\": \"3b2ea4e7-1836-4672-a772-776d385105fb\"\ ,\r\n \"securityRules\": [],\r\n \"defaultSecurityRules\": [\r\n \ \ {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowVnetInBound\"\ - ,\r\n \"etag\": \"W/\\\"c46a3c8a-978a-4728-b744-ec34ef74e1aa\\\"\"\ + ,\r\n \"etag\": \"W/\\\"9cc07eb3-b48b-4bd5-b818-049f2e206fc4\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -649,7 +651,7 @@ interactions: \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\ \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ - ,\r\n \"etag\": \"W/\\\"c46a3c8a-978a-4728-b744-ec34ef74e1aa\\\"\"\ + ,\r\n \"etag\": \"W/\\\"9cc07eb3-b48b-4bd5-b818-049f2e206fc4\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -658,7 +660,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/DenyAllInBound\"\ - ,\r\n \"etag\": \"W/\\\"c46a3c8a-978a-4728-b744-ec34ef74e1aa\\\"\"\ + ,\r\n \"etag\": \"W/\\\"9cc07eb3-b48b-4bd5-b818-049f2e206fc4\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -667,7 +669,7 @@ interactions: access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowVnetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"c46a3c8a-978a-4728-b744-ec34ef74e1aa\\\"\"\ + ,\r\n \"etag\": \"W/\\\"9cc07eb3-b48b-4bd5-b818-049f2e206fc4\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\ \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ @@ -676,7 +678,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowInternetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"c46a3c8a-978a-4728-b744-ec34ef74e1aa\\\"\"\ + ,\r\n \"etag\": \"W/\\\"9cc07eb3-b48b-4bd5-b818-049f2e206fc4\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -685,7 +687,7 @@ interactions: \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \ \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/DenyAllOutBound\"\ - ,\r\n \"etag\": \"W/\\\"c46a3c8a-978a-4728-b744-ec34ef74e1aa\\\"\"\ + ,\r\n \"etag\": \"W/\\\"9cc07eb3-b48b-4bd5-b818-049f2e206fc4\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -694,17 +696,17 @@ interactions: access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ : \"Outbound\"\r\n }\r\n }\r\n ]\r\n }\r\n}"} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:26:21 GMT'] - ETag: [W/"c46a3c8a-978a-4728-b744-ec34ef74e1aa"] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['5251'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:52:55 GMT'] + etag: [W/"9cc07eb3-b48b-4bd5-b818-049f2e206fc4"] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -713,15 +715,15 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a30f8bca-f3b4-11e6-bf3b-74c63bed1137] + x-ms-client-request-id: [5d923d61-f468-11e6-9e7c-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network?api-version=2016-09-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network","namespace":"Microsoft.Network","authorization":{"applicationId":"2cf9eb86-36b5-49dc-86ae-9a63135dfa8c","roleDefinitionId":"13ba9ab4-19f0-4804-adc4-14ece36cc7a1"},"resourceTypes":[{"resourceType":"virtualNetworks","locations":["West + body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network","namespace":"Microsoft.Network","authorization":{"applicationId":"2cf9eb86-36b5-49dc-86ae-9a63135dfa8c","roleDefinitionId":"13ba9ab4-19f0-4804-adc4-14ece36cc7a1"},"resourceTypes":[{"resourceType":"virtualNetworks","locations":["West US","East US","North Europe","West Europe","East Asia","Southeast Asia","North Central US","South Central US","Central US","East US 2","Japan East","Japan West","Brazil South","Australia East","Australia Southeast","Central India","South @@ -799,14 +801,14 @@ interactions: India","Canada Central","Canada East","West Central US","West US 2","UK West","UK South","Korea Central","Korea South"],"apiVersions":["2016-12-01","2016-11-01","2016-10-01","2016-09-01","2016-08-01","2016-07-01","2016-06-01","2016-03-30","2015-06-15","2015-05-01-preview","2014-12-01-preview"],"capabilities":"None"},{"resourceType":"expressRouteServiceProviders","locations":[],"apiVersions":["2016-12-01","2016-11-01","2016-10-01","2016-09-01","2016-08-01","2016-07-01","2016-06-01","2016-03-30","2015-06-15","2015-05-01-preview","2014-12-01-preview"]}],"registrationState":"Registered"}'} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:26:22 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['11292'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:52:56 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -815,82 +817,82 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a357e924-f3b4-11e6-85ff-74c63bed1137] + x-ms-client-request-id: [5da6fde1-f468-11e6-a918-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/publicIpAddresses/vrfpubip?api-version=2016-12-01 response: - body: {string: "{\r\n \"name\": \"vrfpubip\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/publicIPAddresses/vrfpubip\"\ - ,\r\n \"etag\": \"W/\\\"1972f4ca-3921-4eb8-a9d9-f65f4fd2372f\\\"\",\r\n \ + body: {string: !!python/unicode "{\r\n \"name\": \"vrfpubip\",\r\n \"id\": \"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/publicIPAddresses/vrfpubip\"\ + ,\r\n \"etag\": \"W/\\\"67960651-031d-4c5e-b015-b90e2eb64fd8\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n \"location\": \"\ westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"resourceGuid\": \"a159cbff-55f2-4f5b-b7d4-ef35b99f0bcf\"\ + : \"Succeeded\",\r\n \"resourceGuid\": \"715192d1-34d1-4ce9-a552-2bb68f73c953\"\ ,\r\n \"publicIPAddressVersion\": \"IPv4\",\r\n \"publicIPAllocationMethod\"\ : \"Dynamic\",\r\n \"idleTimeoutInMinutes\": 4\r\n }\r\n}"} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:26:22 GMT'] - ETag: [W/"1972f4ca-3921-4eb8-a9d9-f65f4fd2372f"] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['584'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:52:55 GMT'] + etag: [W/"67960651-031d-4c5e-b015-b90e2eb64fd8"] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: - body: '{"properties": {"template": {"variables": {}, "outputs": {}, "resources": - [{"apiVersion": "2015-06-15", "tags": {}, "type": "Microsoft.Network/networkInterfaces", - "location": "westus", "name": "vrfvmVMNic", "dependsOn": [], "properties": {"networkSecurityGroup": - {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg"}, + body: !!python/unicode '{"properties": {"mode": "Incremental", "parameters": {}, + "template": {"parameters": {}, "outputs": {}, "variables": {}, "contentVersion": + "1.0.0.0", "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "resources": [{"name": "vrfvmVMNic", "tags": {}, "apiVersion": "2015-06-15", + "location": "westus", "dependsOn": [], "type": "Microsoft.Network/networkInterfaces", + "properties": {"networkSecurityGroup": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg"}, "ipConfigurations": [{"name": "ipconfigvrfvm", "properties": {"subnet": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/virtualNetworks/vrfvnet/subnets/vrfsubnet"}, - "publicIPAddress": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/publicIpAddresses/vrfpubip"}, - "privateIPAllocationMethod": "Dynamic"}}]}}, {"apiVersion": "2016-04-30-preview", - "tags": {}, "type": "Microsoft.Compute/virtualMachines", "location": "westus", - "name": "vrfvm", "dependsOn": ["Microsoft.Network/networkInterfaces/vrfvmVMNic"], - "properties": {"storageProfile": {"osDisk": {"createOption": "fromImage", "name": - "vrfosdisk", "caching": "ReadWrite", "vhd": {"uri": "https://vcrstorage01234560.blob.core.windows.net/vrfcontainer/vrfosdisk.vhd"}}, - "imageReference": {"publisher": "Canonical", "offer": "UbuntuServer", "version": - "latest", "sku": "14.04.4-LTS"}}, "availabilitySet": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/availabilitySets/vrfavailset"}, - "hardwareProfile": {"vmSize": "Standard_DS2"}, "networkProfile": {"networkInterfaces": - [{"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic"}]}, - "osProfile": {"linuxConfiguration": {"disablePasswordAuthentication": true, - "ssh": {"publicKeys": [{"path": "/home/user11/.ssh/authorized_keys", "keyData": - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCbIg1guRHbI0lV11wWDt1r2cUdcNd27CJsg+SfgC7miZeubtwUhbsPdhMQsfDyhOWHq1+ZL0M+nJZV63d/1dhmhtgyOqejUwrPlzKhydsbrsdUor+JmNJDdW01v7BXHyuymT8G4s09jCasNOwiufbP/qp72ruu0bIA1nySsvlf9pCQAuFkAnVnf/rFhUlOkhtRpwcq8SUNY2zRHR/EKb/4NWY1JzR4sa3q2fWIJdrrX0DvLoa5g9bIEd4Df79ba7v+yiUBOS0zT2ll+z4g9izHK3EO5d8hL4jYxcjKs+wcslSYRWrascfscLgMlMGh0CdKeNTDjHpGPncaf3Z+FwwwjWeuiNBxv7bJo13/8B/098KlVDl4GZqsoBCEjPyJfV6hO0y/LkRGkk7oHWKgeWAfKtfLItRp00eZ4fcJNK9kCaSMmEugoZWcI7NGbZXzqFWqbpRI7NcDP9+WIQ+i9U5vqWsqd/zng4kbuAJ6UuKqIzB0upYrLShfQE3SAck8oaLhJqqq56VfDuASNpJKidV+zq27HfSBmbXnkR/5AK337dc3MXKJypoK/QPMLKUAP5XLPbs+NddJQV7EZXd29DLgp+fRIg3edpKdO7ZErWhv7d+3Kws+e1Y+ypmR2WIVSwVyBEUfgv2C8Ts9gnTF4pNcEY/S2aBicz5Ew2+jdyGNQQ== - [email protected]\n"}]}}, "computerName": "vrfvm", "adminUsername": "user11"}}}], - "parameters": {}, "contentVersion": "1.0.0.0", "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#"}, - "mode": "Incremental", "parameters": {}}}' + "privateIPAllocationMethod": "Dynamic", "publicIPAddress": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/publicIpAddresses/vrfpubip"}}}]}}, + {"name": "vrfvm", "tags": {}, "apiVersion": "2016-04-30-preview", "location": + "westus", "dependsOn": ["Microsoft.Network/networkInterfaces/vrfvmVMNic"], "type": + "Microsoft.Compute/virtualMachines", "properties": {"hardwareProfile": {"vmSize": + "Standard_DS2"}, "storageProfile": {"imageReference": {"sku": "14.04.4-LTS", + "publisher": "Canonical", "version": "latest", "offer": "UbuntuServer"}, "osDisk": + {"caching": "ReadWrite", "vhd": {"uri": "https://vcrstorage01234560.blob.core.windows.net/vrfcontainer/vrfosdisk.vhd"}, + "createOption": "fromImage", "name": "vrfosdisk"}}, "osProfile": {"adminUsername": + "user11", "computerName": "vrfvm", "linuxConfiguration": {"ssh": {"publicKeys": + [{"path": "/home/user11/.ssh/authorized_keys", "keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCbIg1guRHbI0lV11wWDt1r2cUdcNd27CJsg+SfgC7miZeubtwUhbsPdhMQsfDyhOWHq1+ZL0M+nJZV63d/1dhmhtgyOqejUwrPlzKhydsbrsdUor+JmNJDdW01v7BXHyuymT8G4s09jCasNOwiufbP/qp72ruu0bIA1nySsvlf9pCQAuFkAnVnf/rFhUlOkhtRpwcq8SUNY2zRHR/EKb/4NWY1JzR4sa3q2fWIJdrrX0DvLoa5g9bIEd4Df79ba7v+yiUBOS0zT2ll+z4g9izHK3EO5d8hL4jYxcjKs+wcslSYRWrascfscLgMlMGh0CdKeNTDjHpGPncaf3Z+FwwwjWeuiNBxv7bJo13/8B/098KlVDl4GZqsoBCEjPyJfV6hO0y/LkRGkk7oHWKgeWAfKtfLItRp00eZ4fcJNK9kCaSMmEugoZWcI7NGbZXzqFWqbpRI7NcDP9+WIQ+i9U5vqWsqd/zng4kbuAJ6UuKqIzB0upYrLShfQE3SAck8oaLhJqqq56VfDuASNpJKidV+zq27HfSBmbXnkR/5AK337dc3MXKJypoK/QPMLKUAP5XLPbs+NddJQV7EZXd29DLgp+fRIg3edpKdO7ZErWhv7d+3Kws+e1Y+ypmR2WIVSwVyBEUfgv2C8Ts9gnTF4pNcEY/S2aBicz5Ew2+jdyGNQQ== + [email protected]\n"}]}, "disablePasswordAuthentication": true}}, "availabilitySet": + {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/availabilitySets/vrfavailset"}, + "networkProfile": {"networkInterfaces": [{"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic"}]}}}]}}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Length: ['3058'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a3d7e8e6-f3b4-11e6-9b19-74c63bed1137] + x-ms-client-request-id: [5dc8b6b0-f468-11e6-94c1-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2016-09-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/vm_deploy_X1pXH0SOSusjYNkxSiiCIG16sXBeEpg7","name":"vm_deploy_X1pXH0SOSusjYNkxSiiCIG16sXBeEpg7","properties":{"templateHash":"6957269520723735707","parameters":{},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2017-02-15T19:26:25.4257547Z","duration":"PT0.9872488S","correlationId":"f25d9399-5dd4-4be9-ae78-f65b489e4ca9","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vrfvmVMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/virtualMachines/vrfvm","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vrfvm"}]}}'} + body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/vm_deploy_z9JItjv1bTexw0xq21Fi3A2HC0OkoxNn","name":"vm_deploy_z9JItjv1bTexw0xq21Fi3A2HC0OkoxNn","properties":{"templateHash":"2431566676788649389","parameters":{},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2017-02-16T16:52:58.1987674Z","duration":"PT0.5623322S","correlationId":"da771859-4915-4d1f-8c4f-d68538b79006","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vrfvmVMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/virtualMachines/vrfvm","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vrfvm"}]}}'} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/vm_deploy_X1pXH0SOSusjYNkxSiiCIG16sXBeEpg7/operationStatuses/08587144201010391380?api-version=2016-09-01'] - Cache-Control: [no-cache] - Content-Length: ['1251'] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:26:25 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] + azure-asyncoperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/vm_deploy_z9JItjv1bTexw0xq21Fi3A2HC0OkoxNn/operationStatuses/08587143429078412158?api-version=2016-09-01'] + cache-control: [no-cache] + content-length: ['1251'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:52:58 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 201, message: Created} - request: body: null @@ -899,24 +901,24 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a3d7e8e6-f3b4-11e6-9b19-74c63bed1137] + x-ms-client-request-id: [5dc8b6b0-f468-11e6-94c1-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587144201010391380?api-version=2016-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587143429078412158?api-version=2016-09-01 response: - body: {string: '{"status":"Running"}'} + body: {string: !!python/unicode '{"status":"Running"}'} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:26:56 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['20'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:53:29 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -925,24 +927,24 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a3d7e8e6-f3b4-11e6-9b19-74c63bed1137] + x-ms-client-request-id: [5dc8b6b0-f468-11e6-94c1-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587144201010391380?api-version=2016-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587143429078412158?api-version=2016-09-01 response: - body: {string: '{"status":"Running"}'} + body: {string: !!python/unicode '{"status":"Running"}'} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:27:26 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['20'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:53:59 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -951,24 +953,24 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a3d7e8e6-f3b4-11e6-9b19-74c63bed1137] + x-ms-client-request-id: [5dc8b6b0-f468-11e6-94c1-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587144201010391380?api-version=2016-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587143429078412158?api-version=2016-09-01 response: - body: {string: '{"status":"Running"}'} + body: {string: !!python/unicode '{"status":"Running"}'} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:27:56 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['20'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:54:30 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -977,24 +979,24 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a3d7e8e6-f3b4-11e6-9b19-74c63bed1137] + x-ms-client-request-id: [5dc8b6b0-f468-11e6-94c1-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587144201010391380?api-version=2016-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587143429078412158?api-version=2016-09-01 response: - body: {string: '{"status":"Succeeded"}'} + body: {string: !!python/unicode '{"status":"Succeeded"}'} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:28:27 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['22'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:55:00 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1003,24 +1005,24 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a3d7e8e6-f3b4-11e6-9b19-74c63bed1137] + x-ms-client-request-id: [5dc8b6b0-f468-11e6-94c1-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2016-09-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/vm_deploy_X1pXH0SOSusjYNkxSiiCIG16sXBeEpg7","name":"vm_deploy_X1pXH0SOSusjYNkxSiiCIG16sXBeEpg7","properties":{"templateHash":"6957269520723735707","parameters":{},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-02-15T19:28:01.0014598Z","duration":"PT1M36.5629539S","correlationId":"f25d9399-5dd4-4be9-ae78-f65b489e4ca9","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vrfvmVMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/virtualMachines/vrfvm","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vrfvm"}],"outputs":{},"outputResources":[{"id":"Microsoft.Compute/virtualMachines/vrfvm"},{"id":"Microsoft.Network/networkInterfaces/vrfvmVMNic"}]}}'} + body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Resources/deployments/vm_deploy_z9JItjv1bTexw0xq21Fi3A2HC0OkoxNn","name":"vm_deploy_z9JItjv1bTexw0xq21Fi3A2HC0OkoxNn","properties":{"templateHash":"2431566676788649389","parameters":{},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-02-16T16:54:47.8455335Z","duration":"PT1M50.2090983S","correlationId":"da771859-4915-4d1f-8c4f-d68538b79006","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vrfvmVMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/virtualMachines/vrfvm","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vrfvm"}],"outputs":{},"outputResources":[{"id":"Microsoft.Compute/virtualMachines/vrfvm"},{"id":"Microsoft.Network/networkInterfaces/vrfvmVMNic"}]}}'} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:28:27 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['1393'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:55:01 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1029,15 +1031,16 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [eef7e8f8-f3b4-11e6-8147-74c63bed1137] + x-ms-client-request-id: [a8541e40-f468-11e6-b499-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/virtualMachines/vrfvm?$expand=instanceView&api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/virtualMachines/vrfvm?api-version=2016-04-30-preview&$expand=instanceView response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"8a4387c6-390a-4b50-a5e7-0769ea882880\"\ - ,\r\n \"availabilitySet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/availabilitySets/VRFAVAILSET\"\ + body: {string: !!python/unicode "{\r\n \"properties\": {\r\n \"vmId\": \"\ + 08d1a6e0-d1a3-4c63-a1f9-fba60bc506c7\",\r\n \"availabilitySet\": {\r\n\ + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/availabilitySets/VRFAVAILSET\"\ \r\n },\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS2\"\ \r\n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n\ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ @@ -1061,33 +1064,33 @@ interactions: ,\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"\ Ready\",\r\n \"message\": \"GuestAgent is running and accepting\ - \ new configurations.\",\r\n \"time\": \"2017-02-15T19:28:18+00:00\"\ + \ new configurations.\",\r\n \"time\": \"2017-02-16T16:54:45+00:00\"\ \r\n }\r\n ],\r\n \"extensionHandlers\": []\r\n \ \ },\r\n \"disks\": [\r\n {\r\n \"name\": \"vrfosdisk\"\ ,\r\n \"statuses\": [\r\n {\r\n \"code\"\ : \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\ \n \"displayStatus\": \"Provisioning succeeded\",\r\n \ - \ \"time\": \"2017-02-15T19:26:30.878817+00:00\"\r\n }\r\n\ - \ ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ - \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"\ - level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ - ,\r\n \"time\": \"2017-02-15T19:27:55.1028333+00:00\"\r\n \ + \ \"time\": \"2017-02-16T16:53:07.8510258+00:00\"\r\n }\r\ + \n ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ + \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ + \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ + ,\r\n \"time\": \"2017-02-16T16:54:44.9458422+00:00\"\r\n \ \ },\r\n {\r\n \"code\": \"PowerState/running\",\r\n \ \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\ \n }\r\n ]\r\n }\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines\"\ ,\r\n \"location\": \"westus\",\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/virtualMachines/vrfvm\"\ ,\r\n \"name\": \"vrfvm\"\r\n}"} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:28:29 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['3779'] + cache-control: [no-cache] + content-length: ['3780'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:55:01 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1096,20 +1099,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ef71c1fe-f3b4-11e6-bafb-74c63bed1137] + x-ms-client-request-id: [a883e0cf-f468-11e6-9004-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic?api-version=2016-09-01 response: - body: {string: "{\r\n \"name\": \"vrfvmVMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic\"\ - ,\r\n \"etag\": \"W/\\\"16f95226-16a2-42aa-b34a-01990349f657\\\"\",\r\n \ + body: {string: !!python/unicode "{\r\n \"name\": \"vrfvmVMNic\",\r\n \"id\"\ + : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic\"\ + ,\r\n \"etag\": \"W/\\\"20d06768-087b-425f-af2c-1133b00ee25b\\\"\",\r\n \ \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\ - \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"7a6298bb-65e9-4f36-9290-339623adcf7f\"\ + \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"0c1cb463-1fef-42ca-8b70-88bd0c86919d\"\ ,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvrfvm\"\ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic/ipConfigurations/ipconfigvrfvm\"\ - ,\r\n \"etag\": \"W/\\\"16f95226-16a2-42aa-b34a-01990349f657\\\"\"\ + ,\r\n \"etag\": \"W/\\\"20d06768-087b-425f-af2c-1133b00ee25b\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\ : \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\ @@ -1118,8 +1122,8 @@ interactions: \r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\ : \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\ \ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\ - internalDomainNameSuffix\": \"www4d4vnoxdexo5ktdnqphvnka.dx.internal.cloudapp.net\"\ - \r\n },\r\n \"macAddress\": \"00-0D-3A-33-1C-83\",\r\n \"enableAcceleratedNetworking\"\ + internalDomainNameSuffix\": \"s3auspineojejcyt1mgbspm2va.dx.internal.cloudapp.net\"\ + \r\n },\r\n \"macAddress\": \"00-0D-3A-30-21-D7\",\r\n \"enableAcceleratedNetworking\"\ : false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\ : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg\"\ \r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \ @@ -1127,17 +1131,17 @@ interactions: \r\n }\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\ \n}"} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:28:30 GMT'] - ETag: [W/"16f95226-16a2-42aa-b34a-01990349f657"] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['2276'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:55:01 GMT'] + etag: [W/"20d06768-087b-425f-af2c-1133b00ee25b"] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1146,34 +1150,35 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [efdda8e6-f3b4-11e6-a642-74c63bed1137] + x-ms-client-request-id: [a89e94c0-f468-11e6-a400-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/publicIPAddresses/vrfpubip?api-version=2016-09-01 response: - body: {string: "{\r\n \"name\": \"vrfpubip\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/publicIPAddresses/vrfpubip\"\ - ,\r\n \"etag\": \"W/\\\"18b3cdec-b146-44ba-93b4-8759bcc0e111\\\"\",\r\n \ + body: {string: !!python/unicode "{\r\n \"name\": \"vrfpubip\",\r\n \"id\": \"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/publicIPAddresses/vrfpubip\"\ + ,\r\n \"etag\": \"W/\\\"a4593167-8ca8-49e1-9da7-68a771d022ba\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n \"location\": \"\ westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"resourceGuid\": \"a159cbff-55f2-4f5b-b7d4-ef35b99f0bcf\"\ - ,\r\n \"ipAddress\": \"13.64.114.90\",\r\n \"publicIPAddressVersion\"\ + : \"Succeeded\",\r\n \"resourceGuid\": \"715192d1-34d1-4ce9-a552-2bb68f73c953\"\ + ,\r\n \"ipAddress\": \"40.86.188.41\",\r\n \"publicIPAddressVersion\"\ : \"IPv4\",\r\n \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\"\ : 4,\r\n \"ipConfiguration\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic/ipConfigurations/ipconfigvrfvm\"\ \r\n }\r\n }\r\n}"} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:28:31 GMT'] - ETag: [W/"18b3cdec-b146-44ba-93b4-8759bcc0e111"] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['860'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:55:02 GMT'] + etag: [W/"a4593167-8ca8-49e1-9da7-68a771d022ba"] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1182,31 +1187,31 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f0963a86-f3b4-11e6-8d10-74c63bed1137] + x-ms-client-request-id: [a9146100-f468-11e6-a043-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/availabilitySets/vrfavailset?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"platformUpdateDomainCount\"\ + body: {string: !!python/unicode "{\r\n \"properties\": {\r\n \"platformUpdateDomainCount\"\ : 3,\r\n \"platformFaultDomainCount\": 3,\r\n \"virtualMachines\": [\r\ - \n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CLI_TEST_VM_CREATE_EXISTING_IDS_4Q3U_/providers/Microsoft.Compute/virtualMachines/VRFVM\"\ + \n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CLI_TEST_VM_CREATE_EXISTING_IDS_LLMO_/providers/Microsoft.Compute/virtualMachines/VRFVM\"\ \r\n }\r\n ]\r\n },\r\n \"type\": \"Microsoft.Compute/availabilitySets\"\ ,\r\n \"location\": \"westus\",\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/availabilitySets/vrfavailset\"\ ,\r\n \"name\": \"vrfavailset\",\r\n \"sku\": {\r\n \"name\": \"Classic\"\ \r\n }\r\n}"} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:28:32 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['654'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:55:02 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1215,21 +1220,22 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f152bf46-f3b4-11e6-bd8a-74c63bed1137] + x-ms-client-request-id: [a981a1c0-f468-11e6-844b-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg?api-version=2016-09-01 response: - body: {string: "{\r\n \"name\": \"vrfnsg\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg\"\ - ,\r\n \"etag\": \"W/\\\"1c9168f4-0eb9-42d8-a5c1-451526545513\\\"\",\r\n \ + body: {string: !!python/unicode "{\r\n \"name\": \"vrfnsg\",\r\n \"id\": \"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg\"\ + ,\r\n \"etag\": \"W/\\\"177e6907-c8fa-4fc1-929f-6389aa639268\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\ : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"resourceGuid\": \"36625ae3-04a7-454a-a715-6bf27e5a5ed1\"\ + : \"Succeeded\",\r\n \"resourceGuid\": \"3b2ea4e7-1836-4672-a772-776d385105fb\"\ ,\r\n \"securityRules\": [],\r\n \"defaultSecurityRules\": [\r\n \ \ {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowVnetInBound\"\ - ,\r\n \"etag\": \"W/\\\"1c9168f4-0eb9-42d8-a5c1-451526545513\\\"\"\ + ,\r\n \"etag\": \"W/\\\"177e6907-c8fa-4fc1-929f-6389aa639268\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -1239,7 +1245,7 @@ interactions: \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\ \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ - ,\r\n \"etag\": \"W/\\\"1c9168f4-0eb9-42d8-a5c1-451526545513\\\"\"\ + ,\r\n \"etag\": \"W/\\\"177e6907-c8fa-4fc1-929f-6389aa639268\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -1248,7 +1254,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/DenyAllInBound\"\ - ,\r\n \"etag\": \"W/\\\"1c9168f4-0eb9-42d8-a5c1-451526545513\\\"\"\ + ,\r\n \"etag\": \"W/\\\"177e6907-c8fa-4fc1-929f-6389aa639268\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -1257,7 +1263,7 @@ interactions: access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowVnetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"1c9168f4-0eb9-42d8-a5c1-451526545513\\\"\"\ + ,\r\n \"etag\": \"W/\\\"177e6907-c8fa-4fc1-929f-6389aa639268\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\ \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ @@ -1266,7 +1272,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowInternetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"1c9168f4-0eb9-42d8-a5c1-451526545513\\\"\"\ + ,\r\n \"etag\": \"W/\\\"177e6907-c8fa-4fc1-929f-6389aa639268\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -1275,7 +1281,7 @@ interactions: \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \ \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/DenyAllOutBound\"\ - ,\r\n \"etag\": \"W/\\\"1c9168f4-0eb9-42d8-a5c1-451526545513\\\"\"\ + ,\r\n \"etag\": \"W/\\\"177e6907-c8fa-4fc1-929f-6389aa639268\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -1286,17 +1292,17 @@ interactions: : [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic\"\ \r\n }\r\n ]\r\n }\r\n}"} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:28:33 GMT'] - ETag: [W/"1c9168f4-0eb9-42d8-a5c1-451526545513"] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['5484'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:55:03 GMT'] + etag: [W/"177e6907-c8fa-4fc1-929f-6389aa639268"] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1305,20 +1311,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f20f0980-f3b4-11e6-8fb6-74c63bed1137] + x-ms-client-request-id: [a9ea4e9e-f468-11e6-a54b-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic?api-version=2016-09-01 response: - body: {string: "{\r\n \"name\": \"vrfvmVMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic\"\ - ,\r\n \"etag\": \"W/\\\"16f95226-16a2-42aa-b34a-01990349f657\\\"\",\r\n \ + body: {string: !!python/unicode "{\r\n \"name\": \"vrfvmVMNic\",\r\n \"id\"\ + : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic\"\ + ,\r\n \"etag\": \"W/\\\"20d06768-087b-425f-af2c-1133b00ee25b\\\"\",\r\n \ \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\ - \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"7a6298bb-65e9-4f36-9290-339623adcf7f\"\ + \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"0c1cb463-1fef-42ca-8b70-88bd0c86919d\"\ ,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvrfvm\"\ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic/ipConfigurations/ipconfigvrfvm\"\ - ,\r\n \"etag\": \"W/\\\"16f95226-16a2-42aa-b34a-01990349f657\\\"\"\ + ,\r\n \"etag\": \"W/\\\"20d06768-087b-425f-af2c-1133b00ee25b\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\ : \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\ @@ -1327,8 +1334,8 @@ interactions: \r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\ : \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\ \ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\ - internalDomainNameSuffix\": \"www4d4vnoxdexo5ktdnqphvnka.dx.internal.cloudapp.net\"\ - \r\n },\r\n \"macAddress\": \"00-0D-3A-33-1C-83\",\r\n \"enableAcceleratedNetworking\"\ + internalDomainNameSuffix\": \"s3auspineojejcyt1mgbspm2va.dx.internal.cloudapp.net\"\ + \r\n },\r\n \"macAddress\": \"00-0D-3A-30-21-D7\",\r\n \"enableAcceleratedNetworking\"\ : false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\ : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Network/networkSecurityGroups/vrfnsg\"\ \r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \ @@ -1336,17 +1343,17 @@ interactions: \r\n }\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\ \n}"} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:28:33 GMT'] - ETag: [W/"16f95226-16a2-42aa-b34a-01990349f657"] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['2276'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:55:04 GMT'] + etag: [W/"20d06768-087b-425f-af2c-1133b00ee25b"] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1355,15 +1362,16 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/2.7.11 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f2829376-f3b4-11e6-bf7e-74c63bed1137] + x-ms-client-request-id: [aa4f5200-f468-11e6-a526-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/virtualMachines/vrfvm?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"8a4387c6-390a-4b50-a5e7-0769ea882880\"\ - ,\r\n \"availabilitySet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/availabilitySets/VRFAVAILSET\"\ + body: {string: !!python/unicode "{\r\n \"properties\": {\r\n \"vmId\": \"\ + 08d1a6e0-d1a3-4c63-a1f9-fba60bc506c7\",\r\n \"availabilitySet\": {\r\n\ + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/availabilitySets/VRFAVAILSET\"\ \r\n },\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS2\"\ \r\n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n\ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ @@ -1386,15 +1394,15 @@ interactions: tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing_ids/providers/Microsoft.Compute/virtualMachines/vrfvm\"\ ,\r\n \"name\": \"vrfvm\"\r\n}"} headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Wed, 15 Feb 2017 19:28:34 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] + cache-control: [no-cache] content-length: ['2530'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Feb 2017 16:55:04 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] status: {code: 200, message: OK} version: 1 diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/recordings/test_vm_create_existing_options.yaml b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/recordings/test_vm_create_existing_options.yaml index e3c7db2ca..40b2bd5ad 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/recordings/test_vm_create_existing_options.yaml +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/tests/recordings/test_vm_create_existing_options.yaml @@ -6,14 +6,14 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 subscriptionclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f0e234a1-f3b7-11e6-923b-74c63bed1137] + x-ms-client-request-id: [53efc9da-f468-11e6-bffc-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/locations?api-version=2016-06-01 response: - body: {string: !!python/unicode '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastasia","name":"eastasia","displayName":"East + body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastasia","name":"eastasia","displayName":"East Asia","longitude":"114.188","latitude":"22.267"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southeastasia","name":"southeastasia","displayName":"Southeast Asia","longitude":"103.833","latitude":"1.283"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/centralus","name":"centralus","displayName":"Central US","longitude":"-93.6208","latitude":"41.5908"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus","name":"eastus","displayName":"East @@ -41,25 +41,25 @@ interactions: Central","longitude":"126.9780","latitude":"37.5665"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/koreasouth","name":"koreasouth","displayName":"Korea South","longitude":"129.0756","latitude":"35.1796"}]}'} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:52:39 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Vary: [Accept-Encoding] content-length: ['4523'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:50:00 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null headers: Connection: [close] Host: [raw.githubusercontent.com] - User-Agent: [Python-urllib/2.7] + User-Agent: [Python-urllib/3.5] method: GET uri: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json response: - body: {string: !!python/unicode "{\n \"$schema\":\"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json\"\ + body: {string: "{\n \"$schema\":\"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json\"\ ,\n \"contentVersion\":\"1.0.0.0\",\n \"parameters\":{},\n \"variables\"\ :{},\n \"resources\":[],\n\n \"outputs\":{\n \"aliases\":{\n \"\ metadata\":{\n \"description\":\"This list of aliases is used by Azure\ @@ -96,30 +96,30 @@ interactions: \ \"version\":\"latest\"\n }\n }\n }\n }\n }\n\ }\n"} headers: - accept-ranges: [bytes] - access-control-allow-origin: ['*'] - cache-control: [max-age=300] - connection: [close] - content-length: ['2297'] - content-security-policy: [default-src 'none'; style-src 'unsafe-inline'] - content-type: [text/plain; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:50:02 GMT'] - etag: ['"db78eb36618a060181b32ac2de91b1733f382e01"'] - expires: ['Wed, 15 Feb 2017 19:55:02 GMT'] - source-age: ['0'] - strict-transport-security: [max-age=31536000] - vary: ['Authorization,Accept-Encoding'] - via: [1.1 varnish] - x-cache: [MISS] - x-cache-hits: ['0'] - x-content-type-options: [nosniff] - x-fastly-request-id: [367341e62ef5d99cf7239cfa307982b1a3476c50] - x-frame-options: [deny] - x-geo-block-list: [''] - x-github-request-id: ['EB98:7AF6:3C61544:3E446C1:58A4B0EA'] - x-served-by: [cache-sea1044-SEA] - x-timer: ['S1487188202.519194,VS0,VE113'] - x-xss-protection: [1; mode=block] + Accept-Ranges: [bytes] + Access-Control-Allow-Origin: ['*'] + Cache-Control: [max-age=300] + Connection: [close] + Content-Length: ['2297'] + Content-Security-Policy: [default-src 'none'; style-src 'unsafe-inline'] + Content-Type: [text/plain; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:52:40 GMT'] + ETag: ['"db78eb36618a060181b32ac2de91b1733f382e01"'] + Expires: ['Thu, 16 Feb 2017 16:57:40 GMT'] + Source-Age: ['0'] + Strict-Transport-Security: [max-age=31536000] + Vary: ['Authorization,Accept-Encoding'] + Via: [1.1 varnish] + X-Cache: [MISS] + X-Cache-Hits: ['0'] + X-Content-Type-Options: [nosniff] + X-Fastly-Request-ID: [abb14655cf22004187d0eca83526cbb287d19ee4] + X-Frame-Options: [deny] + X-Geo-Block-List: [''] + X-GitHub-Request-Id: ['3798:623E:3EEAA59:40E9734:58A5D8D8'] + X-Served-By: [cache-den6025-DEN] + X-Timer: ['S1487263960.759216,VS0,VE61'] + X-XSS-Protection: [1; mode=block] status: {code: 200, message: OK} - request: body: null @@ -128,15 +128,15 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f1e99280-f3b7-11e6-8f1e-74c63bed1137] + x-ms-client-request-id: [5445b970-f468-11e6-abfc-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage?api-version=2016-09-01 response: - body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage","namespace":"Microsoft.Storage","authorization":{"applicationId":"a6aa9161-5291-40bb-8c5c-923b567bee3b","roleDefinitionId":"070ab87f-0efc-4423-b18b-756f3bdb0236"},"resourceTypes":[{"resourceType":"storageAccounts","locations":["East + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage","namespace":"Microsoft.Storage","authorization":{"applicationId":"a6aa9161-5291-40bb-8c5c-923b567bee3b","roleDefinitionId":"070ab87f-0efc-4423-b18b-756f3bdb0236"},"resourceTypes":[{"resourceType":"storageAccounts","locations":["East US","East US 2","East US 2 (Stage)","West US","West Europe","East Asia","Southeast Asia","Japan East","Japan West","North Central US","South Central US","Central US","North Europe","Brazil South","Australia East","Australia Southeast","South @@ -154,14 +154,14 @@ interactions: India","Central India","West India","Canada East","Canada Central","West US 2","West Central US","UK South","UK West"],"apiVersions":["2014-04-01"]}],"registrationState":"Registered"}'} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:52:40 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Vary: [Accept-Encoding] content-length: ['2634'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:50:02 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -170,28 +170,28 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f22fc340-f3b7-11e6-a7b7-74c63bed1137] + x-ms-client-request-id: [546a678a-f468-11e6-82e1-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Storage/storageAccounts/dummystorage.api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: - body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Storage/storageAccounts/vcrstorage0012345","kind":"Storage","location":"westus","name":"vcrstorage0012345","properties":{"creationTime":"2017-02-15T19:48:32.4559926Z","primaryEndpoints":{"blob":"https://vcrstorage0012345.blob.core.windows.net/","file":"https://vcrstorage0012345.file.core.windows.net/","queue":"https://vcrstorage0012345.queue.core.windows.net/","table":"https://vcrstorage0012345.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Storage/storageAccounts/vcrstorage0012345","kind":"Storage","location":"westus","name":"vcrstorage0012345","properties":{"creationTime":"2017-02-16T16:51:13.4284373Z","primaryEndpoints":{"blob":"https://vcrstorage0012345.blob.core.windows.net/","file":"https://vcrstorage0012345.file.core.windows.net/","queue":"https://vcrstorage0012345.queue.core.windows.net/","table":"https://vcrstorage0012345.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json] + Date: ['Thu, 16 Feb 2017 16:52:40 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] content-length: ['744'] - content-type: [application/json] - date: ['Wed, 15 Feb 2017 19:50:03 GMT'] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -200,15 +200,15 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f2b43580-f3b7-11e6-b95f-74c63bed1137] + x-ms-client-request-id: [54bd7eb8-f468-11e6-b209-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute?api-version=2016-09-01 response: - body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute","namespace":"Microsoft.Compute","authorization":{"applicationId":"60e6cd67-9c8c-4951-9b3c-23c25a2169af","roleDefinitionId":"e4770acb-272e-4dc8-87f3-12f44a612224"},"resourceTypes":[{"resourceType":"availabilitySets","locations":["East + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute","namespace":"Microsoft.Compute","authorization":{"applicationId":"60e6cd67-9c8c-4951-9b3c-23c25a2169af","roleDefinitionId":"e4770acb-272e-4dc8-87f3-12f44a612224"},"resourceTypes":[{"resourceType":"availabilitySets","locations":["East US","East US 2","West US","Central US","North Central US","South Central US","North Europe","West Europe","East Asia","Southeast Asia","Japan East","Japan West","Australia East","Australia Southeast","Brazil South","South India","Central India","West @@ -330,14 +330,14 @@ interactions: India","Canada Central","Canada East","West US 2","West Central US","UK South","UK West","Korea Central","Korea South"],"apiVersions":["2014-04-01"]}],"registrationState":"Registered"}'} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:52:41 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Vary: [Accept-Encoding] content-length: ['12754'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:50:04 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -346,31 +346,31 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f30d03de-f3b7-11e6-8ddd-74c63bed1137] + x-ms-client-request-id: [54f36a86-f468-11e6-8fe0-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Compute/availabilitySets/vrfavailset?api-version=2017-03-30 response: - body: {string: !!python/unicode "{\r\n \"properties\": {\r\n \"platformUpdateDomainCount\"\ + body: {string: "{\r\n \"properties\": {\r\n \"platformUpdateDomainCount\"\ : 3,\r\n \"platformFaultDomainCount\": 3,\r\n \"virtualMachines\": []\r\ \n },\r\n \"type\": \"Microsoft.Compute/availabilitySets\",\r\n \"location\"\ : \"westus\",\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/availabilitySets/vrfavailset\"\ ,\r\n \"name\": \"vrfavailset\",\r\n \"sku\": {\r\n \"name\": \"Classic\"\ \r\n }\r\n}"} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:52:41 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] content-length: ['454'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:50:04 GMT'] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -379,15 +379,15 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f38cbb30-f3b7-11e6-8676-74c63bed1137] + x-ms-client-request-id: [554a45be-f468-11e6-b90b-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network?api-version=2016-09-01 response: - body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network","namespace":"Microsoft.Network","authorization":{"applicationId":"2cf9eb86-36b5-49dc-86ae-9a63135dfa8c","roleDefinitionId":"13ba9ab4-19f0-4804-adc4-14ece36cc7a1"},"resourceTypes":[{"resourceType":"virtualNetworks","locations":["West + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network","namespace":"Microsoft.Network","authorization":{"applicationId":"2cf9eb86-36b5-49dc-86ae-9a63135dfa8c","roleDefinitionId":"13ba9ab4-19f0-4804-adc4-14ece36cc7a1"},"resourceTypes":[{"resourceType":"virtualNetworks","locations":["West US","East US","North Europe","West Europe","East Asia","Southeast Asia","North Central US","South Central US","Central US","East US 2","Japan East","Japan West","Brazil South","Australia East","Australia Southeast","Central India","South @@ -465,14 +465,14 @@ interactions: India","Canada Central","Canada East","West Central US","West US 2","UK West","UK South","Korea Central","Korea South"],"apiVersions":["2016-12-01","2016-11-01","2016-10-01","2016-09-01","2016-08-01","2016-07-01","2016-06-01","2016-03-30","2015-06-15","2015-05-01-preview","2014-12-01-preview"],"capabilities":"None"},{"resourceType":"expressRouteServiceProviders","locations":[],"apiVersions":["2016-12-01","2016-11-01","2016-10-01","2016-09-01","2016-08-01","2016-07-01","2016-06-01","2016-03-30","2015-06-15","2015-05-01-preview","2014-12-01-preview"]}],"registrationState":"Registered"}'} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:52:42 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Vary: [Accept-Encoding] content-length: ['11292'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:50:05 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -481,31 +481,30 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f3d9548f-f3b7-11e6-9a2b-74c63bed1137] + x-ms-client-request-id: [5579cfa2-f468-11e6-bb45-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Network/virtualNetworks/vrfvnet/subnets/vrfsubnet?api-version=2016-12-01 response: - body: {string: !!python/unicode "{\r\n \"name\": \"vrfsubnet\",\r\n \"id\":\ - \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/virtualNetworks/vrfvnet/subnets/vrfsubnet\"\ - ,\r\n \"etag\": \"W/\\\"626685a3-0ed1-4df1-bff4-62ccc00fc94c\\\"\",\r\n \ + body: {string: "{\r\n \"name\": \"vrfsubnet\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/virtualNetworks/vrfvnet/subnets/vrfsubnet\"\ + ,\r\n \"etag\": \"W/\\\"454e5909-1e00-41d2-8e2f-edf34f6f2d7e\\\"\",\r\n \ \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"\ addressPrefix\": \"10.0.0.0/24\"\r\n }\r\n}"} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:52:42 GMT'] + ETag: [W/"454e5909-1e00-41d2-8e2f-edf34f6f2d7e"] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] content-length: ['367'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:50:06 GMT'] - etag: [W/"626685a3-0ed1-4df1-bff4-62ccc00fc94c"] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -514,15 +513,15 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f45a6b70-f3b7-11e6-80a6-74c63bed1137] + x-ms-client-request-id: [55c87442-f468-11e6-ba35-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network?api-version=2016-09-01 response: - body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network","namespace":"Microsoft.Network","authorization":{"applicationId":"2cf9eb86-36b5-49dc-86ae-9a63135dfa8c","roleDefinitionId":"13ba9ab4-19f0-4804-adc4-14ece36cc7a1"},"resourceTypes":[{"resourceType":"virtualNetworks","locations":["West + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network","namespace":"Microsoft.Network","authorization":{"applicationId":"2cf9eb86-36b5-49dc-86ae-9a63135dfa8c","roleDefinitionId":"13ba9ab4-19f0-4804-adc4-14ece36cc7a1"},"resourceTypes":[{"resourceType":"virtualNetworks","locations":["West US","East US","North Europe","West Europe","East Asia","Southeast Asia","North Central US","South Central US","Central US","East US 2","Japan East","Japan West","Brazil South","Australia East","Australia Southeast","Central India","South @@ -600,14 +599,14 @@ interactions: India","Canada Central","Canada East","West Central US","West US 2","UK West","UK South","Korea Central","Korea South"],"apiVersions":["2016-12-01","2016-11-01","2016-10-01","2016-09-01","2016-08-01","2016-07-01","2016-06-01","2016-03-30","2015-06-15","2015-05-01-preview","2014-12-01-preview"],"capabilities":"None"},{"resourceType":"expressRouteServiceProviders","locations":[],"apiVersions":["2016-12-01","2016-11-01","2016-10-01","2016-09-01","2016-08-01","2016-07-01","2016-06-01","2016-03-30","2015-06-15","2015-05-01-preview","2014-12-01-preview"]}],"registrationState":"Registered"}'} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:52:43 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Vary: [Accept-Encoding] content-length: ['11292'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:50:06 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -616,23 +615,22 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f4a6688f-f3b7-11e6-983b-74c63bed1137] + x-ms-client-request-id: [55ff000a-f468-11e6-ab6f-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg?api-version=2016-12-01 response: - body: {string: !!python/unicode "{\r\n \"name\": \"vrfnsg\",\r\n \"id\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg\"\ - ,\r\n \"etag\": \"W/\\\"afbf2009-7e50-4668-8f1b-af9c230d186a\\\"\",\r\n \ + body: {string: "{\r\n \"name\": \"vrfnsg\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg\"\ + ,\r\n \"etag\": \"W/\\\"f38b5bc4-ac29-4fb9-8fb3-72f2e03bb614\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\ : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"resourceGuid\": \"7e232e51-ce15-42b1-8a77-210878e70f5b\"\ + : \"Succeeded\",\r\n \"resourceGuid\": \"427e0940-9990-41bb-afe5-f5b35e1041fc\"\ ,\r\n \"securityRules\": [],\r\n \"defaultSecurityRules\": [\r\n \ \ {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowVnetInBound\"\ - ,\r\n \"etag\": \"W/\\\"afbf2009-7e50-4668-8f1b-af9c230d186a\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f38b5bc4-ac29-4fb9-8fb3-72f2e03bb614\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -642,7 +640,7 @@ interactions: \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\ \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ - ,\r\n \"etag\": \"W/\\\"afbf2009-7e50-4668-8f1b-af9c230d186a\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f38b5bc4-ac29-4fb9-8fb3-72f2e03bb614\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -651,7 +649,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/DenyAllInBound\"\ - ,\r\n \"etag\": \"W/\\\"afbf2009-7e50-4668-8f1b-af9c230d186a\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f38b5bc4-ac29-4fb9-8fb3-72f2e03bb614\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -660,7 +658,7 @@ interactions: access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowVnetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"afbf2009-7e50-4668-8f1b-af9c230d186a\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f38b5bc4-ac29-4fb9-8fb3-72f2e03bb614\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\ \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ @@ -669,7 +667,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowInternetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"afbf2009-7e50-4668-8f1b-af9c230d186a\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f38b5bc4-ac29-4fb9-8fb3-72f2e03bb614\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -678,7 +676,7 @@ interactions: \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \ \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/DenyAllOutBound\"\ - ,\r\n \"etag\": \"W/\\\"afbf2009-7e50-4668-8f1b-af9c230d186a\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f38b5bc4-ac29-4fb9-8fb3-72f2e03bb614\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -687,17 +685,17 @@ interactions: access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ : \"Outbound\"\r\n }\r\n }\r\n ]\r\n }\r\n}"} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:52:43 GMT'] + ETag: [W/"f38b5bc4-ac29-4fb9-8fb3-72f2e03bb614"] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] content-length: ['5223'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:50:07 GMT'] - etag: [W/"afbf2009-7e50-4668-8f1b-af9c230d186a"] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -706,15 +704,15 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f51a871e-f3b7-11e6-9e96-74c63bed1137] + x-ms-client-request-id: [5654c9b8-f468-11e6-ba6e-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network?api-version=2016-09-01 response: - body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network","namespace":"Microsoft.Network","authorization":{"applicationId":"2cf9eb86-36b5-49dc-86ae-9a63135dfa8c","roleDefinitionId":"13ba9ab4-19f0-4804-adc4-14ece36cc7a1"},"resourceTypes":[{"resourceType":"virtualNetworks","locations":["West + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network","namespace":"Microsoft.Network","authorization":{"applicationId":"2cf9eb86-36b5-49dc-86ae-9a63135dfa8c","roleDefinitionId":"13ba9ab4-19f0-4804-adc4-14ece36cc7a1"},"resourceTypes":[{"resourceType":"virtualNetworks","locations":["West US","East US","North Europe","West Europe","East Asia","Southeast Asia","North Central US","South Central US","Central US","East US 2","Japan East","Japan West","Brazil South","Australia East","Australia Southeast","Central India","South @@ -792,14 +790,14 @@ interactions: India","Canada Central","Canada East","West Central US","West US 2","UK West","UK South","Korea Central","Korea South"],"apiVersions":["2016-12-01","2016-11-01","2016-10-01","2016-09-01","2016-08-01","2016-07-01","2016-06-01","2016-03-30","2015-06-15","2015-05-01-preview","2014-12-01-preview"],"capabilities":"None"},{"resourceType":"expressRouteServiceProviders","locations":[],"apiVersions":["2016-12-01","2016-11-01","2016-10-01","2016-09-01","2016-08-01","2016-07-01","2016-06-01","2016-03-30","2015-06-15","2015-05-01-preview","2014-12-01-preview"]}],"registrationState":"Registered"}'} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:52:44 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Vary: [Accept-Encoding] content-length: ['11292'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:50:08 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -808,82 +806,81 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f567478f-f3b7-11e6-8681-74c63bed1137] + x-ms-client-request-id: [566afb9a-f468-11e6-808f-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Network/publicIPAddresses/vrfpubip?api-version=2016-12-01 response: - body: {string: !!python/unicode "{\r\n \"name\": \"vrfpubip\",\r\n \"id\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/publicIPAddresses/vrfpubip\"\ - ,\r\n \"etag\": \"W/\\\"26becd61-ba62-4df0-9312-596d697d1f0e\\\"\",\r\n \ + body: {string: "{\r\n \"name\": \"vrfpubip\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/publicIPAddresses/vrfpubip\"\ + ,\r\n \"etag\": \"W/\\\"f7fc98e1-9919-4125-a652-76ef45ae98f9\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n \"location\": \"\ westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"resourceGuid\": \"3bc72a3e-65bf-4c47-88d5-0e378cf0e139\"\ + : \"Succeeded\",\r\n \"resourceGuid\": \"a57c167b-07b5-420b-8cf3-744d8cc86280\"\ ,\r\n \"publicIPAddressVersion\": \"IPv4\",\r\n \"publicIPAllocationMethod\"\ : \"Dynamic\",\r\n \"idleTimeoutInMinutes\": 4\r\n }\r\n}"} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:52:43 GMT'] + ETag: [W/"f7fc98e1-9919-4125-a652-76ef45ae98f9"] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] content-length: ['580'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:50:09 GMT'] - etag: [W/"26becd61-ba62-4df0-9312-596d697d1f0e"] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: - body: !!python/unicode '{"properties": {"mode": "Incremental", "parameters": {}, - "template": {"parameters": {}, "outputs": {}, "variables": {}, "contentVersion": - "1.0.0.0", "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", - "resources": [{"name": "vrfvmVMNic", "tags": {}, "apiVersion": "2015-06-15", - "location": "westus", "dependsOn": [], "type": "Microsoft.Network/networkInterfaces", - "properties": {"networkSecurityGroup": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg"}, - "ipConfigurations": [{"name": "ipconfigvrfvm", "properties": {"subnet": {"id": + body: '{"properties": {"parameters": {}, "template": {"parameters": {}, "contentVersion": + "1.0.0.0", "resources": [{"apiVersion": "2015-06-15", "type": "Microsoft.Network/networkInterfaces", + "tags": {}, "properties": {"ipConfigurations": [{"properties": {"subnet": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/virtualNetworks/vrfvnet/subnets/vrfsubnet"}, - "privateIPAllocationMethod": "Dynamic", "publicIPAddress": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/publicIPAddresses/vrfpubip"}}}]}}, - {"name": "vrfvm", "tags": {}, "apiVersion": "2016-04-30-preview", "location": - "westus", "dependsOn": ["Microsoft.Network/networkInterfaces/vrfvmVMNic"], "type": - "Microsoft.Compute/virtualMachines", "properties": {"hardwareProfile": {"vmSize": - "Standard_DS2"}, "storageProfile": {"imageReference": {"sku": "14.04.4-LTS", - "publisher": "Canonical", "version": "latest", "offer": "UbuntuServer"}, "osDisk": - {"caching": "ReadWrite", "vhd": {"uri": "https://vcrstorage0012345.blob.core.windows.net/vrfcontainer/vrfosdisk.vhd"}, - "createOption": "fromImage", "name": "vrfosdisk"}}, "osProfile": {"adminUsername": - "user11", "computerName": "vrfvm", "linuxConfiguration": {"ssh": {"publicKeys": - [{"path": "/home/user11/.ssh/authorized_keys", "keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCbIg1guRHbI0lV11wWDt1r2cUdcNd27CJsg+SfgC7miZeubtwUhbsPdhMQsfDyhOWHq1+ZL0M+nJZV63d/1dhmhtgyOqejUwrPlzKhydsbrsdUor+JmNJDdW01v7BXHyuymT8G4s09jCasNOwiufbP/qp72ruu0bIA1nySsvlf9pCQAuFkAnVnf/rFhUlOkhtRpwcq8SUNY2zRHR/EKb/4NWY1JzR4sa3q2fWIJdrrX0DvLoa5g9bIEd4Df79ba7v+yiUBOS0zT2ll+z4g9izHK3EO5d8hL4jYxcjKs+wcslSYRWrascfscLgMlMGh0CdKeNTDjHpGPncaf3Z+FwwwjWeuiNBxv7bJo13/8B/098KlVDl4GZqsoBCEjPyJfV6hO0y/LkRGkk7oHWKgeWAfKtfLItRp00eZ4fcJNK9kCaSMmEugoZWcI7NGbZXzqFWqbpRI7NcDP9+WIQ+i9U5vqWsqd/zng4kbuAJ6UuKqIzB0upYrLShfQE3SAck8oaLhJqqq56VfDuASNpJKidV+zq27HfSBmbXnkR/5AK337dc3MXKJypoK/QPMLKUAP5XLPbs+NddJQV7EZXd29DLgp+fRIg3edpKdO7ZErWhv7d+3Kws+e1Y+ypmR2WIVSwVyBEUfgv2C8Ts9gnTF4pNcEY/S2aBicz5Ew2+jdyGNQQ== - [email protected]\n"}]}, "disablePasswordAuthentication": true}}, "availabilitySet": - {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/availabilitySets/vrfavailset"}, - "networkProfile": {"networkInterfaces": [{"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic"}]}}}]}}}' + "publicIPAddress": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/publicIPAddresses/vrfpubip"}, + "privateIPAllocationMethod": "Dynamic"}, "name": "ipconfigvrfvm"}], "networkSecurityGroup": + {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg"}}, + "location": "westus", "dependsOn": [], "name": "vrfvmVMNic"}, {"apiVersion": + "2016-04-30-preview", "type": "Microsoft.Compute/virtualMachines", "tags": {}, + "properties": {"availabilitySet": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/availabilitySets/vrfavailset"}, + "networkProfile": {"networkInterfaces": [{"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic"}]}, + "osProfile": {"adminUsername": "user11", "linuxConfiguration": {"ssh": {"publicKeys": + [{"keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCbIg1guRHbI0lV11wWDt1r2cUdcNd27CJsg+SfgC7miZeubtwUhbsPdhMQsfDyhOWHq1+ZL0M+nJZV63d/1dhmhtgyOqejUwrPlzKhydsbrsdUor+JmNJDdW01v7BXHyuymT8G4s09jCasNOwiufbP/qp72ruu0bIA1nySsvlf9pCQAuFkAnVnf/rFhUlOkhtRpwcq8SUNY2zRHR/EKb/4NWY1JzR4sa3q2fWIJdrrX0DvLoa5g9bIEd4Df79ba7v+yiUBOS0zT2ll+z4g9izHK3EO5d8hL4jYxcjKs+wcslSYRWrascfscLgMlMGh0CdKeNTDjHpGPncaf3Z+FwwwjWeuiNBxv7bJo13/8B/098KlVDl4GZqsoBCEjPyJfV6hO0y/LkRGkk7oHWKgeWAfKtfLItRp00eZ4fcJNK9kCaSMmEugoZWcI7NGbZXzqFWqbpRI7NcDP9+WIQ+i9U5vqWsqd/zng4kbuAJ6UuKqIzB0upYrLShfQE3SAck8oaLhJqqq56VfDuASNpJKidV+zq27HfSBmbXnkR/5AK337dc3MXKJypoK/QPMLKUAP5XLPbs+NddJQV7EZXd29DLgp+fRIg3edpKdO7ZErWhv7d+3Kws+e1Y+ypmR2WIVSwVyBEUfgv2C8Ts9gnTF4pNcEY/S2aBicz5Ew2+jdyGNQQ== + [email protected]\n", "path": "/home/user11/.ssh/authorized_keys"}]}, "disablePasswordAuthentication": + true}, "computerName": "vrfvm"}, "hardwareProfile": {"vmSize": "Standard_DS2"}, + "storageProfile": {"imageReference": {"sku": "14.04.4-LTS", "publisher": "Canonical", + "offer": "UbuntuServer", "version": "latest"}, "osDisk": {"vhd": {"uri": "https://vcrstorage0012345.blob.core.windows.net/vrfcontainer/vrfosdisk.vhd"}, + "createOption": "fromImage", "name": "vrfosdisk", "caching": "ReadWrite"}}}, + "location": "westus", "dependsOn": ["Microsoft.Network/networkInterfaces/vrfvmVMNic"], + "name": "vrfvm"}], "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "variables": {}, "outputs": {}}, "mode": "Incremental"}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Length: ['3037'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f5e43fc0-f3b7-11e6-b3b9-74c63bed1137] + x-ms-client-request-id: [56a12be8-f468-11e6-b0b8-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2016-09-01 response: - body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/vm_deploy_hgaS05nHHn3PAGy8Vwm9F0z01yVRSOhD","name":"vm_deploy_hgaS05nHHn3PAGy8Vwm9F0z01yVRSOhD","properties":{"templateHash":"15080092347381202554","parameters":{},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2017-02-15T19:50:12.1494696Z","duration":"PT1.3037482S","correlationId":"ef0bae2f-3d48-448b-90e5-173400505446","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vrfvmVMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/virtualMachines/vrfvm","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vrfvm"}]}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/vm_deploy_CmZOtEi20WY1vuITCYo7UkDytPsFNuaW","name":"vm_deploy_CmZOtEi20WY1vuITCYo7UkDytPsFNuaW","properties":{"templateHash":"14960466792898696534","parameters":{},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2017-02-16T16:52:46.0641727Z","duration":"PT0.4470228S","correlationId":"185ca475-b4ce-4753-94b0-bd9d9aebcf5c","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vrfvmVMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/virtualMachines/vrfvm","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vrfvm"}]}}'} headers: - azure-asyncoperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/vm_deploy_hgaS05nHHn3PAGy8Vwm9F0z01yVRSOhD/operationStatuses/08587144186746319284?api-version=2016-09-01'] - cache-control: [no-cache] - content-length: ['1240'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:50:12 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/vm_deploy_CmZOtEi20WY1vuITCYo7UkDytPsFNuaW/operationStatuses/08587143429198604933?api-version=2016-09-01'] + Cache-Control: [no-cache] + Content-Length: ['1240'] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:52:45 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 201, message: Created} - request: body: null @@ -892,50 +889,24 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f5e43fc0-f3b7-11e6-b3b9-74c63bed1137] + x-ms-client-request-id: [56a12be8-f468-11e6-b0b8-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587144186746319284?api-version=2016-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587143429198604933?api-version=2016-09-01 response: - body: {string: !!python/unicode '{"status":"Running"}'} + body: {string: '{"status":"Running"}'} headers: - cache-control: [no-cache] - content-length: ['20'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:50:42 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - vary: [Accept-Encoding] - status: {code: 200, message: OK} -- request: - body: null - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] + Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python - AZURECLI/TEST/0.1.1b3+dev] - accept-language: [en-US] - x-ms-client-request-id: [f5e43fc0-f3b7-11e6-b3b9-74c63bed1137] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587144186746319284?api-version=2016-09-01 - response: - body: {string: !!python/unicode '{"status":"Running"}'} - headers: - cache-control: [no-cache] + Date: ['Thu, 16 Feb 2017 16:53:16 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Vary: [Accept-Encoding] content-length: ['20'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:51:14 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -944,24 +915,24 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f5e43fc0-f3b7-11e6-b3b9-74c63bed1137] + x-ms-client-request-id: [56a12be8-f468-11e6-b0b8-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587144186746319284?api-version=2016-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587143429198604933?api-version=2016-09-01 response: - body: {string: !!python/unicode '{"status":"Running"}'} + body: {string: '{"status":"Running"}'} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:53:47 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Vary: [Accept-Encoding] content-length: ['20'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:51:44 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -970,24 +941,24 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f5e43fc0-f3b7-11e6-b3b9-74c63bed1137] + x-ms-client-request-id: [56a12be8-f468-11e6-b0b8-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587144186746319284?api-version=2016-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587143429198604933?api-version=2016-09-01 response: - body: {string: !!python/unicode '{"status":"Running"}'} + body: {string: '{"status":"Running"}'} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:54:17 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Vary: [Accept-Encoding] content-length: ['20'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:52:15 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -996,24 +967,24 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f5e43fc0-f3b7-11e6-b3b9-74c63bed1137] + x-ms-client-request-id: [56a12be8-f468-11e6-b0b8-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587144186746319284?api-version=2016-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587143429198604933?api-version=2016-09-01 response: - body: {string: !!python/unicode '{"status":"Running"}'} + body: {string: '{"status":"Running"}'} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:54:48 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Vary: [Accept-Encoding] content-length: ['20'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:52:46 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1022,24 +993,24 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f5e43fc0-f3b7-11e6-b3b9-74c63bed1137] + x-ms-client-request-id: [56a12be8-f468-11e6-b0b8-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587144186746319284?api-version=2016-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587143429198604933?api-version=2016-09-01 response: - body: {string: !!python/unicode '{"status":"Succeeded"}'} + body: {string: '{"status":"Succeeded"}'} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:55:17 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Vary: [Accept-Encoding] content-length: ['22'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:53:17 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1048,24 +1019,24 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [f5e43fc0-f3b7-11e6-b3b9-74c63bed1137] + x-ms-client-request-id: [56a12be8-f468-11e6-b0b8-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2016-09-01 response: - body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/vm_deploy_hgaS05nHHn3PAGy8Vwm9F0z01yVRSOhD","name":"vm_deploy_hgaS05nHHn3PAGy8Vwm9F0z01yVRSOhD","properties":{"templateHash":"15080092347381202554","parameters":{},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-02-15T19:53:05.0692526Z","duration":"PT2M54.2235312S","correlationId":"ef0bae2f-3d48-448b-90e5-173400505446","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vrfvmVMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/virtualMachines/vrfvm","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vrfvm"}],"outputs":{},"outputResources":[{"id":"Microsoft.Compute/virtualMachines/vrfvm"},{"id":"Microsoft.Network/networkInterfaces/vrfvmVMNic"}]}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Resources/deployments/vm_deploy_CmZOtEi20WY1vuITCYo7UkDytPsFNuaW","name":"vm_deploy_CmZOtEi20WY1vuITCYo7UkDytPsFNuaW","properties":{"templateHash":"14960466792898696534","parameters":{},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-02-16T16:55:11.5713607Z","duration":"PT2M25.9542108S","correlationId":"185ca475-b4ce-4753-94b0-bd9d9aebcf5c","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vrfvmVMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/virtualMachines/vrfvm","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vrfvm"}],"outputs":{},"outputResources":[{"id":"Microsoft.Compute/virtualMachines/vrfvm"},{"id":"Microsoft.Network/networkInterfaces/vrfvmVMNic"}]}}'} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:55:18 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Vary: [Accept-Encoding] content-length: ['1382'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:53:17 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1074,16 +1045,15 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [669128a1-f3b8-11e6-8861-74c63bed1137] + x-ms-client-request-id: [b310f038-f468-11e6-b141-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/virtualMachines/vrfvm?api-version=2016-04-30-preview&$expand=instanceView response: - body: {string: !!python/unicode "{\r\n \"properties\": {\r\n \"vmId\": \"\ - c51d350f-5326-4ad8-b735-408b21d9c483\",\r\n \"availabilitySet\": {\r\n\ - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/availabilitySets/VRFAVAILSET\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"c1a47492-07a9-4a33-a12e-95605fb35a59\"\ + ,\r\n \"availabilitySet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/availabilitySets/VRFAVAILSET\"\ \r\n },\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS2\"\ \r\n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n\ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ @@ -1107,33 +1077,33 @@ interactions: ,\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"\ Ready\",\r\n \"message\": \"GuestAgent is running and accepting\ - \ new configurations.\",\r\n \"time\": \"2017-02-15T19:53:11+00:00\"\ + \ new configurations.\",\r\n \"time\": \"2017-02-16T16:55:19+00:00\"\ \r\n }\r\n ],\r\n \"extensionHandlers\": []\r\n \ \ },\r\n \"disks\": [\r\n {\r\n \"name\": \"vrfosdisk\"\ ,\r\n \"statuses\": [\r\n {\r\n \"code\"\ : \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\ \n \"displayStatus\": \"Provisioning succeeded\",\r\n \ - \ \"time\": \"2017-02-15T19:50:21.9095478+00:00\"\r\n }\r\ + \ \"time\": \"2017-02-16T16:52:58.2261268+00:00\"\r\n }\r\ \n ]\r\n }\r\n ],\r\n \"statuses\": [\r\n \ \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ - ,\r\n \"time\": \"2017-02-15T19:52:49.3647616+00:00\"\r\n \ + ,\r\n \"time\": \"2017-02-16T16:54:57.5087324+00:00\"\r\n \ \ },\r\n {\r\n \"code\": \"PowerState/running\",\r\n \ \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\ \n }\r\n ]\r\n }\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines\"\ ,\r\n \"location\": \"westus\",\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/virtualMachines/vrfvm\"\ ,\r\n \"name\": \"vrfvm\"\r\n}"} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:55:19 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] content-length: ['3767'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:53:19 GMT'] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1142,21 +1112,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [67003e21-f3b8-11e6-bbcf-74c63bed1137] + x-ms-client-request-id: [b338220c-f468-11e6-a58e-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic?api-version=2016-09-01 response: - body: {string: !!python/unicode "{\r\n \"name\": \"vrfvmVMNic\",\r\n \"id\"\ - : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic\"\ - ,\r\n \"etag\": \"W/\\\"ec17761e-be6d-497f-97d0-34a709d77ad2\\\"\",\r\n \ + body: {string: "{\r\n \"name\": \"vrfvmVMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic\"\ + ,\r\n \"etag\": \"W/\\\"6edfbfc5-838b-4158-b5a4-24175060ffb7\\\"\",\r\n \ \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\ - \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"f64442bf-1299-4d3d-8f86-f82377d06ed8\"\ + \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"92a9fb2a-164d-4df9-a06f-e7a3fb02845f\"\ ,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvrfvm\"\ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic/ipConfigurations/ipconfigvrfvm\"\ - ,\r\n \"etag\": \"W/\\\"ec17761e-be6d-497f-97d0-34a709d77ad2\\\"\"\ + ,\r\n \"etag\": \"W/\\\"6edfbfc5-838b-4158-b5a4-24175060ffb7\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\ : \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\ @@ -1165,8 +1134,8 @@ interactions: \r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\ : \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\ \ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\ - internalDomainNameSuffix\": \"ig0zuqqgq3sutc1m0tjgtydjhf.dx.internal.cloudapp.net\"\ - \r\n },\r\n \"macAddress\": \"00-0D-3A-34-D2-24\",\r\n \"enableAcceleratedNetworking\"\ + internalDomainNameSuffix\": \"tvkzmx0hrk0unir54siohneg3a.dx.internal.cloudapp.net\"\ + \r\n },\r\n \"macAddress\": \"00-0D-3A-33-A0-84\",\r\n \"enableAcceleratedNetworking\"\ : false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\ : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg\"\ \r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \ @@ -1174,17 +1143,17 @@ interactions: \r\n }\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\ \n}"} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:55:19 GMT'] + ETag: [W/"6edfbfc5-838b-4158-b5a4-24175060ffb7"] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] content-length: ['2252'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:53:18 GMT'] - etag: [W/"ec17761e-be6d-497f-97d0-34a709d77ad2"] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1193,35 +1162,34 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [675255c0-f3b8-11e6-84db-74c63bed1137] + x-ms-client-request-id: [b34d31b8-f468-11e6-862a-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/publicIPAddresses/vrfpubip?api-version=2016-09-01 response: - body: {string: !!python/unicode "{\r\n \"name\": \"vrfpubip\",\r\n \"id\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/publicIPAddresses/vrfpubip\"\ - ,\r\n \"etag\": \"W/\\\"d8f8b0cc-725b-49eb-ba21-cbc90df93cb6\\\"\",\r\n \ + body: {string: "{\r\n \"name\": \"vrfpubip\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/publicIPAddresses/vrfpubip\"\ + ,\r\n \"etag\": \"W/\\\"ddad006b-1234-467e-8704-c84f2b4895c2\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n \"location\": \"\ westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"resourceGuid\": \"3bc72a3e-65bf-4c47-88d5-0e378cf0e139\"\ - ,\r\n \"ipAddress\": \"13.91.53.97\",\r\n \"publicIPAddressVersion\"\ + : \"Succeeded\",\r\n \"resourceGuid\": \"a57c167b-07b5-420b-8cf3-744d8cc86280\"\ + ,\r\n \"ipAddress\": \"40.86.189.161\",\r\n \"publicIPAddressVersion\"\ : \"IPv4\",\r\n \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\"\ : 4,\r\n \"ipConfiguration\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic/ipConfigurations/ipconfigvrfvm\"\ \r\n }\r\n }\r\n}"} headers: - cache-control: [no-cache] - content-length: ['851'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:53:19 GMT'] - etag: [W/"d8f8b0cc-725b-49eb-ba21-cbc90df93cb6"] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:55:20 GMT'] + ETag: [W/"ddad006b-1234-467e-8704-c84f2b4895c2"] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['853'] status: {code: 200, message: OK} - request: body: null @@ -1230,31 +1198,31 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [6806ffc0-f3b8-11e6-814a-74c63bed1137] + x-ms-client-request-id: [b3b41f52-f468-11e6-885b-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/availabilitySets/vrfavailset?api-version=2016-04-30-preview response: - body: {string: !!python/unicode "{\r\n \"properties\": {\r\n \"platformUpdateDomainCount\"\ + body: {string: "{\r\n \"properties\": {\r\n \"platformUpdateDomainCount\"\ : 3,\r\n \"platformFaultDomainCount\": 3,\r\n \"virtualMachines\": [\r\ - \n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CLI_TEST_VM_CREATE_EXISTING_YNF4_/providers/Microsoft.Compute/virtualMachines/VRFVM\"\ + \n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CLI_TEST_VM_CREATE_EXISTING_21DA_/providers/Microsoft.Compute/virtualMachines/VRFVM\"\ \r\n }\r\n ]\r\n },\r\n \"type\": \"Microsoft.Compute/availabilitySets\"\ ,\r\n \"location\": \"westus\",\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/availabilitySets/vrfavailset\"\ ,\r\n \"name\": \"vrfavailset\",\r\n \"sku\": {\r\n \"name\": \"Classic\"\ \r\n }\r\n}"} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:55:20 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] content-length: ['646'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:53:21 GMT'] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1263,22 +1231,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [68b58f40-f3b8-11e6-9183-74c63bed1137] + x-ms-client-request-id: [b42592cc-f468-11e6-aa8a-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg?api-version=2016-09-01 response: - body: {string: !!python/unicode "{\r\n \"name\": \"vrfnsg\",\r\n \"id\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg\"\ - ,\r\n \"etag\": \"W/\\\"0fb0618f-8df9-4be5-9aa8-dfd1956e082f\\\"\",\r\n \ + body: {string: "{\r\n \"name\": \"vrfnsg\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg\"\ + ,\r\n \"etag\": \"W/\\\"3b480eec-f336-42c7-9ed3-d323c1ff0efd\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\ : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"resourceGuid\": \"7e232e51-ce15-42b1-8a77-210878e70f5b\"\ + : \"Succeeded\",\r\n \"resourceGuid\": \"427e0940-9990-41bb-afe5-f5b35e1041fc\"\ ,\r\n \"securityRules\": [],\r\n \"defaultSecurityRules\": [\r\n \ \ {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowVnetInBound\"\ - ,\r\n \"etag\": \"W/\\\"0fb0618f-8df9-4be5-9aa8-dfd1956e082f\\\"\"\ + ,\r\n \"etag\": \"W/\\\"3b480eec-f336-42c7-9ed3-d323c1ff0efd\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -1288,7 +1255,7 @@ interactions: \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\ \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ - ,\r\n \"etag\": \"W/\\\"0fb0618f-8df9-4be5-9aa8-dfd1956e082f\\\"\"\ + ,\r\n \"etag\": \"W/\\\"3b480eec-f336-42c7-9ed3-d323c1ff0efd\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -1297,7 +1264,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/DenyAllInBound\"\ - ,\r\n \"etag\": \"W/\\\"0fb0618f-8df9-4be5-9aa8-dfd1956e082f\\\"\"\ + ,\r\n \"etag\": \"W/\\\"3b480eec-f336-42c7-9ed3-d323c1ff0efd\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -1306,7 +1273,7 @@ interactions: access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowVnetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"0fb0618f-8df9-4be5-9aa8-dfd1956e082f\\\"\"\ + ,\r\n \"etag\": \"W/\\\"3b480eec-f336-42c7-9ed3-d323c1ff0efd\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\ \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ @@ -1315,7 +1282,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/AllowInternetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"0fb0618f-8df9-4be5-9aa8-dfd1956e082f\\\"\"\ + ,\r\n \"etag\": \"W/\\\"3b480eec-f336-42c7-9ed3-d323c1ff0efd\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -1324,7 +1291,7 @@ interactions: \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \ \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg/defaultSecurityRules/DenyAllOutBound\"\ - ,\r\n \"etag\": \"W/\\\"0fb0618f-8df9-4be5-9aa8-dfd1956e082f\\\"\"\ + ,\r\n \"etag\": \"W/\\\"3b480eec-f336-42c7-9ed3-d323c1ff0efd\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -1335,17 +1302,17 @@ interactions: : [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic\"\ \r\n }\r\n ]\r\n }\r\n}"} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:55:20 GMT'] + ETag: [W/"3b480eec-f336-42c7-9ed3-d323c1ff0efd"] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] content-length: ['5452'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:53:22 GMT'] - etag: [W/"0fb0618f-8df9-4be5-9aa8-dfd1956e082f"] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1354,21 +1321,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [69a657e1-f3b8-11e6-9e7f-74c63bed1137] + x-ms-client-request-id: [b4984fd0-f468-11e6-8aec-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic?api-version=2016-09-01 response: - body: {string: !!python/unicode "{\r\n \"name\": \"vrfvmVMNic\",\r\n \"id\"\ - : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic\"\ - ,\r\n \"etag\": \"W/\\\"ec17761e-be6d-497f-97d0-34a709d77ad2\\\"\",\r\n \ + body: {string: "{\r\n \"name\": \"vrfvmVMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic\"\ + ,\r\n \"etag\": \"W/\\\"6edfbfc5-838b-4158-b5a4-24175060ffb7\\\"\",\r\n \ \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\ - \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"f64442bf-1299-4d3d-8f86-f82377d06ed8\"\ + \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"92a9fb2a-164d-4df9-a06f-e7a3fb02845f\"\ ,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvrfvm\"\ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkInterfaces/vrfvmVMNic/ipConfigurations/ipconfigvrfvm\"\ - ,\r\n \"etag\": \"W/\\\"ec17761e-be6d-497f-97d0-34a709d77ad2\\\"\"\ + ,\r\n \"etag\": \"W/\\\"6edfbfc5-838b-4158-b5a4-24175060ffb7\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\ : \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\ @@ -1377,8 +1343,8 @@ interactions: \r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\ : \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\ \ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\ - internalDomainNameSuffix\": \"ig0zuqqgq3sutc1m0tjgtydjhf.dx.internal.cloudapp.net\"\ - \r\n },\r\n \"macAddress\": \"00-0D-3A-34-D2-24\",\r\n \"enableAcceleratedNetworking\"\ + internalDomainNameSuffix\": \"tvkzmx0hrk0unir54siohneg3a.dx.internal.cloudapp.net\"\ + \r\n },\r\n \"macAddress\": \"00-0D-3A-33-A0-84\",\r\n \"enableAcceleratedNetworking\"\ : false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\ : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Network/networkSecurityGroups/vrfnsg\"\ \r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \ @@ -1386,17 +1352,17 @@ interactions: \r\n }\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\ \n}"} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:55:22 GMT'] + ETag: [W/"6edfbfc5-838b-4158-b5a4-24175060ffb7"] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] content-length: ['2252'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:53:23 GMT'] - etag: [W/"ec17761e-be6d-497f-97d0-34a709d77ad2"] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] status: {code: 200, message: OK} - request: body: null @@ -1405,16 +1371,15 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.13 (Windows-10-10.0.14393) requests/2.9.1 msrest/0.4.4 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 computemanagementclient/0.33.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [6a31f60f-f3b8-11e6-98fe-74c63bed1137] + x-ms-client-request-id: [b4f6c0d8-f468-11e6-b6d6-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/virtualMachines/vrfvm?api-version=2016-04-30-preview response: - body: {string: !!python/unicode "{\r\n \"properties\": {\r\n \"vmId\": \"\ - c51d350f-5326-4ad8-b735-408b21d9c483\",\r\n \"availabilitySet\": {\r\n\ - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/availabilitySets/VRFAVAILSET\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"c1a47492-07a9-4a33-a12e-95605fb35a59\"\ + ,\r\n \"availabilitySet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/availabilitySets/VRFAVAILSET\"\ \r\n },\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS2\"\ \r\n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n\ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ @@ -1437,15 +1402,15 @@ interactions: tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_create_existing/providers/Microsoft.Compute/virtualMachines/vrfvm\"\ ,\r\n \"name\": \"vrfvm\"\r\n}"} headers: - cache-control: [no-cache] + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Thu, 16 Feb 2017 16:55:22 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] content-length: ['2517'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 15 Feb 2017 19:53:24 GMT'] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] status: {code: 200, message: OK} version: 1
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_added_files", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": -1, "issue_text_score": 1, "test_score": -1 }, "num_modified_files": 8 }
0.1
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc libssl-dev libffi-dev" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==1.2.7 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==1.4.9 attrs==22.2.0 autopep8==1.2.4 azure-batch==1.1.0 -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_documentdb&subdirectory=src/command_modules/azure-cli-documentdb -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@efeceb146b93793ee93b2dc07e14ac58a782b45a#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.4 azure-core==1.24.2 azure-graphrbac==0.30.0rc6 azure-keyvault==0.1.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==2.0.0 azure-mgmt-compute==0.33.0 azure-mgmt-containerregistry==0.1.1 azure-mgmt-dns==0.30.0rc6 azure-mgmt-documentdb==0.1.0 azure-mgmt-iothub==0.2.1 azure-mgmt-keyvault==0.30.0 azure-mgmt-network==0.30.0 azure-mgmt-nspkg==3.0.2 azure-mgmt-redis==1.0.0 azure-mgmt-resource==0.30.2 azure-mgmt-sql==0.2.0 azure-mgmt-storage==0.31.0 azure-mgmt-trafficmanager==0.30.0rc6 azure-mgmt-web==0.31.0 azure-nspkg==3.0.2 azure-storage==0.33.0 certifi==2021.5.30 cffi==1.15.1 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.7.1 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.5.4 pyOpenSSL==16.1.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 PyYAML==3.11 requests==2.9.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.5 tomli==1.2.3 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 wrapt==1.16.0 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==1.2.7 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==1.4.9 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==1.1.0 - azure-common==1.1.4 - azure-core==1.24.2 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.1.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==2.0.0 - azure-mgmt-compute==0.33.0 - azure-mgmt-containerregistry==0.1.1 - azure-mgmt-dns==0.30.0rc6 - azure-mgmt-documentdb==0.1.0 - azure-mgmt-iothub==0.2.1 - azure-mgmt-keyvault==0.30.0 - azure-mgmt-network==0.30.0 - azure-mgmt-nspkg==3.0.2 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==0.30.2 - azure-mgmt-sql==0.2.0 - azure-mgmt-storage==0.31.0 - azure-mgmt-trafficmanager==0.30.0rc6 - azure-mgmt-web==0.31.0 - azure-nspkg==3.0.2 - azure-storage==0.33.0 - cffi==1.15.1 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.7.1 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.5.4 - pyopenssl==16.1.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pyyaml==3.11 - requests==2.9.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.5 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - wrapt==1.16.0 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/test_webapp_commands.py::WebappBackupConfigScenarioTest::test_webapp_backup_config", "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/test_webapp_commands.py::WebappBackupRestoreScenarioTest::test_webapp_backup_restore", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py::StorageAccountScenarioTest::test_storage_account_scenario" ]
[ "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/test_webapp_commands.py::WebappBasicE2ETest::test_webapp_e2e", "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/test_webapp_commands.py::AppServiceBadErrorPolishTest::test_appservice_error_polish" ]
[ "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/test_webapp_commands.py::WebappConfigureTest::test_webapp_config", "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/test_webapp_commands.py::WebappScaleTest::test_webapp_scale", "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/test_webapp_commands.py::LinuxWebappSceanrioTest::test_linux_webapp", "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/test_webapp_commands.py::WebappGitScenarioTest::test_webapp_git", "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/test_webapp_commands.py::WebappSlotScenarioTest::test_webapp_slot", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py::StorageCorsScenarioTest::test_storage_cors_scenario", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py::StorageBlobScenarioTest::test_storage_blob_scenario", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py::StorageBlobCopyScenarioTest::test_storage_blob_copy_scenario", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py::StorageFileScenarioTest::test_storage_file_scenario", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py::StorageFileCopyScenarioTest::test_storage_file_copy_scenario", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py::StorageTableScenarioTest::test_storage_table_scenario", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py::StorageQueueScenarioTest::test_storage_queue_scenario", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py::StorageBlobACLScenarioTest::test_storage_blob_acl_scenario", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py::StorageFileACLScenarioTest::test_storage_file_acl_scenario", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py::StorageBlobNoCredentialsScenarioTest::test_storage_blob_no_credentials_scenario", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage.py::StorageTableAndQueueStatsTest::test_table_and_queue_stats" ]
[]
MIT License
1,023
[ "scripts/automation/commandlint/__init__.py", "scripts/automation/commandlint/run.py", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/commands.py", "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_help.py", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py", "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/custom.py", "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/commands.py", "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_params.py", "src/azure-cli-core/azure/cli/core/_util.py", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_help.py" ]
[ "scripts/automation/commandlint/__init__.py", "scripts/automation/commandlint/run.py", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/commands.py", "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_help.py", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py", "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/custom.py", "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/commands.py", "src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_params.py", "src/azure-cli-core/azure/cli/core/_util.py", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_help.py" ]
albertyw__git-browse-16
9cd501dba9d2d65a6a25265023a1befd253a620c
2017-02-15 10:21:41
9cd501dba9d2d65a6a25265023a1befd253a620c
diff --git a/git_browse/browse.py b/git_browse/browse.py index 08673cd..80c7886 100755 --- a/git_browse/browse.py +++ b/git_browse/browse.py @@ -36,12 +36,21 @@ class GithubHost(object): self.user, self.repository ) + if focus_object.is_commit_hash(): + return self.commit_hash_url(repository_url, focus_object) if focus_object.is_root(): return self.root_url(repository_url, focus_object) if focus_object.is_directory(): return self.directory_url(repository_url, focus_object) return self.file_url(repository_url, focus_object) + def commit_hash_url(self, repository_url, focus_hash): + repository_url = "%s/commit/%s" % ( + repository_url, + focus_hash.commit_hash + ) + return repository_url + def root_url(self, repository_url, focus_object): return repository_url @@ -69,10 +78,13 @@ class UberPhabricatorHost(object): return UberPhabricatorHost(None, None) def get_url(self, focus_object): - path = focus_object.path - # arc browse requires an object, provide the root object by default - if focus_object.is_root(): - path = '.' + if focus_object.is_commit_hash(): + path = focus_object.commit_hash + else: + path = focus_object.path + # arc browse requires an object, provide the root object by default + if focus_object.is_root(): + path = '.' command = ['arc', 'browse'] if path: command.append(path) @@ -90,6 +102,9 @@ class FocusObject(object): def __init__(self, path): self.path = path + def is_commit_hash(self): + return False + def is_root(self): return self.path == os.sep @@ -101,6 +116,14 @@ class FocusObject(object): return FocusObject(os.sep) +class FocusHash(object): + def __init__(self, commit_hash): + self.commit_hash = commit_hash + + def is_commit_hash(self): + return True + + def get_repository_root(): current_directory = '' new_directory = os.getcwd() @@ -166,6 +189,9 @@ def get_focus_object(sys_argv, path): object_path = os.path.join(directory, focus_object[0]) object_path = os.path.normpath(object_path) if not os.path.exists(object_path): + focus_hash = get_commit_hash(focus_object[0]) + if focus_hash: + return focus_hash error = "specified file does not exist: %s" % object_path raise FileNotFoundError(error) is_dir = os.path.isdir(object_path) and object_path[-1] != os.sep @@ -175,6 +201,21 @@ def get_focus_object(sys_argv, path): return FocusObject(object_path) +def get_commit_hash(focus_object): + command = ['git', 'show', focus_object] + process = subprocess.Popen( + command, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + universal_newlines=True + ) + out, err = process.communicate() + if process.returncode != 0: + return None + commit_hash = out.split("\n")[0].split(" ")[1] + return FocusHash(commit_hash) + + def open_url(url): print(url) if url.__class__ is list:
Support git browsing a commit hash
albertyw/git-browse
diff --git a/git_browse/tests/test.py b/git_browse/tests/test.py index a96ba45..75ae39b 100644 --- a/git_browse/tests/test.py +++ b/git_browse/tests/test.py @@ -15,6 +15,7 @@ class TestGithubHost(unittest.TestCase): self.github_host = browse.GithubHost('albertyw', 'git-browse') self.repository_url = 'https://github.com/albertyw/git-browse' self.focus_object = browse.FocusObject('/') + self.focus_hash = browse.FocusHash('v2.0.0') def test_init(self): host = browse.GithubHost('user', 'repository') @@ -48,6 +49,16 @@ class TestGithubHost(unittest.TestCase): 'https://github.com/albertyw/git-browse/blob/master/README.md' ) + def test_commit_hash_url(self): + url = self.github_host.commit_hash_url( + self.repository_url, + self.focus_hash + ) + self.assertEqual( + url, + 'https://github.com/albertyw/git-browse/commit/v2.0.0' + ) + class FocusObject(unittest.TestCase): def test_init(self): @@ -75,6 +86,16 @@ class FocusObject(unittest.TestCase): self.assertTrue(obj.is_root()) +class FocusHash(unittest.TestCase): + def test_init(self): + obj = browse.FocusHash('abcde') + self.assertEqual(obj.commit_hash, 'abcde') + + def test_is_commit_hash(self): + obj = browse.FocusHash('abcde') + self.assertTrue(obj.is_commit_hash()) + + class GetRepositoryRoot(unittest.TestCase): def test_get(self): os.chdir(BASE_DIRECTORY) @@ -179,12 +200,30 @@ class TestGetFocusObject(unittest.TestCase): self.assertFalse(focus_object.is_root()) self.assertTrue(focus_object.is_directory()) + def test_get_focus_hash(self): + sys_argv = ['asdf', 'v2.0.0'] + focus_object = browse.get_focus_object(sys_argv, os.getcwd()) + self.assertTrue(focus_object.__class__ is browse.FocusHash) + def test_nonexistend_focus_object(self): sys_argv = ['asdf', 'asdf'] with self.assertRaises(FileNotFoundError): browse.get_focus_object(sys_argv, os.getcwd()) +class TestGetCommitHash(unittest.TestCase): + def test_get_unknown_hash(self): + focus_object = '!@#$' + focus_hash = browse.get_commit_hash(focus_object) + self.assertEqual(focus_hash, None) + + def test_get_hash(self): + focus_object = 'v2.0.0' + focus_hash = browse.get_commit_hash(focus_object) + self.assertTrue(focus_hash.__class__ is browse.FocusHash) + self.assertTrue(focus_hash.commit_hash) + + class TestOpenURL(unittest.TestCase): @patch("builtins.print", autospec=True) def test_open_url(self, mock_print): diff --git a/git_browse/tests/test_git_urls.py b/git_browse/tests/test_git_urls.py index e570b67..75d62e3 100644 --- a/git_browse/tests/test_git_urls.py +++ b/git_browse/tests/test_git_urls.py @@ -49,6 +49,12 @@ GIT_URLS = [ TEST_DIR, 'https://github.com/albertyw/git-browse/tree/master/testdir/' ), + ( + '[email protected]:albertyw/git-browse', + 'v2.0.0', + 'https://github.com/albertyw/git-browse/commit/' + + 'f5631b4c423f2fa5c9c4b64853607f1727d4b7a9' + ), ( '[email protected]:a/b', None, @@ -63,6 +69,11 @@ GIT_URLS = [ '[email protected]:a/b', TEST_DIR, ['arc', 'browse', TEST_DIR+'/'] + ), + ( + '[email protected]:a/b', + 'v2.0.0', + ['arc', 'browse', 'f5631b4c423f2fa5c9c4b64853607f1727d4b7a9'] ) ]
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 3, "test_score": 2 }, "num_modified_files": 1 }
2.0
{ "env_vars": null, "env_yml_path": [], "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "", "pip_packages": [ "pytest", "flake8" ], "pre_install": [], "python": "3.9", "reqs_path": [], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup==1.2.2 flake8==7.2.0 -e git+https://github.com/albertyw/git-browse.git@9cd501dba9d2d65a6a25265023a1befd253a620c#egg=git_browse iniconfig==2.1.0 mccabe==0.7.0 packaging==24.2 pluggy==1.5.0 pycodestyle==2.13.0 pyflakes==3.3.2 pytest==8.3.5 tomli==2.2.1
name: git-browse channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - exceptiongroup==1.2.2 - flake8==7.2.0 - iniconfig==2.1.0 - mccabe==0.7.0 - packaging==24.2 - pluggy==1.5.0 - pycodestyle==2.13.0 - pyflakes==3.3.2 - pytest==8.3.5 - tomli==2.2.1 prefix: /opt/conda/envs/git-browse
[ "git_browse/tests/test.py::TestGithubHost::test_commit_hash_url", "git_browse/tests/test.py::TestGithubHost::test_directory_url", "git_browse/tests/test.py::TestGithubHost::test_file_url", "git_browse/tests/test.py::TestGithubHost::test_get_url", "git_browse/tests/test.py::TestGithubHost::test_init", "git_browse/tests/test.py::TestGithubHost::test_root_url", "git_browse/tests/test.py::FocusHash::test_init", "git_browse/tests/test.py::FocusHash::test_is_commit_hash", "git_browse/tests/test.py::TestGetFocusObject::test_get_focus_hash", "git_browse/tests/test.py::TestGetCommitHash::test_get_hash", "git_browse/tests/test.py::TestGetCommitHash::test_get_unknown_hash", "git_browse/tests/test_git_urls.py::TestGitURLs::test_git_url_12", "git_browse/tests/test_git_urls.py::TestGitURLs::test_git_url_8" ]
[ "git_browse/tests/test.py::GetGitURL::test_url" ]
[ "git_browse/tests/test.py::FocusObject::test_default", "git_browse/tests/test.py::FocusObject::test_init", "git_browse/tests/test.py::FocusObject::test_is_directory", "git_browse/tests/test.py::FocusObject::test_is_not_directory", "git_browse/tests/test.py::FocusObject::test_is_not_root", "git_browse/tests/test.py::FocusObject::test_is_root", "git_browse/tests/test.py::GetRepositoryRoot::test_fail_get", "git_browse/tests/test.py::GetRepositoryRoot::test_get", "git_browse/tests/test.py::GetGitConfig::test_get", "git_browse/tests/test.py::GetGitURL::test_bad_url", "git_browse/tests/test.py::ParseGitURL::test_broken_url", "git_browse/tests/test.py::ParseGitURL::test_https_url", "git_browse/tests/test.py::ParseGitURL::test_ssh_url", "git_browse/tests/test.py::TestGetRepositoryHost::test_repository_host", "git_browse/tests/test.py::TestGetFocusObjectPath::test_get_cwd", "git_browse/tests/test.py::TestGetFocusObjectPath::test_get_path_override", "git_browse/tests/test.py::TestGetFocusObject::test_default_focus_object", "git_browse/tests/test.py::TestGetFocusObject::test_directory_focus_object", "git_browse/tests/test.py::TestGetFocusObject::test_file_focus_object", "git_browse/tests/test.py::TestGetFocusObject::test_nonexistend_focus_object", "git_browse/tests/test.py::TestOpenURL::test_open_url", "git_browse/tests/test.py::FullTest::test_chdir_subdirectory", "git_browse/tests/test.py::FullTest::test_chdir_subdirectory_file", "git_browse/tests/test.py::FullTest::test_default", "git_browse/tests/test.py::FullTest::test_directory", "git_browse/tests/test.py::FullTest::test_file", "git_browse/tests/test.py::FullTest::test_subdirectory", "git_browse/tests/test.py::FullTest::test_subdirectory_file", "git_browse/tests/test_git_urls.py::TestGitURLs::test_git_url_0", "git_browse/tests/test_git_urls.py::TestGitURLs::test_git_url_1", "git_browse/tests/test_git_urls.py::TestGitURLs::test_git_url_10", "git_browse/tests/test_git_urls.py::TestGitURLs::test_git_url_11", "git_browse/tests/test_git_urls.py::TestGitURLs::test_git_url_2", "git_browse/tests/test_git_urls.py::TestGitURLs::test_git_url_3", "git_browse/tests/test_git_urls.py::TestGitURLs::test_git_url_4", "git_browse/tests/test_git_urls.py::TestGitURLs::test_git_url_5", "git_browse/tests/test_git_urls.py::TestGitURLs::test_git_url_6", "git_browse/tests/test_git_urls.py::TestGitURLs::test_git_url_7", "git_browse/tests/test_git_urls.py::TestGitURLs::test_git_url_9" ]
[]
MIT License
1,024
[ "git_browse/browse.py" ]
[ "git_browse/browse.py" ]
borgbackup__borg-2166
833d0ab76cbf5af2a253d2c245722e16bdcf9887
2017-02-16 15:07:32
b9d834409c9e498d78f2df8ca3a8c24132293499
codecov-io: # [Codecov](https://codecov.io/gh/borgbackup/borg/pull/2166?src=pr&el=h1) Report > Merging [#2166](https://codecov.io/gh/borgbackup/borg/pull/2166?src=pr&el=desc) into [master](https://codecov.io/gh/borgbackup/borg/commit/833d0ab76cbf5af2a253d2c245722e16bdcf9887?src=pr&el=desc) will **decrease** coverage by `-1%`. > The diff coverage is `33.33%`. ```diff @@ Coverage Diff @@ ## master #2166 +/- ## ======================================= - Coverage 83.55% 82.56% -1% ======================================= Files 20 20 Lines 7177 7179 +2 Branches 1227 1228 +1 ======================================= - Hits 5997 5927 -70 - Misses 849 919 +70 - Partials 331 333 +2 ``` | [Impacted Files](https://codecov.io/gh/borgbackup/borg/pull/2166?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [src/borg/key.py](https://codecov.io/gh/borgbackup/borg/compare/833d0ab76cbf5af2a253d2c245722e16bdcf9887...cb64746ad34ded088caf42d90fadfc00d278f9cd?src=pr&el=tree#diff-c3JjL2Jvcmcva2V5LnB5) | `87.22% <ø> (-0.36%)` | :x: | | [src/borg/archiver.py](https://codecov.io/gh/borgbackup/borg/compare/833d0ab76cbf5af2a253d2c245722e16bdcf9887...cb64746ad34ded088caf42d90fadfc00d278f9cd?src=pr&el=tree#diff-c3JjL2JvcmcvYXJjaGl2ZXIucHk=) | `84.95% <100%> (+0.14%)` | :white_check_mark: | | [src/borg/xattr.py](https://codecov.io/gh/borgbackup/borg/compare/833d0ab76cbf5af2a253d2c245722e16bdcf9887...cb64746ad34ded088caf42d90fadfc00d278f9cd?src=pr&el=tree#diff-c3JjL2JvcmcveGF0dHIucHk=) | `56% <ø> (-23.5%)` | :x: | | [src/borg/platform/__init__.py](https://codecov.io/gh/borgbackup/borg/compare/833d0ab76cbf5af2a253d2c245722e16bdcf9887...cb64746ad34ded088caf42d90fadfc00d278f9cd?src=pr&el=tree#diff-c3JjL2JvcmcvcGxhdGZvcm0vX19pbml0X18ucHk=) | `73.68% <ø> (-15.79%)` | :x: | | [src/borg/platform/base.py](https://codecov.io/gh/borgbackup/borg/compare/833d0ab76cbf5af2a253d2c245722e16bdcf9887...cb64746ad34ded088caf42d90fadfc00d278f9cd?src=pr&el=tree#diff-c3JjL2JvcmcvcGxhdGZvcm0vYmFzZS5weQ==) | `72.61% <ø> (-10.72%)` | :x: | | [src/borg/helpers.py](https://codecov.io/gh/borgbackup/borg/compare/833d0ab76cbf5af2a253d2c245722e16bdcf9887...cb64746ad34ded088caf42d90fadfc00d278f9cd?src=pr&el=tree#diff-c3JjL2JvcmcvaGVscGVycy5weQ==) | `85.89% <ø> (-1.52%)` | :x: | | [src/borg/remote.py](https://codecov.io/gh/borgbackup/borg/compare/833d0ab76cbf5af2a253d2c245722e16bdcf9887...cb64746ad34ded088caf42d90fadfc00d278f9cd?src=pr&el=tree#diff-c3JjL2JvcmcvcmVtb3RlLnB5) | `77.3% <ø> (-0.23%)` | :x: | | [src/borg/archive.py](https://codecov.io/gh/borgbackup/borg/compare/833d0ab76cbf5af2a253d2c245722e16bdcf9887...cb64746ad34ded088caf42d90fadfc00d278f9cd?src=pr&el=tree#diff-c3JjL2JvcmcvYXJjaGl2ZS5weQ==) | `82.52% <ø> (+0.5%)` | :white_check_mark: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/borgbackup/borg/pull/2166?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/borgbackup/borg/pull/2166?src=pr&el=footer). Last update [833d0ab...af1cd85](https://codecov.io/gh/borgbackup/borg/compare/833d0ab76cbf5af2a253d2c245722e16bdcf9887...af1cd8500586c496a98bf714881c71cbc3bb2144?el=footer&src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 5de24d26..9dbbd202 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -1850,9 +1850,8 @@ def process_epilog(epilog): subparser.add_argument('location', metavar='REPOSITORY', nargs='?', default='', type=location_validator(archive=False), help='repository to create') - subparser.add_argument('-e', '--encryption', dest='encryption', + subparser.add_argument('-e', '--encryption', dest='encryption', required=True, choices=('none', 'keyfile', 'repokey', 'keyfile-blake2', 'repokey-blake2', 'authenticated'), - default=None, help='select encryption key mode') subparser.add_argument('-a', '--append-only', dest='append_only', action='store_true', help='create an append-only mode repository') diff --git a/src/borg/key.py b/src/borg/key.py index e5d736ea..4358c644 100644 --- a/src/borg/key.py +++ b/src/borg/key.py @@ -98,8 +98,10 @@ def key_creator(repository, args): return Blake2RepoKey.create(repository, args) elif args.encryption == 'authenticated': return AuthenticatedKey.create(repository, args) - else: + elif args.encryption == 'none': return PlaintextKey.create(repository, args) + else: + raise ValueError('Invalid encryption mode "%s"' % args.encryption) def key_factory(repository, manifest_data):
borg init repo -> unencrypted repo Only applies to master branch (borg 1.1beta). When blake2b was introduced, we removed the default of aes256-hmac-sha256. Then intention was that the user does an informed decision between hmac-sha256 and blake2b MACs. But: if a user does not specify --encryption, we now fall back to no encryption at all (and this was not intended).
borgbackup/borg
diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py index 2b0709be..adf85b7d 100644 --- a/src/borg/testsuite/archiver.py +++ b/src/borg/testsuite/archiver.py @@ -79,7 +79,13 @@ def exec_cmd(*args, archiver=None, fork=False, exe=None, **kw): archiver = Archiver() archiver.prerun_checks = lambda *args: None archiver.exit_code = EXIT_SUCCESS - args = archiver.parse_args(list(args)) + try: + args = archiver.parse_args(list(args)) + # argparse parsing may raise SystemExit when the command line is bad or + # actions that abort early (eg. --help) where given. Catch this and return + # the error code as-if we invoked a Borg binary. + except SystemExit as e: + return e.code, output.getvalue() ret = archiver.run(args) return ret, output.getvalue() finally: @@ -879,16 +885,12 @@ def _create_test_caches(self): def test_create_without_root(self): """test create without a root""" - self.cmd('init', self.repository_location) - args = ['create', self.repository_location + '::test'] - if self.FORK_DEFAULT: - self.cmd(*args, exit_code=2) - else: - self.assert_raises(SystemExit, lambda: self.cmd(*args)) + self.cmd('init', '--encryption=repokey', self.repository_location) + self.cmd('create', self.repository_location + '::test', exit_code=2) def test_create_pattern_root(self): """test create with only a root pattern""" - self.cmd('init', self.repository_location) + self.cmd('init', '--encryption=repokey', self.repository_location) self.create_regular_file('file1', size=1024 * 80) self.create_regular_file('file2', size=1024 * 80) output = self.cmd('create', '-v', '--list', '--pattern=R input', self.repository_location + '::test') @@ -897,7 +899,7 @@ def test_create_pattern_root(self): def test_create_pattern(self): """test file patterns during create""" - self.cmd('init', self.repository_location) + self.cmd('init', '--encryption=repokey', self.repository_location) self.create_regular_file('file1', size=1024 * 80) self.create_regular_file('file2', size=1024 * 80) self.create_regular_file('file_important', size=1024 * 80) @@ -910,7 +912,7 @@ def test_create_pattern(self): self.assert_in('x input/file2', output) def test_extract_pattern_opt(self): - self.cmd('init', self.repository_location) + self.cmd('init', '--encryption=repokey', self.repository_location) self.create_regular_file('file1', size=1024 * 80) self.create_regular_file('file2', size=1024 * 80) self.create_regular_file('file_important', size=1024 * 80) @@ -921,9 +923,6 @@ def test_extract_pattern_opt(self): self.repository_location + '::test') self.assert_equal(sorted(os.listdir('output/input')), ['file_important']) - def test_exclude_caches(self): - self.cmd('init', self.repository_location) - def _assert_test_caches(self): with changedir('output'): self.cmd('extract', self.repository_location + '::test') @@ -1516,12 +1515,8 @@ def test_break_lock(self): self.cmd('break-lock', self.repository_location) def test_usage(self): - if self.FORK_DEFAULT: - self.cmd(exit_code=0) - self.cmd('-h', exit_code=0) - else: - self.assert_raises(SystemExit, lambda: self.cmd()) - self.assert_raises(SystemExit, lambda: self.cmd('-h')) + self.cmd() + self.cmd('-h') def test_help(self): assert 'Borg' in self.cmd('help') @@ -1777,6 +1772,9 @@ def raise_eof(*args): self.cmd('init', '--encryption=repokey', self.repository_location, exit_code=1) assert not os.path.exists(self.repository_location) + def test_init_requires_encryption_option(self): + self.cmd('init', self.repository_location, exit_code=2) + def check_cache(self): # First run a regular borg check self.cmd('check', self.repository_location) @@ -2476,10 +2474,10 @@ def test_remote_repo_restrict_to_path(self): path_prefix = os.path.dirname(self.repository_path) # restrict to repo directory's parent directory: with patch.object(RemoteRepository, 'extra_test_args', ['--restrict-to-path', path_prefix]): - self.cmd('init', self.repository_location + '_2') + self.cmd('init', '--encryption=repokey', self.repository_location + '_2') # restrict to repo directory's parent directory and another directory: with patch.object(RemoteRepository, 'extra_test_args', ['--restrict-to-path', '/foo', '--restrict-to-path', path_prefix]): - self.cmd('init', self.repository_location + '_3') + self.cmd('init', '--encryption=repokey', self.repository_location + '_3') @unittest.skip('only works locally') def test_debug_put_get_delete_obj(self): @@ -2682,7 +2680,7 @@ def test_get_args(): assert args.restrict_to_paths == ['/p1', '/p2'] # trying to cheat - try to execute different subcommand args = archiver.get_args(['borg', 'serve', '--restrict-to-path=/p1', '--restrict-to-path=/p2', ], - 'borg init /') + 'borg init --encryption=repokey /') assert args.func == archiver.do_serve
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 2 }
1.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[fuse]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-xdist", "pytest-cov", "pytest-benchmark" ], "pre_install": [ "apt-get update", "apt-get install -y gcc python3-dev libssl-dev libacl1-dev liblz4-dev libfuse-dev fuse pkg-config" ], "python": "3.9", "reqs_path": [ "requirements.d/development.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
-e git+https://github.com/borgbackup/borg.git@833d0ab76cbf5af2a253d2c245722e16bdcf9887#egg=borgbackup cachetools==5.5.2 chardet==5.2.0 colorama==0.4.6 coverage==7.8.0 Cython==3.0.12 distlib==0.3.9 exceptiongroup==1.2.2 execnet==2.1.1 filelock==3.18.0 iniconfig==2.1.0 llfuse==1.5.1 msgpack-python==0.5.6 packaging==24.2 platformdirs==4.3.7 pluggy==1.5.0 py-cpuinfo==9.0.0 pyproject-api==1.9.0 pytest==8.3.5 pytest-benchmark==5.1.0 pytest-cov==6.0.0 pytest-xdist==3.6.1 tomli==2.2.1 tox==4.25.0 typing_extensions==4.13.0 virtualenv==20.29.3
name: borg channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - cachetools==5.5.2 - chardet==5.2.0 - colorama==0.4.6 - coverage==7.8.0 - cython==3.0.12 - distlib==0.3.9 - exceptiongroup==1.2.2 - execnet==2.1.1 - filelock==3.18.0 - iniconfig==2.1.0 - llfuse==1.5.1 - msgpack-python==0.5.6 - packaging==24.2 - platformdirs==4.3.7 - pluggy==1.5.0 - py-cpuinfo==9.0.0 - pyproject-api==1.9.0 - pytest==8.3.5 - pytest-benchmark==5.1.0 - pytest-cov==6.0.0 - pytest-xdist==3.6.1 - tomli==2.2.1 - tox==4.25.0 - typing-extensions==4.13.0 - virtualenv==20.29.3 prefix: /opt/conda/envs/borg
[ "src/borg/testsuite/archiver.py::ArchiverTestCase::test_init_requires_encryption_option", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_init_requires_encryption_option" ]
[ "src/borg/testsuite/archiver.py::test_return_codes[python]", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_aes_counter_uniqueness_keyfile", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_aes_counter_uniqueness_passphrase", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_atime", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_bad_filters", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_basic_functionality", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_break_lock", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_change_passphrase", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_check_cache", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_comment", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_auto_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_auto_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lz4_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lzma_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_none_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_none_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_zlib_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_corrupted_repository", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_dry_run", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_pattern", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_pattern_root", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_read_special_broken_symlink", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_topical", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_without_root", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_archive", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_archive_items", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_manifest", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_repo_objs", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_put_get_delete_obj", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_delete", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_delete_repo", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_caches", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_keep_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_keep_tagged_deprecation", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_normalization", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_hardlinks", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_include_exclude", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_include_exclude_regex", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_include_exclude_regex_from_file", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_list_output", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_pattern_opt", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_progress", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_with_pattern", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_file_status", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_file_status_excluded", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_fuse", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_fuse_allow_damaged_files", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_fuse_mount_options", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_fuse_versions_view", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_info", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_keyfile", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_paperkey", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_qr", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_repokey", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_import_errors", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_chunk_counts", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_format", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_hash", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_prefix", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_repository_format", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_size", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_overwrite", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_path_normalization", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_progress_off", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_progress_on", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_prune_repository", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_prune_repository_prefix", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_prune_repository_save_space", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_basic", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_dry_run", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_exclude_caches", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_exclude_keep_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_exclude_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_list_output", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_rechunkify", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_recompress", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_skips_nothing_to_do", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_subtree_hardlinks", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_target", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_target_rc", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_rename", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repeated_files", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_move", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection2", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection2_no_cache", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection_no_cache", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_security_dir_compat", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_sparse_file", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_strip_components", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_strip_components_links", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_symlink_extract", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_umask", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_unix_socket", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_unusual_filenames", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_with_lock", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_attic013_acl_bug", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_check_usage", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_corrupted_manifest", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_empty_repository", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_extra_chunks", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_manifest_rebuild_corrupted_chunk", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_manifest_rebuild_duplicate_archive", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_archive_item_chunk", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_archive_metadata", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_file_chunk", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_manifest", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_verify_data", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_verify_data_unencrypted", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_disable", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_disable2", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_fresh_init_tam_required", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_not_required", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_aes_counter_uniqueness_keyfile", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_aes_counter_uniqueness_passphrase", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_atime", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_bad_filters", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_basic_functionality", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_break_lock", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_change_passphrase", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_check_cache", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_comment", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_auto_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_auto_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lz4_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lz4_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lzma_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lzma_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_none_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_none_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_zlib_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_zlib_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_corrupted_repository", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_dry_run", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_pattern", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_pattern_root", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_read_special_broken_symlink", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_topical", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_without_root", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_archive", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_archive_items", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_manifest", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_repo_objs", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_delete", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_delete_repo", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_caches", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_keep_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_keep_tagged_deprecation", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_normalization", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_hardlinks", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_include_exclude", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_include_exclude_regex", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_include_exclude_regex_from_file", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_list_output", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_pattern_opt", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_progress", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_with_pattern", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_file_status", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_file_status_excluded", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_fuse", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_fuse_allow_damaged_files", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_fuse_mount_options", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_fuse_versions_view", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_info", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_keyfile", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_paperkey", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_qr", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_repokey", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_import_errors", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_chunk_counts", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_format", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_hash", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_prefix", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_repository_format", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_size", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_overwrite", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_path_normalization", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_progress_off", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_progress_on", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_prune_repository", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_prune_repository_prefix", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_prune_repository_save_space", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_basic", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_dry_run", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_exclude_caches", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_exclude_keep_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_exclude_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_list_output", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_rechunkify", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_recompress", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_skips_nothing_to_do", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_subtree_hardlinks", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_target", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_target_rc", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_remote_repo_restrict_to_path", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_rename", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repeated_files", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_move", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection2", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection2_no_cache", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection_no_cache", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_security_dir_compat", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_sparse_file", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_strip_components", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_strip_components_doesnt_leak", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_strip_components_links", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_symlink_extract", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_umask", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_unix_socket", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_unusual_filenames", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_with_lock", "src/borg/testsuite/archiver.py::DiffArchiverTestCase::test_basic_functionality", "src/borg/testsuite/archiver.py::DiffArchiverTestCase::test_sort_option" ]
[ "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lz4_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lzma_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_zlib_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_help", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_init_interrupt", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_unknown_unencrypted", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_usage", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_help", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_init_interrupt", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_unknown_unencrypted", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_usage", "src/borg/testsuite/archiver.py::test_get_args", "src/borg/testsuite/archiver.py::test_compare_chunk_contents", "src/borg/testsuite/archiver.py::TestBuildFilter::test_basic", "src/borg/testsuite/archiver.py::TestBuildFilter::test_empty", "src/borg/testsuite/archiver.py::TestBuildFilter::test_strip_components" ]
[]
BSD License
1,025
[ "src/borg/key.py", "src/borg/archiver.py" ]
[ "src/borg/key.py", "src/borg/archiver.py" ]
Azure__azure-cli-2112
2a8d8fca411fe8422c7cee557943ae4c9f256bfc
2017-02-16 22:58:00
1576ec67f5029db062579da230902a559acbb9fe
tjprescott: **az network dns -h** ``` Group az network dns: Host your DNS domain in Azure. Subgroups: record-set: Manage DNS records and record sets. zone : Manage DNS zones. ``` **az network dns record-set -h** ``` Group az network dns record-set: Manage DNS records and record sets. Subgroups: a : Manage DNS A records. aaaa : Manage DNS AAAA records. cname: Manage DNS CNAME records. mx : Manage DNS MX records. ns : Manage DNS NS records. ptr : Manage DNS PTR records. soa : Manage DNS zone SOA record. srv : Manage DNS SRV records. txt : Manage DNS TXT records. Commands: list : List all record sets within a DNS zone. ``` **az network dns record-set a -h** ``` Group az network dns record-set a: Manage DNS A records. Commands: add-record : Add A record. create : Create an empty A record set. delete : Delete a A record set and all records within. list : List all A record sets in a zone. remove-record: Remove A record from its record set. show : Show details of A record set. update : Update A record set. ``` **az network dns record-set soa -h** ``` Group az network dns record-set soa: Manage DNS zone SOA record. Commands: show : Show details of the DNS zone's SOA record. update: Update properties of the zone's SOA record. ```
diff --git a/src/azure-cli/setup.py b/src/azure-cli/setup.py index d6bb60adc..a400fd7f7 100644 --- a/src/azure-cli/setup.py +++ b/src/azure-cli/setup.py @@ -44,20 +44,25 @@ CLASSIFIERS = [ ] DEPENDENCIES = [ - 'azure-cli-acr', 'azure-cli-acs', 'azure-cli-appservice', - 'azure-cli-core', - 'azure-cli-component', - 'azure-cli-container', + 'azure-cli-batch', 'azure-cli-cloud', + 'azure-cli-component', 'azure-cli-configure', + 'azure-cli-container', + 'azure-cli-core', + 'azure-cli-documentdb', 'azure-cli-feedback', + 'azure-cli-iot', + 'azure-cli-keyvault', 'azure-cli-network', 'azure-cli-nspkg', 'azure-cli-profile', + 'azure-cli-redis', 'azure-cli-resource', 'azure-cli-role', + 'azure-cli-sql', 'azure-cli-storage', 'azure-cli-vm' ] diff --git a/src/command_modules/azure-cli-batch/azure/cli/command_modules/batch/_validators.py b/src/command_modules/azure-cli-batch/azure/cli/command_modules/batch/_validators.py index 1e9ea4d88..799835935 100644 --- a/src/command_modules/azure-cli-batch/azure/cli/command_modules/batch/_validators.py +++ b/src/command_modules/azure-cli-batch/azure/cli/command_modules/batch/_validators.py @@ -258,9 +258,9 @@ def validate_client_parameters(namespace): raise ValueError("Batch account '{}' not found.".format(namespace.account_name)) else: if not namespace.account_name: - raise ValueError("Need specifiy batch account in command line or enviroment variable.") + raise ValueError("Specify batch account in command line or enviroment variable.") if not namespace.account_endpoint: - raise ValueError("Need specifiy batch endpoint in command line or enviroment variable.") + raise ValueError("Specify batch endpoint in command line or enviroment variable.") if az_config.get('batch', 'auth_mode', 'shared_key') == 'aad': namespace.account_key = None diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_help.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_help.py index 68a64e53c..cafdef162 100644 --- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_help.py +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_help.py @@ -453,82 +453,82 @@ helps['network application-gateway waf-config show'] = """ helps['network dns record-set'] = """ type: group - short-summary: Manage DNS record sets. + short-summary: Manage DNS records and record sets. """ -helps['network dns record-set create'] = """ - type: command - short-summary: Create an empty record set within a DNS zone. - long-summary: | - If a matching record set already exists, it will be overwritten unless --if-none-match is supplied. -""" +# endregion -helps['network dns record-set delete'] = """ - type: command - short-summary: Deletes a record set within a DNS zone. -""" +# region DNS records -helps['network dns record-set list'] = """ - type: command - short-summary: Lists all record sets within a DNS zone. -""" +for record in ['a', 'aaaa', 'cname', 'mx', 'ns', 'ptr', 'srv', 'txt']: + helps['network dns record-set {}'.format(record)] = """ + type: group + short-summary: Manage DNS {} records. + """.format(record.upper()) -helps['network dns record-set show'] = """ - type: command - short-summary: Show details of a record set within a DNS zone. -""" +for record in ['a', 'aaaa', 'cname', 'mx', 'ns', 'ptr', 'srv', 'txt']: -helps['network dns record-set update'] = """ - type: command - short-summary: Update properties of a record set within a DNS zone. -""" -# endregion + helps['network dns record-set {} remove-record'.format(record)] = """ + type: command + short-summary: Remove {} record from its record set. + """.format(record.upper()) -# region DNS records + helps['network dns record-set {} create'.format(record)] = """ + type: command + short-summary: Create an empty {} record set. + """.format(record.upper()) -helps['network dns record'] = """ - type: group - short-summary: Manage DNS records contained in a record set -""" + helps['network dns record-set {} delete'.format(record)] = """ + type: command + short-summary: Delete a {} record set and all records within. + """.format(record.upper()) -helps['network dns record a'] = """ - type: group - short-summary: Manage DNS A records -""" + helps['network dns record-set {} list'.format(record)] = """ + type: command + short-summary: List all {} record sets in a zone. + """.format(record.upper()) -helps['network dns record aaaa'] = """ - type: group - short-summary: Manage DNS AAAA records -""" + helps['network dns record-set {} show'.format(record)] = """ + type: command + short-summary: Show details of {} record set. + """.format(record.upper()) -helps['network dns record cname'] = """ - type: group - short-summary: Manage DNS CNAME records -""" +for item in ['a', 'aaaa', 'mx', 'ns', 'ptr', 'srv', 'txt']: -helps['network dns record mx'] = """ - type: group - short-summary: Manage DNS MX (mail) records + helps['network dns record-set {} update'.format(record)] = """ + type: command + short-summary: Update {} record set. + """.format(record.upper()) + + helps['network dns record-set {} add-record'.format(record)] = """ + type: command + short-summary: Add {} record. + """.format(record.upper()) + +helps['network dns record-set cname set-record'] = """ + type: command + short-summary: Sets the value of the CNAME record. """ -helps['network dns record ns'] = """ +helps['network dns record-set soa'] = """ type: group - short-summary: Manage DNS NS (nameserver) records + short-summary: Manage DNS zone SOA record. """ -helps['network dns record ptr'] = """ - type: group - short-summary: Manage DNS PTR (pointer) records +helps['network dns record-set soa show'] = """ + type: command + short-summary: Show details of the DNS zone's SOA record. """ -helps['network dns record srv'] = """ - type: group - short-summary: Manage DNS SRV records +helps['network dns record-set soa update'] = """ + type: command + short-summary: Update properties of the zone's SOA re. """ -helps['network dns record txt'] = """ - type: group - short-summary: Manage DNS TXT records + +helps['network dns record-set list'] = """ + type: command + short-summary: List all record sets within a DNS zone. """ #endregion diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py index d3f3d423d..983235332 100644 --- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py @@ -16,7 +16,6 @@ from azure.mgmt.network.models.network_management_client_enums import \ ExpressRouteCircuitSkuTier, ExpressRouteCircuitPeeringType, IPVersion, LoadDistribution, ProbeProtocol, TransportProtocol, SecurityRuleAccess, SecurityRuleProtocol, SecurityRuleDirection) -from azure.mgmt.dns.models.dns_management_client_enums import RecordType from azure.cli.core.commands import \ (CliArgumentType, register_cli_argument, register_extra_cli_argument) @@ -40,7 +39,7 @@ from azure.cli.command_modules.network._validators import \ validate_auth_cert, validate_cert, validate_inbound_nat_rule_id_list, validate_address_pool_id_list, validate_inbound_nat_rule_name_or_id, validate_address_pool_name_or_id, validate_servers, load_cert_file, validate_metadata, - validate_peering_type, + validate_peering_type, validate_dns_record_type, get_public_ip_validator, get_nsg_validator, get_subnet_validator, get_virtual_network_validator) from azure.mgmt.network.models import ApplicationGatewaySslProtocol @@ -125,7 +124,6 @@ load_balancer_name_type = CliArgumentType(options_list=('--lb-name',), metavar=' private_ip_address_type = CliArgumentType(help='Static private IP address to use.', validator=validate_private_ip_address) cookie_based_affinity_type = CliArgumentType(**enum_choice_list(ApplicationGatewayCookieBasedAffinity)) http_protocol_type = CliArgumentType(**enum_choice_list(ApplicationGatewayProtocol)) -modified_record_type = CliArgumentType(options_list=('--type', '-t'), help='The type of DNS records in the record set.', **enum_choice_list([x.value for x in RecordType if x.value != 'SOA'])) # ARGUMENT REGISTRATION @@ -557,8 +555,6 @@ register_cli_argument('network dns', 'relative_record_set_name', name_arg_type, register_cli_argument('network dns', 'zone_name', options_list=('--zone-name', '-z'), help='The name of the zone.', type=dns_zone_name_type) register_cli_argument('network dns', 'metadata', nargs='+', help='Metadata in space-separated key=value pairs. This overwrites any existing metadata.', validator=validate_metadata) -register_cli_argument('network dns', 'record_type', modified_record_type) - register_cli_argument('network dns zone', 'zone_name', name_arg_type) register_cli_argument('network dns zone', 'location', ignore_type) @@ -566,37 +562,35 @@ register_cli_argument('network dns zone import', 'file_name', options_list=('--f register_cli_argument('network dns zone export', 'file_name', options_list=('--file-name', '-f'), type=file_type, completer=FilesCompleter(), help='Path to the DNS zone file to save') register_cli_argument('network dns zone update', 'if_none_match', ignore_type) -register_cli_argument('network dns record txt add', 'value', nargs='+') -register_cli_argument('network dns record txt remove', 'value', nargs='+') +for item in ['record_type', 'record_set_type']: + register_cli_argument('network dns record-set', item, ignore_type, validator=validate_dns_record_type) -register_cli_argument('network dns record-set create', 'record_set_type', modified_record_type) register_cli_argument('network dns record-set create', 'ttl', help='Record set TTL (time-to-live)') register_cli_argument('network dns record-set create', 'if_none_match', help='Create the record set only if it does not already exist.', action='store_true') -for item in ['list', 'show']: - register_cli_argument('network dns record-set {}'.format(item), 'record_type', options_list=('--type', '-t'), **enum_choice_list(RecordType)) - for item in ['a', 'aaaa', 'cname', 'mx', 'ns', 'ptr', 'srv', 'txt']: - register_cli_argument('network dns record {} add'.format(item), 'record_set_name', options_list=('--record-set-name', '-n'), help='The name of the record set relative to the zone. Creates a new record set if one does not exist.') - register_cli_argument('network dns record {} remove'.format(item), 'record_set_name', options_list=('--record-set-name', '-n'), help='The name of the record set relative to the zone.') -register_cli_argument('network dns record cname add', 'record_set_name', options_list=('--record-set-name', '-n'), help='The name of the record set relative to the zone. Creates a new record set if one does not exist. If a matching record already exists, it is replaced.') - -register_cli_argument('network dns record a', 'ipv4_address', options_list=('--ipv4-address', '-a'), help='IPV4 address in string notation.') -register_cli_argument('network dns record aaaa', 'ipv6_address', options_list=('--ipv6-address', '-a'), help='IPV6 address in string notation.') -register_cli_argument('network dns record cname', 'cname', options_list=('--cname', '-c'), help='Canonical name.') -register_cli_argument('network dns record mx', 'exchange', options_list=('--exchange', '-e'), help='Exchange metric.') -register_cli_argument('network dns record mx', 'preference', options_list=('--preference', '-p'), help='Preference metric.') -register_cli_argument('network dns record ns', 'dname', options_list=('--nsdname', '-d'), help='Name server domain name.') -register_cli_argument('network dns record ptr', 'dname', options_list=('--ptrdname', '-d'), help='PTR target domain name.') -register_cli_argument('network dns record update-soa', 'host', options_list=('--host', '-t'), help='Host name.') -register_cli_argument('network dns record update-soa', 'email', options_list=('--email', '-e'), help='Email address.') -register_cli_argument('network dns record update-soa', 'expire_time', options_list=('--expire-time', '-x'), help='Expire time (seconds).') -register_cli_argument('network dns record update-soa', 'minimum_ttl', options_list=('--minimum-ttl', '-m'), help='Minimum TTL (time-to-live, seconds).') -register_cli_argument('network dns record update-soa', 'refresh_time', options_list=('--refresh-time', '-f'), help='Refresh value (seconds).') -register_cli_argument('network dns record update-soa', 'retry_time', options_list=('--retry-time', '-r'), help='Retry time (seconds).') -register_cli_argument('network dns record update-soa', 'serial_number', options_list=('--serial-number', '-s'), help='Serial number.') -register_cli_argument('network dns record srv', 'priority', options_list=('--priority', '-p'), help='Priority metric.') -register_cli_argument('network dns record srv', 'weight', options_list=('--weight', '-w'), help='Weight metric.') -register_cli_argument('network dns record srv', 'port', options_list=('--port', '-r'), help='Service port.') -register_cli_argument('network dns record srv', 'target', options_list=('--target', '-t'), help='Target domain name.') -register_cli_argument('network dns record txt', 'value', options_list=('--value', '-v'), nargs='+', help='Space separated list of text values which will be concatenated together.') + register_cli_argument('network dns record-set {} add-record'.format(item), 'record_set_name', options_list=('--record-set-name', '-n'), help='The name of the record set relative to the zone. Creates a new record set if one does not exist.') + register_cli_argument('network dns record-set {} remove-record'.format(item), 'record_set_name', options_list=('--record-set-name', '-n'), help='The name of the record set relative to the zone.') +register_cli_argument('network dns record-set cname set-record', 'record_set_name', options_list=('--record-set-name', '-n'), help='The name of the record set relative to the zone. Creates a new record set if one does not exist.') + +register_cli_argument('network dns record-set soa', 'relative_record_set_name', ignore_type, default='@') + +register_cli_argument('network dns record-set a', 'ipv4_address', options_list=('--ipv4-address', '-a'), help='IPV4 address in string notation.') +register_cli_argument('network dns record-set aaaa', 'ipv6_address', options_list=('--ipv6-address', '-a'), help='IPV6 address in string notation.') +register_cli_argument('network dns record-set cname', 'cname', options_list=('--cname', '-c'), help='Canonical name.') +register_cli_argument('network dns record-set mx', 'exchange', options_list=('--exchange', '-e'), help='Exchange metric.') +register_cli_argument('network dns record-set mx', 'preference', options_list=('--preference', '-p'), help='Preference metric.') +register_cli_argument('network dns record-set ns', 'dname', options_list=('--nsdname', '-d'), help='Name server domain name.') +register_cli_argument('network dns record-set ptr', 'dname', options_list=('--ptrdname', '-d'), help='PTR target domain name.') +register_cli_argument('network dns record-set soa', 'host', options_list=('--host', '-t'), help='Host name.') +register_cli_argument('network dns record-set soa', 'email', options_list=('--email', '-e'), help='Email address.') +register_cli_argument('network dns record-set soa', 'expire_time', options_list=('--expire-time', '-x'), help='Expire time (seconds).') +register_cli_argument('network dns record-set soa', 'minimum_ttl', options_list=('--minimum-ttl', '-m'), help='Minimum TTL (time-to-live, seconds).') +register_cli_argument('network dns record-set soa', 'refresh_time', options_list=('--refresh-time', '-f'), help='Refresh value (seconds).') +register_cli_argument('network dns record-set soa', 'retry_time', options_list=('--retry-time', '-r'), help='Retry time (seconds).') +register_cli_argument('network dns record-set soa', 'serial_number', options_list=('--serial-number', '-s'), help='Serial number.') +register_cli_argument('network dns record-set srv', 'priority', options_list=('--priority', '-p'), help='Priority metric.') +register_cli_argument('network dns record-set srv', 'weight', options_list=('--weight', '-w'), help='Weight metric.') +register_cli_argument('network dns record-set srv', 'port', options_list=('--port', '-r'), help='Service port.') +register_cli_argument('network dns record-set srv', 'target', options_list=('--target', '-t'), help='Target domain name.') +register_cli_argument('network dns record-set txt', 'value', options_list=('--value', '-v'), nargs='+', help='Space separated list of text values which will be concatenated together.') diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_validators.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_validators.py index 9670f5a20..1c0e5961d 100644 --- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_validators.py +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_validators.py @@ -127,6 +127,17 @@ def validate_cert(namespace): # app-gateway ssl-cert create does not have these fields and that is okay pass +def validate_dns_record_type(namespace): + tokens = namespace.command.split(' ') + types = ['a', 'aaaa', 'cname', 'mx', 'ns', 'ptr', 'soa', 'srv', 'txt'] + for token in tokens: + if token in types: + if hasattr(namespace, 'record_type'): + namespace.record_type = token + else: + namespace.record_set_type = token + return + def validate_inbound_nat_rule_id_list(namespace): _generate_lb_id_list_from_names_or_ids( namespace, 'load_balancer_inbound_nat_rule_ids', 'inboundNatRules') diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/commands.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/commands.py index 28ccce26b..08b6f28be 100644 --- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/commands.py +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/commands.py @@ -398,44 +398,41 @@ cli_generic_update_command(__name__, 'network traffic-manager endpoint update', custom_function_op=custom_path.format('update_traffic_manager_endpoint')) # DNS ZonesOperations -cli_command(__name__, 'network dns zone show', 'azure.mgmt.dns.operations.zones_operations#ZonesOperations.get', cf_dns_mgmt_zones, table_transformer=transform_dns_zone_table_output) -cli_command(__name__, 'network dns zone delete', 'azure.mgmt.dns.operations.zones_operations#ZonesOperations.delete', cf_dns_mgmt_zones, confirmation=True) +dns_zone_path = 'azure.mgmt.dns.operations.zones_operations#ZonesOperations.' +cli_command(__name__, 'network dns zone show', dns_zone_path + 'get', cf_dns_mgmt_zones, table_transformer=transform_dns_zone_table_output) +cli_command(__name__, 'network dns zone delete', dns_zone_path + 'delete', cf_dns_mgmt_zones, confirmation=True) cli_command(__name__, 'network dns zone list', custom_path.format('list_dns_zones'), table_transformer=transform_dns_zone_table_output) cli_generic_update_command(__name__, 'network dns zone update', - 'azure.mgmt.dns.operations.zones_operations#ZonesOperations.get', - 'azure.mgmt.dns.operations.zones_operations#ZonesOperations.create_or_update', + dns_zone_path + 'get', + dns_zone_path + 'create_or_update', cf_dns_mgmt_zones) cli_command(__name__, 'network dns zone import', custom_path.format('import_zone')) cli_command(__name__, 'network dns zone export', custom_path.format('export_zone')) cli_command(__name__, 'network dns zone create', custom_path.format('create_dns_zone'), cf_dns_mgmt_zones) # DNS RecordSetsOperations -cli_command(__name__, 'network dns record-set show', 'azure.mgmt.dns.operations.record_sets_operations#RecordSetsOperations.get', cf_dns_mgmt_record_sets, transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record-set delete', 'azure.mgmt.dns.operations.record_sets_operations#RecordSetsOperations.delete', cf_dns_mgmt_record_sets) -cli_command(__name__, 'network dns record-set list', custom_path.format('list_dns_record_set'), cf_dns_mgmt_record_sets, transform=transform_dns_record_set_output, table_transformer=transform_dns_record_set_table_output) -cli_command(__name__, 'network dns record-set create', custom_path.format('create_dns_record_set'), transform=transform_dns_record_set_output) -cli_generic_update_command(__name__, 'network dns record-set update', - 'azure.mgmt.dns.operations.record_sets_operations#RecordSetsOperations.get', - 'azure.mgmt.dns.operations.record_sets_operations#RecordSetsOperations.create_or_update', - cf_dns_mgmt_record_sets, - custom_function_op=custom_path.format('update_dns_record_set'), - transform=transform_dns_record_set_output) - -# DNS RecordOperations -cli_command(__name__, 'network dns record aaaa add', custom_path.format('add_dns_aaaa_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record a add', custom_path.format('add_dns_a_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record cname add', custom_path.format('add_dns_cname_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record ns add', custom_path.format('add_dns_ns_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record mx add', custom_path.format('add_dns_mx_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record ptr add', custom_path.format('add_dns_ptr_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record srv add', custom_path.format('add_dns_srv_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record txt add', custom_path.format('add_dns_txt_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record update-soa', custom_path.format('update_dns_soa_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record aaaa remove', custom_path.format('remove_dns_aaaa_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record a remove', custom_path.format('remove_dns_a_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record cname remove', custom_path.format('remove_dns_cname_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record ns remove', custom_path.format('remove_dns_ns_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record mx remove', custom_path.format('remove_dns_mx_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record ptr remove', custom_path.format('remove_dns_ptr_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record srv remove', custom_path.format('remove_dns_srv_record'), transform=transform_dns_record_set_output) -cli_command(__name__, 'network dns record txt remove', custom_path.format('remove_dns_txt_record'), transform=transform_dns_record_set_output) +dns_record_set_path = 'azure.mgmt.dns.operations.record_sets_operations#RecordSetsOperations.' +cli_command(__name__, 'network dns record-set list', custom_path.format('list_dns_record_set'), cf_dns_mgmt_record_sets, transform=transform_dns_record_set_output) +for record in ['a', 'aaaa', 'mx', 'ns', 'ptr', 'srv', 'txt']: + cli_command(__name__, 'network dns record-set {} show'.format(record), dns_record_set_path + 'get', cf_dns_mgmt_record_sets, transform=transform_dns_record_set_output) + cli_command(__name__, 'network dns record-set {} delete'.format(record), dns_record_set_path + 'delete', cf_dns_mgmt_record_sets) + cli_command(__name__, 'network dns record-set {} list'.format(record), custom_path.format('list_dns_record_set'), cf_dns_mgmt_record_sets, transform=transform_dns_record_set_output, table_transformer=transform_dns_record_set_table_output) + cli_command(__name__, 'network dns record-set {} create'.format(record), custom_path.format('create_dns_record_set'), transform=transform_dns_record_set_output) + cli_command(__name__, 'network dns record-set {} add-record'.format(record), custom_path.format('add_dns_{}_record'.format(record)), transform=transform_dns_record_set_output) + cli_command(__name__, 'network dns record-set {} remove-record'.format(record), custom_path.format('remove_dns_{}_record'.format(record)), transform=transform_dns_record_set_output) + cli_generic_update_command(__name__, 'network dns record-set {} update'.format(record), + dns_record_set_path + 'get', + dns_record_set_path + 'create_or_update', + cf_dns_mgmt_record_sets, + custom_function_op=custom_path.format('update_dns_record_set'), + transform=transform_dns_record_set_output) + +cli_command(__name__, 'network dns record-set soa show', dns_record_set_path + 'get', cf_dns_mgmt_record_sets, transform=transform_dns_record_set_output) +cli_command(__name__, 'network dns record-set soa update', custom_path.format('update_dns_soa_record'), transform=transform_dns_record_set_output) + +cli_command(__name__, 'network dns record-set cname show', dns_record_set_path + 'get', cf_dns_mgmt_record_sets, transform=transform_dns_record_set_output) +cli_command(__name__, 'network dns record-set cname delete', dns_record_set_path + 'delete', cf_dns_mgmt_record_sets) +cli_command(__name__, 'network dns record-set cname list', custom_path.format('list_dns_record_set'), cf_dns_mgmt_record_sets, transform=transform_dns_record_set_output, table_transformer=transform_dns_record_set_table_output) +cli_command(__name__, 'network dns record-set cname create', custom_path.format('create_dns_record_set'), transform=transform_dns_record_set_output) +cli_command(__name__, 'network dns record-set cname set-record', custom_path.format('add_dns_cname_record'), transform=transform_dns_record_set_output) +cli_command(__name__, 'network dns record-set cname remove-record', custom_path.format('remove_dns_cname_record'), transform=transform_dns_record_set_output) diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_params.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_params.py index 34e9314b4..8f0f796fa 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_params.py +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_params.py @@ -185,7 +185,7 @@ for scope in ['vm create', 'vmss create']: register_cli_argument(scope, 'authentication_type', help='Type of authentication to use with the VM. Defaults to password for Windows and SSH public key for Linux.', arg_group='Authentication', **enum_choice_list(['ssh', 'password'])) register_cli_argument(scope, 'os_disk_name', help='The name of the new VM OS disk.', arg_group='Storage') - register_cli_argument(scope, 'os_type', help='Type of OS installed on a custom VHD. Do not use when specifiying an URN or URN alias.', arg_group='Storage', **enum_choice_list(['windows', 'linux'])) + register_cli_argument(scope, 'os_type', help='Type of OS installed on a custom VHD. Do not use when specifying an URN or URN alias.', arg_group='Storage', **enum_choice_list(['windows', 'linux'])) register_cli_argument(scope, 'storage_account', help="Only applicable when use with '--use-unmanaged-disk'. The name to use when creating a new storage account or referencing an existing one. If omitted, an appropriate storage account in the same resource group and location will be used, or a new one will be created.", arg_group='Storage') register_cli_argument(scope, 'storage_caching', help='Storage caching type for the VM OS disk', arg_group='Storage', **enum_choice_list(['ReadWrite', 'ReadOnly'])) register_cli_argument(scope, 'storage_sku', help='The sku of storage account to persist VM. By default, only Standard_LRS and Premium_LRS are allowed. Using with --use-unmanaged-disk, all are available.', arg_group='Storage', **enum_choice_list(SkuName))
[DNS] Change 'az network dns record update-soa' to 'az network dns record soa update' Under 'az network dns record', we have a bunch of subgroups (one for each record type) followed by a one-off command 'update-soa'. The SOA record set is a bit of a special case, in that it can be edited but doesn't support add/remove. However, I think there's a cleaner way to support this. Remove the 'update-soa' command, and move it to an 'update' command under the 'soa' command group That way, under 'records' we have a clean list of command groups, one for each record type including SOA. Under each record type, we support add/remove commands, except for SOA which supports an update command instead.
Azure/azure-cli
diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/recordings/test_network_dns.yaml b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/recordings/test_network_dns.yaml index f3b2a954e..0ae2c3dab 100644 --- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/recordings/test_network_dns.yaml +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/recordings/test_network_dns.yaml @@ -10,17 +10,17 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a4561a5c-f482-11e6-9ff3-a0b3ccf7272a] + x-ms-client-request-id: [8193d8c2-f498-11e6-9e0d-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com","name":"myzone.com","type":"Microsoft.Network\/dnszones","etag":"00000002-0000-0000-f415-d5678f88d201","location":"global","tags":{},"properties":{"maxNumberOfRecordSets":5000,"nameServers":["ns1-01.azure-dns.com.","ns2-01.azure-dns.net.","ns3-01.azure-dns.org.","ns4-01.azure-dns.info."],"numberOfRecordSets":2}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com","name":"myzone.com","type":"Microsoft.Network\/dnszones","etag":"00000002-0000-0000-364a-ed42a588d201","location":"global","tags":{},"properties":{"maxNumberOfRecordSets":5000,"nameServers":["ns1-04.azure-dns.com.","ns2-04.azure-dns.net.","ns3-04.azure-dns.org.","ns4-04.azure-dns.info."],"numberOfRecordSets":2}}'} headers: Cache-Control: [private] Content-Length: ['463'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:05 GMT'] - ETag: [00000002-0000-0000-f415-d5678f88d201] + Date: ['Thu, 16 Feb 2017 22:37:33 GMT'] + ETag: [00000002-0000-0000-364a-ed42a588d201] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] @@ -38,16 +38,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a6e1ccf4-f482-11e6-a33c-a0b3ccf7272a] + x-ms-client-request-id: [829ff686-f498-11e6-af40-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com","name":"myzone.com","type":"Microsoft.Network\/dnszones","etag":"00000002-0000-0000-f415-d5678f88d201","location":"global","tags":{},"properties":{"maxNumberOfRecordSets":5000,"nameServers":["ns1-01.azure-dns.com.","ns2-01.azure-dns.net.","ns3-01.azure-dns.org.","ns4-01.azure-dns.info."],"numberOfRecordSets":2}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com","name":"myzone.com","type":"Microsoft.Network\/dnszones","etag":"00000002-0000-0000-364a-ed42a588d201","location":"global","tags":{},"properties":{"maxNumberOfRecordSets":5000,"nameServers":["ns1-04.azure-dns.com.","ns2-04.azure-dns.net.","ns3-04.azure-dns.org.","ns4-04.azure-dns.info."],"numberOfRecordSets":2}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:06 GMT'] - ETag: [00000002-0000-0000-f415-d5678f88d201] + Date: ['Thu, 16 Feb 2017 22:37:34 GMT'] + ETag: [00000002-0000-0000-364a-ed42a588d201] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -59,7 +59,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: - body: '{"name": "myrsa", "type": "A", "properties": {"TTL": 3600}}' + body: '{"properties": {"TTL": 3600}, "type": "a", "name": "myrsa"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -69,23 +69,23 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a75daa0a-f482-11e6-81b7-a0b3ccf7272a] + x-ms-client-request-id: [83599228-f498-11e6-9d04-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"eac70b5f-ff5d-429b-9b74-b79670f25ce3","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"d7289747-55d5-4f2e-b11e-54c1e1def441","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[]}}'} headers: Cache-Control: [private] Content-Length: ['328'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:07 GMT'] - ETag: [eac70b5f-ff5d-429b-9b74-b79670f25ce3] + Date: ['Thu, 16 Feb 2017 22:37:36 GMT'] + ETag: [d7289747-55d5-4f2e-b11e-54c1e1def441] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11997'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 201, message: Created} - request: body: null @@ -97,16 +97,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a821b93a-f482-11e6-a429-a0b3ccf7272a] + x-ms-client-request-id: [842032c0-f498-11e6-8461-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"eac70b5f-ff5d-429b-9b74-b79670f25ce3","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"d7289747-55d5-4f2e-b11e-54c1e1def441","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:08 GMT'] - ETag: [eac70b5f-ff5d-429b-9b74-b79670f25ce3] + Date: ['Thu, 16 Feb 2017 22:37:36 GMT'] + ETag: [d7289747-55d5-4f2e-b11e-54c1e1def441] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -118,9 +118,9 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: - body: '{"etag": "eac70b5f-ff5d-429b-9b74-b79670f25ce3", "name": "myrsa", "type": - "Microsoft.Network/dnszones/A", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa", - "properties": {"ARecords": [{"ipv4Address": "10.0.0.10"}], "TTL": 3600}}' + body: '{"properties": {"ARecords": [{"ipv4Address": "10.0.0.10"}], "TTL": 3600}, + "type": "Microsoft.Network/dnszones/A", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa", + "etag": "d7289747-55d5-4f2e-b11e-54c1e1def441", "name": "myrsa"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -130,16 +130,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a8805458-f482-11e6-bb94-a0b3ccf7272a] + x-ms-client-request-id: [846280ca-f498-11e6-80d5-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"17019ad8-4c28-4107-92e0-fcfbd198a66b","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"48ca7c67-4f9c-4e81-8574-57271cbc8fe6","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:08 GMT'] - ETag: [17019ad8-4c28-4107-92e0-fcfbd198a66b] + Date: ['Thu, 16 Feb 2017 22:37:37 GMT'] + ETag: [48ca7c67-4f9c-4e81-8574-57271cbc8fe6] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -148,7 +148,7 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['355'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11996'] status: {code: 200, message: OK} - request: body: null @@ -160,7 +160,7 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a95b04dc-f482-11e6-bfc1-a0b3ccf7272a] + x-ms-client-request-id: [854e04d2-f498-11e6-acc5-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsaalt?api-version=2016-04-01 response: @@ -170,17 +170,17 @@ interactions: Cache-Control: [private] Content-Length: ['172'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:11 GMT'] + Date: ['Thu, 16 Feb 2017 22:37:39 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] status: {code: 404, message: Not Found} - request: - body: '{"name": "myrsaalt", "type": "a", "properties": {"ARecords": [{"ipv4Address": - "10.0.0.10"}], "TTL": 3600}}' + body: '{"properties": {"ARecords": [{"ipv4Address": "10.0.0.10"}], "TTL": 3600}, + "type": "a", "name": "myrsaalt"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -190,26 +190,26 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [a9dd063e-f482-11e6-be63-a0b3ccf7272a] + x-ms-client-request-id: [859a5cee-f498-11e6-a8be-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsaalt?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsaalt","name":"myrsaalt","type":"Microsoft.Network\/dnszones\/A","etag":"67bbf38b-68d0-4d61-a9fb-461bf157cf3e","properties":{"fqdn":"myrsaalt.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsaalt","name":"myrsaalt","type":"Microsoft.Network\/dnszones\/A","etag":"7b98d8ff-b2ec-4bf8-a55a-95474ed026f9","properties":{"fqdn":"myrsaalt.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"}]}}'} headers: Cache-Control: [private] Content-Length: ['364'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:11 GMT'] - ETag: [67bbf38b-68d0-4d61-a9fb-461bf157cf3e] + Date: ['Thu, 16 Feb 2017 22:37:39 GMT'] + ETag: [7b98d8ff-b2ec-4bf8-a55a-95474ed026f9] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11997'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] status: {code: 201, message: Created} - request: - body: '{"name": "myrsaaaa", "type": "AAAA", "properties": {"TTL": 3600}}' + body: '{"properties": {"TTL": 3600}, "type": "aaaa", "name": "myrsaaaa"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -219,17 +219,17 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [aa9c0dcc-f482-11e6-a384-a0b3ccf7272a] + x-ms-client-request-id: [866cc5a4-f498-11e6-af7b-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/AAAA/myrsaaaa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaa","name":"myrsaaaa","type":"Microsoft.Network\/dnszones\/AAAA","etag":"f8bedb59-a70e-422f-8b85-c5eec7a66047","properties":{"fqdn":"myrsaaaa.myzone.com.","TTL":3600,"AAAARecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaa","name":"myrsaaaa","type":"Microsoft.Network\/dnszones\/AAAA","etag":"e4d9536c-ac5b-42b1-b4b4-faa923d72a19","properties":{"fqdn":"myrsaaaa.myzone.com.","TTL":3600,"AAAARecords":[]}}'} headers: Cache-Control: [private] Content-Length: ['346'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:15 GMT'] - ETag: [f8bedb59-a70e-422f-8b85-c5eec7a66047] + Date: ['Thu, 16 Feb 2017 22:37:42 GMT'] + ETag: [e4d9536c-ac5b-42b1-b4b4-faa923d72a19] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] @@ -247,16 +247,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ad506806-f482-11e6-b97b-a0b3ccf7272a] + x-ms-client-request-id: [87a8b252-f498-11e6-952d-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/AAAA/myrsaaaa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaa","name":"myrsaaaa","type":"Microsoft.Network\/dnszones\/AAAA","etag":"f8bedb59-a70e-422f-8b85-c5eec7a66047","properties":{"fqdn":"myrsaaaa.myzone.com.","TTL":3600,"AAAARecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaa","name":"myrsaaaa","type":"Microsoft.Network\/dnszones\/AAAA","etag":"e4d9536c-ac5b-42b1-b4b4-faa923d72a19","properties":{"fqdn":"myrsaaaa.myzone.com.","TTL":3600,"AAAARecords":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:17 GMT'] - ETag: [f8bedb59-a70e-422f-8b85-c5eec7a66047] + Date: ['Thu, 16 Feb 2017 22:37:43 GMT'] + ETag: [e4d9536c-ac5b-42b1-b4b4-faa923d72a19] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -268,10 +268,9 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: - body: '{"etag": "f8bedb59-a70e-422f-8b85-c5eec7a66047", "name": "myrsaaaa", "type": - "Microsoft.Network/dnszones/AAAA", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/AAAA/myrsaaaa", - "properties": {"AAAARecords": [{"ipv6Address": "2001:db8:0:1:1:1:1:1"}], "TTL": - 3600}}' + body: '{"properties": {"TTL": 3600, "AAAARecords": [{"ipv6Address": "2001:db8:0:1:1:1:1:1"}]}, + "type": "Microsoft.Network/dnszones/AAAA", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/AAAA/myrsaaaa", + "etag": "e4d9536c-ac5b-42b1-b4b4-faa923d72a19", "name": "myrsaaaa"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -281,16 +280,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ad90b766-f482-11e6-a3d3-a0b3ccf7272a] + x-ms-client-request-id: [88265cb0-f498-11e6-89a1-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/AAAA/myrsaaaa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaa","name":"myrsaaaa","type":"Microsoft.Network\/dnszones\/AAAA","etag":"29b84cf4-54ac-45f4-9992-d600337209f2","properties":{"fqdn":"myrsaaaa.myzone.com.","TTL":3600,"AAAARecords":[{"ipv6Address":"2001:db8:0:1:1:1:1:1"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaa","name":"myrsaaaa","type":"Microsoft.Network\/dnszones\/AAAA","etag":"188f3b1d-e078-489d-8be5-f086455251d6","properties":{"fqdn":"myrsaaaa.myzone.com.","TTL":3600,"AAAARecords":[{"ipv6Address":"2001:db8:0:1:1:1:1:1"}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:18 GMT'] - ETag: [29b84cf4-54ac-45f4-9992-d600337209f2] + Date: ['Thu, 16 Feb 2017 22:37:44 GMT'] + ETag: [188f3b1d-e078-489d-8be5-f086455251d6] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -311,7 +310,7 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ae54a548-f482-11e6-8108-a0b3ccf7272a] + x-ms-client-request-id: [8935e112-f498-11e6-acdc-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/AAAA/myrsaaaaalt?api-version=2016-04-01 response: @@ -321,17 +320,17 @@ interactions: Cache-Control: [private] Content-Length: ['175'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:19 GMT'] + Date: ['Thu, 16 Feb 2017 22:37:45 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 404, message: Not Found} - request: - body: '{"name": "myrsaaaaalt", "type": "aaaa", "properties": {"AAAARecords": [{"ipv6Address": - "2001:db8:0:1:1:1:1:1"}], "TTL": 3600}}' + body: '{"properties": {"TTL": 3600, "AAAARecords": [{"ipv6Address": "2001:db8:0:1:1:1:1:1"}]}, + "type": "aaaa", "name": "myrsaaaaalt"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -341,26 +340,26 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ae975c7e-f482-11e6-b3bc-a0b3ccf7272a] + x-ms-client-request-id: [898bf710-f498-11e6-bfd2-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/AAAA/myrsaaaaalt?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaaalt","name":"myrsaaaaalt","type":"Microsoft.Network\/dnszones\/AAAA","etag":"c85fa146-81a7-4393-8df2-fd6e42c84c8c","properties":{"fqdn":"myrsaaaaalt.myzone.com.","TTL":3600,"AAAARecords":[{"ipv6Address":"2001:db8:0:1:1:1:1:1"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaaalt","name":"myrsaaaaalt","type":"Microsoft.Network\/dnszones\/AAAA","etag":"bb4af783-4e50-4789-a221-6d9720fb7906","properties":{"fqdn":"myrsaaaaalt.myzone.com.","TTL":3600,"AAAARecords":[{"ipv6Address":"2001:db8:0:1:1:1:1:1"}]}}'} headers: Cache-Control: [private] Content-Length: ['393'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:19 GMT'] - ETag: [c85fa146-81a7-4393-8df2-fd6e42c84c8c] + Date: ['Thu, 16 Feb 2017 22:37:46 GMT'] + ETag: [bb4af783-4e50-4789-a221-6d9720fb7906] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 201, message: Created} - request: - body: '{"name": "myrscname", "type": "CNAME", "properties": {"TTL": 3600}}' + body: '{"properties": {"TTL": 3600}, "type": "cname", "name": "myrscname"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -370,23 +369,23 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [af42731a-f482-11e6-b47b-a0b3ccf7272a] + x-ms-client-request-id: [8a757a06-f498-11e6-bf41-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/CNAME/myrscname?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscname","name":"myrscname","type":"Microsoft.Network\/dnszones\/CNAME","etag":"a77e9d56-56ba-4628-8a21-e6f7db9eb868","properties":{"fqdn":"myrscname.myzone.com.","TTL":3600}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscname","name":"myrscname","type":"Microsoft.Network\/dnszones\/CNAME","etag":"61720286-95d3-4d7a-9d8e-1c879a35c472","properties":{"fqdn":"myrscname.myzone.com.","TTL":3600}}'} headers: Cache-Control: [private] Content-Length: ['334'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:20 GMT'] - ETag: [a77e9d56-56ba-4628-8a21-e6f7db9eb868] + Date: ['Thu, 16 Feb 2017 22:37:48 GMT'] + ETag: [61720286-95d3-4d7a-9d8e-1c879a35c472] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 201, message: Created} - request: body: null @@ -398,16 +397,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [affd4812-f482-11e6-87f1-a0b3ccf7272a] + x-ms-client-request-id: [8b7b93b6-f498-11e6-863f-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/CNAME/myrscname?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscname","name":"myrscname","type":"Microsoft.Network\/dnszones\/CNAME","etag":"a77e9d56-56ba-4628-8a21-e6f7db9eb868","properties":{"fqdn":"myrscname.myzone.com.","TTL":3600}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscname","name":"myrscname","type":"Microsoft.Network\/dnszones\/CNAME","etag":"61720286-95d3-4d7a-9d8e-1c879a35c472","properties":{"fqdn":"myrscname.myzone.com.","TTL":3600}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:21 GMT'] - ETag: [a77e9d56-56ba-4628-8a21-e6f7db9eb868] + Date: ['Thu, 16 Feb 2017 22:37:49 GMT'] + ETag: [61720286-95d3-4d7a-9d8e-1c879a35c472] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -419,9 +418,9 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: - body: '{"etag": "a77e9d56-56ba-4628-8a21-e6f7db9eb868", "name": "myrscname", "type": + body: '{"properties": {"CNAMERecord": {"cname": "mycname"}, "TTL": 3600}, "type": "Microsoft.Network/dnszones/CNAME", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/CNAME/myrscname", - "properties": {"CNAMERecord": {"cname": "mycname"}, "TTL": 3600}}' + "etag": "61720286-95d3-4d7a-9d8e-1c879a35c472", "name": "myrscname"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -431,16 +430,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b034890a-f482-11e6-803b-a0b3ccf7272a] + x-ms-client-request-id: [8bdf6fc8-f498-11e6-b3f5-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/CNAME/myrscname?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscname","name":"myrscname","type":"Microsoft.Network\/dnszones\/CNAME","etag":"bca95fc8-060b-45f5-abe4-5d12ecd2856e","properties":{"fqdn":"myrscname.myzone.com.","TTL":3600,"CNAMERecord":{"cname":"mycname"}}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscname","name":"myrscname","type":"Microsoft.Network\/dnszones\/CNAME","etag":"d3ca537b-0e21-42fd-9aeb-5e6f69437c3d","properties":{"fqdn":"myrscname.myzone.com.","TTL":3600,"CNAMERecord":{"cname":"mycname"}}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:22 GMT'] - ETag: [bca95fc8-060b-45f5-abe4-5d12ecd2856e] + Date: ['Thu, 16 Feb 2017 22:37:50 GMT'] + ETag: [d3ca537b-0e21-42fd-9aeb-5e6f69437c3d] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -449,7 +448,7 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['368'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: body: null @@ -461,7 +460,7 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b0ed3d58-f482-11e6-813b-a0b3ccf7272a] + x-ms-client-request-id: [8cd264a6-f498-11e6-b68f-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/CNAME/myrscnamealt?api-version=2016-04-01 response: @@ -471,17 +470,17 @@ interactions: Cache-Control: [private] Content-Length: ['176'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:23 GMT'] + Date: ['Thu, 16 Feb 2017 22:37:54 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 404, message: Not Found} - request: - body: '{"name": "myrscnamealt", "type": "cname", "properties": {"CNAMERecord": - {"cname": "mycname"}, "TTL": 3600}}' + body: '{"properties": {"CNAMERecord": {"cname": "mycname"}, "TTL": 3600}, "type": + "cname", "name": "myrscnamealt"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -491,26 +490,26 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b156c7d8-f482-11e6-b262-a0b3ccf7272a] + x-ms-client-request-id: [8f49d5b8-f498-11e6-aec1-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/CNAME/myrscnamealt?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscnamealt","name":"myrscnamealt","type":"Microsoft.Network\/dnszones\/CNAME","etag":"9af59adb-5b8b-40e5-ae0d-5fde6f2aec12","properties":{"fqdn":"myrscnamealt.myzone.com.","TTL":3600,"CNAMERecord":{"cname":"mycname"}}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscnamealt","name":"myrscnamealt","type":"Microsoft.Network\/dnszones\/CNAME","etag":"22477145-0695-49fd-bedf-5e7c814fe6e4","properties":{"fqdn":"myrscnamealt.myzone.com.","TTL":3600,"CNAMERecord":{"cname":"mycname"}}}'} headers: Cache-Control: [private] Content-Length: ['377'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:23 GMT'] - ETag: [9af59adb-5b8b-40e5-ae0d-5fde6f2aec12] + Date: ['Thu, 16 Feb 2017 22:37:55 GMT'] + ETag: [22477145-0695-49fd-bedf-5e7c814fe6e4] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 201, message: Created} - request: - body: '{"name": "myrsmx", "type": "MX", "properties": {"TTL": 3600}}' + body: '{"properties": {"TTL": 3600}, "type": "mx", "name": "myrsmx"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -520,23 +519,23 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b20b6a92-f482-11e6-8c4d-a0b3ccf7272a] + x-ms-client-request-id: [900503d4-f498-11e6-b89a-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/MX/myrsmx?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmx","name":"myrsmx","type":"Microsoft.Network\/dnszones\/MX","etag":"9736013f-9d46-4223-9934-51067b8fea40","properties":{"fqdn":"myrsmx.myzone.com.","TTL":3600,"MXRecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmx","name":"myrsmx","type":"Microsoft.Network\/dnszones\/MX","etag":"3bb9d092-ce4f-4935-add7-e3ef79b52986","properties":{"fqdn":"myrsmx.myzone.com.","TTL":3600,"MXRecords":[]}}'} headers: Cache-Control: [private] Content-Length: ['334'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:25 GMT'] - ETag: [9736013f-9d46-4223-9934-51067b8fea40] + Date: ['Thu, 16 Feb 2017 22:37:56 GMT'] + ETag: [3bb9d092-ce4f-4935-add7-e3ef79b52986] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 201, message: Created} - request: body: null @@ -548,16 +547,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b2bc3a12-f482-11e6-8bee-a0b3ccf7272a] + x-ms-client-request-id: [90d42868-f498-11e6-bd41-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/MX/myrsmx?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmx","name":"myrsmx","type":"Microsoft.Network\/dnszones\/MX","etag":"9736013f-9d46-4223-9934-51067b8fea40","properties":{"fqdn":"myrsmx.myzone.com.","TTL":3600,"MXRecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmx","name":"myrsmx","type":"Microsoft.Network\/dnszones\/MX","etag":"3bb9d092-ce4f-4935-add7-e3ef79b52986","properties":{"fqdn":"myrsmx.myzone.com.","TTL":3600,"MXRecords":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:25 GMT'] - ETag: [9736013f-9d46-4223-9934-51067b8fea40] + Date: ['Thu, 16 Feb 2017 22:37:58 GMT'] + ETag: [3bb9d092-ce4f-4935-add7-e3ef79b52986] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -566,12 +565,12 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['334'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: - body: '{"etag": "9736013f-9d46-4223-9934-51067b8fea40", "name": "myrsmx", "type": - "Microsoft.Network/dnszones/MX", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/MX/myrsmx", - "properties": {"TTL": 3600, "MXRecords": [{"exchange": "12", "preference": 13}]}}' + body: '{"properties": {"TTL": 3600, "MXRecords": [{"exchange": "12", "preference": + 13}]}, "type": "Microsoft.Network/dnszones/MX", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/MX/myrsmx", + "etag": "3bb9d092-ce4f-4935-add7-e3ef79b52986", "name": "myrsmx"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -581,16 +580,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b2f9717a-f482-11e6-8198-a0b3ccf7272a] + x-ms-client-request-id: [913e829e-f498-11e6-9296-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/MX/myrsmx?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmx","name":"myrsmx","type":"Microsoft.Network\/dnszones\/MX","etag":"ab979abd-f398-463f-92cd-0da2b2b40918","properties":{"fqdn":"myrsmx.myzone.com.","TTL":3600,"MXRecords":[{"exchange":"12","preference":13}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmx","name":"myrsmx","type":"Microsoft.Network\/dnszones\/MX","etag":"c7a5da5c-a17a-4759-8fc6-bc182a17a254","properties":{"fqdn":"myrsmx.myzone.com.","TTL":3600,"MXRecords":[{"exchange":"12","preference":13}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:27 GMT'] - ETag: [ab979abd-f398-463f-92cd-0da2b2b40918] + Date: ['Thu, 16 Feb 2017 22:37:59 GMT'] + ETag: [c7a5da5c-a17a-4759-8fc6-bc182a17a254] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -599,7 +598,7 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['367'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: body: null @@ -611,7 +610,7 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b3ac6d48-f482-11e6-8181-a0b3ccf7272a] + x-ms-client-request-id: [91fac7a6-f498-11e6-82cc-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/MX/myrsmxalt?api-version=2016-04-01 response: @@ -621,7 +620,7 @@ interactions: Cache-Control: [private] Content-Length: ['173'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:27 GMT'] + Date: ['Thu, 16 Feb 2017 22:38:00 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] @@ -630,8 +629,8 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 404, message: Not Found} - request: - body: '{"name": "myrsmxalt", "type": "mx", "properties": {"TTL": 3600, "MXRecords": - [{"exchange": "12", "preference": 13}]}}' + body: '{"properties": {"TTL": 3600, "MXRecords": [{"exchange": "12", "preference": + 13}]}, "type": "mx", "name": "myrsmxalt"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -641,17 +640,17 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b3ead04c-f482-11e6-b37c-a0b3ccf7272a] + x-ms-client-request-id: [9244610a-f498-11e6-9431-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/MX/myrsmxalt?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmxalt","name":"myrsmxalt","type":"Microsoft.Network\/dnszones\/MX","etag":"5ef72ec1-f2df-46db-a7dd-bddf50ac955d","properties":{"fqdn":"myrsmxalt.myzone.com.","TTL":3600,"MXRecords":[{"exchange":"12","preference":13}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmxalt","name":"myrsmxalt","type":"Microsoft.Network\/dnszones\/MX","etag":"abb6c9dd-42c5-41d5-9d90-402b85100832","properties":{"fqdn":"myrsmxalt.myzone.com.","TTL":3600,"MXRecords":[{"exchange":"12","preference":13}]}}'} headers: Cache-Control: [private] Content-Length: ['376'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:28 GMT'] - ETag: [5ef72ec1-f2df-46db-a7dd-bddf50ac955d] + Date: ['Thu, 16 Feb 2017 22:38:00 GMT'] + ETag: [abb6c9dd-42c5-41d5-9d90-402b85100832] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] @@ -660,7 +659,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 201, message: Created} - request: - body: '{"name": "myrsns", "type": "NS", "properties": {"TTL": 3600}}' + body: '{"properties": {"TTL": 3600}, "type": "ns", "name": "myrsns"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -670,23 +669,23 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b4b36042-f482-11e6-b71b-a0b3ccf7272a] + x-ms-client-request-id: [93166aae-f498-11e6-a794-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/NS/myrsns?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsns","name":"myrsns","type":"Microsoft.Network\/dnszones\/NS","etag":"5c267d0b-33b7-4b1e-8933-7ead13085bf6","properties":{"fqdn":"myrsns.myzone.com.","TTL":3600,"NSRecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsns","name":"myrsns","type":"Microsoft.Network\/dnszones\/NS","etag":"fe9e605c-884f-48b9-88b1-439daf254c52","properties":{"fqdn":"myrsns.myzone.com.","TTL":3600,"NSRecords":[]}}'} headers: Cache-Control: [private] Content-Length: ['334'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:29 GMT'] - ETag: [5c267d0b-33b7-4b1e-8933-7ead13085bf6] + Date: ['Thu, 16 Feb 2017 22:38:02 GMT'] + ETag: [fe9e605c-884f-48b9-88b1-439daf254c52] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 201, message: Created} - request: body: null @@ -698,16 +697,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b5619214-f482-11e6-a494-a0b3ccf7272a] + x-ms-client-request-id: [93d4b12c-f498-11e6-bf10-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/NS/myrsns?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsns","name":"myrsns","type":"Microsoft.Network\/dnszones\/NS","etag":"5c267d0b-33b7-4b1e-8933-7ead13085bf6","properties":{"fqdn":"myrsns.myzone.com.","TTL":3600,"NSRecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsns","name":"myrsns","type":"Microsoft.Network\/dnszones\/NS","etag":"fe9e605c-884f-48b9-88b1-439daf254c52","properties":{"fqdn":"myrsns.myzone.com.","TTL":3600,"NSRecords":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:30 GMT'] - ETag: [5c267d0b-33b7-4b1e-8933-7ead13085bf6] + Date: ['Thu, 16 Feb 2017 22:38:03 GMT'] + ETag: [fe9e605c-884f-48b9-88b1-439daf254c52] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -718,9 +717,9 @@ interactions: content-length: ['334'] status: {code: 200, message: OK} - request: - body: '{"etag": "5c267d0b-33b7-4b1e-8933-7ead13085bf6", "name": "myrsns", "type": - "Microsoft.Network/dnszones/NS", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/NS/myrsns", - "properties": {"NSRecords": [{"nsdname": "foobar.com"}], "TTL": 3600}}' + body: '{"properties": {"NSRecords": [{"nsdname": "foobar.com"}], "TTL": 3600}, + "type": "Microsoft.Network/dnszones/NS", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/NS/myrsns", + "etag": "fe9e605c-884f-48b9-88b1-439daf254c52", "name": "myrsns"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -730,16 +729,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b5af695a-f482-11e6-928c-a0b3ccf7272a] + x-ms-client-request-id: [93fdb3fa-f498-11e6-8c1e-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/NS/myrsns?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsns","name":"myrsns","type":"Microsoft.Network\/dnszones\/NS","etag":"5f236f16-7ae4-4c76-b037-57a97a8eb1d3","properties":{"fqdn":"myrsns.myzone.com.","TTL":3600,"NSRecords":[{"nsdname":"foobar.com"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsns","name":"myrsns","type":"Microsoft.Network\/dnszones\/NS","etag":"e1774943-72fa-4c2d-b8a2-c381216df40f","properties":{"fqdn":"myrsns.myzone.com.","TTL":3600,"NSRecords":[{"nsdname":"foobar.com"}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:31 GMT'] - ETag: [5f236f16-7ae4-4c76-b037-57a97a8eb1d3] + Date: ['Thu, 16 Feb 2017 22:38:03 GMT'] + ETag: [e1774943-72fa-4c2d-b8a2-c381216df40f] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -760,7 +759,7 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b676958a-f482-11e6-9760-a0b3ccf7272a] + x-ms-client-request-id: [94cfd77e-f498-11e6-8bd1-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/NS/myrsnsalt?api-version=2016-04-01 response: @@ -770,7 +769,7 @@ interactions: Cache-Control: [private] Content-Length: ['173'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:32 GMT'] + Date: ['Thu, 16 Feb 2017 22:38:09 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] @@ -778,8 +777,8 @@ interactions: X-Powered-By: [ASP.NET] status: {code: 404, message: Not Found} - request: - body: '{"name": "myrsnsalt", "type": "ns", "properties": {"NSRecords": [{"nsdname": - "foobar.com"}], "TTL": 3600}}' + body: '{"properties": {"NSRecords": [{"nsdname": "foobar.com"}], "TTL": 3600}, + "type": "ns", "name": "myrsnsalt"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -789,17 +788,17 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b6bc2074-f482-11e6-b15d-a0b3ccf7272a] + x-ms-client-request-id: [97d2e75c-f498-11e6-83e6-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/NS/myrsnsalt?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsnsalt","name":"myrsnsalt","type":"Microsoft.Network\/dnszones\/NS","etag":"2189e7b7-8113-4f8c-be41-bdbc8f834484","properties":{"fqdn":"myrsnsalt.myzone.com.","TTL":3600,"NSRecords":[{"nsdname":"foobar.com"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsnsalt","name":"myrsnsalt","type":"Microsoft.Network\/dnszones\/NS","etag":"b170e487-a2a6-4172-961a-604139a6f7e7","properties":{"fqdn":"myrsnsalt.myzone.com.","TTL":3600,"NSRecords":[{"nsdname":"foobar.com"}]}}'} headers: Cache-Control: [private] Content-Length: ['367'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:33 GMT'] - ETag: [2189e7b7-8113-4f8c-be41-bdbc8f834484] + Date: ['Thu, 16 Feb 2017 22:38:10 GMT'] + ETag: [b170e487-a2a6-4172-961a-604139a6f7e7] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] @@ -808,7 +807,7 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 201, message: Created} - request: - body: '{"name": "myrsptr", "type": "PTR", "properties": {"TTL": 3600}}' + body: '{"properties": {"TTL": 3600}, "type": "ptr", "name": "myrsptr"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -818,17 +817,17 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b779e150-f482-11e6-9c77-a0b3ccf7272a] + x-ms-client-request-id: [9893451c-f498-11e6-9397-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/PTR/myrsptr?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptr","name":"myrsptr","type":"Microsoft.Network\/dnszones\/PTR","etag":"dd9b1c7a-d0dc-415f-9796-96fcadd667d2","properties":{"fqdn":"myrsptr.myzone.com.","TTL":3600,"PTRRecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptr","name":"myrsptr","type":"Microsoft.Network\/dnszones\/PTR","etag":"ed47aeda-3653-4c66-b99d-b1a9f8eb5920","properties":{"fqdn":"myrsptr.myzone.com.","TTL":3600,"PTRRecords":[]}}'} headers: Cache-Control: [private] Content-Length: ['340'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:34 GMT'] - ETag: [dd9b1c7a-d0dc-415f-9796-96fcadd667d2] + Date: ['Thu, 16 Feb 2017 22:38:12 GMT'] + ETag: [ed47aeda-3653-4c66-b99d-b1a9f8eb5920] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] @@ -846,16 +845,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b84cf18c-f482-11e6-8b97-a0b3ccf7272a] + x-ms-client-request-id: [995c2cc8-f498-11e6-a68e-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/PTR/myrsptr?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptr","name":"myrsptr","type":"Microsoft.Network\/dnszones\/PTR","etag":"dd9b1c7a-d0dc-415f-9796-96fcadd667d2","properties":{"fqdn":"myrsptr.myzone.com.","TTL":3600,"PTRRecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptr","name":"myrsptr","type":"Microsoft.Network\/dnszones\/PTR","etag":"ed47aeda-3653-4c66-b99d-b1a9f8eb5920","properties":{"fqdn":"myrsptr.myzone.com.","TTL":3600,"PTRRecords":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:35 GMT'] - ETag: [dd9b1c7a-d0dc-415f-9796-96fcadd667d2] + Date: ['Thu, 16 Feb 2017 22:38:12 GMT'] + ETag: [ed47aeda-3653-4c66-b99d-b1a9f8eb5920] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -867,9 +866,9 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: - body: '{"etag": "dd9b1c7a-d0dc-415f-9796-96fcadd667d2", "name": "myrsptr", "type": - "Microsoft.Network/dnszones/PTR", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/PTR/myrsptr", - "properties": {"TTL": 3600, "PTRRecords": [{"ptrdname": "foobar.com"}]}}' + body: '{"properties": {"PTRRecords": [{"ptrdname": "foobar.com"}], "TTL": 3600}, + "type": "Microsoft.Network/dnszones/PTR", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/PTR/myrsptr", + "etag": "ed47aeda-3653-4c66-b99d-b1a9f8eb5920", "name": "myrsptr"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -879,16 +878,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b894c282-f482-11e6-ad50-a0b3ccf7272a] + x-ms-client-request-id: [99a48b6e-f498-11e6-8de0-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/PTR/myrsptr?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptr","name":"myrsptr","type":"Microsoft.Network\/dnszones\/PTR","etag":"dbf1445b-687a-46d9-b690-508dcc67cf92","properties":{"fqdn":"myrsptr.myzone.com.","TTL":3600,"PTRRecords":[{"ptrdname":"foobar.com"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptr","name":"myrsptr","type":"Microsoft.Network\/dnszones\/PTR","etag":"05f53f84-a98d-416c-b1d8-a06865ab0068","properties":{"fqdn":"myrsptr.myzone.com.","TTL":3600,"PTRRecords":[{"ptrdname":"foobar.com"}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:36 GMT'] - ETag: [dbf1445b-687a-46d9-b690-508dcc67cf92] + Date: ['Thu, 16 Feb 2017 22:38:13 GMT'] + ETag: [05f53f84-a98d-416c-b1d8-a06865ab0068] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -897,7 +896,7 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['365'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: body: null @@ -909,7 +908,7 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b94d2602-f482-11e6-9f30-a0b3ccf7272a] + x-ms-client-request-id: [9a742b1c-f498-11e6-b9d2-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/PTR/myrsptralt?api-version=2016-04-01 response: @@ -919,7 +918,7 @@ interactions: Cache-Control: [private] Content-Length: ['174'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:36 GMT'] + Date: ['Thu, 16 Feb 2017 22:38:14 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] @@ -928,8 +927,8 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 404, message: Not Found} - request: - body: '{"name": "myrsptralt", "type": "ptr", "properties": {"TTL": 3600, "PTRRecords": - [{"ptrdname": "foobar.com"}]}}' + body: '{"properties": {"PTRRecords": [{"ptrdname": "foobar.com"}], "TTL": 3600}, + "type": "ptr", "name": "myrsptralt"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -939,26 +938,26 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [b9742818-f482-11e6-85a2-a0b3ccf7272a] + x-ms-client-request-id: [9abbf148-f498-11e6-a484-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/PTR/myrsptralt?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptralt","name":"myrsptralt","type":"Microsoft.Network\/dnszones\/PTR","etag":"1ef193c3-848e-4167-aba1-adac705382f3","properties":{"fqdn":"myrsptralt.myzone.com.","TTL":3600,"PTRRecords":[{"ptrdname":"foobar.com"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptralt","name":"myrsptralt","type":"Microsoft.Network\/dnszones\/PTR","etag":"b0e6755b-bada-4396-a94f-e58a3c404f58","properties":{"fqdn":"myrsptralt.myzone.com.","TTL":3600,"PTRRecords":[{"ptrdname":"foobar.com"}]}}'} headers: Cache-Control: [private] Content-Length: ['374'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:37 GMT'] - ETag: [1ef193c3-848e-4167-aba1-adac705382f3] + Date: ['Thu, 16 Feb 2017 22:38:15 GMT'] + ETag: [b0e6755b-bada-4396-a94f-e58a3c404f58] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 201, message: Created} - request: - body: '{"name": "myrssrv", "type": "SRV", "properties": {"TTL": 3600}}' + body: '{"properties": {"TTL": 3600}, "type": "srv", "name": "myrssrv"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -968,23 +967,23 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ba1adc4c-f482-11e6-9b3a-a0b3ccf7272a] + x-ms-client-request-id: [9b78d70a-f498-11e6-919d-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SRV/myrssrv?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrv","name":"myrssrv","type":"Microsoft.Network\/dnszones\/SRV","etag":"f21b1a8e-4032-4a85-a3ed-22cffc632cdc","properties":{"fqdn":"myrssrv.myzone.com.","TTL":3600,"SRVRecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrv","name":"myrssrv","type":"Microsoft.Network\/dnszones\/SRV","etag":"729d4a26-b7fe-47bd-add5-6f3240bd8719","properties":{"fqdn":"myrssrv.myzone.com.","TTL":3600,"SRVRecords":[]}}'} headers: Cache-Control: [private] Content-Length: ['340'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:38 GMT'] - ETag: [f21b1a8e-4032-4a85-a3ed-22cffc632cdc] + Date: ['Thu, 16 Feb 2017 22:38:16 GMT'] + ETag: [729d4a26-b7fe-47bd-add5-6f3240bd8719] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11997'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 201, message: Created} - request: body: null @@ -996,16 +995,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [badecd78-f482-11e6-9954-a0b3ccf7272a] + x-ms-client-request-id: [9c5b4e98-f498-11e6-bc7a-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SRV/myrssrv?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrv","name":"myrssrv","type":"Microsoft.Network\/dnszones\/SRV","etag":"f21b1a8e-4032-4a85-a3ed-22cffc632cdc","properties":{"fqdn":"myrssrv.myzone.com.","TTL":3600,"SRVRecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrv","name":"myrssrv","type":"Microsoft.Network\/dnszones\/SRV","etag":"729d4a26-b7fe-47bd-add5-6f3240bd8719","properties":{"fqdn":"myrssrv.myzone.com.","TTL":3600,"SRVRecords":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:39 GMT'] - ETag: [f21b1a8e-4032-4a85-a3ed-22cffc632cdc] + Date: ['Thu, 16 Feb 2017 22:38:18 GMT'] + ETag: [729d4a26-b7fe-47bd-add5-6f3240bd8719] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1014,13 +1013,13 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['340'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11997'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: - body: '{"etag": "f21b1a8e-4032-4a85-a3ed-22cffc632cdc", "name": "myrssrv", "type": - "Microsoft.Network/dnszones/SRV", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SRV/myrssrv", - "properties": {"TTL": 3600, "SRVRecords": [{"port": 1234, "priority": 1, "target": - "target.com", "weight": 50}]}}' + body: '{"properties": {"TTL": 3600, "SRVRecords": [{"port": 1234, "priority": + 1, "weight": 50, "target": "target.com"}]}, "type": "Microsoft.Network/dnszones/SRV", + "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SRV/myrssrv", + "etag": "729d4a26-b7fe-47bd-add5-6f3240bd8719", "name": "myrssrv"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -1030,16 +1029,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [bb1f98ec-f482-11e6-92ce-a0b3ccf7272a] + x-ms-client-request-id: [9cc442e2-f498-11e6-a66c-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SRV/myrssrv?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrv","name":"myrssrv","type":"Microsoft.Network\/dnszones\/SRV","etag":"d068d744-dbdc-4367-b9c5-2c59f76d3a0e","properties":{"fqdn":"myrssrv.myzone.com.","TTL":3600,"SRVRecords":[{"port":1234,"priority":1,"target":"target.com","weight":50}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrv","name":"myrssrv","type":"Microsoft.Network\/dnszones\/SRV","etag":"e2760f4e-601c-4aad-a2ad-815bd4b75b8b","properties":{"fqdn":"myrssrv.myzone.com.","TTL":3600,"SRVRecords":[{"port":1234,"priority":1,"target":"target.com","weight":50}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:40 GMT'] - ETag: [d068d744-dbdc-4367-b9c5-2c59f76d3a0e] + Date: ['Thu, 16 Feb 2017 22:38:18 GMT'] + ETag: [e2760f4e-601c-4aad-a2ad-815bd4b75b8b] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1048,7 +1047,7 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['400'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11997'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: body: null @@ -1060,7 +1059,7 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [bbdccd0c-f482-11e6-898e-a0b3ccf7272a] + x-ms-client-request-id: [9d9e8f18-f498-11e6-9c1b-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SRV/myrssrvalt?api-version=2016-04-01 response: @@ -1070,7 +1069,7 @@ interactions: Cache-Control: [private] Content-Length: ['174'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:41 GMT'] + Date: ['Thu, 16 Feb 2017 22:38:19 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] @@ -1079,8 +1078,8 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 404, message: Not Found} - request: - body: '{"name": "myrssrvalt", "type": "srv", "properties": {"TTL": 3600, "SRVRecords": - [{"port": 1234, "priority": 1, "target": "target.com", "weight": 50}]}}' + body: '{"properties": {"TTL": 3600, "SRVRecords": [{"port": 1234, "priority": + 1, "weight": 50, "target": "target.com"}]}, "type": "srv", "name": "myrssrvalt"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -1090,26 +1089,26 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [bc1e6b90-f482-11e6-9799-a0b3ccf7272a] + x-ms-client-request-id: [9e0a2e54-f498-11e6-bc5c-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SRV/myrssrvalt?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrvalt","name":"myrssrvalt","type":"Microsoft.Network\/dnszones\/SRV","etag":"89c8cb7a-8185-4001-89d3-dbd906db28b2","properties":{"fqdn":"myrssrvalt.myzone.com.","TTL":3600,"SRVRecords":[{"port":1234,"priority":1,"target":"target.com","weight":50}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrvalt","name":"myrssrvalt","type":"Microsoft.Network\/dnszones\/SRV","etag":"dc74cba5-3626-40c6-815b-a6321e6439a7","properties":{"fqdn":"myrssrvalt.myzone.com.","TTL":3600,"SRVRecords":[{"port":1234,"priority":1,"target":"target.com","weight":50}]}}'} headers: Cache-Control: [private] Content-Length: ['409'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:41 GMT'] - ETag: [89c8cb7a-8185-4001-89d3-dbd906db28b2] + Date: ['Thu, 16 Feb 2017 22:38:20 GMT'] + ETag: [dc74cba5-3626-40c6-815b-a6321e6439a7] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 201, message: Created} - request: - body: '{"name": "myrstxt", "type": "TXT", "properties": {"TTL": 3600}}' + body: '{"properties": {"TTL": 3600}, "type": "txt", "name": "myrstxt"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -1119,23 +1118,23 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [bcd7f718-f482-11e6-8e82-a0b3ccf7272a] + x-ms-client-request-id: [9f1113dc-f498-11e6-bc97-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/TXT/myrstxt?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxt","name":"myrstxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"db03f812-fad8-46f0-bae2-b0063b65fb2a","properties":{"fqdn":"myrstxt.myzone.com.","TTL":3600,"TXTRecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxt","name":"myrstxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"a396d329-6448-45c4-a629-ecbd7cfeef12","properties":{"fqdn":"myrstxt.myzone.com.","TTL":3600,"TXTRecords":[]}}'} headers: Cache-Control: [private] Content-Length: ['340'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:43 GMT'] - ETag: [db03f812-fad8-46f0-bae2-b0063b65fb2a] + Date: ['Thu, 16 Feb 2017 22:38:23 GMT'] + ETag: [a396d329-6448-45c4-a629-ecbd7cfeef12] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11997'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 201, message: Created} - request: body: null @@ -1147,16 +1146,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [bd85f786-f482-11e6-94be-a0b3ccf7272a] + x-ms-client-request-id: [a090ae06-f498-11e6-952f-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/TXT/myrstxt?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxt","name":"myrstxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"db03f812-fad8-46f0-bae2-b0063b65fb2a","properties":{"fqdn":"myrstxt.myzone.com.","TTL":3600,"TXTRecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxt","name":"myrstxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"a396d329-6448-45c4-a629-ecbd7cfeef12","properties":{"fqdn":"myrstxt.myzone.com.","TTL":3600,"TXTRecords":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:44 GMT'] - ETag: [db03f812-fad8-46f0-bae2-b0063b65fb2a] + Date: ['Thu, 16 Feb 2017 22:38:24 GMT'] + ETag: [a396d329-6448-45c4-a629-ecbd7cfeef12] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1165,12 +1164,12 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['340'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11997'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: - body: '{"etag": "db03f812-fad8-46f0-bae2-b0063b65fb2a", "name": "myrstxt", "type": - "Microsoft.Network/dnszones/TXT", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/TXT/myrstxt", - "properties": {"TTL": 3600, "TXTRecords": [{"value": ["some_text"]}]}}' + body: '{"properties": {"TTL": 3600, "TXTRecords": [{"value": ["some_text"]}]}, + "type": "Microsoft.Network/dnszones/TXT", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/TXT/myrstxt", + "etag": "a396d329-6448-45c4-a629-ecbd7cfeef12", "name": "myrstxt"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -1180,16 +1179,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [bdc49522-f482-11e6-b800-a0b3ccf7272a] + x-ms-client-request-id: [a0dd20ec-f498-11e6-9805-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/TXT/myrstxt?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxt","name":"myrstxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"13d16c46-68f3-4f5f-8f55-de9a2d5ea7b7","properties":{"fqdn":"myrstxt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["some_text"]}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxt","name":"myrstxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"fd71221b-1134-4a6b-877f-b6b0b0c12f4c","properties":{"fqdn":"myrstxt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["some_text"]}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:45 GMT'] - ETag: [13d16c46-68f3-4f5f-8f55-de9a2d5ea7b7] + Date: ['Thu, 16 Feb 2017 22:38:25 GMT'] + ETag: [fd71221b-1134-4a6b-877f-b6b0b0c12f4c] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1198,7 +1197,7 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['363'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: body: null @@ -1210,7 +1209,7 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [be7873f4-f482-11e6-961f-a0b3ccf7272a] + x-ms-client-request-id: [a1b26f80-f498-11e6-8301-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/TXT/myrstxtalt?api-version=2016-04-01 response: @@ -1220,17 +1219,17 @@ interactions: Cache-Control: [private] Content-Length: ['174'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:46 GMT'] + Date: ['Thu, 16 Feb 2017 22:38:26 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 404, message: Not Found} - request: - body: '{"name": "myrstxtalt", "type": "txt", "properties": {"TTL": 3600, "TXTRecords": - [{"value": ["some_text"]}]}}' + body: '{"properties": {"TTL": 3600, "TXTRecords": [{"value": ["some_text"]}]}, + "type": "txt", "name": "myrstxtalt"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -1240,17 +1239,17 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [beb73226-f482-11e6-b89d-a0b3ccf7272a] + x-ms-client-request-id: [a1f31066-f498-11e6-a37d-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/TXT/myrstxtalt?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxtalt","name":"myrstxtalt","type":"Microsoft.Network\/dnszones\/TXT","etag":"65de52a1-1242-4d86-81fd-10e1bafe5b45","properties":{"fqdn":"myrstxtalt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["some_text"]}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxtalt","name":"myrstxtalt","type":"Microsoft.Network\/dnszones\/TXT","etag":"b748c7bc-384a-48d0-a23a-cbc63a5cd148","properties":{"fqdn":"myrstxtalt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["some_text"]}]}}'} headers: Cache-Control: [private] Content-Length: ['372'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:46 GMT'] - ETag: [65de52a1-1242-4d86-81fd-10e1bafe5b45] + Date: ['Thu, 16 Feb 2017 22:38:27 GMT'] + ETag: [b748c7bc-384a-48d0-a23a-cbc63a5cd148] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] @@ -1268,16 +1267,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [bf7e19ac-f482-11e6-ac0f-a0b3ccf7272a] + x-ms-client-request-id: [a2ca8148-f498-11e6-8379-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"17019ad8-4c28-4107-92e0-fcfbd198a66b","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"48ca7c67-4f9c-4e81-8574-57271cbc8fe6","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:47 GMT'] - ETag: [17019ad8-4c28-4107-92e0-fcfbd198a66b] + Date: ['Thu, 16 Feb 2017 22:38:28 GMT'] + ETag: [48ca7c67-4f9c-4e81-8574-57271cbc8fe6] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1286,13 +1285,12 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['355'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] status: {code: 200, message: OK} - request: - body: '{"etag": "17019ad8-4c28-4107-92e0-fcfbd198a66b", "name": "myrsa", "type": - "Microsoft.Network/dnszones/A", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa", - "properties": {"ARecords": [{"ipv4Address": "10.0.0.10"}, {"ipv4Address": "10.0.0.11"}], - "TTL": 3600}}' + body: '{"properties": {"ARecords": [{"ipv4Address": "10.0.0.10"}, {"ipv4Address": + "10.0.0.11"}], "TTL": 3600}, "type": "Microsoft.Network/dnszones/A", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa", + "etag": "48ca7c67-4f9c-4e81-8574-57271cbc8fe6", "name": "myrsa"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -1302,16 +1300,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [bfbb0798-f482-11e6-8ac9-a0b3ccf7272a] + x-ms-client-request-id: [a30e4362-f498-11e6-b778-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"829ef375-c9da-43f6-9624-5c6981c715c8","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"},{"ipv4Address":"10.0.0.11"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"8b5467df-7ef5-4572-93d7-f70fbed78754","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"},{"ipv4Address":"10.0.0.11"}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:48 GMT'] - ETag: [829ef375-c9da-43f6-9624-5c6981c715c8] + Date: ['Thu, 16 Feb 2017 22:38:28 GMT'] + ETag: [8b5467df-7ef5-4572-93d7-f70fbed78754] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1320,7 +1318,7 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['383'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11997'] status: {code: 200, message: OK} - request: body: null @@ -1332,16 +1330,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c08dad66-f482-11e6-8193-a0b3ccf7272a] + x-ms-client-request-id: [a3ee47ec-f498-11e6-be8e-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SOA/@?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SOA\/@","name":"@","type":"Microsoft.Network\/dnszones\/SOA","etag":"60f0a9ca-05e9-4d2c-91e6-68a9556d4e2f","properties":{"fqdn":"myzone.com.","TTL":3600,"SOARecord":{"email":"azuredns-hostmaster.microsoft.com","expireTime":2419200,"host":"ns1-01.azure-dns.com.","minimumTTL":300,"refreshTime":3600,"retryTime":300,"serialNumber":1}}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SOA\/@","name":"@","type":"Microsoft.Network\/dnszones\/SOA","etag":"6dfda12b-ea56-4b83-bd52-1737b5490ed3","properties":{"fqdn":"myzone.com.","TTL":3600,"SOARecord":{"email":"azuredns-hostmaster.microsoft.com","expireTime":2419200,"host":"ns1-04.azure-dns.com.","minimumTTL":300,"refreshTime":3600,"retryTime":300,"serialNumber":1}}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:49 GMT'] - ETag: [60f0a9ca-05e9-4d2c-91e6-68a9556d4e2f] + Date: ['Thu, 16 Feb 2017 22:38:29 GMT'] + ETag: [6dfda12b-ea56-4b83-bd52-1737b5490ed3] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1361,16 +1359,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c0cf8934-f482-11e6-a669-a0b3ccf7272a] + x-ms-client-request-id: [a41927cc-f498-11e6-8fb9-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SOA/@?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SOA\/@","name":"@","type":"Microsoft.Network\/dnszones\/SOA","etag":"60f0a9ca-05e9-4d2c-91e6-68a9556d4e2f","properties":{"fqdn":"myzone.com.","TTL":3600,"SOARecord":{"email":"azuredns-hostmaster.microsoft.com","expireTime":2419200,"host":"ns1-01.azure-dns.com.","minimumTTL":300,"refreshTime":3600,"retryTime":300,"serialNumber":1}}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SOA\/@","name":"@","type":"Microsoft.Network\/dnszones\/SOA","etag":"6dfda12b-ea56-4b83-bd52-1737b5490ed3","properties":{"fqdn":"myzone.com.","TTL":3600,"SOARecord":{"email":"azuredns-hostmaster.microsoft.com","expireTime":2419200,"host":"ns1-04.azure-dns.com.","minimumTTL":300,"refreshTime":3600,"retryTime":300,"serialNumber":1}}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:50 GMT'] - ETag: [60f0a9ca-05e9-4d2c-91e6-68a9556d4e2f] + Date: ['Thu, 16 Feb 2017 22:38:30 GMT'] + ETag: [6dfda12b-ea56-4b83-bd52-1737b5490ed3] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1381,11 +1379,10 @@ interactions: content-length: ['483'] status: {code: 200, message: OK} - request: - body: '{"etag": "60f0a9ca-05e9-4d2c-91e6-68a9556d4e2f", "name": "@", "type": "Microsoft.Network/dnszones/SOA", - "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SOA/@", - "properties": {"TTL": 3600, "SOARecord": {"host": "ns1-01.azure-dns.com.", "minimumTTL": - 20, "serialNumber": 123, "refreshTime": 60, "retryTime": 90, "expireTime": 30, - "email": "foo.com"}}}' + body: '{"properties": {"SOARecord": {"expireTime": 30, "refreshTime": 60, "minimumTTL": + 20, "host": "ns1-04.azure-dns.com.", "retryTime": 90, "serialNumber": 123, "email": + "foo.com"}, "TTL": 3600}, "type": "Microsoft.Network/dnszones/SOA", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SOA/@", + "etag": "6dfda12b-ea56-4b83-bd52-1737b5490ed3", "name": "@"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -1395,16 +1392,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c0f7f09e-f482-11e6-b326-a0b3ccf7272a] + x-ms-client-request-id: [a44610a4-f498-11e6-899b-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SOA/@?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SOA\/@","name":"@","type":"Microsoft.Network\/dnszones\/SOA","etag":"32bfcc94-4e2d-498b-a3b6-7065bfcd846f","properties":{"fqdn":"myzone.com.","TTL":3600,"SOARecord":{"email":"foo.com","expireTime":30,"host":"ns1-01.azure-dns.com.","minimumTTL":20,"refreshTime":60,"retryTime":90,"serialNumber":123}}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SOA\/@","name":"@","type":"Microsoft.Network\/dnszones\/SOA","etag":"fb5a847a-980f-4d86-89aa-6234791b3416","properties":{"fqdn":"myzone.com.","TTL":3600,"SOARecord":{"email":"foo.com","expireTime":30,"host":"ns1-04.azure-dns.com.","minimumTTL":20,"refreshTime":60,"retryTime":90,"serialNumber":123}}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:50 GMT'] - ETag: [32bfcc94-4e2d-498b-a3b6-7065bfcd846f] + Date: ['Thu, 16 Feb 2017 22:38:31 GMT'] + ETag: [fb5a847a-980f-4d86-89aa-6234791b3416] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1413,7 +1410,7 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['450'] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: body: null @@ -1425,7 +1422,7 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c18e1f22-f482-11e6-b57c-a0b3ccf7272a] + x-ms-client-request-id: [a4e9439c-f498-11e6-8a1e-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/TXT/longtxt?api-version=2016-04-01 response: @@ -1435,18 +1432,18 @@ interactions: Cache-Control: [private] Content-Length: ['171'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:51 GMT'] + Date: ['Thu, 16 Feb 2017 22:38:32 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11997'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 404, message: Not Found} - request: - body: '{"name": "longtxt", "type": "txt", "properties": {"TTL": 3600, "TXTRecords": - [{"value": ["012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234", - "56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"]}]}}' + body: '{"properties": {"TTL": 3600, "TXTRecords": [{"value": ["012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234", + "56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"]}]}, + "type": "txt", "name": "longtxt"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -1456,23 +1453,23 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c1cbbcfa-f482-11e6-a0e5-a0b3ccf7272a] + x-ms-client-request-id: [a5cace94-f498-11e6-ad58-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/TXT/longtxt?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/longtxt","name":"longtxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"e4d436ad-9883-4875-a86b-a7a7d1196ade","properties":{"fqdn":"longtxt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234","56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"]}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/longtxt","name":"longtxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"1e4c14a0-626f-440a-8913-46ebe815a22e","properties":{"fqdn":"longtxt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234","56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"]}]}}'} headers: Cache-Control: [private] Content-Length: ['857'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:51 GMT'] - ETag: [e4d436ad-9883-4875-a86b-a7a7d1196ade] + Date: ['Thu, 16 Feb 2017 22:38:33 GMT'] + ETag: [1e4c14a0-626f-440a-8913-46ebe815a22e] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11997'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 201, message: Created} - request: body: null @@ -1484,16 +1481,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c28da0f8-f482-11e6-9b10-a0b3ccf7272a] + x-ms-client-request-id: [a6a7df98-f498-11e6-b273-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com","name":"myzone.com","type":"Microsoft.Network\/dnszones","etag":"00000002-0000-0000-f415-d5678f88d201","location":"global","tags":{},"properties":{"maxNumberOfRecordSets":5000,"nameServers":["ns1-01.azure-dns.com.","ns2-01.azure-dns.net.","ns3-01.azure-dns.org.","ns4-01.azure-dns.info."],"numberOfRecordSets":19}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com","name":"myzone.com","type":"Microsoft.Network\/dnszones","etag":"00000002-0000-0000-364a-ed42a588d201","location":"global","tags":{},"properties":{"maxNumberOfRecordSets":5000,"nameServers":["ns1-04.azure-dns.com.","ns2-04.azure-dns.net.","ns3-04.azure-dns.org.","ns4-04.azure-dns.info."],"numberOfRecordSets":19}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:52 GMT'] - ETag: [00000002-0000-0000-f415-d5678f88d201] + Date: ['Thu, 16 Feb 2017 22:38:34 GMT'] + ETag: [00000002-0000-0000-364a-ed42a588d201] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1514,16 +1511,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c31d8646-f482-11e6-a950-a0b3ccf7272a] + x-ms-client-request-id: [a731825e-f498-11e6-97fa-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"829ef375-c9da-43f6-9624-5c6981c715c8","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"},{"ipv4Address":"10.0.0.11"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"8b5467df-7ef5-4572-93d7-f70fbed78754","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"},{"ipv4Address":"10.0.0.11"}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:53 GMT'] - ETag: [829ef375-c9da-43f6-9624-5c6981c715c8] + Date: ['Thu, 16 Feb 2017 22:38:35 GMT'] + ETag: [8b5467df-7ef5-4572-93d7-f70fbed78754] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1544,15 +1541,15 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c3abe874-f482-11e6-ba7f-a0b3ccf7272a] + x-ms-client-request-id: [a7b93e82-f498-11e6-9be7-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/recordsets?api-version=2016-04-01 response: - body: {string: '{"value":[{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/@","name":"@","type":"Microsoft.Network\/dnszones\/NS","etag":"c9f3a482-362c-4282-825c-7a9c08312e89","properties":{"fqdn":"myzone.com.","TTL":172800,"NSRecords":[{"nsdname":"ns1-01.azure-dns.com."},{"nsdname":"ns2-01.azure-dns.net."},{"nsdname":"ns3-01.azure-dns.org."},{"nsdname":"ns4-01.azure-dns.info."}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SOA\/@","name":"@","type":"Microsoft.Network\/dnszones\/SOA","etag":"32bfcc94-4e2d-498b-a3b6-7065bfcd846f","properties":{"fqdn":"myzone.com.","TTL":3600,"SOARecord":{"email":"foo.com","expireTime":30,"host":"ns1-01.azure-dns.com.","minimumTTL":20,"refreshTime":60,"retryTime":90,"serialNumber":123}}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/longtxt","name":"longtxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"e4d436ad-9883-4875-a86b-a7a7d1196ade","properties":{"fqdn":"longtxt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234","56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"]}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"829ef375-c9da-43f6-9624-5c6981c715c8","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"},{"ipv4Address":"10.0.0.11"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaa","name":"myrsaaaa","type":"Microsoft.Network\/dnszones\/AAAA","etag":"29b84cf4-54ac-45f4-9992-d600337209f2","properties":{"fqdn":"myrsaaaa.myzone.com.","TTL":3600,"AAAARecords":[{"ipv6Address":"2001:db8:0:1:1:1:1:1"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaaalt","name":"myrsaaaaalt","type":"Microsoft.Network\/dnszones\/AAAA","etag":"c85fa146-81a7-4393-8df2-fd6e42c84c8c","properties":{"fqdn":"myrsaaaaalt.myzone.com.","TTL":3600,"AAAARecords":[{"ipv6Address":"2001:db8:0:1:1:1:1:1"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsaalt","name":"myrsaalt","type":"Microsoft.Network\/dnszones\/A","etag":"67bbf38b-68d0-4d61-a9fb-461bf157cf3e","properties":{"fqdn":"myrsaalt.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscname","name":"myrscname","type":"Microsoft.Network\/dnszones\/CNAME","etag":"bca95fc8-060b-45f5-abe4-5d12ecd2856e","properties":{"fqdn":"myrscname.myzone.com.","TTL":3600,"CNAMERecord":{"cname":"mycname"}}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscnamealt","name":"myrscnamealt","type":"Microsoft.Network\/dnszones\/CNAME","etag":"9af59adb-5b8b-40e5-ae0d-5fde6f2aec12","properties":{"fqdn":"myrscnamealt.myzone.com.","TTL":3600,"CNAMERecord":{"cname":"mycname"}}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmx","name":"myrsmx","type":"Microsoft.Network\/dnszones\/MX","etag":"ab979abd-f398-463f-92cd-0da2b2b40918","properties":{"fqdn":"myrsmx.myzone.com.","TTL":3600,"MXRecords":[{"exchange":"12","preference":13}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmxalt","name":"myrsmxalt","type":"Microsoft.Network\/dnszones\/MX","etag":"5ef72ec1-f2df-46db-a7dd-bddf50ac955d","properties":{"fqdn":"myrsmxalt.myzone.com.","TTL":3600,"MXRecords":[{"exchange":"12","preference":13}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsns","name":"myrsns","type":"Microsoft.Network\/dnszones\/NS","etag":"5f236f16-7ae4-4c76-b037-57a97a8eb1d3","properties":{"fqdn":"myrsns.myzone.com.","TTL":3600,"NSRecords":[{"nsdname":"foobar.com"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsnsalt","name":"myrsnsalt","type":"Microsoft.Network\/dnszones\/NS","etag":"2189e7b7-8113-4f8c-be41-bdbc8f834484","properties":{"fqdn":"myrsnsalt.myzone.com.","TTL":3600,"NSRecords":[{"nsdname":"foobar.com"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptr","name":"myrsptr","type":"Microsoft.Network\/dnszones\/PTR","etag":"dbf1445b-687a-46d9-b690-508dcc67cf92","properties":{"fqdn":"myrsptr.myzone.com.","TTL":3600,"PTRRecords":[{"ptrdname":"foobar.com"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptralt","name":"myrsptralt","type":"Microsoft.Network\/dnszones\/PTR","etag":"1ef193c3-848e-4167-aba1-adac705382f3","properties":{"fqdn":"myrsptralt.myzone.com.","TTL":3600,"PTRRecords":[{"ptrdname":"foobar.com"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrv","name":"myrssrv","type":"Microsoft.Network\/dnszones\/SRV","etag":"d068d744-dbdc-4367-b9c5-2c59f76d3a0e","properties":{"fqdn":"myrssrv.myzone.com.","TTL":3600,"SRVRecords":[{"port":1234,"priority":1,"target":"target.com","weight":50}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrvalt","name":"myrssrvalt","type":"Microsoft.Network\/dnszones\/SRV","etag":"89c8cb7a-8185-4001-89d3-dbd906db28b2","properties":{"fqdn":"myrssrvalt.myzone.com.","TTL":3600,"SRVRecords":[{"port":1234,"priority":1,"target":"target.com","weight":50}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxt","name":"myrstxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"13d16c46-68f3-4f5f-8f55-de9a2d5ea7b7","properties":{"fqdn":"myrstxt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["some_text"]}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxtalt","name":"myrstxtalt","type":"Microsoft.Network\/dnszones\/TXT","etag":"65de52a1-1242-4d86-81fd-10e1bafe5b45","properties":{"fqdn":"myrstxtalt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["some_text"]}]}}]}'} + body: {string: '{"value":[{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/@","name":"@","type":"Microsoft.Network\/dnszones\/NS","etag":"457f44cd-0da1-4b56-94da-01fe1211ec7b","properties":{"fqdn":"myzone.com.","TTL":172800,"NSRecords":[{"nsdname":"ns1-04.azure-dns.com."},{"nsdname":"ns2-04.azure-dns.net."},{"nsdname":"ns3-04.azure-dns.org."},{"nsdname":"ns4-04.azure-dns.info."}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SOA\/@","name":"@","type":"Microsoft.Network\/dnszones\/SOA","etag":"fb5a847a-980f-4d86-89aa-6234791b3416","properties":{"fqdn":"myzone.com.","TTL":3600,"SOARecord":{"email":"foo.com","expireTime":30,"host":"ns1-04.azure-dns.com.","minimumTTL":20,"refreshTime":60,"retryTime":90,"serialNumber":123}}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/longtxt","name":"longtxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"1e4c14a0-626f-440a-8913-46ebe815a22e","properties":{"fqdn":"longtxt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234","56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"]}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"8b5467df-7ef5-4572-93d7-f70fbed78754","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"},{"ipv4Address":"10.0.0.11"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaa","name":"myrsaaaa","type":"Microsoft.Network\/dnszones\/AAAA","etag":"188f3b1d-e078-489d-8be5-f086455251d6","properties":{"fqdn":"myrsaaaa.myzone.com.","TTL":3600,"AAAARecords":[{"ipv6Address":"2001:db8:0:1:1:1:1:1"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaaalt","name":"myrsaaaaalt","type":"Microsoft.Network\/dnszones\/AAAA","etag":"bb4af783-4e50-4789-a221-6d9720fb7906","properties":{"fqdn":"myrsaaaaalt.myzone.com.","TTL":3600,"AAAARecords":[{"ipv6Address":"2001:db8:0:1:1:1:1:1"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsaalt","name":"myrsaalt","type":"Microsoft.Network\/dnszones\/A","etag":"7b98d8ff-b2ec-4bf8-a55a-95474ed026f9","properties":{"fqdn":"myrsaalt.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscname","name":"myrscname","type":"Microsoft.Network\/dnszones\/CNAME","etag":"d3ca537b-0e21-42fd-9aeb-5e6f69437c3d","properties":{"fqdn":"myrscname.myzone.com.","TTL":3600,"CNAMERecord":{"cname":"mycname"}}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscnamealt","name":"myrscnamealt","type":"Microsoft.Network\/dnszones\/CNAME","etag":"22477145-0695-49fd-bedf-5e7c814fe6e4","properties":{"fqdn":"myrscnamealt.myzone.com.","TTL":3600,"CNAMERecord":{"cname":"mycname"}}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmx","name":"myrsmx","type":"Microsoft.Network\/dnszones\/MX","etag":"c7a5da5c-a17a-4759-8fc6-bc182a17a254","properties":{"fqdn":"myrsmx.myzone.com.","TTL":3600,"MXRecords":[{"exchange":"12","preference":13}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmxalt","name":"myrsmxalt","type":"Microsoft.Network\/dnszones\/MX","etag":"abb6c9dd-42c5-41d5-9d90-402b85100832","properties":{"fqdn":"myrsmxalt.myzone.com.","TTL":3600,"MXRecords":[{"exchange":"12","preference":13}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsns","name":"myrsns","type":"Microsoft.Network\/dnszones\/NS","etag":"e1774943-72fa-4c2d-b8a2-c381216df40f","properties":{"fqdn":"myrsns.myzone.com.","TTL":3600,"NSRecords":[{"nsdname":"foobar.com"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsnsalt","name":"myrsnsalt","type":"Microsoft.Network\/dnszones\/NS","etag":"b170e487-a2a6-4172-961a-604139a6f7e7","properties":{"fqdn":"myrsnsalt.myzone.com.","TTL":3600,"NSRecords":[{"nsdname":"foobar.com"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptr","name":"myrsptr","type":"Microsoft.Network\/dnszones\/PTR","etag":"05f53f84-a98d-416c-b1d8-a06865ab0068","properties":{"fqdn":"myrsptr.myzone.com.","TTL":3600,"PTRRecords":[{"ptrdname":"foobar.com"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptralt","name":"myrsptralt","type":"Microsoft.Network\/dnszones\/PTR","etag":"b0e6755b-bada-4396-a94f-e58a3c404f58","properties":{"fqdn":"myrsptralt.myzone.com.","TTL":3600,"PTRRecords":[{"ptrdname":"foobar.com"}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrv","name":"myrssrv","type":"Microsoft.Network\/dnszones\/SRV","etag":"e2760f4e-601c-4aad-a2ad-815bd4b75b8b","properties":{"fqdn":"myrssrv.myzone.com.","TTL":3600,"SRVRecords":[{"port":1234,"priority":1,"target":"target.com","weight":50}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrvalt","name":"myrssrvalt","type":"Microsoft.Network\/dnszones\/SRV","etag":"dc74cba5-3626-40c6-815b-a6321e6439a7","properties":{"fqdn":"myrssrvalt.myzone.com.","TTL":3600,"SRVRecords":[{"port":1234,"priority":1,"target":"target.com","weight":50}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxt","name":"myrstxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"fd71221b-1134-4a6b-877f-b6b0b0c12f4c","properties":{"fqdn":"myrstxt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["some_text"]}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxtalt","name":"myrstxtalt","type":"Microsoft.Network\/dnszones\/TXT","etag":"b748c7bc-384a-48d0-a23a-cbc63a5cd148","properties":{"fqdn":"myrstxtalt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["some_text"]}]}}]}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:54 GMT'] + Date: ['Thu, 16 Feb 2017 22:38:36 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1572,15 +1569,15 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c4481d3e-f482-11e6-b6c5-a0b3ccf7272a] + x-ms-client-request-id: [a852d2b4-f498-11e6-af46-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/TXT?api-version=2016-04-01 response: - body: {string: '{"value":[{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/longtxt","name":"longtxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"e4d436ad-9883-4875-a86b-a7a7d1196ade","properties":{"fqdn":"longtxt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234","56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"]}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxt","name":"myrstxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"13d16c46-68f3-4f5f-8f55-de9a2d5ea7b7","properties":{"fqdn":"myrstxt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["some_text"]}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxtalt","name":"myrstxtalt","type":"Microsoft.Network\/dnszones\/TXT","etag":"65de52a1-1242-4d86-81fd-10e1bafe5b45","properties":{"fqdn":"myrstxtalt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["some_text"]}]}}]}'} + body: {string: '{"value":[{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/longtxt","name":"longtxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"1e4c14a0-626f-440a-8913-46ebe815a22e","properties":{"fqdn":"longtxt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234","56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"]}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxt","name":"myrstxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"fd71221b-1134-4a6b-877f-b6b0b0c12f4c","properties":{"fqdn":"myrstxt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["some_text"]}]}},{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxtalt","name":"myrstxtalt","type":"Microsoft.Network\/dnszones\/TXT","etag":"b748c7bc-384a-48d0-a23a-cbc63a5cd148","properties":{"fqdn":"myrstxtalt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["some_text"]}]}}]}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:55 GMT'] + Date: ['Thu, 16 Feb 2017 22:38:37 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1589,7 +1586,7 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['1606'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] status: {code: 200, message: OK} - request: body: null @@ -1601,16 +1598,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c4cc1164-f482-11e6-a210-a0b3ccf7272a] + x-ms-client-request-id: [a8d6de0a-f498-11e6-8ba6-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"829ef375-c9da-43f6-9624-5c6981c715c8","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"},{"ipv4Address":"10.0.0.11"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"8b5467df-7ef5-4572-93d7-f70fbed78754","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.10"},{"ipv4Address":"10.0.0.11"}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:56 GMT'] - ETag: [829ef375-c9da-43f6-9624-5c6981c715c8] + Date: ['Thu, 16 Feb 2017 22:38:39 GMT'] + ETag: [8b5467df-7ef5-4572-93d7-f70fbed78754] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1619,12 +1616,12 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['383'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: - body: '{"etag": "829ef375-c9da-43f6-9624-5c6981c715c8", "name": "myrsa", "type": - "Microsoft.Network/dnszones/A", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa", - "properties": {"ARecords": [{"ipv4Address": "10.0.0.11"}], "TTL": 3600}}' + body: '{"properties": {"ARecords": [{"ipv4Address": "10.0.0.11"}], "TTL": 3600}, + "type": "Microsoft.Network/dnszones/A", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa", + "etag": "8b5467df-7ef5-4572-93d7-f70fbed78754", "name": "myrsa"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -1634,16 +1631,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c4f32fa2-f482-11e6-afef-a0b3ccf7272a] + x-ms-client-request-id: [a91ff054-f498-11e6-8a71-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"916e1019-722a-4541-a2a3-b375a1028afd","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.11"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"bad3346f-63a8-41d9-a4b3-b241bd0ba609","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.11"}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:56 GMT'] - ETag: [916e1019-722a-4541-a2a3-b375a1028afd] + Date: ['Thu, 16 Feb 2017 22:38:38 GMT'] + ETag: [bad3346f-63a8-41d9-a4b3-b241bd0ba609] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1664,16 +1661,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c58b0940-f482-11e6-9416-a0b3ccf7272a] + x-ms-client-request-id: [a9c22282-f498-11e6-8957-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/AAAA/myrsaaaa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaa","name":"myrsaaaa","type":"Microsoft.Network\/dnszones\/AAAA","etag":"29b84cf4-54ac-45f4-9992-d600337209f2","properties":{"fqdn":"myrsaaaa.myzone.com.","TTL":3600,"AAAARecords":[{"ipv6Address":"2001:db8:0:1:1:1:1:1"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaa","name":"myrsaaaa","type":"Microsoft.Network\/dnszones\/AAAA","etag":"188f3b1d-e078-489d-8be5-f086455251d6","properties":{"fqdn":"myrsaaaa.myzone.com.","TTL":3600,"AAAARecords":[{"ipv6Address":"2001:db8:0:1:1:1:1:1"}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:57 GMT'] - ETag: [29b84cf4-54ac-45f4-9992-d600337209f2] + Date: ['Thu, 16 Feb 2017 22:38:39 GMT'] + ETag: [188f3b1d-e078-489d-8be5-f086455251d6] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1682,12 +1679,12 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['384'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: - body: '{"etag": "29b84cf4-54ac-45f4-9992-d600337209f2", "name": "myrsaaaa", "type": - "Microsoft.Network/dnszones/AAAA", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/AAAA/myrsaaaa", - "properties": {"AAAARecords": [], "TTL": 3600}}' + body: '{"properties": {"TTL": 3600, "AAAARecords": []}, "type": "Microsoft.Network/dnszones/AAAA", + "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/AAAA/myrsaaaa", + "etag": "188f3b1d-e078-489d-8be5-f086455251d6", "name": "myrsaaaa"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -1697,16 +1694,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c5d0bc4a-f482-11e6-ba69-a0b3ccf7272a] + x-ms-client-request-id: [aa09bf6e-f498-11e6-96df-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/AAAA/myrsaaaa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaa","name":"myrsaaaa","type":"Microsoft.Network\/dnszones\/AAAA","etag":"391195d6-68e3-4f4c-89c5-189649c05c24","properties":{"fqdn":"myrsaaaa.myzone.com.","TTL":3600,"AAAARecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/AAAA\/myrsaaaa","name":"myrsaaaa","type":"Microsoft.Network\/dnszones\/AAAA","etag":"fb8e0b40-dca8-48d3-ae11-93a0a976be8e","properties":{"fqdn":"myrsaaaa.myzone.com.","TTL":3600,"AAAARecords":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:58 GMT'] - ETag: [391195d6-68e3-4f4c-89c5-189649c05c24] + Date: ['Thu, 16 Feb 2017 22:38:40 GMT'] + ETag: [fb8e0b40-dca8-48d3-ae11-93a0a976be8e] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1715,7 +1712,7 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['346'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: body: null @@ -1727,16 +1724,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c684b40a-f482-11e6-9263-a0b3ccf7272a] + x-ms-client-request-id: [aac7b2a2-f498-11e6-b0a7-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/CNAME/myrscname?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscname","name":"myrscname","type":"Microsoft.Network\/dnszones\/CNAME","etag":"bca95fc8-060b-45f5-abe4-5d12ecd2856e","properties":{"fqdn":"myrscname.myzone.com.","TTL":3600,"CNAMERecord":{"cname":"mycname"}}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscname","name":"myrscname","type":"Microsoft.Network\/dnszones\/CNAME","etag":"d3ca537b-0e21-42fd-9aeb-5e6f69437c3d","properties":{"fqdn":"myrscname.myzone.com.","TTL":3600,"CNAMERecord":{"cname":"mycname"}}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:59 GMT'] - ETag: [bca95fc8-060b-45f5-abe4-5d12ecd2856e] + Date: ['Thu, 16 Feb 2017 22:38:41 GMT'] + ETag: [d3ca537b-0e21-42fd-9aeb-5e6f69437c3d] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1748,9 +1745,9 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] status: {code: 200, message: OK} - request: - body: '{"etag": "bca95fc8-060b-45f5-abe4-5d12ecd2856e", "name": "myrscname", "type": - "Microsoft.Network/dnszones/CNAME", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/CNAME/myrscname", - "properties": {"TTL": 3600}}' + body: '{"properties": {"TTL": 3600}, "type": "Microsoft.Network/dnszones/CNAME", + "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/CNAME/myrscname", + "etag": "d3ca537b-0e21-42fd-9aeb-5e6f69437c3d", "name": "myrscname"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -1760,16 +1757,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c6a531e2-f482-11e6-839e-a0b3ccf7272a] + x-ms-client-request-id: [aaeebd7a-f498-11e6-94d1-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/CNAME/myrscname?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscname","name":"myrscname","type":"Microsoft.Network\/dnszones\/CNAME","etag":"f21de5fb-1760-49c0-9fd0-9006ca15b9e4","properties":{"fqdn":"myrscname.myzone.com.","TTL":3600}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/CNAME\/myrscname","name":"myrscname","type":"Microsoft.Network\/dnszones\/CNAME","etag":"c1ee49dd-f0d8-4908-8ac6-9ae637127e25","properties":{"fqdn":"myrscname.myzone.com.","TTL":3600}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:01:59 GMT'] - ETag: [f21de5fb-1760-49c0-9fd0-9006ca15b9e4] + Date: ['Thu, 16 Feb 2017 22:38:42 GMT'] + ETag: [c1ee49dd-f0d8-4908-8ac6-9ae637127e25] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1778,7 +1775,7 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['334'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: body: null @@ -1790,16 +1787,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c754d706-f482-11e6-bef1-a0b3ccf7272a] + x-ms-client-request-id: [abba4674-f498-11e6-9fce-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/MX/myrsmx?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmx","name":"myrsmx","type":"Microsoft.Network\/dnszones\/MX","etag":"ab979abd-f398-463f-92cd-0da2b2b40918","properties":{"fqdn":"myrsmx.myzone.com.","TTL":3600,"MXRecords":[{"exchange":"12","preference":13}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmx","name":"myrsmx","type":"Microsoft.Network\/dnszones\/MX","etag":"c7a5da5c-a17a-4759-8fc6-bc182a17a254","properties":{"fqdn":"myrsmx.myzone.com.","TTL":3600,"MXRecords":[{"exchange":"12","preference":13}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:02:00 GMT'] - ETag: [ab979abd-f398-463f-92cd-0da2b2b40918] + Date: ['Thu, 16 Feb 2017 22:38:43 GMT'] + ETag: [c7a5da5c-a17a-4759-8fc6-bc182a17a254] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1808,12 +1805,12 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['367'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: - body: '{"etag": "ab979abd-f398-463f-92cd-0da2b2b40918", "name": "myrsmx", "type": - "Microsoft.Network/dnszones/MX", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/MX/myrsmx", - "properties": {"TTL": 3600, "MXRecords": []}}' + body: '{"properties": {"TTL": 3600, "MXRecords": []}, "type": "Microsoft.Network/dnszones/MX", + "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/MX/myrsmx", + "etag": "c7a5da5c-a17a-4759-8fc6-bc182a17a254", "name": "myrsmx"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -1823,16 +1820,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c79ed110-f482-11e6-aef4-a0b3ccf7272a] + x-ms-client-request-id: [abe02a5c-f498-11e6-a204-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/MX/myrsmx?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmx","name":"myrsmx","type":"Microsoft.Network\/dnszones\/MX","etag":"986608d6-1ea0-4427-8a44-4d1e9e5f7fe5","properties":{"fqdn":"myrsmx.myzone.com.","TTL":3600,"MXRecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/MX\/myrsmx","name":"myrsmx","type":"Microsoft.Network\/dnszones\/MX","etag":"929a2d35-ed5a-472e-9f99-cc57bccc1d5b","properties":{"fqdn":"myrsmx.myzone.com.","TTL":3600,"MXRecords":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:02:01 GMT'] - ETag: [986608d6-1ea0-4427-8a44-4d1e9e5f7fe5] + Date: ['Thu, 16 Feb 2017 22:38:43 GMT'] + ETag: [929a2d35-ed5a-472e-9f99-cc57bccc1d5b] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1841,7 +1838,7 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['334'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11997'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: body: null @@ -1853,16 +1850,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c858314c-f482-11e6-8503-a0b3ccf7272a] + x-ms-client-request-id: [ac91006e-f498-11e6-b854-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/NS/myrsns?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsns","name":"myrsns","type":"Microsoft.Network\/dnszones\/NS","etag":"5f236f16-7ae4-4c76-b037-57a97a8eb1d3","properties":{"fqdn":"myrsns.myzone.com.","TTL":3600,"NSRecords":[{"nsdname":"foobar.com"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsns","name":"myrsns","type":"Microsoft.Network\/dnszones\/NS","etag":"e1774943-72fa-4c2d-b8a2-c381216df40f","properties":{"fqdn":"myrsns.myzone.com.","TTL":3600,"NSRecords":[{"nsdname":"foobar.com"}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:02:01 GMT'] - ETag: [5f236f16-7ae4-4c76-b037-57a97a8eb1d3] + Date: ['Thu, 16 Feb 2017 22:38:45 GMT'] + ETag: [e1774943-72fa-4c2d-b8a2-c381216df40f] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1873,9 +1870,9 @@ interactions: content-length: ['358'] status: {code: 200, message: OK} - request: - body: '{"etag": "5f236f16-7ae4-4c76-b037-57a97a8eb1d3", "name": "myrsns", "type": - "Microsoft.Network/dnszones/NS", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/NS/myrsns", - "properties": {"NSRecords": [], "TTL": 3600}}' + body: '{"properties": {"NSRecords": [], "TTL": 3600}, "type": "Microsoft.Network/dnszones/NS", + "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/NS/myrsns", + "etag": "e1774943-72fa-4c2d-b8a2-c381216df40f", "name": "myrsns"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -1885,16 +1882,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c87f16a2-f482-11e6-878e-a0b3ccf7272a] + x-ms-client-request-id: [acba5c2c-f498-11e6-9ff3-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/NS/myrsns?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsns","name":"myrsns","type":"Microsoft.Network\/dnszones\/NS","etag":"84698dc9-cc45-4249-8cb8-62d5b5ec6392","properties":{"fqdn":"myrsns.myzone.com.","TTL":3600,"NSRecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/NS\/myrsns","name":"myrsns","type":"Microsoft.Network\/dnszones\/NS","etag":"6e36bc0f-8c91-4089-bef6-013019bf1425","properties":{"fqdn":"myrsns.myzone.com.","TTL":3600,"NSRecords":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:02:02 GMT'] - ETag: [84698dc9-cc45-4249-8cb8-62d5b5ec6392] + Date: ['Thu, 16 Feb 2017 22:38:45 GMT'] + ETag: [6e36bc0f-8c91-4089-bef6-013019bf1425] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1903,7 +1900,7 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['334'] - x-ms-ratelimit-remaining-subscription-writes: ['1196'] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 200, message: OK} - request: body: null @@ -1915,16 +1912,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c9224926-f482-11e6-b95b-a0b3ccf7272a] + x-ms-client-request-id: [ad89ae7a-f498-11e6-82bc-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/PTR/myrsptr?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptr","name":"myrsptr","type":"Microsoft.Network\/dnszones\/PTR","etag":"dbf1445b-687a-46d9-b690-508dcc67cf92","properties":{"fqdn":"myrsptr.myzone.com.","TTL":3600,"PTRRecords":[{"ptrdname":"foobar.com"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptr","name":"myrsptr","type":"Microsoft.Network\/dnszones\/PTR","etag":"05f53f84-a98d-416c-b1d8-a06865ab0068","properties":{"fqdn":"myrsptr.myzone.com.","TTL":3600,"PTRRecords":[{"ptrdname":"foobar.com"}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:02:04 GMT'] - ETag: [dbf1445b-687a-46d9-b690-508dcc67cf92] + Date: ['Thu, 16 Feb 2017 22:38:46 GMT'] + ETag: [05f53f84-a98d-416c-b1d8-a06865ab0068] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1936,9 +1933,9 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: - body: '{"etag": "dbf1445b-687a-46d9-b690-508dcc67cf92", "name": "myrsptr", "type": - "Microsoft.Network/dnszones/PTR", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/PTR/myrsptr", - "properties": {"TTL": 3600, "PTRRecords": []}}' + body: '{"properties": {"PTRRecords": [], "TTL": 3600}, "type": "Microsoft.Network/dnszones/PTR", + "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/PTR/myrsptr", + "etag": "05f53f84-a98d-416c-b1d8-a06865ab0068", "name": "myrsptr"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -1948,16 +1945,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [c961c080-f482-11e6-a000-a0b3ccf7272a] + x-ms-client-request-id: [add40aba-f498-11e6-b471-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/PTR/myrsptr?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptr","name":"myrsptr","type":"Microsoft.Network\/dnszones\/PTR","etag":"0c407d70-8863-481c-945a-3bea7700117d","properties":{"fqdn":"myrsptr.myzone.com.","TTL":3600,"PTRRecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/PTR\/myrsptr","name":"myrsptr","type":"Microsoft.Network\/dnszones\/PTR","etag":"af69ac14-b26f-4cc2-97b3-4279ef08257a","properties":{"fqdn":"myrsptr.myzone.com.","TTL":3600,"PTRRecords":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:02:04 GMT'] - ETag: [0c407d70-8863-481c-945a-3bea7700117d] + Date: ['Thu, 16 Feb 2017 22:38:47 GMT'] + ETag: [af69ac14-b26f-4cc2-97b3-4279ef08257a] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1978,16 +1975,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ca3fb4a8-f482-11e6-a8f9-a0b3ccf7272a] + x-ms-client-request-id: [ae9de8dc-f498-11e6-ae84-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SRV/myrssrv?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrv","name":"myrssrv","type":"Microsoft.Network\/dnszones\/SRV","etag":"d068d744-dbdc-4367-b9c5-2c59f76d3a0e","properties":{"fqdn":"myrssrv.myzone.com.","TTL":3600,"SRVRecords":[{"port":1234,"priority":1,"target":"target.com","weight":50}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrv","name":"myrssrv","type":"Microsoft.Network\/dnszones\/SRV","etag":"e2760f4e-601c-4aad-a2ad-815bd4b75b8b","properties":{"fqdn":"myrssrv.myzone.com.","TTL":3600,"SRVRecords":[{"port":1234,"priority":1,"target":"target.com","weight":50}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:02:05 GMT'] - ETag: [d068d744-dbdc-4367-b9c5-2c59f76d3a0e] + Date: ['Thu, 16 Feb 2017 22:38:47 GMT'] + ETag: [e2760f4e-601c-4aad-a2ad-815bd4b75b8b] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -1996,12 +1993,12 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['400'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: - body: '{"etag": "d068d744-dbdc-4367-b9c5-2c59f76d3a0e", "name": "myrssrv", "type": - "Microsoft.Network/dnszones/SRV", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SRV/myrssrv", - "properties": {"TTL": 3600, "SRVRecords": []}}' + body: '{"properties": {"TTL": 3600, "SRVRecords": []}, "type": "Microsoft.Network/dnszones/SRV", + "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SRV/myrssrv", + "etag": "e2760f4e-601c-4aad-a2ad-815bd4b75b8b", "name": "myrssrv"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -2011,16 +2008,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ca771088-f482-11e6-8209-a0b3ccf7272a] + x-ms-client-request-id: [aee63a46-f498-11e6-b582-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/SRV/myrssrv?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrv","name":"myrssrv","type":"Microsoft.Network\/dnszones\/SRV","etag":"ce4d8fd5-d1c4-4226-b0b1-1b459860fab5","properties":{"fqdn":"myrssrv.myzone.com.","TTL":3600,"SRVRecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/SRV\/myrssrv","name":"myrssrv","type":"Microsoft.Network\/dnszones\/SRV","etag":"dabaf73c-9c8d-435b-9e34-2ff1fd00b952","properties":{"fqdn":"myrssrv.myzone.com.","TTL":3600,"SRVRecords":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:02:06 GMT'] - ETag: [ce4d8fd5-d1c4-4226-b0b1-1b459860fab5] + Date: ['Thu, 16 Feb 2017 22:38:48 GMT'] + ETag: [dabaf73c-9c8d-435b-9e34-2ff1fd00b952] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -2029,7 +2026,7 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['340'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: body: null @@ -2041,16 +2038,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [cb4caf6e-f482-11e6-9fa9-a0b3ccf7272a] + x-ms-client-request-id: [afb3c04c-f498-11e6-bc01-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/TXT/myrstxt?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxt","name":"myrstxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"13d16c46-68f3-4f5f-8f55-de9a2d5ea7b7","properties":{"fqdn":"myrstxt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["some_text"]}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxt","name":"myrstxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"fd71221b-1134-4a6b-877f-b6b0b0c12f4c","properties":{"fqdn":"myrstxt.myzone.com.","TTL":3600,"TXTRecords":[{"value":["some_text"]}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:02:07 GMT'] - ETag: [13d16c46-68f3-4f5f-8f55-de9a2d5ea7b7] + Date: ['Thu, 16 Feb 2017 22:38:49 GMT'] + ETag: [fd71221b-1134-4a6b-877f-b6b0b0c12f4c] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -2062,9 +2059,9 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] status: {code: 200, message: OK} - request: - body: '{"etag": "13d16c46-68f3-4f5f-8f55-de9a2d5ea7b7", "name": "myrstxt", "type": - "Microsoft.Network/dnszones/TXT", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/TXT/myrstxt", - "properties": {"TTL": 3600, "TXTRecords": []}}' + body: '{"properties": {"TTL": 3600, "TXTRecords": []}, "type": "Microsoft.Network/dnszones/TXT", + "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/TXT/myrstxt", + "etag": "fd71221b-1134-4a6b-877f-b6b0b0c12f4c", "name": "myrstxt"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -2074,16 +2071,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [cb722aa4-f482-11e6-b15e-a0b3ccf7272a] + x-ms-client-request-id: [b0011f52-f498-11e6-b843-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/TXT/myrstxt?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxt","name":"myrstxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"55528656-3f8a-4b34-b2aa-2f64c07c3a54","properties":{"fqdn":"myrstxt.myzone.com.","TTL":3600,"TXTRecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/TXT\/myrstxt","name":"myrstxt","type":"Microsoft.Network\/dnszones\/TXT","etag":"e38648b8-5788-4796-b376-cdebfa14cc66","properties":{"fqdn":"myrstxt.myzone.com.","TTL":3600,"TXTRecords":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:02:07 GMT'] - ETag: [55528656-3f8a-4b34-b2aa-2f64c07c3a54] + Date: ['Thu, 16 Feb 2017 22:38:50 GMT'] + ETag: [e38648b8-5788-4796-b376-cdebfa14cc66] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -2104,16 +2101,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [cc1c7662-f482-11e6-b4b2-a0b3ccf7272a] + x-ms-client-request-id: [b0ce9d36-f498-11e6-8b63-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"916e1019-722a-4541-a2a3-b375a1028afd","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.11"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"bad3346f-63a8-41d9-a4b3-b241bd0ba609","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.11"}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:02:08 GMT'] - ETag: [916e1019-722a-4541-a2a3-b375a1028afd] + Date: ['Thu, 16 Feb 2017 22:38:51 GMT'] + ETag: [bad3346f-63a8-41d9-a4b3-b241bd0ba609] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -2134,16 +2131,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ccad22c8-f482-11e6-9b09-a0b3ccf7272a] + x-ms-client-request-id: [b159a948-f498-11e6-87d9-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"916e1019-722a-4541-a2a3-b375a1028afd","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.11"}]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"bad3346f-63a8-41d9-a4b3-b241bd0ba609","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[{"ipv4Address":"10.0.0.11"}]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:02:09 GMT'] - ETag: [916e1019-722a-4541-a2a3-b375a1028afd] + Date: ['Thu, 16 Feb 2017 22:38:52 GMT'] + ETag: [bad3346f-63a8-41d9-a4b3-b241bd0ba609] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -2152,12 +2149,12 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['355'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] status: {code: 200, message: OK} - request: - body: '{"etag": "916e1019-722a-4541-a2a3-b375a1028afd", "name": "myrsa", "type": - "Microsoft.Network/dnszones/A", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa", - "properties": {"ARecords": [], "TTL": 3600}}' + body: '{"properties": {"ARecords": [], "TTL": 3600}, "type": "Microsoft.Network/dnszones/A", + "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa", + "etag": "bad3346f-63a8-41d9-a4b3-b241bd0ba609", "name": "myrsa"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -2167,16 +2164,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ccf31152-f482-11e6-ab51-a0b3ccf7272a] + x-ms-client-request-id: [b19ce99c-f498-11e6-839d-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"98ae9678-f4bc-4c75-bba9-06ebe0e9ed26","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"733c8f1a-14e9-43f2-bb84-2ece6ac1c226","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:02:10 GMT'] - ETag: [98ae9678-f4bc-4c75-bba9-06ebe0e9ed26] + Date: ['Thu, 16 Feb 2017 22:38:53 GMT'] + ETag: [733c8f1a-14e9-43f2-bb84-2ece6ac1c226] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -2185,7 +2182,7 @@ interactions: X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] content-length: ['328'] - x-ms-ratelimit-remaining-subscription-resource-requests: ['11999'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['11998'] status: {code: 200, message: OK} - request: body: null @@ -2197,16 +2194,16 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [cdb2eb24-f482-11e6-aad8-a0b3ccf7272a] + x-ms-client-request-id: [b260b95a-f498-11e6-8ef5-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa?api-version=2016-04-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"98ae9678-f4bc-4c75-bba9-06ebe0e9ed26","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_dns\/providers\/Microsoft.Network\/dnszones\/myzone.com\/A\/myrsa","name":"myrsa","type":"Microsoft.Network\/dnszones\/A","etag":"733c8f1a-14e9-43f2-bb84-2ece6ac1c226","properties":{"fqdn":"myrsa.myzone.com.","TTL":3600,"ARecords":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:02:11 GMT'] - ETag: [98ae9678-f4bc-4c75-bba9-06ebe0e9ed26] + Date: ['Thu, 16 Feb 2017 22:38:54 GMT'] + ETag: [733c8f1a-14e9-43f2-bb84-2ece6ac1c226] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -2228,7 +2225,7 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [ce253ab6-f482-11e6-ae40-a0b3ccf7272a] + x-ms-client-request-id: [b2e6b4d4-f498-11e6-9ab6-a0b3ccf7272a] method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa?api-version=2016-04-01 response: @@ -2236,7 +2233,7 @@ interactions: headers: Cache-Control: [private] Content-Length: ['0'] - Date: ['Thu, 16 Feb 2017 20:02:12 GMT'] + Date: ['Thu, 16 Feb 2017 22:38:56 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] @@ -2254,7 +2251,7 @@ interactions: User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 msrest_azure/0.4.7 dnsmanagementclient/0.30.0rc6 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] accept-language: [en-US] - x-ms-client-request-id: [cefc93da-f482-11e6-82c1-a0b3ccf7272a] + x-ms-client-request-id: [b3b7eec2-f498-11e6-a480-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns/providers/Microsoft.Network/dnszones/myzone.com/A/myrsa?api-version=2016-04-01 response: @@ -2264,7 +2261,7 @@ interactions: Cache-Control: [private] Content-Length: ['169'] Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 16 Feb 2017 20:02:13 GMT'] + Date: ['Thu, 16 Feb 2017 22:38:56 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py index efe93ab1c..60effa634 100644 --- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py @@ -1209,27 +1209,28 @@ class NetworkDnsScenarioTest(ResourceGroupVCRTestBase): for t in record_types: # test creating the record set and then adding records - self.cmd('network dns record-set create -n myrs{0} -g {1} --zone-name {2} --type {0}' + self.cmd('network dns record-set {0} create -n myrs{0} -g {1} --zone-name {2}' .format(t, rg, zone_name)) - self.cmd('network dns record {0} add -g {1} --zone-name {2} --record-set-name myrs{0} {3}' - .format(t, rg, zone_name, args[t])) + add_command = 'set-record' if t == 'cname' else 'add-record' + self.cmd('network dns record-set {0} {4} -g {1} --zone-name {2} --record-set-name myrs{0} {3}' + .format(t, rg, zone_name, args[t], add_command)) # test creating the record set at the same time you add records - self.cmd('network dns record {0} add -g {1} --zone-name {2} --record-set-name myrs{0}alt {3}' - .format(t, rg, zone_name, args[t])) + self.cmd('network dns record-set {0} {4} -g {1} --zone-name {2} --record-set-name myrs{0}alt {3}' + .format(t, rg, zone_name, args[t], add_command)) - self.cmd('network dns record {0} add -g {1} --zone-name {2} --record-set-name myrs{0} {3}' + self.cmd('network dns record-set {0} add-record -g {1} --zone-name {2} --record-set-name myrs{0} {3}' .format('a', rg, zone_name, '--ipv4-address 10.0.0.11')) - self.cmd('network dns record update-soa -g {0} --zone-name {1} {2}' + self.cmd('network dns record-set soa update -g {0} --zone-name {1} {2}' .format(rg, zone_name, args['soa'])) long_value = '0123456789' * 50 - self.cmd('network dns record txt add -g {} -z {} -n longtxt -v {}'.format(rg, zone_name, long_value)) + self.cmd('network dns record-set txt add-record -g {} -z {} -n longtxt -v {}'.format(rg, zone_name, long_value)) typed_record_sets = 2 * len(record_types) + 1 self.cmd('network dns zone show -n {} -g {}'.format(zone_name, rg), checks=[ JMESPathCheck('numberOfRecordSets', base_record_sets + typed_record_sets) ]) - self.cmd('network dns record-set show -n myrs{0} -g {1} --type {0} --zone-name {2}' + self.cmd('network dns record-set {0} show -n myrs{0} -g {1} --zone-name {2}' .format('a', rg, zone_name), checks=[ JMESPathCheck('length(arecords)', 2) ]) @@ -1238,27 +1239,27 @@ class NetworkDnsScenarioTest(ResourceGroupVCRTestBase): self.cmd('network dns record-set list -g {} -z {}'.format(rg, zone_name), checks=JMESPathCheck('length(@)', base_record_sets + typed_record_sets)) - self.cmd('network dns record-set list -g {} -z {} --type txt'.format(rg, zone_name), + self.cmd('network dns record-set txt list -g {} -z {}'.format(rg, zone_name), checks=JMESPathCheck('length(@)', 3)) for t in record_types: - self.cmd('network dns record {0} remove -g {1} --zone-name {2} --record-set-name myrs{0} {3}' + self.cmd('network dns record-set {0} remove-record -g {1} --zone-name {2} --record-set-name myrs{0} {3}' .format(t, rg, zone_name, args[t])) - self.cmd('network dns record-set show -n myrs{0} -g {1} --type {0} --zone-name {2}' + self.cmd('network dns record-set {0} show -n myrs{0} -g {1} --zone-name {2}' .format('a', rg, zone_name), checks=[ JMESPathCheck('length(arecords)', 1) ]) - self.cmd('network dns record {0} remove -g {1} --zone-name {2} --record-set-name myrs{0} {3}' + self.cmd('network dns record-set {0} remove-record -g {1} --zone-name {2} --record-set-name myrs{0} {3}' .format('a', rg, zone_name, '--ipv4-address 10.0.0.11')) - self.cmd('network dns record-set show -n myrs{0} -g {1} --type {0} --zone-name {2}' + self.cmd('network dns record-set {0} show -n myrs{0} -g {1} --zone-name {2}' .format('a', rg, zone_name), checks=[ JMESPathCheck('arecords', None) ]) - self.cmd('network dns record-set delete -n myrs{0} -g {1} --type {0} --zone-name {2}' + self.cmd('network dns record-set {0} delete -n myrs{0} -g {1} --zone-name {2}' .format('a', rg, zone_name)) - self.cmd('network dns record-set show -n myrs{0} -g {1} --type {0} --zone-name {2}' + self.cmd('network dns record-set {0} show -n myrs{0} -g {1} --zone-name {2}' .format('a', rg, zone_name), allowed_exceptions='does not exist in resource group') class NetworkZoneImportExportTest(ResourceGroupVCRTestBase):
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": -1, "issue_text_score": 0, "test_score": -1 }, "num_modified_files": 7 }
0.1
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc libssl-dev libffi-dev" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==0.4.3 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==1.4.9 attrs==22.2.0 autopep8==1.2.4 azure-batch==1.1.0 -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_documentdb&subdirectory=src/command_modules/azure-cli-documentdb -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@2a8d8fca411fe8422c7cee557943ae4c9f256bfc#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.4 azure-core==1.24.2 azure-graphrbac==0.30.0rc6 azure-keyvault==0.1.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==2.0.0 azure-mgmt-compute==0.33.0 azure-mgmt-containerregistry==0.1.1 azure-mgmt-dns==0.30.0rc6 azure-mgmt-documentdb==0.1.0 azure-mgmt-iothub==0.2.1 azure-mgmt-keyvault==0.30.0 azure-mgmt-network==0.30.0 azure-mgmt-nspkg==3.0.2 azure-mgmt-redis==1.0.0 azure-mgmt-resource==0.30.2 azure-mgmt-sql==0.2.0 azure-mgmt-storage==0.31.0 azure-mgmt-trafficmanager==0.30.0rc6 azure-mgmt-web==0.31.0 azure-nspkg==3.0.2 azure-storage==0.33.0 certifi==2021.5.30 cffi==1.15.1 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.7.1 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.5.4 pyOpenSSL==16.1.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 PyYAML==3.11 requests==2.9.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.5 tomli==1.2.3 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 wrapt==1.16.0 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==0.4.3 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==1.4.9 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==1.1.0 - azure-common==1.1.4 - azure-core==1.24.2 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.1.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==2.0.0 - azure-mgmt-compute==0.33.0 - azure-mgmt-containerregistry==0.1.1 - azure-mgmt-dns==0.30.0rc6 - azure-mgmt-documentdb==0.1.0 - azure-mgmt-iothub==0.2.1 - azure-mgmt-keyvault==0.30.0 - azure-mgmt-network==0.30.0 - azure-mgmt-nspkg==3.0.2 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==0.30.2 - azure-mgmt-sql==0.2.0 - azure-mgmt-storage==0.31.0 - azure-mgmt-trafficmanager==0.30.0rc6 - azure-mgmt-web==0.31.0 - azure-nspkg==3.0.2 - azure-storage==0.33.0 - cffi==1.15.1 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.7.1 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.5.4 - pyopenssl==16.1.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pyyaml==3.11 - requests==2.9.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.5 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - wrapt==1.16.0 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkDnsScenarioTest::test_network_dns" ]
[]
[ "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkMultiIdsShowScenarioTest::test_multi_id_show", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkUsageListScenarioTest::test_network_usage_list", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkAppGatewayDefaultScenarioTest::test_network_app_gateway_with_defaults", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkAppGatewayExistingSubnetScenarioTest::test_network_app_gateway_with_existing_subnet", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkAppGatewayNoWaitScenarioTest::test_network_app_gateway_no_wait", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkAppGatewayPrivateIpScenarioTest::test_network_app_gateway_with_private_ip", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkAppGatewayPublicIpScenarioTest::test_network_app_gateway_with_public_ip", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkAppGatewayWafScenarioTest::test_network_app_gateway_waf", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkPublicIpScenarioTest::test_network_public_ip", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkExpressRouteScenarioTest::test_network_express_route", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkLoadBalancerScenarioTest::test_network_load_balancer", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkLoadBalancerIpConfigScenarioTest::test_network_load_balancer_ip_config", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkLoadBalancerSubresourceScenarioTest::test_network_load_balancer_subresources", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkLocalGatewayScenarioTest::test_network_local_gateway", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkNicScenarioTest::test_network_nic", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkNicSubresourceScenarioTest::test_network_nic_subresources", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkNicConvenienceCommandsScenarioTest::test_network_nic_convenience_commands", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkSecurityGroupScenarioTest::test_network_nsg", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkRouteTableOperationScenarioTest::test_network_route_table_operation", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkVNetScenarioTest::test_network_vnet", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkVNetPeeringScenarioTest::test_network_vnet_peering", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkSubnetSetScenarioTest::test_network_subnet_set", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkVpnGatewayScenarioTest::test_network_vpn_gateway", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkTrafficManagerScenarioTest::test_network_traffic_manager", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkZoneImportExportTest::test_network_dns_zone_import_export" ]
[]
MIT License
1,026
[ "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_params.py", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/_help.py", "src/azure-cli/setup.py", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/commands.py", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py", "src/command_modules/azure-cli-batch/azure/cli/command_modules/batch/_validators.py", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/_validators.py" ]
[ "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_params.py", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/_help.py", "src/azure-cli/setup.py", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/commands.py", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py", "src/command_modules/azure-cli-batch/azure/cli/command_modules/batch/_validators.py", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/_validators.py" ]
genialis__resolwe-bio-py-91
739582b58ef3573480347ac4798b5d37f848abce
2017-02-19 01:03:33
739582b58ef3573480347ac4798b5d37f848abce
codecov-io: # [Codecov](https://codecov.io/gh/genialis/resolwe-bio-py/pull/91?src=pr&el=h1) Report > Merging [#91](https://codecov.io/gh/genialis/resolwe-bio-py/pull/91?src=pr&el=desc) into [master](https://codecov.io/gh/genialis/resolwe-bio-py/commit/afe16da59e19507196a3591650a71f94394ffe2e?src=pr&el=desc) will **increase** coverage by `0.03%`. > The diff coverage is `86.45%`. ```diff @@ Coverage Diff @@ ## master #91 +/- ## ========================================== + Coverage 81.6% 81.64% +0.03% ========================================== Files 28 28 Lines 2153 2217 +64 ========================================== + Hits 1757 1810 +53 - Misses 396 407 +11 ``` | [Impacted Files](https://codecov.io/gh/genialis/resolwe-bio-py/pull/91?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [resdk/resolwe.py](https://codecov.io/gh/genialis/resolwe-bio-py/compare/afe16da59e19507196a3591650a71f94394ffe2e...194f027f7b6bacf730c5b5b2fa4bf6795f06bdde?src=pr&el=tree#diff-cmVzZGsvcmVzb2x3ZS5weQ==) | `98.88% <ø> (-0.01%)` | :x: | | [resdk/scripts.py](https://codecov.io/gh/genialis/resolwe-bio-py/compare/afe16da59e19507196a3591650a71f94394ffe2e...194f027f7b6bacf730c5b5b2fa4bf6795f06bdde?src=pr&el=tree#diff-cmVzZGsvc2NyaXB0cy5weQ==) | `0% <ø> (ø)` | :white_check_mark: | | [resdk/tests/unit/test_resolwe.py](https://codecov.io/gh/genialis/resolwe-bio-py/compare/afe16da59e19507196a3591650a71f94394ffe2e...194f027f7b6bacf730c5b5b2fa4bf6795f06bdde?src=pr&el=tree#diff-cmVzZGsvdGVzdHMvdW5pdC90ZXN0X3Jlc29sd2UucHk=) | `99.74% <100%> (ø)` | :white_check_mark: | | [resdk/resources/sample.py](https://codecov.io/gh/genialis/resolwe-bio-py/compare/afe16da59e19507196a3591650a71f94394ffe2e...194f027f7b6bacf730c5b5b2fa4bf6795f06bdde?src=pr&el=tree#diff-cmVzZGsvcmVzb3VyY2VzL3NhbXBsZS5weQ==) | `84.21% <100%> (+4.79%)` | :white_check_mark: | | [resdk/resources/data.py](https://codecov.io/gh/genialis/resolwe-bio-py/compare/afe16da59e19507196a3591650a71f94394ffe2e...194f027f7b6bacf730c5b5b2fa4bf6795f06bdde?src=pr&el=tree#diff-cmVzZGsvcmVzb3VyY2VzL2RhdGEucHk=) | `100% <100%> (ø)` | :white_check_mark: | | [resdk/tests/unit/test_collections.py](https://codecov.io/gh/genialis/resolwe-bio-py/compare/afe16da59e19507196a3591650a71f94394ffe2e...194f027f7b6bacf730c5b5b2fa4bf6795f06bdde?src=pr&el=tree#diff-cmVzZGsvdGVzdHMvdW5pdC90ZXN0X2NvbGxlY3Rpb25zLnB5) | `99.01% <100%> (+0.16%)` | :white_check_mark: | | [resdk/tests/unit/test_data.py](https://codecov.io/gh/genialis/resolwe-bio-py/compare/afe16da59e19507196a3591650a71f94394ffe2e...194f027f7b6bacf730c5b5b2fa4bf6795f06bdde?src=pr&el=tree#diff-cmVzZGsvdGVzdHMvdW5pdC90ZXN0X2RhdGEucHk=) | `98.92% <100%> (-0.06%)` | :x: | | [resdk/tests/unit/test_query.py](https://codecov.io/gh/genialis/resolwe-bio-py/compare/afe16da59e19507196a3591650a71f94394ffe2e...194f027f7b6bacf730c5b5b2fa4bf6795f06bdde?src=pr&el=tree#diff-cmVzZGsvdGVzdHMvdW5pdC90ZXN0X3F1ZXJ5LnB5) | `99.4% <100%> (+0.06%)` | :white_check_mark: | | [resdk/resources/base.py](https://codecov.io/gh/genialis/resolwe-bio-py/compare/afe16da59e19507196a3591650a71f94394ffe2e...194f027f7b6bacf730c5b5b2fa4bf6795f06bdde?src=pr&el=tree#diff-cmVzZGsvcmVzb3VyY2VzL2Jhc2UucHk=) | `94.89% <20%> (-4.04%)` | :x: | | [resdk/query.py](https://codecov.io/gh/genialis/resolwe-bio-py/compare/afe16da59e19507196a3591650a71f94394ffe2e...194f027f7b6bacf730c5b5b2fa4bf6795f06bdde?src=pr&el=tree#diff-cmVzZGsvcXVlcnkucHk=) | `88.19% <64.28%> (-4.55%)` | :x: | | ... and [1 more](https://codecov.io/gh/genialis/resolwe-bio-py/pull/91?src=pr&el=tree-more) | | ------ [Continue to review full report at Codecov](https://codecov.io/gh/genialis/resolwe-bio-py/pull/91?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/genialis/resolwe-bio-py/pull/91?src=pr&el=footer). Last update [afe16da...194f027](https://codecov.io/gh/genialis/resolwe-bio-py/compare/afe16da59e19507196a3591650a71f94394ffe2e...194f027f7b6bacf730c5b5b2fa4bf6795f06bdde?src=pr&el=footer&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index e92a0b2..3aaeaef 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -12,11 +12,22 @@ Added ----- * Option to set API url with ``RESOLWE_HOST_URL`` environment varaible +Added +----- +* ``count``, ``delete`` and ``create`` methods to query +* Support downloading ``basic:dir:`` fields + Changed ------- * Remove ``presample`` endpoint, as it doesn't exist in resolwe anymore * Update the way to mark ``sample`` as annotated +* Add confirmation before deleting an object +Fixed +----- +* Fix related queries (i.e. ``collection.data``, ``collection.samples``...) + for newly created objects and raise error if they are accessed before object + is saved ================== 1.6.4 - 2017-02-17 diff --git a/resdk/query.py b/resdk/query.py index 71b375b..1b38fd0 100644 --- a/resdk/query.py +++ b/resdk/query.py @@ -110,6 +110,7 @@ class ResolweQuery(object): """ _cache = None + _count = None # number of objects in current query (without applied limit and offset) _limit = None _offset = None _filters = collections.defaultdict(list) @@ -183,8 +184,7 @@ class ResolweQuery(object): def __len__(self): """Return length of results of current query.""" - self._fetch() - return len(self._cache) + return self.count() def _clone(self): """Return copy of current object with empty cache.""" @@ -237,6 +237,7 @@ class ResolweQuery(object): # Extract data from paginated response if isinstance(items, dict) and 'results' in items: + self._count = items['count'] items = items['results'] self._cache = [self._populate_resource(data) for data in items] @@ -244,6 +245,23 @@ class ResolweQuery(object): def clear_cache(self): """Clear cache.""" self._cache = None + self._count = None + + def count(self): + """Return number of objects in current query.""" + # pylint: disable=protected-access + if self._count is None: + count_query = self._clone() + count_query._offset = 0 + count_query._limit = 1 + count_query._fetch() + self._count = count_query._count + + if self._limit is None: + return self._count + + remaining = self._count - self._offset + return max(0, min(self._limit, remaining)) def get(self, *args, **kwargs): """Get object that matches given parameters. @@ -285,6 +303,10 @@ class ResolweQuery(object): return response[0] + def create(self, *args, **kwargs): + """Return new instance of current resource.""" + return self.resource(resolwe=self.resolwe, *args, **kwargs) + def post(self, data): """Post data to this endpoint. @@ -298,6 +320,20 @@ class ResolweQuery(object): new_query._add_filter(filters) # pylint: disable=protected-access return new_query + def delete(self, force=False): + """Delete objects in current query.""" + if not force: + user_input = six.moves.input( + 'Do you really want to delete {} object(s)?[yN] '.format(self.count())) + if user_input.strip().lower() != 'y': + return + + # TODO: Use bulk delete when supported on backend + for obj in self: + obj.delete(force=True) + + self.clear_cache() + def all(self): """Return copy of the current queryset. diff --git a/resdk/resolwe.py b/resdk/resolwe.py index 187bb38..8b7c110 100644 --- a/resdk/resolwe.py +++ b/resdk/resolwe.py @@ -514,11 +514,18 @@ class Resolwe(ResolweUtilsMixin): for file_uri in files: file_name = os.path.basename(file_uri) + file_path = os.path.dirname(file_uri) file_url = urljoin(self.url, 'data/{}'.format(file_uri)) - self.logger.info("* %s", file_name) + # Remove data id from path + file_path = file_path.split('/', 1)[1] if '/' in file_path else '' + full_path = os.path.join(download_dir, file_path) + if not os.path.isdir(full_path): + os.makedirs(full_path) - with open(os.path.join(download_dir, file_name), 'wb') as file_handle: + self.logger.info("* %s", os.path.join(file_path, file_name)) + + with open(os.path.join(download_dir, file_path, file_name), 'wb') as file_handle: response = requests.get(file_url, stream=True, auth=self.auth) if not response.ok: diff --git a/resdk/resources/base.py b/resdk/resources/base.py index 2931460..97098db 100644 --- a/resdk/resources/base.py +++ b/resdk/resources/base.py @@ -153,8 +153,14 @@ class BaseResource(object): response = self.api.post(payload) self._update_fields(response) - def delete(self): + def delete(self, force=False): """Delete the resource object from the server.""" + if not force: + user_input = six.moves.input('Do you really want to delete {}?[yN] '.format(self)) + + if user_input.strip().lower() != 'y': + return + self.api(self.id).delete() def __setattr__(self, name, value): diff --git a/resdk/resources/collection.py b/resdk/resources/collection.py index 156c9a5..f75246b 100644 --- a/resdk/resources/collection.py +++ b/resdk/resources/collection.py @@ -24,6 +24,9 @@ class BaseCollection(BaseResource): """ + #: lazy loaded list of data objects + _data = None + WRITABLE_FIELDS = ('description', 'settings', 'descriptor_schema', 'descriptor') + BaseResource.WRITABLE_FIELDS @@ -38,14 +41,17 @@ class BaseCollection(BaseResource): self.descriptor = None #: descriptor schema self.descriptor_schema = None - #: list of data objects - SET THIS IN SUBCLASS - self.data = [] super(BaseCollection, self).__init__(slug, id, model_data, resolwe) + @property + def data(self): + """Return list of attached Data objects.""" + raise NotImplementedError('This should be implemented in subclass') + def _clear_data_cache(self): """Clear data cache.""" - raise NotImplementedError('This should be implemented in subclass') + self._data = None def add_data(self, *data): """Add ``data`` objects to the collection.""" @@ -134,25 +140,40 @@ class Collection(BaseCollection): endpoint = 'collection' + #: (lazy loaded) list of samples that belong to collection + _samples = None + def __init__(self, slug=None, id=None, # pylint: disable=redefined-builtin model_data=None, resolwe=None): """Initialize attributes.""" BaseCollection.__init__(self, slug, id, model_data, resolwe) - #: (lazy loaded) list of data object that belong to collection - self.data = self.resolwe.data.filter(collection=self.id) - #: (lazy loaded) list of samples that belong to collection - self.samples = self.resolwe.sample.filter(collections=self.id) - def update(self): """Clear cache and update resource fields from the server.""" - self.data.clear_cache() # pylint: disable=no-member - self.samples.clear_cache() + self._data = None + self._samples = None super(Collection, self).update() - def _clear_data_cache(self): - self.data.clear_cache() # pylint: disable=no-member + @property + def data(self): + """Return list of data objects on collection.""" + if self.id is None: + raise ValueError('Instance must be saved before accessing `data` attribute.') + if self._data is None: + self._data = self.resolwe.data.filter(collection=self.id) + + return self._data + + @property + def samples(self): + """Return list of samples on collection.""" + if self.id is None: + raise ValueError('Instance must be saved before accessing `samples` attribute.') + if self._samples is None: + self._samples = self.resolwe.sample.filter(collections=self.id) + + return self._samples def add_samples(self, *samples): """Add `samples` objects to the collection.""" diff --git a/resdk/resources/data.py b/resdk/resources/data.py index 1e3fff2..dedd68f 100644 --- a/resdk/resources/data.py +++ b/resdk/resources/data.py @@ -1,6 +1,7 @@ """Data resource.""" from __future__ import absolute_import, division, print_function, unicode_literals +import json import logging import requests @@ -32,6 +33,8 @@ class Data(BaseResource): #: (lazy loaded) annotated ``Sample`` to which ``Data`` object belongs _sample = None + #: (lazy loaded) list of collections to which data object belongs + _collections = None WRITABLE_FIELDS = ('descriptor_schema', 'descriptor') + BaseResource.WRITABLE_FIELDS UPDATE_PROTECTED_FIELDS = ('input', 'process') + BaseResource.UPDATE_PROTECTED_FIELDS @@ -83,15 +86,12 @@ class Data(BaseResource): super(Data, self).__init__(slug, id, model_data, resolwe) - #: (lazy loaded) list of collections to which data object belongs - self.collections = self.resolwe.collection.filter(data=self.id) - self.logger = logging.getLogger(__name__) def update(self): """Clear cache and update resource fields from the server.""" self._sample = None - self.collections.clear_cache() + self._collections = None super(Data, self).update() @@ -137,35 +137,37 @@ class Data(BaseResource): return flat + @property + def collections(self): + """Return list of collections to which data object belongs.""" + if self.id is None: + raise ValueError('Instance must be saved before accessing `collections` attribute.') + if self._collections is None: + self._collections = self.resolwe.collection.filter(data=self.id) + + return self._collections + @property def sample(self): """Get ``sample`` that object belongs to.""" + if self.id is None: + raise ValueError('Instance must be saved before accessing `sample` attribute.') if self._sample is None: self._sample = self.resolwe.sample.filter(data=self.id) self._sample = None if len(self._sample) == 0 else self._sample[0] return self._sample - def files(self, file_name=None, field_name=None): - """Get list of downloadable fields. - - Filter files by file name or output field. - - :param file_name: name of file - :type file_name: string - :param field_name: output field name - :type field_name: string - :rtype: List of tuples (data_id, file_name, field_name, process_type) - - """ + def _files_dirs(self, field_type, file_name=None, field_name=None): + """Get list of downloadable fields.""" download_list = [] def put_in_download_list(elm, fname): - """Append only files with equal name.""" - if 'file' in elm: - if file_name is None or file_name == elm['file']: - download_list.append(elm['file']) + """Append only files od dirs with equal name.""" + if field_type in elm: + if file_name is None or file_name == elm[field_type]: + download_list.append(elm[field_type]) else: - raise KeyError("Item {} does not contain 'file' key.".format(fname)) + raise KeyError("Item {} does not contain '{}' key.".format(fname, field_type)) if field_name and not field_name.startswith('output.'): field_name = 'output.{}'.format(field_name) @@ -174,30 +176,76 @@ class Data(BaseResource): if (ann_field_name.startswith('output') and (field_name is None or field_name == ann_field_name) and ann['value'] is not None): - if ann['type'].startswith('basic:file:'): + if ann['type'].startswith('basic:{}:'.format(field_type)): put_in_download_list(ann['value'], ann_field_name) - elif ann['type'].startswith('list:basic:file:'): + elif ann['type'].startswith('list:basic:{}:'.format(field_type)): for element in ann['value']: put_in_download_list(element, ann_field_name) return download_list - def download(self, file_name=None, field_name=None, download_dir=None): - """Download Data object's files. + def _get_dir_files(self, dir_name): + files_list, dir_list = [], [] + + dir_url = urljoin(self.resolwe.url, 'data/{}/{}'.format(self.id, dir_name)) + if not dir_url.endswith('/'): + dir_url += '/' + response = requests.get(dir_url, auth=self.resolwe.auth) + response = json.loads(response.content.decode('utf-8')) + + for obj in response: + obj_path = '{}/{}'.format(dir_name, obj['name']) + if obj['type'] == 'directory': + dir_list.append(obj_path) + else: + files_list.append(obj_path) - Download files from the Resolwe server to the download - directory (defaults to the current working directory). + if dir_list: + for new_dir in dir_list: + files_list.extend(self._get_dir_files(new_dir)) + + return files_list + + def files(self, file_name=None, field_name=None): + """Get list of downloadable file fields. + + Filter files by file name or output field. :param file_name: name of file :type file_name: string - :param field_name: file field name + :param field_name: output field name + :type field_name: string + :rtype: List of tuples (data_id, file_name, field_name, process_type) + + """ + if not self.id: + raise ValueError('Instance must be saved before using `files` method.') + + file_list = self._files_dirs('file', file_name, field_name) + + for dir_name in self._files_dirs('dir', file_name, field_name): + print('>>', self._get_dir_files) + file_list.extend(self._get_dir_files(dir_name)) + + return file_list + + def download(self, file_name=None, field_name=None, download_dir=None): + """Download Data object's files and directories. + + Download files and directoriesfrom the Resolwe server to the + download directory (defaults to the current working directory). + + :param file_name: name of file or directory + :type file_name: string + :param field_name: file or directory field name :type field_name: string :param download_dir: download path :type download_dir: string :rtype: None - Data objects can contain multiple files. All are downloaded by - default, but may be filtered by name or output field: + Data objects can contain multiple files and directories. All are + downloaded by default, but may be filtered by name or output + field: * re.data.get(42).download(file_name='alignment7.bam') * re.data.get(42).download(field_name='bam') diff --git a/resdk/resources/sample.py b/resdk/resources/sample.py index 016205d..0c785b9 100644 --- a/resdk/resources/sample.py +++ b/resdk/resources/sample.py @@ -25,25 +25,40 @@ class Sample(SampleUtilsMixin, BaseCollection): endpoint = 'sample' + #: (lazy loaded) list of collections to which object belongs + _collections = None + def __init__(self, slug=None, id=None, model_data=None, # pylint: disable=redefined-builtin resolwe=None): """Initialize attributes.""" super(Sample, self).__init__(slug, id, model_data, resolwe) - #: (lazy loaded) list of collections to which object belongs - self.collections = self.resolwe.collection.filter(entity=self.id) - #: (lazy loaded) list of data object that belong to sample - self.data = self.resolwe.data.filter(entity=self.id) - def update(self): """Clear cache and update resource fields from the server.""" - self.collections.clear_cache() - self.data.clear_cache() # pylint: disable=no-member + self._collections = None + self._data = None super(Sample, self).update() - def _clear_data_cache(self): - self.data.clear_cache() # pylint: disable=no-member + @property + def data(self): + """Return list of data objects on collection.""" + if self.id is None: + raise ValueError('Instance must be saved before accessing `data` attribute.') + if self._data is None: + self._data = self.resolwe.data.filter(entity=self.id) + + return self._data + + @property + def collections(self): + """Return list of collections to which sample belongs.""" + if self.id is None: + raise ValueError('Instance must be saved before accessing `collections` attribute.') + if self._collections is None: + self._collections = self.resolwe.collection.filter(entity=self.id) + + return self._collections def print_annotation(self): """Provide annotation data."""
Queries in new objects are not evaluated correctly When new object is created, all queries that are included (i.e. `collection.data`, `collection.samples`,...) are constructed in a wrong way, because object's id is not yet known and filters are applied with `id=None`. Queries shouldn't be initialized in `__init__`, but on the first call and error should be raised if `id` is not yet known.
genialis/resolwe-bio-py
diff --git a/resdk/tests/unit/test_collections.py b/resdk/tests/unit/test_collections.py index 57d8ddd..e35dcbb 100644 --- a/resdk/tests/unit/test_collections.py +++ b/resdk/tests/unit/test_collections.py @@ -75,52 +75,88 @@ class TestCollection(unittest.TestCase): Collection.print_annotation(collection_mock) def test_data(self): - resolwe_mock = MagicMock(**{'data.filter.return_value': ['data_1', 'data_2', 'data_3']}) - collection = Collection(id=1, resolwe=resolwe_mock) + collection = Collection(id=1, resolwe=MagicMock()) + # test getting data attribute + collection.resolwe.data.filter = MagicMock(return_value=['data_1', 'data_2', 'data_3']) self.assertEqual(collection.data, ['data_1', 'data_2', 'data_3']) + # test caching data attribute + self.assertEqual(collection.data, ['data_1', 'data_2', 'data_3']) + self.assertEqual(collection.resolwe.data.filter.call_count, 1) + # cache is cleared at update - collection.data = MagicMock() + collection._data = ['data'] collection.update() - self.assertEqual(collection.data.clear_cache.call_count, 1) + self.assertEqual(collection._data, None) + + # raising error if collection is not saved + collection.id = None + with self.assertRaises(ValueError): + _ = collection.data def test_samples(self): - resolwe_mock = MagicMock(**{'sample.filter.return_value': ['sample1', 'sample2']}) - collection = Collection(id=1, resolwe=resolwe_mock) + collection = Collection(id=1, resolwe=MagicMock()) + # test getting samples attribute + collection.resolwe.sample.filter = MagicMock(return_value=['sample1', 'sample2']) self.assertEqual(collection.samples, ['sample1', 'sample2']) # cache is cleared at update - collection.samples = MagicMock() + collection._samples = ['sample'] collection.update() - self.assertEqual(collection.samples.clear_cache.call_count, 1) + self.assertEqual(collection._samples, None) + + # raising error if data collection is not saved + collection.id = None + with self.assertRaises(ValueError): + _ = collection.samples class TestSample(unittest.TestCase): def test_data(self): - resolwe_mock = MagicMock(**{'data.filter.return_value': ['data_1', 'data_2', 'data_3']}) - sample = Sample(id=1, resolwe=resolwe_mock) + sample = Sample(id=1, resolwe=MagicMock()) + # test getting data attribute + sample.resolwe.data.filter = MagicMock(return_value=['data_1', 'data_2', 'data_3']) self.assertEqual(sample.data, ['data_1', 'data_2', 'data_3']) + # test caching data attribute + self.assertEqual(sample.data, ['data_1', 'data_2', 'data_3']) + self.assertEqual(sample.resolwe.data.filter.call_count, 1) + # cache is cleared at update - sample.data = MagicMock() + sample._data = ['data'] sample.update() - self.assertEqual(sample.data.clear_cache.call_count, 1) # pylint: disable=no-member + self.assertEqual(sample._data, None) + + # raising error if sample is not saved + sample.id = None + with self.assertRaises(ValueError): + _ = sample.data def test_collections(self): - resolwe_mock = MagicMock( - **{'collection.filter.return_value': ['collection_1', 'collection_2']}) - sample = Sample(id=1, resolwe=resolwe_mock) + sample = Sample(id=1, resolwe=MagicMock()) - self.assertEqual(sample.collections, ['collection_1', 'collection_2']) + # test getting data attribute + sample.resolwe.collection.filter = MagicMock( + return_value=['collection_1', 'collection_2', 'collection_3']) + self.assertEqual(sample.collections, ['collection_1', 'collection_2', 'collection_3']) + + # test caching data attribute + self.assertEqual(sample.collections, ['collection_1', 'collection_2', 'collection_3']) + self.assertEqual(sample.resolwe.collection.filter.call_count, 1) # cache is cleared at update - sample.collections = MagicMock() + sample._collections = ['collection'] sample.update() - self.assertEqual(sample.collections.clear_cache.call_count, 1) + self.assertEqual(sample._collections, None) + + # raising error if sample is not saved + sample.id = None + with self.assertRaises(ValueError): + _ = sample.collections @patch('resdk.resources.sample.Sample', spec=True) def test_sample_print_annotation(self, sample_mock): diff --git a/resdk/tests/unit/test_data.py b/resdk/tests/unit/test_data.py index c590ab6..d0fd76c 100644 --- a/resdk/tests/unit/test_data.py +++ b/resdk/tests/unit/test_data.py @@ -2,6 +2,7 @@ Unit tests for resdk/resources/data.py file. """ # pylint: disable=missing-docstring, protected-access +from __future__ import absolute_import, division, print_function, unicode_literals import unittest @@ -49,44 +50,83 @@ class TestData(unittest.TestCase): data.update() self.assertEqual(data._sample, None) + # raising error if data object is not saved + data.id = None + with self.assertRaises(ValueError): + _ = data.sample + def test_collections(self): - resolwe_mock = MagicMock( - **{'collection.filter.return_value': ['collection_1', 'collection_2']}) - data = Data(id=1, resolwe=resolwe_mock) + data = Data(id=1, resolwe=MagicMock()) - self.assertEqual(data.collections, ['collection_1', 'collection_2']) + # test getting collections attribute + data.resolwe.collection.filter = MagicMock(return_value=['collection']) + self.assertEqual(data.collections, ['collection']) + + # test caching collections attribute + self.assertEqual(data.collections, ['collection']) + self.assertEqual(data.resolwe.collection.filter.call_count, 1) # cache is cleared at update - data.collections = MagicMock() + data._collections = ['collection'] data.update() - self.assertEqual(data.collections.clear_cache.call_count, 1) + self.assertEqual(data._collections, None) - @patch('resdk.resources.data.Data', spec=True) - def test_files(self, data_mock): - data_annotation = { + # raising error if data object is not saved + data.id = None + with self.assertRaises(ValueError): + _ = data.collections + + def test_files(self): + data = Data(id=123, resolwe=MagicMock()) + data._get_dir_files = MagicMock( + side_effect=[['first_dir/file1.txt'], ['fastq_dir/file2.txt']]) + + data.annotation = { 'output.list': {'value': [{'file': "element.gz"}], 'type': 'list:basic:file:'}, + 'output.dir_list': {'value': [{'dir': "first_dir"}], 'type': 'list:basic:dir:'}, 'output.fastq': {'value': {'file': "file.fastq.gz"}, 'type': 'basic:file:fastq'}, 'output.fastq_archive': {'value': {'file': "archive.gz"}, 'type': 'basic:file:'}, + 'output.fastq_dir': {'value': {'dir': "fastq_dir"}, 'type': 'basic:dir:'}, 'input.fastq_url': {'value': {'file': "blah"}, 'type': 'basic:url:'}, 'input.blah': {'value': "blah.gz", 'type': 'basic:file:'} } - bad_data_annotation = { + + file_list = data.files() + six.assertCountEqual(self, file_list, [ + 'element.gz', + 'archive.gz', + 'file.fastq.gz', + 'first_dir/file1.txt', + 'fastq_dir/file2.txt' + ]) + file_list = data.files(file_name='element.gz') + self.assertEqual(file_list, ['element.gz']) + file_list = data.files(field_name='output.fastq') + self.assertEqual(file_list, ['file.fastq.gz']) + + data.annotation = { 'output.list': {'value': [{'no_file_field_here': "element.gz"}], 'type': 'list:basic:file:'}, } - data_mock.configure_mock(annotation=data_annotation) + with six.assertRaisesRegex(self, KeyError, "does not contain 'file' key."): + data.files() - file_list = Data.files(data_mock) - self.assertEqual(set(file_list), set(['element.gz', 'archive.gz', 'file.fastq.gz'])) - file_list = Data.files(data_mock, file_name='element.gz') - self.assertEqual(file_list, ['element.gz']) - file_list = Data.files(data_mock, field_name='output.fastq') - self.assertEqual(file_list, ['file.fastq.gz']) + data = Data(resolwe=MagicMock()) + with six.assertRaisesRegex(self, ValueError, "must be saved before"): + data.files() + + @patch('resdk.resources.data.requests') + def test_dir_files(self, requests_mock): + data = Data(id=123, resolwe=MagicMock(url='http://resolwe.url')) + requests_mock.get = MagicMock(side_effect=[ + MagicMock(content=b'[{"type": "file", "name": "file1.txt"}, ' + b'{"type": "directory", "name": "subdir"}]'), + MagicMock(content=b'[{"type": "file", "name": "file2.txt"}]'), + ]) + + files = data._get_dir_files('test_dir') - data_mock.configure_mock(annotation=bad_data_annotation) - message = r"Item .* does not contain 'file' key." - with six.assertRaisesRegex(self, KeyError, message): - Data.files(data_mock) + self.assertEqual(files, ['test_dir/file1.txt', 'test_dir/subdir/file2.txt']) @patch('resdk.resources.data.Data', spec=True) def test_download_fail(self, data_mock): @@ -97,16 +137,18 @@ class TestData(unittest.TestCase): @patch('resdk.resources.data.Data', spec=True) def test_download_ok(self, data_mock): data_mock.configure_mock(id=123, **{'resolwe': MagicMock()}) - data_mock.configure_mock(**{'files.return_value': ['file1.txt', 'file2.fq.gz']}) + data_mock.configure_mock(**{ + 'files.return_value': ['file1.txt', 'file2.fq.gz'], + }) Data.download(data_mock) data_mock.resolwe._download_files.assert_called_once_with( - [u'123/file1.txt', u'123/file2.fq.gz'], None) + ['123/file1.txt', '123/file2.fq.gz'], None) data_mock.reset_mock() Data.download(data_mock, download_dir="/some/path/") data_mock.resolwe._download_files.assert_called_once_with( - [u'123/file1.txt', u'123/file2.fq.gz'], '/some/path/') + ['123/file1.txt', '123/file2.fq.gz'], '/some/path/') @patch('resdk.resources.data.Data', spec=True) def test_add_output(self, data_mock): @@ -115,10 +157,10 @@ class TestData(unittest.TestCase): 'output.fasta': {'type': 'basic:file:', 'value': {'file': 'genome.fa'}}} ) - files_list = Data.files(data_mock, field_name="output.fastq") + files_list = Data._files_dirs(data_mock, 'file', field_name="output.fastq") self.assertEqual(files_list, ['reads.fq']) - files_list = Data.files(data_mock, field_name="fastq") + files_list = Data._files_dirs(data_mock, 'file', field_name="fastq") self.assertEqual(files_list, ['reads.fq']) @patch('resdk.resources.data.Data', spec=True) diff --git a/resdk/tests/unit/test_query.py b/resdk/tests/unit/test_query.py index 74523b7..df38837 100644 --- a/resdk/tests/unit/test_query.py +++ b/resdk/tests/unit/test_query.py @@ -103,7 +103,7 @@ class TestResolweQuery(unittest.TestCase): self.assertEqual(rep, '[1,\n 2,\n 3]') def test_len(self): - query = MagicMock(spec=ResolweQuery, _cache=[1, 2, 3]) + query = MagicMock(spec=ResolweQuery, **{'count.return_value': 3}) query.__len__ = ResolweQuery.__len__ self.assertEqual(len(query), 3) @@ -166,6 +166,30 @@ class TestResolweQuery(unittest.TestCase): ResolweQuery.clear_cache(query) self.assertEqual(query._cache, None) + def test_count(self): + count_query = MagicMock(spec=ResolweQuery, _count=10) + query = MagicMock(spec=ResolweQuery, _count=None, _limit=None, _offset=None, + **{'_clone.return_value': count_query}) + + self.assertEqual(ResolweQuery.count(query), 10) + + query._limit = 2 + query._offset = 0 + self.assertEqual(ResolweQuery.count(query), 2) + + query._limit = 2 + query._offset = 9 + self.assertEqual(ResolweQuery.count(query), 1) + + query._limit = 2 + query._offset = 12 + self.assertEqual(ResolweQuery.count(query), 0) + + query._count = 5 + query._limit = None + query._offset = None + self.assertEqual(ResolweQuery.count(query), 5) + def test_get(self): new_query = MagicMock(spec=ResolweQuery) query = MagicMock(spec=ResolweQuery, **{'_clone.return_value': new_query}) diff --git a/resdk/tests/unit/test_resolwe.py b/resdk/tests/unit/test_resolwe.py index fb99b6d..a722215 100644 --- a/resdk/tests/unit/test_resolwe.py +++ b/resdk/tests/unit/test_resolwe.py @@ -569,7 +569,6 @@ class TestDownload(unittest.TestCase): @patch('resdk.resolwe.Resolwe', spec=True) def test_empty_file_list(self, resolwe_mock, os_mock): resolwe_mock.configure_mock(**self.config) - os_mock.path.isfile.return_value = True Resolwe._download_files(resolwe_mock, [])
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 7 }
1.7
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[docs,package,test]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-xdist", "pytest-mock", "pytest-asyncio" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": null, "test_cmd": "py.test --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.16 appdirs==1.4.4 astroid==3.3.9 babel==2.17.0 backports.tarfile==1.2.0 build==1.2.2.post1 certifi==2025.1.31 cffi==1.17.1 charset-normalizer==3.4.1 check-manifest==0.50 coverage==7.8.0 cryptography==44.0.2 dill==0.3.9 docutils==0.21.2 exceptiongroup==1.2.2 execnet==2.1.1 id==1.5.0 idna==3.10 imagesize==1.4.1 importlib_metadata==8.6.1 iniconfig==2.1.0 isort==6.0.1 jaraco.classes==3.4.0 jaraco.context==6.0.1 jaraco.functools==4.1.0 jeepney==0.9.0 Jinja2==3.1.6 keyring==25.6.0 markdown-it-py==3.0.0 MarkupSafe==3.0.2 mccabe==0.7.0 mdurl==0.1.2 mock==1.3.0 more-itertools==10.6.0 nh3==0.2.21 packaging==24.2 pbr==6.1.1 platformdirs==4.3.7 pluggy==1.5.0 pycodestyle==2.13.0 pycparser==2.22 pydocstyle==6.3.0 Pygments==2.19.1 pylint==3.3.6 pyproject_hooks==1.2.0 pytest==8.3.5 pytest-asyncio==0.26.0 pytest-cov==6.0.0 pytest-mock==3.14.0 pytest-xdist==3.6.1 PyYAML==6.0.2 readme_renderer==44.0 requests==2.32.3 requests-toolbelt==1.0.0 -e git+https://github.com/genialis/resolwe-bio-py.git@739582b58ef3573480347ac4798b5d37f848abce#egg=resdk rfc3986==2.0.0 rich==14.0.0 SecretStorage==3.3.3 six==1.17.0 slumber==0.7.1 snowballstemmer==2.2.0 Sphinx==7.4.7 sphinx-rtd-theme==3.0.2 sphinxcontrib-applehelp==2.0.0 sphinxcontrib-devhelp==2.0.0 sphinxcontrib-htmlhelp==2.1.0 sphinxcontrib-jquery==4.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==2.0.0 sphinxcontrib-serializinghtml==2.0.0 tomli==2.2.1 tomlkit==0.13.2 twine==6.1.0 typing_extensions==4.13.0 urllib3==2.3.0 zipp==3.21.0
name: resolwe-bio-py channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.16 - appdirs==1.4.4 - astroid==3.3.9 - babel==2.17.0 - backports-tarfile==1.2.0 - build==1.2.2.post1 - certifi==2025.1.31 - cffi==1.17.1 - charset-normalizer==3.4.1 - check-manifest==0.50 - coverage==7.8.0 - cryptography==44.0.2 - dill==0.3.9 - docutils==0.21.2 - exceptiongroup==1.2.2 - execnet==2.1.1 - id==1.5.0 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==8.6.1 - iniconfig==2.1.0 - isort==6.0.1 - jaraco-classes==3.4.0 - jaraco-context==6.0.1 - jaraco-functools==4.1.0 - jeepney==0.9.0 - jinja2==3.1.6 - keyring==25.6.0 - markdown-it-py==3.0.0 - markupsafe==3.0.2 - mccabe==0.7.0 - mdurl==0.1.2 - mock==1.3.0 - more-itertools==10.6.0 - nh3==0.2.21 - packaging==24.2 - pbr==6.1.1 - platformdirs==4.3.7 - pluggy==1.5.0 - pycodestyle==2.13.0 - pycparser==2.22 - pydocstyle==6.3.0 - pygments==2.19.1 - pylint==3.3.6 - pyproject-hooks==1.2.0 - pytest==8.3.5 - pytest-asyncio==0.26.0 - pytest-cov==6.0.0 - pytest-mock==3.14.0 - pytest-xdist==3.6.1 - pyyaml==6.0.2 - readme-renderer==44.0 - requests==2.32.3 - requests-toolbelt==1.0.0 - rfc3986==2.0.0 - rich==14.0.0 - secretstorage==3.3.3 - six==1.17.0 - slumber==0.7.1 - snowballstemmer==2.2.0 - sphinx==7.4.7 - sphinx-rtd-theme==3.0.2 - sphinxcontrib-applehelp==2.0.0 - sphinxcontrib-devhelp==2.0.0 - sphinxcontrib-htmlhelp==2.1.0 - sphinxcontrib-jquery==4.1 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==2.0.0 - sphinxcontrib-serializinghtml==2.0.0 - tomli==2.2.1 - tomlkit==0.13.2 - twine==6.1.0 - typing-extensions==4.13.0 - urllib3==2.3.0 - zipp==3.21.0 prefix: /opt/conda/envs/resolwe-bio-py
[ "resdk/tests/unit/test_collections.py::TestCollection::test_data", "resdk/tests/unit/test_collections.py::TestCollection::test_samples", "resdk/tests/unit/test_collections.py::TestSample::test_collections", "resdk/tests/unit/test_collections.py::TestSample::test_data", "resdk/tests/unit/test_data.py::TestData::test_add_output", "resdk/tests/unit/test_data.py::TestData::test_collections", "resdk/tests/unit/test_data.py::TestData::test_dir_files", "resdk/tests/unit/test_data.py::TestData::test_files", "resdk/tests/unit/test_data.py::TestData::test_sample", "resdk/tests/unit/test_query.py::TestResolweQuery::test_count", "resdk/tests/unit/test_query.py::TestResolweQuery::test_len" ]
[ "resdk/tests/unit/test_resolwe.py::TestRegister::test_completely_new_process", "resdk/tests/unit/test_resolwe.py::TestRegister::test_raise_if_bad_yaml_file", "resdk/tests/unit/test_resolwe.py::TestRegister::test_raise_if_slug_not_in_yaml", "resdk/tests/unit/test_resolwe.py::TestRegister::test_raises_client_error", "resdk/tests/unit/test_resolwe.py::TestRegister::test_update_existing_process" ]
[ "resdk/tests/unit/test_collections.py::TestBaseCollection::test_data_types", "resdk/tests/unit/test_collections.py::TestBaseCollection::test_files", "resdk/tests/unit/test_collections.py::TestBaseCollection::test_print_annotation", "resdk/tests/unit/test_collections.py::TestBaseCollectionDownload::test_bad_file_type", "resdk/tests/unit/test_collections.py::TestBaseCollectionDownload::test_file_type", "resdk/tests/unit/test_collections.py::TestCollection::test_collection_print_ann", "resdk/tests/unit/test_collections.py::TestSample::test_confirm_is_annotated", "resdk/tests/unit/test_collections.py::TestSample::test_sample_print_annotation", "resdk/tests/unit/test_collections.py::TestSample::test_update_descriptor", "resdk/tests/unit/test_data.py::TestData::test_download_fail", "resdk/tests/unit/test_data.py::TestData::test_download_ok", "resdk/tests/unit/test_data.py::TestData::test_flatten_field", "resdk/tests/unit/test_data.py::TestData::test_print_annotation", "resdk/tests/unit/test_data.py::TestData::test_stdout_ok", "resdk/tests/unit/test_data.py::TestData::test_update_fields", "resdk/tests/unit/test_query.py::TestResolweQuery::test_add_filter", "resdk/tests/unit/test_query.py::TestResolweQuery::test_all", "resdk/tests/unit/test_query.py::TestResolweQuery::test_clear_cache", "resdk/tests/unit/test_query.py::TestResolweQuery::test_clone", "resdk/tests/unit/test_query.py::TestResolweQuery::test_compose_filters", "resdk/tests/unit/test_query.py::TestResolweQuery::test_fetch", "resdk/tests/unit/test_query.py::TestResolweQuery::test_filter", "resdk/tests/unit/test_query.py::TestResolweQuery::test_get", "resdk/tests/unit/test_query.py::TestResolweQuery::test_getitem", "resdk/tests/unit/test_query.py::TestResolweQuery::test_getitem_cached", "resdk/tests/unit/test_query.py::TestResolweQuery::test_getitem_invalid", "resdk/tests/unit/test_query.py::TestResolweQuery::test_init", "resdk/tests/unit/test_query.py::TestResolweQuery::test_iter", "resdk/tests/unit/test_query.py::TestResolweQuery::test_post", "resdk/tests/unit/test_query.py::TestResolweQuery::test_repr", "resdk/tests/unit/test_query.py::TestResolweQuery::test_search", "resdk/tests/unit/test_resolwe.py::TestResolweResource::test_delete_wrapped", "resdk/tests/unit/test_resolwe.py::TestResolweResource::test_get_wrapped", "resdk/tests/unit/test_resolwe.py::TestResolweResource::test_head_wrapped", "resdk/tests/unit/test_resolwe.py::TestResolweResource::test_options_wrapped", "resdk/tests/unit/test_resolwe.py::TestResolweResource::test_patch_wrapped", "resdk/tests/unit/test_resolwe.py::TestResolweResource::test_post_wrapped", "resdk/tests/unit/test_resolwe.py::TestResolweResource::test_put_wrapped", "resdk/tests/unit/test_resolwe.py::TestResolwe::test_env_variables", "resdk/tests/unit/test_resolwe.py::TestResolwe::test_init", "resdk/tests/unit/test_resolwe.py::TestResolwe::test_repr", "resdk/tests/unit/test_resolwe.py::TestVersionConverters::test_version_int_to_string", "resdk/tests/unit/test_resolwe.py::TestVersionConverters::test_version_string_to_int", "resdk/tests/unit/test_resolwe.py::TestRegister::test_raise_if_no_yaml_file", "resdk/tests/unit/test_resolwe.py::TestUploadTools::test_log_if_returncode_gt1", "resdk/tests/unit/test_resolwe.py::TestUploadTools::test_logger_calls", "resdk/tests/unit/test_resolwe.py::TestUploadTools::test_raise_if_returncode_1", "resdk/tests/unit/test_resolwe.py::TestUploadTools::test_remote_host_not_set", "resdk/tests/unit/test_resolwe.py::TestUploadTools::test_tools_file_not_found", "resdk/tests/unit/test_resolwe.py::TestProcessFileField::test_if_upload_fails", "resdk/tests/unit/test_resolwe.py::TestProcessFileField::test_if_upload_ok", "resdk/tests/unit/test_resolwe.py::TestProcessFileField::test_invalid_file_name", "resdk/tests/unit/test_resolwe.py::TestProcessFileField::test_url", "resdk/tests/unit/test_resolwe.py::TestRun::test_bad_descriptor_input", "resdk/tests/unit/test_resolwe.py::TestRun::test_bad_inputs", "resdk/tests/unit/test_resolwe.py::TestRun::test_call_with_all_args", "resdk/tests/unit/test_resolwe.py::TestRun::test_dehydrate_collections", "resdk/tests/unit/test_resolwe.py::TestRun::test_dehydrate_data", "resdk/tests/unit/test_resolwe.py::TestRun::test_file_processing", "resdk/tests/unit/test_resolwe.py::TestRun::test_get_or_run", "resdk/tests/unit/test_resolwe.py::TestRun::test_keep_input", "resdk/tests/unit/test_resolwe.py::TestRun::test_run_process", "resdk/tests/unit/test_resolwe.py::TestRun::test_wrap_list", "resdk/tests/unit/test_resolwe.py::TestUploadFile::test_always_bad", "resdk/tests/unit/test_resolwe.py::TestUploadFile::test_always_ok", "resdk/tests/unit/test_resolwe.py::TestUploadFile::test_one_bad_other_ok", "resdk/tests/unit/test_resolwe.py::TestDownload::test_bad_response", "resdk/tests/unit/test_resolwe.py::TestDownload::test_empty_file_list", "resdk/tests/unit/test_resolwe.py::TestDownload::test_fail_if_bad_dir", "resdk/tests/unit/test_resolwe.py::TestDownload::test_good_response", "resdk/tests/unit/test_resolwe.py::TestResAuth::test_all_ok", "resdk/tests/unit/test_resolwe.py::TestResAuth::test_bad_credentials", "resdk/tests/unit/test_resolwe.py::TestResAuth::test_bad_url", "resdk/tests/unit/test_resolwe.py::TestResAuth::test_call", "resdk/tests/unit/test_resolwe.py::TestResAuth::test_no_csrf_token", "resdk/tests/unit/test_resolwe.py::TestResAuth::test_public_user" ]
[]
Apache License 2.0
1,027
[ "resdk/resources/base.py", "docs/CHANGELOG.rst", "resdk/query.py", "resdk/resources/sample.py", "resdk/resources/data.py", "resdk/resolwe.py", "resdk/resources/collection.py" ]
[ "resdk/resources/base.py", "docs/CHANGELOG.rst", "resdk/query.py", "resdk/resources/sample.py", "resdk/resources/data.py", "resdk/resolwe.py", "resdk/resources/collection.py" ]
borgbackup__borg-2184
4862efe718797e9fff6ca0dbfa24e8af8491be09
2017-02-19 06:09:53
b9d834409c9e498d78f2df8ca3a8c24132293499
enkore: I can has test case? ;) ThomasWaldmann: btw, i also tried to add a test for the single --force delete, but it needs some different corruption code that cleanly removes an archive chunk from repo. enkore: Suggestion: Don't corrupt the low-level structures for the tests, it is expected that only check--repair can fix it and that --force² might fail after the commit. Instead, write some invalid data via the Repository API, that way it's easier to test.
diff --git a/src/borg/archive.py b/src/borg/archive.py index 07d62e16..4bebecd7 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -662,7 +662,7 @@ def chunk_decref(id, stats): raise ChunksIndexError(cid) except Repository.ObjectNotFound as e: # object not in repo - strange, but we wanted to delete it anyway. - if not forced: + if forced == 0: raise error = True @@ -686,14 +686,14 @@ def chunk_decref(id, stats): except (TypeError, ValueError): # if items metadata spans multiple chunks and one chunk got dropped somehow, # it could be that unpacker yields bad types - if not forced: + if forced == 0: raise error = True if progress: pi.finish() except (msgpack.UnpackException, Repository.ObjectNotFound): # items metadata corrupted - if not forced: + if forced == 0: raise error = True # in forced delete mode, we try hard to delete at least the manifest entry, diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 041749a1..efdc16db 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -828,6 +828,26 @@ def _delete_archives(self, args, repository): if not archive_names: return self.exit_code + if args.forced == 2: + deleted = False + for i, archive_name in enumerate(archive_names, 1): + try: + del manifest.archives[archive_name] + except KeyError: + self.exit_code = EXIT_WARNING + logger.warning('Archive {} not found ({}/{}).'.format(archive_name, i, len(archive_names))) + else: + deleted = True + logger.info('Deleted {} ({}/{}).'.format(archive_name, i, len(archive_names))) + if deleted: + manifest.write() + # note: might crash in compact() after committing the repo + repository.commit() + logger.info('Done. Run "borg check --repair" to clean up the mess.') + else: + logger.warning('Aborted.') + return self.exit_code + stats_logger = logging.getLogger('borg.output.stats') if args.stats: log_multi(DASHES, STATS_HEADER, logger=stats_logger) @@ -845,7 +865,7 @@ def _delete_archives(self, args, repository): if args.stats: log_multi(stats.summary.format(label='Deleted data:', stats=stats), DASHES, logger=stats_logger) - if not args.forced and self.exit_code: + if args.forced == 0 and self.exit_code: break if args.stats: stats_logger.info(str(cache)) @@ -2383,8 +2403,9 @@ def process_epilog(epilog): action='store_true', default=False, help='delete only the local cache for the given repository') subparser.add_argument('--force', dest='forced', - action='store_true', default=False, - help='force deletion of corrupted archives') + action='count', default=0, + help='force deletion of corrupted archives, ' + 'use --force --force in case --force does not work.') subparser.add_argument('--save-space', dest='save_space', action='store_true', default=False, help='work slower, but using less space')
Traceback when attempting to delete a corrupted .checkpoint archive After upgrading to 1.0.9, I noticed the daily backup on one of the machines failed. I'm not sure 1.0.9 is the culprit here however, it may have just let me know about the corrupted archive since it looks like it rebuilt the indexes. When attempting the delete the corrupted archive, I receive the following traceback, even when using --force. Any ideas? ``` Error: Did not get expected metadata dict - archive corrupted! Local Exception. Traceback (most recent call last): File "borg/archiver.py", line 2052, in main File "borg/archiver.py", line 1997, in run File "borg/archiver.py", line 90, in wrapper File "borg/archiver.py", line 498, in do_delete File "borg/cache.py", line 97, in __init__ File "borg/cache.py", line 391, in sync File "borg/cache.py", line 358, in create_master_idx File "borg/cache.py", line 315, in fetch_and_build_idx File "msgpack/_unpacker.pyx", line 469, in msgpack._unpacker.Unpacker.__next__ (msgpack/_unpacker.cpp:5459) File "msgpack/_unpacker.pyx", line 400, in msgpack._unpacker.Unpacker._unpack (msgpack/_unpacker.cpp:4483) TypeError: unhashable type: 'dict' Platform: Linux machinename 2.6.32-642.11.1.el6.i686 #1 SMP Fri Nov 18 18:48:28 UTC 2016 i686 i686 Linux: CentOS 6.8 Final Borg: 1.0.9 Python: CPython 3.5.2 PID: 15290 CWD: /usr/local/bin sys.argv: ['/usr/local/bin/borg', 'delete', 'user@machine:/location::machine_2016-07-18-23:45:02.checkpoint'] SSH_ORIGINAL_COMMAND: None ``` --- :moneybag: [there is a bounty for this](https://www.bountysource.com/issues/40319126-traceback-when-attempting-to-delete-a-corrupted-checkpoint-archive)
borgbackup/borg
diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py index cce0c92f..d13dee4c 100644 --- a/src/borg/testsuite/archiver.py +++ b/src/borg/testsuite/archiver.py @@ -1166,6 +1166,20 @@ def test_delete_repo(self): # Make sure the repo is gone self.assertFalse(os.path.exists(self.repository_path)) + def test_delete_double_force(self): + self.cmd('init', '--encryption=none', self.repository_location) + self.create_src_archive('test') + with Repository(self.repository_path, exclusive=True) as repository: + manifest, key = Manifest.load(repository) + archive = Archive(repository, key, manifest, 'test') + id = archive.metadata.items[0] + repository.put(id, b'corrupted items metadata stream chunk') + repository.commit() + self.cmd('delete', '--force', '--force', self.repository_location + '::test') + self.cmd('check', '--repair', self.repository_location) + output = self.cmd('list', self.repository_location) + self.assert_not_in('test', output) + def test_corrupted_repository(self): self.cmd('init', '--encryption=repokey', self.repository_location) self.create_src_archive('test')
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_issue_reference", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 2 }
1.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[fuse]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-xdist", "pytest-cov", "pytest-benchmark" ], "pre_install": [ "apt-get update", "apt-get install -y gcc python3-dev libssl-dev libacl1-dev liblz4-dev libfuse-dev fuse pkg-config" ], "python": "3.9", "reqs_path": [ "requirements.d/development.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
-e git+https://github.com/borgbackup/borg.git@4862efe718797e9fff6ca0dbfa24e8af8491be09#egg=borgbackup cachetools==5.5.2 chardet==5.2.0 colorama==0.4.6 coverage==7.8.0 Cython==3.0.12 distlib==0.3.9 exceptiongroup==1.2.2 execnet==2.1.1 filelock==3.18.0 iniconfig==2.1.0 llfuse==1.5.1 msgpack-python==0.5.6 packaging==24.2 platformdirs==4.3.7 pluggy==1.5.0 py-cpuinfo==9.0.0 pyproject-api==1.9.0 pytest==8.3.5 pytest-benchmark==5.1.0 pytest-cov==6.0.0 pytest-xdist==3.6.1 tomli==2.2.1 tox==4.25.0 typing_extensions==4.13.0 virtualenv==20.29.3
name: borg channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - cachetools==5.5.2 - chardet==5.2.0 - colorama==0.4.6 - coverage==7.8.0 - cython==3.0.12 - distlib==0.3.9 - exceptiongroup==1.2.2 - execnet==2.1.1 - filelock==3.18.0 - iniconfig==2.1.0 - llfuse==1.5.1 - msgpack-python==0.5.6 - packaging==24.2 - platformdirs==4.3.7 - pluggy==1.5.0 - py-cpuinfo==9.0.0 - pyproject-api==1.9.0 - pytest==8.3.5 - pytest-benchmark==5.1.0 - pytest-cov==6.0.0 - pytest-xdist==3.6.1 - tomli==2.2.1 - tox==4.25.0 - typing-extensions==4.13.0 - virtualenv==20.29.3 prefix: /opt/conda/envs/borg
[ "src/borg/testsuite/archiver.py::ArchiverTestCase::test_delete_double_force", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_delete_double_force" ]
[ "src/borg/testsuite/archiver.py::test_return_codes[python]", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_aes_counter_uniqueness_keyfile", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_aes_counter_uniqueness_passphrase", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_atime", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_bad_filters", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_basic_functionality", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_break_lock", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_change_passphrase", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_check_cache", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_comment", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_auto_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_auto_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lz4_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lzma_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_none_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_none_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_zlib_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_corrupted_repository", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_dry_run", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_pattern", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_pattern_root", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_read_special_broken_symlink", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_topical", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_without_root", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_archive", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_archive_items", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_manifest", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_repo_objs", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_put_get_delete_obj", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_delete", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_delete_repo", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_caches", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_keep_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_keep_tagged_deprecation", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_normalization", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_hardlinks", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_include_exclude", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_include_exclude_regex", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_include_exclude_regex_from_file", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_list_output", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_pattern_opt", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_progress", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_with_pattern", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_file_status", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_file_status_excluded", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_fuse", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_fuse_allow_damaged_files", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_fuse_mount_options", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_fuse_versions_view", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_info", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_keyfile", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_paperkey", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_qr", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_repokey", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_import_errors", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_chunk_counts", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_format", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_hash", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_prefix", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_repository_format", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_size", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_overwrite", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_path_normalization", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_progress_off", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_progress_on", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_prune_repository", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_prune_repository_prefix", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_prune_repository_save_space", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_basic", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_dry_run", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_exclude_caches", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_exclude_keep_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_exclude_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_list_output", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_rechunkify", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_recompress", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_skips_nothing_to_do", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_subtree_hardlinks", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_target", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_target_rc", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_rename", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repeated_files", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_move", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection2", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection2_no_cache", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection_no_cache", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_security_dir_compat", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_sparse_file", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_strip_components", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_strip_components_links", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_symlink_extract", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_umask", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_unix_socket", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_unusual_filenames", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_with_lock", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_attic013_acl_bug", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_check_usage", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_corrupted_manifest", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_empty_repository", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_extra_chunks", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_manifest_rebuild_corrupted_chunk", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_manifest_rebuild_duplicate_archive", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_archive_item_chunk", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_archive_metadata", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_file_chunk", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_manifest", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_verify_data", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_verify_data_unencrypted", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_disable", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_disable2", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_fresh_init_tam_required", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_not_required", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_aes_counter_uniqueness_keyfile", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_aes_counter_uniqueness_passphrase", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_atime", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_bad_filters", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_basic_functionality", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_break_lock", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_change_passphrase", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_check_cache", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_comment", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_auto_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_auto_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lz4_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lz4_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lzma_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lzma_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_none_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_none_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_zlib_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_zlib_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_corrupted_repository", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_dry_run", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_pattern", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_pattern_root", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_read_special_broken_symlink", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_topical", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_without_root", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_archive", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_archive_items", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_manifest", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_repo_objs", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_delete", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_delete_repo", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_caches", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_keep_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_keep_tagged_deprecation", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_normalization", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_hardlinks", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_include_exclude", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_include_exclude_regex", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_include_exclude_regex_from_file", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_list_output", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_pattern_opt", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_progress", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_with_pattern", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_file_status", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_file_status_excluded", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_fuse", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_fuse_allow_damaged_files", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_fuse_mount_options", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_fuse_versions_view", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_info", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_keyfile", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_paperkey", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_qr", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_repokey", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_import_errors", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_chunk_counts", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_format", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_hash", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_prefix", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_repository_format", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_size", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_overwrite", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_path_normalization", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_progress_off", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_progress_on", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_prune_repository", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_prune_repository_prefix", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_prune_repository_save_space", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_basic", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_dry_run", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_exclude_caches", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_exclude_keep_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_exclude_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_list_output", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_rechunkify", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_recompress", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_skips_nothing_to_do", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_subtree_hardlinks", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_target", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_target_rc", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_remote_repo_restrict_to_path", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_rename", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repeated_files", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_move", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection2", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection2_no_cache", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection_no_cache", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_security_dir_compat", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_sparse_file", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_strip_components", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_strip_components_doesnt_leak", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_strip_components_links", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_symlink_extract", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_umask", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_unix_socket", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_unusual_filenames", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_with_lock", "src/borg/testsuite/archiver.py::DiffArchiverTestCase::test_basic_functionality", "src/borg/testsuite/archiver.py::DiffArchiverTestCase::test_sort_option" ]
[ "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lz4_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lzma_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_zlib_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_help", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_init_interrupt", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_init_requires_encryption_option", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_unknown_unencrypted", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_usage", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_help", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_init_interrupt", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_init_requires_encryption_option", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_unknown_unencrypted", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_usage", "src/borg/testsuite/archiver.py::test_get_args", "src/borg/testsuite/archiver.py::test_compare_chunk_contents", "src/borg/testsuite/archiver.py::TestBuildFilter::test_basic", "src/borg/testsuite/archiver.py::TestBuildFilter::test_empty", "src/borg/testsuite/archiver.py::TestBuildFilter::test_strip_components" ]
[]
BSD License
1,028
[ "src/borg/archive.py", "src/borg/archiver.py" ]
[ "src/borg/archive.py", "src/borg/archiver.py" ]
Shopify__shopify_python_api-177
c29e0ecbed9de67dd923f980a3ac053922dab75e
2017-02-21 04:08:10
c29e0ecbed9de67dd923f980a3ac053922dab75e
diff --git a/shopify/resources/image.py b/shopify/resources/image.py index a0e82ef..b408261 100644 --- a/shopify/resources/image.py +++ b/shopify/resources/image.py @@ -23,7 +23,7 @@ class Image(ShopifyResource): return super(Image, self).__getattr__(name) def attach_image(self, data, filename=None): - self.attributes["attachment"] = base64.b64encode(data) + self.attributes["attachment"] = base64.b64encode(data).decode() if filename: self.attributes["filename"] = filename
Attaching Images - Decode required for Python 3 compatibility When attaching an image from a local file: ``` with open("some_image.jpg","rb") as f: img = f.read() image1.attach_image(data=img) ``` img will be bytes while the attachment needs to be a string to the JSONified. So in image.py: ``` def attach_image(self, data, filename=None): self.attributes["attachment"] = base64.b64encode(data).decode() #decode() for Python 3 if filename: self.attributes["filename"] = filename ``` I am not sure how to keep it Python 2 compatible.
Shopify/shopify_python_api
diff --git a/test/image_test.py b/test/image_test.py index 1234898..bde789e 100644 --- a/test/image_test.py +++ b/test/image_test.py @@ -1,5 +1,6 @@ import shopify from test.test_helper import TestCase +import base64 class ImageTest(TestCase): @@ -13,6 +14,19 @@ class ImageTest(TestCase): self.assertEqual('http://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano.png?v=1389388540', image.src) self.assertEqual(850703190, image.id) + def test_attach_image(self): + self.fake("products/632910392/images", method='POST', body=self.load_fixture('image'), headers={'Content-type': 'application/json'}) + image = shopify.Image({'product_id':632910392}) + image.position = 1 + binary_in = base64.b64decode("R0lGODlhbgCMAPf/APbr48VySrxTO7IgKt2qmKQdJeK8lsFjROG5p/nz7Zg3MNmnd7Q1MLNVS9GId71hSJMZIuzTu4UtKbeEeakhKMl8U8WYjfr18YQaIbAf==") + image.attach_image(data=binary_in, filename='ipod-nano.png') + image.save() + binary_out = base64.b64decode(image.attachment) + + self.assertEqual('http://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano.png?v=1389388540', image.src) + self.assertEqual(850703190, image.id) + self.assertEqual(binary_in, binary_out) + def test_create_image_then_add_parent_id(self): self.fake("products/632910392/images", method='POST', body=self.load_fixture('image'), headers={'Content-type': 'application/json'}) image = shopify.Image()
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_media" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 1 }
2.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "flake8", "flake8_docstrings" ], "pre_install": null, "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup==1.2.2 flake8==7.2.0 flake8-docstrings==1.7.0 iniconfig==2.1.0 mccabe==0.7.0 packaging==24.2 pluggy==1.5.0 pyactiveresource==2.2.2 pycodestyle==2.13.0 pydocstyle==6.3.0 pyflakes==3.3.1 pytest==8.3.5 PyYAML==6.0.2 -e git+https://github.com/Shopify/shopify_python_api.git@c29e0ecbed9de67dd923f980a3ac053922dab75e#egg=ShopifyAPI six==1.17.0 snowballstemmer==2.2.0 tomli==2.2.1
name: shopify_python_api channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - exceptiongroup==1.2.2 - flake8==7.2.0 - flake8-docstrings==1.7.0 - iniconfig==2.1.0 - mccabe==0.7.0 - packaging==24.2 - pluggy==1.5.0 - pyactiveresource==2.2.2 - pycodestyle==2.13.0 - pydocstyle==6.3.0 - pyflakes==3.3.1 - pytest==8.3.5 - pyyaml==6.0.2 - six==1.17.0 - snowballstemmer==2.2.0 - tomli==2.2.1 prefix: /opt/conda/envs/shopify_python_api
[ "test/image_test.py::ImageTest::test_attach_image" ]
[]
[ "test/image_test.py::ImageTest::test_create_image", "test/image_test.py::ImageTest::test_create_image_then_add_parent_id", "test/image_test.py::ImageTest::test_get_image", "test/image_test.py::ImageTest::test_get_images", "test/image_test.py::ImageTest::test_get_metafields_for_image" ]
[]
MIT License
1,029
[ "shopify/resources/image.py" ]
[ "shopify/resources/image.py" ]
EliCDavis__AssociationEngine-30
941e395d804635ead728ce0c69156974b9c1d59c
2017-02-21 04:27:49
941e395d804635ead728ce0c69156974b9c1d59c
diff --git a/Snapper/Snapper.py b/Snapper/Snapper.py index 7306c09..56feaa3 100644 --- a/Snapper/Snapper.py +++ b/Snapper/Snapper.py @@ -1,3 +1,6 @@ +from ..Relationship.Variable import Variable + + class Snapper: def __init__(self): self.sensors = [] @@ -23,6 +26,16 @@ class Snapper: """ self.dataBuffer[sensor.uuid] = data + def add_sensor(self, sensor): + """ + This function adds a new sensor to the snapper module and generates a corresponding variable object. + :return: + """ + self.sensors.append(sensor) + newVariable = Variable() + self.variables.append(newVariable) + self.routeMap[sensor.uuid] = newVariable.uuid + def create_snapshot(self): """ This function collects all available data and builds the newest snapshot of synchronized values.
Implement Generation of Variables from Sensors in Snapper The snapper module must generate variable objects as needed from sensor objects supplied, rather than expect to be provided with the variables from outside the module.
EliCDavis/AssociationEngine
diff --git a/Snapper/Snapper_test.py b/Snapper/Snapper_test.py index 799a6e2..fbb2cb6 100644 --- a/Snapper/Snapper_test.py +++ b/Snapper/Snapper_test.py @@ -1,4 +1,5 @@ from ..Sensor.Sensor import Sensor +from ..Relationship.Variable import Variable from .Snapper import Snapper @@ -15,7 +16,24 @@ def test_should_have_variables_field_as_empty_list_on_init(): def test_should_receive_data_from_attached_sensor(): snapper = Snapper() sensor = Sensor(snapper) - snapper.sensors.append(sensor) # A little hacked, I know. This is a place-holder + snapper.add_sensor(sensor) sensor.Publish(2) - assert snapper.dataBuffer[sensor.uuid] is 2 \ No newline at end of file + assert snapper.dataBuffer[sensor.uuid] is 2 + + +def test_should_store_sensor(): + snapper = Snapper() + sensor = Sensor(snapper) + snapper.add_sensor(sensor) + + assert isinstance(snapper.sensors[0], Sensor) + + +def test_should_generate_variable(): + snapper = Snapper() + sensor = Sensor(snapper) + snapper.add_sensor(sensor) + + assert isinstance(snapper.variables[0], Variable) +
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 0 }, "num_modified_files": 1 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "scipy numpy pytest", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
-e git+https://github.com/EliCDavis/AssociationEngine.git@941e395d804635ead728ce0c69156974b9c1d59c#egg=association_engine exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work numpy @ file:///croot/numpy_and_numpy_base_1736283260865/work/dist/numpy-2.0.2-cp39-cp39-linux_x86_64.whl#sha256=3387e3e62932fa288bc18e8f445ce19e998b418a65ed2064dd40a054f976a6c7 packaging @ file:///croot/packaging_1734472117206/work pluggy @ file:///croot/pluggy_1733169602837/work pytest @ file:///croot/pytest_1738938843180/work scipy @ file:///croot/scipy_1733756309941/work/dist/scipy-1.13.1-cp39-cp39-linux_x86_64.whl#sha256=3b247b926209f2d9f719ebae39faf3ff891b2596150ed8f8349adfc3eb19441c tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
name: AssociationEngine channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - blas=1.0=openblas - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgfortran-ng=11.2.0=h00389a5_1 - libgfortran5=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libopenblas=0.3.21=h043d6bf_0 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - numpy=2.0.2=py39heeff2f4_0 - numpy-base=2.0.2=py39h8a23956_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pybind11-abi=4=hd3eb1b0_1 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - scipy=1.13.1=py39heeff2f4_1 - setuptools=72.1.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 prefix: /opt/conda/envs/AssociationEngine
[ "Snapper/Snapper_test.py::test_should_receive_data_from_attached_sensor", "Snapper/Snapper_test.py::test_should_store_sensor", "Snapper/Snapper_test.py::test_should_generate_variable" ]
[]
[ "Snapper/Snapper_test.py::test_should_have_sensors_field_as_empty_list_on_init", "Snapper/Snapper_test.py::test_should_have_variables_field_as_empty_list_on_init" ]
[]
null
1,030
[ "Snapper/Snapper.py" ]
[ "Snapper/Snapper.py" ]
pimutils__todoman-117
6a213db74ccb922e3a1c8e47a21a55746912feb6
2017-02-22 10:54:47
e3099be88920a0bb0eff97eafd2d46c9275a4468
untitaker: @hobarrera I think I made all requested changes. untitaker: re https://github.com/pimutils/todoman/pull/117/commits/ab7a9958892595d580503332af58b6f8b2ec8fa6: Yeah, that's probably cleaner. hobarrera: > re ab7a995: Yeah, that's probably cleaner. Great, I just though it was faster to push it than explain it. 😄 untitaker: Ok i think this is ready to merge untitaker: Since you don't appear to be on IRC: >I would rather revert back to the old variant. Eventually I want to add support for bare dates for DUE (without time component) and this preprocessing makes it very hard. hobarrera: Yeah, I jump in and out of IRC, TBH. So, does any of the rest of the stack (rfc/icalendar/`Todo`/cache) support bare `date`s? untitaker: No, it would all have to be refactored for that. My point is that this code will require more changes with your proposed implementation. hobarrera: You're right, this won't work formatting separately, sadly. :( I wonder if we might just as well using something like [`arrow.humanize`](http://crsmithdev.com/arrow/#humanize) ([code](https://github.com/crsmithdev/arrow/blob/a78bb2ffde8582d648d54ecc0a6b04d61408e4cb/arrow/arrow.py#L703)) to do the work for us. hobarrera: I've also had my eye on [maya](https://github.com/kennethreitz/maya) for some time now, and it might also be capable of doing some parsing (though we really _should_ review it before changing anything). untitaker: Possibly in the future, but that's a lot of code there. I think we should be more conservative about "humanizing" datetimes, preferrably without loss of precision hobarrera: Back to this PR though: * Yes, my proposal is bad. * We should also support things like `--due 10:30`. If the event has a date, only change the time. If it doesn't make it today at 10:30. untitaker: I force-pushed the old variant. untitaker: >If the event has a date, only change the time. This will be complicated. Right now only datetimes are passed around. hobarrera: Sure, let's keep this simple and discuss more improvements in a separate issue. untitaker: I pushed a commit that allows the user to enter `--due 12:00`, and it will be parsed as "today 12am" (regardless of previous due value) hobarrera: > If the event has a date, only change the time. I meant, "if it has a `datetime`" (as opposed to having `None`). untitaker: So to be clear, if I set `todo.due` to a `time`, you want that only the time component gets updated, not the entire value replaced? This sounds counterintuitive. hobarrera: My idea was that, basically, when a user sets a time (note: this is really pseuocode, not python): ```python if todo.due: todo.due.set_time(time): else: todo.due = datetime(today, time) ``` Does this seem too unintuitive (I'm biased because it's my idea)? untitaker: In the CLI module `todo` properties are set in a much more generic way. hobarrera: Okay then, I won't distract any more, and let's aim to keep this simple. ^_^ untitaker: I added a bit of validation to the config parsing code, please review again. hobarrera: I pushed the changes I was suggesting for the validation. untitaker: Oops, sorry I didn't notice that there are already ConfigObj validators, or that ConfigObj even had that capability. hobarrera: LGTM, but since **I** pushed the last change, I'll also wait for you thumbs-up. untitaker: I woudl but I cannot approve my own RP hobarrera: Feel free to merge 🚀 untitaker: Travis triggers a `push`-type build, but that is nonsensical since the PR branch is outside of the main repo. Since this is a required status check I can't merge the PR hobarrera: I squash-pushed this, travis should stop being dumb (I think it got confused when I pushed to `pimutils/time-support`, but that's still a bug on their side.
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 32fa29b..0740b25 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,8 @@ releases, in reverse chronological order. v2.2.0 ------ +* Basic support for times in due dates, new ``time_format`` configuration + parameter. * Use the system's date format as a default. * Show "Today" or "Tomorrow" when due date is today/tomorrow respectively. diff --git a/todoman.conf.sample b/todoman.conf.sample index 08fa0b0..3a84f32 100644 --- a/todoman.conf.sample +++ b/todoman.conf.sample @@ -2,5 +2,6 @@ # A glob expression which matches all directories relevant. path = ~/.local/share/calendars/* date_format = %Y-%m-%d +time_format = %H:%M default_list = Personal default_due = 48 diff --git a/todoman/cli.py b/todoman/cli.py index 1e97645..811cc78 100644 --- a/todoman/cli.py +++ b/todoman/cli.py @@ -43,7 +43,7 @@ def _validate_list_param(ctx, param=None, name=None): def _validate_date_param(ctx, param, val): try: - return ctx.obj['formatter'].parse_date(val) + return ctx.obj['formatter'].parse_datetime(val) except ValueError as e: raise click.BadParameter(e) @@ -97,7 +97,11 @@ def cli(ctx, color, porcelain): if porcelain: ctx.obj['formatter'] = PorcelainFormatter() else: - ctx.obj['formatter'] = TodoFormatter(config['main']['date_format']) + ctx.obj['formatter'] = TodoFormatter( + config['main']['date_format'], + config['main']['time_format'], + config['main']['dt_separator'], + ) color = color or config['main']['color'] if color == 'always': diff --git a/todoman/configuration.py b/todoman/configuration.py index aa394ff..667baff 100644 --- a/todoman/configuration.py +++ b/todoman/configuration.py @@ -33,6 +33,24 @@ def validate_cache_path(path): ) +def validate_date_format(fmt): + if any(x in fmt for x in ('%H', '%M', '%S', '%X')): + raise ConfigurationException( + 'Found time component in `date_format`, please use `time_format` ' + 'for that.' + ) + return fmt + + +def validate_time_format(fmt): + if any(x in fmt for x in ('%Y', '%y', '%m', '%d', '%x')): + raise ConfigurationException( + 'Found date component in `time_format`, please use `date_format` ' + 'for that.' + ) + return fmt + + def validate_color(color): color = is_option(color) if color == 'always': @@ -67,6 +85,8 @@ def load_config(): validator = Validator({ 'expand_path': expand_path, 'cache_path': validate_cache_path, + 'date_format': validate_date_format, + 'time_format': validate_time_format, }) config = ConfigObj(path, configspec=specpath, file_error=True) diff --git a/todoman/confspec.ini b/todoman/confspec.ini index c5945f7..d900d7e 100644 --- a/todoman/confspec.ini +++ b/todoman/confspec.ini @@ -12,7 +12,13 @@ color = option('always', 'auto', 'never', default='auto') # The date format used both for displaying dates, and parsing input dates. If # this option is not specified the system locale's is used. -date_format = string(default='%x') +date_format = date_format(default='%x') + +# The date format used both for displaying times, and parsing input times. +time_format = time_format(default='%X') + +# The string used to separate date and time when displaying and parsing. +dt_separator = string(default=' ') # The default list for adding a todo. If you do not specify this option, you # must use the ``--list`` / ``-l`` option every time you add a todo. diff --git a/todoman/ui.py b/todoman/ui.py index b9b6efa..82baeb3 100644 --- a/todoman/ui.py +++ b/todoman/ui.py @@ -1,5 +1,5 @@ +import datetime import json -from datetime import datetime, timedelta from time import mktime import click @@ -39,13 +39,13 @@ class TodoEditor: if todo.due: # TODO: use proper date_format - due = formatter.format_date(todo.due) + due = formatter.format_datetime(todo.due) else: due = "" if todo.start: # TODO: use proper date_format - dtstart = formatter.format_date(todo.start) + dtstart = formatter.format_datetime(todo.start) else: dtstart = '' @@ -143,8 +143,8 @@ class TodoEditor: self.todo.summary = self.summary self.todo.description = self.description self.todo.location = self.location - self.todo.due = self.formatter.parse_date(self.due) - self.todo.start = self.formatter.parse_date(self.dtstart) + self.todo.due = self.formatter.parse_datetime(self.due) + self.todo.start = self.formatter.parse_datetime(self.dtstart) self.todo.is_completed = self._completed.get_state() @@ -200,15 +200,22 @@ class TodoFormatter: "{id:3d} [{completed}] {urgent} {due} {summary} {list}{percent}" # compact_format = "{completed} {urgent} {due} {summary}" - def __init__(self, date_format): + def __init__(self, date_format, time_format, dt_separator): self.date_format = date_format + self.time_format = time_format + self.dt_separator = dt_separator + self.datetime_format = date_format + dt_separator + time_format + self._localtimezone = tzlocal() - self.now = datetime.now().replace(tzinfo=self._localtimezone) - self.tomorrow = self.now.date() + timedelta(days=1) + self.now = datetime.datetime.now().replace(tzinfo=self._localtimezone) + self.tomorrow = self.now.date() + datetime.timedelta(days=1) # An empty date which should be used in case no date is present self.date_width = len(self.now.strftime(date_format)) self.empty_date = " " * self.date_width + + self.time_width = len(self.now.strftime(time_format)) + self.empty_time = " " * self.time_width # Map special dates to the special string we need to return self.special_dates = { self.now.date(): "Today".rjust(self.date_width, " "), @@ -230,7 +237,7 @@ class TodoFormatter: percent = " ({}%)".format(percent) urgent = " " if todo.priority in [None, 0] else "!" - due = self.format_date(todo.due) + due = self.format_datetime(todo.due) if todo.due and todo.due <= self.now and not todo.is_completed: due = click.style(due, fg='red') @@ -258,40 +265,76 @@ class TodoFormatter: rv = "{}\n\n{}".format(rv, todo.description) return rv - def format_date(self, date): + def _format_date(self, date): """ Returns date in the following format: * if date == today or tomorrow: "Today" or "Tomorrow" * else: return a string representing that date * if no date is supplied, it returns empty_date - :param datetime.datetime date: a datetime object + :param datetime.date date: a date object """ if date: - assert isinstance(date, datetime) - if date.date() in self.special_dates: - rv = self.special_dates[date.date()] + if date in self.special_dates: + rv = self.special_dates[date] else: rv = date.strftime(self.date_format) return rv else: return self.empty_date - def parse_date(self, date): - if not date: + def _format_time(self, time): + if time: + return time.strftime(self.time_format) + else: + return self.empty_time + + def format_datetime(self, dt): + if not dt: + date_part = None + time_part = None + else: + assert isinstance(dt, datetime.datetime) + date_part = dt.date() + time_part = dt.time() + + return self.dt_separator.join(filter(bool, ( + self._format_date(date_part), + self._format_time(time_part) + ))) + + def parse_datetime(self, dt): + if not dt: return None + rv = self._parse_datetime_naive(dt) + return rv.replace(tzinfo=self._localtimezone) + + def _parse_datetime_naive(self, dt): try: - rv = datetime.strptime(date, self.date_format) + return datetime.datetime.strptime(dt, self.datetime_format) except ValueError: - rv, certainty = self._parsedatetime_calendar.parse(date) - if not certainty: - raise ValueError( - 'Time description not recognized: {}' .format(date) - ) - rv = datetime.fromtimestamp(mktime(rv)) + pass - return rv.replace(tzinfo=self._localtimezone) + try: + return datetime.datetime.strptime(dt, self.date_format) + except ValueError: + pass + + try: + return datetime.datetime.combine( + self.now.date(), + datetime.datetime.strptime(dt, self.time_format).time() + ) + except ValueError: + pass + + rv, certainty = self._parsedatetime_calendar.parse(dt) + if not certainty: + raise ValueError( + 'Time description not recognized: {}' .format(dt) + ) + return datetime.datetime.fromtimestamp(mktime(rv)) def format_database(self, database): return '{}@{}'.format(database.color_ansi or '', @@ -303,7 +346,7 @@ class PorcelainFormatter: def compact(self, todo): data = dict( completed=todo.is_completed, - due=self.format_date(todo.due), + due=self.format_datetime(todo.due), id=todo.id, list=todo.list.name, percent=todo.percent_complete, @@ -316,7 +359,7 @@ class PorcelainFormatter: detailed = compact - def format_date(self, date): + def format_datetime(self, date): if date: return int(date.timestamp()) else:
Support times for due dates - Todoman should introduce a `time_format` configuration parameter that, if non-empty, is *additionally* used to format due datetimes. It should be omitted if `DUE` does not have a time component. - Todoman should prevent people from using `%H`, %M` and so on in `date_format` (I'm currently doing that) - Likewise it should prevent people from using `%Y` etc in `time_format`
pimutils/todoman
diff --git a/tests/conftest.py b/tests/conftest.py index 9ecafaf..0d66165 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -22,6 +22,7 @@ def config(tmpdir, default_database): path.write('[main]\n' 'path = {}/*\n' 'date_format = %Y-%m-%d\n' + 'time_format = \n' 'cache_path = {}\n' .format(str(tmpdir), str(tmpdir.join('cache.sqlite3')))) return path diff --git a/tests/test_formatter.py b/tests/test_formatter.py index cb5b9d3..67b6de1 100644 --- a/tests/test_formatter.py +++ b/tests/test_formatter.py @@ -4,18 +4,23 @@ from random import randrange from todoman import ui DATE_FORMAT = "%d-%m-%y" +TIME_FORMAT = "%H:%M" -def test_format_date(): - """ - Tests the format_date function in todoman.ui.TodoFormatter - """ - formatter = ui.TodoFormatter(DATE_FORMAT) +def test_human_dates(): + formatter = ui.TodoFormatter(DATE_FORMAT, TIME_FORMAT, ' ') today = datetime.now() tomorrow = today + timedelta(days=1) + tomorrow_12am = datetime(tomorrow.year, tomorrow.month, tomorrow.day, + 12, 0) + today_12am = datetime(today.year, today.month, today.day, + 12, 0) any_day = today + timedelta(days=randrange(2, 8)) - assert formatter.format_date("") == " " - assert formatter.format_date(today) == " Today" - assert formatter.format_date(tomorrow) == "Tomorrow" - assert formatter.format_date(any_day) == any_day.strftime(DATE_FORMAT) + assert formatter.format_datetime("") == " " + assert formatter._format_date(today.date()) == " Today" + assert formatter._format_date(tomorrow.date()) == "Tomorrow" + assert formatter.format_datetime(any_day) == \ + any_day.strftime(DATE_FORMAT + ' ' + TIME_FORMAT) + assert formatter.format_datetime(tomorrow_12am) == "Tomorrow 12:00" + assert formatter.parse_datetime('12:00').replace(tzinfo=None) == today_12am
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 6 }
2.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "hypothesis" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
atomicwrites==1.4.1 attrs==25.3.0 click==8.1.8 click-log==0.4.0 configobj==5.0.9 coverage==7.8.0 exceptiongroup==1.2.2 hypothesis==6.130.5 icalendar==6.1.3 iniconfig==2.1.0 packaging==24.2 parsedatetime==2.6 pluggy==1.5.0 pytest==8.3.5 pytest-cov==6.0.0 python-dateutil==2.9.0.post0 pyxdg==0.28 six==1.17.0 sortedcontainers==2.4.0 -e git+https://github.com/pimutils/todoman.git@6a213db74ccb922e3a1c8e47a21a55746912feb6#egg=todoman tomli==2.2.1 typing_extensions==4.13.0 tzdata==2025.2 urwid==2.6.16 wcwidth==0.2.13
name: todoman channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - atomicwrites==1.4.1 - attrs==25.3.0 - click==8.1.8 - click-log==0.4.0 - configobj==5.0.9 - coverage==7.8.0 - exceptiongroup==1.2.2 - hypothesis==6.130.5 - icalendar==6.1.3 - iniconfig==2.1.0 - packaging==24.2 - parsedatetime==2.6 - pluggy==1.5.0 - pytest==8.3.5 - pytest-cov==6.0.0 - python-dateutil==2.9.0.post0 - pyxdg==0.28 - six==1.17.0 - sortedcontainers==2.4.0 - tomli==2.2.1 - typing-extensions==4.13.0 - tzdata==2025.2 - urwid==2.6.16 - wcwidth==0.2.13 prefix: /opt/conda/envs/todoman
[ "tests/test_formatter.py::test_human_dates" ]
[]
[]
[]
ISC License
1,031
[ "todoman.conf.sample", "todoman/ui.py", "todoman/configuration.py", "CHANGELOG.rst", "todoman/cli.py", "todoman/confspec.ini" ]
[ "todoman.conf.sample", "todoman/ui.py", "todoman/configuration.py", "CHANGELOG.rst", "todoman/cli.py", "todoman/confspec.ini" ]
Azure__azure-cli-2214
01bbaf048c7669c024ece5e84c9360d829624574
2017-02-22 21:17:11
1576ec67f5029db062579da230902a559acbb9fe
diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/commands.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/commands.py index 0e5118830..3b6e72876 100644 --- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/commands.py +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/commands.py @@ -418,7 +418,7 @@ dns_record_set_path = 'azure.mgmt.dns.operations.record_sets_operations#RecordSe cli_command(__name__, 'network dns record-set list', custom_path.format('list_dns_record_set'), cf_dns_mgmt_record_sets, transform=transform_dns_record_set_output) for record in ['a', 'aaaa', 'mx', 'ns', 'ptr', 'srv', 'txt']: cli_command(__name__, 'network dns record-set {} show'.format(record), dns_record_set_path + 'get', cf_dns_mgmt_record_sets, transform=transform_dns_record_set_output, exception_handler=empty_on_404) - cli_command(__name__, 'network dns record-set {} delete'.format(record), dns_record_set_path + 'delete', cf_dns_mgmt_record_sets) + cli_command(__name__, 'network dns record-set {} delete'.format(record), dns_record_set_path + 'delete', cf_dns_mgmt_record_sets, confirmation=True) cli_command(__name__, 'network dns record-set {} list'.format(record), custom_path.format('list_dns_record_set'), cf_dns_mgmt_record_sets, transform=transform_dns_record_set_output, table_transformer=transform_dns_record_set_table_output) cli_command(__name__, 'network dns record-set {} create'.format(record), custom_path.format('create_dns_record_set'), transform=transform_dns_record_set_output) cli_command(__name__, 'network dns record-set {} add-record'.format(record), custom_path.format('add_dns_{}_record'.format(record)), transform=transform_dns_record_set_output)
[DNS] Deleting a record requires a confirmation prompt Deleting a record set is a potentially catastrophic operation. For this reason, in the Portal, PowerShell, and CLI1.0, the operation has a confirmation prompt. We need to add a similar confirmation prompt in CLI2.0. This applies to both `az network dns record-set <type> delete` and `az network dns record-set <type> remove-record`. The prompt should be suppressible for scripting purposes (e.g. via `--yes -y` same as `az network dns zone delete`)
Azure/azure-cli
diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py index c7c490fd5..1b0d4e81d 100644 --- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py @@ -1268,7 +1268,7 @@ class NetworkDnsScenarioTest(ResourceGroupVCRTestBase): self.cmd('network dns record-set {0} show -n myrs{0} -g {1} --zone-name {2}'.format('a', rg, zone_name), checks=NoneCheck()) - self.cmd('network dns record-set {0} delete -n myrs{0} -g {1} --zone-name {2}' + self.cmd('network dns record-set {0} delete -n myrs{0} -g {1} --zone-name {2} -y' .format('a', rg, zone_name)) self.cmd('network dns record-set {0} show -n myrs{0} -g {1} --zone-name {2}' .format('a', rg, zone_name), allowed_exceptions='does not exist in resource group')
{ "commit_name": "merge_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 1 }
0.1
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc libssl-dev libffi-dev" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==0.4.3 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==1.4.9 attrs==22.2.0 autopep8==1.2.4 azure-batch==1.1.0 -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_documentdb&subdirectory=src/command_modules/azure-cli-documentdb -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@01bbaf048c7669c024ece5e84c9360d829624574#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.4 azure-core==1.24.2 azure-graphrbac==0.30.0rc6 azure-keyvault==0.1.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==2.0.0 azure-mgmt-compute==0.33.1rc1 azure-mgmt-containerregistry==0.1.1 azure-mgmt-dns==1.0.0 azure-mgmt-documentdb==0.1.0 azure-mgmt-iothub==0.2.1 azure-mgmt-keyvault==0.30.0 azure-mgmt-network==0.30.0 azure-mgmt-nspkg==3.0.2 azure-mgmt-redis==1.0.0 azure-mgmt-resource==0.30.2 azure-mgmt-sql==0.2.0 azure-mgmt-storage==0.31.0 azure-mgmt-trafficmanager==0.30.0rc6 azure-mgmt-web==0.31.0 azure-nspkg==3.0.2 azure-storage==0.33.0 certifi==2021.5.30 cffi==1.15.1 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.7.1 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.5.4 pyOpenSSL==16.1.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 PyYAML==3.11 requests==2.9.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.5 tomli==1.2.3 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 wrapt==1.16.0 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==0.4.3 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==1.4.9 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==1.1.0 - azure-common==1.1.4 - azure-core==1.24.2 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.1.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==2.0.0 - azure-mgmt-compute==0.33.1rc1 - azure-mgmt-containerregistry==0.1.1 - azure-mgmt-dns==1.0.0 - azure-mgmt-documentdb==0.1.0 - azure-mgmt-iothub==0.2.1 - azure-mgmt-keyvault==0.30.0 - azure-mgmt-network==0.30.0 - azure-mgmt-nspkg==3.0.2 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==0.30.2 - azure-mgmt-sql==0.2.0 - azure-mgmt-storage==0.31.0 - azure-mgmt-trafficmanager==0.30.0rc6 - azure-mgmt-web==0.31.0 - azure-nspkg==3.0.2 - azure-storage==0.33.0 - cffi==1.15.1 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.7.1 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.5.4 - pyopenssl==16.1.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pyyaml==3.11 - requests==2.9.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.5 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - wrapt==1.16.0 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkDnsScenarioTest::test_network_dns" ]
[]
[ "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkMultiIdsShowScenarioTest::test_multi_id_show", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkUsageListScenarioTest::test_network_usage_list", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkAppGatewayDefaultScenarioTest::test_network_app_gateway_with_defaults", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkAppGatewayExistingSubnetScenarioTest::test_network_app_gateway_with_existing_subnet", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkAppGatewayNoWaitScenarioTest::test_network_app_gateway_no_wait", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkAppGatewayPrivateIpScenarioTest::test_network_app_gateway_with_private_ip", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkAppGatewayPublicIpScenarioTest::test_network_app_gateway_with_public_ip", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkAppGatewayWafScenarioTest::test_network_app_gateway_waf", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkPublicIpScenarioTest::test_network_public_ip", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkExpressRouteScenarioTest::test_network_express_route", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkLoadBalancerScenarioTest::test_network_load_balancer", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkLoadBalancerIpConfigScenarioTest::test_network_load_balancer_ip_config", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkLoadBalancerSubresourceScenarioTest::test_network_load_balancer_subresources", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkLocalGatewayScenarioTest::test_network_local_gateway", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkNicScenarioTest::test_network_nic", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkNicSubresourceScenarioTest::test_network_nic_subresources", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkNicConvenienceCommandsScenarioTest::test_network_nic_convenience_commands", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkSecurityGroupScenarioTest::test_network_nsg", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkRouteTableOperationScenarioTest::test_network_route_table_operation", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkVNetScenarioTest::test_network_vnet", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkVNetPeeringScenarioTest::test_network_vnet_peering", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkSubnetSetScenarioTest::test_network_subnet_set", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkVpnGatewayScenarioTest::test_network_vpn_gateway", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkTrafficManagerScenarioTest::test_network_traffic_manager", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_commands.py::NetworkZoneImportExportTest::test_network_dns_zone_import_export" ]
[]
MIT License
1,032
[ "src/command_modules/azure-cli-network/azure/cli/command_modules/network/commands.py" ]
[ "src/command_modules/azure-cli-network/azure/cli/command_modules/network/commands.py" ]
zopefoundation__ZConfig-24
a79e6a49c983eba104aff4e0869002437a66426f
2017-02-22 22:52:54
648fc674631ab28c7268aba114804020f8d7ebec
diff --git a/ZConfig/info.py b/ZConfig/info.py index 02ced04..758430b 100644 --- a/ZConfig/info.py +++ b/ZConfig/info.py @@ -17,6 +17,7 @@ import copy import ZConfig from abc import abstractmethod +from collections import OrderedDict from functools import total_ordering from ZConfig._compat import AbstractBaseClass @@ -137,7 +138,7 @@ class BaseKeyInfo(AbstractBaseClass, BaseInfo): assert self.name == "+" if self._rawdefaults is None: self._rawdefaults = self._default - self._default = {} + self._default = OrderedDict() class KeyInfo(BaseKeyInfo): @@ -148,7 +149,7 @@ class KeyInfo(BaseKeyInfo): BaseKeyInfo.__init__(self, name, datatype, minOccurs, 1, handler, attribute) if self.name == "+": - self._default = {} + self._default = OrderedDict() def add_valueinfo(self, vi, key): if self.name == "+": @@ -184,7 +185,7 @@ class MultiKeyInfo(BaseKeyInfo): BaseKeyInfo.__init__(self, name, datatype, minOccurs, maxOccurs, handler, attribute) if self.name == "+": - self._default = {} + self._default = OrderedDict() else: self._default = [] @@ -269,14 +270,19 @@ class SectionInfo(BaseInfo): class AbstractType(object): - + # This isn't actually "abstract" in the Python ABC sense, + # it's only abstract from the schema sense. This class is + # instantiated, and not expected to be subclassed. __slots__ = '_subtypes', 'name', 'description' def __init__(self, name): - self._subtypes = {} + self._subtypes = OrderedDict() self.name = name self.description = None + def __iter__(self): + return iter(self._subtypes.items()) + def addsubtype(self, type): self._subtypes[type.name] = type @@ -314,8 +320,8 @@ class SectionType(object): self.example = None self.registry = registry self._children = [] # [(key, info), ...] - self._attrmap = {} # {attribute: info, ...} - self._keymap = {} # {key: info, ...} + self._attrmap = OrderedDict() # {attribute: info, ...} + self._keymap = OrderedDict() # {key: info, ...} self._types = types def gettype(self, name): @@ -334,6 +340,12 @@ class SectionType(object): def __getitem__(self, index): return self._children[index] + def __iter__(self): + return iter(self._children) + + def itertypes(self): + return iter(sorted(self._types.items())) + def _add_child(self, key, info): # check naming constraints assert key or info.attribute @@ -367,7 +379,7 @@ class SectionType(object): raise ZConfig.ConfigurationError("no key matching " + repr(key)) def getrequiredtypes(self): - d = {} + d = OrderedDict() if self.name: d[self.name] = 1 stack = [self] @@ -432,7 +444,7 @@ class SchemaType(SectionType): registry): SectionType.__init__(self, None, keytype, valuetype, datatype, registry, {}) - self._components = {} + self._components = OrderedDict() self.handler = handler self.url = url diff --git a/ZConfig/schema2html.py b/ZConfig/schema2html.py index c3cc33c..0d0791c 100755 --- a/ZConfig/schema2html.py +++ b/ZConfig/schema2html.py @@ -22,6 +22,7 @@ import ZConfig.loader from ZConfig.info import SectionType from ZConfig.info import SectionInfo from ZConfig.info import ValueInfo +from ZConfig.info import AbstractType def esc(x): return cgi.escape(str(x)) @@ -32,7 +33,10 @@ def dt(x): if isinstance(x, type): return '%s %s' % (tn, x.__module__ + '.' + x.__name__) - return '%s %s' % (tn, x.__name__) + if hasattr(x, '__name__'): + return '%s %s' % (tn, x.__name__) + + return tn class explain(object): done = [] @@ -88,6 +92,13 @@ def printContents(name, info, file=None): for sub in info.sectiontype: printContents(*sub, file=out) print('</dl></dd>', file=out) + elif isinstance(info, AbstractType): + print('<dt><b><i>', info.name, '</i></b>', file=out) + print('<dd>', file=out) + if info.description: + print(info.description, file=out) # pragma: no cover + explain(info, file=out) + print('</dd>', file=out) else: print('<dt><b>',info.name, '</b>', '(%s)' % dt(info.datatype), file=out) default = info.getdefault() @@ -108,26 +119,47 @@ def main(argv=None): description="Print an HTML version of a schema") argparser.add_argument( "schema", - help="The schema to print", - default="-", - type=argparse.FileType('r')) + metavar='[SCHEMA-OR-PACKAGE]', + help="The schema to print. By default, a file. Optionally, a Python package." + " If not given, defaults to reading a schema file from stdin", + default="-" + ) argparser.add_argument( "--out", "-o", help="Write the schema to this file; if not given, write to stdout", type=argparse.FileType('w')) + argparser.add_argument( + "--package", + action='store_true', + default=False, + help="The SCHEMA-OR-PACKAGE argument indicates a Python package instead of a file." + " The component.xml (by default) from the package will be read.") + argparser.add_argument( + "--package-file", + action="store", + default="component.xml", + help="When PACKAGE is given, this can specify the file inside it to load.") args = argparser.parse_args(argv) out = args.out or sys.stdout - schema = ZConfig.loader.loadSchemaFile(args.schema) + if not args.package: + schema_reader = argparse.FileType('r')(args.schema) + else: + schema_template = "<schema><import package='%s' file='%s' /></schema>" % ( + args.schema, args.package_file) + from ZConfig._compat import TextIO + schema_reader = TextIO(schema_template) + + schema = ZConfig.loader.loadSchemaFile(schema_reader) print('''<html><body> <style> dl {margin: 0 0 1em 0;} </style> ''', file=out) - printSchema(schema, out) + printSchema(iter(schema) if not args.package else schema.itertypes(), out) print('</body></html>', file=out) return 0
zconfig_schema2html should handle component.xml from packages If you feed it a component file, right now it blows up. If I change the script to do the obvious thing and wrap a `<schema><import package="..."/></schema>` around it, then you get no output.
zopefoundation/ZConfig
diff --git a/ZConfig/tests/test_schema2html.py b/ZConfig/tests/test_schema2html.py index b11eb31..f1cf668 100644 --- a/ZConfig/tests/test_schema2html.py +++ b/ZConfig/tests/test_schema2html.py @@ -49,7 +49,7 @@ def run_transform(*args): with stdout_replaced(buf): schema2html.main(args) return buf - return schema2html.main(args) + return schema2html.main(args) # pragma: no cover @@ -79,6 +79,9 @@ class TestSchema2HTML(unittest.TestCase): res = run_transform(input_file(name)) self.assertIn('</html>', res.getvalue()) + def test_cover_logging_components(self): + res = run_transform('--package', 'ZConfig.components.logger') + self.assertIn('eventlog', res.getvalue()) def test_suite(): return unittest.defaultTestLoader.loadTestsFromName(__name__)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 2 }
3.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "coverage", "zope.testrunner", "nti.sphinxcontrib-programoutput" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work Babel==2.11.0 certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 docutils==0.18.1 idna==3.10 imagesize==1.4.1 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work Jinja2==3.0.3 MarkupSafe==2.0.1 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work nti.sphinxcontrib-programoutput==0.10 packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work Pygments==2.14.0 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 pytz==2025.2 requests==2.27.1 six==1.17.0 snowballstemmer==2.2.0 Sphinx==5.3.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-programoutput==0.17 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 toml @ file:///tmp/build/80754af9/toml_1616166611790/work typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 -e git+https://github.com/zopefoundation/ZConfig.git@a79e6a49c983eba104aff4e0869002437a66426f#egg=ZConfig zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work zope.exceptions==4.6 zope.interface==5.5.2 zope.testrunner==5.6
name: ZConfig channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - babel==2.11.0 - charset-normalizer==2.0.12 - coverage==6.2 - docutils==0.18.1 - idna==3.10 - imagesize==1.4.1 - jinja2==3.0.3 - markupsafe==2.0.1 - nti-sphinxcontrib-programoutput==0.10 - pygments==2.14.0 - pytz==2025.2 - requests==2.27.1 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==5.3.0 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-programoutput==0.17 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - urllib3==1.26.20 - zope-exceptions==4.6 - zope-interface==5.5.2 - zope-testrunner==5.6 prefix: /opt/conda/envs/ZConfig
[ "ZConfig/tests/test_schema2html.py::TestSchema2HTML::test_cover_logging_components" ]
[]
[ "ZConfig/tests/test_schema2html.py::TestSchema2HTML::test_cover_all_schemas", "ZConfig/tests/test_schema2html.py::TestSchema2HTML::test_no_schema", "ZConfig/tests/test_schema2html.py::TestSchema2HTML::test_schema_only", "ZConfig/tests/test_schema2html.py::TestSchema2HTML::test_schema_only_redirect", "ZConfig/tests/test_schema2html.py::test_suite" ]
[]
Zope Public License 2.1
1,033
[ "ZConfig/info.py", "ZConfig/schema2html.py" ]
[ "ZConfig/info.py", "ZConfig/schema2html.py" ]
Duke-GCB__DukeDSClient-113
a1ffd407bc0dd886c892eb0667f79d08317f7b84
2017-02-23 11:42:04
bffebebd86d09f5924461959401ef3698b4e47d5
diff --git a/ddsc/cmdparser.py b/ddsc/cmdparser.py index 91f6940..fdceb62 100644 --- a/ddsc/cmdparser.py +++ b/ddsc/cmdparser.py @@ -3,6 +3,7 @@ Command line parser for the application. """ import os import argparse +import six from builtins import str @@ -26,7 +27,7 @@ def to_unicode(s): :param s: string to convert to unicode :return: unicode string for argument """ - return str(s) + return s if six.PY3 else str(s, 'utf-8') def add_project_name_arg(arg_parser, required=True, help_text="Name of the remote project to manage."): diff --git a/ddsc/core/util.py b/ddsc/core/util.py index a5e7112..10e0445 100644 --- a/ddsc/core/util.py +++ b/ddsc/core/util.py @@ -232,9 +232,9 @@ def wait_for_processes(processes, size, progress_queue, watcher, item): def verify_terminal_encoding(encoding): """ - Raises ValueError with error message when terminal encoding is not Unicode(contains UTF). + Raises ValueError with error message when terminal encoding is not Unicode(contains UTF ignoring case). :param encoding: str: encoding we want to check """ encoding = encoding or '' - if not ("UTF" in encoding): + if not ("UTF" in encoding.upper()): raise ValueError(TERMINAL_ENCODING_NOT_UTF_ERROR)
Check for lowercase utf-8 in encoding Testing Windows 7 with Anaconda(python 3.6) 4.3.0 ignores the PYTHONIOENCODING value and displays lowercase utf-8. Change the code in ddsc/core/util.py verify_terminal_encoding to ignore case.
Duke-GCB/DukeDSClient
diff --git a/ddsc/core/tests/test_util.py b/ddsc/core/tests/test_util.py new file mode 100644 index 0000000..daf00cd --- /dev/null +++ b/ddsc/core/tests/test_util.py @@ -0,0 +1,24 @@ +from unittest import TestCase + +from ddsc.core.util import verify_terminal_encoding + + +class TestUtil(TestCase): + + def test_verify_terminal_encoding_upper(self): + verify_terminal_encoding('UTF') + + def test_verify_terminal_encoding_lower(self): + verify_terminal_encoding('utf') + + def test_verify_terminal_encoding_ascii_raises(self): + with self.assertRaises(ValueError): + verify_terminal_encoding('ascii') + + def test_verify_terminal_encoding_empty_raises(self): + with self.assertRaises(ValueError): + verify_terminal_encoding('') + + def test_verify_terminal_encoding_none_raises(self): + with self.assertRaises(ValueError): + verify_terminal_encoding(None)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 2 }
0.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "mock", "flake8", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 -e git+https://github.com/Duke-GCB/DukeDSClient.git@a1ffd407bc0dd886c892eb0667f79d08317f7b84#egg=DukeDSClient flake8==5.0.4 future==0.16.0 importlib-metadata==4.2.0 iniconfig==1.1.1 mccabe==0.7.0 mock==5.2.0 packaging==21.3 pluggy==1.0.0 py==1.11.0 pycodestyle==2.9.1 pyflakes==2.5.0 pyparsing==3.1.4 pytest==7.0.1 PyYAML==3.12 requests==2.13.0 six==1.10.0 tomli==1.2.3 typing_extensions==4.1.1 zipp==3.6.0
name: DukeDSClient channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - flake8==5.0.4 - future==0.16.0 - importlib-metadata==4.2.0 - iniconfig==1.1.1 - mccabe==0.7.0 - mock==5.2.0 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pycodestyle==2.9.1 - pyflakes==2.5.0 - pyparsing==3.1.4 - pytest==7.0.1 - pyyaml==3.12 - requests==2.13.0 - six==1.10.0 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/DukeDSClient
[ "ddsc/core/tests/test_util.py::TestUtil::test_verify_terminal_encoding_lower" ]
[]
[ "ddsc/core/tests/test_util.py::TestUtil::test_verify_terminal_encoding_ascii_raises", "ddsc/core/tests/test_util.py::TestUtil::test_verify_terminal_encoding_empty_raises", "ddsc/core/tests/test_util.py::TestUtil::test_verify_terminal_encoding_none_raises", "ddsc/core/tests/test_util.py::TestUtil::test_verify_terminal_encoding_upper" ]
[]
MIT License
1,034
[ "ddsc/cmdparser.py", "ddsc/core/util.py" ]
[ "ddsc/cmdparser.py", "ddsc/core/util.py" ]
html5lib__html5lib-python-324
984f934d30ba2fde0e9ce5d4581c73fb81654474
2017-02-23 18:49:15
41bd598ed867f3076223328e9db577c4366ad518
willkg: This has been sitting around for 6 months. I was told if I put a PR together that someone would help me land it: https://github.com/html5lib/html5lib-python/issues/322#issuecomment-281811976 What's going on? What can I do to help land this and move forward with the other 17 pull requests in the queue?
diff --git a/html5lib/filters/alphabeticalattributes.py b/html5lib/filters/alphabeticalattributes.py index 4795bae..f938ba1 100644 --- a/html5lib/filters/alphabeticalattributes.py +++ b/html5lib/filters/alphabeticalattributes.py @@ -8,13 +8,24 @@ except ImportError: from ordereddict import OrderedDict +def _attr_key(attr): + """Return an appropriate key for an attribute for sorting + + Attributes have a namespace that can be either ``None`` or a string. We + can't compare the two because they're different types, so we convert + ``None`` to an empty string first. + + """ + return (attr[0][0] or ''), attr[0][1] + + class Filter(base.Filter): def __iter__(self): for token in base.Filter.__iter__(self): if token["type"] in ("StartTag", "EmptyTag"): attrs = OrderedDict() for name, value in sorted(token["data"].items(), - key=lambda x: x[0]): + key=_attr_key): attrs[name] = value token["data"] = attrs yield token
alphabeticalattributes filter TypeError when comparing namespaced attributes with non-namespaced attributes In SVG 1.1, you could have something like this: ``` <svg><pattern id="patt1" xlink:href="http://example.com/#whatever" /></svg> ``` In Python 3, that creates the following attributes: ``` dict_items([((None, 'id'), 'patt1'), (('http://www.w3.org/1999/xlink', 'href'), '#patt2')]) ``` The problem is that this means we're comparing `None` with a str here: https://github.com/html5lib/html5lib-python/blob/17499b9763a090f7715af49555d21fe4b558958b/html5lib/filters/alphabeticalattributes.py#L17 That kicks up a TypeError. Script: ``` import html5lib from html5lib.serializer import HTMLSerializer text = '<svg><pattern id="patt1" xlink:href="http://example.com/#foo" /></svg>' parser = html5lib.HTMLParser() dom = parser.parseFragment(text) walker = html5lib.getTreeWalker('etree') ser = HTMLSerializer(alphabetical_attributes=True) ser.render(walker(dom)) ``` Traceback: ``` Traceback (most recent call last): File "foo.py", line 12, in <module> ser.render(walker(dom)) File "/home/willkg/mozilla/bleach/.tox/py34-html5lib99999999/lib/python3.4/site-packages/html5lib/serializer.py", line 323, in render return "".join(list(self.serialize(treewalker))) File "/home/willkg/mozilla/bleach/.tox/py34-html5lib99999999/lib/python3.4/site-packages/html5lib/serializer.py", line 209, in serialize for token in treewalker: File "/home/willkg/mozilla/bleach/.tox/py34-html5lib99999999/lib/python3.4/site-packages/html5lib/filters/optionaltags.py", line 18, in __iter__ for previous, token, next in self.slider(): File "/home/willkg/mozilla/bleach/.tox/py34-html5lib99999999/lib/python3.4/site-packages/html5lib/filters/optionaltags.py", line 9, in slider for token in self.source: File "/home/willkg/mozilla/bleach/.tox/py34-html5lib99999999/lib/python3.4/site-packages/html5lib/filters/alphabeticalattributes.py", line 17, in __iter__ key=lambda x: x[0]): TypeError: unorderable types: str() < NoneType() ``` This is true of html5lib 0.99999999 (8 9s) and 0.999999999 (9 9s).
html5lib/html5lib-python
diff --git a/html5lib/tests/test_alphabeticalattributes.py b/html5lib/tests/test_alphabeticalattributes.py new file mode 100644 index 0000000..9e560a1 --- /dev/null +++ b/html5lib/tests/test_alphabeticalattributes.py @@ -0,0 +1,81 @@ +from __future__ import absolute_import, division, unicode_literals + +try: + from collections import OrderedDict +except ImportError: + from ordereddict import OrderedDict + +import pytest + +import html5lib +from html5lib.filters.alphabeticalattributes import Filter +from html5lib.serializer import HTMLSerializer + + [email protected]('msg, attrs, expected_attrs', [ + ( + 'no attrs', + {}, + {} + ), + ( + 'one attr', + {(None, 'alt'): 'image'}, + OrderedDict([((None, 'alt'), 'image')]) + ), + ( + 'multiple attrs', + { + (None, 'src'): 'foo', + (None, 'alt'): 'image', + (None, 'style'): 'border: 1px solid black;' + }, + OrderedDict([ + ((None, 'alt'), 'image'), + ((None, 'src'), 'foo'), + ((None, 'style'), 'border: 1px solid black;') + ]) + ), +]) +def test_alphabetizing(msg, attrs, expected_attrs): + tokens = [{'type': 'StartTag', 'name': 'img', 'data': attrs}] + output_tokens = list(Filter(tokens)) + + attrs = output_tokens[0]['data'] + assert attrs == expected_attrs + + +def test_with_different_namespaces(): + tokens = [{ + 'type': 'StartTag', + 'name': 'pattern', + 'data': { + (None, 'id'): 'patt1', + ('http://www.w3.org/1999/xlink', 'href'): '#patt2' + } + }] + output_tokens = list(Filter(tokens)) + + attrs = output_tokens[0]['data'] + assert attrs == OrderedDict([ + ((None, 'id'), 'patt1'), + (('http://www.w3.org/1999/xlink', 'href'), '#patt2') + ]) + + +def test_with_serializer(): + """Verify filter works in the context of everything else""" + parser = html5lib.HTMLParser() + dom = parser.parseFragment('<svg><pattern xlink:href="#patt2" id="patt1"></svg>') + walker = html5lib.getTreeWalker('etree') + ser = HTMLSerializer( + alphabetical_attributes=True, + quote_attr_values='always' + ) + + # FIXME(willkg): The "xlink" namespace gets dropped by the serializer. When + # that gets fixed, we can fix this expected result. + assert ( + ser.render(walker(dom)) == + '<svg><pattern id="patt1" href="#patt2"></pattern></svg>' + )
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_hyperlinks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 1 }
1.010
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[all]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-expect", "mock" ], "pre_install": null, "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
chardet==5.2.0 datrie==0.8.2 exceptiongroup==1.2.2 Genshi==0.7.9 -e git+https://github.com/html5lib/html5lib-python.git@984f934d30ba2fde0e9ce5d4581c73fb81654474#egg=html5lib iniconfig==2.1.0 lxml==5.3.1 mock==5.2.0 packaging==24.2 pluggy==1.5.0 pytest==8.3.5 pytest-expect==1.1.0 six==1.17.0 tomli==2.2.1 u-msgpack-python==2.8.0 webencodings==0.5.1
name: html5lib-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - chardet==5.2.0 - datrie==0.8.2 - exceptiongroup==1.2.2 - genshi==0.7.9 - iniconfig==2.1.0 - lxml==5.3.1 - mock==5.2.0 - packaging==24.2 - pluggy==1.5.0 - pytest==8.3.5 - pytest-expect==1.1.0 - six==1.17.0 - tomli==2.2.1 - u-msgpack-python==2.8.0 - webencodings==0.5.1 prefix: /opt/conda/envs/html5lib-python
[ "html5lib/tests/test_alphabeticalattributes.py::test_with_different_namespaces", "html5lib/tests/test_alphabeticalattributes.py::test_with_serializer" ]
[]
[ "html5lib/tests/test_alphabeticalattributes.py::test_alphabetizing[no", "html5lib/tests/test_alphabeticalattributes.py::test_alphabetizing[one", "html5lib/tests/test_alphabeticalattributes.py::test_alphabetizing[multiple" ]
[]
MIT License
1,035
[ "html5lib/filters/alphabeticalattributes.py" ]
[ "html5lib/filters/alphabeticalattributes.py" ]
borgbackup__borg-2206
4862efe718797e9fff6ca0dbfa24e8af8491be09
2017-02-24 03:22:58
b9d834409c9e498d78f2df8ca3a8c24132293499
diff --git a/src/borg/helpers.py b/src/borg/helpers.py index 89b557e5..5d05b3ce 100644 --- a/src/borg/helpers.py +++ b/src/borg/helpers.py @@ -1004,10 +1004,17 @@ class Location: # path must not contain :: (it ends at :: or string end), but may contain single colons. # to avoid ambiguities with other regexes, it must also not start with ":" nor with "//" nor with "ssh://". - path_re = r""" + scp_path_re = r""" (?!(:|//|ssh://)) # not starting with ":" or // or ssh:// (?P<path>([^:]|(:(?!:)))+) # any chars, but no "::" """ + + # file_path must not contain :: (it ends at :: or string end), but may contain single colons. + # it must start with a / and that slash is part of the path. + file_path_re = r""" + (?P<path>(([^/]*)/([^:]|(:(?!:)))+)) # start opt. servername, then /, then any chars, but no "::" + """ + # abs_path must not contain :: (it ends at :: or string end), but may contain single colons. # it must start with a / and that slash is part of the path. abs_path_re = r""" @@ -1032,7 +1039,7 @@ class Location: file_re = re.compile(r""" (?P<proto>file):// # file:// - """ + path_re + optional_archive_re, re.VERBOSE) # path or path::archive + """ + file_path_re + optional_archive_re, re.VERBOSE) # servername/path, path or path::archive # note: scp_re is also use for local pathes scp_re = re.compile(r""" @@ -1040,7 +1047,7 @@ class Location: """ + optional_user_re + r""" # user@ (optional) (?P<host>[^:/]+): # host: (don't match / in host to disambiguate from file:) )? # user@host: part is optional - """ + path_re + optional_archive_re, re.VERBOSE) # path with optional archive + """ + scp_path_re + optional_archive_re, re.VERBOSE) # path with optional archive # get the repo from BORG_REPO env and the optional archive from param. # if the syntax requires giving REPOSITORY (see "borg mount"),
Borg (cygwin) 1.0.10 don't like smb paths I know that cygwin is not really supported, but it worked with smb paths with no problems until version 1.0.10. I also tested the cygwin version from billyc [https://github.com/borgbackup/borg/issues/440](https://github.com/borgbackup/borg/issues/440) Same result. /cygdrive/x/abc still works > borg list //synology/Backups/My-PC/Borg > > usage: borg list [-h] [--critical] [--error] [--warning] [--info] [--debug] > [--lock-wait N] [--show-rc] [--no-files-cache] [--umask M] > [--remote-path PATH] [--short] [--list-format LISTFORMAT] > [-P PREFIX] > [REPOSITORY_OR_ARCHIVE] > > borg list: error: argument REPOSITORY_OR_ARCHIVE: Invalid location format: "//synology/Backups/My-PC/Borg"
borgbackup/borg
diff --git a/src/borg/testsuite/helpers.py b/src/borg/testsuite/helpers.py index 8dca6a39..57bf0175 100644 --- a/src/borg/testsuite/helpers.py +++ b/src/borg/testsuite/helpers.py @@ -60,6 +60,11 @@ def test_scp(self, monkeypatch): assert repr(Location('user@host:/some/path')) == \ "Location(proto='ssh', user='user', host='host', port=None, path='/some/path', archive=None)" + def test_smb(self, monkeypatch): + monkeypatch.delenv('BORG_REPO', raising=False) + assert repr(Location('file:////server/share/path::archive')) == \ + "Location(proto='file', user=None, host=None, port=None, path='//server/share/path', archive='archive')" + def test_folder(self, monkeypatch): monkeypatch.delenv('BORG_REPO', raising=False) assert repr(Location('path::archive')) == \
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 1 }
1.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[fuse]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-xdist", "pytest-cov", "pytest-benchmark" ], "pre_install": [ "apt-get update", "apt-get install -y gcc python3-dev libssl-dev libacl1-dev liblz4-dev libfuse-dev fuse pkg-config" ], "python": "3.9", "reqs_path": [ "requirements.d/development.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
-e git+https://github.com/borgbackup/borg.git@4862efe718797e9fff6ca0dbfa24e8af8491be09#egg=borgbackup cachetools==5.5.2 chardet==5.2.0 colorama==0.4.6 coverage==7.8.0 Cython==3.0.12 distlib==0.3.9 exceptiongroup==1.2.2 execnet==2.1.1 filelock==3.18.0 iniconfig==2.1.0 llfuse==1.5.1 msgpack-python==0.5.6 packaging==24.2 platformdirs==4.3.7 pluggy==1.5.0 py-cpuinfo==9.0.0 pyproject-api==1.9.0 pytest==8.3.5 pytest-benchmark==5.1.0 pytest-cov==6.0.0 pytest-xdist==3.6.1 tomli==2.2.1 tox==4.25.0 typing_extensions==4.13.0 virtualenv==20.29.3
name: borg channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - cachetools==5.5.2 - chardet==5.2.0 - colorama==0.4.6 - coverage==7.8.0 - cython==3.0.12 - distlib==0.3.9 - exceptiongroup==1.2.2 - execnet==2.1.1 - filelock==3.18.0 - iniconfig==2.1.0 - llfuse==1.5.1 - msgpack-python==0.5.6 - packaging==24.2 - platformdirs==4.3.7 - pluggy==1.5.0 - py-cpuinfo==9.0.0 - pyproject-api==1.9.0 - pytest==8.3.5 - pytest-benchmark==5.1.0 - pytest-cov==6.0.0 - pytest-xdist==3.6.1 - tomli==2.2.1 - tox==4.25.0 - typing-extensions==4.13.0 - virtualenv==20.29.3 prefix: /opt/conda/envs/borg
[ "src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_smb" ]
[ "src/borg/testsuite/helpers.py::test_is_slow_msgpack" ]
[ "src/borg/testsuite/helpers.py::test_bin_to_hex", "src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_ssh", "src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_file", "src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_scp", "src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_folder", "src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_abspath", "src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_relpath", "src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_with_colons", "src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_user_parsing", "src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_underspecified", "src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_no_slashes", "src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_canonical_path", "src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_format_path", "src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_bad_syntax", "src/borg/testsuite/helpers.py::TestLocationWithEnv::test_ssh", "src/borg/testsuite/helpers.py::TestLocationWithEnv::test_file", "src/borg/testsuite/helpers.py::TestLocationWithEnv::test_scp", "src/borg/testsuite/helpers.py::TestLocationWithEnv::test_folder", "src/borg/testsuite/helpers.py::TestLocationWithEnv::test_abspath", "src/borg/testsuite/helpers.py::TestLocationWithEnv::test_relpath", "src/borg/testsuite/helpers.py::TestLocationWithEnv::test_with_colons", "src/borg/testsuite/helpers.py::TestLocationWithEnv::test_no_slashes", "src/borg/testsuite/helpers.py::FormatTimedeltaTestCase::test", "src/borg/testsuite/helpers.py::test_patterns_prefix[/-None]", "src/borg/testsuite/helpers.py::test_patterns_prefix[/./-None]", "src/borg/testsuite/helpers.py::test_patterns_prefix[-expected2]", "src/borg/testsuite/helpers.py::test_patterns_prefix[/home/u-expected3]", "src/borg/testsuite/helpers.py::test_patterns_prefix[/home/user-expected4]", "src/borg/testsuite/helpers.py::test_patterns_prefix[/etc-expected5]", "src/borg/testsuite/helpers.py::test_patterns_prefix[///etc//////-expected6]", "src/borg/testsuite/helpers.py::test_patterns_prefix[/./home//..//home/user2-expected7]", "src/borg/testsuite/helpers.py::test_patterns_prefix[/srv-expected8]", "src/borg/testsuite/helpers.py::test_patterns_prefix_relative[-expected0]", "src/borg/testsuite/helpers.py::test_patterns_prefix_relative[foo-expected1]", "src/borg/testsuite/helpers.py::test_patterns_prefix_relative[relative-expected2]", "src/borg/testsuite/helpers.py::test_patterns_prefix_relative[more-expected3]", "src/borg/testsuite/helpers.py::test_patterns_fnmatch[/*-None]", "src/borg/testsuite/helpers.py::test_patterns_fnmatch[/./*-None]", "src/borg/testsuite/helpers.py::test_patterns_fnmatch[*-None]", "src/borg/testsuite/helpers.py::test_patterns_fnmatch[*/*-None]", "src/borg/testsuite/helpers.py::test_patterns_fnmatch[*///*-None]", "src/borg/testsuite/helpers.py::test_patterns_fnmatch[/home/u-expected5]", "src/borg/testsuite/helpers.py::test_patterns_fnmatch[/home/*-expected6]", "src/borg/testsuite/helpers.py::test_patterns_fnmatch[/home/user/*-expected7]", "src/borg/testsuite/helpers.py::test_patterns_fnmatch[/etc/*-expected8]", "src/borg/testsuite/helpers.py::test_patterns_fnmatch[*/.pr????e-expected9]", "src/borg/testsuite/helpers.py::test_patterns_fnmatch[///etc//////*-expected10]", "src/borg/testsuite/helpers.py::test_patterns_fnmatch[/./home//..//home/user2/*-expected11]", "src/borg/testsuite/helpers.py::test_patterns_fnmatch[/srv*-expected12]", "src/borg/testsuite/helpers.py::test_patterns_fnmatch[/home/*/.thumbnails-expected13]", "src/borg/testsuite/helpers.py::test_patterns_shell[*-None]", "src/borg/testsuite/helpers.py::test_patterns_shell[**/*-None]", "src/borg/testsuite/helpers.py::test_patterns_shell[/**/*-None]", "src/borg/testsuite/helpers.py::test_patterns_shell[/./*-None]", "src/borg/testsuite/helpers.py::test_patterns_shell[*/*-None]", "src/borg/testsuite/helpers.py::test_patterns_shell[*///*-None]", "src/borg/testsuite/helpers.py::test_patterns_shell[/home/u-expected6]", "src/borg/testsuite/helpers.py::test_patterns_shell[/home/*-expected7]", "src/borg/testsuite/helpers.py::test_patterns_shell[/home/user/*-expected8]", "src/borg/testsuite/helpers.py::test_patterns_shell[/etc/*/*-expected9]", "src/borg/testsuite/helpers.py::test_patterns_shell[/etc/**/*-expected10]", "src/borg/testsuite/helpers.py::test_patterns_shell[/etc/**/*/*-expected11]", "src/borg/testsuite/helpers.py::test_patterns_shell[*/.pr????e-expected12]", "src/borg/testsuite/helpers.py::test_patterns_shell[**/.pr????e-expected13]", "src/borg/testsuite/helpers.py::test_patterns_shell[///etc//////*-expected14]", "src/borg/testsuite/helpers.py::test_patterns_shell[/./home//..//home/user2/-expected15]", "src/borg/testsuite/helpers.py::test_patterns_shell[/./home//..//home/user2/**/*-expected16]", "src/borg/testsuite/helpers.py::test_patterns_shell[/srv*/-expected17]", "src/borg/testsuite/helpers.py::test_patterns_shell[/srv*-expected18]", "src/borg/testsuite/helpers.py::test_patterns_shell[/srv/*-expected19]", "src/borg/testsuite/helpers.py::test_patterns_shell[/srv2/**-expected20]", "src/borg/testsuite/helpers.py::test_patterns_shell[/srv2/**/-expected21]", "src/borg/testsuite/helpers.py::test_patterns_shell[/home/*/.thumbnails-expected22]", "src/borg/testsuite/helpers.py::test_patterns_shell[/home/*/*/.thumbnails-expected23]", "src/borg/testsuite/helpers.py::test_patterns_regex[-None]", "src/borg/testsuite/helpers.py::test_patterns_regex[.*-None]", "src/borg/testsuite/helpers.py::test_patterns_regex[^/-None]", "src/borg/testsuite/helpers.py::test_patterns_regex[^abc$-expected3]", "src/borg/testsuite/helpers.py::test_patterns_regex[^[^/]-expected4]", "src/borg/testsuite/helpers.py::test_patterns_regex[^(?!/srv|/foo|/opt)-expected5]", "src/borg/testsuite/helpers.py::test_regex_pattern", "src/borg/testsuite/helpers.py::test_composed_unicode_pattern[pattern0]", "src/borg/testsuite/helpers.py::test_composed_unicode_pattern[pattern1]", "src/borg/testsuite/helpers.py::test_composed_unicode_pattern[pattern2]", "src/borg/testsuite/helpers.py::test_composed_unicode_pattern[pattern3]", "src/borg/testsuite/helpers.py::test_decomposed_unicode_pattern[pattern0]", "src/borg/testsuite/helpers.py::test_decomposed_unicode_pattern[pattern1]", "src/borg/testsuite/helpers.py::test_decomposed_unicode_pattern[pattern2]", "src/borg/testsuite/helpers.py::test_decomposed_unicode_pattern[pattern3]", "src/borg/testsuite/helpers.py::test_invalid_unicode_pattern[pattern0]", "src/borg/testsuite/helpers.py::test_invalid_unicode_pattern[pattern1]", "src/borg/testsuite/helpers.py::test_invalid_unicode_pattern[pattern2]", "src/borg/testsuite/helpers.py::test_invalid_unicode_pattern[pattern3]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines0-None]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines1-None]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines2-expected2]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines3-expected3]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines4-expected4]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines5-expected5]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines6-expected6]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines7-expected7]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines8-expected8]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines9-expected9]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines10-None]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines11-expected11]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines12-None]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines13-expected13]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines14-expected14]", "src/borg/testsuite/helpers.py::test_exclude_patterns_from_file[lines15-expected15]", "src/borg/testsuite/helpers.py::test_load_patterns_from_file[lines0-expected_roots0-0]", "src/borg/testsuite/helpers.py::test_load_patterns_from_file[lines1-expected_roots1-0]", "src/borg/testsuite/helpers.py::test_load_patterns_from_file[lines2-expected_roots2-1]", "src/borg/testsuite/helpers.py::test_load_patterns_from_file[lines3-expected_roots3-2]", "src/borg/testsuite/helpers.py::test_load_patterns_from_file[lines4-expected_roots4-0]", "src/borg/testsuite/helpers.py::test_load_patterns_from_file[lines5-expected_roots5-0]", "src/borg/testsuite/helpers.py::test_load_patterns_from_file[lines6-expected_roots6-1]", "src/borg/testsuite/helpers.py::test_load_invalid_patterns_from_file[lines0]", "src/borg/testsuite/helpers.py::test_load_invalid_patterns_from_file[lines1]", "src/borg/testsuite/helpers.py::test_inclexcl_patterns_from_file[lines0-None]", "src/borg/testsuite/helpers.py::test_inclexcl_patterns_from_file[lines1-None]", "src/borg/testsuite/helpers.py::test_inclexcl_patterns_from_file[lines2-expected2]", "src/borg/testsuite/helpers.py::test_inclexcl_patterns_from_file[lines3-expected3]", "src/borg/testsuite/helpers.py::test_inclexcl_patterns_from_file[lines4-expected4]", "src/borg/testsuite/helpers.py::test_inclexcl_patterns_from_file[lines5-expected5]", "src/borg/testsuite/helpers.py::test_inclexcl_patterns_from_file[lines6-expected6]", "src/borg/testsuite/helpers.py::test_inclexcl_patterns_from_file[lines7-expected7]", "src/borg/testsuite/helpers.py::test_inclexcl_patterns_from_file[lines8-expected8]", "src/borg/testsuite/helpers.py::test_inclexcl_patterns_from_file[lines9-expected9]", "src/borg/testsuite/helpers.py::test_inclexcl_patterns_from_file[lines10-expected10]", "src/borg/testsuite/helpers.py::test_parse_pattern[-FnmatchPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[*-FnmatchPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[/data/*-FnmatchPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[fm:-FnmatchPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[fm:*-FnmatchPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[fm:/data/*-FnmatchPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[fm:fm:/data/*-FnmatchPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[re:-RegexPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[re:.*-RegexPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[re:^/something/-RegexPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[re:re:^/something/-RegexPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[pp:-PathPrefixPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[pp:/-PathPrefixPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[pp:/data/-PathPrefixPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[pp:pp:/data/-PathPrefixPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[sh:-ShellPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[sh:*-ShellPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[sh:/data/*-ShellPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern[sh:sh:/data/*-ShellPattern]", "src/borg/testsuite/helpers.py::test_parse_pattern_error[aa:]", "src/borg/testsuite/helpers.py::test_parse_pattern_error[fo:*]", "src/borg/testsuite/helpers.py::test_parse_pattern_error[00:]", "src/borg/testsuite/helpers.py::test_parse_pattern_error[x1:abc]", "src/borg/testsuite/helpers.py::test_pattern_matcher", "src/borg/testsuite/helpers.py::test_compression_specs", "src/borg/testsuite/helpers.py::test_chunkerparams", "src/borg/testsuite/helpers.py::MakePathSafeTestCase::test", "src/borg/testsuite/helpers.py::PruneSplitTestCase::test", "src/borg/testsuite/helpers.py::PruneWithinTestCase::test", "src/borg/testsuite/helpers.py::StableDictTestCase::test", "src/borg/testsuite/helpers.py::TestParseTimestamp::test", "src/borg/testsuite/helpers.py::test_get_cache_dir", "src/borg/testsuite/helpers.py::test_get_keys_dir", "src/borg/testsuite/helpers.py::test_get_security_dir", "src/borg/testsuite/helpers.py::test_file_size", "src/borg/testsuite/helpers.py::test_file_size_precision", "src/borg/testsuite/helpers.py::test_file_size_sign", "src/borg/testsuite/helpers.py::test_parse_file_size[1-1]", "src/borg/testsuite/helpers.py::test_parse_file_size[20-20]", "src/borg/testsuite/helpers.py::test_parse_file_size[5K-5000]", "src/borg/testsuite/helpers.py::test_parse_file_size[1.75M-1750000]", "src/borg/testsuite/helpers.py::test_parse_file_size[1e+9-1000000000.0]", "src/borg/testsuite/helpers.py::test_parse_file_size[-1T--1000000000000.0]", "src/borg/testsuite/helpers.py::test_parse_file_size_invalid[]", "src/borg/testsuite/helpers.py::test_parse_file_size_invalid[5", "src/borg/testsuite/helpers.py::test_parse_file_size_invalid[4E]", "src/borg/testsuite/helpers.py::test_parse_file_size_invalid[2229", "src/borg/testsuite/helpers.py::test_parse_file_size_invalid[1B]", "src/borg/testsuite/helpers.py::TestBuffer::test_type", "src/borg/testsuite/helpers.py::TestBuffer::test_len", "src/borg/testsuite/helpers.py::TestBuffer::test_resize", "src/borg/testsuite/helpers.py::TestBuffer::test_limit", "src/borg/testsuite/helpers.py::TestBuffer::test_get", "src/borg/testsuite/helpers.py::test_yes_input", "src/borg/testsuite/helpers.py::test_yes_input_defaults", "src/borg/testsuite/helpers.py::test_yes_input_custom", "src/borg/testsuite/helpers.py::test_yes_env", "src/borg/testsuite/helpers.py::test_yes_env_default", "src/borg/testsuite/helpers.py::test_yes_defaults", "src/borg/testsuite/helpers.py::test_yes_retry", "src/borg/testsuite/helpers.py::test_yes_no_retry", "src/borg/testsuite/helpers.py::test_yes_output", "src/borg/testsuite/helpers.py::test_yes_env_output", "src/borg/testsuite/helpers.py::test_progress_percentage_sameline", "src/borg/testsuite/helpers.py::test_progress_percentage_step", "src/borg/testsuite/helpers.py::test_progress_percentage_quiet", "src/borg/testsuite/helpers.py::test_progress_endless", "src/borg/testsuite/helpers.py::test_progress_endless_step", "src/borg/testsuite/helpers.py::test_partial_format", "src/borg/testsuite/helpers.py::test_chunk_file_wrapper", "src/borg/testsuite/helpers.py::test_chunkit", "src/borg/testsuite/helpers.py::test_clean_lines", "src/borg/testsuite/helpers.py::test_compression_decider1", "src/borg/testsuite/helpers.py::test_compression_decider2", "src/borg/testsuite/helpers.py::test_format_line", "src/borg/testsuite/helpers.py::test_format_line_erroneous", "src/borg/testsuite/helpers.py::test_replace_placeholders", "src/borg/testsuite/helpers.py::test_swidth_slice", "src/borg/testsuite/helpers.py::test_swidth_slice_mixed_characters" ]
[]
BSD License
1,036
[ "src/borg/helpers.py" ]
[ "src/borg/helpers.py" ]
wireservice__csvkit-800
3d9438e7ea5db34948ade66b0a4333736990c77a
2017-02-24 20:00:49
e88daad61ed949edf11dfbf377eb347a9b969d47
diff --git a/csvkit/utilities/csvstack.py b/csvkit/utilities/csvstack.py index bf1c00b..39d544d 100644 --- a/csvkit/utilities/csvstack.py +++ b/csvkit/utilities/csvstack.py @@ -9,7 +9,7 @@ from csvkit.cli import CSVKitUtility, make_default_headers class CSVStack(CSVKitUtility): description = 'Stack up the rows from multiple CSV files, optionally adding a grouping value.' - override_flags = ['f', 'K', 'L', 'date-format', 'datetime-format'] + override_flags = ['f', 'L', 'date-format', 'datetime-format'] def add_arguments(self): self.argparser.add_argument(metavar="FILE", nargs='+', dest='input_paths', default=['-'], @@ -45,6 +45,14 @@ class CSVStack(CSVKitUtility): output = agate.csv.writer(self.output_file, **self.writer_kwargs) for i, f in enumerate(self.input_files): + if isinstance(self.args.skip_lines, int): + skip_lines = self.args.skip_lines + while skip_lines > 0: + f.readline() + skip_lines -= 1 + else: + raise ValueError('skip_lines argument must be an int') + rows = agate.csv.reader(f, **self.reader_kwargs) # If we have header rows, use them
csvstack to support --skip-lines First , great library. It was very handy in searching big csv files , i just needed to search a complete folder full of csv that each file has a header that should be ignored by using latest version 1.0.2 --skip-lines it was possible but file by file . i tried using csvstack but it did not recognise the parameter --skip-lines ``` Alis-Mac-mini:sonus shahbour$ csvgrep --skip-lines 1 -c 20 -r "^449" -H 20170219013000.1014D6F.ACT.gz | csvgrep -c 21 -r "^639" | csvcut -c 20,21 t,u 44971506961058,639398219637 44971504921587,639106889971 44971569097874,639291643991 44971568622691,639101981790 44971543461612,639495761895 44971502473650,639287415793 44971543544583,639183191196 44971569097874,639291643991 44971566267135,639293255451 44971507677524,639108700472 ``` ``` Alis-Mac-mini:sonus shahbour$ csvstack -H --skip-lines 1 * | csvgrep -c 20 -r "^449" | csvgrep -c 21 -r "^639" | csvcut -c 20,21 usage: csvstack [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b] [-p ESCAPECHAR] [-z FIELD_SIZE_LIMIT] [-e ENCODING] [-S] [-H] [-v] [-l] [--zero] [-V] [-g GROUPS] [-n GROUP_NAME] [--filenames] FILE [FILE ...] csvstack: error: unrecognized arguments: --skip-lines ```
wireservice/csvkit
diff --git a/tests/test_utilities/test_csvstack.py b/tests/test_utilities/test_csvstack.py index abae02d..2921f2f 100644 --- a/tests/test_utilities/test_csvstack.py +++ b/tests/test_utilities/test_csvstack.py @@ -19,6 +19,13 @@ class TestCSVStack(CSVKitTestCase, EmptyFileTests): with patch.object(sys, 'argv', [self.Utility.__name__.lower(), 'examples/dummy.csv']): launch_new_instance() + def test_skip_lines(self): + self.assertRows(['--skip-lines', '3', 'examples/test_skip_lines.csv', 'examples/test_skip_lines.csv'], [ + ['a', 'b', 'c'], + ['1', '2', '3'], + ['1', '2', '3'], + ]) + def test_single_file_stack(self): self.assertRows(['examples/dummy.csv'], [ ['a', 'b', 'c'],
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 1 }
1.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "agate-excel", "agate-sql" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
agate==1.13.0 agate-dbf==0.2.3 agate-excel==0.4.1 agate-sql==0.7.2 babel==2.17.0 -e git+https://github.com/wireservice/csvkit.git@3d9438e7ea5db34948ade66b0a4333736990c77a#egg=csvkit dbfread==2.0.7 et_xmlfile==2.0.0 exceptiongroup==1.2.2 greenlet==3.1.1 iniconfig==2.1.0 isodate==0.7.2 leather==0.4.0 olefile==0.47 openpyxl==3.1.5 packaging==24.2 parsedatetime==2.6 pluggy==1.5.0 pytest==8.3.5 python-slugify==8.0.4 pytimeparse==1.1.8 six==1.17.0 SQLAlchemy==2.0.40 text-unidecode==1.3 tomli==2.2.1 typing_extensions==4.13.0 xlrd==2.0.1
name: csvkit channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - agate==1.13.0 - agate-dbf==0.2.3 - agate-excel==0.4.1 - agate-sql==0.7.2 - babel==2.17.0 - dbfread==2.0.7 - et-xmlfile==2.0.0 - exceptiongroup==1.2.2 - greenlet==3.1.1 - iniconfig==2.1.0 - isodate==0.7.2 - leather==0.4.0 - olefile==0.47 - openpyxl==3.1.5 - packaging==24.2 - parsedatetime==2.6 - pluggy==1.5.0 - pytest==8.3.5 - python-slugify==8.0.4 - pytimeparse==1.1.8 - six==1.17.0 - sqlalchemy==2.0.40 - text-unidecode==1.3 - tomli==2.2.1 - typing-extensions==4.13.0 - xlrd==2.0.1 prefix: /opt/conda/envs/csvkit
[ "tests/test_utilities/test_csvstack.py::TestCSVStack::test_skip_lines" ]
[]
[ "tests/test_utilities/test_csvstack.py::TestCSVStack::test_empty", "tests/test_utilities/test_csvstack.py::TestCSVStack::test_explicit_grouping", "tests/test_utilities/test_csvstack.py::TestCSVStack::test_filenames_grouping", "tests/test_utilities/test_csvstack.py::TestCSVStack::test_launch_new_instance", "tests/test_utilities/test_csvstack.py::TestCSVStack::test_multiple_file_stack", "tests/test_utilities/test_csvstack.py::TestCSVStack::test_no_header_row", "tests/test_utilities/test_csvstack.py::TestCSVStack::test_single_file_stack" ]
[]
MIT License
1,037
[ "csvkit/utilities/csvstack.py" ]
[ "csvkit/utilities/csvstack.py" ]
globus__globus-sdk-python-143
35e55d84064d5a5ca7589c9d326c0abf5b153f69
2017-02-25 03:59:36
898dbe17a9da31445d11aca5c5e442d46d68df5d
diff --git a/globus_sdk/auth/client_types/native_client.py b/globus_sdk/auth/client_types/native_client.py index 0f8da1d3..e2ab435e 100644 --- a/globus_sdk/auth/client_types/native_client.py +++ b/globus_sdk/auth/client_types/native_client.py @@ -46,7 +46,8 @@ class NativeAppAuthClient(AuthClient): def oauth2_start_flow( self, requested_scopes=None, redirect_uri=None, - state='_default', verifier=None, refresh_tokens=False): + state='_default', verifier=None, refresh_tokens=False, + prefill_named_grant=None): """ Starts a Native App OAuth2 flow by instantiating a :class:`GlobusNativeAppFlowManager @@ -61,7 +62,8 @@ class NativeAppAuthClient(AuthClient): self.current_oauth2_flow_manager = GlobusNativeAppFlowManager( self, requested_scopes=requested_scopes, redirect_uri=redirect_uri, state=state, verifier=verifier, - refresh_tokens=refresh_tokens) + refresh_tokens=refresh_tokens, + prefill_named_grant=prefill_named_grant) return self.current_oauth2_flow_manager def oauth2_refresh_token(self, refresh_token): diff --git a/globus_sdk/auth/oauth2_native_app.py b/globus_sdk/auth/oauth2_native_app.py index b53f77a7..daa8f4d7 100644 --- a/globus_sdk/auth/oauth2_native_app.py +++ b/globus_sdk/auth/oauth2_native_app.py @@ -77,11 +77,14 @@ class GlobusNativeAppFlowManager(GlobusOAuthFlowManager): ``refresh_tokens`` (*bool*) When True, request refresh tokens in addition to access tokens + + ``prefill_named_grant`` (*string*) + Optionally prefill the named grant label on the consent page """ def __init__(self, auth_client, requested_scopes=None, redirect_uri=None, state='_default', verifier=None, - refresh_tokens=False): + refresh_tokens=False, prefill_named_grant=None): self.auth_client = auth_client # set client_id, then check for validity @@ -109,6 +112,7 @@ class GlobusNativeAppFlowManager(GlobusOAuthFlowManager): # store the remaining parameters directly, with no transformation self.refresh_tokens = refresh_tokens self.state = state + self.prefill_named_grant = prefill_named_grant logger.debug('Starting Native App Flow with params:') logger.debug('auth_client.client_id={}'.format(auth_client.client_id)) @@ -118,6 +122,10 @@ class GlobusNativeAppFlowManager(GlobusOAuthFlowManager): logger.debug('requested_scopes={}'.format(self.requested_scopes)) logger.debug('verifier=<REDACTED>,challenge={}'.format(self.challenge)) + if prefill_named_grant is not None: + logger.debug('prefill_named_grant={}'.format( + self.prefill_named_grant)) + def get_authorize_url(self, additional_params=None): """ Start a Native App flow by getting the authorization URL to which users @@ -153,6 +161,8 @@ class GlobusNativeAppFlowManager(GlobusOAuthFlowManager): 'code_challenge_method': 'S256', 'access_type': (self.refresh_tokens and 'offline') or 'online' } + if self.prefill_named_grant is not None: + params['prefill_named_grant'] = self.prefill_named_grant if additional_params: params.update(additional_params)
Add `prefill_named_grant` support to NativeApp grant flow Per globus/globus-cli#176 , there's an option to prefill the named grant label, `prefill_named_grant`. It's probably a string. We need to support this so that the CLI and similar applications can use it. Not considering this blocked on documentation.
globus/globus-sdk-python
diff --git a/tests/unit/test_oauth2_native_app.py b/tests/unit/test_oauth2_native_app.py index 1403795d..0826a81f 100644 --- a/tests/unit/test_oauth2_native_app.py +++ b/tests/unit/test_oauth2_native_app.py @@ -81,6 +81,27 @@ class GlobusNativeAppFlowManagerTests(CapturedIOTestCase): for param, value in params.items(): self.assertIn(param + "=" + value, param_url) + def test_prefill_named_grant(self): + """ + Should add the `prefill_named_grant` query string parameter + to the authorize url. + """ + flow_with_prefill = globus_sdk.auth.GlobusNativeAppFlowManager( + self.ac, requested_scopes="scopes", redirect_uri="uri", + state="state", verifier="verifier", prefill_named_grant="test") + + authorize_url = flow_with_prefill.get_authorize_url() + + self.assertIn('prefill_named_grant=test', authorize_url) + + flow_without_prefill = globus_sdk.auth.GlobusNativeAppFlowManager( + self.ac, requested_scopes="scopes", redirect_uri="uri", + state="state", verifier="verifier") + + authorize_url = flow_without_prefill.get_authorize_url() + + self.assertNotIn('prefill_named_grant=', authorize_url) + def test_exchange_code_for_tokens(self): """ Makes a token exchange with the mock AuthClient,
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 2 }, "num_modified_files": 2 }
0.5
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "nose2", "flake8", "mock", "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work certifi==2021.5.30 charset-normalizer==2.0.12 flake8==5.0.4 -e git+https://github.com/globus/globus-sdk-python.git@35e55d84064d5a5ca7589c9d326c0abf5b153f69#egg=globus_sdk idna==3.10 importlib-metadata==4.2.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work mccabe==0.7.0 mock==5.2.0 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work nose2==0.13.0 packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work pycodestyle==2.9.1 pyflakes==2.5.0 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 requests==2.27.1 six==1.10.0 toml @ file:///tmp/build/80754af9/toml_1616166611790/work typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: globus-sdk-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - charset-normalizer==2.0.12 - flake8==5.0.4 - idna==3.10 - importlib-metadata==4.2.0 - mccabe==0.7.0 - mock==5.2.0 - nose2==0.13.0 - pycodestyle==2.9.1 - pyflakes==2.5.0 - requests==2.27.1 - six==1.10.0 - urllib3==1.26.20 prefix: /opt/conda/envs/globus-sdk-python
[ "tests/unit/test_oauth2_native_app.py::GlobusNativeAppFlowManagerTests::test_prefill_named_grant" ]
[]
[ "tests/unit/test_oauth2_native_app.py::GlobusNativeAppFlowManagerTests::test_exchange_code_for_tokens", "tests/unit/test_oauth2_native_app.py::GlobusNativeAppFlowManagerTests::test_get_authorize_url", "tests/unit/test_oauth2_native_app.py::GlobusNativeAppFlowManagerTests::test_make_native_app_challenge" ]
[]
Apache License 2.0
1,038
[ "globus_sdk/auth/client_types/native_client.py", "globus_sdk/auth/oauth2_native_app.py" ]
[ "globus_sdk/auth/client_types/native_client.py", "globus_sdk/auth/oauth2_native_app.py" ]
PyCQA__flake8-bugbear-12
c91bb7e24891cc3d1e3f1396dd280385c4557b48
2017-02-25 15:47:25
87315550de2f78094a3b7f6ce75fc37c4f9b4caa
diff --git a/README.rst b/README.rst index 9f3cf5f..81382f4 100644 --- a/README.rst +++ b/README.rst @@ -107,9 +107,10 @@ Users coming from Python 2 may expect the old behavior which might lead to bugs. Use native ``async def`` coroutines or mark intentional ``return x`` usage with ``# noqa`` on the same line. -**B902**: Invalid first argument used for method. Use ``self`` for -instance methods, and `cls` for class methods (which includes `__new__` -and `__init_subclass__`). +**B902**: Invalid first argument used for method. Use ``self`` for instance +methods, and `cls` for class methods (which includes `__new__` and +`__init_subclass__`) or instance methods of metaclasses. Note that this lint +can only detect metaclasses if they directly inherit from ``type``. **B950**: Line too long. This is a pragmatic equivalent of ``pycodestyle``'s E501: it considers "max-line-length" but only triggers when the value has been diff --git a/bugbear.py b/bugbear.py index d9dc7e7..42a9077 100644 --- a/bugbear.py +++ b/bugbear.py @@ -319,6 +319,10 @@ class BugBearVisitor(ast.NodeVisitor): ): expected_first_args = B902.cls kind = 'class' + elif any(getattr(x, 'id', None) == 'type' + for x in self.node_stack[-2].bases): + expected_first_args = B902.cls + kind = 'metaclass instance' else: expected_first_args = B902.self kind = 'instance'
B902 requires first parameter named self for __init__ of metaclass I have a metaclass defined like this: class StorageMeta(type): def __init__(cls, name, bases, d): Naturally B902 flagged the first parameter of `__init__`, but I'm not sure if it's intended in the case of metaclasses. I can imagine arguments for and against this behavior.
PyCQA/flake8-bugbear
diff --git a/tests/b902.py b/tests/b902.py index 91e6bc1..7f8ffc1 100644 --- a/tests/b902.py +++ b/tests/b902.py @@ -47,3 +47,13 @@ class Warnings: def invalid_keyword_only(*, self): ... + + +class Meta(type): + def __init__(cls, name, bases, d): + ... + + +class OtherMeta(type): + def __init__(self, name, bases, d): + ... diff --git a/tests/test_bugbear.py b/tests/test_bugbear.py index f7c89d9..c94a60e 100644 --- a/tests/test_bugbear.py +++ b/tests/test_bugbear.py @@ -146,6 +146,7 @@ class BugbearTestCase(unittest.TestCase): B902(39, 22, vars=("*args", 'instance', 'self')), B902(45, 30, vars=("**kwargs", 'instance', 'self')), B902(48, 32, vars=("*, self", 'instance', 'self')), + B902(58, 17, vars=("'self'", 'metaclass instance', 'cls')), ) )
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 2, "test_score": 2 }, "num_modified_files": 2 }
17.2
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==25.3.0 exceptiongroup==1.2.2 flake8==7.2.0 -e git+https://github.com/PyCQA/flake8-bugbear.git@c91bb7e24891cc3d1e3f1396dd280385c4557b48#egg=flake8_bugbear iniconfig==2.1.0 mccabe==0.7.0 packaging==24.2 pluggy==1.5.0 pycodestyle==2.13.0 pyflakes==3.3.1 pytest==8.3.5 tomli==2.2.1
name: flake8-bugbear channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==25.3.0 - exceptiongroup==1.2.2 - flake8==7.2.0 - iniconfig==2.1.0 - mccabe==0.7.0 - packaging==24.2 - pluggy==1.5.0 - pycodestyle==2.13.0 - pyflakes==3.3.1 - pytest==8.3.5 - tomli==2.2.1 prefix: /opt/conda/envs/flake8-bugbear
[ "tests/test_bugbear.py::BugbearTestCase::test_b902" ]
[ "tests/test_bugbear.py::BugbearTestCase::test_selfclean_bugbear" ]
[ "tests/test_bugbear.py::BugbearTestCase::test_b001", "tests/test_bugbear.py::BugbearTestCase::test_b002", "tests/test_bugbear.py::BugbearTestCase::test_b003", "tests/test_bugbear.py::BugbearTestCase::test_b004", "tests/test_bugbear.py::BugbearTestCase::test_b005", "tests/test_bugbear.py::BugbearTestCase::test_b006", "tests/test_bugbear.py::BugbearTestCase::test_b007", "tests/test_bugbear.py::BugbearTestCase::test_b301_b302_b305", "tests/test_bugbear.py::BugbearTestCase::test_b303_b304", "tests/test_bugbear.py::BugbearTestCase::test_b306", "tests/test_bugbear.py::BugbearTestCase::test_b901", "tests/test_bugbear.py::BugbearTestCase::test_b950", "tests/test_bugbear.py::BugbearTestCase::test_selfclean_test_bugbear" ]
[]
MIT License
1,039
[ "README.rst", "bugbear.py" ]
[ "README.rst", "bugbear.py" ]
elastic__elasticsearch-dsl-py-603
7c1dad0f99957db9ebb9bfe10cf72cf1a8ec3fb3
2017-02-25 16:39:41
7c1dad0f99957db9ebb9bfe10cf72cf1a8ec3fb3
diff --git a/.travis.yml b/.travis.yml index f6456d7..88ce371 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,10 @@ python: - "3.3" - "3.4" - "3.5" + - "3.6" + - "3.6-dev" + - "3.7-dev" + - "nightly" env: global: diff --git a/docs/index.rst b/docs/index.rst index d19c3ae..6db9555 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -23,6 +23,9 @@ Compatibility The library is compatible with all Elasticsearch versions since ``1.x`` but you **have to use a matching major version**: +For **Elasticsearch 5.0** and later, use the major version 5 (``5.x.y``) of the +library. + For **Elasticsearch 2.0** and later, use the major version 2 (``2.x.y``) of the library. @@ -33,6 +36,9 @@ library. The recommended way to set your requirements in your `setup.py` or `requirements.txt` is:: + # Elasticsearch 5.x + elasticsearch-dsl>=5.0.0,<6.0.0 + # Elasticsearch 2.x elasticsearch-dsl>=2.0.0,<3.0.0 diff --git a/docs/search_dsl.rst b/docs/search_dsl.rst index 7b8fe32..6e730cc 100644 --- a/docs/search_dsl.rst +++ b/docs/search_dsl.rst @@ -417,7 +417,9 @@ endpoint) you can do so via ``execute_suggest``: Extra properties and parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -To set extra properties of the search request, use the ``.extra()`` method: +To set extra properties of the search request, use the ``.extra()`` method. +This can be used to define keys in the body that cannot be defined via a +specific API method like ``explain`` or ``search_after``: .. code:: python diff --git a/elasticsearch_dsl/aggs.py b/elasticsearch_dsl/aggs.py index 9d9058a..84b5b8b 100644 --- a/elasticsearch_dsl/aggs.py +++ b/elasticsearch_dsl/aggs.py @@ -40,6 +40,10 @@ class Agg(DslBase): _type_name = 'agg' _type_shortcut = staticmethod(A) name = None + + def __contains__(self, key): + return False + def to_dict(self): d = super(Agg, self).to_dict() if 'meta' in d[self.name]: @@ -54,6 +58,9 @@ class AggBase(object): _param_defs = { 'aggs': {'type': 'agg', 'hash': True}, } + def __contains__(self, key): + return key in self._params.get('aggs', {}) + def __getitem__(self, agg_name): agg = self._params.setdefault('aggs', {})[agg_name] # propagate KeyError diff --git a/elasticsearch_dsl/field.py b/elasticsearch_dsl/field.py index a1afb18..3fbc80d 100644 --- a/elasticsearch_dsl/field.py +++ b/elasticsearch_dsl/field.py @@ -46,6 +46,9 @@ class Field(DslBase): self._required = kwargs.pop('required', False) super(Field, self).__init__(*args, **kwargs) + def __getitem__(self, subfield): + return self._params.get('fields', {})[subfield] + def _serialize(self, data): return data @@ -265,6 +268,9 @@ class Boolean(Field): class Float(Field): name = 'float' +class HalfFloat(Field): + name = 'half_float' + class Double(Field): name = 'double' diff --git a/elasticsearch_dsl/query.py b/elasticsearch_dsl/query.py index 6bcd69a..b5a1225 100644 --- a/elasticsearch_dsl/query.py +++ b/elasticsearch_dsl/query.py @@ -179,7 +179,10 @@ class Boosting(Query): class ConstantScore(Query): name = 'constant_score' - _param_defs = {'query': {'type': 'query'}, 'filter': {'type': 'query'}} + _param_defs = { + 'query': {'type': 'query', 'multi': True}, + 'filter': {'type': 'query', 'multi': True} + } class DisMax(Query): name = 'dis_max' diff --git a/elasticsearch_dsl/response/__init__.py b/elasticsearch_dsl/response/__init__.py index 4e8b1de..f6bd47e 100644 --- a/elasticsearch_dsl/response/__init__.py +++ b/elasticsearch_dsl/response/__init__.py @@ -30,11 +30,18 @@ class Response(AttrDict): def __len__(self): return len(self.hits) + def __getstate__(self): + return (self._d_, self._search) + + def __setstate__(self, state): + super(AttrDict, self).__setattr__('_d_', state[0]) + super(AttrDict, self).__setattr__('_search', state[1]) + def success(self): return self._shards.total == self._shards.successful and not self.timed_out def _get_result(self, hit): - dt = hit['_type'] + dt = hit.get('_type') for t in hit.get('inner_hits', ()): hit['inner_hits'][t] = Response(self._search, hit['inner_hits'][t]) callback = self._search._doc_type_map.get(dt, Hit) diff --git a/elasticsearch_dsl/search.py b/elasticsearch_dsl/search.py index fc71204..b49d982 100644 --- a/elasticsearch_dsl/search.py +++ b/elasticsearch_dsl/search.py @@ -43,6 +43,12 @@ class QueryProxy(object): setattr(self._proxied, attr_name, value) super(QueryProxy, self).__setattr__(attr_name, value) + def __getstate__(self): + return (self._search, self._proxied, self._attr_name) + + def __setstate__(self, state): + self._search, self._proxied, self._attr_name = state + class ProxyDescriptor(object): """ @@ -96,6 +102,15 @@ class Request(object): self._params = {} self._extra = extra or {} + def __eq__(self, other): + return ( + isinstance(other, Request) and + other._params == self._params and + other._index == self._index and + other._doc_type == self._doc_type and + other.to_dict() == self.to_dict() + ) + def params(self, **kwargs): """ Specify query params to be used when executing the search. All the
TypeError unhashable type: 'list' ``` client = Search(using=haystack_connections['default'].get_backend().conn, index='haystack', doc_type='modelresult') query = \ { "size": 0, "query" : { "constant_score": { "filter": [ { "missing": { "field": "deleted_at" } } ] } }, "aggs" : { "occurrences_of_query" : { "filter" : { "match": { "text": "query" } }, "aggs": { "city_slug": { "terms": { "field": "geo_type_slug", "size": 6, "order": { "city_distance" : "asc" } }, "aggs": { "city_distance": { "avg": { "script": { "inline": "doc['coordinates'].arcDistanceInKm(ref_lat, ref_lon)", "params": { "ref_lat": 61.25595, "ref_lon": 73.384547 } } } } } } } } } } searcher = client.update_from_dict(query) response = searcher.execute() ``` Which rises: ``` File "/Users/alkalit/.virtualenvs/promvtor/promvtor/apps/seo_queries/jinja/globals.py" in get_seo_queries 174. searcher = client.update_from_dict(query) File "/Users/alkalit/.virtualenvs/promvtor/promvtor/apps/elasticsearch_dsl2/search.py" in update_from_dict 329. self.query._proxied = Q(d.pop('query')) File "/Users/alkalit/.virtualenvs/promvtor/promvtor/apps/elasticsearch_dsl2/query.py" in Q 27. return Query.get_dsl_class(name)(**params) File "/Users/alkalit/.virtualenvs/promvtor/promvtor/apps/elasticsearch_dsl2/utils.py" in __init__ 221. self._setattr(pname, pvalue) File "/Users/alkalit/.virtualenvs/promvtor/promvtor/apps/elasticsearch_dsl2/utils.py" in _setattr 268. value = shortcut(value) File "/Users/alkalit/.virtualenvs/promvtor/promvtor/apps/elasticsearch_dsl2/query.py" in Q 40. return Query.get_dsl_class(name_or_query)(**params) File "/Users/alkalit/.virtualenvs/promvtor/promvtor/apps/elasticsearch_dsl2/utils.py" in get_dsl_class 212. return cls._classes[name] ``` Where is: ``` name [{u'missing': {u'field': u'deleted_at'}}] cls <class 'elasticsearch_dsl2.query.Query'> ``` ``` In [1]: import elasticsearch_dsl2 In [2]: elasticsearch_dsl2.VERSION Out[2]: (2, 2, 0) In [3]: import elasticsearch In [4]: elasticsearch.VERSION Out[4]: (2, 1, 0) ```
elastic/elasticsearch-dsl-py
diff --git a/test_elasticsearch_dsl/conftest.py b/test_elasticsearch_dsl/conftest.py index a07bf09..b2c2dd8 100644 --- a/test_elasticsearch_dsl/conftest.py +++ b/test_elasticsearch_dsl/conftest.py @@ -132,6 +132,7 @@ def aggs_search(): .metric('line_stats', 'stats', field='stats.lines')\ .metric('top_commits', 'top_hits', size=2, _source=["stats.*", "committed_date"]) s.aggs.bucket('per_month', 'date_histogram', interval='month', field='info.committed_date') + s.aggs.metric('sum_lines', 'sum', field='stats.lines') return s @fixture @@ -142,6 +143,7 @@ def aggs_data(): '_shards': {'total': 1, 'successful': 1, 'failed': 0}, 'hits': {'total': 52, 'hits': [], 'max_score': 0.0}, 'aggregations': { + 'sum_lines': {'value': 25052.0}, 'per_month': { 'buckets': [ {'doc_count': 38, 'key': 1393632000000, 'key_as_string': '2014-03-01T00:00:00.000Z'}, diff --git a/test_elasticsearch_dsl/test_mapping.py b/test_elasticsearch_dsl/test_mapping.py index 350c63b..f42d866 100644 --- a/test_elasticsearch_dsl/test_mapping.py +++ b/test_elasticsearch_dsl/test_mapping.py @@ -152,3 +152,9 @@ def test_even_non_custom_analyzers_can_have_params(): } } } == m._collect_analysis() + +def test_resolve_field_can_resolve_multifields(): + m = mapping.Mapping('m') + m.field('title', 'text', fields={'keyword': Keyword()}) + + assert isinstance(m.resolve_field('title.keyword'), Keyword) diff --git a/test_elasticsearch_dsl/test_query.py b/test_elasticsearch_dsl/test_query.py index c1414e1..7cc0fe5 100644 --- a/test_elasticsearch_dsl/test_query.py +++ b/test_elasticsearch_dsl/test_query.py @@ -212,6 +212,17 @@ def test_two_bool_queries_append_one_to_should_if_possible(): assert (q1 | q2) == query.Bool(should=[query.Match(f='v'), query.Bool(must=[query.Match(f='v')])]) assert (q2 | q1) == query.Bool(should=[query.Match(f='v'), query.Bool(must=[query.Match(f='v')])]) +def test_allow_multiple_queries_for_constant_score_issue_599(): + # Construct a number of ConstantScore queries each with different + # combinations of queries and filters. + q1 = query.ConstantScore(query=[query.Match(f=1), query.Match(f=2)]) + q2 = query.ConstantScore(filter=[query.Match(f=1), query.Match(f=2)]) + q3 = query.ConstantScore(query=query.Match(f=1)) + q4 = query.ConstantScore(filter=query.Match(f=1)) + + for q in [q1, q2, q3, q4]: + assert isinstance(q.to_dict(), dict) + def test_queries_are_registered(): assert 'match' in query.Query._classes assert query.Query._classes['match'] is query.Match diff --git a/test_elasticsearch_dsl/test_result.py b/test_elasticsearch_dsl/test_result.py index af4265a..e7b36ed 100644 --- a/test_elasticsearch_dsl/test_result.py +++ b/test_elasticsearch_dsl/test_result.py @@ -15,6 +15,8 @@ def test_agg_response_is_pickleable(agg_response): r = pickle.loads(pickle.dumps(agg_response)) assert r == agg_response + assert r._search == agg_response._search + assert r.hits == agg_response.hits def test_response_is_pickleable(dummy_response): res = response.Response(Search(), dummy_response) @@ -22,6 +24,8 @@ def test_response_is_pickleable(dummy_response): r = pickle.loads(pickle.dumps(res)) assert r == res + assert r._search == res._search + assert r.hits == res.hits def test_hit_is_pickleable(dummy_response): res = response.Response(Search(), dummy_response) @@ -120,10 +124,13 @@ def test_aggregation_base(agg_response): assert agg_response.aggs is agg_response.aggregations assert isinstance(agg_response.aggs, response.AggResponse) +def test_metric_agg_works(agg_response): + assert 25052.0 == agg_response.aggs.sum_lines.value + def test_aggregations_can_be_iterated_over(agg_response): aggs = [a for a in agg_response.aggs] - assert len(aggs) == 2 + assert len(aggs) == 3 assert all(map(lambda a: isinstance(a, AggResponse), aggs)) def test_aggregations_can_be_retrieved_by_name(agg_response, aggs_search):
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 8 }
5.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e '.[develop]'", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "mock", "pytz", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 attrs==22.2.0 Babel==2.11.0 certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 docutils==0.18.1 elasticsearch==5.5.3 -e git+https://github.com/elastic/elasticsearch-dsl-py.git@7c1dad0f99957db9ebb9bfe10cf72cf1a8ec3fb3#egg=elasticsearch_dsl idna==3.10 imagesize==1.4.1 importlib-metadata==4.8.3 iniconfig==1.1.1 Jinja2==3.0.3 MarkupSafe==2.0.1 mock==5.2.0 packaging==21.3 pluggy==1.0.0 py==1.11.0 Pygments==2.14.0 pyparsing==3.1.4 pytest==7.0.1 pytest-cov==4.0.0 python-dateutil==2.9.0.post0 pytz==2025.2 requests==2.27.1 six==1.17.0 snowballstemmer==2.2.0 Sphinx==5.3.0 sphinx-rtd-theme==2.0.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jquery==4.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 zipp==3.6.0
name: elasticsearch-dsl-py channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - attrs==22.2.0 - babel==2.11.0 - charset-normalizer==2.0.12 - coverage==6.2 - docutils==0.18.1 - elasticsearch==5.5.3 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - jinja2==3.0.3 - markupsafe==2.0.1 - mock==5.2.0 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pygments==2.14.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-cov==4.0.0 - python-dateutil==2.9.0.post0 - pytz==2025.2 - requests==2.27.1 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==5.3.0 - sphinx-rtd-theme==2.0.0 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jquery==4.1 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/elasticsearch-dsl-py
[ "test_elasticsearch_dsl/test_mapping.py::test_resolve_field_can_resolve_multifields", "test_elasticsearch_dsl/test_query.py::test_allow_multiple_queries_for_constant_score_issue_599", "test_elasticsearch_dsl/test_result.py::test_agg_response_is_pickleable", "test_elasticsearch_dsl/test_result.py::test_response_is_pickleable", "test_elasticsearch_dsl/test_result.py::test_metric_agg_works" ]
[]
[ "test_elasticsearch_dsl/test_mapping.py::test_mapping_can_has_fields", "test_elasticsearch_dsl/test_mapping.py::test_mapping_update_is_recursive", "test_elasticsearch_dsl/test_mapping.py::test_properties_can_iterate_over_all_the_fields", "test_elasticsearch_dsl/test_mapping.py::test_mapping_can_collect_all_analyzers", "test_elasticsearch_dsl/test_mapping.py::test_mapping_can_collect_multiple_analyzers", "test_elasticsearch_dsl/test_mapping.py::test_even_non_custom_analyzers_can_have_params", "test_elasticsearch_dsl/test_query.py::test_empty_Q_is_match_all", "test_elasticsearch_dsl/test_query.py::test_match_to_dict", "test_elasticsearch_dsl/test_query.py::test_match_to_dict_extra", "test_elasticsearch_dsl/test_query.py::test_fuzzy_to_dict", "test_elasticsearch_dsl/test_query.py::test_prefix_to_dict", "test_elasticsearch_dsl/test_query.py::test_term_to_dict", "test_elasticsearch_dsl/test_query.py::test_bool_to_dict", "test_elasticsearch_dsl/test_query.py::test_dismax_to_dict", "test_elasticsearch_dsl/test_query.py::test_bool_from_dict_issue_318", "test_elasticsearch_dsl/test_query.py::test_repr", "test_elasticsearch_dsl/test_query.py::test_query_clone", "test_elasticsearch_dsl/test_query.py::test_bool_converts_its_init_args_to_queries", "test_elasticsearch_dsl/test_query.py::test_two_queries_make_a_bool", "test_elasticsearch_dsl/test_query.py::test_other_and_bool_appends_other_to_must", "test_elasticsearch_dsl/test_query.py::test_bool_and_other_appends_other_to_must", "test_elasticsearch_dsl/test_query.py::test_bool_and_other_sets_min_should_match_if_needed", "test_elasticsearch_dsl/test_query.py::test_query_and_query_creates_bool", "test_elasticsearch_dsl/test_query.py::test_match_all_and_query_equals_other", "test_elasticsearch_dsl/test_query.py::test_bool_and_bool", "test_elasticsearch_dsl/test_query.py::test_inverted_query_becomes_bool_with_must_not", "test_elasticsearch_dsl/test_query.py::test_inverted_query_with_must_not_become_should", "test_elasticsearch_dsl/test_query.py::test_inverted_query_with_must_and_must_not", "test_elasticsearch_dsl/test_query.py::test_double_invert_returns_original_query", "test_elasticsearch_dsl/test_query.py::test_bool_query_gets_inverted_internally", "test_elasticsearch_dsl/test_query.py::test_match_all_or_something_is_match_all", "test_elasticsearch_dsl/test_query.py::test_or_produces_bool_with_should", "test_elasticsearch_dsl/test_query.py::test_or_bool_doesnt_loop_infinitely_issue_37", "test_elasticsearch_dsl/test_query.py::test_or_bool_doesnt_loop_infinitely_issue_96", "test_elasticsearch_dsl/test_query.py::test_bool_will_append_another_query_with_or", "test_elasticsearch_dsl/test_query.py::test_bool_queries_with_only_should_get_concatenated", "test_elasticsearch_dsl/test_query.py::test_two_bool_queries_append_one_to_should_if_possible", "test_elasticsearch_dsl/test_query.py::test_queries_are_registered", "test_elasticsearch_dsl/test_query.py::test_defining_query_registers_it", "test_elasticsearch_dsl/test_query.py::test_Q_passes_query_through", "test_elasticsearch_dsl/test_query.py::test_Q_constructs_query_by_name", "test_elasticsearch_dsl/test_query.py::test_Q_translates_double_underscore_to_dots_in_param_names", "test_elasticsearch_dsl/test_query.py::test_Q_doesn_translate_double_underscore_to_dots_in_param_names", "test_elasticsearch_dsl/test_query.py::test_Q_constructs_simple_query_from_dict", "test_elasticsearch_dsl/test_query.py::test_Q_constructs_compound_query_from_dict", "test_elasticsearch_dsl/test_query.py::test_Q_raises_error_when_passed_in_dict_and_params", "test_elasticsearch_dsl/test_query.py::test_Q_raises_error_when_passed_in_query_and_params", "test_elasticsearch_dsl/test_query.py::test_Q_raises_error_on_unknown_query", "test_elasticsearch_dsl/test_query.py::test_match_all_and_anything_is_anything", "test_elasticsearch_dsl/test_query.py::test_function_score_with_functions", "test_elasticsearch_dsl/test_query.py::test_function_score_with_no_function_is_boost_factor", "test_elasticsearch_dsl/test_query.py::test_function_score_to_dict", "test_elasticsearch_dsl/test_query.py::test_function_score_with_single_function", "test_elasticsearch_dsl/test_query.py::test_function_score_from_dict", "test_elasticsearch_dsl/test_result.py::test_hit_is_pickleable", "test_elasticsearch_dsl/test_result.py::test_response_stores_search", "test_elasticsearch_dsl/test_result.py::test_attribute_error_in_hits_is_not_hidden", "test_elasticsearch_dsl/test_result.py::test_interactive_helpers", "test_elasticsearch_dsl/test_result.py::test_empty_response_is_false", "test_elasticsearch_dsl/test_result.py::test_len_response", "test_elasticsearch_dsl/test_result.py::test_iterating_over_response_gives_you_hits", "test_elasticsearch_dsl/test_result.py::test_hits_get_wrapped_to_contain_additional_attrs", "test_elasticsearch_dsl/test_result.py::test_hits_provide_dot_and_bracket_access_to_attrs", "test_elasticsearch_dsl/test_result.py::test_slicing_on_response_slices_on_hits", "test_elasticsearch_dsl/test_result.py::test_aggregation_base", "test_elasticsearch_dsl/test_result.py::test_aggregations_can_be_iterated_over", "test_elasticsearch_dsl/test_result.py::test_aggregations_can_be_retrieved_by_name", "test_elasticsearch_dsl/test_result.py::test_bucket_response_can_be_iterated_over", "test_elasticsearch_dsl/test_result.py::test_bucket_keys_get_deserialized" ]
[]
Apache License 2.0
1,040
[ "elasticsearch_dsl/response/__init__.py", "elasticsearch_dsl/field.py", ".travis.yml", "elasticsearch_dsl/aggs.py", "elasticsearch_dsl/search.py", "docs/index.rst", "elasticsearch_dsl/query.py", "docs/search_dsl.rst" ]
[ "elasticsearch_dsl/response/__init__.py", "elasticsearch_dsl/field.py", ".travis.yml", "elasticsearch_dsl/aggs.py", "elasticsearch_dsl/search.py", "docs/index.rst", "elasticsearch_dsl/query.py", "docs/search_dsl.rst" ]
MicroPyramid__forex-python-27
1ebd8dda32503ca63d52b8a55f5647804fd1d1dd
2017-02-27 13:16:26
1ebd8dda32503ca63d52b8a55f5647804fd1d1dd
diff --git a/forex_python/converter.py b/forex_python/converter.py index bcc8348..316f0cf 100644 --- a/forex_python/converter.py +++ b/forex_python/converter.py @@ -56,6 +56,8 @@ class CurrencyRates(Common): raise RatesNotAvailableError("Currency Rates Source Not Ready") def get_rate(self, base_cur, dest_cur, date_obj=None): + if base_cur == dest_cur: + return 1. date_str = self._get_date_string(date_obj) payload = {'base': base_cur, 'symbols': dest_cur} source_url = self._source_url() + date_str
identity get_rate It would be nice that the conversion from one currency to itself also work ``` >>> c.get_rate("CHF", "CHF") Traceback (most recent call last): File "<input>", line 1, in <module> File "/home/user/.virtualenvs/tool/local/lib/python2.7/site-packages/forex_python/converter.py", line 67, in get_rate base_cur, dest_cur, date_str)) RatesNotAvailableError: Currency Rate CHF => CHF not available for Date latest ```
MicroPyramid/forex-python
diff --git a/tests/test.py b/tests/test.py index 040ed75..2501aa9 100644 --- a/tests/test.py +++ b/tests/test.py @@ -50,6 +50,11 @@ class TestGetRate(TestCase): # check if return value is float self.assertTrue(isinstance(rate, float)) + + def test_get_rate_with_valid_codes_same_currency(self): + rate = get_rate('USD', 'USD') + # rate should be 1. + self.assertEqual(1., rate) def test_get_rate_with_date(self): date_obj = datetime.datetime.strptime('2010-05-10', "%Y-%m-%d").date()
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 0, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 1 }
0.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "pytest-cov", "pytest-mock" ], "pre_install": null, "python": "3.5", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 -e git+https://github.com/MicroPyramid/forex-python.git@1ebd8dda32503ca63d52b8a55f5647804fd1d1dd#egg=forex_python idna==3.10 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 pytest-cov==4.0.0 pytest-mock==3.6.1 requests==2.27.1 simplejson==3.20.1 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tomli==1.2.3 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: forex-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - charset-normalizer==2.0.12 - coverage==6.2 - idna==3.10 - pytest-cov==4.0.0 - pytest-mock==3.6.1 - requests==2.27.1 - simplejson==3.20.1 - tomli==1.2.3 - urllib3==1.26.20 prefix: /opt/conda/envs/forex-python
[ "tests/test.py::TestGetRate::test_get_rate_with_valid_codes_same_currency" ]
[ "tests/test.py::TestGetRates::test_get_rates_valid_code", "tests/test.py::TestGetRates::test_get_rates_with_date", "tests/test.py::TestGetRate::test_get_rate_with_date", "tests/test.py::TestGetRate::test_get_rate_with_valid_codes", "tests/test.py::TestAmountConvert::test_amount_convert_date", "tests/test.py::TestAmountConvert::test_amount_convert_valid_currency", "tests/test.py::TestForceDecimalAmountConvert::test_amount_decimal_convert", "tests/test.py::TestForceDecimalAmountConvert::test_amount_decimal_convert_date", "tests/test.py::TestForceDecimalAmountConvert::test_amount_decimal_invalid_type", "tests/test.py::TestForceDecimalAmountConvert::test_decimal_get_rate_with_date", "tests/test.py::TestForceDecimalAmountConvert::test_decimal_get_rate_with_valid_codes", "tests/test.py::TestForceDecimalAmountConvert::test_decimal_get_rates_valid_code", "tests/test.py::TestForceDecimalAmountConvert::test_decimal_get_rates_with_date" ]
[ "tests/test.py::TestGetRates::test_get_rates_invalid_code", "tests/test.py::TestGetRate::test_get_rate_with_invalid_codes", "tests/test.py::TestAmountConvert::test_amount_convert_invalid_currency", "tests/test.py::TestAmountConvert::test_amount_convert_valid_currency_same_currency", "tests/test.py::TestForceDecimalAmountConvert::test_decimal_get_rate_with_invalid_codes", "tests/test.py::TestForceDecimalAmountConvert::test_decimal_get_rates_invalid_code", "tests/test.py::TestCurrencySymbol::test_with_invalid_currency_code", "tests/test.py::TestCurrencySymbol::test_with_valid_currency_code", "tests/test.py::TestCurrencyName::test_with_invalid_currency_code", "tests/test.py::TestCurrencyName::test_with_valid_currency_code" ]
[]
MIT License
1,042
[ "forex_python/converter.py" ]
[ "forex_python/converter.py" ]
google__mobly-134
061ed277ec8af0b67e607ad7b12a5de80912c590
2017-02-28 16:35:44
b4362eda0c8148644812849cdb9c741e35d5750d
adorokhine: Reviewed 1 of 2 files at r1. Review status: 0 of 2 files reviewed at latest revision, 5 unresolved discussions. --- *[mobly/controllers/android_device_lib/callback_handler.py, line 59 at r1](https://reviewable.io:443/reviews/google/mobly/134#-KeafhOKadEKJiLgP7gH:-KeafhOLrEIcl4RQ0eT3:b-kx858c) ([raw file](https://github.com/google/mobly/blob/ac07cff0770546fe6ffc9087d423d3236400775c/mobly/controllers/android_device_lib/callback_handler.py#L59)):* > ```Python > self.ret_value = ret_value > > def _msgToEvent(self, raw_event): > ``` Our Python style is lowercase_with_underscores. --- *[mobly/controllers/android_device_lib/callback_handler.py, line 63 at r1](https://reviewable.io:443/reviews/google/mobly/134#-KeafmHMPALFwnwIopJG:-KeafmHMPALFwnwIopJH:b-akwad4) ([raw file](https://github.com/google/mobly/blob/ac07cff0770546fe6ffc9087d423d3236400775c/mobly/controllers/android_device_lib/callback_handler.py#L63)):* > ```Python > callback_id=raw_event['callbackId'], > name=raw_event['name'], > creation_tie=raw_event['time'], > ``` tie? I don't think this would run; can you test this? --- *[mobly/controllers/android_device_lib/callback_handler.py, line 66 at r1](https://reviewable.io:443/reviews/google/mobly/134#-KeafukV0V8RVakOJdMM:-KeafukV0V8RVakOJdMN:b-9nmx1w) ([raw file](https://github.com/google/mobly/blob/ac07cff0770546fe6ffc9087d423d3236400775c/mobly/controllers/android_device_lib/callback_handler.py#L66)):* > ```Python > data=raw_event['data']) > > def waitAndGet(self, event_name, timeout=None): > ``` Should be lowercase_with_underscores right? (and elsewhere) --- *[mobly/controllers/android_device_lib/snippet_event.py, line 1 at r1](https://reviewable.io:443/reviews/google/mobly/134#-Keag8VONgs_comAMvjD:-Keag8VONgs_comAMvjE:b-8q37n6) ([raw file](https://github.com/google/mobly/blob/ac07cff0770546fe6ffc9087d423d3236400775c/mobly/controllers/android_device_lib/snippet_event.py#L1)):* > ```Python > #/usr/bin/env python3.4 > ``` 1. Don't quite understand why we are creating new files without the bang. Is it supposed to be there or isn't it? 2. Since this isn't a main class and isn't intended to be executed directly, no bang line is needed. --- *[mobly/controllers/android_device_lib/snippet_event.py, line 23 at r1](https://reviewable.io:443/reviews/google/mobly/134#-Keag5vDpkhj42nrEfqp:-Keag5vEcTvkA8DeVpq_:bkaa4h2) ([raw file](https://github.com/google/mobly/blob/ac07cff0770546fe6ffc9087d423d3236400775c/mobly/controllers/android_device_lib/snippet_event.py#L23)):* > ```Python > class SnippetEvent(object): > """The class that represents callback events for mobly snippet library. > > ``` Whitespace on indented line --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/134)* <!-- Sent from Reviewable.io --> xpconanfan: Review status: 0 of 2 files reviewed at latest revision, 5 unresolved discussions. --- *[mobly/controllers/android_device_lib/callback_handler.py, line 63 at r1](https://reviewable.io:443/reviews/google/mobly/134#-KeafmHMPALFwnwIopJG:-Keaih1W4qlZRt5zcACw:b-896fix) ([raw file](https://github.com/google/mobly/blob/ac07cff0770546fe6ffc9087d423d3236400775c/mobly/controllers/android_device_lib/callback_handler.py#L63)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> tie? I don't think this would run; can you test this? </blockquote></details> Done. --- *[mobly/controllers/android_device_lib/callback_handler.py, line 66 at r1](https://reviewable.io:443/reviews/google/mobly/134#-KeafukV0V8RVakOJdMM:-KeagrCsfOUTVWNCG-J2:bohdahi) ([raw file](https://github.com/google/mobly/blob/ac07cff0770546fe6ffc9087d423d3236400775c/mobly/controllers/android_device_lib/callback_handler.py#L66)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> Should be lowercase_with_underscores right? (and elsewhere) </blockquote></details> Hmm, should we? This class deals with data from Java side and is closely tied with the Java method names, it seems make sense to use camel case here. ``` callback = ad.spt.doAsyncStuff() callback.waitAndGet('blahEvent') ``` --- *[mobly/controllers/android_device_lib/snippet_event.py, line 1 at r1](https://reviewable.io:443/reviews/google/mobly/134#-Keag8VONgs_comAMvjD:-Keah2cmy_OYwhjiO1-o:b-896fix) ([raw file](https://github.com/google/mobly/blob/ac07cff0770546fe6ffc9087d423d3236400775c/mobly/controllers/android_device_lib/snippet_event.py#L1)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> 1. Don't quite understand why we are creating new files without the bang. Is it supposed to be there or isn't it? 2. Since this isn't a main class and isn't intended to be executed directly, no bang line is needed. </blockquote></details> Done. --- *[mobly/controllers/android_device_lib/snippet_event.py, line 23 at r1](https://reviewable.io:443/reviews/google/mobly/134#-Keag5vDpkhj42nrEfqp:-Keah30E7XriE80Se1Ju:b-896fix) ([raw file](https://github.com/google/mobly/blob/ac07cff0770546fe6ffc9087d423d3236400775c/mobly/controllers/android_device_lib/snippet_event.py#L23)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> Whitespace on indented line </blockquote></details> Done. --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/134)* <!-- Sent from Reviewable.io --> adorokhine: Reviewed 2 of 2 files at r2. Review status: all files reviewed at latest revision, 3 unresolved discussions. --- *[mobly/controllers/android_device_lib/callback_handler.py, line 63 at r1](https://reviewable.io:443/reviews/google/mobly/134#-KeafmHMPALFwnwIopJG:-Kealgjf9qegfnk_UPvi:bdakz5s) ([raw file](https://github.com/google/mobly/blob/ac07cff0770546fe6ffc9087d423d3236400775c/mobly/controllers/android_device_lib/callback_handler.py#L63)):* <details><summary><i>Previously, xpconanfan (Ang Li) wrote…</i></summary><blockquote> Done. </blockquote></details> Did we have a unit test capable of catching this? --- *[mobly/controllers/android_device_lib/callback_handler.py, line 66 at r1](https://reviewable.io:443/reviews/google/mobly/134#-KeafukV0V8RVakOJdMM:-Kealn3xeLpy4qz8xwFz:b-6e7p7t) ([raw file](https://github.com/google/mobly/blob/ac07cff0770546fe6ffc9087d423d3236400775c/mobly/controllers/android_device_lib/callback_handler.py#L66)):* <details><summary><i>Previously, xpconanfan (Ang Li) wrote…</i></summary><blockquote> Hmm, should we? This class deals with data from Java side and is closely tied with the Java method names, it seems make sense to use camel case here. ``` callback = ad.spt.doAsyncStuff() callback.waitAndGet('blahEvent') ``` </blockquote></details> For the method names that map directly to the java side like waitAndGet <-> eventWaitAndGet, sg. For unrelated method names like _msgToEvent we should maintain our python convention. --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/134)* <!-- Sent from Reviewable.io --> xpconanfan: Review status: 0 of 3 files reviewed at latest revision, 3 unresolved discussions. --- *[mobly/controllers/android_device_lib/callback_handler.py, line 59 at r1](https://reviewable.io:443/reviews/google/mobly/134#-KeafhOKadEKJiLgP7gH:-Keb0Fl52Y_09mhX2EcR:b-896fix) ([raw file](https://github.com/google/mobly/blob/ac07cff0770546fe6ffc9087d423d3236400775c/mobly/controllers/android_device_lib/callback_handler.py#L59)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> Our Python style is lowercase_with_underscores. </blockquote></details> Done. --- *[mobly/controllers/android_device_lib/callback_handler.py, line 63 at r1](https://reviewable.io:443/reviews/google/mobly/134#-KeafmHMPALFwnwIopJG:-Keb0GMXDLBQkBPF_jDB:b-896fix) ([raw file](https://github.com/google/mobly/blob/ac07cff0770546fe6ffc9087d423d3236400775c/mobly/controllers/android_device_lib/callback_handler.py#L63)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> Did we have a unit test capable of catching this? </blockquote></details> Done. --- *[mobly/controllers/android_device_lib/callback_handler.py, line 66 at r1](https://reviewable.io:443/reviews/google/mobly/134#-KeafukV0V8RVakOJdMM:-Keb0GybKDoO7No6vN6E:b-896fix) ([raw file](https://github.com/google/mobly/blob/ac07cff0770546fe6ffc9087d423d3236400775c/mobly/controllers/android_device_lib/callback_handler.py#L66)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> For the method names that map directly to the java side like waitAndGet <-> eventWaitAndGet, sg. For unrelated method names like _msgToEvent we should maintain our python convention. </blockquote></details> Done. --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/134)* <!-- Sent from Reviewable.io --> adorokhine: Reviewed 1 of 3 files at r3. Review status: 1 of 3 files reviewed at latest revision, 1 unresolved discussion. --- *[tests/mobly/controllers/android_device_lib/callback_handler_test.py, line 42 at r3](https://reviewable.io:443/reviews/google/mobly/134#-Keb3TNWhm1veWNWxwy0:-Keb3TNWhm1veWNWxwy1:b-kkxbju) ([raw file](https://github.com/google/mobly/blob/b3d6d78c2855411ed3ec35a3f3e01eba7ebc3291/tests/mobly/controllers/android_device_lib/callback_handler_test.py#L42)):* > ```Python > mock_event_client.eventWaitAndGet = mock.Mock(return_value=MOCK_RAW_EVENT) > handler = callback_handler.CallbackHandler(MOCK_CALLBACK_ID, > mock_event_client, None, None) > ``` Can you change this to kwargs so the meaning of the two Nones is clearer? --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/134)* <!-- Sent from Reviewable.io --> xpconanfan: Review status: 1 of 3 files reviewed at latest revision, 1 unresolved discussion. --- *[tests/mobly/controllers/android_device_lib/callback_handler_test.py, line 42 at r3](https://reviewable.io:443/reviews/google/mobly/134#-Keb3TNWhm1veWNWxwy0:-KebLP7CiCjz4E8MrI22:b-896fix) ([raw file](https://github.com/google/mobly/blob/b3d6d78c2855411ed3ec35a3f3e01eba7ebc3291/tests/mobly/controllers/android_device_lib/callback_handler_test.py#L42)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> Can you change this to kwargs so the meaning of the two Nones is clearer? </blockquote></details> Done. --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/134)* <!-- Sent from Reviewable.io --> adorokhine: <img class="emoji" title=":lgtm:" alt=":lgtm:" align="absmiddle" src="https://reviewable.io/lgtm.png" height="20" width="61"/> --- Reviewed 2 of 3 files at r3, 1 of 1 files at r4. Review status: all files reviewed at latest revision, all discussions resolved. --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/134#-:-KebPTqrpHKK-5HOzqt1:bnfp4nl)* <!-- Sent from Reviewable.io -->
diff --git a/mobly/controllers/android_device_lib/callback_handler.py b/mobly/controllers/android_device_lib/callback_handler.py index 93b13e2..d86bf9e 100644 --- a/mobly/controllers/android_device_lib/callback_handler.py +++ b/mobly/controllers/android_device_lib/callback_handler.py @@ -17,6 +17,8 @@ import logging import time +from mobly.controllers.android_device_lib import snippet_event + class Error(Exception): pass @@ -30,16 +32,23 @@ class CallbackHandler(object): """The class used to handle a specific group of callback events. All the events handled by a CallbackHandler are originally triggered by one - async Rpc call. All the events are tagged with a callback_id specific to a call - to an AsyncRpc method defined on the server side. + async Rpc call. All the events are tagged with a callback_id specific to a + call to an AsyncRpc method defined on the server side. - The callback events are dictionaries that follow this schema: + The raw message representing an event looks like: { 'callbackId': <string, callbackId>, 'name': <string, name of the event>, - 'time': <long, epoch time of when the event was created on the server side>, + 'time': <long, epoch time of when the event was created on the server + side>, 'data': <dict, extra data from the callback on the server side> } + + Each message is then used to create a SnippetEvent object on the client + side. + + Attributes: + ret_value: The direct return value of the async Rpc call. """ def __init__(self, callback_id, event_client, ret_value, method_name): @@ -57,7 +66,7 @@ class CallbackHandler(object): timeout: float, the number of seconds to wait before giving up. Returns: - The oldest entry of the specified event. + SnippetEvent, the oldest entry of the specified event. Raises: TimeoutError: The expected event does not occur within time limit. @@ -65,25 +74,27 @@ class CallbackHandler(object): if timeout: timeout *= 1000 # convert to milliseconds for java side try: - event = self._event_client.eventWaitAndGet(self._id, event_name, - timeout) + raw_event = self._event_client.eventWaitAndGet(self._id, + event_name, timeout) except Exception as e: if "EventSnippetException: timeout." in str(e): raise TimeoutError( 'Timeout waiting for event "%s" triggered by %s (%s).' % (event_name, self._method_name, self._id)) raise - return event + return snippet_event.from_dict(raw_event) def getAll(self, event_name): - """Gets all the events of a certain name that have been received so far. - This is a non-blocking call. + """Gets all the events of a certain name that have been received so + far. This is a non-blocking call. Args: callback_id: The id of the callback. event_name: string, the name of the event to get. Returns: - A list of dicts, each dict representing an event from the Java side. + A list of SnippetEvent, each representing an event from the Java + side. """ - return self._event_client.eventGetAll(self._id, event_name) + raw_events = self._event_client.eventGetAll(self._id, event_name) + return [snippet_event.from_dict(msg) for msg in raw_events] diff --git a/mobly/controllers/android_device_lib/snippet_event.py b/mobly/controllers/android_device_lib/snippet_event.py new file mode 100644 index 0000000..0947a55 --- /dev/null +++ b/mobly/controllers/android_device_lib/snippet_event.py @@ -0,0 +1,50 @@ +# Copyright 2017 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging +import time + + +def from_dict(event_dict): + """Create a SnippetEvent object from a dictionary. + + Args: + event_dict: a dictionary representing an event. + + Returns: + A SnippetEvent object. + """ + return SnippetEvent( + callback_id=event_dict['callbackId'], + name=event_dict['name'], + creation_time=event_dict['time'], + data=event_dict['data']) + + +class SnippetEvent(object): + """The class that represents callback events for mobly snippet library. + + Attributes: + callback_id: string, the callback ID associated with the event. + name: string, the name of the event. + creation_time: int, the epoch time when the event is created on the + Rpc server side. + data: dictionary, the data held by the event. Can be None. + """ + + def __init__(self, callback_id, name, creation_time, data): + self.callback_id = callback_id + self.name = name + self.creation_time = creation_time + self.data = data
Create an `event` type on the client side So instead of dealing with the dict and key access: ``` {u'callbackId': u'2-2', u'data': {u'isSuccess': True}, u'name': u'status', u'time': 1487989424790} ``` We could have some sort of structure: ``` event.data -> {'isSuccess': True} event.name -> 'status' event.creation_time -> 1487989424790 ```
google/mobly
diff --git a/tests/mobly/controllers/android_device_lib/callback_handler_test.py b/tests/mobly/controllers/android_device_lib/callback_handler_test.py index dbbb692..d121fe8 100755 --- a/tests/mobly/controllers/android_device_lib/callback_handler_test.py +++ b/tests/mobly/controllers/android_device_lib/callback_handler_test.py @@ -21,19 +21,47 @@ from mobly.controllers.android_device_lib import callback_handler from mobly.controllers.android_device_lib import jsonrpc_client_base MOCK_CALLBACK_ID = "1-0" +MOCK_RAW_EVENT = { + 'callbackId': '2-1', + 'name': 'AsyncTaskResult', + 'time': 20460228696, + 'data': { + 'exampleData': "Here's a simple event.", + 'successful': True, + 'secretNumber': 12 + } +} class CallbackHandlerTest(unittest.TestCase): """Unit tests for mobly.controllers.android_device_lib.callback_handler. """ + def test_event_dict_to_snippet_event(self): + mock_event_client = mock.Mock() + mock_event_client.eventWaitAndGet = mock.Mock( + return_value=MOCK_RAW_EVENT) + handler = callback_handler.CallbackHandler( + callback_id=MOCK_CALLBACK_ID, + event_client=mock_event_client, + ret_value=None, + method_name=None) + event = handler.waitAndGet('ha') + self.assertEqual(event.name, MOCK_RAW_EVENT['name']) + self.assertEqual(event.creation_time, MOCK_RAW_EVENT['time']) + self.assertEqual(event.data, MOCK_RAW_EVENT['data']) + self.assertEqual(event.callback_id, MOCK_RAW_EVENT['callbackId']) + def test_wait_and_get_timeout(self): mock_event_client = mock.Mock() java_timeout_msg = 'com.google.android.mobly.snippet.event.EventSnippet$EventSnippetException: timeout.' mock_event_client.eventWaitAndGet = mock.Mock( side_effect=jsonrpc_client_base.ApiError(java_timeout_msg)) - handler = callback_handler.CallbackHandler(MOCK_CALLBACK_ID, - mock_event_client, None, None) + handler = callback_handler.CallbackHandler( + callback_id=MOCK_CALLBACK_ID, + event_client=mock_event_client, + ret_value=None, + method_name=None) expected_msg = 'Timeout waiting for event "ha" .*' with self.assertRaisesRegexp(callback_handler.TimeoutError, expected_msg):
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_added_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 1 }
1.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work future==1.0.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work -e git+https://github.com/google/mobly.git@061ed277ec8af0b67e607ad7b12a5de80912c590#egg=mobly mock==1.0.1 packaging @ file:///croot/packaging_1734472117206/work pluggy @ file:///croot/pluggy_1733169602837/work pytest @ file:///croot/pytest_1738938843180/work pytz==2025.2 tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
name: mobly channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - future==1.0.0 - mock==1.0.1 - pytz==2025.2 prefix: /opt/conda/envs/mobly
[ "tests/mobly/controllers/android_device_lib/callback_handler_test.py::CallbackHandlerTest::test_event_dict_to_snippet_event" ]
[]
[ "tests/mobly/controllers/android_device_lib/callback_handler_test.py::CallbackHandlerTest::test_wait_and_get_timeout" ]
[]
Apache License 2.0
1,043
[ "mobly/controllers/android_device_lib/snippet_event.py", "mobly/controllers/android_device_lib/callback_handler.py" ]
[ "mobly/controllers/android_device_lib/snippet_event.py", "mobly/controllers/android_device_lib/callback_handler.py" ]
google__mobly-135
81f4c8854fdc7b07607efdb7f0da91b9e1b22d12
2017-02-28 17:06:35
b4362eda0c8148644812849cdb9c741e35d5750d
dthkao: Review status: 0 of 3 files reviewed at latest revision, 1 unresolved discussion. --- *[mobly/controllers/android_device_lib/callback_handler.py, line 74 at r1](https://reviewable.io:443/reviews/google/mobly/135#-Ke4ob0DXHPzYW-rBks6:-Ke4ob0DXHPzYW-rBks7:b6v54a8) ([raw file](https://github.com/google/mobly/blob/17f126533ea9c8c2e19c8379964a14ea02b6a3a6/mobly/controllers/android_device_lib/callback_handler.py#L74)):* > ```Python > raise TimeoutError( > 'Timeout waiting for event "%s" triggered by %s' > % (event_name, self._method_name)) > ``` Why not keep the callback id in there as well? --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/135)* <!-- Sent from Reviewable.io --> xpconanfan: Review status: 0 of 3 files reviewed at latest revision, 1 unresolved discussion. --- *[mobly/controllers/android_device_lib/callback_handler.py, line 74 at r1](https://reviewable.io:443/reviews/google/mobly/135#-Ke4ob0DXHPzYW-rBks6:-Ke4qNtizUsPekAcMHvk:bq9wddn) ([raw file](https://github.com/google/mobly/blob/17f126533ea9c8c2e19c8379964a14ea02b6a3a6/mobly/controllers/android_device_lib/callback_handler.py#L74)):* <details><summary><i>Previously, dthkao (David T.H. Kao) wrote…</i></summary><blockquote> Why not keep the callback id in there as well? </blockquote></details> It is not really useful for regular users, and may cause confusion... Since it is an implementation detail, I don't want people to start relying on it for analysis and other things. --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/135)* <!-- Sent from Reviewable.io -->
diff --git a/mobly/controllers/android_device_lib/callback_handler.py b/mobly/controllers/android_device_lib/callback_handler.py index 399e999..93b13e2 100644 --- a/mobly/controllers/android_device_lib/callback_handler.py +++ b/mobly/controllers/android_device_lib/callback_handler.py @@ -42,10 +42,11 @@ class CallbackHandler(object): } """ - def __init__(self, callback_id, event_client, ret_value): + def __init__(self, callback_id, event_client, ret_value, method_name): self._id = callback_id self._event_client = event_client self.ret_value = ret_value + self._method_name = method_name def waitAndGet(self, event_name, timeout=None): """Blocks until an event of the specified name has been received and @@ -69,8 +70,8 @@ class CallbackHandler(object): except Exception as e: if "EventSnippetException: timeout." in str(e): raise TimeoutError( - 'Timeout waiting for event "%s" of callback %s' - % (event_name, self._id)) + 'Timeout waiting for event "%s" triggered by %s (%s).' + % (event_name, self._method_name, self._id)) raise return event diff --git a/mobly/controllers/android_device_lib/jsonrpc_client_base.py b/mobly/controllers/android_device_lib/jsonrpc_client_base.py index 84cf480..eed3aca 100644 --- a/mobly/controllers/android_device_lib/jsonrpc_client_base.py +++ b/mobly/controllers/android_device_lib/jsonrpc_client_base.py @@ -292,7 +292,10 @@ class JsonRpcClientBase(object): if self._event_client is None: self._event_client = self._start_event_client() return callback_handler.CallbackHandler( - result['callback'], self._event_client, result['result']) + callback_id=result['callback'], + event_client=self._event_client, + ret_value=result['result'], + method_name=method) return result['result'] def _is_app_running(self): diff --git a/mobly/controllers/android_device_lib/snippet_client.py b/mobly/controllers/android_device_lib/snippet_client.py index a053303..c3f2ac9 100644 --- a/mobly/controllers/android_device_lib/snippet_client.py +++ b/mobly/controllers/android_device_lib/snippet_client.py @@ -64,13 +64,13 @@ class SnippetClient(jsonrpc_client_base.JsonRpcClientBase): # Use info here so people know exactly what's happening here, which is # helpful since they need to create their own instrumentations and # manifest. - logging.info('Launching snippet apk with: %s', cmd) + logging.debug('Launching snippet apk %s', self.package) self._adb.shell(cmd) def stop_app(self): """Overrides superclass.""" cmd = _STOP_CMD % self.package - logging.info('Stopping snippet apk with: %s', cmd) + logging.debug('Stopping snippet apk %s', self.package) out = self._adb.shell(_STOP_CMD % self.package).decode('utf-8') if 'OK (0 tests)' not in out: raise Error('Failed to stop existing apk. Unexpected output: %s' %
Better timeout message in CallbackHandler Right now the `CallbackHandler`'s timeout msg only includes the `callback_id`, which is an implementation detail that doesn't make too much sense for the user. We should add the name of the call where the event was supposed to originate from.
google/mobly
diff --git a/tests/mobly/controllers/android_device_lib/callback_handler_test.py b/tests/mobly/controllers/android_device_lib/callback_handler_test.py index ffe3ad7..dbbb692 100755 --- a/tests/mobly/controllers/android_device_lib/callback_handler_test.py +++ b/tests/mobly/controllers/android_device_lib/callback_handler_test.py @@ -33,7 +33,7 @@ class CallbackHandlerTest(unittest.TestCase): mock_event_client.eventWaitAndGet = mock.Mock( side_effect=jsonrpc_client_base.ApiError(java_timeout_msg)) handler = callback_handler.CallbackHandler(MOCK_CALLBACK_ID, - mock_event_client, None) + mock_event_client, None, None) expected_msg = 'Timeout waiting for event "ha" .*' with self.assertRaisesRegexp(callback_handler.TimeoutError, expected_msg):
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 3 }
1.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup==1.2.2 future==1.0.0 iniconfig==2.1.0 -e git+https://github.com/google/mobly.git@81f4c8854fdc7b07607efdb7f0da91b9e1b22d12#egg=mobly mock==1.0.1 packaging==24.2 pluggy==1.5.0 pytest==8.3.5 pytz==2025.2 tomli==2.2.1
name: mobly channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - exceptiongroup==1.2.2 - future==1.0.0 - iniconfig==2.1.0 - mock==1.0.1 - packaging==24.2 - pluggy==1.5.0 - pytest==8.3.5 - pytz==2025.2 - tomli==2.2.1 prefix: /opt/conda/envs/mobly
[ "tests/mobly/controllers/android_device_lib/callback_handler_test.py::CallbackHandlerTest::test_wait_and_get_timeout" ]
[]
[]
[]
Apache License 2.0
1,044
[ "mobly/controllers/android_device_lib/snippet_client.py", "mobly/controllers/android_device_lib/jsonrpc_client_base.py", "mobly/controllers/android_device_lib/callback_handler.py" ]
[ "mobly/controllers/android_device_lib/snippet_client.py", "mobly/controllers/android_device_lib/jsonrpc_client_base.py", "mobly/controllers/android_device_lib/callback_handler.py" ]
dpkp__kafka-python-999
bcb4009b935fb74e3ca71206466c68ad74bc7b3c
2017-02-28 18:12:26
618c5051493693c1305aa9f08e8a0583d5fcf0e3
diff --git a/kafka/client_async.py b/kafka/client_async.py index 1513f39..85de90a 100644 --- a/kafka/client_async.py +++ b/kafka/client_async.py @@ -105,10 +105,10 @@ class KafkaClient(object): providing a file, only the leaf certificate will be checked against this CRL. The CRL can only be checked with Python 3.4+ or 2.7.9+. default: none. - api_version (tuple): specify which kafka API version to use. Accepted - values are: (0, 8, 0), (0, 8, 1), (0, 8, 2), (0, 9), (0, 10) - If None, KafkaClient will attempt to infer the broker - version by probing various APIs. Default: None + api_version (tuple): Specify which Kafka API version to use. If set + to None, KafkaClient will attempt to infer the broker version by + probing various APIs. For the full list of supported versions, + see KafkaClient.API_VERSIONS. Default: None api_version_auto_timeout_ms (int): number of milliseconds to throw a timeout exception from the constructor when checking the broker api version. Only applies if api_version is None diff --git a/kafka/conn.py b/kafka/conn.py index f4fbb93..88013f0 100644 --- a/kafka/conn.py +++ b/kafka/conn.py @@ -114,10 +114,9 @@ class BrokerConnection(object): providing a file, only the leaf certificate will be checked against this CRL. The CRL can only be checked with Python 3.4+ or 2.7.9+. default: None. - api_version (tuple): specify which Kafka API version to use. Accepted - values are: (0, 8, 0), (0, 8, 1), (0, 8, 2), (0, 9), (0, 10) - If None, KafkaClient will attempt to infer the broker - version by probing various APIs. Default: None + api_version (tuple): Specify which Kafka API version to use. + Accepted values are: (0, 8, 0), (0, 8, 1), (0, 8, 2), (0, 9), + (0, 10). Default: (0, 8, 2) api_version_auto_timeout_ms (int): number of milliseconds to throw a timeout exception from the constructor when checking the broker api version. Only applies if api_version is None diff --git a/kafka/consumer/group.py b/kafka/consumer/group.py index 47c721f..8c2ab2d 100644 --- a/kafka/consumer/group.py +++ b/kafka/consumer/group.py @@ -6,6 +6,8 @@ import socket import sys import time +from kafka.errors import KafkaConfigurationError + from kafka.vendor import six from kafka.client_async import KafkaClient, selectors @@ -159,9 +161,9 @@ class KafkaConsumer(six.Iterator): providing a file, only the leaf certificate will be checked against this CRL. The CRL can only be checked with Python 3.4+ or 2.7.9+. Default: None. - api_version (tuple): Specify which kafka API version to use. - If set to None, the client will attempt to infer the broker version - by probing various APIs. Default: None + api_version (tuple): Specify which Kafka API version to use. If set to + None, the client will attempt to infer the broker version by probing + various APIs. Different versions enable different functionality. Examples: (0, 9) enables full group coordination features with automatic partition assignment and rebalancing, @@ -171,7 +173,8 @@ class KafkaConsumer(six.Iterator): partition assignment only, (0, 8, 0) enables basic functionality but requires manual partition assignment and offset management. - For a full list of supported versions, see KafkaClient.API_VERSIONS + For the full list of supported versions, see + KafkaClient.API_VERSIONS. Default: None api_version_auto_timeout_ms (int): number of milliseconds to throw a timeout exception from the constructor when checking the broker api version. Only applies if api_version set to 'auto' @@ -267,6 +270,17 @@ class KafkaConsumer(six.Iterator): new_config, self.config['auto_offset_reset']) self.config['auto_offset_reset'] = new_config + request_timeout_ms = self.config['request_timeout_ms'] + session_timeout_ms = self.config['session_timeout_ms'] + fetch_max_wait_ms = self.config['fetch_max_wait_ms'] + if request_timeout_ms <= session_timeout_ms: + raise KafkaConfigurationError( + "Request timeout (%s) must be larger than session timeout (%s)" % + (request_timeout_ms, session_timeout_ms)) + if request_timeout_ms <= fetch_max_wait_ms: + raise KafkaConfigurationError("Request timeout (%s) must be larger than fetch-max-wait-ms (%s)" % + (request_timeout_ms, fetch_max_wait_ms)) + metrics_tags = {'client-id': self.config['client_id']} metric_config = MetricConfig(samples=self.config['metrics_num_samples'], time_window_ms=self.config['metrics_sample_window_ms'], diff --git a/kafka/producer/buffer.py b/kafka/producer/buffer.py index 422d47c..d1eeaf1 100644 --- a/kafka/producer/buffer.py +++ b/kafka/producer/buffer.py @@ -197,6 +197,7 @@ class SimpleBufferPool(object): if self._free: buf = self._free.popleft() else: + self._waiters.remove(more_memory) raise Errors.KafkaTimeoutError( "Failed to allocate memory within the configured" " max blocking time") diff --git a/kafka/producer/kafka.py b/kafka/producer/kafka.py index 98d4426..5581f63 100644 --- a/kafka/producer/kafka.py +++ b/kafka/producer/kafka.py @@ -224,10 +224,10 @@ class KafkaProducer(object): providing a file, only the leaf certificate will be checked against this CRL. The CRL can only be checked with Python 3.4+ or 2.7.9+. default: none. - api_version (tuple): specify which kafka API version to use. - For a full list of supported versions, see KafkaClient.API_VERSIONS - If set to None, the client will attempt to infer the broker version - by probing various APIs. Default: None + api_version (tuple): Specify which Kafka API version to use. If set to + None, the client will attempt to infer the broker version by probing + various APIs. For a full list of supported versions, see + KafkaClient.API_VERSIONS. Default: None api_version_auto_timeout_ms (int): number of milliseconds to throw a timeout exception from the constructor when checking the broker api version. Only applies if api_version set to 'auto' diff --git a/kafka/util.py b/kafka/util.py index bc01154..de8f228 100644 --- a/kafka/util.py +++ b/kafka/util.py @@ -4,7 +4,6 @@ import atexit import binascii import collections import struct -import sys from threading import Thread, Event import weakref @@ -33,19 +32,6 @@ def write_int_string(s): return struct.pack('>i%ds' % len(s), len(s), s) -def write_short_string(s): - if s is not None and not isinstance(s, six.binary_type): - raise TypeError('Expected "%s" to be bytes\n' - 'data=%s' % (type(s), repr(s))) - if s is None: - return struct.pack('>h', -1) - elif len(s) > 32767 and sys.version_info < (2, 7): - # Python 2.6 issues a deprecation warning instead of a struct error - raise struct.error(len(s)) - else: - return struct.pack('>h%ds' % len(s), len(s), s) - - def read_short_string(data, cur): if len(data) < cur + 2: raise BufferUnderflowError("Not enough data left") @@ -62,24 +48,6 @@ def read_short_string(data, cur): return out, cur + strlen -def read_int_string(data, cur): - if len(data) < cur + 4: - raise BufferUnderflowError( - "Not enough data left to read string len (%d < %d)" % - (len(data), cur + 4)) - - (strlen,) = struct.unpack('>i', data[cur:cur + 4]) - if strlen == -1: - return None, cur + 4 - - cur += 4 - if len(data) < cur + strlen: - raise BufferUnderflowError("Not enough data left") - - out = data[cur:cur + strlen] - return out, cur + strlen - - def relative_unpack(fmt, data, cur): size = struct.calcsize(fmt) if len(data) < cur + size:
Once KafkaProducer reports "Failed to allocate memory within the configured" exceptions, it never recovers from the failures We have a situation there is a message burst in our business codes using Kafka 1.3.2. The message rate might reach 100K/s, each message size is less than 16Kb. The producer is shared between threads and configured as default parameters except 'compression_type='gzip', linger_ms=5, retries=3'. We observe that during message burst, Kafka producer reports: “KafkaTimeoutError: KafkaTimeoutError: Failed to allocate memory within the configured max blocking time” And it never comes back. Traceback listed below: Traceback (most recent call last): File "/root/search/db_publisher.py", line 47, in publish self._publish(message) File "/root/search/db_publisher.py", line 41, in _publish self.producer.send(self.topic, msg) File "/usr/lib/python2.7/site-packages/kafka/producer/kafka.py", line 511, in send self.config['max_block_ms']) File "/usr/lib/python2.7/site-packages/kafka/producer/record_accumulator.py", line 243, in append buf = self._free.allocate(size, max_time_to_block_ms) File "/usr/lib/python2.7/site-packages/kafka/producer/buffer.py", line 201, in allocate "Failed to allocate memory within the configured" KafkaTimeoutError: KafkaTimeoutError: Failed to allocate memory within the configured max blocking time Then I check more and find another exception produced: Traceback (most recent call last): File "/root/search/db_publisher.py", line 47, in publish self._publish(message) File "/root/search/db_publisher.py", line 41, in _publish self.producer.send(self.topic, msg) File "/usr/lib/python2.7/site-packages/kafka/producer/kafka.py", line 511, in send self.config['max_block_ms']) File "/usr/lib/python2.7/site-packages/kafka/producer/record_accumulator.py", line 243, in append buf = self._free.allocate(size, max_time_to_block_ms) File "/usr/lib/python2.7/site-packages/kafka/producer/buffer.py", line 207, in allocate assert removed is more_memory, 'Wrong condition' AssertionError: Wrong condition I check the source codes of above exceptions in code buffer.py (class SimpleBufferPool). There is something wrong in the situation when producer fails to allocate memory from buffer pool within time limit: if self._free: buf = self._free.popleft() else: raise Errors.KafkaTimeoutError( "Failed to allocate memory within the configured" " max blocking time") Should we popleft the semaphore appended to the waiters before raising Errors.KafkaTimeoutError, so next allocation action no need to wait for "max_time_to_block_ms" milliseconds and thus its Condition assertion can pass? Due to each de-allocation notifies the wrong Condtion objects, each allocation action has to waste "max_time_to_block_ms" to wait the semaphore signal. As consequence, our program is slowing down rapidly and not acceptable for business. The issue has been re-produced 3 times and I will provide debug information about memory allocation and de-allocation logging. Anyway, thanks your guys for this wonderful library.
dpkp/kafka-python
diff --git a/test/test_consumer.py b/test/test_consumer.py index f3dad16..073a3af 100644 --- a/test/test_consumer.py +++ b/test/test_consumer.py @@ -16,6 +16,14 @@ class TestKafkaConsumer(unittest.TestCase): with self.assertRaises(AssertionError): SimpleConsumer(MagicMock(), 'group', 'topic', partitions = [ '0' ]) + def test_session_timeout_larger_than_request_timeout_raises(self): + with self.assertRaises(KafkaConfigurationError): + KafkaConsumer(bootstrap_servers='localhost:9092', session_timeout_ms=60000, request_timeout_ms=40000) + + def test_fetch_max_wait_larger_than_request_timeout_raises(self): + with self.assertRaises(KafkaConfigurationError): + KafkaConsumer(bootstrap_servers='localhost:9092', fetch_max_wait_ms=41000, request_timeout_ms=40000) + class TestMultiProcessConsumer(unittest.TestCase): @unittest.skipIf(sys.platform.startswith('win'), 'test mocking fails on windows') diff --git a/test/test_util.py b/test/test_util.py index 5fc3f69..58e5ab8 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -43,57 +43,11 @@ class UtilTest(unittest.TestCase): b'\xff\xff\xff\xff' ) - def test_read_int_string(self): - self.assertEqual(kafka.util.read_int_string(b'\xff\xff\xff\xff', 0), (None, 4)) - self.assertEqual(kafka.util.read_int_string(b'\x00\x00\x00\x00', 0), (b'', 4)) - self.assertEqual(kafka.util.read_int_string(b'\x00\x00\x00\x0bsome string', 0), (b'some string', 15)) - - def test_read_int_string__insufficient_data(self): - with self.assertRaises(kafka.errors.BufferUnderflowError): - kafka.util.read_int_string(b'\x00\x00\x00\x021', 0) - - def test_write_short_string(self): - self.assertEqual( - kafka.util.write_short_string(b'some string'), - b'\x00\x0bsome string' - ) - - def test_write_short_string__unicode(self): - with self.assertRaises(TypeError) as cm: - kafka.util.write_short_string(u'hello') - #: :type: TypeError - te = cm.exception - if six.PY2: - self.assertIn('unicode', str(te)) - else: - self.assertIn('str', str(te)) - self.assertIn('to be bytes', str(te)) - - def test_write_short_string__empty(self): - self.assertEqual( - kafka.util.write_short_string(b''), - b'\x00\x00' - ) - - def test_write_short_string__null(self): - self.assertEqual( - kafka.util.write_short_string(None), - b'\xff\xff' - ) - - def test_write_short_string__too_long(self): - with self.assertRaises(struct.error): - kafka.util.write_short_string(b' ' * 33000) - def test_read_short_string(self): self.assertEqual(kafka.util.read_short_string(b'\xff\xff', 0), (None, 2)) self.assertEqual(kafka.util.read_short_string(b'\x00\x00', 0), (b'', 2)) self.assertEqual(kafka.util.read_short_string(b'\x00\x0bsome string', 0), (b'some string', 13)) - def test_read_int_string__insufficient_data2(self): - with self.assertRaises(kafka.errors.BufferUnderflowError): - kafka.util.read_int_string('\x00\x021', 0) - def test_relative_unpack2(self): self.assertEqual( kafka.util.relative_unpack('>hh', b'\x00\x01\x00\x00\x02', 0),
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 6 }
1.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest pytest-cov pytest-catchlog pytest-pylint pytest-sugar pytest-mock mock python-snappy lz4tools xxhash", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc libsnappy-dev" ], "python": "3.5", "reqs_path": [ "docs/requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 astroid==2.11.7 attrs==22.2.0 Babel==2.11.0 certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 cramjam==2.5.0 dill==0.3.4 docutils==0.18.1 idna==3.10 imagesize==1.4.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isort==5.10.1 Jinja2==3.0.3 -e git+https://github.com/dpkp/kafka-python.git@bcb4009b935fb74e3ca71206466c68ad74bc7b3c#egg=kafka_python lazy-object-proxy==1.7.1 lz4tools==1.3.1.2 MarkupSafe==2.0.1 mccabe==0.7.0 mock==5.2.0 packaging==21.3 platformdirs==2.4.0 pluggy==1.0.0 pockets==0.9.1 py==1.11.0 Pygments==2.14.0 pylint==2.13.9 pyparsing==3.1.4 pytest==7.0.1 pytest-catchlog==1.2.2 pytest-cov==4.0.0 pytest-mock==3.6.1 pytest-pylint==0.18.0 pytest-sugar==0.9.6 python-snappy==0.7.3 pytz==2025.2 requests==2.27.1 six==1.17.0 snowballstemmer==2.2.0 Sphinx==5.3.0 sphinx-rtd-theme==2.0.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jquery==4.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-napoleon==0.7 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 termcolor==1.1.0 toml==0.10.2 tomli==1.2.3 typed-ast==1.5.5 typing_extensions==4.1.1 urllib3==1.26.20 wrapt==1.16.0 xxhash==3.2.0 zipp==3.6.0
name: kafka-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - astroid==2.11.7 - attrs==22.2.0 - babel==2.11.0 - charset-normalizer==2.0.12 - coverage==6.2 - cramjam==2.5.0 - dill==0.3.4 - docutils==0.18.1 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isort==5.10.1 - jinja2==3.0.3 - lazy-object-proxy==1.7.1 - lz4tools==1.3.1.2 - markupsafe==2.0.1 - mccabe==0.7.0 - mock==5.2.0 - packaging==21.3 - platformdirs==2.4.0 - pluggy==1.0.0 - pockets==0.9.1 - py==1.11.0 - pygments==2.14.0 - pylint==2.13.9 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-catchlog==1.2.2 - pytest-cov==4.0.0 - pytest-mock==3.6.1 - pytest-pylint==0.18.0 - pytest-sugar==0.9.6 - python-snappy==0.7.3 - pytz==2025.2 - requests==2.27.1 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==5.3.0 - sphinx-rtd-theme==2.0.0 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jquery==4.1 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-napoleon==0.7 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - termcolor==1.1.0 - toml==0.10.2 - tomli==1.2.3 - typed-ast==1.5.5 - typing-extensions==4.1.1 - urllib3==1.26.20 - wrapt==1.16.0 - xxhash==3.2.0 - zipp==3.6.0 prefix: /opt/conda/envs/kafka-python
[ "test/test_consumer.py::TestKafkaConsumer::test_fetch_max_wait_larger_than_request_timeout_raises", "test/test_consumer.py::TestKafkaConsumer::test_session_timeout_larger_than_request_timeout_raises" ]
[]
[ "test/test_consumer.py::TestKafkaConsumer::test_non_integer_partitions", "test/test_consumer.py::TestMultiProcessConsumer::test_partition_list", "test/test_consumer.py::TestSimpleConsumer::test_simple_consumer_commit_does_not_raise", "test/test_consumer.py::TestSimpleConsumer::test_simple_consumer_failed_payloads", "test/test_consumer.py::TestSimpleConsumer::test_simple_consumer_leader_change", "test/test_consumer.py::TestSimpleConsumer::test_simple_consumer_reset_partition_offset", "test/test_consumer.py::TestSimpleConsumer::test_simple_consumer_unknown_topic_partition", "test/test_util.py::UtilTest::test_group_by_topic_and_partition", "test/test_util.py::UtilTest::test_read_short_string", "test/test_util.py::UtilTest::test_relative_unpack2", "test/test_util.py::UtilTest::test_relative_unpack3", "test/test_util.py::UtilTest::test_write_int_string", "test/test_util.py::UtilTest::test_write_int_string__empty", "test/test_util.py::UtilTest::test_write_int_string__null", "test/test_util.py::UtilTest::test_write_int_string__unicode" ]
[]
Apache License 2.0
1,045
[ "kafka/consumer/group.py", "kafka/producer/buffer.py", "kafka/client_async.py", "kafka/producer/kafka.py", "kafka/util.py", "kafka/conn.py" ]
[ "kafka/consumer/group.py", "kafka/producer/buffer.py", "kafka/client_async.py", "kafka/producer/kafka.py", "kafka/util.py", "kafka/conn.py" ]
Duke-GCB__lando-20
5684145c4e27e6396a63b02ffc6d6e244ad69bc1
2017-02-28 21:01:23
5684145c4e27e6396a63b02ffc6d6e244ad69bc1
diff --git a/README.md b/README.md index 8130b3b..4adc5b5 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ vm_settings: worker_image_name: lando_worker # Name of the image that has lando installed and lando_worker setup to run as a service ssh_key_name: jpb67 # Name of the openstack SSH key to install on the worker network_name: selfservice # Openstack network name to add the vm onto + allocate_floating_ips: false # Should each worker VM get allocated a floating IP defaults to false floating_ip_pool_name: ext-net # Pool of floating IP's that will have one assigned to the VM default_favor_name: m1.small # Flavor of image to use by default when creating a VM @@ -97,7 +98,7 @@ cloud_settings: password: secret3 user_domain_name: Default project_name: jpb67 # name of the project we will add VMs to - project_domain_name: Default + project_domain_name: Default # Bespin job API settings bespin_api: diff --git a/lando/server/cloudservice.py b/lando/server/cloudservice.py index 01be99f..c5f4e8a 100644 --- a/lando/server/cloudservice.py +++ b/lando/server/cloudservice.py @@ -3,6 +3,7 @@ Allows launching and terminating openstack virtual machines. """ from keystoneauth1 import session from keystoneauth1 import loading +import novaclient.exceptions from novaclient import client as nvclient from time import sleep import logging @@ -67,13 +68,28 @@ class NovaClient(object): instance.add_floating_ip(floating_ip) return floating_ip.ip - def terminate_instance(self, server_name): + def _delete_floating_ip(self, instance): + """ + Delete floating ip address associated with the instance with server_name. + If not found will log as as warning. + :param instance: Server: VM we want to delete a floating IP from + """ + try: + floating_ip = self.nova.floating_ips.find(instance_id=instance.id) + floating_ip.delete() + except novaclient.exceptions.NotFound: + logging.warn('No floating ip address found for {} ({})'.format(instance.name, instance.id)) + + def terminate_instance(self, server_name, delete_floating_ip): """ Terminate a VM based on name. :param server_name: str: name of the VM to terminate + :param delete_floating_ip: bool: should we try to delete an attached floating ip address """ - s = self.nova.servers.find(name=server_name) - self.nova.servers.delete(s) + instance = self.nova.servers.find(name=server_name) + if delete_floating_ip: + self._delete_floating_ip(instance) + self.nova.servers.delete(instance) class CloudService(object): @@ -99,18 +115,23 @@ class CloudService(object): """ vm_settings = self.config.vm_settings instance = self.nova_client.launch_instance(vm_settings, server_name, flavor_name, script_contents) - sleep(WAIT_BEFORE_ATTACHING_IP) - ip_address = self.nova_client.attach_floating_ip(instance, vm_settings.floating_ip_pool_name) - logging.info('launched {} on ip {}'.format(server_name, ip_address)) + ip_address = None + if vm_settings.allocate_floating_ips: + sleep(WAIT_BEFORE_ATTACHING_IP) + ip_address = self.nova_client.attach_floating_ip(instance, vm_settings.floating_ip_pool_name) + logging.info('launched {} on floating ip {}'.format(server_name, ip_address)) + else: + logging.info('launched {} with id'.format(server_name, instance.id)) return instance, ip_address def terminate_instance(self, server_name): """ - Terminate the VM with server_name. + Terminate the VM with server_name and deletes attached floating ip address :param server_name: str: name of the VM to terminate """ + vm_settings = self.config.vm_settings logging.info('terminating instance {}'.format(server_name)) - self.nova_client.terminate_instance(server_name) + self.nova_client.terminate_instance(server_name, delete_floating_ip=vm_settings.allocate_floating_ips) def make_vm_name(self, job_id): """ @@ -136,4 +157,4 @@ class FakeCloudService(object): print("Pretend we terminate: {}".format(server_name)) def make_vm_name(self, job_id): - return 'local_worker' \ No newline at end of file + return 'local_worker' diff --git a/lando/server/config.py b/lando/server/config.py index 8ed34d8..208c471 100644 --- a/lando/server/config.py +++ b/lando/server/config.py @@ -71,6 +71,7 @@ class VMSettings(object): self.worker_image_name = get_or_raise_config_exception(data, 'worker_image_name') self.ssh_key_name = get_or_raise_config_exception(data, 'ssh_key_name') self.network_name = get_or_raise_config_exception(data, 'network_name') + self.allocate_floating_ips = data.get('allocate_floating_ips', False) self.floating_ip_pool_name = get_or_raise_config_exception(data, 'floating_ip_pool_name') self.default_favor_name = get_or_raise_config_exception(data, 'default_favor_name')
Floating IP address exhaustion The current implementation allocates a new floating IP address. Once these are exhausted the VM will not launch. Need to re-use existing floating IP addresses or delete them when we are done. We don't technically need to have floating IPs for running jobs but it makes debugging easier.
Duke-GCB/lando
diff --git a/lando/server/tests/test_cloudservice.py b/lando/server/tests/test_cloudservice.py index c26704c..c8e8c58 100644 --- a/lando/server/tests/test_cloudservice.py +++ b/lando/server/tests/test_cloudservice.py @@ -1,14 +1,16 @@ from __future__ import absolute_import from unittest import TestCase +import novaclient.exceptions from lando.server.cloudservice import CloudService import mock class TestCwlWorkflow(TestCase): + @mock.patch('lando.server.cloudservice.sleep') @mock.patch('keystoneauth1.loading.get_plugin_loader') @mock.patch('keystoneauth1.session.Session') @mock.patch('novaclient.client.Client') - def test_that_flavor_overrides_default(self, mock_client, mock_session, mock_get_plugin_loader): + def test_that_flavor_overrides_default(self, mock_client, mock_session, mock_get_plugin_loader, mock_sleep): config = mock.MagicMock() config.vm_settings.default_favor_name = 'm1.xbig' cloud_service = CloudService(config, project_name='bespin_user1') @@ -16,10 +18,11 @@ class TestCwlWorkflow(TestCase): find_flavor_method = mock_client().flavors.find find_flavor_method.assert_called_with(name='m1.GIANT') + @mock.patch('lando.server.cloudservice.sleep') @mock.patch('keystoneauth1.loading.get_plugin_loader') @mock.patch('keystoneauth1.session.Session') @mock.patch('novaclient.client.Client') - def test_that_no_flavor_chooses_default(self, mock_client, mock_session, mock_get_plugin_loader): + def test_that_no_flavor_chooses_default(self, mock_client, mock_session, mock_get_plugin_loader, mock_sleep): config = mock.MagicMock() config.vm_settings.default_favor_name = 'm1.xbig' cloud_service = CloudService(config, project_name='bespin_user1') @@ -27,5 +30,69 @@ class TestCwlWorkflow(TestCase): find_flavor_method = mock_client().flavors.find find_flavor_method.assert_called_with(name='m1.xbig') + @mock.patch('lando.server.cloudservice.sleep') + @mock.patch('keystoneauth1.loading.get_plugin_loader') + @mock.patch('keystoneauth1.session.Session') + @mock.patch('novaclient.client.Client') + def test_launch_instance_no_floating_ip(self, mock_client, mock_session, mock_get_plugin_loader, mock_sleep): + config = mock.MagicMock() + config.vm_settings.allocate_floating_ips = False + config.vm_settings.default_favor_name = 'm1.large' + cloud_service = CloudService(config, project_name='bespin_user1') + instance, ip_address = cloud_service.launch_instance(server_name="worker1", flavor_name=None, script_contents="") + self.assertEqual(None, ip_address) + mock_client().servers.create.assert_called() + mock_client().floating_ips.create.assert_not_called() + @mock.patch('lando.server.cloudservice.sleep') + @mock.patch('keystoneauth1.loading.get_plugin_loader') + @mock.patch('keystoneauth1.session.Session') + @mock.patch('novaclient.client.Client') + def test_launch_instance_with_floating_ip(self, mock_client, mock_session, mock_get_plugin_loader, mock_sleep): + config = mock.MagicMock() + config.vm_settings.allocate_floating_ips = True + config.vm_settings.default_favor_name = 'm1.large' + cloud_service = CloudService(config, project_name='bespin_user1') + instance, ip_address = cloud_service.launch_instance(server_name="worker1", flavor_name=None, + script_contents="") + self.assertNotEqual(None, ip_address) + mock_client().servers.create.assert_called() + mock_client().floating_ips.create.assert_called() + @mock.patch('keystoneauth1.loading.get_plugin_loader') + @mock.patch('keystoneauth1.session.Session') + @mock.patch('novaclient.client.Client') + def test_terminate_instance_no_floating_ip(self, mock_client, mock_session, mock_get_plugin_loader): + config = mock.MagicMock() + config.vm_settings.allocate_floating_ips = False + config.vm_settings.default_favor_name = 'm1.large' + cloud_service = CloudService(config, project_name='bespin_user1') + cloud_service.terminate_instance(server_name='worker1') + mock_client().servers.delete.assert_called() + mock_client().floating_ips.find.assert_not_called() + + @mock.patch('keystoneauth1.loading.get_plugin_loader') + @mock.patch('keystoneauth1.session.Session') + @mock.patch('novaclient.client.Client') + def test_terminate_instance_with_floating_ip(self, mock_client, mock_session, mock_get_plugin_loader): + config = mock.MagicMock() + config.vm_settings.allocate_floating_ips = True + config.vm_settings.default_favor_name = 'm1.large' + cloud_service = CloudService(config, project_name='bespin_user1') + cloud_service.terminate_instance(server_name='worker1') + mock_client().servers.delete.assert_called() + mock_client().floating_ips.find.assert_called() + mock_client().floating_ips.find().delete.assert_called() + + @mock.patch('keystoneauth1.loading.get_plugin_loader') + @mock.patch('keystoneauth1.session.Session') + @mock.patch('novaclient.client.Client') + def test_terminate_instance_with_missing_floating_ip(self, mock_client, mock_session, mock_get_plugin_loader): + mock_client().floating_ips.find.side_effect = novaclient.exceptions.NotFound(404) + config = mock.MagicMock() + config.vm_settings.allocate_floating_ips = True + config.vm_settings.default_favor_name = 'm1.large' + cloud_service = CloudService(config, project_name='bespin_user1') + cloud_service.terminate_instance(server_name='worker1') + mock_client().servers.delete.assert_called() + mock_client().floating_ips.find.assert_called() diff --git a/lando/server/tests/test_config.py b/lando/server/tests/test_config.py index 80f9c4c..4342ea9 100644 --- a/lando/server/tests/test_config.py +++ b/lando/server/tests/test_config.py @@ -19,6 +19,7 @@ vm_settings: network_name: selfservice floating_ip_pool_name: ext-net default_favor_name: m1.small +{} cloud_settings: auth_url: http://10.109.252.9:5000/v3 @@ -36,7 +37,7 @@ bespin_api: class TestServerConfig(TestCase): def test_good_config(self): - filename = write_temp_return_filename(GOOD_CONFIG) + filename = write_temp_return_filename(GOOD_CONFIG.format("")) config = ServerConfig(filename) os.unlink(filename) self.assertEqual(False, config.fake_cloud_service) @@ -46,6 +47,8 @@ class TestServerConfig(TestCase): self.assertEqual('lando_worker', config.vm_settings.worker_image_name) self.assertEqual('jpb67', config.vm_settings.ssh_key_name) + # by default allocate_floating_ips is off + self.assertEqual(False, config.vm_settings.allocate_floating_ips) self.assertEqual("http://10.109.252.9:5000/v3", config.cloud_settings.auth_url) self.assertEqual("jpb67", config.cloud_settings.username) @@ -53,8 +56,22 @@ class TestServerConfig(TestCase): self.assertEqual("http://localhost:8000/api", config.bespin_api_settings.url) self.assertEqual("10498124091240e", config.bespin_api_settings.token) + def test_allocate_floating_ip_true(self): + line = " allocate_floating_ips: true" + filename = write_temp_return_filename(GOOD_CONFIG.format(line)) + config = ServerConfig(filename) + os.unlink(filename) + self.assertEqual(True, config.vm_settings.allocate_floating_ips) + + def test_allocate_floating_ip_false(self): + line = " allocate_floating_ips: false" + filename = write_temp_return_filename(GOOD_CONFIG.format(line)) + config = ServerConfig(filename) + os.unlink(filename) + self.assertEqual(False, config.vm_settings.allocate_floating_ips) + def test_good_config_with_fake_cloud_service(self): - config_data = GOOD_CONFIG + "\nfake_cloud_service: True" + config_data = GOOD_CONFIG.format("") + "\nfake_cloud_service: True" filename = write_temp_return_filename(config_data) config = ServerConfig(filename) os.unlink(filename) @@ -73,7 +90,7 @@ class TestServerConfig(TestCase): os.unlink(filename) def test_make_worker_config_yml(self): - filename = write_temp_return_filename(GOOD_CONFIG) + filename = write_temp_return_filename(GOOD_CONFIG.format("")) config = ServerConfig(filename) os.unlink(filename) expected = """
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 0 }, "num_modified_files": 3 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "nose", "mock", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
argcomplete==3.6.1 babel==2.17.0 CacheControl==0.12.14 coloredlogs==15.0.1 cwl-upgrader==1.2.12 cwl-utils==0.35 cwlref-runner==1.0 cwltool==3.1.20250110105449 debtcollector==3.0.0 DukeDSClient==2.0.1 exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work future==1.0.0 humanfriendly==10.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work iso8601==2.1.0 isodate==0.7.2 keystoneauth1==2.21.0 -e git+https://github.com/Duke-GCB/lando.git@5684145c4e27e6396a63b02ffc6d6e244ad69bc1#egg=lando lando-messaging==2.1.0 lockfile==0.12.2 lxml==5.3.1 markdown-it-py==3.0.0 mdurl==0.1.2 mistune==3.0.2 mock==5.2.0 msgpack==1.1.0 mypy-extensions==1.0.0 netaddr==1.3.0 netifaces==0.11.0 networkx==3.2.1 nose==1.3.7 oslo.i18n==6.5.1 oslo.serialization==5.7.0 oslo.utils==6.2.1 packaging @ file:///croot/packaging_1734472117206/work pbr==6.1.1 pika==1.1.0 pluggy @ file:///croot/pluggy_1733169602837/work positional==1.2.1 prettytable==0.7.2 prov==1.5.1 psutil==7.0.0 pydot==2.0.0 Pygments==2.19.1 pyparsing==3.2.3 pytest @ file:///croot/pytest_1738938843180/work python-dateutil==2.9.0.post0 python-novaclient==9.0.1 pytz==2025.2 PyYAML==3.11 rdflib==7.1.4 requests==2.10.0 rich==14.0.0 rich-argparse==1.7.0 ruamel.yaml==0.18.10 ruamel.yaml.clib==0.2.12 schema-salad==8.7.20240718183047 simplejson==3.20.1 six==1.17.0 spython==0.3.14 stevedore==5.4.1 tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work typing_extensions==4.13.0 tzdata==2025.2 wrapt==1.17.2
name: lando channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - argcomplete==3.6.1 - babel==2.17.0 - cachecontrol==0.12.14 - coloredlogs==15.0.1 - cwl-upgrader==1.2.12 - cwl-utils==0.35 - cwlref-runner==1.0 - cwltool==3.1.20250110105449 - debtcollector==3.0.0 - dukedsclient==2.0.1 - future==1.0.0 - humanfriendly==10.0 - iso8601==2.1.0 - isodate==0.7.2 - keystoneauth1==2.21.0 - lando-messaging==2.1.0 - lockfile==0.12.2 - lxml==5.3.1 - markdown-it-py==3.0.0 - mdurl==0.1.2 - mistune==3.0.2 - mock==5.2.0 - msgpack==1.1.0 - mypy-extensions==1.0.0 - netaddr==1.3.0 - netifaces==0.11.0 - networkx==3.2.1 - nose==1.3.7 - oslo-i18n==6.5.1 - oslo-serialization==5.7.0 - oslo-utils==6.2.1 - pbr==6.1.1 - pika==1.1.0 - positional==1.2.1 - prettytable==0.7.2 - prov==1.5.1 - psutil==7.0.0 - pydot==2.0.0 - pygments==2.19.1 - pyparsing==3.2.3 - python-dateutil==2.9.0.post0 - python-novaclient==9.0.1 - pytz==2025.2 - pyyaml==3.11 - rdflib==7.1.4 - requests==2.10.0 - rich==14.0.0 - rich-argparse==1.7.0 - ruamel-yaml==0.18.10 - ruamel-yaml-clib==0.2.12 - schema-salad==8.7.20240718183047 - simplejson==3.20.1 - six==1.17.0 - spython==0.3.14 - stevedore==5.4.1 - typing-extensions==4.13.0 - tzdata==2025.2 - wrapt==1.17.2 prefix: /opt/conda/envs/lando
[ "lando/server/tests/test_cloudservice.py::TestCwlWorkflow::test_launch_instance_no_floating_ip", "lando/server/tests/test_cloudservice.py::TestCwlWorkflow::test_terminate_instance_with_floating_ip", "lando/server/tests/test_cloudservice.py::TestCwlWorkflow::test_terminate_instance_with_missing_floating_ip" ]
[ "lando/server/tests/test_config.py::TestServerConfig::test_allocate_floating_ip_false", "lando/server/tests/test_config.py::TestServerConfig::test_allocate_floating_ip_true", "lando/server/tests/test_config.py::TestServerConfig::test_bogus_config_file", "lando/server/tests/test_config.py::TestServerConfig::test_empty_config_file", "lando/server/tests/test_config.py::TestServerConfig::test_good_config", "lando/server/tests/test_config.py::TestServerConfig::test_good_config_with_fake_cloud_service", "lando/server/tests/test_config.py::TestServerConfig::test_make_worker_config_yml" ]
[ "lando/server/tests/test_cloudservice.py::TestCwlWorkflow::test_launch_instance_with_floating_ip", "lando/server/tests/test_cloudservice.py::TestCwlWorkflow::test_terminate_instance_no_floating_ip", "lando/server/tests/test_cloudservice.py::TestCwlWorkflow::test_that_flavor_overrides_default", "lando/server/tests/test_cloudservice.py::TestCwlWorkflow::test_that_no_flavor_chooses_default" ]
[]
MIT License
1,046
[ "lando/server/config.py", "README.md", "lando/server/cloudservice.py" ]
[ "lando/server/config.py", "README.md", "lando/server/cloudservice.py" ]
tox-dev__tox-travis-59
bc25fa2d2fc8e98a051a57160dfc43c8f35da2ee
2017-03-01 06:44:33
ffe844135832585a8bad0b5bd56edecbb47ba654
codecov-io: # [Codecov](https://codecov.io/gh/tox-dev/tox-travis/pull/59?src=pr&el=h1) Report > Merging [#59](https://codecov.io/gh/tox-dev/tox-travis/pull/59?src=pr&el=desc) into [master](https://codecov.io/gh/tox-dev/tox-travis/commit/e83cadff47ca060bb437a4a12311a9a6b407ebcb?src=pr&el=desc) will **decrease** coverage by `1.96%`. > The diff coverage is `65.85%`. [![Impacted file tree graph](https://codecov.io/gh/tox-dev/tox-travis/pull/59/graphs/tree.svg?width=650&height=150&src=pr&token=CBMEkiKkWy)](https://codecov.io/gh/tox-dev/tox-travis/pull/59?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #59 +/- ## ========================================= - Coverage 75.26% 73.3% -1.97% ========================================= Files 5 4 -1 Lines 186 206 +20 Branches 45 51 +6 ========================================= + Hits 140 151 +11 - Misses 39 43 +4 - Partials 7 12 +5 ``` | [Impacted Files](https://codecov.io/gh/tox-dev/tox-travis/pull/59?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [src/tox\_travis/toxenv.py](https://codecov.io/gh/tox-dev/tox-travis/pull/59?src=pr&el=tree#diff-c3JjL3RveF90cmF2aXMvdG94ZW52LnB5) | `89.87% <100%> (-4.58%)` | :arrow_down: | | [src/tox\_travis/after.py](https://codecov.io/gh/tox-dev/tox-travis/pull/59?src=pr&el=tree#diff-c3JjL3RveF90cmF2aXMvYWZ0ZXIucHk=) | `59.77% <50%> (+2.12%)` | :arrow_up: | | [src/tox\_travis/utils.py](https://codecov.io/gh/tox-dev/tox-travis/pull/59?src=pr&el=tree#diff-c3JjL3RveF90cmF2aXMvdXRpbHMucHk=) | `65.38% <57.14%> (-34.62%)` | :arrow_down: | | [src/tox\_travis/hooks.py](https://codecov.io/gh/tox-dev/tox-travis/pull/59?src=pr&el=tree#diff-c3JjL3RveF90cmF2aXMvaG9va3MucHk=) | `78.57% <75%> (-8.1%)` | :arrow_down: | | [src/tox\_travis/hacks.py](https://codecov.io/gh/tox-dev/tox-travis/pull/59?src=pr&el=tree#diff-c3JjL3RveF90cmF2aXMvaGFja3MucHk=) | | | ------ [Continue to review full report at Codecov](https://codecov.io/gh/tox-dev/tox-travis/pull/59?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/tox-dev/tox-travis/pull/59?src=pr&el=footer). Last update [e83cadf...df2fed4](https://codecov.io/gh/tox-dev/tox-travis/pull/59?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). ryanhiebert: This is ready for review. I've added a test, and rebased it to be based on us now using the tox_configure hook. So it's just using the config that Tox loaded, instead of loading our own. ryanhiebert: >>> I'm going to clean this up and merge it. >> >> Tests? > > Yes, those too. I spoke like I wasn't going to, but I definitely do, and hopefully a green review too ;-) Confession: I totally wanted to skip writing tests. My excuse was that it was a bug fix and I wanted to get it fixed quickly. In hindsight the original pull request was certainly too big to skip tests, and I'm really thankful to @rpkilby for calling me out on it with a single word. I apologize for obfuscating my true intentions at the time. At this point the patch is much smaller, and has added a regression test. In an effort to maintain my own momentum, I may merge some PRs that I perceive to be less challenging, like this one now is, though I intend to give @rpkilby a couple days before I do that with this particular pull request. Or anyone else that's willing. I sometimes take @rpkilby for granted because of how absolutely awesome he's been as a maintainer.
diff --git a/src/tox_travis/after.py b/src/tox_travis/after.py index 9f25f20..caf3750 100644 --- a/src/tox_travis/after.py +++ b/src/tox_travis/after.py @@ -4,7 +4,6 @@ import os import sys import json import time -import py from tox.config import _split_env as split_env try: @@ -32,18 +31,18 @@ def travis_after_monkeypatch(): retcode = real_subcommand_test(self) if retcode == 0 and self.config.option.travis_after: # No need to run if the tests failed anyway - travis_after(self.config.envlist) + travis_after(self.config.envlist, self.config._cfg) return retcode tox.session.Session.subcommand_test = subcommand_test -def travis_after(envlist): +def travis_after(envlist, ini): """Wait for all jobs to finish, then exit successfully.""" # after-all disabled for pull requests if os.environ.get('TRAVIS_PULL_REQUEST', 'false') != 'false': return - if not after_config_matches(envlist): + if not after_config_matches(envlist, ini): return # This is not the one that needs to wait github_token = os.environ.get('GITHUB_TOKEN') @@ -77,10 +76,9 @@ def travis_after(envlist): print('All required jobs were successful.') -def after_config_matches(envlist): +def after_config_matches(envlist, ini): """Determine if this job should wait for the others.""" - config = py.iniconfig.IniConfig('tox.ini') - section = config.sections.get('travis:after', {}) + section = ini.sections.get('travis:after', {}) if not section: return False # Never wait if it's not configured diff --git a/src/tox_travis/toxenv.py b/src/tox_travis/toxenv.py index 631f45b..8bed3c7 100644 --- a/src/tox_travis/toxenv.py +++ b/src/tox_travis/toxenv.py @@ -4,7 +4,6 @@ from itertools import product import os import sys import re -import py import tox.config from tox.config import _split_env as split_env from .utils import TRAVIS_FACTORS, parse_dict @@ -15,7 +14,7 @@ def default_toxenv(config): if 'TOXENV' in os.environ or config.option.env: return # Skip any processing if already set - ini = py.iniconfig.IniConfig('tox.ini') + ini = config._cfg # Find the envs that tox knows about declared_envs = get_declared_envs(ini) @@ -235,8 +234,7 @@ def env_matches(declared, desired): def override_ignore_outcome(config): """Override ignore_outcome if unignore_outcomes is set to True.""" - tox_config = py.iniconfig.IniConfig('tox.ini') - travis_reader = tox.config.SectionReader("travis", tox_config) + travis_reader = tox.config.SectionReader("travis", config._cfg) if travis_reader.getbool('unignore_outcomes', False): for envconfig in config.envconfigs.values(): envconfig.ignore_outcome = False
Respect specified tox configuration file `tox -c CONFIGFILE` tells tox exactly where to find the Tox configuration file. This defaults to `tox.ini`. If this option is given, Tox-Travis should look for its configuration in that file as well. References #56.
tox-dev/tox-travis
diff --git a/tests/test_after.py b/tests/test_after.py index da63063..06fb01c 100644 --- a/tests/test_after.py +++ b/tests/test_after.py @@ -13,7 +13,7 @@ class TestAfter: monkeypatch.setenv('TRAVIS', 'true') monkeypatch.setenv('TRAVIS_PULL_REQUEST', '1') - travis_after(mocker.Mock()) + travis_after(mocker.Mock(), mocker.Mock()) out, err = capsys.readouterr() assert out == '' @@ -25,7 +25,7 @@ class TestAfter: return_value=True) monkeypatch.setenv('TRAVIS', 'true') with pytest.raises(SystemExit) as excinfo: - travis_after(mocker.Mock()) + travis_after(mocker.Mock(), mocker.Mock()) assert excinfo.value.code == 32 out, err = capsys.readouterr() @@ -38,7 +38,7 @@ class TestAfter: monkeypatch.setenv('TRAVIS', 'true') monkeypatch.setenv('GITHUB_TOKEN', 'spamandeggs') with pytest.raises(SystemExit) as excinfo: - travis_after(mocker.Mock()) + travis_after(mocker.Mock(), mocker.Mock()) assert excinfo.value.code == 34 out, err = capsys.readouterr() @@ -52,7 +52,7 @@ class TestAfter: monkeypatch.setenv('GITHUB_TOKEN', 'spamandeggs') monkeypatch.setenv('TRAVIS_BUILD_ID', '1234') with pytest.raises(SystemExit) as excinfo: - travis_after(mocker.Mock()) + travis_after(mocker.Mock(), mocker.Mock()) assert excinfo.value.code == 34 out, err = capsys.readouterr() @@ -69,7 +69,7 @@ class TestAfter: # TRAVIS_API_URL is set to a reasonable default monkeypatch.setenv('TRAVIS_API_URL', '') with pytest.raises(SystemExit) as excinfo: - travis_after(mocker.Mock()) + travis_after(mocker.Mock(), mocker.Mock()) assert excinfo.value.code == 34 out, err = capsys.readouterr() @@ -86,7 +86,7 @@ class TestAfter: # TRAVIS_POLLING_INTERVAL is set to a reasonable default monkeypatch.setenv('TRAVIS_POLLING_INTERVAL', 'xbe') with pytest.raises(SystemExit) as excinfo: - travis_after(mocker.Mock()) + travis_after(mocker.Mock(), mocker.Mock()) assert excinfo.value.code == 33 out, err = capsys.readouterr() @@ -186,7 +186,7 @@ class TestAfter: get_json.responses = iter(responses) mocker.patch('tox_travis.after.get_json', side_effect=get_json) - travis_after(mocker.Mock()) + travis_after(mocker.Mock(), mocker.Mock()) out, err = capsys.readouterr() assert 'All required jobs were successful.' in out @@ -289,7 +289,7 @@ class TestAfter: mocker.patch('tox_travis.after.get_json', side_effect=get_json) with pytest.raises(SystemExit) as excinfo: - travis_after(mocker.Mock()) + travis_after(mocker.Mock(), mocker.Mock()) assert excinfo.value.code == 35 out, err = capsys.readouterr() diff --git a/tests/test_toxenv.py b/tests/test_toxenv.py index bd62707..91daef9 100644 --- a/tests/test_toxenv.py +++ b/tests/test_toxenv.py @@ -119,27 +119,33 @@ unignore_outcomes = False class TestToxEnv: """Test the logic to automatically configure TOXENV with Travis.""" - def tox_envs(self): + def tox_envs(self, **kwargs): """Find the envs that tox sees.""" - returncode, stdout, stderr = self.tox_envs_raw() + returncode, stdout, stderr = self.tox_envs_raw(**kwargs) assert returncode == 0, stderr return [env for env in stdout.strip().split('\n')] - def tox_envs_raw(self): + def tox_envs_raw(self, ini_filename=None): """Return the raw output of finding what tox sees.""" - return self.call_raw(['tox', '-l']) + command = ['tox', '-l'] + if ini_filename is not None: + command += ['-c', ini_filename] + return self.call_raw(command) - def tox_config(self): + def tox_config(self, **kwargs): """Returns the configuration per configuration as computed by tox.""" - returncode, stdout, stderr = self.tox_config_raw() + returncode, stdout, stderr = self.tox_config_raw(**kwargs) assert returncode == 0, stderr ini = "[global]\n" + re.sub( re.compile(r'^\s+', re.MULTILINE), '', stdout) return py.iniconfig.IniConfig('', data=ini) - def tox_config_raw(self): + def tox_config_raw(self, ini_filename=None): """Return the raw output of finding the complex tox env config.""" - return self.call_raw(['tox', '--showconfig']) + command = ['tox', '--showconfig'] + if ini_filename is not None: + command += ['-c', ini_filename] + return self.call_raw(command) def call_raw(self, command): """Return the raw output of the given command.""" @@ -152,10 +158,11 @@ class TestToxEnv: def configure(self, tmpdir, monkeypatch, tox_ini, version=None, major=None, minor=None, travis_version=None, travis_os=None, - travis_language=None, env=None): + travis_language=None, env=None, + ini_filename='tox.ini'): """Configure the environment for running a test.""" origdir = tmpdir.chdir() - tmpdir.join('tox.ini').write(tox_ini) + tmpdir.join(ini_filename).write(tox_ini) tmpdir.join('.coveragerc').write(coverage_config) if version or travis_version or travis_os or travis_language: @@ -202,6 +209,12 @@ class TestToxEnv: ] assert self.tox_envs() == expected + def test_travis_config_filename(self, tmpdir, monkeypatch): + """Give the correct env for CPython 2.7.""" + with self.configure(tmpdir, monkeypatch, tox_ini, 'CPython', 3, 6, + ini_filename='spam.ini'): + assert self.tox_envs(ini_filename='spam.ini') == ['py36'] + def test_travis_default_26(self, tmpdir, monkeypatch): """Give the correct env for CPython 2.6.""" with self.configure(tmpdir, monkeypatch, tox_ini, 'CPython', 2, 6):
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 2 }
0.8
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "pytest-mock", "mock" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work certifi==2021.5.30 distlib==0.3.9 filelock==3.4.1 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work mock==5.2.0 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work platformdirs==2.4.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 pytest-mock==3.6.1 six==1.17.0 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tox==3.28.0 -e git+https://github.com/tox-dev/tox-travis.git@bc25fa2d2fc8e98a051a57160dfc43c8f35da2ee#egg=tox_travis typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work virtualenv==20.17.1 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: tox-travis channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - distlib==0.3.9 - filelock==3.4.1 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - mock==5.2.0 - platformdirs==2.4.0 - pytest-mock==3.6.1 - six==1.17.0 - tox==3.28.0 - virtualenv==20.17.1 prefix: /opt/conda/envs/tox-travis
[ "tests/test_after.py::TestAfter::test_pull_request", "tests/test_after.py::TestAfter::test_no_github_token", "tests/test_after.py::TestAfter::test_travis_environment_build_id", "tests/test_after.py::TestAfter::test_travis_environment_job_number", "tests/test_after.py::TestAfter::test_travis_environment_api_url", "tests/test_after.py::TestAfter::test_travis_env_polling_interval", "tests/test_after.py::TestAfter::test_travis_env_passed", "tests/test_after.py::TestAfter::test_travis_env_failed" ]
[ "tests/test_toxenv.py::TestToxEnv::test_travis_config_filename", "tests/test_toxenv.py::TestToxEnv::test_travis_default_26", "tests/test_toxenv.py::TestToxEnv::test_travis_default_27", "tests/test_toxenv.py::TestToxEnv::test_travis_default_32", "tests/test_toxenv.py::TestToxEnv::test_travis_default_33", "tests/test_toxenv.py::TestToxEnv::test_travis_default_34", "tests/test_toxenv.py::TestToxEnv::test_travis_default_pypy", "tests/test_toxenv.py::TestToxEnv::test_travis_default_pypy3", "tests/test_toxenv.py::TestToxEnv::test_travis_python_version_py27", "tests/test_toxenv.py::TestToxEnv::test_travis_python_version_py35", "tests/test_toxenv.py::TestToxEnv::test_travis_python_version_pypy", "tests/test_toxenv.py::TestToxEnv::test_travis_python_version_pypy3", "tests/test_toxenv.py::TestToxEnv::test_travis_not_matching", "tests/test_toxenv.py::TestToxEnv::test_travis_nightly", "tests/test_toxenv.py::TestToxEnv::test_travis_override", "tests/test_toxenv.py::TestToxEnv::test_respect_overridden_toxenv", "tests/test_toxenv.py::TestToxEnv::test_keep_if_no_match", "tests/test_toxenv.py::TestToxEnv::test_default_tox_ini_overrides", "tests/test_toxenv.py::TestToxEnv::test_factors", "tests/test_toxenv.py::TestToxEnv::test_match_and_keep", "tests/test_toxenv.py::TestToxEnv::test_django_factors", "tests/test_toxenv.py::TestToxEnv::test_non_python_factor", "tests/test_toxenv.py::TestToxEnv::test_travis_factors_py27", "tests/test_toxenv.py::TestToxEnv::test_travis_factors_py35", "tests/test_toxenv.py::TestToxEnv::test_travis_factors_osx", "tests/test_toxenv.py::TestToxEnv::test_travis_factors_py27_osx", "tests/test_toxenv.py::TestToxEnv::test_travis_factors_language", "tests/test_toxenv.py::TestToxEnv::test_travis_env_py27", "tests/test_toxenv.py::TestToxEnv::test_travis_env_py27_dj19", "tests/test_toxenv.py::TestToxEnv::test_travis_env_py35_dj110" ]
[ "tests/test_toxenv.py::TestToxEnv::test_not_travis", "tests/test_toxenv.py::TestToxEnv::test_legacy_warning", "tests/test_toxenv.py::TestToxEnv::test_travis_ignore_outcome", "tests/test_toxenv.py::TestToxEnv::test_travis_ignore_outcome_unignore_outcomes", "tests/test_toxenv.py::TestToxEnv::test_travis_ignore_outcome_not_unignore_outcomes", "tests/test_toxenv.py::TestToxEnv::test_local_ignore_outcome_unignore_outcomes" ]
[]
MIT License
1,047
[ "src/tox_travis/after.py", "src/tox_travis/toxenv.py" ]
[ "src/tox_travis/after.py", "src/tox_travis/toxenv.py" ]
Azure__azure-cli-2345
23b3145b4623edf2648ee28a101175199d92cb1c
2017-03-01 22:32:27
eb12ac454cbe1ddb59c86cdf2045e1912660e750
codecov-io: # [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2345?src=pr&el=h1) Report > Merging [#2345](https://codecov.io/gh/Azure/azure-cli/pull/2345?src=pr&el=desc) into [master](https://codecov.io/gh/Azure/azure-cli/commit/23b3145b4623edf2648ee28a101175199d92cb1c?src=pr&el=desc) will **increase** coverage by `0.07%`. > The diff coverage is `68.29%`. ```diff @@ Coverage Diff @@ ## master #2345 +/- ## ========================================== + Coverage 72.86% 72.94% +0.07% ========================================== Files 425 425 Lines 19306 19307 +1 Branches 2742 2740 -2 ========================================== + Hits 14067 14083 +16 - Misses 4330 4352 +22 + Partials 909 872 -37 ``` | [Impacted Files](https://codecov.io/gh/Azure/azure-cli/pull/2345?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [...etwork/azure/cli/command_modules/network/custom.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...d64796ad3f5fb27e722199d0d7a74ef18c0da398?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktbmV0d29yay9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL25ldHdvcmsvY3VzdG9tLnB5) | `60.72% <68.29%> (+1.42%)` | :white_check_mark: | | [...e-cli-acs/azure/cli/command_modules/acs/_params.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...d64796ad3f5fb27e722199d0d7a74ef18c0da398?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktYWNzL2F6dXJlL2NsaS9jb21tYW5kX21vZHVsZXMvYWNzL19wYXJhbXMucHk=) | `68.51% <0%> (ø)` | :white_check_mark: | | [src/azure-cli-core/azure/cli/core/telemetry.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...d64796ad3f5fb27e722199d0d7a74ef18c0da398?src=pr&el=tree#diff-c3JjL2F6dXJlLWNsaS1jb3JlL2F6dXJlL2NsaS9jb3JlL3RlbGVtZXRyeS5weQ==) | `54.1% <0%> (ø)` | :white_check_mark: | | [...i-cloud/azure/cli/command_modules/cloud/_params.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...d64796ad3f5fb27e722199d0d7a74ef18c0da398?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktY2xvdWQvYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy9jbG91ZC9fcGFyYW1zLnB5) | `92.3% <0%> (ø)` | :white_check_mark: | | [...cli-vm/azure/cli/command_modules/vm/_validators.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...d64796ad3f5fb27e722199d0d7a74ef18c0da398?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktdm0vYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy92bS9fdmFsaWRhdG9ycy5weQ==) | `73.69% <0%> (ø)` | :white_check_mark: | | [src/azure-cli-core/azure/cli/core/_util.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...d64796ad3f5fb27e722199d0d7a74ef18c0da398?src=pr&el=tree#diff-c3JjL2F6dXJlLWNsaS1jb3JlL2F6dXJlL2NsaS9jb3JlL191dGlsLnB5) | `65.51% <0%> (ø)` | :white_check_mark: | | [...-cli-role/azure/cli/command_modules/role/custom.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...d64796ad3f5fb27e722199d0d7a74ef18c0da398?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcm9sZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3JvbGUvY3VzdG9tLnB5) | `20.44% <0%> (ø)` | :white_check_mark: | | [...twork/azure/cli/command_modules/network/_params.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...d64796ad3f5fb27e722199d0d7a74ef18c0da398?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktbmV0d29yay9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL25ldHdvcmsvX3BhcmFtcy5weQ==) | `92.51% <0%> (ø)` | :white_check_mark: | | [...ure-cli-core/azure/cli/core/commands/parameters.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...d64796ad3f5fb27e722199d0d7a74ef18c0da398?src=pr&el=tree#diff-c3JjL2F6dXJlLWNsaS1jb3JlL2F6dXJlL2NsaS9jb3JlL2NvbW1hbmRzL3BhcmFtZXRlcnMucHk=) | `70.58% <0%> (ø)` | :white_check_mark: | | [...gure/azure/cli/command_modules/configure/custom.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...d64796ad3f5fb27e722199d0d7a74ef18c0da398?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktY29uZmlndXJlL2F6dXJlL2NsaS9jb21tYW5kX21vZHVsZXMvY29uZmlndXJlL2N1c3RvbS5weQ==) | `17% <0%> (ø)` | :white_check_mark: | | ... and [13 more](https://codecov.io/gh/Azure/azure-cli/pull/2345?src=pr&el=tree-more) | | ------ [Continue to review full report at Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2345?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2345?src=pr&el=footer). Last update [23b3145...e9f58cf](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...e9f58cfbd3b30a553ebe629915fa7e6abe74c5c1?el=footer&src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/azure-cli.pyproj b/azure-cli.pyproj index 6a88538e3..c714d3247 100644 --- a/azure-cli.pyproj +++ b/azure-cli.pyproj @@ -333,6 +333,9 @@ <Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_vnet_gateway\lib\version.py" /> <Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_vnet_gateway\lib\vnet_gateway_creation_client.py" /> <Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_vnet_gateway\lib\__init__.py" /> + <Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\tests\test_network_unit_tests.py"> + <SubType>Code</SubType> + </Compile> <Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\tests\test_dns_zone_import.py"> <SubType>Code</SubType> </Compile> diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py index afe5d3ffd..3a7bd967c 100644 --- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py @@ -39,12 +39,19 @@ from azure.cli.command_modules.network.zone_file.make_zone_file import make_zone logger = azlogging.get_az_logger(__name__) -def _upsert(collection, obj, key_name, key_value): - match = next((x for x in collection if getattr(x, key_name, None) == key_value), None) +def _upsert(parent, collection_name, obj_to_add, key_name): + + if not getattr(parent, collection_name, None): + setattr(parent, collection_name, []) + collection = getattr(parent, collection_name, None) + + value = getattr(obj_to_add, key_name) + match = next((x for x in collection if getattr(x, key_name, None) == value), None) if match: - logger.warning("Item '%s' already exists. Replacing with new values.", key_value) + logger.warning("Item '%s' already exists. Replacing with new values.", value) collection.remove(match) - collection.append(obj) + + collection.append(obj_to_add) #region Generic list commands def _generic_list(operation_name, resource_group_name): @@ -101,7 +108,7 @@ def create_ag_authentication_certificate(resource_group_name, application_gatewa ncf = _network_client_factory().application_gateways ag = ncf.get(resource_group_name, application_gateway_name) new_cert = AuthCert(data=cert_data, name=item_name) - _upsert(ag.authentication_certificates, new_cert, 'name', item_name) + _upsert(ag, 'authentication_certificates', new_cert, 'name') return ncf.create_or_update(resource_group_name, application_gateway_name, ag, raw=no_wait) def update_ag_authentication_certificate(instance, parent, item_name, cert_data): # pylint: disable=unused-argument @@ -114,7 +121,7 @@ def create_ag_backend_address_pool(resource_group_name, application_gateway_name ncf = _network_client_factory() ag = ncf.application_gateways.get(resource_group_name, application_gateway_name) new_pool = ApplicationGatewayBackendAddressPool(name=item_name, backend_addresses=servers) - _upsert(ag.backend_address_pools, new_pool, 'name', item_name) + _upsert(ag, 'backend_address_pools', new_pool, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) create_ag_backend_address_pool.__doc__ = AppGatewayOperations.create_or_update.__doc__ @@ -141,7 +148,7 @@ def create_ag_frontend_ip_configuration(resource_group_name, application_gateway private_ip_address=private_ip_address if private_ip_address else None, private_ip_allocation_method='Static' if private_ip_address else 'Dynamic', subnet=SubResource(subnet)) - _upsert(ag.frontend_ip_configurations, new_config, 'name', item_name) + _upsert(ag, 'frontend_ip_configurations', new_config, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) create_ag_frontend_ip_configuration.__doc__ = AppGatewayOperations.create_or_update.__doc__ @@ -165,7 +172,7 @@ def create_ag_frontend_port(resource_group_name, application_gateway_name, item_ ncf = _network_client_factory() ag = ncf.application_gateways.get(resource_group_name, application_gateway_name) new_port = ApplicationGatewayFrontendPort(name=item_name, port=port) - _upsert(ag.frontend_ports, new_port, 'name', item_name) + _upsert(ag, 'frontend_ports', new_port, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) @@ -188,7 +195,7 @@ def create_ag_http_listener(resource_group_name, application_gateway_name, item_ require_server_name_indication=True if ssl_cert and host_name else None, protocol='https' if ssl_cert else 'http', ssl_certificate=SubResource(ssl_cert) if ssl_cert else None) - _upsert(ag.http_listeners, new_listener, 'name', item_name) + _upsert(ag, 'http_listeners', new_listener, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) @@ -225,7 +232,7 @@ def create_ag_backend_http_settings_collection(resource_group_name, application_ request_timeout=timeout, probe=SubResource(probe) if probe else None, name=item_name) - _upsert(ag.backend_http_settings_collection, new_settings, 'name', item_name) + _upsert(ag, 'backend_http_settings_collection', new_settings, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) @@ -257,7 +264,7 @@ def create_ag_probe(resource_group_name, application_gateway_name, item_name, pr interval=interval, timeout=timeout, unhealthy_threshold=threshold) - _upsert(ag.probes, new_probe, 'name', item_name) + _upsert(ag, 'probes', new_probe, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) @@ -290,7 +297,7 @@ def create_ag_request_routing_rule(resource_group_name, application_gateway_name backend_http_settings=SubResource(http_settings), http_listener=SubResource(http_listener), url_path_map=SubResource(url_path_map) if url_path_map else None) - _upsert(ag.request_routing_rules, new_rule, 'name', item_name) + _upsert(ag, 'request_routing_rules', new_rule, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) @@ -316,7 +323,7 @@ def create_ag_ssl_certificate(resource_group_name, application_gateway_name, ite ag = ncf.application_gateways.get(resource_group_name, application_gateway_name) new_cert = ApplicationGatewaySslCertificate( name=item_name, data=cert_data, password=cert_password) - _upsert(ag.ssl_certificates, new_cert, 'name', item_name) + _upsert(ag, 'ssl_certificates', new_cert, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) create_ag_ssl_certificate.__doc__ = AppGatewayOperations.create_or_update.__doc__ @@ -359,7 +366,7 @@ def create_ag_url_path_map(resource_group_name, application_gateway_name, item_n backend_http_settings=SubResource(http_settings), paths=paths )]) - _upsert(ag.url_path_maps, new_map, 'name', item_name) + _upsert(ag, 'url_path_maps', new_map, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) @@ -387,7 +394,7 @@ def create_ag_url_path_map_rule(resource_group_name, application_gateway_name, u if address_pool else SubResource(url_map.default_backend_address_pool.id), backend_http_settings=SubResource(http_settings) \ if http_settings else SubResource(url_map.default_backend_http_settings.id)) - _upsert(url_map.path_rules, new_rule, 'name', item_name) + _upsert(url_map, 'path_rules', new_rule, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) @@ -432,7 +439,7 @@ def create_lb_inbound_nat_rule( frontend_ip_configuration=frontend_ip, enable_floating_ip=floating_ip == 'true', idle_timeout_in_minutes=idle_timeout) - _upsert(lb.inbound_nat_rules, new_rule, 'name', item_name) + _upsert(lb, 'inbound_nat_rules', new_rule, 'name') poller = ncf.load_balancers.create_or_update(resource_group_name, load_balancer_name, lb) return _get_property(poller.result().inbound_nat_rules, item_name) @@ -467,7 +474,7 @@ def create_lb_inbound_nat_pool( frontend_port_range_start=frontend_port_range_start, frontend_port_range_end=frontend_port_range_end, backend_port=backend_port) - _upsert(lb.inbound_nat_pools, new_pool, 'name', item_name) + _upsert(lb, 'inbound_nat_pools', new_pool, 'name') poller = ncf.load_balancers.create_or_update(resource_group_name, load_balancer_name, lb) return _get_property(poller.result().inbound_nat_pools, item_name) @@ -500,7 +507,7 @@ def create_lb_frontend_ip_configuration( private_ip_allocation_method=private_ip_address_allocation, public_ip_address=PublicIPAddress(public_ip_address) if public_ip_address else None, subnet=Subnet(subnet) if subnet else None) - _upsert(lb.frontend_ip_configurations, new_config, 'name', item_name) + _upsert(lb, 'frontend_ip_configurations', new_config, 'name') poller = ncf.load_balancers.create_or_update(resource_group_name, load_balancer_name, lb) return _get_property(poller.result().frontend_ip_configurations, item_name) @@ -532,7 +539,7 @@ def create_lb_backend_address_pool(resource_group_name, load_balancer_name, item ncf = _network_client_factory() lb = ncf.load_balancers.get(resource_group_name, load_balancer_name) new_pool = BackendAddressPool(name=item_name) - _upsert(lb.backend_address_pools, new_pool, 'name', item_name) + _upsert(lb, 'backend_address_pools', new_pool, 'name') poller = ncf.load_balancers.create_or_update(resource_group_name, load_balancer_name, lb) return _get_property(poller.result().backend_address_pools, item_name) @@ -543,7 +550,7 @@ def create_lb_probe(resource_group_name, load_balancer_name, item_name, protocol new_probe = Probe( protocol, port, interval_in_seconds=interval, number_of_probes=threshold, request_path=path, name=item_name) - _upsert(lb.probes, new_probe, 'name', item_name) + _upsert(lb, 'probes', new_probe, 'name') poller = ncf.load_balancers.create_or_update(resource_group_name, load_balancer_name, lb) return _get_property(poller.result().probes, item_name) @@ -577,7 +584,7 @@ def create_lb_rule( load_distribution=load_distribution, enable_floating_ip=floating_ip == 'true', idle_timeout_in_minutes=idle_timeout) - _upsert(lb.load_balancing_rules, new_rule, 'name', item_name) + _upsert(lb, 'load_balancing_rules', new_rule, 'name') poller = ncf.load_balancers.create_or_update(resource_group_name, load_balancer_name, lb) return _get_property(poller.result().load_balancing_rules, item_name) @@ -658,7 +665,7 @@ def create_nic_ip_config(resource_group_name, network_interface_name, ip_config_ private_ip_allocation_method=private_ip_address_allocation, private_ip_address_version=private_ip_address_version, primary=make_primary) - _upsert(nic.ip_configurations, new_config, 'name', ip_config_name) + _upsert(nic, 'ip_configurations', new_config, 'name') poller = ncf.network_interfaces.create_or_update( resource_group_name, network_interface_name, nic) return _get_property(poller.result().ip_configurations, ip_config_name) @@ -708,19 +715,25 @@ def set_nic_ip_config(instance, parent, ip_config_name, subnet=None, # pylint: d return parent set_nic_ip_config.__doc__ = NicOperations.create_or_update.__doc__ +def _get_nic_ip_config(nic, name): + if nic.ip_configurations: + ip_config = next( + (x for x in nic.ip_configurations if x.name.lower() == name.lower()), None) + else: + ip_config = None + if not ip_config: + raise CLIError('IP configuration {} not found.'.format(name)) + return ip_config + def add_nic_ip_config_address_pool( resource_group_name, network_interface_name, ip_config_name, backend_address_pool, load_balancer_name=None): # pylint: disable=unused-argument client = _network_client_factory().network_interfaces nic = client.get(resource_group_name, network_interface_name) - ip_config = next( - (x for x in nic.ip_configurations if x.name.lower() == ip_config_name.lower()), None) - try: - _upsert(ip_config.load_balancer_backend_address_pools, - BackendAddressPool(backend_address_pool), - 'name', backend_address_pool) - except AttributeError: - ip_config.load_balancer_backend_address_pools = [BackendAddressPool(backend_address_pool)] + ip_config = _get_nic_ip_config(nic, ip_config_name) + _upsert(ip_config, 'load_balancer_backend_address_pools', + BackendAddressPool(backend_address_pool), + 'name') poller = client.create_or_update(resource_group_name, network_interface_name, nic) return _get_property(poller.result().ip_configurations, ip_config_name) @@ -729,10 +742,7 @@ def remove_nic_ip_config_address_pool( load_balancer_name=None): # pylint: disable=unused-argument client = _network_client_factory().network_interfaces nic = client.get(resource_group_name, network_interface_name) - ip_config = next( - (x for x in nic.ip_configurations if x.name.lower() == ip_config_name.lower()), None) - if not ip_config: - raise CLIError('IP configuration {} not found.'.format(ip_config_name)) + ip_config = _get_nic_ip_config(nic, ip_config_name) keep_items = \ [x for x in ip_config.load_balancer_backend_address_pools or [] \ if x.id != backend_address_pool] @@ -745,14 +755,10 @@ def add_nic_ip_config_inbound_nat_rule( load_balancer_name=None): # pylint: disable=unused-argument client = _network_client_factory().network_interfaces nic = client.get(resource_group_name, network_interface_name) - ip_config = next( - (x for x in nic.ip_configurations if x.name.lower() == ip_config_name.lower()), None) - try: - _upsert(ip_config.load_balancer_inbound_nat_rules, - InboundNatRule(inbound_nat_rule), - 'name', inbound_nat_rule) - except AttributeError: - ip_config.load_balancer_inbound_nat_rules = [InboundNatRule(inbound_nat_rule)] + ip_config = _get_nic_ip_config(nic, ip_config_name) + _upsert(ip_config, 'load_balancer_inbound_nat_rules', + InboundNatRule(inbound_nat_rule), + 'name') poller = client.create_or_update(resource_group_name, network_interface_name, nic) return _get_property(poller.result().ip_configurations, ip_config_name) @@ -761,10 +767,7 @@ def remove_nic_ip_config_inbound_nat_rule( load_balancer_name=None): # pylint: disable=unused-argument client = _network_client_factory().network_interfaces nic = client.get(resource_group_name, network_interface_name) - ip_config = next( - (x for x in nic.ip_configurations or [] if x.name.lower() == ip_config_name.lower()), None) - if not ip_config: - raise CLIError('IP configuration {} not found.'.format(ip_config_name)) + ip_config = _get_nic_ip_config(nic, ip_config_name) keep_items = \ [x for x in ip_config.load_balancer_inbound_nat_rules if x.id != inbound_nat_rule] ip_config.load_balancer_inbound_nat_rules = keep_items @@ -1074,7 +1077,7 @@ def create_vnet_gateway_root_cert(resource_group_name, gateway_name, public_cert config.vpn_client_root_certificates = [] cert = VpnClientRootCertificate(name=cert_name, public_cert_data=public_cert_data) - _upsert(config.vpn_client_root_certificates, cert, 'name', cert_name) + _upsert(config, 'vpn_client_root_certificates', cert, 'name') return ncf.create_or_update(resource_group_name, gateway_name, gateway) def delete_vnet_gateway_root_cert(resource_group_name, gateway_name, cert_name): @@ -1094,7 +1097,7 @@ def create_vnet_gateway_revoked_cert(resource_group_name, gateway_name, thumbpri config, gateway, ncf = _prep_cert_create(gateway_name, resource_group_name) cert = VpnClientRevokedCertificate(name=cert_name, thumbprint=thumbprint) - _upsert(config.vpn_client_revoked_certificates, cert, 'name', cert_name) + _upsert(config, 'vpn_client_revoked_certificates', cert, 'name') return ncf.create_or_update(resource_group_name, gateway_name, gateway) def delete_vnet_gateway_revoked_cert(resource_group_name, gateway_name, cert_name):
az network nic ip-config address-pool add command fails Using the cli 2.0 to bind a nic to an address pool with the following command produces this error: command: az network nic ip-config address-pool add \ --resource-group ${resource_group} \ --nic-name ${nic_name} \ --lb-name ${lb_name} \ --address-pool ${lb_address_pool_name} \ --ip-config-name ${lb_name}-binding produces the following: 'NoneType' object has no attribute 'load_balancer_backend_address_pools' Traceback (most recent call last): File "/Users/marty.bell/lib/azure-cli/lib/python2.7/site-packages/azure/cli/main.py", line 37, in main cmd_result = APPLICATION.execute(args) File "/Users/marty.bell/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/application.py", line 157, in execute result = expanded_arg.func(params) File "/Users/marty.bell/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 343, in _execute_command raise ex AttributeError: 'NoneType' object has no attribute 'load_balancer_backend_address_pools' Below is the azure client version: az --version azure-cli (2.0.0) acs (2.0.0) appservice (0.1.1b5) batch (0.1.1b4) cloud (2.0.0) component (2.0.0) configure (2.0.0) container (0.1.1b4) core (2.0.0) documentdb (0.1.1b2) feedback (2.0.0) iot (0.1.1b3) keyvault (0.1.1b5) network (2.0.0) nspkg (2.0.0) profile (2.0.0) redis (0.1.1b3) resource (2.0.0) role (2.0.0) sql (0.1.1b5) storage (2.0.0) vm (2.0.0) Python (Darwin) 2.7.10 (default, Oct 23 2015, 19:19:21) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] There do seem to be a number of similar issues with other use cases with the cli, but the remediation wasn't clear..... Marty
Azure/azure-cli
diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_unit_tests.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_unit_tests.py new file mode 100644 index 000000000..66ab9a44d --- /dev/null +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_unit_tests.py @@ -0,0 +1,84 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import unittest + +import mock + +from azure.cli.core._util import CLIError + +class Test_Network_Unit_Tests(unittest.TestCase): + + def test_network_get_nic_ip_config(self): + from azure.cli.command_modules.network.custom import _get_nic_ip_config + + # 1 - Test that if ip_configurations property is null, error is thrown + nic = mock.MagicMock() + nic.ip_configurations = None + with self.assertRaises(CLIError): + _get_nic_ip_config(nic, 'test') + + def mock_ip_config(name, value): + fake = mock.MagicMock() + fake.name = name + fake.value = value + return fake + + nic = mock.MagicMock() + nic.ip_configurations = [ + mock_ip_config('test1', '1'), + mock_ip_config('test2', '2'), + mock_ip_config('test3', '3'), + ] + # 2 - Test that if ip_configurations is not null but no match, error is thrown + with self.assertRaises(CLIError): + _get_nic_ip_config(nic, 'test4') + + # 3 - Test that match is returned + self.assertEqual(_get_nic_ip_config(nic, 'test2').value, '2') + + def test_network_upsert(self): + from azure.cli.command_modules.network.custom import _upsert + + obj1 = mock.MagicMock() + obj1.key = 'object1' + obj1.value = 'cat' + + obj2 = mock.MagicMock() + obj2.key = 'object2' + obj2.value = 'dog' + + # 1 - verify upsert to a null collection + parent_with_null_collection = mock.MagicMock() + parent_with_null_collection.collection = None + _upsert(parent_with_null_collection, 'collection', obj1, 'key') + result = parent_with_null_collection.collection + self.assertEqual(len(result), 1) + self.assertEqual(result[0].value, 'cat') + + # 2 - verify upsert to an empty collection + parent_with_empty_collection = mock.MagicMock() + parent_with_empty_collection.collection = [] + _upsert(parent_with_empty_collection, 'collection', obj1, 'key') + result = parent_with_empty_collection.collection + self.assertEqual(len(result), 1) + self.assertEqual(result[0].value, 'cat') + + # 3 - verify can add more than one + _upsert(parent_with_empty_collection, 'collection', obj2, 'key') + result = parent_with_empty_collection.collection + self.assertEqual(len(result), 2) + self.assertEqual(result[1].value, 'dog') + + # 4 - verify update to existing collection + obj2.value = 'noodle' + _upsert(parent_with_empty_collection, 'collection', obj2, 'key') + result = parent_with_empty_collection.collection + self.assertEqual(len(result), 2) + self.assertEqual(result[1].value, 'noodle') + + +if __name__ == '__main__': + unittest.main()
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 2 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==0.4.3 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==1.4.9 attrs==22.2.0 autopep8==1.2.4 azure-batch==1.1.0 -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_documentdb&subdirectory=src/command_modules/azure-cli-documentdb -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.4 azure-core==1.24.2 azure-graphrbac==0.30.0rc6 azure-keyvault==0.1.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==2.0.0 azure-mgmt-compute==0.33.1rc1 azure-mgmt-containerregistry==0.1.1 azure-mgmt-dns==1.0.0 azure-mgmt-documentdb==0.1.0 azure-mgmt-iothub==0.2.1 azure-mgmt-keyvault==0.30.0 azure-mgmt-network==0.30.0 azure-mgmt-nspkg==3.0.2 azure-mgmt-redis==1.0.0 azure-mgmt-resource==0.30.2 azure-mgmt-sql==0.3.0 azure-mgmt-storage==0.31.0 azure-mgmt-trafficmanager==0.30.0rc6 azure-mgmt-web==0.31.0 azure-nspkg==3.0.2 azure-storage==0.33.0 certifi==2021.5.30 cffi==1.15.1 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.7.1 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.5.4 pyOpenSSL==16.1.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 PyYAML==3.11 requests==2.9.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.5 tomli==1.2.3 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 wrapt==1.16.0 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==0.4.3 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==1.4.9 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==1.1.0 - azure-common==1.1.4 - azure-core==1.24.2 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.1.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==2.0.0 - azure-mgmt-compute==0.33.1rc1 - azure-mgmt-containerregistry==0.1.1 - azure-mgmt-dns==1.0.0 - azure-mgmt-documentdb==0.1.0 - azure-mgmt-iothub==0.2.1 - azure-mgmt-keyvault==0.30.0 - azure-mgmt-network==0.30.0 - azure-mgmt-nspkg==3.0.2 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==0.30.2 - azure-mgmt-sql==0.3.0 - azure-mgmt-storage==0.31.0 - azure-mgmt-trafficmanager==0.30.0rc6 - azure-mgmt-web==0.31.0 - azure-nspkg==3.0.2 - azure-storage==0.33.0 - cffi==1.15.1 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.7.1 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.5.4 - pyopenssl==16.1.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pyyaml==3.11 - requests==2.9.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.5 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - wrapt==1.16.0 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_unit_tests.py::Test_Network_Unit_Tests::test_network_get_nic_ip_config", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_unit_tests.py::Test_Network_Unit_Tests::test_network_upsert" ]
[]
[]
[]
MIT License
1,048
[ "azure-cli.pyproj", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py" ]
[ "azure-cli.pyproj", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py" ]
Azure__azure-cli-2346
23b3145b4623edf2648ee28a101175199d92cb1c
2017-03-01 23:41:49
eb12ac454cbe1ddb59c86cdf2045e1912660e750
codecov-io: # [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2346?src=pr&el=h1) Report > Merging [#2346](https://codecov.io/gh/Azure/azure-cli/pull/2346?src=pr&el=desc) into [master](https://codecov.io/gh/Azure/azure-cli/commit/23b3145b4623edf2648ee28a101175199d92cb1c?src=pr&el=desc) will **decrease** coverage by `-0.02%`. > The diff coverage is `40%`. ```diff @@ Coverage Diff @@ ## master #2346 +/- ## ========================================== - Coverage 72.86% 72.85% -0.02% ========================================== Files 425 425 Lines 19306 19306 Branches 2742 2743 +1 ========================================== - Hits 14067 14065 -2 - Misses 4330 4364 +34 + Partials 909 877 -32 ``` | [Impacted Files](https://codecov.io/gh/Azure/azure-cli/pull/2346?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [...rage/azure/cli/command_modules/storage/commands.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...60d0433c7c7a07f9ad38b5a2fa028ecba4fbe311?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktc3RvcmFnZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3N0b3JhZ2UvY29tbWFuZHMucHk=) | `98.75% <ø> (ø)` | :white_check_mark: | | [...e/azure/cli/command_modules/storage/_validators.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...60d0433c7c7a07f9ad38b5a2fa028ecba4fbe311?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktc3RvcmFnZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3N0b3JhZ2UvX3ZhbGlkYXRvcnMucHk=) | `53.65% <0%> (+0.03%)` | :white_check_mark: | | [...orage/azure/cli/command_modules/storage/_params.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...60d0433c7c7a07f9ad38b5a2fa028ecba4fbe311?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktc3RvcmFnZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3N0b3JhZ2UvX3BhcmFtcy5weQ==) | `86.9% <100%> (-0.04%)` | :x: | | [...torage/azure/cli/command_modules/storage/custom.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...60d0433c7c7a07f9ad38b5a2fa028ecba4fbe311?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktc3RvcmFnZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3N0b3JhZ2UvY3VzdG9tLnB5) | `86.02% <33.33%> (-1.48%)` | :x: | | [...e-cli-acs/azure/cli/command_modules/acs/_params.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...60d0433c7c7a07f9ad38b5a2fa028ecba4fbe311?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktYWNzL2F6dXJlL2NsaS9jb21tYW5kX21vZHVsZXMvYWNzL19wYXJhbXMucHk=) | `68.51% <0%> (ø)` | :white_check_mark: | | [src/azure-cli-core/azure/cli/core/telemetry.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...60d0433c7c7a07f9ad38b5a2fa028ecba4fbe311?src=pr&el=tree#diff-c3JjL2F6dXJlLWNsaS1jb3JlL2F6dXJlL2NsaS9jb3JlL3RlbGVtZXRyeS5weQ==) | `54.1% <0%> (ø)` | :white_check_mark: | | [...twork/azure/cli/command_modules/network/_params.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...60d0433c7c7a07f9ad38b5a2fa028ecba4fbe311?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktbmV0d29yay9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL25ldHdvcmsvX3BhcmFtcy5weQ==) | `92.51% <0%> (ø)` | :white_check_mark: | | [...i-cloud/azure/cli/command_modules/cloud/_params.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...60d0433c7c7a07f9ad38b5a2fa028ecba4fbe311?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktY2xvdWQvYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy9jbG91ZC9fcGFyYW1zLnB5) | `92.3% <0%> (ø)` | :white_check_mark: | | [...cli-vm/azure/cli/command_modules/vm/_validators.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...60d0433c7c7a07f9ad38b5a2fa028ecba4fbe311?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktdm0vYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy92bS9fdmFsaWRhdG9ycy5weQ==) | `73.69% <0%> (ø)` | :white_check_mark: | | [...-cli-role/azure/cli/command_modules/role/custom.py](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...60d0433c7c7a07f9ad38b5a2fa028ecba4fbe311?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcm9sZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3JvbGUvY3VzdG9tLnB5) | `20.44% <0%> (ø)` | :white_check_mark: | | ... and [14 more](https://codecov.io/gh/Azure/azure-cli/pull/2346?src=pr&el=tree-more) | | ------ [Continue to review full report at Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2346?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2346?src=pr&el=footer). Last update [23b3145...60d0433](https://codecov.io/gh/Azure/azure-cli/compare/23b3145b4623edf2648ee28a101175199d92cb1c...60d0433c7c7a07f9ad38b5a2fa028ecba4fbe311?el=footer&src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/azure-cli.pyproj b/azure-cli.pyproj index 6a88538e3..c714d3247 100644 --- a/azure-cli.pyproj +++ b/azure-cli.pyproj @@ -333,6 +333,9 @@ <Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_vnet_gateway\lib\version.py" /> <Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_vnet_gateway\lib\vnet_gateway_creation_client.py" /> <Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_vnet_gateway\lib\__init__.py" /> + <Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\tests\test_network_unit_tests.py"> + <SubType>Code</SubType> + </Compile> <Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\tests\test_dns_zone_import.py"> <SubType>Code</SubType> </Compile> diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index e5bb75d77..a4b13bf17 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -10,6 +10,7 @@ import errno import json import os.path from pprint import pformat +from copy import deepcopy from enum import Enum import adal @@ -137,7 +138,8 @@ class Profile(object): subscriptions, is_service_principal) self._set_subscriptions(consolidated) - return consolidated + # use deepcopy as we don't want to persist these changes to file. + return deepcopy(consolidated) @staticmethod def _normalize_properties(user, subscriptions, is_service_principal): @@ -224,8 +226,10 @@ class Profile(object): def load_cached_subscriptions(self, all_clouds=False): subscriptions = self._storage.get(_SUBSCRIPTIONS) or [] active_cloud = get_active_cloud() - return [sub for sub in subscriptions - if all_clouds or sub[_ENVIRONMENT_NAME] == active_cloud.name] + cached_subscriptions = [sub for sub in subscriptions + if all_clouds or sub[_ENVIRONMENT_NAME] == active_cloud.name] + # use deepcopy as we don't want to persist these changes to file. + return deepcopy(cached_subscriptions) def get_current_account_user(self): try: @@ -282,7 +286,6 @@ class Profile(object): result[_ENVIRONMENT_NAME] = CLOUD.name result['subscriptionName'] = account[_SUBSCRIPTION_NAME] else: # has logged in through cli - from copy import deepcopy result = deepcopy(account) user_type = account[_USER_ENTITY].get(_USER_TYPE) if user_type == _SERVICE_PRINCIPAL: diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py index afe5d3ffd..3a7bd967c 100644 --- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py @@ -39,12 +39,19 @@ from azure.cli.command_modules.network.zone_file.make_zone_file import make_zone logger = azlogging.get_az_logger(__name__) -def _upsert(collection, obj, key_name, key_value): - match = next((x for x in collection if getattr(x, key_name, None) == key_value), None) +def _upsert(parent, collection_name, obj_to_add, key_name): + + if not getattr(parent, collection_name, None): + setattr(parent, collection_name, []) + collection = getattr(parent, collection_name, None) + + value = getattr(obj_to_add, key_name) + match = next((x for x in collection if getattr(x, key_name, None) == value), None) if match: - logger.warning("Item '%s' already exists. Replacing with new values.", key_value) + logger.warning("Item '%s' already exists. Replacing with new values.", value) collection.remove(match) - collection.append(obj) + + collection.append(obj_to_add) #region Generic list commands def _generic_list(operation_name, resource_group_name): @@ -101,7 +108,7 @@ def create_ag_authentication_certificate(resource_group_name, application_gatewa ncf = _network_client_factory().application_gateways ag = ncf.get(resource_group_name, application_gateway_name) new_cert = AuthCert(data=cert_data, name=item_name) - _upsert(ag.authentication_certificates, new_cert, 'name', item_name) + _upsert(ag, 'authentication_certificates', new_cert, 'name') return ncf.create_or_update(resource_group_name, application_gateway_name, ag, raw=no_wait) def update_ag_authentication_certificate(instance, parent, item_name, cert_data): # pylint: disable=unused-argument @@ -114,7 +121,7 @@ def create_ag_backend_address_pool(resource_group_name, application_gateway_name ncf = _network_client_factory() ag = ncf.application_gateways.get(resource_group_name, application_gateway_name) new_pool = ApplicationGatewayBackendAddressPool(name=item_name, backend_addresses=servers) - _upsert(ag.backend_address_pools, new_pool, 'name', item_name) + _upsert(ag, 'backend_address_pools', new_pool, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) create_ag_backend_address_pool.__doc__ = AppGatewayOperations.create_or_update.__doc__ @@ -141,7 +148,7 @@ def create_ag_frontend_ip_configuration(resource_group_name, application_gateway private_ip_address=private_ip_address if private_ip_address else None, private_ip_allocation_method='Static' if private_ip_address else 'Dynamic', subnet=SubResource(subnet)) - _upsert(ag.frontend_ip_configurations, new_config, 'name', item_name) + _upsert(ag, 'frontend_ip_configurations', new_config, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) create_ag_frontend_ip_configuration.__doc__ = AppGatewayOperations.create_or_update.__doc__ @@ -165,7 +172,7 @@ def create_ag_frontend_port(resource_group_name, application_gateway_name, item_ ncf = _network_client_factory() ag = ncf.application_gateways.get(resource_group_name, application_gateway_name) new_port = ApplicationGatewayFrontendPort(name=item_name, port=port) - _upsert(ag.frontend_ports, new_port, 'name', item_name) + _upsert(ag, 'frontend_ports', new_port, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) @@ -188,7 +195,7 @@ def create_ag_http_listener(resource_group_name, application_gateway_name, item_ require_server_name_indication=True if ssl_cert and host_name else None, protocol='https' if ssl_cert else 'http', ssl_certificate=SubResource(ssl_cert) if ssl_cert else None) - _upsert(ag.http_listeners, new_listener, 'name', item_name) + _upsert(ag, 'http_listeners', new_listener, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) @@ -225,7 +232,7 @@ def create_ag_backend_http_settings_collection(resource_group_name, application_ request_timeout=timeout, probe=SubResource(probe) if probe else None, name=item_name) - _upsert(ag.backend_http_settings_collection, new_settings, 'name', item_name) + _upsert(ag, 'backend_http_settings_collection', new_settings, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) @@ -257,7 +264,7 @@ def create_ag_probe(resource_group_name, application_gateway_name, item_name, pr interval=interval, timeout=timeout, unhealthy_threshold=threshold) - _upsert(ag.probes, new_probe, 'name', item_name) + _upsert(ag, 'probes', new_probe, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) @@ -290,7 +297,7 @@ def create_ag_request_routing_rule(resource_group_name, application_gateway_name backend_http_settings=SubResource(http_settings), http_listener=SubResource(http_listener), url_path_map=SubResource(url_path_map) if url_path_map else None) - _upsert(ag.request_routing_rules, new_rule, 'name', item_name) + _upsert(ag, 'request_routing_rules', new_rule, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) @@ -316,7 +323,7 @@ def create_ag_ssl_certificate(resource_group_name, application_gateway_name, ite ag = ncf.application_gateways.get(resource_group_name, application_gateway_name) new_cert = ApplicationGatewaySslCertificate( name=item_name, data=cert_data, password=cert_password) - _upsert(ag.ssl_certificates, new_cert, 'name', item_name) + _upsert(ag, 'ssl_certificates', new_cert, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) create_ag_ssl_certificate.__doc__ = AppGatewayOperations.create_or_update.__doc__ @@ -359,7 +366,7 @@ def create_ag_url_path_map(resource_group_name, application_gateway_name, item_n backend_http_settings=SubResource(http_settings), paths=paths )]) - _upsert(ag.url_path_maps, new_map, 'name', item_name) + _upsert(ag, 'url_path_maps', new_map, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) @@ -387,7 +394,7 @@ def create_ag_url_path_map_rule(resource_group_name, application_gateway_name, u if address_pool else SubResource(url_map.default_backend_address_pool.id), backend_http_settings=SubResource(http_settings) \ if http_settings else SubResource(url_map.default_backend_http_settings.id)) - _upsert(url_map.path_rules, new_rule, 'name', item_name) + _upsert(url_map, 'path_rules', new_rule, 'name') return ncf.application_gateways.create_or_update( resource_group_name, application_gateway_name, ag, raw=no_wait) @@ -432,7 +439,7 @@ def create_lb_inbound_nat_rule( frontend_ip_configuration=frontend_ip, enable_floating_ip=floating_ip == 'true', idle_timeout_in_minutes=idle_timeout) - _upsert(lb.inbound_nat_rules, new_rule, 'name', item_name) + _upsert(lb, 'inbound_nat_rules', new_rule, 'name') poller = ncf.load_balancers.create_or_update(resource_group_name, load_balancer_name, lb) return _get_property(poller.result().inbound_nat_rules, item_name) @@ -467,7 +474,7 @@ def create_lb_inbound_nat_pool( frontend_port_range_start=frontend_port_range_start, frontend_port_range_end=frontend_port_range_end, backend_port=backend_port) - _upsert(lb.inbound_nat_pools, new_pool, 'name', item_name) + _upsert(lb, 'inbound_nat_pools', new_pool, 'name') poller = ncf.load_balancers.create_or_update(resource_group_name, load_balancer_name, lb) return _get_property(poller.result().inbound_nat_pools, item_name) @@ -500,7 +507,7 @@ def create_lb_frontend_ip_configuration( private_ip_allocation_method=private_ip_address_allocation, public_ip_address=PublicIPAddress(public_ip_address) if public_ip_address else None, subnet=Subnet(subnet) if subnet else None) - _upsert(lb.frontend_ip_configurations, new_config, 'name', item_name) + _upsert(lb, 'frontend_ip_configurations', new_config, 'name') poller = ncf.load_balancers.create_or_update(resource_group_name, load_balancer_name, lb) return _get_property(poller.result().frontend_ip_configurations, item_name) @@ -532,7 +539,7 @@ def create_lb_backend_address_pool(resource_group_name, load_balancer_name, item ncf = _network_client_factory() lb = ncf.load_balancers.get(resource_group_name, load_balancer_name) new_pool = BackendAddressPool(name=item_name) - _upsert(lb.backend_address_pools, new_pool, 'name', item_name) + _upsert(lb, 'backend_address_pools', new_pool, 'name') poller = ncf.load_balancers.create_or_update(resource_group_name, load_balancer_name, lb) return _get_property(poller.result().backend_address_pools, item_name) @@ -543,7 +550,7 @@ def create_lb_probe(resource_group_name, load_balancer_name, item_name, protocol new_probe = Probe( protocol, port, interval_in_seconds=interval, number_of_probes=threshold, request_path=path, name=item_name) - _upsert(lb.probes, new_probe, 'name', item_name) + _upsert(lb, 'probes', new_probe, 'name') poller = ncf.load_balancers.create_or_update(resource_group_name, load_balancer_name, lb) return _get_property(poller.result().probes, item_name) @@ -577,7 +584,7 @@ def create_lb_rule( load_distribution=load_distribution, enable_floating_ip=floating_ip == 'true', idle_timeout_in_minutes=idle_timeout) - _upsert(lb.load_balancing_rules, new_rule, 'name', item_name) + _upsert(lb, 'load_balancing_rules', new_rule, 'name') poller = ncf.load_balancers.create_or_update(resource_group_name, load_balancer_name, lb) return _get_property(poller.result().load_balancing_rules, item_name) @@ -658,7 +665,7 @@ def create_nic_ip_config(resource_group_name, network_interface_name, ip_config_ private_ip_allocation_method=private_ip_address_allocation, private_ip_address_version=private_ip_address_version, primary=make_primary) - _upsert(nic.ip_configurations, new_config, 'name', ip_config_name) + _upsert(nic, 'ip_configurations', new_config, 'name') poller = ncf.network_interfaces.create_or_update( resource_group_name, network_interface_name, nic) return _get_property(poller.result().ip_configurations, ip_config_name) @@ -708,19 +715,25 @@ def set_nic_ip_config(instance, parent, ip_config_name, subnet=None, # pylint: d return parent set_nic_ip_config.__doc__ = NicOperations.create_or_update.__doc__ +def _get_nic_ip_config(nic, name): + if nic.ip_configurations: + ip_config = next( + (x for x in nic.ip_configurations if x.name.lower() == name.lower()), None) + else: + ip_config = None + if not ip_config: + raise CLIError('IP configuration {} not found.'.format(name)) + return ip_config + def add_nic_ip_config_address_pool( resource_group_name, network_interface_name, ip_config_name, backend_address_pool, load_balancer_name=None): # pylint: disable=unused-argument client = _network_client_factory().network_interfaces nic = client.get(resource_group_name, network_interface_name) - ip_config = next( - (x for x in nic.ip_configurations if x.name.lower() == ip_config_name.lower()), None) - try: - _upsert(ip_config.load_balancer_backend_address_pools, - BackendAddressPool(backend_address_pool), - 'name', backend_address_pool) - except AttributeError: - ip_config.load_balancer_backend_address_pools = [BackendAddressPool(backend_address_pool)] + ip_config = _get_nic_ip_config(nic, ip_config_name) + _upsert(ip_config, 'load_balancer_backend_address_pools', + BackendAddressPool(backend_address_pool), + 'name') poller = client.create_or_update(resource_group_name, network_interface_name, nic) return _get_property(poller.result().ip_configurations, ip_config_name) @@ -729,10 +742,7 @@ def remove_nic_ip_config_address_pool( load_balancer_name=None): # pylint: disable=unused-argument client = _network_client_factory().network_interfaces nic = client.get(resource_group_name, network_interface_name) - ip_config = next( - (x for x in nic.ip_configurations if x.name.lower() == ip_config_name.lower()), None) - if not ip_config: - raise CLIError('IP configuration {} not found.'.format(ip_config_name)) + ip_config = _get_nic_ip_config(nic, ip_config_name) keep_items = \ [x for x in ip_config.load_balancer_backend_address_pools or [] \ if x.id != backend_address_pool] @@ -745,14 +755,10 @@ def add_nic_ip_config_inbound_nat_rule( load_balancer_name=None): # pylint: disable=unused-argument client = _network_client_factory().network_interfaces nic = client.get(resource_group_name, network_interface_name) - ip_config = next( - (x for x in nic.ip_configurations if x.name.lower() == ip_config_name.lower()), None) - try: - _upsert(ip_config.load_balancer_inbound_nat_rules, - InboundNatRule(inbound_nat_rule), - 'name', inbound_nat_rule) - except AttributeError: - ip_config.load_balancer_inbound_nat_rules = [InboundNatRule(inbound_nat_rule)] + ip_config = _get_nic_ip_config(nic, ip_config_name) + _upsert(ip_config, 'load_balancer_inbound_nat_rules', + InboundNatRule(inbound_nat_rule), + 'name') poller = client.create_or_update(resource_group_name, network_interface_name, nic) return _get_property(poller.result().ip_configurations, ip_config_name) @@ -761,10 +767,7 @@ def remove_nic_ip_config_inbound_nat_rule( load_balancer_name=None): # pylint: disable=unused-argument client = _network_client_factory().network_interfaces nic = client.get(resource_group_name, network_interface_name) - ip_config = next( - (x for x in nic.ip_configurations or [] if x.name.lower() == ip_config_name.lower()), None) - if not ip_config: - raise CLIError('IP configuration {} not found.'.format(ip_config_name)) + ip_config = _get_nic_ip_config(nic, ip_config_name) keep_items = \ [x for x in ip_config.load_balancer_inbound_nat_rules if x.id != inbound_nat_rule] ip_config.load_balancer_inbound_nat_rules = keep_items @@ -1074,7 +1077,7 @@ def create_vnet_gateway_root_cert(resource_group_name, gateway_name, public_cert config.vpn_client_root_certificates = [] cert = VpnClientRootCertificate(name=cert_name, public_cert_data=public_cert_data) - _upsert(config.vpn_client_root_certificates, cert, 'name', cert_name) + _upsert(config, 'vpn_client_root_certificates', cert, 'name') return ncf.create_or_update(resource_group_name, gateway_name, gateway) def delete_vnet_gateway_root_cert(resource_group_name, gateway_name, cert_name): @@ -1094,7 +1097,7 @@ def create_vnet_gateway_revoked_cert(resource_group_name, gateway_name, thumbpri config, gateway, ncf = _prep_cert_create(gateway_name, resource_group_name) cert = VpnClientRevokedCertificate(name=cert_name, thumbprint=thumbprint) - _upsert(config.vpn_client_revoked_certificates, cert, 'name', cert_name) + _upsert(config, 'vpn_client_revoked_certificates', cert, 'name') return ncf.create_or_update(resource_group_name, gateway_name, gateway) def delete_vnet_gateway_revoked_cert(resource_group_name, gateway_name, cert_name): diff --git a/src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/custom.py b/src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/custom.py index caa1ea222..e30d0a245 100644 --- a/src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/custom.py +++ b/src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/custom.py @@ -3,7 +3,6 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -from copy import deepcopy import requests from adal.adal_error import AdalError from azure.cli.core.prompting import prompt_pass, NoTTYException @@ -85,8 +84,7 @@ def login(username=None, password=None, service_principal=None, tenant=None): raise CLIError(err) except requests.exceptions.ConnectionError as err: raise CLIError('Please ensure you have network connection. Error detail: ' + str(err)) - # use deepcopy as we don't want to persist these changes to file. - all_subscriptions = deepcopy(subscriptions) + all_subscriptions = list(subscriptions) for sub in all_subscriptions: sub['cloudName'] = sub.pop('environmentName', None) return all_subscriptions diff --git a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_params.py b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_params.py index 2cd7be83d..1e96ca573 100644 --- a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_params.py +++ b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_params.py @@ -250,10 +250,9 @@ for item in ['create', 'update']: register_cli_argument('storage account create', 'access_tier', help='Required for StandardBlob accounts. The access tier used for billing. Cannot be set for StandardLRS, StandardGRS, StandardRAGRS, or PremiumLRS account types.', **enum_choice_list(AccessTier)) register_cli_argument('storage account update', 'access_tier', help='The access tier used for billing StandardBlob accounts. Cannot be set for StandardLRS, StandardGRS, StandardRAGRS, or PremiumLRS account types.', **enum_choice_list(AccessTier)) -register_cli_argument('storage account create', 'custom_domain', help='User domain assigned to the storage account. Name is the CNAME source.', validator=validate_custom_domain) +register_cli_argument('storage account create', 'custom_domain', help='User domain assigned to the storage account. Name is the CNAME source.') register_cli_argument('storage account update', 'custom_domain', help='User domain assigned to the storage account. Name is the CNAME source. Use "" to clear existing value.', validator=validate_custom_domain) -register_extra_cli_argument('storage account create', 'subdomain', options_list=('--use-subdomain',), help='Specify to enable indirect CNAME validation.', action='store_true') -register_extra_cli_argument('storage account update', 'subdomain', options_list=('--use-subdomain',), help='Specify whether to use indirect CNAME validation.', default=None, **enum_choice_list(['true', 'false'])) +register_cli_argument('storage account update', 'use_subdomain', help='Specify whether to use indirect CNAME validation.', **enum_choice_list(['true', 'false'])) register_cli_argument('storage account update', 'tags', tags_type, default=None) diff --git a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_validators.py b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_validators.py index 4648aa836..21beba5e9 100644 --- a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_validators.py +++ b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_validators.py @@ -15,7 +15,6 @@ from azure.cli.core._util import CLIError from azure.cli.core.commands.client_factory import get_mgmt_service_client from azure.cli.core.commands.validators import validate_key_value_pairs from azure.mgmt.storage import StorageManagementClient -from azure.mgmt.storage.models import CustomDomain from azure.storage.sharedaccesssignature import SharedAccessSignature from azure.storage.blob import Include, PublicAccess from azure.storage.blob.baseblobservice import BaseBlobService @@ -154,16 +153,19 @@ def validate_source_uri(namespace): # pylint: disable=too-many-statements validate_client_parameters(namespace) # must run first to resolve storage account # determine if the copy will happen in the same storage account + same_account = False if not source_account_name and source_account_key: raise ValueError(usage_string.format('Source account key is given but account name is not')) elif not source_account_name and not source_account_key: # neither source account name or key is given, assume that user intends to copy blob in # the same account + same_account = True source_account_name = ns.get('account_name', None) source_account_key = ns.get('account_key', None) elif source_account_name and not source_account_key: if source_account_name == ns.get('account_name', None): # the source account name is same as the destination account name + same_account = True source_account_key = ns.get('account_key', None) else: # the source account is different from destination account but the key is missing @@ -180,11 +182,11 @@ def validate_source_uri(namespace): # pylint: disable=too-many-statements if not sas: # generate a sas token even in the same account when the source and destination are not the # same kind. - if valid_file_source and ns.get('container_name', None): + if valid_file_source and (ns.get('container_name', None) or not same_account): dir_name, file_name = os.path.split(path) if path else (None, '') sas = _create_short_lived_file_sas(source_account_name, source_account_key, share, dir_name, file_name) - elif valid_blob_source and ns.get('share_name', None): + elif valid_blob_source and (ns.get('share_name', None) or not same_account): sas = _create_short_lived_blob_sas(source_account_name, source_account_key, container, blob) @@ -272,11 +274,8 @@ def get_content_setting_validator(settings_class, update): def validate_custom_domain(namespace): - if namespace.custom_domain: - namespace.custom_domain = CustomDomain(namespace.custom_domain, namespace.subdomain) - if namespace.subdomain and not namespace.custom_domain: - raise ValueError("must specify '--custom-domain' to use the '--use-subdomain' flag") - del namespace.subdomain + if namespace.use_subdomain and not namespace.custom_domain: + raise ValueError('usage error: --custom-domain DOMAIN [--use-subdomain]') def validate_encryption(namespace): diff --git a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/commands.py b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/commands.py index e7243fa56..247c7c6fe 100644 --- a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/commands.py +++ b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/commands.py @@ -57,7 +57,7 @@ cli_command(__name__, 'storage account keys renew', mgmt_path + 'regenerate_key' cli_command(__name__, 'storage account keys list', mgmt_path + 'list_keys', factory, transform=lambda x: x.keys) cli_generic_update_command(__name__, 'storage account update', mgmt_path + 'get_properties', - mgmt_path + 'create', factory, + mgmt_path + 'update', factory, custom_function_op=custom_path + 'update_storage_account') cli_storage_data_plane_command('storage account generate-sas', 'azure.storage.cloudstorageaccount#CloudStorageAccount.generate_shared_access_signature', cloud_storage_account_service_factory) diff --git a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py index b89a8e196..0976aad5f 100644 --- a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py +++ b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py @@ -103,23 +103,26 @@ def create_storage_account(resource_group_name, account_name, sku, location, kind=Kind(kind), location=location, tags=tags, - custom_domain=CustomDomain(custom_domain) if custom_domain else None, + custom_domain=CustomDomain(custom_domain, None) if custom_domain else None, encryption=encryption, access_tier=AccessTier(access_tier) if access_tier else None) return scf.storage_accounts.create(resource_group_name, account_name, params) def update_storage_account(instance, sku=None, tags=None, custom_domain=None, - encryption=None, access_tier=None): + use_subdomain=None, encryption=None, access_tier=None): from azure.mgmt.storage.models import \ - (StorageAccountCreateParameters, Sku, CustomDomain, AccessTier) - - params = StorageAccountCreateParameters( + (StorageAccountUpdateParameters, Sku, CustomDomain, AccessTier) + domain = instance.custom_domain + if custom_domain is not None: + domain = CustomDomain(custom_domain) + if use_subdomain is not None: + domain.name = use_subdomain == 'true' + + params = StorageAccountUpdateParameters( sku=Sku(sku) if sku is not None else instance.sku, - kind=instance.kind, - location=instance.location, tags=tags if tags is not None else instance.tags, - custom_domain=CustomDomain(custom_domain) if custom_domain is not None else instance.custom_domain, # pylint: disable=line-too-long + custom_domain=domain, encryption=encryption if encryption is not None else instance.encryption, access_tier=AccessTier(access_tier) if access_tier is not None else instance.access_tier )
extension hack not working ### **This is autogenerated. Please review and update as needed.** ## Describe the bug **Command Name** `az hack` **Errors:** ``` libffi.so.6: cannot open shared object file: No such file or directory Traceback (most recent call last): python3.8/site-packages/knack/cli.py, ln 206, in invoke cmd_result = self.invocation.execute(args) cli/core/commands/__init__.py, ln 554, in execute parsed_args = self.parser.parse_args(args) python3.8/site-packages/knack/parser.py, ln 259, in parse_args return super(CLICommandParser, self).parse_args(args) ... site-packages/cryptography/x509/extensions.py, ln 20, in <module> from cryptography.hazmat.primitives import constant_time, serialization cryptography/hazmat/primitives/constant_time.py, ln 11, in <module> from cryptography.hazmat.bindings._constant_time import lib ImportError: libffi.so.6: cannot open shared object file: No such file or directory ``` ## To Reproduce: Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information. - _Put any pre-requisite steps here..._ - `az hack -h` ## Expected Behavior ## Environment Summary ``` Linux-5.4.0-47-generic-x86_64-with-glibc2.2.5 Python 3.8.1 azure-cli 2.1.0 * Extensions: hack 0.4.2 interactive 0.4.4 subscription 0.1.4 aks-preview 0.4.62 k8sconfiguration 0.1.7 azure-devops 0.17.0 ``` ## Additional Context <!--Please don't remove this:--> <!--auto-generated-->
Azure/azure-cli
diff --git a/scripts/automation/tests/run.py b/scripts/automation/tests/run.py index b3dc92b3e..76a98b118 100644 --- a/scripts/automation/tests/run.py +++ b/scripts/automation/tests/run.py @@ -20,14 +20,14 @@ def run_tests(modules, parallel, run_live): # create test results folder test_results_folder = get_test_results_dir(with_timestamp=True, prefix='tests') - # get test runner - run_nose = get_nose_runner(test_results_folder, xunit_report=True, exclude_integration=True, - parallel=parallel) - # set environment variable if run_live: os.environ['AZURE_CLI_TEST_RUN_LIVE'] = 'True' + # get test runner + run_nose = get_nose_runner(test_results_folder, xunit_report=True, exclude_integration=True, + parallel=parallel, process_timeout=3600 if run_live else 600) + # run tests test_folders = [test_path for _, _, test_path in modules] result, test_result = run_nose(test_folders) diff --git a/src/azure-cli-core/azure/cli/core/tests/test_profile.py b/src/azure-cli-core/azure/cli/core/tests/test_profile.py index 878e318f2..cef7e5644 100644 --- a/src/azure-cli-core/azure/cli/core/tests/test_profile.py +++ b/src/azure-cli-core/azure/cli/core/tests/test_profile.py @@ -157,13 +157,11 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method False) profile._set_subscriptions(consolidated) - subscription1 = storage_mock['subscriptions'][0] - subscription2 = storage_mock['subscriptions'][1] - self.assertTrue(subscription2['isDefault']) + self.assertTrue(storage_mock['subscriptions'][1]['isDefault']) - profile.set_active_subscription(subscription1['id']) - self.assertFalse(subscription2['isDefault']) - self.assertTrue(subscription1['isDefault']) + profile.set_active_subscription(storage_mock['subscriptions'][0]['id']) + self.assertFalse(storage_mock['subscriptions'][1]['isDefault']) + self.assertTrue(storage_mock['subscriptions'][0]['isDefault']) def test_get_subscription(self): storage_mock = {'subscriptions': None} diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_unit_tests.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_unit_tests.py new file mode 100644 index 000000000..66ab9a44d --- /dev/null +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_unit_tests.py @@ -0,0 +1,84 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import unittest + +import mock + +from azure.cli.core._util import CLIError + +class Test_Network_Unit_Tests(unittest.TestCase): + + def test_network_get_nic_ip_config(self): + from azure.cli.command_modules.network.custom import _get_nic_ip_config + + # 1 - Test that if ip_configurations property is null, error is thrown + nic = mock.MagicMock() + nic.ip_configurations = None + with self.assertRaises(CLIError): + _get_nic_ip_config(nic, 'test') + + def mock_ip_config(name, value): + fake = mock.MagicMock() + fake.name = name + fake.value = value + return fake + + nic = mock.MagicMock() + nic.ip_configurations = [ + mock_ip_config('test1', '1'), + mock_ip_config('test2', '2'), + mock_ip_config('test3', '3'), + ] + # 2 - Test that if ip_configurations is not null but no match, error is thrown + with self.assertRaises(CLIError): + _get_nic_ip_config(nic, 'test4') + + # 3 - Test that match is returned + self.assertEqual(_get_nic_ip_config(nic, 'test2').value, '2') + + def test_network_upsert(self): + from azure.cli.command_modules.network.custom import _upsert + + obj1 = mock.MagicMock() + obj1.key = 'object1' + obj1.value = 'cat' + + obj2 = mock.MagicMock() + obj2.key = 'object2' + obj2.value = 'dog' + + # 1 - verify upsert to a null collection + parent_with_null_collection = mock.MagicMock() + parent_with_null_collection.collection = None + _upsert(parent_with_null_collection, 'collection', obj1, 'key') + result = parent_with_null_collection.collection + self.assertEqual(len(result), 1) + self.assertEqual(result[0].value, 'cat') + + # 2 - verify upsert to an empty collection + parent_with_empty_collection = mock.MagicMock() + parent_with_empty_collection.collection = [] + _upsert(parent_with_empty_collection, 'collection', obj1, 'key') + result = parent_with_empty_collection.collection + self.assertEqual(len(result), 1) + self.assertEqual(result[0].value, 'cat') + + # 3 - verify can add more than one + _upsert(parent_with_empty_collection, 'collection', obj2, 'key') + result = parent_with_empty_collection.collection + self.assertEqual(len(result), 2) + self.assertEqual(result[1].value, 'dog') + + # 4 - verify update to existing collection + obj2.value = 'noodle' + _upsert(parent_with_empty_collection, 'collection', obj2, 'key') + result = parent_with_empty_collection.collection + self.assertEqual(len(result), 2) + self.assertEqual(result[1].value, 'noodle') + + +if __name__ == '__main__': + unittest.main() diff --git a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/recordings/test_storage_account_scenario.yaml b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/recordings/test_storage_account_scenario.yaml index 1c2f83a9e..1fc3a1527 100644 --- a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/recordings/test_storage_account_scenario.yaml +++ b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/tests/recordings/test_storage_account_scenario.yaml @@ -7,10 +7,10 @@ interactions: Connection: [keep-alive] Content-Length: ['73'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [d3fbbbf4-f3c9-11e6-ab1b-74c63bed1137] + x-ms-client-request-id: [9c9be3b6-fed7-11e6-8ca8-a0b3ccf7272a] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/checkNameAvailability?api-version=2016-12-01 response: @@ -20,7 +20,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:03 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:28 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -37,10 +37,10 @@ interactions: Connection: [keep-alive] Content-Length: ['73'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [d4c73850-f3c9-11e6-9371-74c63bed1137] + x-ms-client-request-id: [9d4cbb68-fed7-11e6-96c5-a0b3ccf7272a] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/checkNameAvailability?api-version=2016-12-01 response: @@ -50,7 +50,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:04 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:28 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -60,17 +60,17 @@ interactions: content-length: ['23'] status: {code: 200, message: OK} - request: - body: '{"sku": {"name": "Standard_LRS"}, "kind": "Storage", "location": "westus"}' + body: '{"sku": {"name": "Standard_LRS"}, "location": "westus", "kind": "Storage"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Length: ['74'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [d58758a8-f3c9-11e6-93c6-74c63bed1137] + x-ms-client-request-id: [9dfccaee-fed7-11e6-ac56-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: @@ -78,14 +78,14 @@ interactions: headers: Cache-Control: [no-cache] Content-Length: ['0'] - Date: ['Wed, 15 Feb 2017 21:58:07 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:30 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/9147d762-549f-4705-a5ac-dbf05b9c7a94?monitor=true&api-version=2016-12-01'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/47260cb6-ad6b-4505-abf3-db1258120ff9?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] Retry-After: ['17'] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1196'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 202, message: Accepted} - request: body: null @@ -94,20 +94,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [d58758a8-f3c9-11e6-93c6-74c63bed1137] + x-ms-client-request-id: [9dfccaee-fed7-11e6-ac56-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/9147d762-549f-4705-a5ac-dbf05b9c7a94?monitor=true&api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/47260cb6-ad6b-4505-abf3-db1258120ff9?monitor=true&api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage000197884384","kind":"Storage","location":"westus","name":"vcrstorage000197884384","properties":{"creationTime":"2017-03-01T23:34:31.1193082Z","primaryEndpoints":{"blob":"https://vcrstorage000197884384.blob.core.windows.net/","file":"https://vcrstorage000197884384.file.core.windows.net/","queue":"https://vcrstorage000197884384.queue.core.windows.net/","table":"https://vcrstorage000197884384.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:24 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:47 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -117,28 +117,28 @@ interactions: content-length: ['776'] status: {code: 200, message: OK} - request: - body: '{"name": "vcrstorage733641907300", "type": "Microsoft.Storage/storageAccounts"}' + body: '{"name": "vcrstorage000197884384", "type": "Microsoft.Storage/storageAccounts"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Length: ['79'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [e1bebfcc-f3c9-11e6-a3b6-74c63bed1137] + x-ms-client-request-id: [a9a247a6-fed7-11e6-88e9-a0b3ccf7272a] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/checkNameAvailability?api-version=2016-12-01 response: - body: {string: '{"message":"The storage account named vcrstorage733641907300 is + body: {string: '{"message":"The storage account named vcrstorage000197884384 is already taken.","nameAvailable":false,"reason":"AlreadyExists"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:26 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:50 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -154,20 +154,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [e25fb3ac-f3c9-11e6-9d53-74c63bed1137] + x-ms-client-request-id: [aa39415a-fed7-11e6-b244-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts?api-version=2016-12-01 response: - body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"}]} + body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage000197884384","kind":"Storage","location":"westus","name":"vcrstorage000197884384","properties":{"creationTime":"2017-03-01T23:34:31.1193082Z","primaryEndpoints":{"blob":"https://vcrstorage000197884384.blob.core.windows.net/","file":"https://vcrstorage000197884384.file.core.windows.net/","queue":"https://vcrstorage000197884384.queue.core.windows.net/","table":"https://vcrstorage000197884384.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"}]} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:26 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:50 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -183,20 +183,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [e2e57f30-f3c9-11e6-b459-74c63bed1137] + x-ms-client-request-id: [aad6b914-fed7-11e6-8f5e-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage000197884384","kind":"Storage","location":"westus","name":"vcrstorage000197884384","properties":{"creationTime":"2017-03-01T23:34:31.1193082Z","primaryEndpoints":{"blob":"https://vcrstorage000197884384.blob.core.windows.net/","file":"https://vcrstorage000197884384.file.core.windows.net/","queue":"https://vcrstorage000197884384.queue.core.windows.net/","table":"https://vcrstorage000197884384.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:27 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:52 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -212,21 +212,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [e3620122-f3c9-11e6-9d80-74c63bed1137] + x-ms-client-request-id: [ab60fc00-fed7-11e6-8a97-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/usages?api-version=2016-12-01 response: body: {string: "{\r\n \"value\": [\r\n {\r\n \"unit\": \"Count\",\r\n\ - \ \"currentValue\": 41,\r\n \"limit\": 250,\r\n \"name\": {\r\ + \ \"currentValue\": 43,\r\n \"limit\": 250,\r\n \"name\": {\r\ \n \"value\": \"StorageAccounts\",\r\n \"localizedValue\": \"\ Storage Accounts\"\r\n }\r\n }\r\n ]\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:28 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:52 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -243,20 +243,20 @@ interactions: Connection: [keep-alive] Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [e3f246c6-f3c9-11e6-8348-74c63bed1137] + x-ms-client-request-id: [abff0f12-fed7-11e6-8753-a0b3ccf7272a] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage/listKeys?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"FvHhwyIgb9w4f9IP8q8hsco9YRMQx2Cmw7/twW6Z5BDSqV7E3glSpl6XjhGd4EBoH1y3Qs7ZydIzRdzXb5RUlA=="},{"keyName":"key2","permissions":"Full","value":"bl05+mAzQpLT0w07vniIWTHZfgxJ8M9ywLnk6NmJ0EsWmpa/QBeO9zK7AObh4pOmsIBgeQq7ibjoDYpLBjLxmw=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"ItLmzJCF8AnEJIgk03B+Hnp6H7farh0R/pAriD55Jfpx1/h5VM7StJbEACuMPO+1yPL4F0JolztcG1Ma4wS1Sw=="},{"keyName":"key2","permissions":"Full","value":"sVCBmSEwOpBbPiI3MNKdBMJKBdrHun8OTUkiyRIkZQWwNbgt2xcfOFn0GluHepOkQ9Mopcjld8Xjxm7MfPD91g=="}]} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:29 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:53 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -264,7 +264,7 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['289'] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: body: null @@ -274,20 +274,20 @@ interactions: Connection: [keep-alive] Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [e461e3c2-f3c9-11e6-a33d-74c63bed1137] + x-ms-client-request-id: [ac779990-fed7-11e6-b38f-a0b3ccf7272a] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage/listKeys?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"FvHhwyIgb9w4f9IP8q8hsco9YRMQx2Cmw7/twW6Z5BDSqV7E3glSpl6XjhGd4EBoH1y3Qs7ZydIzRdzXb5RUlA=="},{"keyName":"key2","permissions":"Full","value":"bl05+mAzQpLT0w07vniIWTHZfgxJ8M9ywLnk6NmJ0EsWmpa/QBeO9zK7AObh4pOmsIBgeQq7ibjoDYpLBjLxmw=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"ItLmzJCF8AnEJIgk03B+Hnp6H7farh0R/pAriD55Jfpx1/h5VM7StJbEACuMPO+1yPL4F0JolztcG1Ma4wS1Sw=="},{"keyName":"key2","permissions":"Full","value":"sVCBmSEwOpBbPiI3MNKdBMJKBdrHun8OTUkiyRIkZQWwNbgt2xcfOFn0GluHepOkQ9Mopcjld8Xjxm7MfPD91g=="}]} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:31 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:54 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -295,24 +295,24 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['289'] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:33 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:34:55 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://dummystorage.blob.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.blob.core.windows.net/?comp=properties&restype=service response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Wed, 15 Feb 2017 21:58:31 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:54 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -321,19 +321,19 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:34 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:34:55 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://dummystorage.queue.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.queue.core.windows.net/?comp=properties&restype=service response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Cache-Control: [no-cache] Content-Type: [application/xml] - Date: ['Wed, 15 Feb 2017 21:58:32 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:57 GMT'] Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -344,18 +344,18 @@ interactions: Connection: [keep-alive] DataServiceVersion: [3.0;NetFx] MaxDataServiceVersion: ['3.0'] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:34 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:34:57 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://dummystorage.table.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.table.core.windows.net/?comp=properties&restype=service response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Wed, 15 Feb 2017 21:58:31 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:56 GMT'] Server: [Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -367,16 +367,16 @@ interactions: headers: Connection: [keep-alive] Content-Length: ['264'] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:35 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:34:58 GMT'] x-ms-version: ['2015-07-08'] method: PUT - uri: https://dummystorage.blob.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.blob.core.windows.net/?comp=properties&restype=service response: body: {string: ''} headers: - Date: ['Wed, 15 Feb 2017 21:58:32 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:57 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -385,18 +385,18 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:35 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:34:59 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://dummystorage.blob.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.blob.core.windows.net/?comp=properties&restype=service response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>true</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>true</Enabled><Days>1</Days></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Wed, 15 Feb 2017 21:58:32 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:58 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -405,19 +405,19 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:35 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:34:59 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://dummystorage.queue.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.queue.core.windows.net/?comp=properties&restype=service response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Cache-Control: [no-cache] Content-Type: [application/xml] - Date: ['Wed, 15 Feb 2017 21:58:33 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:58 GMT'] Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -428,18 +428,18 @@ interactions: Connection: [keep-alive] DataServiceVersion: [3.0;NetFx] MaxDataServiceVersion: ['3.0'] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:35 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:34:59 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://dummystorage.table.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.table.core.windows.net/?comp=properties&restype=service response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Wed, 15 Feb 2017 21:58:33 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:58 GMT'] Server: [Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -448,18 +448,18 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:36 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:34:59 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://dummystorage.blob.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.blob.core.windows.net/?comp=properties&restype=service response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>true</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>true</Enabled><Days>1</Days></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Wed, 15 Feb 2017 21:58:33 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:58 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -468,18 +468,18 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:36 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:34:59 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://dummystorage.file.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.file.core.windows.net/?comp=properties&restype=service response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Wed, 15 Feb 2017 21:58:33 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:59 GMT'] Server: [Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -488,19 +488,19 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:36 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:34:59 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://dummystorage.queue.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.queue.core.windows.net/?comp=properties&restype=service response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Cache-Control: [no-cache] Content-Type: [application/xml] - Date: ['Wed, 15 Feb 2017 21:58:34 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:59 GMT'] Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -511,18 +511,18 @@ interactions: Connection: [keep-alive] DataServiceVersion: [3.0;NetFx] MaxDataServiceVersion: ['3.0'] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:36 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:35:00 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://dummystorage.table.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.table.core.windows.net/?comp=properties&restype=service response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Wed, 15 Feb 2017 21:58:33 GMT'] + Date: ['Wed, 01 Mar 2017 23:34:59 GMT'] Server: [Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -534,16 +534,16 @@ interactions: headers: Connection: [keep-alive] Content-Length: ['386'] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:37 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:35:00 GMT'] x-ms-version: ['2015-07-08'] method: PUT - uri: https://dummystorage.file.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.file.core.windows.net/?comp=properties&restype=service response: body: {string: ''} headers: - Date: ['Wed, 15 Feb 2017 21:58:34 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:00 GMT'] Server: [Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -552,18 +552,18 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:37 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:35:01 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://dummystorage.blob.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.blob.core.windows.net/?comp=properties&restype=service response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>true</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>true</Enabled><Days>1</Days></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Wed, 15 Feb 2017 21:58:34 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:00 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -572,18 +572,18 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:37 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:35:01 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://dummystorage.file.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.file.core.windows.net/?comp=properties&restype=service response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><HourMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>true</Enabled><Days>1</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>true</Enabled><Days>1</Days></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Wed, 15 Feb 2017 21:58:35 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:01 GMT'] Server: [Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -592,19 +592,19 @@ interactions: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:37 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:35:01 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://dummystorage.queue.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.queue.core.windows.net/?comp=properties&restype=service response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Cache-Control: [no-cache] Content-Type: [application/xml] - Date: ['Wed, 15 Feb 2017 21:58:35 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:01 GMT'] Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -615,18 +615,18 @@ interactions: Connection: [keep-alive] DataServiceVersion: [3.0;NetFx] MaxDataServiceVersion: ['3.0'] - User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.3; Windows 10) AZURECLI/0.1.1b3+dev] - x-ms-client-request-id: [d1951d86-f3c9-11e6-849f-74c63bed1137] - x-ms-date: ['Wed, 15 Feb 2017 21:58:38 GMT'] + User-Agent: [Azure-Storage/0.33.0 (Python CPython 3.5.1; Windows 10) AZURECLI/2.0.0+dev] + x-ms-client-request-id: [99cd850c-fed7-11e6-bb24-a0b3ccf7272a] + x-ms-date: ['Wed, 01 Mar 2017 23:35:01 GMT'] x-ms-version: ['2015-07-08'] method: GET - uri: https://dummystorage.table.core.windows.net/?restype=service&comp=properties + uri: https://dummystorage.table.core.windows.net/?comp=properties&restype=service response: body: {string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors\ \ /></StorageServiceProperties>"} headers: Content-Type: [application/xml] - Date: ['Wed, 15 Feb 2017 21:58:35 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:00 GMT'] Server: [Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] x-ms-version: ['2015-07-08'] @@ -639,20 +639,20 @@ interactions: Connection: [keep-alive] Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [e7dff490-f3c9-11e6-94b6-74c63bed1137] + x-ms-client-request-id: [b0eb465e-fed7-11e6-af56-a0b3ccf7272a] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage/listKeys?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"FvHhwyIgb9w4f9IP8q8hsco9YRMQx2Cmw7/twW6Z5BDSqV7E3glSpl6XjhGd4EBoH1y3Qs7ZydIzRdzXb5RUlA=="},{"keyName":"key2","permissions":"Full","value":"bl05+mAzQpLT0w07vniIWTHZfgxJ8M9ywLnk6NmJ0EsWmpa/QBeO9zK7AObh4pOmsIBgeQq7ibjoDYpLBjLxmw=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"ItLmzJCF8AnEJIgk03B+Hnp6H7farh0R/pAriD55Jfpx1/h5VM7StJbEACuMPO+1yPL4F0JolztcG1Ma4wS1Sw=="},{"keyName":"key2","permissions":"Full","value":"sVCBmSEwOpBbPiI3MNKdBMJKBdrHun8OTUkiyRIkZQWwNbgt2xcfOFn0GluHepOkQ9Mopcjld8Xjxm7MfPD91g=="}]} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:36 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:01 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -670,20 +670,20 @@ interactions: Connection: [keep-alive] Content-Length: ['19'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [e876def8-f3c9-11e6-92c4-74c63bed1137] + x-ms-client-request-id: [b17d4e74-fed7-11e6-8937-a0b3ccf7272a] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage/regenerateKey?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"l03UHMDSrRKgCV8svPY6KwOJkLebUO4Ga+hTp6OOmbfgGHErym9xC0cqiRv1EFwD1qGl4n6L2meRzgmIIvwDtw=="},{"keyName":"key2","permissions":"Full","value":"bl05+mAzQpLT0w07vniIWTHZfgxJ8M9ywLnk6NmJ0EsWmpa/QBeO9zK7AObh4pOmsIBgeQq7ibjoDYpLBjLxmw=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"u0uWulZ6Y6Ang3CrIvE/bT6y3xHip8viRr9RY88vKtv/LPSsYDZdXDOfP1SLswm3aiBzTZarZsbo4ssJqfBJ3g=="},{"keyName":"key2","permissions":"Full","value":"sVCBmSEwOpBbPiI3MNKdBMJKBdrHun8OTUkiyRIkZQWwNbgt2xcfOFn0GluHepOkQ9Mopcjld8Xjxm7MfPD91g=="}]} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:37 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:03 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -691,7 +691,7 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['289'] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: body: '{"keyName": "key2"}' @@ -701,20 +701,20 @@ interactions: Connection: [keep-alive] Content-Length: ['19'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [e8fa5966-f3c9-11e6-9f40-74c63bed1137] + x-ms-client-request-id: [b23a6bec-fed7-11e6-a4cf-a0b3ccf7272a] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage/regenerateKey?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"l03UHMDSrRKgCV8svPY6KwOJkLebUO4Ga+hTp6OOmbfgGHErym9xC0cqiRv1EFwD1qGl4n6L2meRzgmIIvwDtw=="},{"keyName":"key2","permissions":"Full","value":"YfbqITRrz1Rtt8HMj/hKLxQDho6ZbojNZnjevh8Di8ZmWr4NYsneWY47IdSQTxUFSqrveoyrXwpp+xjNBVDVeA=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"u0uWulZ6Y6Ang3CrIvE/bT6y3xHip8viRr9RY88vKtv/LPSsYDZdXDOfP1SLswm3aiBzTZarZsbo4ssJqfBJ3g=="},{"keyName":"key2","permissions":"Full","value":"aZHNVFhuVqvRgW4/6NW++p2F6tQfnTIi25FMnRw3tlL/l3vIzGuG9UuU3dbGsEOJyiZKMj/Zn8gIi2FZo0tUXQ=="}]} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:38 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:04 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -731,20 +731,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [e971ec5a-f3c9-11e6-98df-74c63bed1137] + x-ms-client-request-id: [b2ef2162-fed7-11e6-9a04-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage000197884384","kind":"Storage","location":"westus","name":"vcrstorage000197884384","properties":{"creationTime":"2017-03-01T23:34:31.1193082Z","primaryEndpoints":{"blob":"https://vcrstorage000197884384.blob.core.windows.net/","file":"https://vcrstorage000197884384.file.core.windows.net/","queue":"https://vcrstorage000197884384.queue.core.windows.net/","table":"https://vcrstorage000197884384.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:39 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:05 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -754,28 +754,27 @@ interactions: content-length: ['776'] status: {code: 200, message: OK} - request: - body: '{"sku": {"name": "Standard_LRS"}, "kind": "Storage", "tags": {"cat": "", - "foo": "bar"}, "location": "westus"}' + body: '{"sku": {"name": "Standard_LRS"}, "tags": {"foo": "bar", "cat": ""}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['109'] + Content-Length: ['68'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [e9ba9bba-f3c9-11e6-ad5f-74c63bed1137] - method: PUT + x-ms-client-request-id: [b319532c-fed7-11e6-8eb2-a0b3ccf7272a] + method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{"cat":"","foo":"bar"},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage000197884384","kind":"Storage","location":"westus","name":"vcrstorage000197884384","properties":{"creationTime":"2017-03-01T23:34:31.1193082Z","primaryEndpoints":{"blob":"https://vcrstorage000197884384.blob.core.windows.net/","file":"https://vcrstorage000197884384.file.core.windows.net/","queue":"https://vcrstorage000197884384.queue.core.windows.net/","table":"https://vcrstorage000197884384.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{"cat":"","foo":"bar"},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:39 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:06 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -783,7 +782,7 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['796'] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: body: null @@ -792,20 +791,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [ea9f11d8-f3c9-11e6-aff0-74c63bed1137] + x-ms-client-request-id: [b4500b98-fed7-11e6-afb5-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{"cat":"","foo":"bar"},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage000197884384","kind":"Storage","location":"westus","name":"vcrstorage000197884384","properties":{"creationTime":"2017-03-01T23:34:31.1193082Z","primaryEndpoints":{"blob":"https://vcrstorage000197884384.blob.core.windows.net/","file":"https://vcrstorage000197884384.file.core.windows.net/","queue":"https://vcrstorage000197884384.queue.core.windows.net/","table":"https://vcrstorage000197884384.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{"cat":"","foo":"bar"},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:41 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:07 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -815,28 +814,27 @@ interactions: content-length: ['796'] status: {code: 200, message: OK} - request: - body: '{"sku": {"name": "Standard_GRS"}, "kind": "Storage", "tags": {}, "location": - "westus"}' + body: '{"sku": {"name": "Standard_GRS"}, "tags": {}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['86'] + Content-Length: ['45'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [eae678e6-f3c9-11e6-9c30-74c63bed1137] - method: PUT + x-ms-client-request-id: [b49a3afa-fed7-11e6-b7e6-a0b3ccf7272a] + method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","secondaryLocation":"eastus","statusOfPrimary":"available","statusOfSecondary":"available"},"sku":{"name":"Standard_GRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage000197884384","kind":"Storage","location":"westus","name":"vcrstorage000197884384","properties":{"creationTime":"2017-03-01T23:34:31.1193082Z","primaryEndpoints":{"blob":"https://vcrstorage000197884384.blob.core.windows.net/","file":"https://vcrstorage000197884384.file.core.windows.net/","queue":"https://vcrstorage000197884384.queue.core.windows.net/","table":"https://vcrstorage000197884384.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","secondaryLocation":"eastus","statusOfPrimary":"available","statusOfSecondary":"available"},"sku":{"name":"Standard_GRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:41 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:09 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -844,7 +842,7 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['837'] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 200, message: OK} - request: body: null @@ -853,20 +851,20 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [ebb69412-f3c9-11e6-90d2-74c63bed1137] + x-ms-client-request-id: [b5e70440-fed7-11e6-9c11-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","secondaryLocation":"eastus","statusOfPrimary":"available","statusOfSecondary":"available"},"sku":{"name":"Standard_GRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage000197884384","kind":"Storage","location":"westus","name":"vcrstorage000197884384","properties":{"creationTime":"2017-03-01T23:34:31.1193082Z","primaryEndpoints":{"blob":"https://vcrstorage000197884384.blob.core.windows.net/","file":"https://vcrstorage000197884384.file.core.windows.net/","queue":"https://vcrstorage000197884384.queue.core.windows.net/","table":"https://vcrstorage000197884384.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","secondaryLocation":"eastus","statusOfPrimary":"available","statusOfSecondary":"available"},"sku":{"name":"Standard_GRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:42 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:11 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -876,28 +874,27 @@ interactions: content-length: ['837'] status: {code: 200, message: OK} - request: - body: '{"sku": {"name": "Standard_GRS"}, "kind": "Storage", "tags": {"test": "success"}, - "location": "westus"}' + body: '{"sku": {"name": "Standard_GRS"}, "tags": {"test": "success"}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['103'] + Content-Length: ['62'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [ec0156a2-f3c9-11e6-accb-74c63bed1137] - method: PUT + x-ms-client-request-id: [b631db38-fed7-11e6-af1c-a0b3ccf7272a] + method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage733641907300","kind":"Storage","location":"westus","name":"vcrstorage733641907300","properties":{"creationTime":"2017-02-15T21:58:07.7815453Z","primaryEndpoints":{"blob":"https://vcrstorage733641907300.blob.core.windows.net/","file":"https://vcrstorage733641907300.file.core.windows.net/","queue":"https://vcrstorage733641907300.queue.core.windows.net/","table":"https://vcrstorage733641907300.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","secondaryLocation":"eastus","statusOfPrimary":"available","statusOfSecondary":"available"},"sku":{"name":"Standard_GRS","tier":"Standard"},"tags":{"test":"success"},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/vcrstorage000197884384","kind":"Storage","location":"westus","name":"vcrstorage000197884384","properties":{"creationTime":"2017-03-01T23:34:31.1193082Z","primaryEndpoints":{"blob":"https://vcrstorage000197884384.blob.core.windows.net/","file":"https://vcrstorage000197884384.file.core.windows.net/","queue":"https://vcrstorage000197884384.queue.core.windows.net/","table":"https://vcrstorage000197884384.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","secondaryLocation":"eastus","statusOfPrimary":"available","statusOfSecondary":"available"},"sku":{"name":"Standard_GRS","tier":"Standard"},"tags":{"test":"success"},"type":"Microsoft.Storage/storageAccounts"} '} headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:43 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:12 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -905,7 +902,7 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['853'] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: body: null @@ -915,10 +912,10 @@ interactions: Connection: [keep-alive] Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [ec90ffe8-f3c9-11e6-8acd-74c63bed1137] + x-ms-client-request-id: [b785f78c-fed7-11e6-96c7-a0b3ccf7272a] method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_storage_account_scenario/providers/Microsoft.Storage/storageAccounts/dummystorage?api-version=2016-12-01 response: @@ -926,25 +923,25 @@ interactions: headers: Cache-Control: [no-cache] Content-Length: ['0'] - Date: ['Wed, 15 Feb 2017 21:58:45 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:13 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 200, message: OK} - request: - body: '{"name": "vcrstorage733641907300", "type": "Microsoft.Storage/storageAccounts"}' + body: '{"name": "vcrstorage000197884384", "type": "Microsoft.Storage/storageAccounts"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Length: ['79'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [ed84472e-f3c9-11e6-b3f4-74c63bed1137] + x-ms-client-request-id: [b88a3394-fed7-11e6-b3ef-a0b3ccf7272a] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/checkNameAvailability?api-version=2016-12-01 response: @@ -954,7 +951,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:46 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:14 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -971,10 +968,10 @@ interactions: Connection: [keep-alive] Content-Length: ['73'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.4 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/0.1.1b3+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.0+dev] accept-language: [en-US] - x-ms-client-request-id: [ee15b978-f3c9-11e6-9fe3-74c63bed1137] + x-ms-client-request-id: [b8fa7600-fed7-11e6-8db2-a0b3ccf7272a] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/checkNameAvailability?api-version=2016-12-01 response: @@ -984,7 +981,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json] - Date: ['Wed, 15 Feb 2017 21:58:47 GMT'] + Date: ['Wed, 01 Mar 2017 23:35:15 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0]
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 3, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 8 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==0.4.3 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==1.4.9 attrs==22.2.0 autopep8==1.2.4 azure-batch==1.1.0 -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_documentdb&subdirectory=src/command_modules/azure-cli-documentdb -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@23b3145b4623edf2648ee28a101175199d92cb1c#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.4 azure-core==1.24.2 azure-graphrbac==0.30.0rc6 azure-keyvault==0.1.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==2.0.0 azure-mgmt-compute==0.33.1rc1 azure-mgmt-containerregistry==0.1.1 azure-mgmt-dns==1.0.0 azure-mgmt-documentdb==0.1.0 azure-mgmt-iothub==0.2.1 azure-mgmt-keyvault==0.30.0 azure-mgmt-network==0.30.0 azure-mgmt-nspkg==3.0.2 azure-mgmt-redis==1.0.0 azure-mgmt-resource==0.30.2 azure-mgmt-sql==0.3.0 azure-mgmt-storage==0.31.0 azure-mgmt-trafficmanager==0.30.0rc6 azure-mgmt-web==0.31.0 azure-nspkg==3.0.2 azure-storage==0.33.0 certifi==2021.5.30 cffi==1.15.1 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.7.1 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.5.4 pyOpenSSL==16.1.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 PyYAML==3.11 requests==2.9.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.5 tomli==1.2.3 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 wrapt==1.16.0 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==0.4.3 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==1.4.9 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==1.1.0 - azure-common==1.1.4 - azure-core==1.24.2 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.1.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==2.0.0 - azure-mgmt-compute==0.33.1rc1 - azure-mgmt-containerregistry==0.1.1 - azure-mgmt-dns==1.0.0 - azure-mgmt-documentdb==0.1.0 - azure-mgmt-iothub==0.2.1 - azure-mgmt-keyvault==0.30.0 - azure-mgmt-network==0.30.0 - azure-mgmt-nspkg==3.0.2 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==0.30.2 - azure-mgmt-sql==0.3.0 - azure-mgmt-storage==0.31.0 - azure-mgmt-trafficmanager==0.30.0rc6 - azure-mgmt-web==0.31.0 - azure-nspkg==3.0.2 - azure-storage==0.33.0 - cffi==1.15.1 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.7.1 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.5.4 - pyopenssl==16.1.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pyyaml==3.11 - requests==2.9.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.5 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - wrapt==1.16.0 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_unit_tests.py::Test_Network_Unit_Tests::test_network_get_nic_ip_config", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/tests/test_network_unit_tests.py::Test_Network_Unit_Tests::test_network_upsert" ]
[]
[ "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_create_token_cache", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_credscache_add_new_sp_creds", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_credscache_load_tokens_and_sp_creds", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_credscache_new_token_added_by_adal", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_credscache_remove_creds", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_find_subscriptions_from_particular_tenent", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_find_subscriptions_from_service_principal_id", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_find_subscriptions_interactive_from_particular_tenent", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_find_subscriptions_through_interactive_flow", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_find_subscriptions_thru_username_password", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_get_current_account_user", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_get_expanded_subscription_info", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_get_expanded_subscription_info_for_logged_in_service_principal", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_get_login_credentials", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_get_login_credentials_for_graph_client", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_get_subscription", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_load_cached_tokens", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_logout", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_logout_all", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_normalize", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_set_active_subscription", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_update_add_two_different_subscriptions", "src/azure-cli-core/azure/cli/core/tests/test_profile.py::Test_Profile::test_update_with_same_subscription_added_twice" ]
[]
MIT License
1,049
[ "azure-cli.pyproj", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/commands.py", "src/azure-cli-core/azure/cli/core/_profile.py", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py", "src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/custom.py", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_params.py", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_validators.py" ]
[ "azure-cli.pyproj", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/commands.py", "src/azure-cli-core/azure/cli/core/_profile.py", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py", "src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/custom.py", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_params.py", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_validators.py" ]
scrapy__scrapy-2612
7b49b9c0f53396ac89cbd74930bc4c6e41d41901
2017-03-02 11:36:20
dfe6d3d59aa3de7a96c1883d0f3f576ba5994aa9
diff --git a/scrapy/spiderloader.py b/scrapy/spiderloader.py index d4f0f663f..486a4637e 100644 --- a/scrapy/spiderloader.py +++ b/scrapy/spiderloader.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import +from collections import defaultdict import traceback import warnings @@ -19,10 +20,24 @@ class SpiderLoader(object): def __init__(self, settings): self.spider_modules = settings.getlist('SPIDER_MODULES') self._spiders = {} + self._found = defaultdict(list) self._load_all_spiders() + def _check_name_duplicates(self): + dupes = ["\n".join(" {cls} named {name!r} (in {module})".format( + module=mod, cls=cls, name=name) + for (mod, cls) in locations) + for name, locations in self._found.items() + if len(locations)>1] + if dupes: + msg = ("There are several spiders with the same name:\n\n" + "{}\n\n This can cause unexpected behavior.".format( + "\n\n".join(dupes))) + warnings.warn(msg, UserWarning) + def _load_spiders(self, module): for spcls in iter_spider_classes(module): + self._found[spcls.name].append((module.__name__, spcls.__name__)) self._spiders[spcls.name] = spcls def _load_all_spiders(self): @@ -35,6 +50,7 @@ class SpiderLoader(object): "Check SPIDER_MODULES setting".format( modname=name, tb=traceback.format_exc())) warnings.warn(msg, RuntimeWarning) + self._check_name_duplicates() @classmethod def from_settings(cls, settings):
rename spider will load the old left .pyc instead of renamed spider Hi all, I'm not sure if this is an issue. If got `y.py` and `y.pyc` in the `spider` directory. Then rename it with `mv y.py x.py` and update the new `x.py`. After updates, run `scrapy crawl spider` will use the old version of spider instead of updates in the `x.py`. Have to remove `y.pyc` first. Thanks!
scrapy/scrapy
diff --git a/tests/test_spiderloader/__init__.py b/tests/test_spiderloader/__init__.py index b2ad93b3f..673a2d302 100644 --- a/tests/test_spiderloader/__init__.py +++ b/tests/test_spiderloader/__init__.py @@ -101,3 +101,55 @@ class SpiderLoaderTest(unittest.TestCase): spiders = spider_loader.list() self.assertEqual(spiders, []) + + +class DuplicateSpiderNameLoaderTest(unittest.TestCase): + + def setUp(self): + orig_spiders_dir = os.path.join(module_dir, 'test_spiders') + self.tmpdir = self.mktemp() + os.mkdir(self.tmpdir) + self.spiders_dir = os.path.join(self.tmpdir, 'test_spiders_xxx') + shutil.copytree(orig_spiders_dir, self.spiders_dir) + sys.path.append(self.tmpdir) + self.settings = Settings({'SPIDER_MODULES': ['test_spiders_xxx']}) + + def tearDown(self): + del sys.modules['test_spiders_xxx'] + sys.path.remove(self.tmpdir) + + def test_dupename_warning(self): + # copy 1 spider module so as to have duplicate spider name + shutil.copyfile(os.path.join(self.tmpdir, 'test_spiders_xxx/spider3.py'), + os.path.join(self.tmpdir, 'test_spiders_xxx/spider3dupe.py')) + + with warnings.catch_warnings(record=True) as w: + spider_loader = SpiderLoader.from_settings(self.settings) + + self.assertEqual(len(w), 1) + msg = str(w[0].message) + self.assertIn("several spiders with the same name", msg) + self.assertIn("'spider3'", msg) + + spiders = set(spider_loader.list()) + self.assertEqual(spiders, set(['spider1', 'spider2', 'spider3', 'spider4'])) + + def test_multiple_dupename_warning(self): + # copy 2 spider modules so as to have duplicate spider name + # This should issue 2 warning, 1 for each duplicate spider name + shutil.copyfile(os.path.join(self.tmpdir, 'test_spiders_xxx/spider1.py'), + os.path.join(self.tmpdir, 'test_spiders_xxx/spider1dupe.py')) + shutil.copyfile(os.path.join(self.tmpdir, 'test_spiders_xxx/spider2.py'), + os.path.join(self.tmpdir, 'test_spiders_xxx/spider2dupe.py')) + + with warnings.catch_warnings(record=True) as w: + spider_loader = SpiderLoader.from_settings(self.settings) + + self.assertEqual(len(w), 1) + msg = str(w[0].message) + self.assertIn("several spiders with the same name", msg) + self.assertIn("'spider1'", msg) + self.assertIn("'spider2'", msg) + + spiders = set(spider_loader.list()) + self.assertEqual(spiders, set(['spider1', 'spider2', 'spider3', 'spider4']))
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 0, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 1 }
1.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov" ], "pre_install": [ "apt-get update", "apt-get install -y gcc libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==25.3.0 Automat==24.8.1 cffi==1.17.1 constantly==23.10.4 coverage==7.8.0 cryptography==44.0.2 cssselect==1.3.0 exceptiongroup==1.2.2 hyperlink==21.0.0 idna==3.10 incremental==24.7.2 iniconfig==2.1.0 jmespath==1.0.1 lxml==5.3.1 packaging==24.2 parsel==1.10.0 pluggy==1.5.0 pyasn1==0.6.1 pyasn1_modules==0.4.2 pycparser==2.22 PyDispatcher==2.0.7 pyOpenSSL==25.0.0 pytest==8.3.5 pytest-cov==6.0.0 queuelib==1.7.0 -e git+https://github.com/scrapy/scrapy.git@7b49b9c0f53396ac89cbd74930bc4c6e41d41901#egg=Scrapy service-identity==24.2.0 six==1.17.0 tomli==2.2.1 Twisted==24.11.0 typing_extensions==4.13.0 w3lib==2.3.1 zope.interface==7.2
name: scrapy channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==25.3.0 - automat==24.8.1 - cffi==1.17.1 - constantly==23.10.4 - coverage==7.8.0 - cryptography==44.0.2 - cssselect==1.3.0 - exceptiongroup==1.2.2 - hyperlink==21.0.0 - idna==3.10 - incremental==24.7.2 - iniconfig==2.1.0 - jmespath==1.0.1 - lxml==5.3.1 - packaging==24.2 - parsel==1.10.0 - pluggy==1.5.0 - pyasn1==0.6.1 - pyasn1-modules==0.4.2 - pycparser==2.22 - pydispatcher==2.0.7 - pyopenssl==25.0.0 - pytest==8.3.5 - pytest-cov==6.0.0 - queuelib==1.7.0 - service-identity==24.2.0 - six==1.17.0 - tomli==2.2.1 - twisted==24.11.0 - typing-extensions==4.13.0 - w3lib==2.3.1 - zope-interface==7.2 prefix: /opt/conda/envs/scrapy
[ "tests/test_spiderloader/__init__.py::DuplicateSpiderNameLoaderTest::test_dupename_warning", "tests/test_spiderloader/__init__.py::DuplicateSpiderNameLoaderTest::test_multiple_dupename_warning" ]
[]
[ "tests/test_spiderloader/__init__.py::SpiderLoaderTest::test_bad_spider_modules_warning", "tests/test_spiderloader/__init__.py::SpiderLoaderTest::test_crawler_runner_loading", "tests/test_spiderloader/__init__.py::SpiderLoaderTest::test_find_by_request", "tests/test_spiderloader/__init__.py::SpiderLoaderTest::test_interface", "tests/test_spiderloader/__init__.py::SpiderLoaderTest::test_list", "tests/test_spiderloader/__init__.py::SpiderLoaderTest::test_load", "tests/test_spiderloader/__init__.py::SpiderLoaderTest::test_load_base_spider", "tests/test_spiderloader/__init__.py::SpiderLoaderTest::test_load_spider_module", "tests/test_spiderloader/__init__.py::SpiderLoaderTest::test_load_spider_module_multiple" ]
[]
BSD 3-Clause "New" or "Revised" License
1,050
[ "scrapy/spiderloader.py" ]
[ "scrapy/spiderloader.py" ]
Duke-GCB__DukeDSClient-116
759ef9203db06b482365c4d04d669b24bdeedcca
2017-03-02 16:17:10
bffebebd86d09f5924461959401ef3698b4e47d5
diff --git a/ddsc/core/ddsapi.py b/ddsc/core/ddsapi.py index f79d7bf..2039628 100644 --- a/ddsc/core/ddsapi.py +++ b/ddsc/core/ddsapi.py @@ -747,6 +747,26 @@ class DataServiceApi(object): } return self._put("/activities/" + activity_id, put_data) + def get_auth_providers(self): + """ + List Authentication Providers Lists Authentication Providers + Returns an array of auth provider details + :return: requests.Response containing the successful result + """ + return self._get_collection("/auth_providers", {}) + + def auth_provider_add_user(self, auth_provider_id, username): + """ + Transform an institutional affiliates UID, such as a Duke NetID, to a DDS specific user identity; + can be used by clients prior to calling DDS APIs that require a DDS user in the request payload. + Returns user details. Can be safely called multiple times. + :param auth_provider_id: str: auth provider who supports user adding + :param username: str: netid we wish to register with DukeDS + :return: requests.Response containing the successful result + """ + url = "/auth_providers/{}/affiliates/{}/dds_user/".format(auth_provider_id, username) + return self._post(url, {}) + class MultiJSONResponse(object): """ diff --git a/ddsc/ddsclient.py b/ddsc/ddsclient.py index 48b464e..a24d036 100644 --- a/ddsc/ddsclient.py +++ b/ddsc/ddsclient.py @@ -166,7 +166,7 @@ class AddUserCommand(object): username = args.username # username of person to give permissions, will be None if email is specified auth_role = args.auth_role # type of permission(project_admin) project = self.remote_store.fetch_remote_project(project_name, must_exist=True, include_children=False) - user = self.remote_store.lookup_user_by_email_or_username(email, username) + user = self.remote_store.lookup_or_register_user_by_email_or_username(email, username) self.remote_store.set_user_project_permission(project, user, auth_role) print(u'Gave user {} {} permissions for {}.'.format(user.full_name, auth_role, project_name)) @@ -191,7 +191,7 @@ class RemoveUserCommand(object): email = args.email # email of person to remove permissions from (None if username specified) username = args.username # username of person to remove permissions from (None if email is specified) project = self.remote_store.fetch_remote_project(project_name, must_exist=True, include_children=False) - user = self.remote_store.lookup_user_by_email_or_username(email, username) + user = self.remote_store.lookup_or_register_user_by_email_or_username(email, username) self.remote_store.revoke_user_project_permission(project, user) print(u'Removed permissions from user {} for project {}.'.format(user.full_name, project_name)) @@ -218,7 +218,7 @@ class ShareCommand(object): username = args.username # username of person to send email to, will be None if email is specified force_send = args.resend # is this a resend so we should force sending auth_role = args.auth_role # authorization role(project permissions) to give to the user - to_user = self.remote_store.lookup_user_by_email_or_username(email, username) + to_user = self.remote_store.lookup_or_register_user_by_email_or_username(email, username) try: dest_email = self.service.share(project_name, to_user, force_send, auth_role) print("Share email message sent to " + dest_email) @@ -256,7 +256,7 @@ class DeliverCommand(object): new_project_name = None if not skip_copy_project: new_project_name = self.get_new_project_name(project_name) - to_user = self.remote_store.lookup_user_by_email_or_username(email, username) + to_user = self.remote_store.lookup_or_register_user_by_email_or_username(email, username) try: path_filter = PathFilter(args.include_paths, args.exclude_paths) dest_email = self.service.deliver(project_name, new_project_name, to_user, force_send, path_filter)
For Share/Deliver, register users in DukeDS as needed The API to create a DukeDS user is at https://apidev.dataservice.duke.edu/apidocs/users_software_agents.html#auth-provider-affiliates-not_impl_new-create-or-get-user-account-for-affiliate-post, and while we can register users through this API, DukeDS will not automatically create new accounts until we call it. Since the [share/deliver actions in DukeDSClient](https://github.com/Duke-GCB/DukeDSClient/blob/master/ddsc/ddsclient.py#L260) already have a step to look up the user by email or netid, this would be a good time to register the user account if needed. I considered adding this step to D4S2, but D4S2 currently only deals with the UUIDs of existing users. It assumes the user has already been looked up. Thoughts?
Duke-GCB/DukeDSClient
diff --git a/ddsc/core/remotestore.py b/ddsc/core/remotestore.py index 6df761c..942cd88 100644 --- a/ddsc/core/remotestore.py +++ b/ddsc/core/remotestore.py @@ -34,7 +34,7 @@ class RemoteStore(object): self._add_project_children(project) else: if must_exist: - raise ValueError(u'There is no project with the name {}'.format(project_name).encode('utf-8')) + raise NotFoundError(u'There is no project with the name {}'.format(project_name).encode('utf-8')) return project def fetch_remote_project_by_id(self, id): @@ -68,10 +68,18 @@ class RemoteStore(object): for child in project_children.get_tree(): project.add_child(child) - def lookup_user_by_email_or_username(self, email, username): + def lookup_or_register_user_by_email_or_username(self, email, username): + """ + Lookup user by email or username. Only fill in one field. + For username it will try to register if not found. + :param email: str: email address of the user + :param username: netid of the user to find + :return: RemoteUser + """ if username: - return self.lookup_user_by_username(username) + return self.get_or_register_user_by_username(username) else: + # API doesn't support registering user by email address yet return self.lookup_user_by_email(email) def lookup_user_by_name(self, full_name): @@ -85,27 +93,72 @@ class RemoteStore(object): results = json_data['results'] found_cnt = len(results) if found_cnt == 0: - raise ValueError("User not found:" + full_name) + raise NotFoundError("User not found:" + full_name) elif found_cnt > 1: raise ValueError("Multiple users with name:" + full_name) user = RemoteUser(results[0]) if user.full_name.lower() != full_name.lower(): - raise ValueError("User not found:" + full_name) + raise NotFoundError("User not found:" + full_name) return user def lookup_user_by_username(self, username): """ Finds the single user who has this username or raises ValueError. :param username: str username we are looking for - :return: RemoteUser user we found + :return: RemoteUser: user we found """ matches = [user for user in self.fetch_all_users() if user.username == username] if not matches: - raise ValueError('Username not found: {}.'.format(username)) + raise NotFoundError('Username not found: {}.'.format(username)) if len(matches) > 1: raise ValueError('Multiple users with same username found: {}.'.format(username)) return matches[0] + def get_or_register_user_by_username(self, username): + """ + Try to lookup user by username. If not found try registering the user. + :param username: str: username to lookup + :return: RemoteUser: user we found + """ + try: + return self.lookup_user_by_username(username) + except NotFoundError: + return self.register_user_by_username(username) + + def register_user_by_username(self, username): + """ + Tries to register user with the first non-deprecated auth provider. + Raises ValueError if the data service doesn't have any non-deprecated providers. + :param username: str: netid of the user we are trying to register + :return: RemoteUser: user that was created for our netid + """ + current_providers = [prov.id for prov in self.get_auth_providers() if not prov.is_deprecated] + if not current_providers: + raise ValueError("Unable to register user: no non-deprecated providers found!") + auth_provider_id = current_providers[0] + return self._register_user_by_username(auth_provider_id, username) + + def _register_user_by_username(self, auth_provider_id, username): + """ + Tries to register a user who has a valid netid but isn't registered with DukeDS yet under auth_provider_id. + :param auth_provider_id: str: id from RemoteAuthProvider to use for registering + :param username: str: netid of the user we are trying to register + :return: RemoteUser: user that was created for our netid + """ + user_json = self.data_service.auth_provider_add_user(auth_provider_id, username).json() + return RemoteUser(user_json) + + def get_auth_providers(self): + """ + Return the list of authorization providers. + :return: [RemoteAuthProvider]: list of remote auth providers + """ + providers = [] + response = self.data_service.get_auth_providers().json() + for data in response['results']: + providers.append(RemoteAuthProvider(data)) + return providers + def lookup_user_by_email(self, email): """ Finds the single user who has this email or raises ValueError. @@ -458,3 +511,24 @@ class RemoteProjectChildren(object): file = RemoteFile(child_data, parent_path) children.append(file) return children + + +class RemoteAuthProvider(object): + def __init__(self, json_data): + """ + Set properties based on json_data. + :param json_data: dict JSON data containing auth_role info + """ + self.id = json_data['id'] + self.service_id = json_data['service_id'] + self.name = json_data['name'] + self.is_deprecated = json_data['is_deprecated'] + self.is_default = json_data['is_default'] + self.is_deprecated = json_data['is_deprecated'] + self.login_initiation_url = json_data['login_initiation_url'] + + +class NotFoundError(Exception): + def __init__(self, message): + Exception.__init__(self, message) + self.message = message diff --git a/ddsc/core/tests/test_ddsapi.py b/ddsc/core/tests/test_ddsapi.py index 0bb219e..5b19adc 100644 --- a/ddsc/core/tests/test_ddsapi.py +++ b/ddsc/core/tests/test_ddsapi.py @@ -10,6 +10,12 @@ def fake_response_with_pages(status_code, json_return_value, num_pages=1): return mock_response +def fake_response(status_code, json_return_value): + mock_response = MagicMock(status_code=status_code, headers={}) + mock_response.json.return_value = json_return_value + return mock_response + + class TestMultiJSONResponse(TestCase): """ Tests that we can merge multiple JSON responses arrays with a given name(merge_array_field_name). @@ -187,3 +193,43 @@ class TestDataServiceApi(TestCase): api = DataServiceApi(auth=None, url="something.com/v1/", http=mock_requests) resp = api._get_single_page(url_suffix='stuff', data={}, content_type=ContentType.json, page_num=1) self.assertEqual(True, resp.json()['ok']) + + def test_get_auth_providers(self): + provider = { + "id": "aca35ba3-a44a-47c2-8b3b-afe43a88360d", + "service_id": "cfde039d-f550-47e7-833c-9ebc4e257847", + "name": "Duke Authentication Service", + "is_deprecated": True, + "is_default": True, + "login_initiation_url": "https://someurl" + } + json_results = { + "results": [ + provider + ] + } + mock_requests = MagicMock() + mock_requests.get.side_effect = [ + fake_response_with_pages(status_code=200, json_return_value=json_results, num_pages=1) + ] + api = DataServiceApi(auth=None, url="something.com/v1", http=mock_requests) + result = api.get_auth_providers() + self.assertEqual(200, result.status_code) + self.assertEqual(json_results, result.json()) + self.assertEqual('something.com/v1/auth_providers', mock_requests.get.call_args_list[0][0][0]) + + def test_auth_provider_add_user(self): + user = { + "id": "abc4e9-9987-47eb-bb4e-19f0203efbf6", + "username": "joe", + } + mock_requests = MagicMock() + mock_requests.post.side_effect = [ + fake_response(status_code=200, json_return_value=user) + ] + api = DataServiceApi(auth=None, url="something.com/v1", http=mock_requests) + result = api.auth_provider_add_user('123', "joe") + self.assertEqual(200, result.status_code) + self.assertEqual(user, result.json()) + expected_url = 'something.com/v1/auth_providers/123/affiliates/joe/dds_user/' + self.assertEqual(expected_url, mock_requests.post.call_args_list[0][0][0]) diff --git a/ddsc/core/tests/test_remotestore.py b/ddsc/core/tests/test_remotestore.py index 524fcda..5a3a7fb 100644 --- a/ddsc/core/tests/test_remotestore.py +++ b/ddsc/core/tests/test_remotestore.py @@ -1,10 +1,12 @@ import json from unittest import TestCase - +from mock import MagicMock +from mock.mock import patch from ddsc.core.remotestore import RemoteProject, RemoteFolder, RemoteFile, RemoteUser from ddsc.core.remotestore import RemoteStore from ddsc.core.remotestore import RemoteAuthRole from ddsc.core.remotestore import RemoteProjectChildren +from ddsc.core.remotestore import RemoteAuthProvider class TestProjectFolderFile(TestCase): @@ -544,3 +546,76 @@ class TestReadRemoteHash(TestCase): hash_info = RemoteFile.get_hash_from_upload(upload) self.assertEqual(hash_info["value"], "aabbcc") self.assertEqual(hash_info["algorithm"], "md5") + + +class TestRemoteAuthProvider(TestCase): + def setUp(self): + self.provider_data1 = { + "id": "aca35ba3-a44a-47c2-8b3b-afe43a88360d", + "service_id": "cfde039d-f550-47e7-833c-9ebc4e257847", + "name": "Duke Authentication Service", + "is_deprecated": False, + "is_default": True, + "login_initiation_url": "https://someurl" + } + + def test_constructor(self): + auth_provider = RemoteAuthProvider(self.provider_data1) + self.assertEqual(auth_provider.id, "aca35ba3-a44a-47c2-8b3b-afe43a88360d") + self.assertEqual(auth_provider.service_id, "cfde039d-f550-47e7-833c-9ebc4e257847") + self.assertEqual(auth_provider.name, "Duke Authentication Service") + self.assertEqual(auth_provider.is_deprecated, False) + self.assertEqual(auth_provider.is_default, True) + self.assertEqual(auth_provider.login_initiation_url, "https://someurl") + + @patch("ddsc.core.remotestore.DataServiceApi") + def test_get_auth_providers(self, mock_data_service_api): + response = MagicMock() + response.json.return_value = { + "results": [self.provider_data1] + } + mock_data_service_api().get_auth_providers.return_value = response + remote_store = RemoteStore(MagicMock()) + providers = remote_store.get_auth_providers() + self.assertEqual(len(providers), 1) + self.assertEqual(providers[0].name, "Duke Authentication Service") + + @patch("ddsc.core.remotestore.DataServiceApi") + def test_register_user_by_username(self, mock_data_service_api): + providers_response = MagicMock() + providers_response.json.return_value = { + "results": [self.provider_data1] + } + add_user_response = MagicMock() + add_user_response.json.return_value = { + "id": "123", + "username": "joe", + "full_name": "Joe Shoe", + "email": "", + } + mock_data_service_api().get_auth_providers.return_value = providers_response + mock_data_service_api().auth_provider_add_user.return_value = add_user_response + remote_store = RemoteStore(MagicMock()) + user = remote_store.register_user_by_username("joe") + self.assertEqual(user.id, "123") + self.assertEqual(user.username, "joe") + mock_data_service_api().auth_provider_add_user.assert_called_with(self.provider_data1['id'], 'joe') + + @patch("ddsc.core.remotestore.DataServiceApi") + def test_register_user_by_username_with_no_default_provider(self, mock_data_service_api): + providers_response = MagicMock() + providers_response.json.return_value = { + "results": [] + } + add_user_response = MagicMock() + add_user_response.json.return_value = { + "id": "123", + "username": "joe", + "full_name": "Joe Shoe", + "email": "", + } + mock_data_service_api().get_auth_providers.return_value = providers_response + mock_data_service_api().auth_provider_add_user.return_value = add_user_response + remote_store = RemoteStore(MagicMock()) + with self.assertRaises(ValueError): + remote_store.register_user_by_username("joe")
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 2 }, "num_modified_files": 2 }
0.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "mock" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
-e git+https://github.com/Duke-GCB/DukeDSClient.git@759ef9203db06b482365c4d04d669b24bdeedcca#egg=DukeDSClient exceptiongroup==1.2.2 future==0.16.0 iniconfig==2.1.0 mock==5.2.0 packaging==24.2 pluggy==1.5.0 pytest==8.3.5 PyYAML==3.12 requests==2.13.0 six==1.10.0 tomli==2.2.1
name: DukeDSClient channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - exceptiongroup==1.2.2 - future==0.16.0 - iniconfig==2.1.0 - mock==5.2.0 - packaging==24.2 - pluggy==1.5.0 - pytest==8.3.5 - pyyaml==3.12 - requests==2.13.0 - six==1.10.0 - tomli==2.2.1 prefix: /opt/conda/envs/DukeDSClient
[ "ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_auth_provider_add_user", "ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_auth_providers" ]
[]
[ "ddsc/core/tests/test_ddsapi.py::TestMultiJSONResponse::test_pass_through_works_with_one_response", "ddsc/core/tests/test_ddsapi.py::TestMultiJSONResponse::test_pass_through_works_with_three_responses", "ddsc/core/tests/test_ddsapi.py::TestMultiJSONResponse::test_pass_through_works_with_two_responses", "ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_delete_raises_error_on_paging_response", "ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_collection_one_page", "ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_collection_three_pages", "ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_collection_two_pages", "ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_single_item_raises_error_on_paging_response", "ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_single_page_works_on_paging_response", "ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_post_raises_error_on_paging_response", "ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_put_raises_error_on_paging_response", "ddsc/core/tests/test_remotestore.py::TestProjectFolderFile::test_file_item", "ddsc/core/tests/test_remotestore.py::TestProjectFolderFile::test_file_item_new_version", "ddsc/core/tests/test_remotestore.py::TestProjectFolderFile::test_folder_item", "ddsc/core/tests/test_remotestore.py::TestProjectFolderFile::test_project_list_item", "ddsc/core/tests/test_remotestore.py::TestRemoteUser::test_parse_user", "ddsc/core/tests/test_remotestore.py::TestRemoteAuthRole::test_deprecated_system_role", "ddsc/core/tests/test_remotestore.py::TestRemoteAuthRole::test_parse_auth_role", "ddsc/core/tests/test_remotestore.py::TestRemoteStore::test_auth_roles_project", "ddsc/core/tests/test_remotestore.py::TestRemoteStore::test_auth_roles_system", "ddsc/core/tests/test_remotestore.py::TestRemoteProjectChildren::test_simple_case", "ddsc/core/tests/test_remotestore.py::TestRemoteProjectChildren::test_top_level_files", "ddsc/core/tests/test_remotestore.py::TestReadRemoteHash::test_new_way_one_item", "ddsc/core/tests/test_remotestore.py::TestReadRemoteHash::test_new_way_two_item", "ddsc/core/tests/test_remotestore.py::TestReadRemoteHash::test_old_way", "ddsc/core/tests/test_remotestore.py::TestRemoteAuthProvider::test_constructor", "ddsc/core/tests/test_remotestore.py::TestRemoteAuthProvider::test_get_auth_providers", "ddsc/core/tests/test_remotestore.py::TestRemoteAuthProvider::test_register_user_by_username", "ddsc/core/tests/test_remotestore.py::TestRemoteAuthProvider::test_register_user_by_username_with_no_default_provider" ]
[]
MIT License
1,051
[ "ddsc/ddsclient.py", "ddsc/core/ddsapi.py" ]
[ "ddsc/ddsclient.py", "ddsc/core/ddsapi.py" ]
Pylons__webob-309
8669fe335b54697f23a787f67da19552bc03d5c6
2017-03-02 18:36:17
b2e78a53af7abe866b90a532479cf5c0ae00301b
diff --git a/webob/request.py b/webob/request.py index 150dd37..923cce5 100644 --- a/webob/request.py +++ b/webob/request.py @@ -1629,8 +1629,9 @@ def _encode_multipart(vars, content_type, fout=None): w(b'--') wt(boundary) w(CRLF) - assert name is not None, 'Value associated with no name: %r' % value - wt('Content-Disposition: form-data; name="%s"' % name) + wt('Content-Disposition: form-data') + if name is not None: + wt('; name="%s"' % name) filename = None if getattr(value, 'filename', None): filename = value.filename @@ -1708,7 +1709,10 @@ class Transcoder(object): # transcode FieldStorage if PY2: def decode(b): - return b.decode(self.charset, self.errors) + if b is not None: + return b.decode(self.charset, self.errors) + else: + return b else: def decode(b): return b
multipart field names may be None I'm getting this stack trace. ``` Traceback (most recent call last): File "/home/bukzor/my/wsgi/app.py", line 11, in handler request = new_request(environ).decode('latin1') File "/usr/lib/pymodules/python2.6/webob/request.py", line 243, in decode fout = t.transcode_fs(fs, r._content_type_raw) File "/usr/lib/pymodules/python2.6/webob/request.py", line 1699, in transcode_fs field.name = decode(field.name) File "/usr/lib/pymodules/python2.6/webob/request.py", line 1696, in <lambda> decode = lambda b: b.decode(self.charset, self.errors) AttributeError: 'NoneType' object has no attribute 'decode' ``` The docstring for fieldStorage notes that "None can occur as a field name". webob should allow for this. You can use this little client to reproduce the issue: ``` python #!/usr/bin/env python [0/1878] import socket HOST = 'www.buck.dev.yelp.com' PATH = '/lil_brudder' PORT = 80 body = '''\ --FOO 123 --FOO--''' req = '''\ POST %s HTTP/1.0 Host: %s Content-Length: %s Content-Type: multipart/form-data; boundary=FOO %s ''' % (PATH, HOST, len(body), body) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((HOST, PORT)) sock.send(req) sock.close() ```
Pylons/webob
diff --git a/tests/test_request.py b/tests/test_request.py index de3b149..357a724 100644 --- a/tests/test_request.py +++ b/tests/test_request.py @@ -2618,6 +2618,20 @@ class TestRequest_functional(object): req2 = req2.decode('latin-1') assert body == req2.body + def test_none_field_name(self): + from webob.request import Request + body = b'--FOO\r\nContent-Disposition: form-data\r\n\r\n123\r\n--FOO--' + content_type = 'multipart/form-data; boundary=FOO' + environ = { + 'wsgi.input': BytesIO(body), + 'CONTENT_TYPE': content_type, + 'CONTENT_LENGTH': len(body), + 'REQUEST_METHOD': 'POST' + } + req = Request(environ) + req = req.decode('latin-1') + assert body == req.body + def test_broken_seek(self): # copy() should work even when the input has a broken seek method req = self._blankOne('/', method='POST',
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 1 }
1.7
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "coverage", "pytest-cov" ], "pre_install": null, "python": "3.6", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 coverage==6.2 importlib-metadata==4.8.3 iniconfig==1.1.1 packaging==21.3 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 pytest-cov==4.0.0 tomli==1.2.3 typing_extensions==4.1.1 -e git+https://github.com/Pylons/webob.git@8669fe335b54697f23a787f67da19552bc03d5c6#egg=WebOb zipp==3.6.0
name: webob channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - coverage==6.2 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-cov==4.0.0 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/webob
[ "tests/test_request.py::TestRequest_functional::test_none_field_name" ]
[]
[ "tests/test_request.py::TestRequestCommon::test_ctor_environ_getter_raises_WTF", "tests/test_request.py::TestRequestCommon::test_ctor_wo_environ_raises_WTF", "tests/test_request.py::TestRequestCommon::test_ctor_w_environ", "tests/test_request.py::TestRequestCommon::test_ctor_w_non_utf8_charset", "tests/test_request.py::TestRequestCommon::test_scheme", "tests/test_request.py::TestRequestCommon::test_body_file_getter", "tests/test_request.py::TestRequestCommon::test_body_file_getter_seekable", "tests/test_request.py::TestRequestCommon::test_body_file_getter_cache", "tests/test_request.py::TestRequestCommon::test_body_file_getter_unreadable", "tests/test_request.py::TestRequestCommon::test_body_file_setter_w_bytes", "tests/test_request.py::TestRequestCommon::test_body_file_setter_non_bytes", "tests/test_request.py::TestRequestCommon::test_body_file_deleter", "tests/test_request.py::TestRequestCommon::test_body_file_raw", "tests/test_request.py::TestRequestCommon::test_body_file_seekable_input_not_seekable", "tests/test_request.py::TestRequestCommon::test_body_file_seekable_input_is_seekable", "tests/test_request.py::TestRequestCommon::test_urlvars_getter_w_paste_key", "tests/test_request.py::TestRequestCommon::test_urlvars_getter_w_wsgiorg_key", "tests/test_request.py::TestRequestCommon::test_urlvars_getter_wo_keys", "tests/test_request.py::TestRequestCommon::test_urlvars_setter_w_paste_key", "tests/test_request.py::TestRequestCommon::test_urlvars_setter_w_wsgiorg_key", "tests/test_request.py::TestRequestCommon::test_urlvars_setter_wo_keys", "tests/test_request.py::TestRequestCommon::test_urlvars_deleter_w_paste_key", "tests/test_request.py::TestRequestCommon::test_urlvars_deleter_w_wsgiorg_key_non_empty_tuple", "tests/test_request.py::TestRequestCommon::test_urlvars_deleter_w_wsgiorg_key_empty_tuple", "tests/test_request.py::TestRequestCommon::test_urlvars_deleter_wo_keys", "tests/test_request.py::TestRequestCommon::test_urlargs_getter_w_paste_key", "tests/test_request.py::TestRequestCommon::test_urlargs_getter_w_wsgiorg_key", "tests/test_request.py::TestRequestCommon::test_urlargs_getter_wo_keys", "tests/test_request.py::TestRequestCommon::test_urlargs_setter_w_paste_key", "tests/test_request.py::TestRequestCommon::test_urlargs_setter_w_wsgiorg_key", "tests/test_request.py::TestRequestCommon::test_urlargs_setter_wo_keys", "tests/test_request.py::TestRequestCommon::test_urlargs_deleter_w_wsgiorg_key", "tests/test_request.py::TestRequestCommon::test_urlargs_deleter_w_wsgiorg_key_empty", "tests/test_request.py::TestRequestCommon::test_urlargs_deleter_wo_keys", "tests/test_request.py::TestRequestCommon::test_cookies_empty_environ", "tests/test_request.py::TestRequestCommon::test_cookies_is_mutable", "tests/test_request.py::TestRequestCommon::test_cookies_w_webob_parsed_cookies_matching_source", "tests/test_request.py::TestRequestCommon::test_cookies_w_webob_parsed_cookies_mismatched_source", "tests/test_request.py::TestRequestCommon::test_set_cookies", "tests/test_request.py::TestRequestCommon::test_body_getter", "tests/test_request.py::TestRequestCommon::test_body_setter_None", "tests/test_request.py::TestRequestCommon::test_body_setter_non_string_raises", "tests/test_request.py::TestRequestCommon::test_body_setter_value", "tests/test_request.py::TestRequestCommon::test_body_deleter_None", "tests/test_request.py::TestRequestCommon::test_json_body", "tests/test_request.py::TestRequestCommon::test_json_body_array", "tests/test_request.py::TestRequestCommon::test_text_body", "tests/test_request.py::TestRequestCommon::test__text_get_without_charset", "tests/test_request.py::TestRequestCommon::test__text_set_without_charset", "tests/test_request.py::TestRequestCommon::test_POST_not_POST_or_PUT", "tests/test_request.py::TestRequestCommon::test_POST_existing_cache_hit", "tests/test_request.py::TestRequestCommon::test_PUT_missing_content_type", "tests/test_request.py::TestRequestCommon::test_PATCH_missing_content_type", "tests/test_request.py::TestRequestCommon::test_POST_missing_content_type", "tests/test_request.py::TestRequestCommon::test_POST_json_no_content_type", "tests/test_request.py::TestRequestCommon::test_PUT_bad_content_type", "tests/test_request.py::TestRequestCommon::test_POST_multipart", "tests/test_request.py::TestRequestCommon::test_GET_reflects_query_string", "tests/test_request.py::TestRequestCommon::test_GET_updates_query_string", "tests/test_request.py::TestRequestCommon::test_cookies_wo_webob_parsed_cookies", "tests/test_request.py::TestRequestCommon::test_copy_get", "tests/test_request.py::TestRequestCommon::test_remove_conditional_headers_accept_encoding", "tests/test_request.py::TestRequestCommon::test_remove_conditional_headers_if_modified_since", "tests/test_request.py::TestRequestCommon::test_remove_conditional_headers_if_none_match", "tests/test_request.py::TestRequestCommon::test_remove_conditional_headers_if_range", "tests/test_request.py::TestRequestCommon::test_remove_conditional_headers_range", "tests/test_request.py::TestRequestCommon::test_is_body_readable_POST", "tests/test_request.py::TestRequestCommon::test_is_body_readable_PATCH", "tests/test_request.py::TestRequestCommon::test_is_body_readable_GET", "tests/test_request.py::TestRequestCommon::test_is_body_readable_unknown_method_and_content_length", "tests/test_request.py::TestRequestCommon::test_is_body_readable_special_flag", "tests/test_request.py::TestRequestCommon::test_cache_control_reflects_environ", "tests/test_request.py::TestRequestCommon::test_cache_control_updates_environ", "tests/test_request.py::TestRequestCommon::test_cache_control_set_dict", "tests/test_request.py::TestRequestCommon::test_cache_control_set_object", "tests/test_request.py::TestRequestCommon::test_cache_control_gets_cached", "tests/test_request.py::TestRequestCommon::test_call_application_calls_application", "tests/test_request.py::TestRequestCommon::test_call_application_provides_write", "tests/test_request.py::TestRequestCommon::test_call_application_closes_iterable_when_mixed_w_write_calls", "tests/test_request.py::TestRequestCommon::test_call_application_raises_exc_info", "tests/test_request.py::TestRequestCommon::test_call_application_returns_exc_info", "tests/test_request.py::TestRequestCommon::test_blank__method_subtitution", "tests/test_request.py::TestRequestCommon::test_blank__ctype_in_env", "tests/test_request.py::TestRequestCommon::test_blank__ctype_in_headers", "tests/test_request.py::TestRequestCommon::test_blank__ctype_as_kw", "tests/test_request.py::TestRequestCommon::test_blank__str_post_data_for_unsupported_ctype", "tests/test_request.py::TestRequestCommon::test_blank__post_urlencoded", "tests/test_request.py::TestRequestCommon::test_blank__post_multipart", "tests/test_request.py::TestRequestCommon::test_blank__post_files", "tests/test_request.py::TestRequestCommon::test_blank__post_file_w_wrong_ctype", "tests/test_request.py::TestRequestCommon::test_from_bytes_extra_data", "tests/test_request.py::TestRequestCommon::test_as_bytes_skip_body", "tests/test_request.py::TestBaseRequest::test_method", "tests/test_request.py::TestBaseRequest::test_http_version", "tests/test_request.py::TestBaseRequest::test_script_name", "tests/test_request.py::TestBaseRequest::test_path_info", "tests/test_request.py::TestBaseRequest::test_content_length_getter", "tests/test_request.py::TestBaseRequest::test_content_length_setter_w_str", "tests/test_request.py::TestBaseRequest::test_remote_user", "tests/test_request.py::TestBaseRequest::test_remote_addr", "tests/test_request.py::TestBaseRequest::test_query_string", "tests/test_request.py::TestBaseRequest::test_server_name", "tests/test_request.py::TestBaseRequest::test_server_port_getter", "tests/test_request.py::TestBaseRequest::test_server_port_setter_with_string", "tests/test_request.py::TestBaseRequest::test_uscript_name", "tests/test_request.py::TestBaseRequest::test_upath_info", "tests/test_request.py::TestBaseRequest::test_upath_info_set_unicode", "tests/test_request.py::TestBaseRequest::test_content_type_getter_no_parameters", "tests/test_request.py::TestBaseRequest::test_content_type_getter_w_parameters", "tests/test_request.py::TestBaseRequest::test_content_type_setter_w_None", "tests/test_request.py::TestBaseRequest::test_content_type_setter_existing_paramter_no_new_paramter", "tests/test_request.py::TestBaseRequest::test_content_type_deleter_clears_environ_value", "tests/test_request.py::TestBaseRequest::test_content_type_deleter_no_environ_value", "tests/test_request.py::TestBaseRequest::test_headers_getter", "tests/test_request.py::TestBaseRequest::test_headers_setter", "tests/test_request.py::TestBaseRequest::test_no_headers_deleter", "tests/test_request.py::TestBaseRequest::test_client_addr_xff_singleval", "tests/test_request.py::TestBaseRequest::test_client_addr_xff_multival", "tests/test_request.py::TestBaseRequest::test_client_addr_prefers_xff", "tests/test_request.py::TestBaseRequest::test_client_addr_no_xff", "tests/test_request.py::TestBaseRequest::test_client_addr_no_xff_no_remote_addr", "tests/test_request.py::TestBaseRequest::test_host_port_w_http_host_and_no_port", "tests/test_request.py::TestBaseRequest::test_host_port_w_http_host_and_standard_port", "tests/test_request.py::TestBaseRequest::test_host_port_w_http_host_and_oddball_port", "tests/test_request.py::TestBaseRequest::test_host_port_w_http_host_https_and_no_port", "tests/test_request.py::TestBaseRequest::test_host_port_w_http_host_https_and_standard_port", "tests/test_request.py::TestBaseRequest::test_host_port_w_http_host_https_and_oddball_port", "tests/test_request.py::TestBaseRequest::test_host_port_wo_http_host", "tests/test_request.py::TestBaseRequest::test_host_url_w_http_host_and_no_port", "tests/test_request.py::TestBaseRequest::test_host_url_w_http_host_and_standard_port", "tests/test_request.py::TestBaseRequest::test_host_url_w_http_host_and_oddball_port", "tests/test_request.py::TestBaseRequest::test_host_url_w_http_host_https_and_no_port", "tests/test_request.py::TestBaseRequest::test_host_url_w_http_host_https_and_standard_port", "tests/test_request.py::TestBaseRequest::test_host_url_w_http_host_https_and_oddball_port", "tests/test_request.py::TestBaseRequest::test_host_url_wo_http_host", "tests/test_request.py::TestBaseRequest::test_application_url", "tests/test_request.py::TestBaseRequest::test_path_url", "tests/test_request.py::TestBaseRequest::test_path", "tests/test_request.py::TestBaseRequest::test_path_qs_no_qs", "tests/test_request.py::TestBaseRequest::test_path_qs_w_qs", "tests/test_request.py::TestBaseRequest::test_url_no_qs", "tests/test_request.py::TestBaseRequest::test_url_w_qs", "tests/test_request.py::TestBaseRequest::test_relative_url_to_app_true_wo_leading_slash", "tests/test_request.py::TestBaseRequest::test_relative_url_to_app_true_w_leading_slash", "tests/test_request.py::TestBaseRequest::test_relative_url_to_app_false_other_w_leading_slash", "tests/test_request.py::TestBaseRequest::test_relative_url_to_app_false_other_wo_leading_slash", "tests/test_request.py::TestBaseRequest::test_path_info_pop_empty", "tests/test_request.py::TestBaseRequest::test_path_info_pop_just_leading_slash", "tests/test_request.py::TestBaseRequest::test_path_info_pop_non_empty_no_pattern", "tests/test_request.py::TestBaseRequest::test_path_info_pop_non_empty_w_pattern_miss", "tests/test_request.py::TestBaseRequest::test_path_info_pop_non_empty_w_pattern_hit", "tests/test_request.py::TestBaseRequest::test_path_info_pop_skips_empty_elements", "tests/test_request.py::TestBaseRequest::test_path_info_peek_empty", "tests/test_request.py::TestBaseRequest::test_path_info_peek_just_leading_slash", "tests/test_request.py::TestBaseRequest::test_path_info_peek_non_empty", "tests/test_request.py::TestBaseRequest::test_is_xhr_no_header", "tests/test_request.py::TestBaseRequest::test_is_xhr_header_miss", "tests/test_request.py::TestBaseRequest::test_is_xhr_header_hit", "tests/test_request.py::TestBaseRequest::test_host_getter_w_HTTP_HOST", "tests/test_request.py::TestBaseRequest::test_host_getter_wo_HTTP_HOST", "tests/test_request.py::TestBaseRequest::test_host_setter", "tests/test_request.py::TestBaseRequest::test_host_deleter_hit", "tests/test_request.py::TestBaseRequest::test_host_deleter_miss", "tests/test_request.py::TestBaseRequest::test_domain_nocolon", "tests/test_request.py::TestBaseRequest::test_domain_withcolon", "tests/test_request.py::TestBaseRequest::test_encget_raises_without_default", "tests/test_request.py::TestBaseRequest::test_encget_doesnt_raises_with_default", "tests/test_request.py::TestBaseRequest::test_encget_with_encattr", "tests/test_request.py::TestBaseRequest::test_encget_with_encattr_latin_1", "tests/test_request.py::TestBaseRequest::test_encget_no_encattr", "tests/test_request.py::TestBaseRequest::test_relative_url", "tests/test_request.py::TestBaseRequest::test_header_getter", "tests/test_request.py::TestBaseRequest::test_json_body", "tests/test_request.py::TestBaseRequest::test_host_get", "tests/test_request.py::TestBaseRequest::test_host_get_w_no_http_host", "tests/test_request.py::TestLegacyRequest::test_method", "tests/test_request.py::TestLegacyRequest::test_http_version", "tests/test_request.py::TestLegacyRequest::test_script_name", "tests/test_request.py::TestLegacyRequest::test_path_info", "tests/test_request.py::TestLegacyRequest::test_content_length_getter", "tests/test_request.py::TestLegacyRequest::test_content_length_setter_w_str", "tests/test_request.py::TestLegacyRequest::test_remote_user", "tests/test_request.py::TestLegacyRequest::test_remote_addr", "tests/test_request.py::TestLegacyRequest::test_query_string", "tests/test_request.py::TestLegacyRequest::test_server_name", "tests/test_request.py::TestLegacyRequest::test_server_port_getter", "tests/test_request.py::TestLegacyRequest::test_server_port_setter_with_string", "tests/test_request.py::TestLegacyRequest::test_uscript_name", "tests/test_request.py::TestLegacyRequest::test_upath_info", "tests/test_request.py::TestLegacyRequest::test_upath_info_set_unicode", "tests/test_request.py::TestLegacyRequest::test_content_type_getter_no_parameters", "tests/test_request.py::TestLegacyRequest::test_content_type_getter_w_parameters", "tests/test_request.py::TestLegacyRequest::test_content_type_setter_w_None", "tests/test_request.py::TestLegacyRequest::test_content_type_setter_existing_paramter_no_new_paramter", "tests/test_request.py::TestLegacyRequest::test_content_type_deleter_clears_environ_value", "tests/test_request.py::TestLegacyRequest::test_content_type_deleter_no_environ_value", "tests/test_request.py::TestLegacyRequest::test_headers_getter", "tests/test_request.py::TestLegacyRequest::test_headers_setter", "tests/test_request.py::TestLegacyRequest::test_no_headers_deleter", "tests/test_request.py::TestLegacyRequest::test_client_addr_xff_singleval", "tests/test_request.py::TestLegacyRequest::test_client_addr_xff_multival", "tests/test_request.py::TestLegacyRequest::test_client_addr_prefers_xff", "tests/test_request.py::TestLegacyRequest::test_client_addr_no_xff", "tests/test_request.py::TestLegacyRequest::test_client_addr_no_xff_no_remote_addr", "tests/test_request.py::TestLegacyRequest::test_host_port_w_http_host_and_no_port", "tests/test_request.py::TestLegacyRequest::test_host_port_w_http_host_and_standard_port", "tests/test_request.py::TestLegacyRequest::test_host_port_w_http_host_and_oddball_port", "tests/test_request.py::TestLegacyRequest::test_host_port_w_http_host_https_and_no_port", "tests/test_request.py::TestLegacyRequest::test_host_port_w_http_host_https_and_standard_port", "tests/test_request.py::TestLegacyRequest::test_host_port_w_http_host_https_and_oddball_port", "tests/test_request.py::TestLegacyRequest::test_host_port_wo_http_host", "tests/test_request.py::TestLegacyRequest::test_host_url_w_http_host_and_no_port", "tests/test_request.py::TestLegacyRequest::test_host_url_w_http_host_and_standard_port", "tests/test_request.py::TestLegacyRequest::test_host_url_w_http_host_and_oddball_port", "tests/test_request.py::TestLegacyRequest::test_host_url_w_http_host_https_and_no_port", "tests/test_request.py::TestLegacyRequest::test_host_url_w_http_host_https_and_standard_port", "tests/test_request.py::TestLegacyRequest::test_host_url_w_http_host_https_and_oddball_port", "tests/test_request.py::TestLegacyRequest::test_host_url_wo_http_host", "tests/test_request.py::TestLegacyRequest::test_application_url", "tests/test_request.py::TestLegacyRequest::test_path_url", "tests/test_request.py::TestLegacyRequest::test_path", "tests/test_request.py::TestLegacyRequest::test_path_qs_no_qs", "tests/test_request.py::TestLegacyRequest::test_path_qs_w_qs", "tests/test_request.py::TestLegacyRequest::test_url_no_qs", "tests/test_request.py::TestLegacyRequest::test_url_w_qs", "tests/test_request.py::TestLegacyRequest::test_relative_url_to_app_true_wo_leading_slash", "tests/test_request.py::TestLegacyRequest::test_relative_url_to_app_true_w_leading_slash", "tests/test_request.py::TestLegacyRequest::test_relative_url_to_app_false_other_w_leading_slash", "tests/test_request.py::TestLegacyRequest::test_relative_url_to_app_false_other_wo_leading_slash", "tests/test_request.py::TestLegacyRequest::test_path_info_pop_empty", "tests/test_request.py::TestLegacyRequest::test_path_info_pop_just_leading_slash", "tests/test_request.py::TestLegacyRequest::test_path_info_pop_non_empty_no_pattern", "tests/test_request.py::TestLegacyRequest::test_path_info_pop_non_empty_w_pattern_miss", "tests/test_request.py::TestLegacyRequest::test_path_info_pop_non_empty_w_pattern_hit", "tests/test_request.py::TestLegacyRequest::test_path_info_pop_skips_empty_elements", "tests/test_request.py::TestLegacyRequest::test_path_info_peek_empty", "tests/test_request.py::TestLegacyRequest::test_path_info_peek_just_leading_slash", "tests/test_request.py::TestLegacyRequest::test_path_info_peek_non_empty", "tests/test_request.py::TestLegacyRequest::test_is_xhr_no_header", "tests/test_request.py::TestLegacyRequest::test_is_xhr_header_miss", "tests/test_request.py::TestLegacyRequest::test_is_xhr_header_hit", "tests/test_request.py::TestLegacyRequest::test_host_getter_w_HTTP_HOST", "tests/test_request.py::TestLegacyRequest::test_host_getter_wo_HTTP_HOST", "tests/test_request.py::TestLegacyRequest::test_host_setter", "tests/test_request.py::TestLegacyRequest::test_host_deleter_hit", "tests/test_request.py::TestLegacyRequest::test_host_deleter_miss", "tests/test_request.py::TestLegacyRequest::test_encget_raises_without_default", "tests/test_request.py::TestLegacyRequest::test_encget_doesnt_raises_with_default", "tests/test_request.py::TestLegacyRequest::test_encget_with_encattr", "tests/test_request.py::TestLegacyRequest::test_encget_no_encattr", "tests/test_request.py::TestLegacyRequest::test_relative_url", "tests/test_request.py::TestLegacyRequest::test_header_getter", "tests/test_request.py::TestLegacyRequest::test_json_body", "tests/test_request.py::TestLegacyRequest::test_host_get_w_http_host", "tests/test_request.py::TestLegacyRequest::test_host_get_w_no_http_host", "tests/test_request.py::TestRequestConstructorWarnings::test_ctor_w_unicode_errors", "tests/test_request.py::TestRequestConstructorWarnings::test_ctor_w_decode_param_names", "tests/test_request.py::TestRequestWithAdhocAttr::test_adhoc_attrs_set", "tests/test_request.py::TestRequestWithAdhocAttr::test_adhoc_attrs_set_nonadhoc", "tests/test_request.py::TestRequestWithAdhocAttr::test_adhoc_attrs_get", "tests/test_request.py::TestRequestWithAdhocAttr::test_adhoc_attrs_get_missing", "tests/test_request.py::TestRequestWithAdhocAttr::test_adhoc_attrs_del", "tests/test_request.py::TestRequestWithAdhocAttr::test_adhoc_attrs_del_missing", "tests/test_request.py::TestRequest_functional::test_gets", "tests/test_request.py::TestRequest_functional::test_gets_with_query_string", "tests/test_request.py::TestRequest_functional::test_language_parsing1", "tests/test_request.py::TestRequest_functional::test_language_parsing2", "tests/test_request.py::TestRequest_functional::test_language_parsing3", "tests/test_request.py::TestRequest_functional::test_mime_parsing1", "tests/test_request.py::TestRequest_functional::test_mime_parsing2", "tests/test_request.py::TestRequest_functional::test_mime_parsing3", "tests/test_request.py::TestRequest_functional::test_accept_best_match", "tests/test_request.py::TestRequest_functional::test_from_mimeparse", "tests/test_request.py::TestRequest_functional::test_headers", "tests/test_request.py::TestRequest_functional::test_bad_cookie", "tests/test_request.py::TestRequest_functional::test_cookie_quoting", "tests/test_request.py::TestRequest_functional::test_path_quoting", "tests/test_request.py::TestRequest_functional::test_path_quoting_pct_encodes", "tests/test_request.py::TestRequest_functional::test_params", "tests/test_request.py::TestRequest_functional::test_copy_body", "tests/test_request.py::TestRequest_functional::test_already_consumed_stream", "tests/test_request.py::TestRequest_functional::test_broken_seek", "tests/test_request.py::TestRequest_functional::test_set_body", "tests/test_request.py::TestRequest_functional::test_broken_clen_header", "tests/test_request.py::TestRequest_functional::test_nonstr_keys", "tests/test_request.py::TestRequest_functional::test_authorization", "tests/test_request.py::TestRequest_functional::test_as_bytes", "tests/test_request.py::TestRequest_functional::test_as_text", "tests/test_request.py::TestRequest_functional::test_req_kw_none_val", "tests/test_request.py::TestRequest_functional::test_env_keys", "tests/test_request.py::TestRequest_functional::test_repr_nodefault", "tests/test_request.py::TestRequest_functional::test_request_noenviron_param", "tests/test_request.py::TestRequest_functional::test_unexpected_kw", "tests/test_request.py::TestRequest_functional::test_conttype_set_del", "tests/test_request.py::TestRequest_functional::test_headers2", "tests/test_request.py::TestRequest_functional::test_host_url", "tests/test_request.py::TestRequest_functional::test_path_info_p", "tests/test_request.py::TestRequest_functional::test_urlvars_property", "tests/test_request.py::TestRequest_functional::test_urlargs_property", "tests/test_request.py::TestRequest_functional::test_host_property", "tests/test_request.py::TestRequest_functional::test_body_property", "tests/test_request.py::TestRequest_functional::test_repr_invalid", "tests/test_request.py::TestRequest_functional::test_from_garbage_file", "tests/test_request.py::TestRequest_functional::test_from_file_patch", "tests/test_request.py::TestRequest_functional::test_from_bytes", "tests/test_request.py::TestRequest_functional::test_from_text", "tests/test_request.py::TestRequest_functional::test_blank", "tests/test_request.py::TestRequest_functional::test_post_does_not_reparse", "tests/test_request.py::TestRequest_functional::test_middleware_body", "tests/test_request.py::TestRequest_functional::test_body_file_noseek", "tests/test_request.py::TestRequest_functional::test_cgi_escaping_fix", "tests/test_request.py::TestRequest_functional::test_content_type_none", "tests/test_request.py::TestRequest_functional::test_body_file_seekable", "tests/test_request.py::TestRequest_functional::test_request_init", "tests/test_request.py::TestRequest_functional::test_request_query_and_POST_vars", "tests/test_request.py::TestRequest_functional::test_request_put", "tests/test_request.py::TestRequest_functional::test_request_patch", "tests/test_request.py::TestRequest_functional::test_call_WSGI_app", "tests/test_request.py::TestRequest_functional::test_call_WSGI_app_204", "tests/test_request.py::TestRequest_functional::test_call_WSGI_app_no_content_type", "tests/test_request.py::TestRequest_functional::test_get_response_catch_exc_info_true", "tests/test_request.py::TestFakeCGIBody::test_encode_multipart_value_type_options", "tests/test_request.py::TestFakeCGIBody::test_encode_multipart_no_boundary", "tests/test_request.py::TestFakeCGIBody::test_repr", "tests/test_request.py::TestFakeCGIBody::test_fileno", "tests/test_request.py::TestFakeCGIBody::test_iter", "tests/test_request.py::TestFakeCGIBody::test_readline", "tests/test_request.py::TestFakeCGIBody::test_read_bad_content_type", "tests/test_request.py::TestFakeCGIBody::test_read_urlencoded", "tests/test_request.py::TestFakeCGIBody::test_readable", "tests/test_request.py::Test_cgi_FieldStorage__repr__patch::test_with_file", "tests/test_request.py::Test_cgi_FieldStorage__repr__patch::test_without_file", "tests/test_request.py::TestLimitedLengthFile::test_fileno", "tests/test_request.py::Test_environ_from_url::test_environ_from_url", "tests/test_request.py::Test_environ_from_url::test_environ_from_url_highorder_path_info", "tests/test_request.py::Test_environ_from_url::test_fileupload_mime_type_detection", "tests/test_request.py::TestRequestMultipart::test_multipart_with_charset" ]
[]
null
1,052
[ "webob/request.py" ]
[ "webob/request.py" ]
networkx__networkx-2375
2111408257dc7a5da56d26a7db95a36fff31fe4d
2017-03-02 19:56:39
3f4fd85765bf2d88188cfd4c84d0707152e6cd1e
diff --git a/networkx/algorithms/bipartite/__init__.py b/networkx/algorithms/bipartite/__init__.py index f33c1d31a..7db5a174e 100644 --- a/networkx/algorithms/bipartite/__init__.py +++ b/networkx/algorithms/bipartite/__init__.py @@ -32,42 +32,21 @@ algorithm: True >>> bottom_nodes, top_nodes = bipartite.sets(B) -list(top_nodes) -[1, 2, 3, 4] -list(bottom_nodes) -['a', 'c', 'b'] - However, if the input graph is not connected, there are more than one possible -colorations. Thus, the following result is correct: - ->>> B.remove_edge(2,'c') ->>> nx.is_connected(B) -False ->>> bottom_nodes, top_nodes = bipartite.sets(B) - -list(top_nodes) -[1, 2, 4, 'c'] -list(bottom_nodes) -['a', 3, 'b'] +colorations. In the face of ambiguity, we refuse the temptation to guess and +raise an exc:`AmbiguousSolution` Exception. Using the "bipartite" node attribute, you can easily get the two node sets: >>> top_nodes = set(n for n,d in B.nodes(data=True) if d['bipartite']==0) >>> bottom_nodes = set(B) - top_nodes -list(top_nodes) -[1, 2, 3, 4] -list(bottom_nodes) -['a', 'c', 'b'] - So you can easily use the bipartite algorithms that require, as an argument, a container with all nodes that belong to one node set: >>> print(round(bipartite.density(B, bottom_nodes),2)) -0.42 +0.5 >>> G = bipartite.projected_graph(B, top_nodes) ->>> list(G.edges()) -[(1, 2), (1, 4)] All bipartite graph generators in NetworkX build bipartite graphs with the "bipartite" node attribute. Thus, you can use the same approach: diff --git a/networkx/algorithms/bipartite/basic.py b/networkx/algorithms/bipartite/basic.py index 917e18a1b..644dcf94a 100644 --- a/networkx/algorithms/bipartite/basic.py +++ b/networkx/algorithms/bipartite/basic.py @@ -139,20 +139,40 @@ def is_bipartite_node_set(G,nodes): return True -def sets(G): +def sets(G, top_nodes=None): """Returns bipartite node sets of graph G. - Raises an exception if the graph is not bipartite. + Raises an exception if the graph is not bipartite or if the input + graph is disconnected and thus more than one valid solution exists. Parameters ---------- G : NetworkX graph + top_nodes : container + + Container with all nodes in one bipartite node set. If not supplied + it will be computed. But if more than one solution exists an exception + will be raised. + Returns ------- (X,Y) : two-tuple of sets One set of nodes for each part of the bipartite graph. + Raises + ------ + AmbiguousSolution : Exception + + Raised if the input bipartite graph is disconnected and no container + with all nodes in one bipartite set is provided. When determining + the nodes in each bipartite set more than one valid solution is + possible if the input graph is disconnected. + + NetworkXError: Exception + + Raised if the input graph is not bipartite. + Examples -------- >>> from networkx.algorithms import bipartite @@ -166,10 +186,22 @@ def sets(G): See Also -------- color + """ - c = color(G) - X = set(n for n in c if c[n]) # c[n] == 1 - Y = set(n for n in c if not c[n]) # c[n] == 0 + if G.is_directed(): + is_connected = nx.is_weakly_connected + else: + is_connected = nx.is_connected + if top_nodes is not None: + X = set(top_nodes) + Y = set(G) - X + else: + if not is_connected(G): + msg = 'Disconnected graph: Ambiguous solution for bipartite sets.' + raise nx.AmbiguousSolution(msg) + c = color(G) + X = {n for n, is_top in c.items() if is_top} + Y = {n for n, is_top in c.items() if not is_top} return (X, Y) def density(B, nodes): diff --git a/networkx/algorithms/bipartite/covering.py b/networkx/algorithms/bipartite/covering.py index deb864a02..44fcbf914 100644 --- a/networkx/algorithms/bipartite/covering.py +++ b/networkx/algorithms/bipartite/covering.py @@ -55,6 +55,8 @@ def min_edge_cover(G, matching_algorithm=None): is bounded by the worst-case running time of the function ``matching_algorithm``. """ + if G.order() == 0: # Special case for the empty graph + return set() if matching_algorithm is None: matching_algorithm = hopcroft_karp_matching return _min_edge_cover(G, matching_algorithm=matching_algorithm) diff --git a/networkx/algorithms/bipartite/matching.py b/networkx/algorithms/bipartite/matching.py index 9c19738ab..85f40a6eb 100644 --- a/networkx/algorithms/bipartite/matching.py +++ b/networkx/algorithms/bipartite/matching.py @@ -53,7 +53,7 @@ __all__ = ['maximum_matching', 'hopcroft_karp_matching', 'eppstein_matching', INFINITY = float('inf') -def hopcroft_karp_matching(G): +def hopcroft_karp_matching(G, top_nodes=None): """Returns the maximum cardinality matching of the bipartite graph `G`. Parameters @@ -62,6 +62,12 @@ def hopcroft_karp_matching(G): Undirected bipartite graph + top_nodes : container + + Container with all nodes in one bipartite node set. If not supplied + it will be computed. But if more than one solution exists an exception + will be raised. + Returns ------- matches : dictionary @@ -70,6 +76,15 @@ def hopcroft_karp_matching(G): ``matches[v] == w`` if node `v` is matched to node `w`. Unmatched nodes do not occur as a key in mate. + Raises + ------ + AmbiguousSolution : Exception + + Raised if the input bipartite graph is disconnected and no container + with all nodes in one bipartite set is provided. When determining + the nodes in each bipartite set more than one valid solution is + possible if the input graph is disconnected. + Notes ----- @@ -125,7 +140,7 @@ def hopcroft_karp_matching(G): return True # Initialize the "global" variables that maintain state during the search. - left, right = bipartite_sets(G) + left, right = bipartite_sets(G, top_nodes) leftmatches = {v: None for v in left} rightmatches = {v: None for v in right} distances = {} @@ -153,7 +168,7 @@ def hopcroft_karp_matching(G): return dict(itertools.chain(leftmatches.items(), rightmatches.items())) -def eppstein_matching(G): +def eppstein_matching(G, top_nodes=None): """Returns the maximum cardinality matching of the bipartite graph `G`. Parameters @@ -162,6 +177,12 @@ def eppstein_matching(G): Undirected bipartite graph + top_nodes : container + + Container with all nodes in one bipartite node set. If not supplied + it will be computed. But if more than one solution exists an exception + will be raised. + Returns ------- matches : dictionary @@ -170,6 +191,15 @@ def eppstein_matching(G): ``matching[v] == w`` if node `v` is matched to node `w`. Unmatched nodes do not occur as a key in mate. + Raises + ------ + AmbiguousSolution : Exception + + Raised if the input bipartite graph is disconnected and no container + with all nodes in one bipartite set is provided. When determining + the nodes in each bipartite set more than one valid solution is + possible if the input graph is disconnected. + Notes ----- @@ -186,7 +216,7 @@ def eppstein_matching(G): """ # Due to its original implementation, a directed graph is needed # so that the two sets of bipartite nodes can be distinguished - left = bipartite_sets(G)[0] + left, right = bipartite_sets(G, top_nodes) G = nx.DiGraph(G.edges(left)) # initialize greedy matching (redundant, but faster than full search) matching = {} @@ -363,7 +393,7 @@ def _connected_by_alternating_paths(G, matching, targets): targets)} -def to_vertex_cover(G, matching): +def to_vertex_cover(G, matching, top_nodes=None): """Returns the minimum vertex cover corresponding to the given maximum matching of the bipartite graph `G`. @@ -381,6 +411,12 @@ def to_vertex_cover(G, matching): by, for example, :func:`maximum_matching`. The dictionary *must* represent the maximum matching. + top_nodes : container + + Container with all nodes in one bipartite node set. If not supplied + it will be computed. But if more than one solution exists an exception + will be raised. + Returns ------- @@ -388,6 +424,15 @@ def to_vertex_cover(G, matching): The minimum vertex cover in `G`. + Raises + ------ + AmbiguousSolution : Exception + + Raised if the input bipartite graph is disconnected and no container + with all nodes in one bipartite set is provided. When determining + the nodes in each bipartite set more than one valid solution is + possible if the input graph is disconnected. + Notes ----- @@ -412,7 +457,7 @@ def to_vertex_cover(G, matching): """ # This is a Python implementation of the algorithm described at # <https://en.wikipedia.org/wiki/K%C3%B6nig%27s_theorem_%28graph_theory%29#Proof>. - L, R = bipartite_sets(G) + L, R = bipartite_sets(G, top_nodes) # Let U be the set of unmatched vertices in the left vertex set. unmatched_vertices = set(G) - set(matching) U = unmatched_vertices & L diff --git a/networkx/exception.py b/networkx/exception.py index 01aec88b1..83190bdff 100644 --- a/networkx/exception.py +++ b/networkx/exception.py @@ -57,6 +57,17 @@ class NodeNotFound(NetworkXException): """Exception raised if requested node is not present in the graph""" +class AmbiguousSolution(NetworkXException): + """Raised if more than one valid solution exists for an intermediary step + of an algorithm. + + In the face of ambiguity, refuse the temptation to guess. + This may occur, for example, when trying to determine the + bipartite node sets in a disconnected bipartite graph when + computing bipartite matchings. + + """ + class ExceededMaxIterations(NetworkXException): """Raised if a loop iterates too many times without breaking.
Issues calculating max independent set `Python 2.7.11` `networkx 1.11` I have the following directed acyclic graph: ![DAG](https://cloud.githubusercontent.com/assets/7001223/15185853/c0cba98a-1768-11e6-9ef4-ae6f87dd59e4.png) I wanted to calculate the max independent set of the transitive closure of this DAG (the nodes colored in green). ``` python from networkx import Graph, DiGraph, transitive_closure from networkx.algorithms.bipartite import hopcroft_karp_matching, to_vertex_cover # Build the DAG G = DiGraph() G.add_edge("A", "C") G.add_edge("A", "B") G.add_edge("C", "E") G.add_edge("C", "D") G.add_edge("E", "G") G.add_edge("E", "F") G.add_edge("G", "I") G.add_edge("G", "H") tc = transitive_closure(G) btc = Graph() # Create a bipartite graph based on the transitive closure of G for v in tc.nodes_iter(): btc.add_node((0, v)) btc.add_node((1, v)) for u, v in tc.edges_iter(): btc.add_edge((0, u), (1, v)) matching = hopcroft_karp_matching(btc) vertex_cover = to_vertex_cover(btc, matching) independent_set = set(G) - {v for _, v in vertex_cover} ``` I am expecting independent set to be `set(['B', 'D', 'F', 'I', 'H'])` but it is `set(['A', 'B', 'D', 'F', 'I', 'H'])` instead. I am either doing something wrong, or there is a bug in the `to_vertex_cover` function. References: - http://cs.stackexchange.com/a/16829 - http://cs.stackexchange.com/a/10303/5323 - http://stackoverflow.com/a/10304235 - https://en.wikipedia.org/wiki/Hopcroft%E2%80%93Karp_algorithm - https://en.wikipedia.org/wiki/Dilworth's_theorem - https://en.wikipedia.org/wiki/K%C5%91nig%27s_theorem_(graph_theory) - Konig’s theorem proves an equivalence between a maximum matching and a minimum vertex cover in bipartite graphs. A minimum vertex cover is the complement of a maximum independent set for any graph
networkx/networkx
diff --git a/networkx/algorithms/bipartite/tests/test_basic.py b/networkx/algorithms/bipartite/tests/test_basic.py index ec4799865..d33fe6bc6 100644 --- a/networkx/algorithms/bipartite/tests/test_basic.py +++ b/networkx/algorithms/bipartite/tests/test_basic.py @@ -28,10 +28,30 @@ class TestBipartiteBasic: assert_true(bipartite.is_bipartite(G)) def test_bipartite_sets(self): + G = nx.path_graph(4) + X, Y = bipartite.sets(G) + assert_equal(X, {0, 2}) + assert_equal(Y, {1, 3}) + + def test_bipartite_sets_directed(self): + G = nx.path_graph(4) + D = G.to_directed() + X, Y = bipartite.sets(D) + assert_equal(X, {0, 2}) + assert_equal(Y, {1, 3}) + + def test_bipartite_sets_given_top_nodes(self): G=nx.path_graph(4) - X,Y=bipartite.sets(G) - assert_equal(X,set([0,2])) - assert_equal(Y,set([1,3])) + top_nodes = [0, 2] + X, Y = bipartite.sets(G, top_nodes) + assert_equal(X, {0, 2}) + assert_equal(Y, {1, 3}) + + @raises(nx.AmbiguousSolution) + def test_bipartite_sets_disconnected(self): + G = nx.path_graph(4) + G.add_edges_from([(5, 6), (6, 7)]) + X, Y = bipartite.sets(G) def test_is_bipartite_node_set(self): G=nx.path_graph(4) diff --git a/networkx/algorithms/bipartite/tests/test_generators.py b/networkx/algorithms/bipartite/tests/test_generators.py index 5ae64e4a9..41551c074 100644 --- a/networkx/algorithms/bipartite/tests/test_generators.py +++ b/networkx/algorithms/bipartite/tests/test_generators.py @@ -204,7 +204,7 @@ class TestGeneratorsBipartite(): def test_gnmk_random_graph(self): n = 10 m = 20 - edges = 100 + edges = 200 G = gnmk_random_graph(n, m, edges) assert_equal(len(G),30) assert_true(is_bipartite(G)) @@ -213,4 +213,3 @@ class TestGeneratorsBipartite(): assert_equal(set(range(n)),X) assert_equal(set(range(n,n+m)),Y) assert_equal(edges, len(list(G.edges()))) - diff --git a/networkx/algorithms/bipartite/tests/test_matching.py b/networkx/algorithms/bipartite/tests/test_matching.py index 890d46e60..c30582a19 100644 --- a/networkx/algorithms/bipartite/tests/test_matching.py +++ b/networkx/algorithms/bipartite/tests/test_matching.py @@ -11,7 +11,7 @@ import itertools import networkx as nx -from nose.tools import assert_true +from nose.tools import assert_true, assert_equal, raises from networkx.algorithms.bipartite.matching import eppstein_matching from networkx.algorithms.bipartite.matching import hopcroft_karp_matching @@ -30,12 +30,47 @@ class TestMatching(): vertices and the next six numbers are the right vertices. """ + self.simple_graph = nx.complete_bipartite_graph(2, 3) + self.simple_solution = {0: 2, 1: 3, 2: 0, 3: 1} + edges = [(0, 7), (0, 8), (2, 6), (2, 9), (3, 8), (4, 8), (4, 9), (5, 11)] + self.top_nodes = set(range(6)) self.graph = nx.Graph() self.graph.add_nodes_from(range(12)) self.graph.add_edges_from(edges) + # Example bipartite graph from issue 2127 + G = nx.Graph() + G.add_nodes_from([ + (1, 'C'), (1, 'B'), (0, 'G'), (1, 'F'), + (1, 'E'), (0, 'C'), (1, 'D'), (1, 'I'), + (0, 'A'), (0, 'D'), (0, 'F'), (0, 'E'), + (0, 'H'), (1, 'G'), (1, 'A'), (0, 'I'), + (0, 'B'), (1, 'H'), + ]) + G.add_edge((1, 'C'), (0, 'A')) + G.add_edge((1, 'B'), (0, 'A')) + G.add_edge((0, 'G'), (1, 'I')) + G.add_edge((0, 'G'), (1, 'H')) + G.add_edge((1, 'F'), (0, 'A')) + G.add_edge((1, 'F'), (0, 'C')) + G.add_edge((1, 'F'), (0, 'E')) + G.add_edge((1, 'E'), (0, 'A')) + G.add_edge((1, 'E'), (0, 'C')) + G.add_edge((0, 'C'), (1, 'D')) + G.add_edge((0, 'C'), (1, 'I')) + G.add_edge((0, 'C'), (1, 'G')) + G.add_edge((0, 'C'), (1, 'H')) + G.add_edge((1, 'D'), (0, 'A')) + G.add_edge((1, 'I'), (0, 'A')) + G.add_edge((1, 'I'), (0, 'E')) + G.add_edge((0, 'A'), (1, 'G')) + G.add_edge((0, 'A'), (1, 'H')) + G.add_edge((0, 'E'), (1, 'G')) + G.add_edge((0, 'E'), (1, 'H')) + self.disconnected_graph = G + def check_match(self, matching): """Asserts that the matching is what we expect from the bipartite graph constructed in the :meth:`setup` fixture. @@ -70,21 +105,67 @@ class TestMatching(): algorithm produces a maximum cardinality matching. """ - self.check_match(eppstein_matching(self.graph)) + self.check_match(eppstein_matching(self.graph, self.top_nodes)) def test_hopcroft_karp_matching(self): """Tests that the Hopcroft--Karp algorithm produces a maximum cardinality matching in a bipartite graph. """ - self.check_match(hopcroft_karp_matching(self.graph)) + self.check_match(hopcroft_karp_matching(self.graph, self.top_nodes)) def test_to_vertex_cover(self): """Test for converting a maximum matching to a minimum vertex cover.""" - matching = maximum_matching(self.graph) - vertex_cover = to_vertex_cover(self.graph, matching) + matching = maximum_matching(self.graph, self.top_nodes) + vertex_cover = to_vertex_cover(self.graph, matching, self.top_nodes) self.check_vertex_cover(vertex_cover) + def test_eppstein_matching_simple(self): + match = eppstein_matching(self.simple_graph) + assert_equal(match, self.simple_solution) + + def test_hopcroft_karp_matching_simple(self): + match = hopcroft_karp_matching(self.simple_graph) + assert_equal(match, self.simple_solution) + + @raises(nx.AmbiguousSolution) + def test_eppstein_matching_disconnected(self): + match = eppstein_matching(self.disconnected_graph) + + @raises(nx.AmbiguousSolution) + def test_hopcroft_karp_matching_disconnected(self): + match = hopcroft_karp_matching(self.disconnected_graph) + + def test_issue_2127(self): + """Test from issue 2127""" + # Build the example DAG + G = nx.DiGraph() + G.add_edge("A", "C") + G.add_edge("A", "B") + G.add_edge("C", "E") + G.add_edge("C", "D") + G.add_edge("E", "G") + G.add_edge("E", "F") + G.add_edge("G", "I") + G.add_edge("G", "H") + + tc = nx.transitive_closure(G) + btc = nx.Graph() + + # Create a bipartite graph based on the transitive closure of G + for v in tc.nodes(): + btc.add_node((0, v)) + btc.add_node((1, v)) + + for u, v in tc.edges(): + btc.add_edge((0, u), (1, v)) + + top_nodes = {n for n in btc if n[0]==0} + matching = hopcroft_karp_matching(btc, top_nodes) + vertex_cover = to_vertex_cover(btc, matching, top_nodes) + independent_set = set(G) - {v for _, v in vertex_cover} + assert_equal({'B', 'D', 'F', 'I', 'H'}, independent_set) + def test_eppstein_matching(): """Test in accordance to issue #1927"""
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_media", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 5 }
help
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "nose", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y libgdal-dev graphviz" ], "python": "3.6", "reqs_path": [ "requirements/default.txt", "requirements/test.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 decorator==5.1.1 importlib-metadata==4.8.3 iniconfig==1.1.1 -e git+https://github.com/networkx/networkx.git@2111408257dc7a5da56d26a7db95a36fff31fe4d#egg=networkx nose==1.3.7 packaging==21.3 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 tomli==1.2.3 typing_extensions==4.1.1 zipp==3.6.0
name: networkx channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - decorator==5.1.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - nose==1.3.7 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/networkx
[ "networkx/algorithms/bipartite/tests/test_basic.py::TestBipartiteBasic::test_is_bipartite", "networkx/algorithms/bipartite/tests/test_basic.py::TestBipartiteBasic::test_bipartite_color", "networkx/algorithms/bipartite/tests/test_basic.py::TestBipartiteBasic::test_not_bipartite_color", "networkx/algorithms/bipartite/tests/test_basic.py::TestBipartiteBasic::test_bipartite_directed", "networkx/algorithms/bipartite/tests/test_basic.py::TestBipartiteBasic::test_bipartite_sets", "networkx/algorithms/bipartite/tests/test_basic.py::TestBipartiteBasic::test_bipartite_sets_directed", "networkx/algorithms/bipartite/tests/test_basic.py::TestBipartiteBasic::test_bipartite_sets_given_top_nodes", "networkx/algorithms/bipartite/tests/test_basic.py::TestBipartiteBasic::test_bipartite_sets_disconnected", "networkx/algorithms/bipartite/tests/test_basic.py::TestBipartiteBasic::test_is_bipartite_node_set", "networkx/algorithms/bipartite/tests/test_basic.py::TestBipartiteBasic::test_bipartite_density", "networkx/algorithms/bipartite/tests/test_basic.py::TestBipartiteBasic::test_bipartite_degrees", "networkx/algorithms/bipartite/tests/test_basic.py::TestBipartiteBasic::test_bipartite_weighted_degrees", "networkx/algorithms/bipartite/tests/test_generators.py::TestGeneratorsBipartite::test_complete_bipartite_graph", "networkx/algorithms/bipartite/tests/test_generators.py::TestGeneratorsBipartite::test_configuration_model", "networkx/algorithms/bipartite/tests/test_generators.py::TestGeneratorsBipartite::test_havel_hakimi_graph", "networkx/algorithms/bipartite/tests/test_generators.py::TestGeneratorsBipartite::test_reverse_havel_hakimi_graph", "networkx/algorithms/bipartite/tests/test_generators.py::TestGeneratorsBipartite::test_alternating_havel_hakimi_graph", "networkx/algorithms/bipartite/tests/test_generators.py::TestGeneratorsBipartite::test_preferential_attachment", "networkx/algorithms/bipartite/tests/test_generators.py::TestGeneratorsBipartite::test_random_graph", "networkx/algorithms/bipartite/tests/test_generators.py::TestGeneratorsBipartite::test_gnmk_random_graph", "networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_eppstein_matching", "networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_hopcroft_karp_matching", "networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_to_vertex_cover", "networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_eppstein_matching_simple", "networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_hopcroft_karp_matching_simple", "networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_eppstein_matching_disconnected", "networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_hopcroft_karp_matching_disconnected", "networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_issue_2127", "networkx/algorithms/bipartite/tests/test_matching.py::test_eppstein_matching" ]
[ "networkx/algorithms/bipartite/tests/test_generators.py::test" ]
[]
[]
BSD 3-Clause
1,053
[ "networkx/exception.py", "networkx/algorithms/bipartite/matching.py", "networkx/algorithms/bipartite/__init__.py", "networkx/algorithms/bipartite/basic.py", "networkx/algorithms/bipartite/covering.py" ]
[ "networkx/exception.py", "networkx/algorithms/bipartite/matching.py", "networkx/algorithms/bipartite/__init__.py", "networkx/algorithms/bipartite/basic.py", "networkx/algorithms/bipartite/covering.py" ]
frictionlessdata__goodtables-py-177
3ea326ea948a50f0155257e2cf423f44c6fc363b
2017-03-03 07:39:59
3ea326ea948a50f0155257e2cf423f44c6fc363b
roll: @amercader please take a look
diff --git a/README.md b/README.md index 2fc94ba..5173225 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ Goodtables by default supports the following presets: - table - tables - datapackage +- datapackages #### Custom presets diff --git a/examples/datapackages.py b/examples/datapackages.py new file mode 100644 index 0000000..6545c9b --- /dev/null +++ b/examples/datapackages.py @@ -0,0 +1,9 @@ +from pprint import pprint +from goodtables import Inspector + +inspector = Inspector() +report = inspector.inspect([ + 'data/datapackages/valid/datapackage.json', + {'source': 'data/datapackages/invalid/datapackage.json'}, +], preset='datapackages') +pprint(report) diff --git a/examples/tables.py b/examples/tables.py index fba2af5..26e7ba0 100644 --- a/examples/tables.py +++ b/examples/tables.py @@ -3,7 +3,7 @@ from goodtables import Inspector inspector = Inspector() report = inspector.inspect([ + 'data/invalid.csv', {'source': 'data/valid.csv', 'schema': {'fields': [{'name': 'id'}, {'name': 'name'}]}}, - {'source': 'data/invalid.csv'}, ], preset='tables') pprint(report) diff --git a/features/datapackages.yml b/features/datapackages.yml new file mode 100644 index 0000000..bea1769 --- /dev/null +++ b/features/datapackages.yml @@ -0,0 +1,8 @@ +datapackages: + source: + - data/datapackages/valid/datapackage.json + - source: data/datapackages/invalid/datapackage.json + preset: datapackages + report: + - [3, 3, null, 'blank-row'] + - [4, 4, null, 'blank-row'] diff --git a/goodtables/inspector.py b/goodtables/inspector.py index 6d8be7b..70e6028 100644 --- a/goodtables/inspector.py +++ b/goodtables/inspector.py @@ -67,7 +67,9 @@ class Inspector(object): preset (str): dataset extraction preset supported presets: - table + - tables - datapackage + - datapackages options (dict): source options Returns: @@ -93,7 +95,7 @@ class Inspector(object): # Collect reports reports = [] - if not errors: + if tables: tasks = [] pool = ThreadPool(processes=len(tables)) for table in tables: diff --git a/goodtables/presets/__init__.py b/goodtables/presets/__init__.py index 91d2f3b..d5c24f4 100644 --- a/goodtables/presets/__init__.py +++ b/goodtables/presets/__init__.py @@ -5,5 +5,6 @@ from __future__ import absolute_import from __future__ import unicode_literals from .datapackage import datapackage +from .datapackages import datapackages from .table import table from .tables import tables diff --git a/goodtables/presets/datapackages.py b/goodtables/presets/datapackages.py new file mode 100644 index 0000000..408a36a --- /dev/null +++ b/goodtables/presets/datapackages.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +from __future__ import division +from __future__ import print_function +from __future__ import absolute_import +from __future__ import unicode_literals + +import six +from copy import deepcopy +from .datapackage import datapackage as datapackage_preset +from ..register import preset + + +# Module API + +@preset('datapackages') +def datapackages(items): + errors = [] + tables = [] + + # Add errors, tables + items = deepcopy(items) + for item in items: + if isinstance(item, six.string_types): + item_errors, item_tables = datapackage_preset(item) + else: + source = item.pop('source') + item_errors, item_tables = datapackage_preset(source, **item) + errors.extend(item_errors) + tables.extend(item_tables) + + return errors, tables diff --git a/goodtables/presets/tables.py b/goodtables/presets/tables.py index 581c538..6ef002b 100644 --- a/goodtables/presets/tables.py +++ b/goodtables/presets/tables.py @@ -4,6 +4,8 @@ from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals +import six +from copy import deepcopy from .table import table as table_preset from ..register import preset @@ -16,9 +18,13 @@ def tables(items): tables = [] # Add errors, tables + items = deepcopy(items) for item in items: - source = item.pop('source') - item_errors, item_tables = table_preset(source, **item) + if isinstance(item, six.string_types): + item_errors, item_tables = table_preset(item) + else: + source = item.pop('source') + item_errors, item_tables = table_preset(source, **item) errors.extend(item_errors) tables.extend(item_tables)
Add datapackages preset # Overview Required by https://github.com/frictionlessdata/goodtables.io/issues/17
frictionlessdata/goodtables-py
diff --git a/tests/presets/test_datapackages.py b/tests/presets/test_datapackages.py new file mode 100644 index 0000000..6ca1ce7 --- /dev/null +++ b/tests/presets/test_datapackages.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import division +from __future__ import print_function +from __future__ import absolute_import +from __future__ import unicode_literals + +from goodtables import presets + + +# Test + +def test_datapackages(): + errors, tables = presets.datapackages([ + 'data/datapackages/valid/datapackage.json', + {'source': 'data/datapackages/invalid/datapackage.json'}, + ]) + assert len(errors) == 0 + assert len(tables) == 4 diff --git a/tests/presets/test_tables.py b/tests/presets/test_tables.py new file mode 100644 index 0000000..4aedfcc --- /dev/null +++ b/tests/presets/test_tables.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import division +from __future__ import print_function +from __future__ import absolute_import +from __future__ import unicode_literals + +from goodtables import presets + + +# Test + +def test_tables(): + errors, tables = presets.tables([ + 'data/valid.csv', + {'source': 'data/invalid.csv'}, + ]) + assert len(errors) == 0 + assert len(tables) == 2
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks", "has_added_files", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 3, "test_score": 3 }, "num_modified_files": 5 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install --upgrade -e .[develop,ods]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "mock", "pyyaml", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work cchardet==1.1.3 certifi==2021.5.30 charset-normalizer==2.0.12 click==6.7 datapackage==0.8.8 distlib==0.3.9 et-xmlfile==1.1.0 ezodf==0.3.2 filelock==3.4.1 future==0.18.3 -e git+https://github.com/frictionlessdata/goodtables-py.git@3ea326ea948a50f0155257e2cf423f44c6fc363b#egg=goodtables idna==3.10 ijson==2.6.1 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work isodate==0.6.1 jdcal==1.4.1 jsonlines==1.2.0 jsonschema==2.6.0 jsontableschema==0.10.0 linear-tsv==1.1.0 lxml==3.8.0 mccabe==0.7.0 mock==5.2.0 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work openpyxl==2.6.4 packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work platformdirs==2.4.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work pycodestyle==2.10.0 pydocstyle==6.3.0 pyflakes==3.0.1 pylama==7.7.1 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 python-dateutil==2.9.0.post0 PyYAML==6.0.1 requests==2.27.1 rfc3986==0.4.1 six==1.17.0 snowballstemmer==2.2.0 tabulator==0.15.1 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tox==3.28.0 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work unicodecsv==0.14.1 urllib3==1.26.20 virtualenv==20.17.1 xlrd==1.2.0 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: goodtables-py channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - cchardet==1.1.3 - charset-normalizer==2.0.12 - click==6.7 - datapackage==0.8.8 - distlib==0.3.9 - et-xmlfile==1.1.0 - ezodf==0.3.2 - filelock==3.4.1 - future==0.18.3 - idna==3.10 - ijson==2.6.1 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - isodate==0.6.1 - jdcal==1.4.1 - jsonlines==1.2.0 - jsonschema==2.6.0 - jsontableschema==0.10.0 - linear-tsv==1.1.0 - lxml==3.8.0 - mccabe==0.7.0 - mock==5.2.0 - openpyxl==2.6.4 - platformdirs==2.4.0 - pycodestyle==2.10.0 - pydocstyle==6.3.0 - pyflakes==3.0.1 - pylama==7.7.1 - python-dateutil==2.9.0.post0 - pyyaml==6.0.1 - requests==2.27.1 - rfc3986==0.4.1 - six==1.17.0 - snowballstemmer==2.2.0 - tabulator==0.15.1 - tox==3.28.0 - unicodecsv==0.14.1 - urllib3==1.26.20 - virtualenv==20.17.1 - xlrd==1.2.0 prefix: /opt/conda/envs/goodtables-py
[ "tests/presets/test_datapackages.py::test_datapackages", "tests/presets/test_tables.py::test_tables" ]
[]
[]
[]
MIT License
1,054
[ "examples/tables.py", "examples/datapackages.py", "goodtables/presets/datapackages.py", "goodtables/presets/tables.py", "features/datapackages.yml", "goodtables/presets/__init__.py", "README.md", "goodtables/inspector.py" ]
[ "examples/tables.py", "examples/datapackages.py", "goodtables/presets/datapackages.py", "goodtables/presets/tables.py", "features/datapackages.yml", "goodtables/presets/__init__.py", "README.md", "goodtables/inspector.py" ]
imageio__imageio-236
7df104500646d0cf7dd143aec698ef9ce77b7005
2017-03-03 10:49:39
48e81976e70f2c4795dfdd105d8115bc53f66a11
diff --git a/imageio/plugins/_tifffile.py b/imageio/plugins/_tifffile.py index 6072ace..5d87f70 100644 --- a/imageio/plugins/_tifffile.py +++ b/imageio/plugins/_tifffile.py @@ -1,9 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # tifffile.py +# styletest: skip -# Copyright (c) 2008-2017, Christoph Gohlke -# Copyright (c) 2008-2017, The Regents of the University of California +# Copyright (c) 2008-2016, Christoph Gohlke +# Copyright (c) 2008-2016, The Regents of the University of California # Produced at the Laboratory for Fluorescence Dynamics # All rights reserved. # @@ -58,45 +59,18 @@ For command line usage run `python tifffile.py --help` :Organization: Laboratory for Fluorescence Dynamics, University of California, Irvine -:Version: 2017.01.12 +:Version: 2016.04.18 Requirements ------------ -* `CPython 2.7 or 3.5 <http://www.python.org>`_ (64-bit recommended) -* `Numpy 1.11 <http://www.numpy.org>`_ +* `CPython 2.7 or 3.5 <http://www.python.org>`_ (64 bit recommended) +* `Numpy 1.10 <http://www.numpy.org>`_ * `Matplotlib 1.5 <http://www.matplotlib.org>`_ (optional for plotting) -* `Tifffile.c 2017.01.10 <http://www.lfd.uci.edu/~gohlke/>`_ +* `Tifffile.c 2016.04.13 <http://www.lfd.uci.edu/~gohlke/>`_ (recommended for faster decoding of PackBits and LZW encoded strings) Revisions --------- -2017.01.12 - Read Zeiss SEM metadata. - Read OME-TIFF with invalid references to external files. - Rewrite C LZW decoder (5x faster). - Read corrupted LSM files missing EOI code in LZW stream. -2017.01.01 - Add option to append images to existing TIFF files. - Read files without pages. - Read S-FEG and Helios NanoLab tags created by FEI software. - Allow saving Color Filter Array (CFA) images. - Add info functions returning more information about TiffFile and TiffPage. - Add option to read specific pages only. - Remove maxpages argument (backwards incompatible). - Remove test_tifffile function. -2016.10.28 - Pass 1944 tests. - Improve detection of ImageJ hyperstacks. - Read TVIPS metadata created by EM-MENU (by Marco Oster). - Add option to disable using OME-XML metadata. - Allow non-integer range attributes in modulo tags (by Stuart Berg). -2016.06.21 - Do not always memmap contiguous data in page series. -2016.05.13 - Add option to specify resolution unit. - Write grayscale images with extra samples when planarconfig is specified. - Do not write RGB color images with 2 samples. - Reorder TiffWriter.save keyword arguments (backwards incompatible). 2016.04.18 Pass 1932 tests. TiffWriter, imread, and imsave accept open binary file streams. @@ -104,7 +78,7 @@ Revisions Correctly handle reversed fill order in 2 and 4 bps images (bug fix). Implement reverse_bitorder in C. 2016.03.18 - Fix saving additional ImageJ metadata. + Fixed saving additional ImageJ metadata. 2016.02.22 Pass 1920 tests. Write 8 bytes double tag values using offset if necessary (bug fix). @@ -151,7 +125,7 @@ Revisions Rename decoder functions (backwards incompatible) 2014.08.24 TiffWriter class for incremental writing images. - Simplify examples. + Simplified examples. 2014.08.19 Add memmap function to FileHandle. Add function to determine if image data in TiffPage is memory-mappable. @@ -206,7 +180,6 @@ Tested on little-endian platforms only. Other Python packages and modules for reading bio-scientific TIFF files: -* `python-bioformats <https://github.com/CellProfiler/python-bioformats>`_ * `Imread <https://github.com/luispedro/imread>`_ * `PyLibTiff <https://github.com/pearu/pylibtiff>`_ * `SimpleITK <http://www.simpleitk.org>`_ @@ -214,7 +187,8 @@ Other Python packages and modules for reading bio-scientific TIFF files: * `PyMca.TiffIO.py <https://github.com/vasole/pymca>`_ (same as fabio.TiffIO) * `BioImageXD.Readers <http://www.bioimagexd.net/>`_ * `Cellcognition.io <http://cellcognition.org/>`_ -* `pymimage <https://github.com/ardoi/pymimage>`_ +* `CellProfiler.bioformats + <https://github.com/CellProfiler/python-bioformats>`_ Acknowledgements ---------------- @@ -288,7 +262,19 @@ except ImportError: except ImportError: lzma = None -__version__ = '2017.01.12' +try: + if __package__: + from . import _tifffile # noqa + else: + import _tifffile # noqa +except ImportError: + warnings.warn( + "failed to import the optional _tifffile C extension module.\n" + "Loading of some compressed images will be very slow.\n" + "Tifffile.c can be obtained at http://www.lfd.uci.edu/~gohlke/") + + +__version__ = '2016.04.18' __docformat__ = 'restructuredtext en' __all__ = ( 'imsave', 'imread', 'imshow', 'TiffFile', 'TiffWriter', 'TiffSequence', @@ -309,8 +295,8 @@ def imsave(file, data, **kwargs): Input image. The last dimensions are assumed to be image depth, height, width, and samples. kwargs : dict - Parameters 'append', 'byteorder', 'bigtiff', 'software', and 'imagej', - are passed to the TiffWriter class. + Parameters 'byteorder', 'bigtiff', 'software', and 'imagej', are passed + to the TiffWriter class. Parameters 'photometric', 'planarconfig', 'resolution', 'compress', 'colormap', 'tile', 'description', 'datetime', 'metadata', 'contiguous' and 'extratags' are passed to the TiffWriter.save function. @@ -321,8 +307,11 @@ def imsave(file, data, **kwargs): >>> imsave('temp.tif', data, compress=6, metadata={'axes': 'TZCYX'}) """ - tifargs = parse_kwargs(kwargs, 'append', 'bigtiff', 'byteorder', - 'software', 'imagej') + tifargs = {} + for key in ('byteorder', 'bigtiff', 'software', 'imagej'): + if key in kwargs: + tifargs[key] = kwargs[key] + del kwargs[key] if 'bigtiff' not in tifargs and 'imagej' not in tifargs and ( data.size*data.dtype.itemsize > 2000*2**20): @@ -336,7 +325,7 @@ class TiffWriter(object): """Write image data to TIFF file. TiffWriter instances must be closed using the 'close' method, which is - automatically called when using the 'with' context manager. + automatically called when using the 'with' statement. Examples -------- @@ -347,7 +336,7 @@ class TiffWriter(object): """ TYPES = {'B': 1, 's': 2, 'H': 3, 'I': 4, '2I': 5, 'b': 6, - 'h': 8, 'i': 9, '2i': 10, 'f': 11, 'd': 12, 'Q': 16, 'q': 17} + 'h': 8, 'i': 9, 'f': 11, 'd': 12, 'Q': 16, 'q': 17} TAGS = { 'new_subfile_type': 254, 'subfile_type': 255, 'image_width': 256, 'image_length': 257, 'bits_per_sample': 258, @@ -362,11 +351,10 @@ class TiffWriter(object): 'smin_sample_value': 340, 'smax_sample_value': 341, 'image_depth': 32997, 'tile_depth': 32998} - def __init__(self, file, append=False, bigtiff=False, byteorder=None, + def __init__(self, file, bigtiff=False, byteorder=None, software='tifffile.py', imagej=False): """Open a TIFF file for writing. - Existing files are overwritten by default. Use bigtiff=True when creating files larger than 2 GB. Parameters @@ -374,12 +362,6 @@ class TiffWriter(object): file : str, binary stream, or FileHandle File name or writable binary stream, such as a open file or BytesIO. - The file is created if it does not exist. - append : bool - If True and 'file' is an existing standard TIFF file, image data - and tags are appended to the file. - Appending data may corrupt specifically formatted TIFF files - such as LSM, STK, ImageJ, NIH, or FluoView. bigtiff : bool If True, the BigTIFF format is used. byteorder : {'<', '>'} @@ -399,31 +381,6 @@ class TiffWriter(object): The ImageJ file format is undocumented. """ - if append: - # determine if file is an existing TIFF file that can be extended - try: - with FileHandle(file, mode='rb', size=0) as fh: - pos = fh.tell() - try: - with TiffFile(fh, pages=[0]) as tif: - if (append != 'force' and - any(getattr(tif, 'is_'+a) for a in - ('lsm', 'stk', 'imagej', 'nih', 'fluoview', - 'micromanager'))): - raise ValueError("contains metadata") - byteorder = tif.byteorder - bigtiff = tif.is_bigtiff - imagej = tif.is_imagej - self._ifd_offset = tif._ifd_offset - if tif.pages: - software = None - except Exception as e: - raise ValueError("can not append to file: %s" % str(e)) - finally: - fh.seek(pos) - except (IOError, FileNotFoundError): - append = False - if byteorder not in (None, '<', '>'): raise ValueError("invalid byteorder %s" % byteorder) if byteorder is None: @@ -449,6 +406,9 @@ class TiffWriter(object): self._data_byte_counts = None # byte counts per plane self._tag_offsets = None # strip or tile offset tag code + self._fh = FileHandle(file, mode='wb', size=0) + self._fh.write({'<': b'II', '>': b'MM'}[byteorder]) + if bigtiff: self._bigtiff = True self._offset_size = 8 @@ -456,6 +416,7 @@ class TiffWriter(object): self._numtag_format = 'Q' self._offset_format = 'Q' self._value_format = '8s' + self._fh.write(struct.pack(byteorder+'HHH', 43, 8, 0)) else: self._bigtiff = False self._offset_size = 4 @@ -463,25 +424,15 @@ class TiffWriter(object): self._numtag_format = 'H' self._offset_format = 'I' self._value_format = '4s' + self._fh.write(struct.pack(byteorder+'H', 42)) - if append: - self._fh = FileHandle(file, mode='r+b', size=0) - self._fh.seek(0, 2) - else: - self._fh = FileHandle(file, mode='wb', size=0) - self._fh.write({'<': b'II', '>': b'MM'}[byteorder]) - if bigtiff: - self._fh.write(struct.pack(byteorder+'HHH', 43, 8, 0)) - else: - self._fh.write(struct.pack(byteorder+'H', 42)) - # first IFD - self._ifd_offset = self._fh.tell() - self._fh.write(struct.pack(byteorder+self._offset_format, 0)) - - def save(self, data, photometric=None, planarconfig=None, tile=None, - contiguous=True, compress=0, colormap=None, - description=None, datetime=None, resolution=None, - metadata={}, extratags=()): + # first IFD + self._ifd_offset = self._fh.tell() + self._fh.write(struct.pack(byteorder+self._offset_format, 0)) + + def save(self, data, photometric=None, planarconfig=None, resolution=None, + compress=0, colormap=None, tile=None, datetime=None, + description=None, metadata={}, contiguous=True, extratags=()): """Write image data and tags to TIFF file. Image data are written in one stripe per plane by default. @@ -498,30 +449,19 @@ class TiffWriter(object): If a colormap is provided, the dtype must be uint8 or uint16 and the data values are indices into the last dimension of the colormap. - photometric : {'minisblack', 'miniswhite', 'rgb', 'palette', 'cfa'} + photometric : {'minisblack', 'miniswhite', 'rgb', 'palette'} The color space of the image data. By default this setting is inferred from the data shape and the value of colormap. - For CFA images, DNG tags must be specified in extratags. planarconfig : {'contig', 'planar'} Specifies if samples are stored contiguous or in separate planes. By default this setting is inferred from the data shape. - If this parameter is set, extra samples are used to store grayscale - images. 'contig': last dimension contains samples. 'planar': third last dimension contains samples. - tile : tuple of int - The shape (depth, length, width) of image tiles to write. - If None (default), image data are written in one stripe per plane. - The tile length and width must be a multiple of 16. - If the tile depth is provided, the SGI image_depth and tile_depth - tags are used to save volume data. Few software can read the - SGI format, e.g. MeVisLab. - contiguous : bool - If True (default) and the data and parameters are compatible with - previous ones, if any, the data are stored contiguously after - the previous one. Parameters 'photometric' and 'planarconfig' are - ignored. + resolution : (float, float, [str]) or ((int, int), (int, int), [str]) + X and Y resolution in dots per inch as float or rational numbers. + The resolution unit defaults to 'inch' but can also be set to + 'none' or 'cm'. compress : int or 'lzma' Values from 0 to 9 controlling the level of zlib compression. If 0, data are written uncompressed (default). @@ -531,21 +471,28 @@ class TiffWriter(object): colormap : numpy.ndarray RGB color values for the corresponding data value. Must be of shape (3, 2**(data.itemsize*8)) and dtype uint16. - description : str - The subject of the image. Saved with the first page only. - Cannot be used with the ImageJ format. + tile : tuple of int + The shape (depth, length, width) of image tiles to write. + If None (default), image data are written in one stripe per plane. + The tile length and width must be a multiple of 16. + If the tile depth is provided, the SGI image_depth and tile_depth + tags are used to save volume data. Few software can read the + SGI format, e.g. MeVisLab. datetime : datetime Date and time of image creation. Saved with the first page only. If None (default), the current date and time is used. - resolution : (float, float[, str]) or ((int, int), (int, int)[, str]) - X and Y resolutions in pixels per resolution unit as float or - rational numbers. - A third, optional parameter specifies the resolution unit, - which must be None (default for ImageJ), 'inch' (default), or 'cm'. + description : str + The subject of the image. Saved with the first page only. + Cannot be used with the ImageJ format. metadata : dict Additional meta data to be saved along with shape information in JSON or ImageJ formats in an image_description tag. - If None, do not write a second image_description tag. + If None, do not write second image_description tag. + contiguous : bool + If True (default) and the data and parameters are compatible with + previous ones, if any, the data are stored contiguously after + the previous one. Parameters 'photometric' and 'planarconfig' are + ignored. extratags : sequence of tuples Additional tags as [(code, dtype, count, value, writeonce)]. @@ -553,7 +500,7 @@ class TiffWriter(object): The TIFF tag Id. dtype : str Data type of items in 'value' in Python struct format. - One of B, s, H, I, 2I, b, h, i, 2i, f, d, Q, or q. + One of B, s, H, I, 2I, b, h, i, f, d, Q, or q. count : int Number of data values. Not used for string values. value : sequence @@ -572,8 +519,6 @@ class TiffWriter(object): tag_size = self._tag_size data = numpy.asarray(data, dtype=byteorder+data.dtype.char, order='C') - if data.size == 0: - raise ValueError("can not save empty array") # just append contiguous data if possible if self._data_shape: @@ -602,7 +547,7 @@ class TiffWriter(object): return if photometric not in (None, 'minisblack', 'miniswhite', - 'rgb', 'palette', 'cfa'): + 'rgb', 'palette'): raise ValueError("invalid photometric %s" % photometric) if planarconfig not in (None, 'contig', 'planar'): raise ValueError("invalid planarconfig %s" % planarconfig) @@ -671,14 +616,8 @@ class TiffWriter(object): # normalize data shape to 5D or 6D, depending on volume: # (pages, planar_samples, [depth,] height, width, contig_samples) - data_shape = data.shape - - if photometric == 'rgb': - data = reshape_nd(data, 3) - else: - data = reshape_nd(data, 2) - - shape = data.shape + data_shape = shape = data.shape + data = numpy.atleast_2d(data) samplesperpixel = 1 extrasamples = 0 @@ -688,15 +627,8 @@ class TiffWriter(object): photometric = 'palette' planarconfig = None if photometric is None: - photometric = 'minisblack' - if planarconfig == 'contig': - if data.ndim > 2 and shape[-1] in (3, 4): - photometric = 'rgb' - elif planarconfig == 'planar': - if volume and data.ndim > 3 and shape[-4] in (3, 4): - photometric = 'rgb' - elif data.ndim > 2 and shape[-3] in (3, 4): - photometric = 'rgb' + if planarconfig: + photometric = 'rgb' elif data.ndim > 2 and shape[-1] in (3, 4): photometric = 'rgb' elif self._imagej: @@ -705,6 +637,8 @@ class TiffWriter(object): photometric = 'rgb' elif data.ndim > 2 and shape[-3] in (3, 4): photometric = 'rgb' + else: + photometric = 'minisblack' if planarconfig and len(shape) <= (3 if volume else 2): planarconfig = None photometric = 'minisblack' @@ -731,14 +665,6 @@ class TiffWriter(object): samplesperpixel = data.shape[1] if samplesperpixel > 3: extrasamples = samplesperpixel - 3 - elif photometric == 'cfa': - if len(shape) != 2: - raise ValueError("invalid CFA image") - volume = False - planarconfig = None - data = data.reshape((-1, 1) + shape[-2:] + (1,)) - if 50706 not in (et[0] for et in extratags): - raise ValueError("must specify DNG tags for CFA image") elif planarconfig and len(shape) > (3 if volume else 2): if planarconfig == 'contig': data = data.reshape((-1, 1) + shape[(-4 if volume else -3):]) @@ -755,8 +681,18 @@ class TiffWriter(object): shape = shape[:-1] if len(shape) < 3: volume = False - data = data.reshape( - (-1, 1) + shape[(-3 if volume else -2):] + (1,)) + if False and ( + photometric != 'palette' and + len(shape) > (3 if volume else 2) and shape[-1] < 5 and + all(shape[-1] < i + for i in shape[(-4 if volume else -3):-1])): + # DISABLED: non-standard TIFF, e.g. (220, 320, 2) + planarconfig = 'contig' + samplesperpixel = shape[-1] + data = data.reshape((-1, 1) + shape[(-4 if volume else -3):]) + else: + data = data.reshape( + (-1, 1) + shape[(-3 if volume else -2):] + (1,)) # normalize shape to 6D assert len(data.shape) in (5, 6) @@ -772,8 +708,8 @@ class TiffWriter(object): shape[1] != 1 or shape[-1] != 1): raise ValueError("invalid data shape for palette mode") - if photometric == 'rgb' and samplesperpixel == 2: - raise ValueError("not a RGB image (samplesperpixel=2)") + if samplesperpixel == 2: + warnings.warn("writing non-standard TIFF (samplesperpixel 2)") bytestr = bytes if sys.version[0] == '2' else ( lambda x: bytes(x, 'utf-8') if isinstance(x, str) else x) @@ -826,7 +762,7 @@ class TiffWriter(object): if isinstance(value, numpy.ndarray): assert value.size == count assert value.dtype.char == dtype - ifdvalue = value.tostring() + ifdvalue = value.tobytes() elif isinstance(value, (tuple, list)): ifdvalue = pack(str(count)+dtype, *value) else: @@ -884,8 +820,7 @@ class TiffWriter(object): addtag('sample_format', 'H', 1, {'u': 1, 'i': 2, 'f': 3, 'c': 6}[data.dtype.kind]) addtag('photometric', 'H', 1, {'miniswhite': 0, 'minisblack': 1, - 'rgb': 2, 'palette': 3, - 'cfa': 32803}[photometric]) + 'rgb': 2, 'palette': 3}[photometric]) if colormap is not None: addtag('color_map', 'H', colormap.size, colormap) addtag('samples_per_pixel', 'H', 1, samplesperpixel) @@ -904,12 +839,9 @@ class TiffWriter(object): if resolution: addtag('x_resolution', '2I', 1, rational(resolution[0])) addtag('y_resolution', '2I', 1, rational(resolution[1])) - if len(resolution) > 2: - resolution_unit = {None: 1, 'inch': 2, 'cm': 3}[resolution[2]] - elif self._imagej: - resolution_unit = 1 - else: - resolution_unit = 2 + resolution_unit = ({'none': 1, 'inch': 2, 'cm': 3}[resolution[2]] + if len(resolution) == 3 + else 2) addtag('resolution_unit', 'H', 1, resolution_unit) if not tile: addtag('rows_per_strip', 'I', 1, shape[-3]) # * shape[-4] @@ -1181,19 +1113,25 @@ class TiffWriter(object): def imread(files, **kwargs): """Return image data from TIFF file(s) as numpy array. - Refer to the TiffFile class and member functions for documentation. + The first image series is returned if no arguments are provided. Parameters ---------- files : str, binary stream, or sequence File name, seekable binary stream, glob pattern, or sequence of file names. + key : int, slice, or sequence of page indices + Defines which pages to return as array. + series : int + Defines which series of pages in file to return as array. + multifile : bool + If True (default), OME-TIFF data may include pages from multiple files. + pattern : str + Regular expression pattern that matches axes names and indices in + file names. kwargs : dict - Parameters 'multifile', 'multifile_close', 'pages', 'fastij', and - 'is_ome' are passed to the TiffFile class. - The 'pattern' parameter is passed to the TiffSequence class. - Other parameters are passed to the asarray functions. - The first image series is returned if no arguments are provided. + Additional parameters passed to the TiffFile or TiffSequence asarray + function. Examples -------- @@ -1206,9 +1144,16 @@ def imread(files, **kwargs): (2, 3, 4, 301, 219) """ - kwargs_file = parse_kwargs(kwargs, 'multifile', 'multifile_close', - 'pages', 'fastij', 'is_ome') - kwargs_seq = parse_kwargs(kwargs, 'pattern') + kwargs_file = {} + if 'multifile' in kwargs: + kwargs_file['multifile'] = kwargs['multifile'] + del kwargs['multifile'] + else: + kwargs_file['multifile'] = True + kwargs_seq = {} + if 'pattern' in kwargs: + kwargs_seq['pattern'] = kwargs['pattern'] + del kwargs['pattern'] if isinstance(files, basestring) and any(i in files for i in '?*'): files = glob.glob(files) @@ -1246,7 +1191,7 @@ class TiffFile(object): """Read image and metadata from TIFF, STK, LSM, and FluoView files. TiffFile instances must be closed using the 'close' method, which is - automatically called when using the 'with' context manager. + automatically called when using the 'with' statement. Attributes ---------- @@ -1268,8 +1213,8 @@ class TiffFile(object): """ def __init__(self, arg, name=None, offset=None, size=None, - multifile=True, multifile_close=True, pages=None, - fastij=True, is_ome=None): + multifile=True, multifile_close=True, maxpages=None, + fastij=True): """Initialize instance from file. Parameters @@ -1292,21 +1237,14 @@ class TiffFile(object): If True (default), keep the handles of other files in multifile series closed. This is inefficient when few files refer to many pages. If False, the C runtime may run out of resources. - pages : sequence of int - Indices of the pages to read. If None (default) all pages are read. - Can be used to read only the first page with pages=[0]. - Specifying pages might invalidate series based on metadata. + maxpages : int + Number of pages to read (default: no limit). fastij : bool If True (default), try to use only the metadata from the first page of ImageJ files. Significantly speeds up loading movies with thousands of pages. - is_ome : bool - If False, disable processing of OME-XML metadata. """ - if is_ome is False: - self.is_ome = False - self._fh = FileHandle(arg, mode='rb', name=name, offset=offset, size=size) self.offset_size = None @@ -1314,9 +1252,8 @@ class TiffFile(object): self._multifile = bool(multifile) self._multifile_close = bool(multifile_close) self._files = {self._fh.name: self} # cache of TiffFiles - self._ifd_offset = 0 # offset to offset of next IFD try: - self._fromfile(pages, fastij) + self._fromfile(maxpages, fastij) except Exception: self._fh.close() raise @@ -1337,13 +1274,13 @@ class TiffFile(object): tif._fh.close() self._files = {} - def _fromfile(self, pages=None, fastij=True): + def _fromfile(self, maxpages=None, fastij=True): """Read TIFF header and all page records from file.""" self._fh.seek(0) try: self.byteorder = {b'II': '<', b'MM': '>'}[self._fh.read(2)] except KeyError: - raise ValueError("invalid TIFF file") + raise ValueError("not a valid TIFF file") self._is_native = self.byteorder == {'big': '>', 'little': '<'}[sys.byteorder] version = struct.unpack(self.byteorder+'H', self._fh.read(2))[0] @@ -1352,33 +1289,27 @@ class TiffFile(object): self.offset_size, zero = struct.unpack(self.byteorder+'HH', self._fh.read(4)) if zero or self.offset_size != 8: - raise ValueError("invalid BigTIFF file") + raise ValueError("not a valid BigTIFF file") elif version == 42: self.offset_size = 4 else: raise ValueError("not a TIFF file") - - self._ifd_offset = self._fh.tell() - self.pages = [] - pageindex = -1 while True: - pageindex += 1 - skip = pages and pageindex not in pages try: - page = TiffPage(self, skip) + page = TiffPage(self) + self.pages.append(page) except StopIteration: break - if skip: - continue - self.pages.append(page) - if fastij: + if maxpages and len(self.pages) > maxpages: + break + if fastij and page.is_imagej: if page._patch_imagej(): break # only read the first page of ImageJ files fastij = False - # TiffPage() leaves the file cursor at offset to offset of next IFD - self._ifd_offset = self._fh.tell() + if not self.pages: + raise ValueError("empty TIFF file") if self.is_micromanager: # MicroManager files contain metadata not stored in TIFF tags. @@ -1390,7 +1321,7 @@ class TiffFile(object): def _fix_lsm_strip_offsets(self): """Unwrap strip offsets for LSM files greater than 4 GB.""" - # each series and position require separate unwrapping (undocumented) + # each series and position require separate unwrappig (undocumented) for series in self.series: positions = 1 for i in 0, 1: @@ -1452,8 +1383,6 @@ class TiffFile(object): The directory where the memory-mapped file will be created. """ - if not self.pages: - return numpy.array([]) if key is None and series is None: series = 0 if series is not None: @@ -1537,13 +1466,8 @@ class TiffFile(object): index += a.size keep.close() elif key is None and series and series.offset: - if memmap: - result = self.filehandle.memmap_array( - series.dtype, series.shape, series.offset) - else: - self.filehandle.seek(series.offset) - result = self.filehandle.read_array( - series.dtype, product(series.shape)) + result = self.filehandle.memmap_array(series.dtype, series.shape, + series.offset) else: result = stack_pages(pages, memmap=memmap, tempdir=tempdir) @@ -1620,13 +1544,10 @@ class TiffFile(object): axes = reshape_axes(axes, shape, reshape) shape = reshape except ValueError as e: - warnings.warn(str(e)) + warnings.warn(e.message) series.append( TiffPageSeries(pages[s], shape, page0.dtype, axes)) - for i, s in enumerate(series): - s.index = i - # remove empty series, e.g. in MD Gel files series = [s for s in series if sum(s.shape) > 0] return series @@ -1753,10 +1674,10 @@ class TiffFile(object): newaxis = along.attrib.get('Type', 'other') newaxis = AXES_LABELS[newaxis] if 'Start' in along.attrib: - step = float(along.attrib.get('Step', 1)) - start = float(along.attrib['Start']) - stop = float(along.attrib['End']) + step - labels = numpy.arange(start, stop, step) + labels = range( + int(along.attrib['Start']), + int(along.attrib['End']) + 1, + int(along.attrib.get('Step', 1))) else: labels = [label.text for label in along if label.tag.endswith('Label')] @@ -1797,8 +1718,8 @@ class TiffFile(object): fname = uuid.attrib['FileName'] try: tif = TiffFile(os.path.join(dirname, fname)) - except (IOError, FileNotFoundError, ValueError): - # TODO: close open file handle + except (IOError, ValueError): + tif.close() warnings.warn( "ome-xml: failed to read '%s'" % fname) break @@ -1854,24 +1775,14 @@ class TiffFile(object): """Return iterator over pages.""" return iter(self.pages) - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_value, traceback): - self.close() - def __str__(self): """Return string containing information about file.""" result = [ - "TIFF file: %s" % self._fh.name, + self._fh.name.capitalize(), format_size(self._fh.size), {'<': 'little endian', '>': 'big endian'}[self.byteorder]] if self.is_bigtiff: result.append("bigtiff") - attrs = ['mdgel', 'mediacy', 'stk', 'lsm', 'vista', 'imagej', - 'fluoview', 'micromanager', 'nih', 'ome', 'scn', 'tvips', - 'fei', 'sem'] - result.extend((attr for attr in attrs if getattr(self, 'is_' + attr))) if len(self.pages) > 1: result.append("%i pages" % len(self.pages)) if len(self.series) > 1: @@ -1880,28 +1791,11 @@ class TiffFile(object): result.append("%i files" % (len(self._files))) return ", ".join(result) - def info(self, series=None, pages=None): - """Return string with detailed information about file.""" - if series is None: - series = self.series - else: - series = [self.series[i] for i in sequence(series)] - - result = [str(self)] - for s in series: - result.append(str(s)) - if pages is None: - result.append(s.pages[0].info()) - - if pages is not None: - if pages == 'all': - pages = self.pages - else: - pages = [self.pages[i] for i in sequence(pages)] - for p in pages: - result.append(p.info()) + def __enter__(self): + return self - return '\n\n'.join(result) + def __exit__(self, exc_type, exc_value, traceback): + self.close() @lazyattr def fstat(self): @@ -1918,12 +1812,12 @@ class TiffFile(object): @lazyattr def is_rgb(self): """File contains only RGB images.""" - return self.pages and all(p.is_rgb for p in self.pages) + return all(p.is_rgb for p in self.pages) @lazyattr def is_indexed(self): """File contains only indexed images.""" - return self.pages and all(p.is_indexed for p in self.pages) + return all(p.is_indexed for p in self.pages) @lazyattr def is_mdgel(self): @@ -1938,7 +1832,7 @@ class TiffFile(object): @lazyattr def is_stk(self): """File has MetaMorph STK format.""" - return self.pages and all(p.is_stk for p in self.pages) + return all(p.is_stk for p in self.pages) @lazyattr def is_lsm(self): @@ -1980,21 +1874,6 @@ class TiffFile(object): """File has Leica SCN format.""" return len(self.pages) and self.pages[0].is_scn - @lazyattr - def is_tvips(self): - """File was created using EM-MENU software.""" - return len(self.pages) and self.pages[0].is_tvips - - @lazyattr - def is_fei(self): - """File was created using FEI software.""" - return len(self.pages) and self.pages[0].is_fei - - @lazyattr - def is_sem(self): - """File contains Zeiss SEM metadata.""" - return len(self.pages) and self.pages[0].is_sem - class TiffPage(object): """A TIFF image file directory (IFD). @@ -2040,31 +1919,24 @@ class TiffPage(object): 5. contig samples_per_pixel. """ - def __init__(self, parent, skip=False): - """Initialize instance from file. - - If skip, seek to next IFD offset without reading tags. - - """ + def __init__(self, parent): + """Initialize instance from file.""" self.parent = parent - self.index = len(parent.pages) self.shape = self._shape = () self.dtype = self._dtype = None self.axes = "" self.tags = TiffTags() - self._offset = 0 # offset to this IDF + self._offset = 0 - self._fromfile(skip) - if skip: - return + self._fromfile() self._process_tags() - def _fromfile(self, skip=False): + def _fromfile(self): """Read TIFF IFD structure and its tags from file. - The file cursor is left at the storage position of the offset to the - next IFD (if any). + File cursor must be at storage position of IFD offset and is left at + offset to next IFD. Raises StopIteration if offset (first bytes read) is 0 or a corrupted page list is encountered. @@ -2073,37 +1945,29 @@ class TiffPage(object): fh = self.parent.filehandle byteorder = self.parent.byteorder offset_size = self.parent.offset_size - pos = fh.tell() # read offset to this IFD fmt = {4: 'I', 8: 'Q'}[offset_size] offset = struct.unpack(byteorder + fmt, fh.read(offset_size))[0] if not offset: - fh.seek(pos) raise StopIteration() if offset >= fh.size: warnings.warn("invalid page offset > file size") - fh.seek(pos) raise StopIteration() self._offset = offset # read standard tags + tags = self.tags fh.seek(offset) - fmt, size, tagsize = {4: ('H', 2, 12), 8: ('Q', 8, 20)}[offset_size] + fmt, size = {4: ('H', 2), 8: ('Q', 8)}[offset_size] try: numtags = struct.unpack(byteorder + fmt, fh.read(size))[0] if numtags > 4096: raise ValueError("suspicious number of tags") except Exception: warnings.warn("corrupted page list at offset %i" % offset) - fh.seek(pos) raise StopIteration() - if skip: - fh.seek(offset + size + numtags * tagsize) - return - - tags = self.tags tagcode = 0 for _ in range(numtags): try: @@ -2118,8 +1982,8 @@ class TiffPage(object): if tag.name not in tags: tags[tag.name] = tag else: - # some files contain multiple tags with same code - # e.g. MicroManager files contain two image_description tags + # some files contain multiple IFD with same code + # e.g. MicroManager files contain two image_description i = 1 while True: name = "%s_%i" % (tag.name, i) @@ -2127,7 +1991,7 @@ class TiffPage(object): tags[name] = tag break - pos = fh.tell() # where offset to next IFD is stored + pos = fh.tell() # where offset to next IFD can be found if self.is_lsm or (self.index and self.parent.is_lsm): # correct non standard LSM bitspersample tags @@ -2155,7 +2019,6 @@ class TiffPage(object): tags['uic1tag'].value = Record( read_uic1tag(fh, byteorder, uic1tag.dtype, uic1tag.count, tags['uic2tag'].count)) - fh.seek(pos) def _process_tags(self): @@ -2210,8 +2073,6 @@ class TiffPage(object): self.photometric = None if 'image_length' in tags: - if 'rows_per_strip' not in tags: - self.rows_per_strip = self.image_length self.strips_per_image = int(math.floor( float(self.image_length + self.rows_per_strip - 1) / self.rows_per_strip)) @@ -2396,25 +2257,12 @@ class TiffPage(object): shape = self.shape if self.is_indexed: shape = shape[:-1] - - fh = self.parent.filehandle if (count != product(shape) * self.bits_per_sample // 8 or - offset + count*images > fh.size): + offset + count*images > self.parent.filehandle.size): self.is_imagej = False - warnings.warn("invalid ImageJ metadata or corrupted file") - return - - # check that next page is stored after data - byteorder = self.parent.byteorder - offset_size = self.parent.offset_size - pos = fh.tell() - fmt = {4: 'I', 8: 'Q'}[offset_size] - nextpage = struct.unpack(byteorder + fmt, fh.read(offset_size))[0] - fh.seek(pos) - if nextpage and offset + count*images > nextpage: + warnings.warn("corrupted ImageJ metadata or file") return - # patch metadata pre = 'tile' if self.is_tiled else 'strip' self.tags[pre+'_offsets'].value = (offset,) self.tags[pre+'_byte_counts'].value = (count * images,) @@ -2425,7 +2273,7 @@ class TiffPage(object): def asarray(self, squeeze=True, colormapped=True, rgbonly=False, scale_mdgel=False, memmap=False, reopen=True, - maxsize=64*2**30): + maxsize=64*1024*1024*1024): """Read image data from file and return as numpy array. Raise ValueError if format is unsupported. @@ -2443,7 +2291,7 @@ class TiffPage(object): If True, return RGB(A) image without additional extra samples. memmap : bool If True, use numpy.memmap to read arrays from file if possible. - For use on 64-bit systems and files with few huge contiguous data. + For use on 64 bit systems and files with few huge contiguous data. reopen : bool If True and the parent file handle is closed, the file is temporarily re-opened (and closed if no exception occurs). @@ -2586,9 +2434,8 @@ class TiffPage(object): result = result[..., :image_depth, :image_length, :image_width, :] else: - strip_size = self.rows_per_strip * self.image_width - if self.planar_configuration == 'contig': - strip_size *= self.samples_per_pixel + strip_size = (self.rows_per_strip * self.image_width * + self.samples_per_pixel) result = numpy.empty(shape, dtype).reshape(-1) index = 0 for offset, bytecount in zip(offsets, byte_counts): @@ -2726,18 +2573,10 @@ class TiffPage(object): for i in range(len(offsets)-1)): return offsets[0], sum(byte_counts) - def __getattr__(self, name): - """Return tag value.""" - if name in self.tags: - value = self.tags[name].value - setattr(self, name, value) - return value - raise AttributeError(name) - def __str__(self): """Return string containing information about page.""" s = ', '.join(s for s in ( - 'x'.join(str(i) for i in self.shape), + ' x '.join(str(i) for i in self.shape), str(numpy.dtype(self.dtype)), '%s bit' % str(self.bits_per_sample), self.photometric if 'photometric' in self.tags else '', @@ -2749,23 +2588,13 @@ class TiffPage(object): 'is_contiguous') if getattr(self, t))) if s) return "Page %i: %s" % (self.index, s) - def info(self): - """Return string with detailed information about page.""" - result = ['\n'.join((str(self), str(self.tags)))] - if self.is_indexed: - result.append('Color Map: %s, %s' % (self.color_map.shape, - self.color_map.dtype)) - for attr in ('cz_lsm_info', 'cz_lsm_scan_info', 'uic_tags', - 'mm_header', 'imagej_tags', 'micromanager_metadata', - 'nih_image_header', 'tvips_metadata', 'sfeg_metadata', - 'helios_metadata', 'sem_metadata'): - if hasattr(self, attr): - result.append('\n'.join(( - attr.upper(), str(Record(getattr(self, attr)))))) - if self.is_micromanager: - result.append('MICROMANAGER_FILE_METADATA\n%s' % - Record(self.micromanager_metadata)) - return '\n\n'.join(result) + def __getattr__(self, name): + """Return tag value.""" + if name in self.tags: + value = self.tags[name].value + setattr(self, name, value) + return value + raise AttributeError(name) @lazyattr def uic_tags(self): @@ -2950,21 +2779,6 @@ class TiffPage(object): """Page contains Micro-Manager metadata.""" return 'micromanager_metadata' in self.tags - @lazyattr - def is_tvips(self): - """Page contains TVIPS metadata.""" - return 'tvips_metadata' in self.tags - - @lazyattr - def is_fei(self): - """Page contains SFEG or HELIOS metadata.""" - return 'sfeg_metadata' in self.tags or 'helios_metadata' in self.tags - - @lazyattr - def is_sem(self): - """Page contains Zeiss SEM metadata.""" - return 'sem_metadata' in self.tags - class TiffTag(object): """A TIFF tag structure. @@ -3129,7 +2943,6 @@ class TiffPageSeries(object): def __init__(self, pages, shape, dtype, axes, parent=None): # TODO? sort pages by page number? - self.index = 0 self.pages = pages self.shape = tuple(shape) self.axes = ''.join(axes) @@ -3195,14 +3008,13 @@ class TiffPageSeries(object): def __str__(self): """Return string with information about series.""" - s = ', '.join(s for s in ( - 'x'.join(str(i) for i in self.shape), - str(numpy.dtype(self.dtype)), - self.axes, - '%i pages' % len(self.pages), - ('memmap-offset=%i' % self.offset) if self.offset else - 'not mem-mappable')) - return 'Series %i: %s' % (self.index, s) + return "\n".join("* %s: %s" % kv for kv in ( + ("pages", len(self.pages)), + ("dtype", str(self.dtype)), + ("shape", str(self.shape)), + ("axes", self.axes), + ("offset", self.offset) + )) class TiffSequence(object): @@ -3388,7 +3200,6 @@ class Record(dict): try: dict.__init__(self, arg) except (TypeError, ValueError): - # numpy records for i, name in enumerate(arg.dtype.names): v = arg[i] self[name] = v if v.dtype.char != 'S' else stripnull(v) @@ -3416,9 +3227,6 @@ class Record(dict): continue elif isinstance(v[0], TiffPage): v = [i.index for i in v if i] - elif isinstance(v, Record): - s.append(("* %s:\n%s" % (k, str(v).replace('*', ' *')))) - continue s.append( ("* %s: %s" % (k, str(v))).split("\n", 1)[0] [:PRINT_LINE_LEN].rstrip()) @@ -3448,11 +3256,11 @@ class TiffTags(Record): class FileHandle(object): """Binary file handle. - A limited, special purpose file handler that can: + A limited, special purpose file handler that: - * handle embedded files (for CZI within CZI files) - * re-open closed files (for multi file formats, such as OME-TIFF) - * read and write numpy arrays and records from file like objects + * handles embedded files (for CZI within CZI files) + * allows to re-open closed files (for multi file formats, such as OME-TIFF) + * reads and writes numpy arrays and records from file like objects Only 'rb' and 'wb' modes are supported. Concurrently reading and writing of the same stream is untested. @@ -3515,7 +3323,7 @@ class FileHandle(object): if isinstance(self._file, basestring): # file name - self._file = os.path.realpath(self._file) + self._file = os.path.abspath(self._file) self._dir, self._name = os.path.split(self._file) self._fh = open(self._file, self._mode) self._close = True @@ -3561,6 +3369,9 @@ class FileHandle(object): raise ValueError("The first parameter must be a file name, " "seekable binary stream, or FileHandle") + # if self._mode not in (None, 'rb', 'wb', 'r+b', 'rb+', 'w+b', 'wb+'): + # raise ValueError('file mode not supported: %s' % self._mode) + if self._offset: self._fh.seek(self._offset) @@ -3593,7 +3404,7 @@ class FileHandle(object): def memmap_array(self, dtype, shape, offset=0, mode='r', order='C'): """Return numpy.memmap of data stored in file.""" if not self.is_file: - raise ValueError("Can not memory-map file without fileno") + raise ValueError("Can not memory-map file without fileno.") return numpy.memmap(self._fh, dtype=dtype, mode=mode, offset=self._offset + offset, shape=shape, order=order) @@ -3891,7 +3702,7 @@ def read_cz_lsm_info(fh, byteorder, dtype, count): assert byteorder == '<' magic_number, structure_size = struct.unpack('<II', fh.read(8)) if magic_number not in (50350412, 67127628): - raise ValueError("invalid CS_LSM_INFO structure") + raise ValueError("not a valid CS_LSM_INFO structure") fh.seek(-8, 1) if structure_size < numpy.dtype(CZ_LSM_INFO).itemsize: @@ -3989,83 +3800,6 @@ def read_cz_lsm_scan_info(fh): return block -def read_tvips_header(fh, byteorder, dtype, count): - """Read TVIPS EM-MENU headers and return as Record.""" - header = Record(fh.read_record(TVIPS_HEADER_V1, byteorder=byteorder)) - if header.version == 2: - header = Record(fh.read_record(TVIPS_HEADER_V2, byteorder=byteorder)) - if header.magic != int(0xaaaaaaaa): - raise ValueError("invalid TVIPS v2 magic number") - # decode utf16 strings - for name, typestr in TVIPS_HEADER_V2: - if typestr.startswith('V'): - s = header[name].tostring().decode('utf16', errors='ignore') - header[name] = stripnull(s, null='\0') - # convert nm to m - for axis in 'xy': - header['physical_pixel_size_' + axis] /= 1e9 - header['pixel_size_' + axis] /= 1e9 - elif header.version != 1: - raise ValueError("unknown TVIPS header version") - return header - - -def read_fei_metadata(fh, byteorder, dtype, count): - """Read FEI SFEG/HELIOS headers and return as nested Record.""" - result = Record() - section = Record() - for line in fh.read(count).splitlines(): - line = line.strip() - if line.startswith(b'['): - section = Record() - result[bytes2str(line[1:-1])] = section - continue - try: - key, value = line.split(b'=') - except ValueError: - continue - section[bytes2str(key)] = astype(value) - return result - - -def read_sem_metadata(fh, byteorder, dtype, count): - """Read Zeiss SEM tag and return as Record.""" - result = Record({'': ()}) - key = None - for line in fh.read(count).splitlines(): - line = line.decode('cp1252') - if line.isupper(): - key = line.lower() - elif key: - try: - name, value = line.split('=') - except ValueError: - continue - value = value.strip() - unit = '' - try: - v, u = value.split() - number = astype(v, (int, float)) - if number != v: - value = number - unit = u - except: - number = astype(value, (int, float)) - if number != value: - value = number - if value in ('No', 'Off'): - value = False - elif value in ('Yes', 'On'): - value = True - result[key] = (name.strip(), value) - if unit: - result[key] += (unit,) - key = None - else: - result[''] += (astype(line, (int, float)),) - return result - - def read_nih_image_header(fh, byteorder, dtype, count): """Read NIH_IMAGE_HEADER tag from file and return as numpy.rec.array.""" a = fh.read_record(NIH_IMAGE_HEADER, byteorder=byteorder) @@ -4089,7 +3823,7 @@ def read_micromanager_metadata(fh): except IndexError: raise ValueError("not a MicroManager TIFF file") - result = {} + results = {} fh.seek(8) (index_header, index_offset, display_header, display_offset, comments_header, comments_offset, summary_header, summary_length @@ -4097,7 +3831,7 @@ def read_micromanager_metadata(fh): if summary_header != 2355492: raise ValueError("invalid MicroManager summary_header") - result['summary'] = read_json(fh, byteorder, None, summary_length) + results['summary'] = read_json(fh, byteorder, None, summary_length) if index_header != 54773648: raise ValueError("invalid MicroManager index_header") @@ -4106,7 +3840,7 @@ def read_micromanager_metadata(fh): if header != 3453623: raise ValueError("invalid MicroManager index_header") data = struct.unpack(byteorder + "IIIII"*count, fh.read(20*count)) - result['index_map'] = { + results['index_map'] = { 'channel': data[::5], 'slice': data[1::5], 'frame': data[2::5], 'position': data[3::5], 'offset': data[4::5]} @@ -4116,7 +3850,7 @@ def read_micromanager_metadata(fh): header, count = struct.unpack(byteorder + "II", fh.read(8)) if header != 347834724: raise ValueError("invalid MicroManager display_header") - result['display_settings'] = read_json(fh, byteorder, None, count) + results['display_settings'] = read_json(fh, byteorder, None, count) if comments_header != 99384722: raise ValueError("invalid MicroManager comments_header") @@ -4124,9 +3858,9 @@ def read_micromanager_metadata(fh): header, count = struct.unpack(byteorder + "II", fh.read(8)) if header != 84720485: raise ValueError("invalid MicroManager comments_header") - result['comments'] = read_json(fh, byteorder, None, count) + results['comments'] = read_json(fh, byteorder, None, count) - return result + return results def imagej_metadata(data, bytecounts, byteorder): @@ -4656,26 +4390,49 @@ def reverse_bitorder(data): array([ 128, 16473], dtype=uint16) """ - table = ( - b'\x00\x80@\xc0 \xa0`\xe0\x10\x90P\xd00\xb0p\xf0\x08\x88H\xc8(\xa8h' - b'\xe8\x18\x98X\xd88\xb8x\xf8\x04\x84D\xc4$\xa4d\xe4\x14\x94T\xd44' - b'\xb4t\xf4\x0c\x8cL\xcc,\xacl\xec\x1c\x9c\\\xdc<\xbc|\xfc\x02\x82B' - b'\xc2"\xa2b\xe2\x12\x92R\xd22\xb2r\xf2\n\x8aJ\xca*\xaaj\xea\x1a' - b'\x9aZ\xda:\xbaz\xfa\x06\x86F\xc6&\xa6f\xe6\x16\x96V\xd66\xb6v\xf6' - b'\x0e\x8eN\xce.\xaen\xee\x1e\x9e^\xde>\xbe~\xfe\x01\x81A\xc1!\xa1a' - b'\xe1\x11\x91Q\xd11\xb1q\xf1\t\x89I\xc9)\xa9i\xe9\x19\x99Y\xd99' - b'\xb9y\xf9\x05\x85E\xc5%\xa5e\xe5\x15\x95U\xd55\xb5u\xf5\r\x8dM' - b'\xcd-\xadm\xed\x1d\x9d]\xdd=\xbd}\xfd\x03\x83C\xc3#\xa3c\xe3\x13' - b'\x93S\xd33\xb3s\xf3\x0b\x8bK\xcb+\xabk\xeb\x1b\x9b[\xdb;\xbb{\xfb' - b'\x07\x87G\xc7\'\xa7g\xe7\x17\x97W\xd77\xb7w\xf7\x0f\x8fO\xcf/\xafo' - b'\xef\x1f\x9f_\xdf?\xbf\x7f\xff') try: + # numpy array view = data.view('uint8') - numpy.take(numpy.fromstring(table, dtype='uint8'), view, out=view) + table = numpy.array([ + 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, + 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, + 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, + 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8, + 0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4, + 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4, + 0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, + 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC, + 0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2, + 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2, + 0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, + 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA, + 0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, + 0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6, + 0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE, + 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE, + 0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1, + 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1, + 0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, + 0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9, + 0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5, + 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5, + 0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED, + 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD, + 0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, + 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3, + 0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, + 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB, + 0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, + 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7, + 0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, + 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF], dtype='uint8') + numpy.take(table, view, out=view) except AttributeError: - return data.translate(table) - except ValueError: - raise NotImplementedError("slices of arrays not supported") + # byte string + # TODO: use string translate + data = numpy.fromstring(data, dtype='uint8') + reverse_bitorder(data) + return data.tostring() def apply_colormap(image, colormap, contig=True): @@ -4739,27 +4496,6 @@ def reorient(image, orientation): return numpy.swapaxes(image, -3, -2)[..., ::-1, ::-1, :] -def reshape_nd(image, ndim): - """Return image array with at least ndim dimensions. - - Prepend 1s to image shape as necessary. - - >>> reshape_nd(numpy.empty(0), 1).shape - (0,) - >>> reshape_nd(numpy.empty(1), 2).shape - (1, 1) - >>> reshape_nd(numpy.empty((2, 3)), 3).shape - (1, 2, 3) - >>> reshape_nd(numpy.empty((3, 4, 5)), 3).shape - (3, 4, 5) - - """ - if image.ndim >= ndim: - return image - image = image.reshape((1,) * (ndim - image.ndim) + image.shape) - return image - - def squeeze_axes(shape, axes, skip='XY'): """Return shape and axes with single-dimensional entries removed. @@ -4776,8 +4512,8 @@ def squeeze_axes(shape, axes, skip='XY'): return tuple(shape), ''.join(axes) -def transpose_axes(image, axes, asaxes='CTZYX'): - """Return image with its axes permuted to match specified axes. +def transpose_axes(data, axes, asaxes='CTZYX'): + """Return data with its axes permuted to match specified axes. A view is returned if possible. @@ -4788,16 +4524,16 @@ def transpose_axes(image, axes, asaxes='CTZYX'): for ax in axes: if ax not in asaxes: raise ValueError("unknown axis %s" % ax) - # add missing axes to image - shape = image.shape + # add missing axes to data + shape = data.shape for ax in reversed(asaxes): if ax not in axes: axes = ax + axes shape = (1,) + shape - image = image.reshape(shape) + data = data.reshape(shape) # transpose axes - image = image.transpose([axes.index(ax) for ax in asaxes]) - return image + data = data.transpose([axes.index(ax) for ax in asaxes]) + return data def reshape_axes(axes, shape, newshape): @@ -4811,8 +4547,6 @@ def reshape_axes(axes, shape, newshape): 'QQYQXQ' """ - shape = tuple(shape) - newshape = tuple(newshape) if len(axes) != len(shape): raise ValueError("axes do not match shape") if product(shape) != product(newshape): @@ -4875,18 +4609,16 @@ def stack_pages(pages, memmap=False, tempdir=None, *args, **kwargs): return data -def stripnull(string, null=b'\x00'): +def stripnull(string): """Return string truncated at first null character. - Clean NULL terminated C strings. For unicode strings use null='\\0'. + Clean NULL terminated C strings. >>> stripnull(b'string\\x00') b'string' - >>> stripnull('string\\x00', null='\\0') - 'string' """ - i = string.find(null) + i = string.find(b'\x00') return string if (i < 0) else string[:i] @@ -4913,21 +4645,9 @@ def stripascii(string): return string[:i+1] -def astype(value, types=None): - """Return argument as one of types if possible.""" - if types is None: - types = int, float, bytes2str - for typ in types: - try: - return typ(value) - except (ValueError, TypeError, UnicodeEncodeError): - pass - return value - - def format_size(size): """Return file size as string from byte size.""" - for unit in ('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'): + for unit in ('B', 'KB', 'MB', 'GB', 'TB'): if size < 2048: return "%.f %s" % (size, unit) size /= 1024.0 @@ -5027,45 +4747,50 @@ def julian_datetime(julianday, milisecond=0): hour, minute, second, milisecond) -def parse_kwargs(kwargs, *keys, **keyvalues): - """Return dict with keys from keys|keyvals and values from kwargs|keyvals. - - Existing keys are deleted from kwargs. - - >>> kwargs = {'one': 1, 'two': 2, 'four': 4} - >>> kwargs2 = parse_kwargs(kwargs, 'two', 'three', four=None, five=5) - >>> kwargs == {'one': 1} - True - >>> kwargs2 == {'two': 2, 'four': 4, 'five': 5} - True - - """ - result = {} - for key in keys: - if key in kwargs: - result[key] = kwargs[key] - del kwargs[key] - for key, value in keyvalues.items(): - if key in kwargs: - result[key] = kwargs[key] - del kwargs[key] - else: - result[key] = value - return result - +def test_tifffile(directory='testimages', verbose=True): + """Read all images in directory. -def update_kwargs(kwargs, **keyvalues): - """Update dict with keys and values if keys do not already exist. + Print error message on failure. - >>> kwargs = {'one': 1, } - >>> update_kwargs(kwargs, one=None, two=2) - >>> kwargs == {'one': 1, 'two': 2} - True + >>> test_tifffile(verbose=False) """ - for key, value in keyvalues.items(): - if key not in kwargs: - kwargs[key] = value + successful = 0 + failed = 0 + start = time.time() + for f in glob.glob(os.path.join(directory, '*.*')): + if verbose: + print("\n%s>\n" % f.lower(), end='') + t0 = time.time() + try: + tif = TiffFile(f, multifile=True) + except Exception as e: + if not verbose: + print(f, end=' ') + print("ERROR:", e) + failed += 1 + continue + try: + img = tif.asarray() + except ValueError: + try: + img = tif[0].asarray() + except Exception as e: + if not verbose: + print(f, end=' ') + print("ERROR:", e) + failed += 1 + continue + finally: + tif.close() + successful += 1 + if verbose: + print("%s, %s %s, %s, %.0f ms" % ( + str(tif), str(img.shape), img.dtype, tif[0].compression, + (time.time()-t0) * 1e3)) + if verbose: + print("\nSuccessfully read %i of %i files in %.3f s\n" % ( + successful, successful+failed, time.time()-start)) class TIFF_SUBFILE_TYPES(object): @@ -5126,6 +4851,7 @@ TIFF_COMPESSIONS = { 34712: 'jp2000', 34713: 'nef', 34925: 'lzma', + } TIFF_DECOMPESSORS = { @@ -5409,6 +5135,7 @@ UIC_TAGS = { #66: ('overlay_plane_color', read_uic_overlay_plane_color), } + # Olympus FluoView MM_DIMENSION = [ ('name', 'a16'), @@ -5783,110 +5510,6 @@ CZ_LSM_SCAN_INFO_ATTRIBUTES = { 0x14000004: "trigger_out", } -# TVIPS metadata from EMMENU Help file -TVIPS_HEADER_V1 = [ - ('version', 'i4'), - ('comment_v1', 'a80'), - ('high_tension', 'i4'), - ('spherical_aberration', 'i4'), - ('illumination_aperture', 'i4'), - ('magnification', 'i4'), - ('post-magnification', 'i4'), - ('focal_length', 'i4'), - ('defocus', 'i4'), - ('astigmatism', 'i4'), - ('astigmatism_direction', 'i4'), - ('biprism_voltage', 'i4'), - ('specimen_tilt_angle', 'i4'), - ('specimen_tilt_direction', 'i4'), - ('illumination_tilt_direction', 'i4'), - ('illumination_tilt_angle', 'i4'), - ('image_mode', 'i4'), - ('energy_spread', 'i4'), - ('chromatic_aberration', 'i4'), - ('shutter_type', 'i4'), - ('defocus_spread', 'i4'), - ('ccd_number', 'i4'), - ('ccd_size', 'i4'), - ('offset_x_v1', 'i4'), - ('offset_y_v1', 'i4'), - ('physical_pixel_size', 'i4'), - ('binning', 'i4'), - ('readout_speed', 'i4'), - ('gain_v1', 'i4'), - ('sensitivity_v1', 'i4'), - ('exposure_time_v1', 'i4'), - ('flat_corrected', 'i4'), - ('dead_px_corrected', 'i4'), - ('image_mean', 'i4'), - ('image_std', 'i4'), - ('displacement_x', 'i4'), - ('displacement_y', 'i4'), - ('date_v1', 'i4'), - ('time_v1', 'i4'), - ('image_min', 'i4'), - ('image_max', 'i4'), - ('image_statistics_quality', 'i4'), -] - -TVIPS_HEADER_V2 = [ - ('image_name', 'V160'), # utf16 - ('image_folder', 'V160'), - ('image_size_x', 'i4'), - ('image_size_y', 'i4'), - ('image_size_z', 'i4'), - ('image_size_e', 'i4'), - ('image_data_type', 'i4'), - ('date', 'i4'), - ('time', 'i4'), - ('comment', 'V1024'), - ('image_history', 'V1024'), - ('scaling', '16f4'), - ('image_statistics', '16c16'), - ('image_type', 'i4'), - ('image_display_type', 'i4'), - ('pixel_size_x', 'f4'), # distance between two px in x, [nm] - ('pixel_size_y', 'f4'), # distance between two px in y, [nm] - ('image_distance_z', 'f4'), - ('image_distance_e', 'f4'), - ('image_misc', '32f4'), - ('tem_type', 'V160'), - ('tem_high_tension', 'f4'), - ('tem_aberrations', '32f4'), - ('tem_energy', '32f4'), - ('tem_mode', 'i4'), - ('tem_magnification', 'f4'), - ('tem_magnification_correction', 'f4'), - ('post_magnification', 'f4'), - ('tem_stage_type', 'i4'), - ('tem_stage_position', '5f4'), # x, y, z, a, b - ('tem_image_shift', '2f4'), - ('tem_beam_shift', '2f4'), - ('tem_beam_tilt', '2f4'), - ('tiling_parameters', '7f4'), # 0: tiling? 1:x 2:y 3: max x 4: max y - # 5: overlap x 6: overlap y - ('tem_illumination', '3f4'), # 0: spotsize 1: intensity - ('tem_shutter', 'i4'), - ('tem_misc', '32f4'), - ('camera_type', 'V160'), - ('physical_pixel_size_x', 'f4'), - ('physical_pixel_size_y', 'f4'), - ('offset_x', 'i4'), - ('offset_y', 'i4'), - ('binning_x', 'i4'), - ('binning_y', 'i4'), - ('exposure_time', 'f4'), - ('gain', 'f4'), - ('readout_rate', 'f4'), - ('flatfield_description', 'V160'), - ('sensitivity', 'f4'), - ('dose', 'f4'), - ('cam_misc', '32f4'), - ('fei_microscope_information', 'V1024'), - ('fei_specimen_information', 'V1024'), - ('magic', 'u4'), -] - # Map TIFF tag code to attribute name, default value, type, count, validator TIFF_TAGS = { 254: ('new_subfile_type', 0, 4, 1, TIFF_SUBFILE_TYPES()), @@ -5915,7 +5538,7 @@ TIFF_TAGS = { 285: ('page_name', None, 2, None, None), 286: ('x_position', None, 5, 1, None), 287: ('y_position', None, 5, 1, None), - 296: ('resolution_unit', 2, 4, 1, {1: None, 2: 'inch', 3: 'centimeter'}), + 296: ('resolution_unit', 2, 4, 1, {1: 'none', 2: 'inch', 3: 'centimeter'}), 297: ('page_number', None, 3, 2, None), 305: ('software', None, 2, None, None), 306: ('datetime', None, 2, None, None), @@ -5929,7 +5552,6 @@ TIFF_TAGS = { 323: ('tile_length', None, 4, 1, None), 324: ('tile_offsets', None, 4, None, None), 325: ('tile_byte_counts', None, 4, None, None), - 330: ('sub_ifds', None, 4, None, None), 338: ('extra_samples', None, 3, None, {0: 'unspecified', 1: 'assocalpha', 2: 'unassalpha'}), 339: ('sample_format', 1, 3, None, TIFF_SAMPLE_FORMATS), @@ -5940,7 +5562,7 @@ TIFF_TAGS = { 530: ('ycbcr_subsampling', (1, 1), 3, 2, None), 531: ('ycbcr_positioning', (1, 1), 3, 1, None), 532: ('reference_black_white', None, 5, 1, None), - 32995: ('sgi_matteing', None, None, 1, None), # use extra_samples + 32996: ('sgi_matteing', None, None, 1, None), # use extra_samples 32996: ('sgi_datatype', None, None, None, None), # use sample_format 32997: ('image_depth', 1, 4, 1, None), 32998: ('tile_depth', None, 4, 1, None), @@ -5986,14 +5608,10 @@ CUSTOM_TAGS = { 33629: ('uic2tag', read_uic2tag), 33630: ('uic3tag', read_uic3tag), 33631: ('uic4tag', read_uic4tag), - 34118: ('sem_metadata', read_sem_metadata), # Zeiss SEM 34361: ('mm_header', read_mm_header), # Olympus FluoView 34362: ('mm_stamp', read_mm_stamp), 34386: ('mm_user_block', read_bytes), 34412: ('cz_lsm_info', read_cz_lsm_info), # Carl Zeiss LSM - 34680: ('sfeg_metadata', read_fei_metadata), # S-FEG - 34682: ('helios_metadata', read_fei_metadata), # Helios NanoLab - 37706: ('tvips_metadata', read_tvips_header), # TVIPS EMMENU 43314: ('nih_image_header', read_nih_image_header), # 40001: ('mc_ipwinscal', read_bytes), 40100: ('mc_id_old', read_bytes), @@ -6008,7 +5626,7 @@ PRINT_LINE_LEN = 79 def imshow(data, title=None, vmin=0, vmax=None, cmap=None, - bitspersample=None, photometric='rgb', interpolation=None, + bitspersample=None, photometric='rgb', interpolation='nearest', dpi=96, figure=None, subplot=111, maxdim=8192, **kwargs): """Plot n-dimensional images using matplotlib.pyplot. @@ -6037,12 +5655,7 @@ def imshow(data, title=None, vmin=0, vmax=None, cmap=None, # raise ValueError("Can not handle %s photometrics" % photometric) # TODO: handle photometric == 'separated' (CMYK) isrgb = photometric in ('rgb', 'palette') - - data = data.squeeze() - if photometric in ('miniswhite', 'minisblack'): - data = reshape_nd(data, 2) - else: - data = reshape_nd(data, 3) + data = numpy.atleast_2d(data.squeeze()) dims = data.ndim if dims < 2: @@ -6249,8 +5862,8 @@ def askopenfilename(**kwargs): def main(argv=None): """Command line usage main function.""" - if float(sys.version[0:3]) < 2.7: - print("This script requires Python version 2.7 or better.") + if float(sys.version[0:3]) < 2.6: + print("This script requires Python version 2.6 or better.") print("This is Python version %s" % sys.version) return 0 if argv is None: @@ -6281,6 +5894,8 @@ def main(argv=None): help="set maximum value for colormapping") opt('--debug', dest='debug', action='store_true', default=False, help="raise exception on failures") + opt('--test', dest='test', action='store_true', default=False, + help="try read all images in path") opt('--doctest', dest='doctest', action='store_true', default=False, help="runs the docstring examples") opt('-v', '--verbose', dest='verbose', action='store_true', default=True) @@ -6300,6 +5915,9 @@ def main(argv=None): ("STK files", "*.stk"), ("allfiles", "*")]) if not path: parser.error("No file specified") + if settings.test: + test_tifffile(path, settings.verbose) + return 0 if any(i in path for i in '?*'): path = glob.glob(path) @@ -6325,13 +5943,12 @@ def main(argv=None): if tif.is_ome: settings.norgb = True - images = [] + images = [(None, tif[0 if settings.page < 0 else settings.page])] if not settings.noplot: print("Reading image data... ", end=' ') def notnone(x): return next(i for i in x if i is not None) - start = time.time() try: if settings.page >= 0: @@ -6361,9 +5978,27 @@ def main(argv=None): print(e) tif.close() + + print("\nTIFF file:", tif) print() - print(tif.info()) - print() + for i, s in enumerate(tif.series): + print("Series %i" % i) + print(s) + print() + for i, page in images: + print(page) + print(page.tags) + if page.is_indexed: + print("\nColor Map:", page.color_map.shape, page.color_map.dtype) + for attr in ('cz_lsm_info', 'cz_lsm_scan_info', 'uic_tags', + 'mm_header', 'imagej_tags', 'micromanager_metadata', + 'nih_image_header'): + if hasattr(page, attr): + print("", attr.upper(), Record(getattr(page, attr)), sep="\n") + print() + if page.is_micromanager: + print('MICROMANAGER_FILE_METADATA') + print(Record(tif.micromanager_metadata)) if images and not settings.noplot: try: @@ -6406,21 +6041,12 @@ if sys.version_info[0] > 2: basestring = str, bytes unicode = str - def bytes2str(b): - return str(b, 'cp1252') - def str2bytes(s, encoding="latin-1"): return s.encode(encoding) - else: - bytes2str = str - def str2bytes(s): return s - class FileNotFoundError(IOError): - pass - if __name__ == "__main__": sys.exit(main()) diff --git a/imageio/plugins/ffmpeg.py b/imageio/plugins/ffmpeg.py index 5199b79..6610199 100644 --- a/imageio/plugins/ffmpeg.py +++ b/imageio/plugins/ffmpeg.py @@ -211,6 +211,7 @@ class FfmpegFormat(Format): class Reader(Format.Reader): _exe = None + _frame_catcher = None @classmethod def _get_exe(cls): @@ -301,7 +302,6 @@ class FfmpegFormat(Format): self._load_infos() # For cameras, create thread that keeps reading the images - self._frame_catcher = None if self.request._video: w, h = self._meta['size'] framesize = self._depth * w * h
ffmpeg read_infos bug Hi, I just found a bug in the ffmpeg plugin that results in the following traceback: ```python Traceback (most recent call last): File "C:/Users/Felix/PycharmProjects/imageio/test.py", line 9, in <module> vid = imageio.get_reader(filename, 'ffmpeg', ffmpeg_params=['-loglevel', 'fatal', '-err_detect', 'aggressive']) File "C:\Users\Felix\PycharmProjects\imageio\imageio\core\functions.py", line 111, in get_reader return format.get_reader(request) File "C:\Users\Felix\PycharmProjects\imageio\imageio\core\format.py", line 169, in get_reader return self.Reader(self, request) File "C:\Users\Felix\PycharmProjects\imageio\imageio\core\format.py", line 218, in __init__ self._open(**self.request.kwargs.copy()) File "C:\Users\Felix\PycharmProjects\imageio\imageio\plugins\ffmpeg.py", line 306, in _open self._load_infos() File "C:\Users\Felix\PycharmProjects\imageio\imageio\plugins\ffmpeg.py", line 445, in _load_infos self._terminate() File "C:\Users\Felix\PycharmProjects\imageio\imageio\plugins\ffmpeg.py", line 430, in _terminate if self._frame_catcher: AttributeError: 'Reader' object has no attribute '_frame_catcher' ``` This happens if the ffmpeg process doesn't print anything to stderr. The problem is that `self._frame_catcher` is initialized after the call to `self._load_infos` which in case of an error calls `self._terminate` which then accesses `self._frame_catcher`. You can reproduce the bug by using the code changes from #234 and passing `ffmpeg_params=['-loglevel', 'fatal']` to the reader. Here's the relevant section of the ffmpeg reader (Line 305...): ```python ... # Start ffmpeg subprocess and get meta information self._initialize() self._load_infos() # accesses self._frame_catcher in case of an error # For cameras, create thread that keeps reading the images self._frame_catcher = None ... ```
imageio/imageio
diff --git a/tests/test_tifffile.py b/tests/test_tifffile.py index 5ab5ce7..32d8b45 100644 --- a/tests/test_tifffile.py +++ b/tests/test_tifffile.py @@ -63,7 +63,7 @@ def test_tifffile_reading_writing(): ims = list(R) # == [im for im in R] assert (ims[0] == im2).all() meta = R.get_meta_data() - assert meta['orientation'] == 'top_left' + assert meta['is_rgb'] # Fail raises(IndexError, R.get_data, -1) raises(IndexError, R.get_data, 3)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 2 }
2.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov" ], "pre_install": [ "apt-get update", "apt-get install -y libfreeimage3" ], "python": "3.6", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 coverage==6.2 -e git+https://github.com/imageio/imageio.git@7df104500646d0cf7dd143aec698ef9ce77b7005#egg=imageio importlib-metadata==4.8.3 iniconfig==1.1.1 numpy==1.19.5 packaging==21.3 Pillow==8.4.0 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 pytest-cov==4.0.0 tomli==1.2.3 typing_extensions==4.1.1 zipp==3.6.0
name: imageio channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - coverage==6.2 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - numpy==1.19.5 - packaging==21.3 - pillow==8.4.0 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-cov==4.0.0 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/imageio
[ "tests/test_tifffile.py::test_tifffile_reading_writing" ]
[]
[ "tests/test_tifffile.py::test_tifffile_format" ]
[]
BSD 2-Clause "Simplified" License
1,055
[ "imageio/plugins/ffmpeg.py", "imageio/plugins/_tifffile.py" ]
[ "imageio/plugins/ffmpeg.py", "imageio/plugins/_tifffile.py" ]
mozilla__bleach-259
f2a6d383f788e7ef6525e3f9baa40ed5c748b1c5
2017-03-03 17:05:38
fa4cadc5b3dad924b6c1e82a284cb2bb7a94377f
diff --git a/bleach/__init__.py b/bleach/__init__.py index 12788eb..04d69b0 100644 --- a/bleach/__init__.py +++ b/bleach/__init__.py @@ -115,9 +115,8 @@ class Cleaner(object): def __init__(self, tags=ALLOWED_TAGS, attributes=ALLOWED_ATTRIBUTES, styles=ALLOWED_STYLES, protocols=ALLOWED_PROTOCOLS, strip=False, - strip_comments=True): - """ - :arg tags: whitelist of allowed tags; defaults to + strip_comments=True, filters=None): + """:arg tags: whitelist of allowed tags; defaults to ``bleach.ALLOWED_TAGS`` :arg attributes: whitelist of allowed attributes; defaults to @@ -133,6 +132,16 @@ class Cleaner(object): :arg strip_comments: whether or not to strip HTML comments + :arg filters: list of html5lib Filter classes to pass streamed content through + + See http://html5lib.readthedocs.io/en/latest/movingparts.html#filters + + .. Warning:: + + Using filters changes the output of + :py:method:`bleach.Cleaner.clean`. Make sure the way the filters + change the output are secure. + """ self.tags = tags self.attributes = attributes @@ -140,6 +149,7 @@ class Cleaner(object): self.protocols = protocols self.strip = strip self.strip_comments = strip_comments + self.filters = filters or [] self.parser = html5lib.HTMLParser(namespaceHTMLElements=False) self.walker = html5lib.getTreeWalker('etree') @@ -183,12 +193,16 @@ class Cleaner(object): allowed_svg_properties=[], ) + # Apply any filters after the BleachSanitizerFilter + for filter_class in self.filters: + filtered = filter_class(source=filtered) + return self.serializer.render(filtered) def clean(text, tags=ALLOWED_TAGS, attributes=ALLOWED_ATTRIBUTES, styles=ALLOWED_STYLES, protocols=ALLOWED_PROTOCOLS, strip=False, - strip_comments=True): + strip_comments=True, filters=None): """Clean an HTML fragment of malicious content and return it This function is a security-focused function whose sole purpose is to @@ -228,6 +242,16 @@ def clean(text, tags=ALLOWED_TAGS, attributes=ALLOWED_ATTRIBUTES, :arg strip_comments: whether or not to strip HTML comments + :arg filters: list of html5lib Filter classes to pass streamed content through + + See http://html5lib.readthedocs.io/en/latest/movingparts.html#filters + + .. Warning:: + + Using filters changes the output of + `bleach.Cleaner.clean`. Make sure the way the filters + change the output are secure. + :returns: cleaned text as unicode """ @@ -238,6 +262,7 @@ def clean(text, tags=ALLOWED_TAGS, attributes=ALLOWED_ATTRIBUTES, protocols=protocols, strip=strip, strip_comments=strip_comments, + filters=filters, ) return cleaner.clean(text) diff --git a/bleach/sanitizer.py b/bleach/sanitizer.py index b7162ee..62bbf64 100644 --- a/bleach/sanitizer.py +++ b/bleach/sanitizer.py @@ -16,7 +16,6 @@ def _attr_key(attr): """ key = (attr[0][0] or ''), attr[0][1] - print(key) return key diff --git a/docs/clean.rst b/docs/clean.rst index 63f0427..8e310f5 100644 --- a/docs/clean.rst +++ b/docs/clean.rst @@ -5,7 +5,7 @@ ``bleach.clean()`` ================== -:py:func:`bleach.clean`` is Bleach's HTML sanitization method. +:py:func:`bleach.clean` is Bleach's HTML sanitization method. Given a fragment of HTML, Bleach will parse it according to the HTML5 parsing algorithm and sanitize any disallowed tags or attributes. This algorithm also @@ -48,13 +48,41 @@ The default value is a relatively conservative list found in ``bleach.ALLOWED_TAGS``. -Attribute Whitelist -=================== +Allowed Attributes +================== + +The ``attributes`` kwarg lets you specify which attributes are allowed. + +The default value is also a conservative dict found in +``bleach.ALLOWED_ATTRIBUTES``. + + +As a list +--------- + +The ``attributes`` value can be a list, in which case the attributes are allowed +for any tag. + +For example: + +.. doctest:: + + >>> import bleach + + >>> bleach.clean( + ... u'<p class="foo" style="color: red; font-weight: bold;">blah blah blah</p>', + ... tags=['p'], + ... attributes=['style'], + ... styles=['color'], + ... ) + u'<p style="color: red;">blah blah blah</p>' + + +As a dict +--------- -The ``attributes`` kwarg is a whitelist of attributes. It can be a list, in -which case the attributes are allowed for any tag, or a dictionary, in which -case the keys are tag names (or a wildcard: ``*`` for all tags) and the values -are lists of allowed attributes. +The ``attributes`` value can be a dict, in which case the keys are tag names (or +a wildcard: ``*`` for all tags) and the values are lists of allowed attributes. For example: @@ -80,23 +108,19 @@ In this case, ``class`` is allowed on any allowed element (from the ``tags`` argument), ``<a>`` tags are allowed to have ``href`` and ``rel`` attributes, and so on. -The default value is also a conservative dict found in -``bleach.ALLOWED_ATTRIBUTES``. - -Callable Filters ----------------- +Using functions +--------------- -You can also use a callable (instead of a list) in the ``attributes`` kwarg. If -the callable returns ``True``, the attribute is allowed. Otherwise, it is -stripped. For example: +You can also use callables. If the callable returns ``True``, the attribute is +allowed. Otherwise, it is stripped. For example: .. doctest:: >>> from urlparse import urlparse >>> import bleach - >>> def filter_src(name, value): + >>> def allow_src(name, value): ... if name in ('alt', 'height', 'width'): ... return True ... if name == 'src': @@ -108,7 +132,7 @@ stripped. For example: ... u'<img src="http://example.com" alt="an example">', ... tags=['img'], ... attributes={ - ... 'img': filter_src + ... 'img': allow_src ... } ... ) u'<img alt="an example">' @@ -229,3 +253,47 @@ By default, Bleach will strip out HTML comments. To disable this behavior, set >>> bleach.clean(html, strip_comments=False) u'my<!-- commented --> html' + + +html5lib Filters +================ + +Bleach sanitizing is implemented as an html5lib Filter. The consequence of this +is that we can pass the streamed content through additional specified filters +after the :py:class:`bleach.sanitizer.BleachSanitizingFilter` filter has run. + +This lets you add data, drop data and change data as it is being serialized back +to a unicode. + +Documentation on html5lib Filters is here: +http://html5lib.readthedocs.io/en/latest/movingparts.html#filters + +Trivial Filter example: + +.. doctest:: + + >>> import bleach + >>> from html5lib.filters.base import Filter + + >>> class MooFilter(Filter): + ... def __iter__(self): + ... for token in Filter.__iter__(self): + ... if token['type'] in ['StartTag', 'EmptyTag'] and token['data']: + ... for attr, value in token['data'].items(): + ... token['data'][attr] = 'moo' + ... yield token + ... + >>> ATTRS = { + ... 'img': ['rel', 'src'] + ... } + ... + >>> TAGS = ['img'] + >>> dirty = 'this is cute! <img src="http://example.com/puppy.jpg" rel="nofollow">' + >>> bleach.clean(dirty, tags=TAGS, attributes=ATTRS, filters=[MooFilter]) + u'this is cute! <img rel="moo" src="moo">' + + +.. Warning:: + + Filters change the output of cleaning. Make sure that whatever changes the + filter is applying maintain the safety guarantees of the output.
A cleaning pipeline One thing that occured to me while working on the `BleachSanitizerMixin.sanitize_token` is that it's code is getting pretty long and kind of ugly, the more functionality one needs do add. One possible way to counter this problem might be to implement a "pipeline". I've seen this concept first in [django-social-auth](https://github.com/omab/django-social-auth) which I'm also using in a project. To be more specific [this part of the README](https://github.com/omab/django-social-auth#id14) explains it pretty good. Personally I really love the concept. The code of the [default social auth pipeline is here](https://github.com/omab/django-social-auth/tree/master/social_auth/backends/pipeline) So what I am proposing is something very much in the vain of social auth's pipeline: 1. Instead of having to tie into the (big) if condition, we iterate over an iterable with functions:: ``` python PIPELINE = ('SkipAllowedElements', 'StripScripts',...) ``` 2. While iterating, each function get's called and returns either a cleaned token which gets passed on to the next function in the iterable _or_ `None` for skip. Note that maybe it might be more expressive to use Exceptions (like `SkipToken`) here. This may also clean up a bit of the code I introduce with the `strip_script_content` fork (like doing `self.previous_token = token` right before every `return`) So, basically this is me requesting for a comment on refactoring things a bit :D – Maybe the same kind of _pipeline-logic_ could be used for #56
mozilla/bleach
diff --git a/tests/test_basics.py b/tests/test_basics.py index 919c867..620a42d 100644 --- a/tests/test_basics.py +++ b/tests/test_basics.py @@ -1,4 +1,5 @@ import html5lib +from html5lib.filters.base import Filter import pytest import six @@ -147,14 +148,14 @@ class TestClean: ) def test_allowed_styles(self): - ATTR = ['style'] + ATTRS = ['style'] STYLE = ['color'] blank = '<b style=""></b>' s = '<b style="color: blue;"></b>' - assert bleach.clean('<b style="top:0"></b>', attributes=ATTR) == blank - assert bleach.clean(s, attributes=ATTR, styles=STYLE) == s + assert bleach.clean('<b style="top:0"></b>', attributes=ATTRS) == blank + assert bleach.clean(s, attributes=ATTRS, styles=STYLE) == s assert ( - bleach.clean('<b style="top: 0; color: blue;"></b>', attributes=ATTR, styles=STYLE) == + bleach.clean('<b style="top: 0; color: blue;"></b>', attributes=ATTRS, styles=STYLE) == s ) @@ -165,7 +166,7 @@ class TestClean: assert bleach.clean(dirty, attributes=['class']) == clean def test_wildcard_attributes(self): - ATTR = { + ATTRS = { '*': ['id'], 'img': ['src'], } @@ -173,7 +174,7 @@ class TestClean: dirty = ('both <em id="foo" style="color: black">can</em> have ' '<img id="bar" src="foo"/>') assert ( - bleach.clean(dirty, tags=TAG, attributes=ATTR) == + bleach.clean(dirty, tags=TAG, attributes=ATTRS) == 'both <em id="foo">can</em> have <img id="bar" src="foo">' ) @@ -273,6 +274,27 @@ class TestClean: cleaned_href = '<a>invalid href</a>' assert bleach.clean(invalid_href, protocols=['my_protocol']) == cleaned_href + def test_filters(self): + # Create a Filter that changes all the attr values to "moo" + class MooFilter(Filter): + def __iter__(self): + for token in Filter.__iter__(self): + if token['type'] in ['StartTag', 'EmptyTag'] and token['data']: + for attr, value in token['data'].items(): + token['data'][attr] = 'moo' + + yield token + + ATTRS = { + 'img': ['rel', 'src'] + } + TAGS = ['img'] + dirty = 'this is cute! <img src="http://example.com/puppy.jpg" rel="nofollow">' + assert ( + bleach.clean(dirty, tags=TAGS, attributes=ATTRS, filters=[MooFilter]) == + 'this is cute! <img rel="moo" src="moo">' + ) + class TestCleaner: def test_basics(self):
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 0 }, "num_modified_files": 3 }
1.5
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest_v2", "no_use_env": null, "packages": "requirements.txt", "pip_packages": null, "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest -v" }
alabaster==0.7.13 args==0.1.0 Babel==2.11.0 -e git+https://github.com/mozilla/bleach.git@f2a6d383f788e7ef6525e3f9baa40ed5c748b1c5#egg=bleach certifi==2021.5.30 charset-normalizer==2.0.12 clint==0.5.1 distlib==0.3.9 docutils==0.18.1 filelock==3.4.1 flake8==3.3.0 html5lib==1.1 idna==3.10 imagesize==1.4.1 importlib-metadata==4.8.3 importlib-resources==5.4.0 Jinja2==3.0.3 MarkupSafe==2.0.1 mccabe==0.6.1 pkginfo==1.10.0 platformdirs==2.4.0 pluggy==0.4.0 py==1.11.0 pycodestyle==2.3.1 pyflakes==1.5.0 Pygments==2.14.0 pytest==3.0.6 pytest-wholenodeid==0.2 pytz==2025.2 requests==2.27.1 requests-toolbelt==1.0.0 six==1.17.0 snowballstemmer==2.2.0 Sphinx==1.5.2 tox==2.4.1 twine==1.8.1 typing_extensions==4.1.1 urllib3==1.26.20 virtualenv==20.17.1 webencodings==0.5.1 zipp==3.6.0
name: bleach channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - args==0.1.0 - babel==2.11.0 - charset-normalizer==2.0.12 - clint==0.5.1 - distlib==0.3.9 - docutils==0.18.1 - filelock==3.4.1 - flake8==3.3.0 - html5lib==1.1 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - jinja2==3.0.3 - markupsafe==2.0.1 - mccabe==0.6.1 - pkginfo==1.10.0 - platformdirs==2.4.0 - pluggy==0.4.0 - py==1.11.0 - pycodestyle==2.3.1 - pyflakes==1.5.0 - pygments==2.14.0 - pytest==3.0.6 - pytest-wholenodeid==0.2 - pytz==2025.2 - requests==2.27.1 - requests-toolbelt==1.0.0 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==1.5.2 - tox==2.4.1 - twine==1.8.1 - typing-extensions==4.1.1 - urllib3==1.26.20 - virtualenv==20.17.1 - webencodings==0.5.1 - zipp==3.6.0 prefix: /opt/conda/envs/bleach
[ "tests/test_basics.py::TestClean::test_filters" ]
[]
[ "tests/test_basics.py::TestClean::test_empty", "tests/test_basics.py::TestClean::test_nbsp", "tests/test_basics.py::TestClean::test_comments_only", "tests/test_basics.py::TestClean::test_with_comments", "tests/test_basics.py::TestClean::test_no_html", "tests/test_basics.py::TestClean::test_allowed_html", "tests/test_basics.py::TestClean::test_bad_html", "tests/test_basics.py::TestClean::test_function_arguments", "tests/test_basics.py::TestClean::test_named_arguments", "tests/test_basics.py::TestClean::test_disallowed_html", "tests/test_basics.py::TestClean::test_bad_href", "tests/test_basics.py::TestClean::test_bare_entities", "tests/test_basics.py::TestClean::test_escaped_entities", "tests/test_basics.py::TestClean::test_weird_strings", "tests/test_basics.py::TestClean::test_stripping", "tests/test_basics.py::TestClean::test_allowed_styles", "tests/test_basics.py::TestClean::test_lowercase_html", "tests/test_basics.py::TestClean::test_wildcard_attributes", "tests/test_basics.py::TestClean::test_callable_attributes", "tests/test_basics.py::TestClean::test_svg_attr_val_allows_ref", "tests/test_basics.py::TestClean::test_user_defined_protocols_valid", "tests/test_basics.py::TestClean::test_user_defined_protocols_invalid", "tests/test_basics.py::TestCleaner::test_basics", "tests/test_basics.py::TestLinkify::test_no_href_links", "tests/test_basics.py::TestLinkify::test_rel_already_there", "tests/test_basics.py::test_xml_render", "tests/test_basics.py::test_idempotent", "tests/test_basics.py::test_serializer" ]
[]
Apache License 2.0
1,056
[ "bleach/__init__.py", "bleach/sanitizer.py", "docs/clean.rst" ]
[ "bleach/__init__.py", "bleach/sanitizer.py", "docs/clean.rst" ]
Azure__WALinuxAgent-602
d3a25f6cba37f8f18330d1a55500a4648d22dc49
2017-03-03 23:01:11
6e9b985c1d7d564253a1c344bab01b45093103cd
brendandixon: LGTM
diff --git a/azurelinuxagent/common/protocol/hostplugin.py b/azurelinuxagent/common/protocol/hostplugin.py index 4c4c2290..bdae56e2 100644 --- a/azurelinuxagent/common/protocol/hostplugin.py +++ b/azurelinuxagent/common/protocol/hostplugin.py @@ -80,10 +80,10 @@ class HostPluginProtocol(object): def get_artifact_request(self, artifact_url, artifact_manifest_url=None): if not self.ensure_initialized(): logger.error("host plugin channel is not available") - return + return None, None if textutil.is_str_none_or_whitespace(artifact_url): logger.error("no extension artifact url was provided") - return + return None, None url = URI_FORMAT_GET_EXTENSION_ARTIFACT.format(self.endpoint, HOST_PLUGIN_PORT) diff --git a/azurelinuxagent/common/rdma.py b/azurelinuxagent/common/rdma.py index ba9a0294..226482d3 100644 --- a/azurelinuxagent/common/rdma.py +++ b/azurelinuxagent/common/rdma.py @@ -133,14 +133,14 @@ class RDMAHandler(object): """Load the kernel driver, this depends on the proper driver to be installed with the install_driver() method""" logger.info("RDMA: probing module '%s'" % self.driver_module_name) - result = shellutil.run('modprobe %s' % self.driver_module_name) + result = shellutil.run('modprobe --first-time %s' % self.driver_module_name) if result != 0: error_msg = 'Could not load "%s" kernel module. ' - error_msg += 'Run "modprobe %s" as root for more details' + error_msg += 'Run "modprobe --first-time %s" as root for more details' logger.error( error_msg % (self.driver_module_name, self.driver_module_name) ) - return + return False logger.info('RDMA: Loaded the kernel driver successfully.') return True @@ -158,6 +158,7 @@ class RDMAHandler(object): logger.info('RDMA: module loaded.') return True logger.info('RDMA: module not loaded.') + return False def reboot_system(self): """Reboot the system. This is required as the kernel module for diff --git a/azurelinuxagent/ga/exthandlers.py b/azurelinuxagent/ga/exthandlers.py index c563cc85..9b99d041 100644 --- a/azurelinuxagent/ga/exthandlers.py +++ b/azurelinuxagent/ga/exthandlers.py @@ -341,7 +341,7 @@ class ExtHandlerInstance(object): self.logger = logger.Logger(logger.DEFAULT_LOGGER, prefix) try: - fileutil.mkdir(self.get_log_dir(), mode=0o744) + fileutil.mkdir(self.get_log_dir(), mode=0o755) except IOError as e: self.logger.error(u"Failed to create extension log dir: {0}", e) diff --git a/azurelinuxagent/ga/update.py b/azurelinuxagent/ga/update.py index ed05135c..59bc70c5 100644 --- a/azurelinuxagent/ga/update.py +++ b/azurelinuxagent/ga/update.py @@ -701,11 +701,15 @@ class GuestAgent(object): if self._fetch(uri.uri): break else: - if self.host is not None: + if self.host is not None and self.host.ensure_initialized(): logger.warn("Download unsuccessful, falling back to host plugin") uri, headers = self.host.get_artifact_request(uri.uri, self.host.manifest_uri) - if self._fetch(uri, headers=headers): + if uri is not None \ + and headers is not None \ + and self._fetch(uri, headers=headers): break + else: + logger.warn("Download unsuccessful, host plugin not available") if not os.path.isfile(self.get_agent_pkg_path()): msg = u"Unable to download Agent {0} from any URI".format(self.name) diff --git a/azurelinuxagent/pa/rdma/centos.py b/azurelinuxagent/pa/rdma/centos.py index 8ad09c54..214f9ead 100644 --- a/azurelinuxagent/pa/rdma/centos.py +++ b/azurelinuxagent/pa/rdma/centos.py @@ -173,8 +173,7 @@ class CentOSRDMAHandler(RDMAHandler): 'user mode', self.rdma_user_mode_package_name, umod_pkg_path) logger.info("RDMA: driver packages installed") - self.load_driver_module() - if not self.is_driver_loaded(): + if not self.load_driver_module() or not self.is_driver_loaded(): logger.info("RDMA: driver module is not loaded; reboot required") self.reboot_system() else: diff --git a/azurelinuxagent/pa/rdma/suse.py b/azurelinuxagent/pa/rdma/suse.py index f0d8d0f5..d31b2b08 100644 --- a/azurelinuxagent/pa/rdma/suse.py +++ b/azurelinuxagent/pa/rdma/suse.py @@ -93,8 +93,7 @@ class SUSERDMAHandler(RDMAHandler): msg = 'RDMA: Successfully installed "%s" from ' msg += 'configured repositories' logger.info(msg % complete_name) - self.load_driver_module() - if requires_reboot: + if not self.load_driver_module() or requires_reboot: self.reboot_system() return True else: @@ -119,8 +118,7 @@ class SUSERDMAHandler(RDMAHandler): msg = 'RDMA: Successfully installed "%s" from ' msg += 'local package cache' logger.info(msg % (local_package)) - self.load_driver_module() - if requires_reboot: + if not self.load_driver_module() or requires_reboot: self.reboot_system() return True else:
Unhandled error ``` 2017/02/06 19:09:15.537324 ERROR get API versions failed with [(000009)HTTP GET failed] 2017/02/06 19:09:15.537516 ERROR Event: name=WALA, op=InitializeHostPlugin, message= 2017/02/06 19:09:15.538399 ERROR host plugin channel is not available 2017/02/06 19:09:15.545516 WARNING Agent WALinuxAgent-2.2.4 failed with exception: 'NoneType' object is not iterable 2017/02/06 19:10:14.026838 WARNING Agent WALinuxAgent-2.2.4 launched with command 'python -u bin/WALinuxAgent-2.2.4-py2.7.egg -run-exthandlers' failed with return code: 1 ``` We need to handle this failure more gracefully
Azure/WALinuxAgent
diff --git a/tests/ga/test_update.py b/tests/ga/test_update.py index a431a9b6..5277e594 100644 --- a/tests/ga/test_update.py +++ b/tests/ga/test_update.py @@ -17,30 +17,10 @@ from __future__ import print_function -import copy -import glob -import json -import os -import platform -import random -import re -import subprocess -import sys -import tempfile -import zipfile - -from tests.protocol.mockwiredata import * -from tests.tools import * - -import azurelinuxagent.common.logger as logger -import azurelinuxagent.common.utils.fileutil as fileutil - -from azurelinuxagent.common.exception import UpdateError -from azurelinuxagent.common.protocol.restapi import * +from azurelinuxagent.common.protocol.hostplugin import * from azurelinuxagent.common.protocol.wire import * -from azurelinuxagent.common.utils.flexible_version import FlexibleVersion -from azurelinuxagent.common.version import AGENT_NAME, AGENT_VERSION from azurelinuxagent.ga.update import * +from tests.tools import * NO_ERROR = { "last_failure" : 0.0, @@ -194,7 +174,7 @@ class UpdateTestCase(AgentTestCase): self.copy_agents(get_agent_pkgs()[0]) self.expand_agents() count -= 1 - + # Determine the most recent agent version versions = self.agent_versions() src_v = FlexibleVersion(str(versions[0])) @@ -290,11 +270,11 @@ class TestGuestAgentError(UpdateTestCase): for i in range(0, MAX_FAILURE): err.mark_failure() - + # Agent failed >= MAX_FAILURE, it should be blacklisted self.assertTrue(err.is_blacklisted) self.assertEqual(MAX_FAILURE, err.failure_count) - + # Clear old failure does not clear recent failure err.clear_old_failure() self.assertTrue(err.is_blacklisted) @@ -396,7 +376,7 @@ class TestGuestAgent(UpdateTestCase): self.assertFalse(agent.is_available) agent._unpack() self.assertTrue(agent.is_available) - + agent.mark_failure(is_fatal=True) self.assertFalse(agent.is_available) return @@ -409,7 +389,7 @@ class TestGuestAgent(UpdateTestCase): agent._unpack() self.assertFalse(agent.is_blacklisted) self.assertEqual(agent.is_blacklisted, agent.error.is_blacklisted) - + agent.mark_failure(is_fatal=True) self.assertTrue(agent.is_blacklisted) self.assertEqual(agent.is_blacklisted, agent.error.is_blacklisted) @@ -525,7 +505,7 @@ class TestGuestAgent(UpdateTestCase): self.assertFalse(os.path.isdir(self.agent_path)) mock_http_get.return_value= ResponseMock(status=restutil.httpclient.SERVICE_UNAVAILABLE) - + pkg = ExtHandlerPackage(version=str(get_agent_version())) pkg.uris.append(ExtHandlerPackageUri()) agent = GuestAgent(pkg=pkg) @@ -546,6 +526,8 @@ class TestGuestAgent(UpdateTestCase): ext_uri = 'ext_uri' host_uri = 'host_uri' + api_uri = URI_FORMAT_GET_API_VERSIONS.format(host_uri, HOST_PLUGIN_PORT) + art_uri = URI_FORMAT_GET_EXTENSION_ARTIFACT.format(host_uri, HOST_PLUGIN_PORT) mock_host = HostPluginProtocol(host_uri, 'container_id', 'role_config') @@ -555,13 +537,29 @@ class TestGuestAgent(UpdateTestCase): agent = GuestAgent(pkg=pkg) agent.host = mock_host + # ensure fallback fails gracefully, no http + self.assertRaises(UpdateError, agent._download) + self.assertEqual(mock_http_get.call_count, 2) + self.assertEqual(mock_http_get.call_args_list[0][0][0], ext_uri) + self.assertEqual(mock_http_get.call_args_list[1][0][0], api_uri) + + # ensure fallback fails gracefully, artifact api failure with patch.object(HostPluginProtocol, - "get_artifact_request", - return_value=[host_uri, {}]): + "ensure_initialized", + return_value=True): self.assertRaises(UpdateError, agent._download) - self.assertEqual(mock_http_get.call_count, 2) - self.assertEqual(mock_http_get.call_args_list[0][0][0], ext_uri) - self.assertEqual(mock_http_get.call_args_list[1][0][0], host_uri) + self.assertEqual(mock_http_get.call_count, 4) + self.assertEqual(mock_http_get.call_args_list[2][0][0], ext_uri) + self.assertEqual(mock_http_get.call_args_list[3][0][0], art_uri) + + # ensure fallback works as expected + with patch.object(HostPluginProtocol, + "get_artifact_request", + return_value=[art_uri, {}]): + self.assertRaises(UpdateError, agent._download) + self.assertEqual(mock_http_get.call_count, 6) + self.assertEqual(mock_http_get.call_args_list[4][0][0], ext_uri) + self.assertEqual(mock_http_get.call_args_list[5][0][0], art_uri) @patch("azurelinuxagent.ga.update.restutil.http_get") def test_ensure_downloaded(self, mock_http_get): @@ -688,7 +686,7 @@ class TestUpdate(UpdateTestCase): protocol=None, versions=None, count=5): - + latest_version = self.prepare_agents(count=count) if versions is None or len(versions) <= 0: versions = [latest_version] @@ -741,7 +739,7 @@ class TestUpdate(UpdateTestCase): self.prepare_agents() agent_count = self.agent_count() self.assertEqual(5, agent_count) - + agent_versions = self.agent_versions()[:3] self.assertTrue(self._test_upgrade_available(versions=agent_versions)) self.assertEqual(len(agent_versions), len(self.update_handler.agents)) @@ -793,7 +791,7 @@ class TestUpdate(UpdateTestCase): return iterations[0] < invocations mock_util.check_pid_alive = Mock(side_effect=iterator) - + with patch('os.getpid', return_value=42): with patch('time.sleep', return_value=None) as mock_sleep: self.update_handler._ensure_no_orphans(orphan_wait_interval=interval) @@ -1178,7 +1176,7 @@ class TestUpdate(UpdateTestCase): # reference. Incrementing an item of a list changes an item to # which the code has a reference. # See http://stackoverflow.com/questions/26408941/python-nested-functions-and-variable-scope - iterations = [0] + iterations = [0] def iterator(*args, **kwargs): iterations[0] += 1 if iterations[0] >= invocations:
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 1 }, "num_modified_files": 6 }
2.2
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pyasn1", "nose", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.4", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work certifi==2021.5.30 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work nose==1.3.7 packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work pyasn1==0.5.1 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 toml @ file:///tmp/build/80754af9/toml_1616166611790/work typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work -e git+https://github.com/Azure/WALinuxAgent.git@d3a25f6cba37f8f18330d1a55500a4648d22dc49#egg=WALinuxAgent zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: WALinuxAgent channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - nose==1.3.7 - pyasn1==0.5.1 prefix: /opt/conda/envs/WALinuxAgent
[ "tests/ga/test_update.py::TestGuestAgent::test_download_fallback" ]
[]
[ "tests/ga/test_update.py::TestGuestAgentError::test_clear", "tests/ga/test_update.py::TestGuestAgentError::test_creation", "tests/ga/test_update.py::TestGuestAgentError::test_load_preserves_error_state", "tests/ga/test_update.py::TestGuestAgentError::test_mark_failure", "tests/ga/test_update.py::TestGuestAgentError::test_mark_failure_permanent", "tests/ga/test_update.py::TestGuestAgentError::test_save", "tests/ga/test_update.py::TestGuestAgentError::test_str", "tests/ga/test_update.py::TestGuestAgent::test_clear_error", "tests/ga/test_update.py::TestGuestAgent::test_creation", "tests/ga/test_update.py::TestGuestAgent::test_download", "tests/ga/test_update.py::TestGuestAgent::test_download_fail", "tests/ga/test_update.py::TestGuestAgent::test_ensure_download_skips_blacklisted", "tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded", "tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded_download_fails", "tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded_load_manifest_fails", "tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded_unpack_fails", "tests/ga/test_update.py::TestGuestAgent::test_is_available", "tests/ga/test_update.py::TestGuestAgent::test_is_blacklisted", "tests/ga/test_update.py::TestGuestAgent::test_is_downloaded", "tests/ga/test_update.py::TestGuestAgent::test_load_error", "tests/ga/test_update.py::TestGuestAgent::test_load_manifest", "tests/ga/test_update.py::TestGuestAgent::test_load_manifest_is_empty", "tests/ga/test_update.py::TestGuestAgent::test_load_manifest_is_malformed", "tests/ga/test_update.py::TestGuestAgent::test_load_manifest_missing", "tests/ga/test_update.py::TestGuestAgent::test_mark_failure", "tests/ga/test_update.py::TestGuestAgent::test_unpack", "tests/ga/test_update.py::TestGuestAgent::test_unpack_fail", "tests/ga/test_update.py::TestUpdate::test_creation", "tests/ga/test_update.py::TestUpdate::test_emit_restart_event_emits_event_if_not_clean_start", "tests/ga/test_update.py::TestUpdate::test_emit_restart_event_writes_sentinal_file", "tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans", "tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans_ignores_exceptions", "tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans_kills_after_interval", "tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans_skips_if_no_orphans", "tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_ignores_installed_agent", "tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_raises_exception_for_restarting_agent", "tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_resets_with_new_agent", "tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_will_not_raise_exception_for_long_restarts", "tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_will_not_raise_exception_too_few_restarts", "tests/ga/test_update.py::TestUpdate::test_filter_blacklisted_agents", "tests/ga/test_update.py::TestUpdate::test_get_latest_agent", "tests/ga/test_update.py::TestUpdate::test_get_latest_agent_excluded", "tests/ga/test_update.py::TestUpdate::test_get_latest_agent_no_updates", "tests/ga/test_update.py::TestUpdate::test_get_latest_agent_skip_updates", "tests/ga/test_update.py::TestUpdate::test_get_latest_agent_skips_unavailable", "tests/ga/test_update.py::TestUpdate::test_get_pid_files", "tests/ga/test_update.py::TestUpdate::test_get_pid_files_returns_previous", "tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_false_for_current_agent", "tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_false_for_exceptions", "tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_true_sentinal_agent_is_not_current", "tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_true_when_no_sentinal", "tests/ga/test_update.py::TestUpdate::test_is_orphaned_returns_false_if_parent_exists", "tests/ga/test_update.py::TestUpdate::test_is_orphaned_returns_true_if_parent_does_not_exist", "tests/ga/test_update.py::TestUpdate::test_is_orphaned_returns_true_if_parent_is_init", "tests/ga/test_update.py::TestUpdate::test_load_agents", "tests/ga/test_update.py::TestUpdate::test_load_agents_does_reload", "tests/ga/test_update.py::TestUpdate::test_load_agents_sorts", "tests/ga/test_update.py::TestUpdate::test_purge_agents", "tests/ga/test_update.py::TestUpdate::test_run", "tests/ga/test_update.py::TestUpdate::test_run_clears_sentinal_on_successful_exit", "tests/ga/test_update.py::TestUpdate::test_run_emits_restart_event", "tests/ga/test_update.py::TestUpdate::test_run_keeps_running", "tests/ga/test_update.py::TestUpdate::test_run_latest", "tests/ga/test_update.py::TestUpdate::test_run_latest_captures_signals", "tests/ga/test_update.py::TestUpdate::test_run_latest_creates_only_one_signal_handler", "tests/ga/test_update.py::TestUpdate::test_run_latest_defaults_to_current", "tests/ga/test_update.py::TestUpdate::test_run_latest_exception_blacklists", "tests/ga/test_update.py::TestUpdate::test_run_latest_forwards_output", "tests/ga/test_update.py::TestUpdate::test_run_latest_nonzero_code_marks_failures", "tests/ga/test_update.py::TestUpdate::test_run_latest_polling_stops_at_failure", "tests/ga/test_update.py::TestUpdate::test_run_latest_polling_stops_at_success", "tests/ga/test_update.py::TestUpdate::test_run_latest_polls_and_waits_for_success", "tests/ga/test_update.py::TestUpdate::test_run_leaves_sentinal_on_unsuccessful_exit", "tests/ga/test_update.py::TestUpdate::test_run_stops_if_orphaned", "tests/ga/test_update.py::TestUpdate::test_run_stops_if_update_available", "tests/ga/test_update.py::TestUpdate::test_set_agents_sets_agents", "tests/ga/test_update.py::TestUpdate::test_set_agents_sorts_agents", "tests/ga/test_update.py::TestUpdate::test_set_sentinal", "tests/ga/test_update.py::TestUpdate::test_set_sentinal_writes_current_agent", "tests/ga/test_update.py::TestUpdate::test_shutdown", "tests/ga/test_update.py::TestUpdate::test_shutdown_ignores_exceptions", "tests/ga/test_update.py::TestUpdate::test_shutdown_ignores_missing_sentinal_file", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_handles_missing_family", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_includes_old_agents", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_purges_old_agents", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_returns_true_on_first_use", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_skips_if_too_frequent", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_skips_if_when_no_new_versions", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_skips_when_no_versions", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_skips_when_updates_are_disabled", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_sorts", "tests/ga/test_update.py::TestUpdate::test_write_pid_file", "tests/ga/test_update.py::TestUpdate::test_write_pid_file_ignores_exceptions" ]
[]
Apache License 2.0
1,057
[ "azurelinuxagent/ga/update.py", "azurelinuxagent/pa/rdma/centos.py", "azurelinuxagent/common/protocol/hostplugin.py", "azurelinuxagent/common/rdma.py", "azurelinuxagent/ga/exthandlers.py", "azurelinuxagent/pa/rdma/suse.py" ]
[ "azurelinuxagent/ga/update.py", "azurelinuxagent/pa/rdma/centos.py", "azurelinuxagent/common/protocol/hostplugin.py", "azurelinuxagent/common/rdma.py", "azurelinuxagent/ga/exthandlers.py", "azurelinuxagent/pa/rdma/suse.py" ]
Azure__WALinuxAgent-603
d3a25f6cba37f8f18330d1a55500a4648d22dc49
2017-03-03 23:32:44
6e9b985c1d7d564253a1c344bab01b45093103cd
brendandixon: LGTM
diff --git a/azurelinuxagent/common/protocol/hostplugin.py b/azurelinuxagent/common/protocol/hostplugin.py index 4c4c2290..bdae56e2 100644 --- a/azurelinuxagent/common/protocol/hostplugin.py +++ b/azurelinuxagent/common/protocol/hostplugin.py @@ -80,10 +80,10 @@ class HostPluginProtocol(object): def get_artifact_request(self, artifact_url, artifact_manifest_url=None): if not self.ensure_initialized(): logger.error("host plugin channel is not available") - return + return None, None if textutil.is_str_none_or_whitespace(artifact_url): logger.error("no extension artifact url was provided") - return + return None, None url = URI_FORMAT_GET_EXTENSION_ARTIFACT.format(self.endpoint, HOST_PLUGIN_PORT) diff --git a/azurelinuxagent/common/rdma.py b/azurelinuxagent/common/rdma.py index ba9a0294..226482d3 100644 --- a/azurelinuxagent/common/rdma.py +++ b/azurelinuxagent/common/rdma.py @@ -133,14 +133,14 @@ class RDMAHandler(object): """Load the kernel driver, this depends on the proper driver to be installed with the install_driver() method""" logger.info("RDMA: probing module '%s'" % self.driver_module_name) - result = shellutil.run('modprobe %s' % self.driver_module_name) + result = shellutil.run('modprobe --first-time %s' % self.driver_module_name) if result != 0: error_msg = 'Could not load "%s" kernel module. ' - error_msg += 'Run "modprobe %s" as root for more details' + error_msg += 'Run "modprobe --first-time %s" as root for more details' logger.error( error_msg % (self.driver_module_name, self.driver_module_name) ) - return + return False logger.info('RDMA: Loaded the kernel driver successfully.') return True @@ -158,6 +158,7 @@ class RDMAHandler(object): logger.info('RDMA: module loaded.') return True logger.info('RDMA: module not loaded.') + return False def reboot_system(self): """Reboot the system. This is required as the kernel module for diff --git a/azurelinuxagent/ga/exthandlers.py b/azurelinuxagent/ga/exthandlers.py index c563cc85..9b99d041 100644 --- a/azurelinuxagent/ga/exthandlers.py +++ b/azurelinuxagent/ga/exthandlers.py @@ -341,7 +341,7 @@ class ExtHandlerInstance(object): self.logger = logger.Logger(logger.DEFAULT_LOGGER, prefix) try: - fileutil.mkdir(self.get_log_dir(), mode=0o744) + fileutil.mkdir(self.get_log_dir(), mode=0o755) except IOError as e: self.logger.error(u"Failed to create extension log dir: {0}", e) diff --git a/azurelinuxagent/ga/update.py b/azurelinuxagent/ga/update.py index ed05135c..59bc70c5 100644 --- a/azurelinuxagent/ga/update.py +++ b/azurelinuxagent/ga/update.py @@ -701,11 +701,15 @@ class GuestAgent(object): if self._fetch(uri.uri): break else: - if self.host is not None: + if self.host is not None and self.host.ensure_initialized(): logger.warn("Download unsuccessful, falling back to host plugin") uri, headers = self.host.get_artifact_request(uri.uri, self.host.manifest_uri) - if self._fetch(uri, headers=headers): + if uri is not None \ + and headers is not None \ + and self._fetch(uri, headers=headers): break + else: + logger.warn("Download unsuccessful, host plugin not available") if not os.path.isfile(self.get_agent_pkg_path()): msg = u"Unable to download Agent {0} from any URI".format(self.name) diff --git a/azurelinuxagent/pa/provision/ubuntu.py b/azurelinuxagent/pa/provision/ubuntu.py index 60b9a89a..a71df374 100644 --- a/azurelinuxagent/pa/provision/ubuntu.py +++ b/azurelinuxagent/pa/provision/ubuntu.py @@ -89,8 +89,14 @@ class UbuntuProvisionHandler(ProvisionHandler): path = '/etc/ssh/ssh_host_{0}_key.pub'.format(keypair_type) for retry in range(0, max_retry): if os.path.isfile(path): - return self.get_ssh_host_key_thumbprint(keypair_type) + logger.info("ssh host key found at: {0}".format(path)) + try: + thumbprint = self.get_ssh_host_key_thumbprint(keypair_type) + logger.info("Thumbprint obtained from : {0}".format(path)) + return thumbprint + except ProvisionError: + logger.warn("Could not get thumbprint from {0}".format(path)) if retry < max_retry - 1: - logger.info("Wait for ssh host key be generated: {0}", path) + logger.info("Wait for ssh host key be generated: {0}".format(path)) time.sleep(5) raise ProvisionError("ssh host key is not generated.") diff --git a/azurelinuxagent/pa/rdma/centos.py b/azurelinuxagent/pa/rdma/centos.py index 8ad09c54..214f9ead 100644 --- a/azurelinuxagent/pa/rdma/centos.py +++ b/azurelinuxagent/pa/rdma/centos.py @@ -173,8 +173,7 @@ class CentOSRDMAHandler(RDMAHandler): 'user mode', self.rdma_user_mode_package_name, umod_pkg_path) logger.info("RDMA: driver packages installed") - self.load_driver_module() - if not self.is_driver_loaded(): + if not self.load_driver_module() or not self.is_driver_loaded(): logger.info("RDMA: driver module is not loaded; reboot required") self.reboot_system() else: diff --git a/azurelinuxagent/pa/rdma/suse.py b/azurelinuxagent/pa/rdma/suse.py index f0d8d0f5..d31b2b08 100644 --- a/azurelinuxagent/pa/rdma/suse.py +++ b/azurelinuxagent/pa/rdma/suse.py @@ -93,8 +93,7 @@ class SUSERDMAHandler(RDMAHandler): msg = 'RDMA: Successfully installed "%s" from ' msg += 'configured repositories' logger.info(msg % complete_name) - self.load_driver_module() - if requires_reboot: + if not self.load_driver_module() or requires_reboot: self.reboot_system() return True else: @@ -119,8 +118,7 @@ class SUSERDMAHandler(RDMAHandler): msg = 'RDMA: Successfully installed "%s" from ' msg += 'local package cache' logger.info(msg % (local_package)) - self.load_driver_module() - if requires_reboot: + if not self.load_driver_module() or requires_reboot: self.reboot_system() return True else:
Timing Issue with cloud-init and host keys Under some circumstances, provisioning can fail waiting for cloud-init to regenerate SSH host keys: ``` 2017/02/08 23:03:23.712479 INFO Wait for ssh host key to be generated. 2017/02/08 23:03:23.756726 ERROR run cmd 'ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub' failed 2017/02/08 23:03:23.762243 ERROR Error Code:255 2017/02/08 23:03:23.766393 ERROR Result:ssh-keygen: /etc/ssh/ssh_host_rsa_key.pub: No such file or directory 2017/02/08 23:03:23.775621 ERROR Provision failed: (000004)**Failed to generate ssh host key: ret=255, out= ssh-keygen: /etc/ssh/ssh_host_rsa_key.pub: No such file or directory** ``` Waagent checks the thumbprint of the host rsa pub file to validate that the key is regenerated. If the file doesn't exist, it waits up to 5 minutes for it to be generated. Based on the logs, the sequence of events seems to be 1. Waagent confirms existence of the file 2. Cloud-init deletes the file and begins generating a new file 3. Waagent tries and fails to get the thumbprint because the file doesn't exist One or both of the following should be implemented: 1. Use more caution when exiting from this function with error. If the thumbprint operation finds that the file doesn't exist (when it was just confirmed to exist by other means), we should try again. 2. If the expectation is that the SSH host keys are deleted before provisioning, then waagent -deprovision should delete them.
Azure/WALinuxAgent
diff --git a/tests/ga/test_update.py b/tests/ga/test_update.py index a431a9b6..5277e594 100644 --- a/tests/ga/test_update.py +++ b/tests/ga/test_update.py @@ -17,30 +17,10 @@ from __future__ import print_function -import copy -import glob -import json -import os -import platform -import random -import re -import subprocess -import sys -import tempfile -import zipfile - -from tests.protocol.mockwiredata import * -from tests.tools import * - -import azurelinuxagent.common.logger as logger -import azurelinuxagent.common.utils.fileutil as fileutil - -from azurelinuxagent.common.exception import UpdateError -from azurelinuxagent.common.protocol.restapi import * +from azurelinuxagent.common.protocol.hostplugin import * from azurelinuxagent.common.protocol.wire import * -from azurelinuxagent.common.utils.flexible_version import FlexibleVersion -from azurelinuxagent.common.version import AGENT_NAME, AGENT_VERSION from azurelinuxagent.ga.update import * +from tests.tools import * NO_ERROR = { "last_failure" : 0.0, @@ -194,7 +174,7 @@ class UpdateTestCase(AgentTestCase): self.copy_agents(get_agent_pkgs()[0]) self.expand_agents() count -= 1 - + # Determine the most recent agent version versions = self.agent_versions() src_v = FlexibleVersion(str(versions[0])) @@ -290,11 +270,11 @@ class TestGuestAgentError(UpdateTestCase): for i in range(0, MAX_FAILURE): err.mark_failure() - + # Agent failed >= MAX_FAILURE, it should be blacklisted self.assertTrue(err.is_blacklisted) self.assertEqual(MAX_FAILURE, err.failure_count) - + # Clear old failure does not clear recent failure err.clear_old_failure() self.assertTrue(err.is_blacklisted) @@ -396,7 +376,7 @@ class TestGuestAgent(UpdateTestCase): self.assertFalse(agent.is_available) agent._unpack() self.assertTrue(agent.is_available) - + agent.mark_failure(is_fatal=True) self.assertFalse(agent.is_available) return @@ -409,7 +389,7 @@ class TestGuestAgent(UpdateTestCase): agent._unpack() self.assertFalse(agent.is_blacklisted) self.assertEqual(agent.is_blacklisted, agent.error.is_blacklisted) - + agent.mark_failure(is_fatal=True) self.assertTrue(agent.is_blacklisted) self.assertEqual(agent.is_blacklisted, agent.error.is_blacklisted) @@ -525,7 +505,7 @@ class TestGuestAgent(UpdateTestCase): self.assertFalse(os.path.isdir(self.agent_path)) mock_http_get.return_value= ResponseMock(status=restutil.httpclient.SERVICE_UNAVAILABLE) - + pkg = ExtHandlerPackage(version=str(get_agent_version())) pkg.uris.append(ExtHandlerPackageUri()) agent = GuestAgent(pkg=pkg) @@ -546,6 +526,8 @@ class TestGuestAgent(UpdateTestCase): ext_uri = 'ext_uri' host_uri = 'host_uri' + api_uri = URI_FORMAT_GET_API_VERSIONS.format(host_uri, HOST_PLUGIN_PORT) + art_uri = URI_FORMAT_GET_EXTENSION_ARTIFACT.format(host_uri, HOST_PLUGIN_PORT) mock_host = HostPluginProtocol(host_uri, 'container_id', 'role_config') @@ -555,13 +537,29 @@ class TestGuestAgent(UpdateTestCase): agent = GuestAgent(pkg=pkg) agent.host = mock_host + # ensure fallback fails gracefully, no http + self.assertRaises(UpdateError, agent._download) + self.assertEqual(mock_http_get.call_count, 2) + self.assertEqual(mock_http_get.call_args_list[0][0][0], ext_uri) + self.assertEqual(mock_http_get.call_args_list[1][0][0], api_uri) + + # ensure fallback fails gracefully, artifact api failure with patch.object(HostPluginProtocol, - "get_artifact_request", - return_value=[host_uri, {}]): + "ensure_initialized", + return_value=True): self.assertRaises(UpdateError, agent._download) - self.assertEqual(mock_http_get.call_count, 2) - self.assertEqual(mock_http_get.call_args_list[0][0][0], ext_uri) - self.assertEqual(mock_http_get.call_args_list[1][0][0], host_uri) + self.assertEqual(mock_http_get.call_count, 4) + self.assertEqual(mock_http_get.call_args_list[2][0][0], ext_uri) + self.assertEqual(mock_http_get.call_args_list[3][0][0], art_uri) + + # ensure fallback works as expected + with patch.object(HostPluginProtocol, + "get_artifact_request", + return_value=[art_uri, {}]): + self.assertRaises(UpdateError, agent._download) + self.assertEqual(mock_http_get.call_count, 6) + self.assertEqual(mock_http_get.call_args_list[4][0][0], ext_uri) + self.assertEqual(mock_http_get.call_args_list[5][0][0], art_uri) @patch("azurelinuxagent.ga.update.restutil.http_get") def test_ensure_downloaded(self, mock_http_get): @@ -688,7 +686,7 @@ class TestUpdate(UpdateTestCase): protocol=None, versions=None, count=5): - + latest_version = self.prepare_agents(count=count) if versions is None or len(versions) <= 0: versions = [latest_version] @@ -741,7 +739,7 @@ class TestUpdate(UpdateTestCase): self.prepare_agents() agent_count = self.agent_count() self.assertEqual(5, agent_count) - + agent_versions = self.agent_versions()[:3] self.assertTrue(self._test_upgrade_available(versions=agent_versions)) self.assertEqual(len(agent_versions), len(self.update_handler.agents)) @@ -793,7 +791,7 @@ class TestUpdate(UpdateTestCase): return iterations[0] < invocations mock_util.check_pid_alive = Mock(side_effect=iterator) - + with patch('os.getpid', return_value=42): with patch('time.sleep', return_value=None) as mock_sleep: self.update_handler._ensure_no_orphans(orphan_wait_interval=interval) @@ -1178,7 +1176,7 @@ class TestUpdate(UpdateTestCase): # reference. Incrementing an item of a list changes an item to # which the code has a reference. # See http://stackoverflow.com/questions/26408941/python-nested-functions-and-variable-scope - iterations = [0] + iterations = [0] def iterator(*args, **kwargs): iterations[0] += 1 if iterations[0] >= invocations:
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 3, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 7 }
2.2
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "nose", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.4", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work certifi==2021.5.30 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work nose==1.3.7 packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 toml @ file:///tmp/build/80754af9/toml_1616166611790/work typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work -e git+https://github.com/Azure/WALinuxAgent.git@d3a25f6cba37f8f18330d1a55500a4648d22dc49#egg=WALinuxAgent zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: WALinuxAgent channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - nose==1.3.7 prefix: /opt/conda/envs/WALinuxAgent
[ "tests/ga/test_update.py::TestGuestAgent::test_download_fallback" ]
[]
[ "tests/ga/test_update.py::TestGuestAgentError::test_clear", "tests/ga/test_update.py::TestGuestAgentError::test_creation", "tests/ga/test_update.py::TestGuestAgentError::test_load_preserves_error_state", "tests/ga/test_update.py::TestGuestAgentError::test_mark_failure", "tests/ga/test_update.py::TestGuestAgentError::test_mark_failure_permanent", "tests/ga/test_update.py::TestGuestAgentError::test_save", "tests/ga/test_update.py::TestGuestAgentError::test_str", "tests/ga/test_update.py::TestGuestAgent::test_clear_error", "tests/ga/test_update.py::TestGuestAgent::test_creation", "tests/ga/test_update.py::TestGuestAgent::test_download", "tests/ga/test_update.py::TestGuestAgent::test_download_fail", "tests/ga/test_update.py::TestGuestAgent::test_ensure_download_skips_blacklisted", "tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded", "tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded_download_fails", "tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded_load_manifest_fails", "tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded_unpack_fails", "tests/ga/test_update.py::TestGuestAgent::test_is_available", "tests/ga/test_update.py::TestGuestAgent::test_is_blacklisted", "tests/ga/test_update.py::TestGuestAgent::test_is_downloaded", "tests/ga/test_update.py::TestGuestAgent::test_load_error", "tests/ga/test_update.py::TestGuestAgent::test_load_manifest", "tests/ga/test_update.py::TestGuestAgent::test_load_manifest_is_empty", "tests/ga/test_update.py::TestGuestAgent::test_load_manifest_is_malformed", "tests/ga/test_update.py::TestGuestAgent::test_load_manifest_missing", "tests/ga/test_update.py::TestGuestAgent::test_mark_failure", "tests/ga/test_update.py::TestGuestAgent::test_unpack", "tests/ga/test_update.py::TestGuestAgent::test_unpack_fail", "tests/ga/test_update.py::TestUpdate::test_creation", "tests/ga/test_update.py::TestUpdate::test_emit_restart_event_emits_event_if_not_clean_start", "tests/ga/test_update.py::TestUpdate::test_emit_restart_event_writes_sentinal_file", "tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans", "tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans_ignores_exceptions", "tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans_kills_after_interval", "tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans_skips_if_no_orphans", "tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_ignores_installed_agent", "tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_raises_exception_for_restarting_agent", "tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_resets_with_new_agent", "tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_will_not_raise_exception_for_long_restarts", "tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_will_not_raise_exception_too_few_restarts", "tests/ga/test_update.py::TestUpdate::test_filter_blacklisted_agents", "tests/ga/test_update.py::TestUpdate::test_get_latest_agent", "tests/ga/test_update.py::TestUpdate::test_get_latest_agent_excluded", "tests/ga/test_update.py::TestUpdate::test_get_latest_agent_no_updates", "tests/ga/test_update.py::TestUpdate::test_get_latest_agent_skip_updates", "tests/ga/test_update.py::TestUpdate::test_get_latest_agent_skips_unavailable", "tests/ga/test_update.py::TestUpdate::test_get_pid_files", "tests/ga/test_update.py::TestUpdate::test_get_pid_files_returns_previous", "tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_false_for_current_agent", "tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_false_for_exceptions", "tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_true_sentinal_agent_is_not_current", "tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_true_when_no_sentinal", "tests/ga/test_update.py::TestUpdate::test_is_orphaned_returns_false_if_parent_exists", "tests/ga/test_update.py::TestUpdate::test_is_orphaned_returns_true_if_parent_does_not_exist", "tests/ga/test_update.py::TestUpdate::test_is_orphaned_returns_true_if_parent_is_init", "tests/ga/test_update.py::TestUpdate::test_load_agents", "tests/ga/test_update.py::TestUpdate::test_load_agents_does_reload", "tests/ga/test_update.py::TestUpdate::test_load_agents_sorts", "tests/ga/test_update.py::TestUpdate::test_purge_agents", "tests/ga/test_update.py::TestUpdate::test_run", "tests/ga/test_update.py::TestUpdate::test_run_clears_sentinal_on_successful_exit", "tests/ga/test_update.py::TestUpdate::test_run_emits_restart_event", "tests/ga/test_update.py::TestUpdate::test_run_keeps_running", "tests/ga/test_update.py::TestUpdate::test_run_latest", "tests/ga/test_update.py::TestUpdate::test_run_latest_captures_signals", "tests/ga/test_update.py::TestUpdate::test_run_latest_creates_only_one_signal_handler", "tests/ga/test_update.py::TestUpdate::test_run_latest_defaults_to_current", "tests/ga/test_update.py::TestUpdate::test_run_latest_exception_blacklists", "tests/ga/test_update.py::TestUpdate::test_run_latest_forwards_output", "tests/ga/test_update.py::TestUpdate::test_run_latest_nonzero_code_marks_failures", "tests/ga/test_update.py::TestUpdate::test_run_latest_polling_stops_at_failure", "tests/ga/test_update.py::TestUpdate::test_run_latest_polling_stops_at_success", "tests/ga/test_update.py::TestUpdate::test_run_latest_polls_and_waits_for_success", "tests/ga/test_update.py::TestUpdate::test_run_leaves_sentinal_on_unsuccessful_exit", "tests/ga/test_update.py::TestUpdate::test_run_stops_if_orphaned", "tests/ga/test_update.py::TestUpdate::test_run_stops_if_update_available", "tests/ga/test_update.py::TestUpdate::test_set_agents_sets_agents", "tests/ga/test_update.py::TestUpdate::test_set_agents_sorts_agents", "tests/ga/test_update.py::TestUpdate::test_set_sentinal", "tests/ga/test_update.py::TestUpdate::test_set_sentinal_writes_current_agent", "tests/ga/test_update.py::TestUpdate::test_shutdown", "tests/ga/test_update.py::TestUpdate::test_shutdown_ignores_exceptions", "tests/ga/test_update.py::TestUpdate::test_shutdown_ignores_missing_sentinal_file", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_handles_missing_family", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_includes_old_agents", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_purges_old_agents", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_returns_true_on_first_use", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_skips_if_too_frequent", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_skips_if_when_no_new_versions", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_skips_when_no_versions", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_skips_when_updates_are_disabled", "tests/ga/test_update.py::TestUpdate::test_upgrade_available_sorts", "tests/ga/test_update.py::TestUpdate::test_write_pid_file", "tests/ga/test_update.py::TestUpdate::test_write_pid_file_ignores_exceptions" ]
[]
Apache License 2.0
1,058
[ "azurelinuxagent/ga/update.py", "azurelinuxagent/pa/rdma/centos.py", "azurelinuxagent/common/protocol/hostplugin.py", "azurelinuxagent/common/rdma.py", "azurelinuxagent/pa/provision/ubuntu.py", "azurelinuxagent/ga/exthandlers.py", "azurelinuxagent/pa/rdma/suse.py" ]
[ "azurelinuxagent/ga/update.py", "azurelinuxagent/pa/rdma/centos.py", "azurelinuxagent/common/protocol/hostplugin.py", "azurelinuxagent/common/rdma.py", "azurelinuxagent/pa/provision/ubuntu.py", "azurelinuxagent/ga/exthandlers.py", "azurelinuxagent/pa/rdma/suse.py" ]
PennChopMicrobiomeProgram__illqc-17
bc504d4c93300db446ab7b70cb0660f682d07687
2017-03-04 12:40:47
bc504d4c93300db446ab7b70cb0660f682d07687
diff --git a/illqclib/main.py b/illqclib/main.py index e8503bf..396d282 100644 --- a/illqclib/main.py +++ b/illqclib/main.py @@ -67,7 +67,7 @@ class Trimmomatic(object): "ILLUMINACLIP:%s:2:30:10:8:true" % self._adapter_fp, "LEADING:%d" % self.config["leading"], "TRAILING:%d" % self.config["trailing"], - "SLIDINGWINDOW:%d:%d" % self.config["slidingwindow"], + "SLIDINGWINDOW:%d:%d" % tuple(self.config["slidingwindow"]), "MINLEN:%d" % self.config["minlen"], ]
Cannot configure setting for sliding window Python needs a tuple value for this setting, but JSON does not support tuple types. Suggest converting to value tuple before line 70: https://github.com/PennChopMicrobiomeProgram/illqc/blob/master/illqclib/main.py#L70
PennChopMicrobiomeProgram/illqc
diff --git a/test/test_main.py b/test/test_main.py index 7a75113..803ed7b 100644 --- a/test/test_main.py +++ b/test/test_main.py @@ -26,17 +26,19 @@ class ConfigTests(unittest.TestCase): class TrimmomaticTests(unittest.TestCase): + config_vals = { + "trimmomatic_jar_fp": "trimmomatic-0.30.jar", + "adapter_dir": "adapters", + "adapter": "NexteraPE-PE", + "leading": 3, + "trailing": 3, + "slidingwindow": (4, 15), + "minlen": 36, + "java_heapsize":"200M" + } + def test_make_command(self): - app = Trimmomatic({ - "trimmomatic_jar_fp": "trimmomatic-0.30.jar", - "adapter_dir": "adapters", - "adapter": "NexteraPE-PE", - "leading": 3, - "trailing": 3, - "slidingwindow": (4, 15), - "minlen": 36, - "java_heapsize":"200M" - }) + app = Trimmomatic(self.config_vals) observed = app.make_command("a.fastq", "b.fastq", "mydir") expected = [ 'java', '-Xmx200M', '-jar', 'trimmomatic-0.30.jar', 'PE', '-phred33', @@ -47,3 +49,18 @@ class TrimmomaticTests(unittest.TestCase): 'LEADING:3', 'TRAILING:3', 'SLIDINGWINDOW:4:15', 'MINLEN:36', ] self.assertEqual(observed, expected) + + def test_make_command_sliding_window_as_list(self): + config_vals = self.config_vals.copy() + config_vals["slidingwindow"] = [6, 32] + app = Trimmomatic(config_vals) + observed = app.make_command("a.fastq", "b.fastq", "mydir") + expected = [ + 'java', '-Xmx200M', '-jar', 'trimmomatic-0.30.jar', 'PE', '-phred33', + 'a.fastq', 'b.fastq', + 'mydir/a.fastq', 'mydir/a_unpaired.fastq', + 'mydir/b.fastq', 'mydir/b_unpaired.fastq', + 'ILLUMINACLIP:adapters/NexteraPE-PE.fa:2:30:10:8:true', + 'LEADING:3', 'TRAILING:3', 'SLIDINGWINDOW:6:32', 'MINLEN:36', + ] + self.assertEqual(observed, expected)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 1 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-xdist", "pytest-mock", "pytest-asyncio", "numpy>=1.16.0", "pandas>=1.0.0" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
coverage==7.8.0 exceptiongroup==1.2.2 execnet==2.1.1 -e git+https://github.com/PennChopMicrobiomeProgram/illqc.git@bc504d4c93300db446ab7b70cb0660f682d07687#egg=illQC iniconfig==2.1.0 numpy==2.0.2 packaging==24.2 pandas==2.2.3 pluggy==1.5.0 pytest==8.3.5 pytest-asyncio==0.26.0 pytest-cov==6.0.0 pytest-mock==3.14.0 pytest-xdist==3.6.1 python-dateutil==2.9.0.post0 pytz==2025.2 six==1.17.0 tomli==2.2.1 typing_extensions==4.13.0 tzdata==2025.2
name: illqc channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - coverage==7.8.0 - exceptiongroup==1.2.2 - execnet==2.1.1 - iniconfig==2.1.0 - numpy==2.0.2 - packaging==24.2 - pandas==2.2.3 - pluggy==1.5.0 - pytest==8.3.5 - pytest-asyncio==0.26.0 - pytest-cov==6.0.0 - pytest-mock==3.14.0 - pytest-xdist==3.6.1 - python-dateutil==2.9.0.post0 - pytz==2025.2 - six==1.17.0 - tomli==2.2.1 - typing-extensions==4.13.0 - tzdata==2025.2 prefix: /opt/conda/envs/illqc
[ "test/test_main.py::TrimmomaticTests::test_make_command_sliding_window_as_list" ]
[]
[ "test/test_main.py::ConfigTests::test_default_config_locataion", "test/test_main.py::TrimmomaticTests::test_make_command" ]
[]
null
1,059
[ "illqclib/main.py" ]
[ "illqclib/main.py" ]
meejah__txtorcon-213
8139ebb8f48544121274aaa2892117f02862dc5f
2017-03-04 17:49:24
8139ebb8f48544121274aaa2892117f02862dc5f
diff --git a/txtorcon/router.py b/txtorcon/router.py index 547c321..03b6163 100644 --- a/txtorcon/router.py +++ b/txtorcon/router.py @@ -200,8 +200,6 @@ class Router(object): ) returnValue(relay_data) - - # note that exit-policy is no longer included in the # microdescriptors by default, so this stuff is mostly here as a # historic artifact. If you want to use exit-policy for things diff --git a/txtorcon/torcontrolprotocol.py b/txtorcon/torcontrolprotocol.py index 269c72e..9947c94 100644 --- a/txtorcon/torcontrolprotocol.py +++ b/txtorcon/torcontrolprotocol.py @@ -11,6 +11,7 @@ from twisted.internet import defer from twisted.internet.interfaces import IProtocolFactory from twisted.internet.error import ConnectionDone from twisted.protocols.basic import LineOnlyReceiver +from twisted.python.failure import Failure from zope.interface import implementer @@ -109,7 +110,17 @@ class Event(object): def got_update(self, data): for cb in self.callbacks: - cb(data) + try: + cb(data) + except Exception as e: + log.err(Failure()) + log.err( + "Notifying '{callback}' for '{name}' failed: {e}".format( + callback=cb, + name=self.name, + e=e, + ) + ) def unquote(word):
What happens to an exception in event listener? If an event-handler for an event listener causes an exception, where does it end up going?
meejah/txtorcon
diff --git a/test/test_router.py b/test/test_router.py index 4ddf5c2..de8dd84 100644 --- a/test/test_router.py +++ b/test/test_router.py @@ -3,7 +3,7 @@ from datetime import datetime from mock import Mock from twisted.trial import unittest -from twisted.internet import defer, error +from twisted.internet import defer from twisted.python.failure import Failure from twisted.web.client import ResponseDone @@ -253,7 +253,7 @@ class OnionOOTests(unittest.TestCase): agent.request = Mock(return_value=defer.succeed(resp)) with self.assertRaises(Exception) as ctx: - data = yield self.router.get_onionoo_details(agent) + yield self.router.get_onionoo_details(agent) self.assertTrue( "multiple relays for" in str(ctx.exception) @@ -279,7 +279,7 @@ class OnionOOTests(unittest.TestCase): agent.request = Mock(return_value=defer.succeed(resp)) with self.assertRaises(Exception) as ctx: - data = yield self.router.get_onionoo_details(agent) + yield self.router.get_onionoo_details(agent) self.assertTrue( " but got data for " in str(ctx.exception) diff --git a/test/test_torcontrolprotocol.py b/test/test_torcontrolprotocol.py index a3beda5..03465f0 100644 --- a/test/test_torcontrolprotocol.py +++ b/test/test_torcontrolprotocol.py @@ -849,6 +849,40 @@ platform Tor 0.2.5.0-alpha-dev on Linux self.send(b"650 STREAM 2345 NEW 4321 2.3.4.5:666 REASON=MISC") self.assertEqual(listener.stream_events, 2) + def test_eventlistener_error(self): + self.protocol._set_valid_events('STREAM') + + class EventListener(object): + stream_events = 0 + do_error = False + + def __call__(self, data): + self.stream_events += 1 + if self.do_error: + raise Exception("the bad thing happened") + + # we make sure the first listener has the errors to prove the + # second one still gets called. + listener0 = EventListener() + listener0.do_error = True + listener1 = EventListener() + self.protocol.add_event_listener('STREAM', listener0) + self.protocol.add_event_listener('STREAM', listener1) + + d = self.protocol.defer + self.send(b"250 OK") + self._wait(d) + self.send(b"650 STREAM 1234 NEW 4321 1.2.3.4:555 REASON=MISC") + self.send(b"650 STREAM 2345 NEW 4321 2.3.4.5:666 REASON=MISC") + self.assertEqual(listener0.stream_events, 2) + self.assertEqual(listener1.stream_events, 2) + + # should have logged the two errors + logged = self.flushLoggedErrors() + self.assertEqual(2, len(logged)) + self.assertTrue("the bad thing happened" in str(logged[0])) + self.assertTrue("the bad thing happened" in str(logged[1])) + def test_remove_eventlistener(self): self.protocol._set_valid_events('STREAM') @@ -900,13 +934,12 @@ platform Tor 0.2.5.0-alpha-dev on Linux except Exception as e: self.assertTrue('FOO' in str(e)) - def checkContinuation(self, v): - self.assertEqual(v, "key=\nvalue0\nvalue1") - - def test_continuationLine(self): + def test_continuation_line(self): d = self.protocol.get_info_raw("key") - d.addCallback(self.checkContinuation) + def check_continuation(v): + self.assertEqual(v, "key=\nvalue0\nvalue1") + d.addCallback(check_continuation) self.send(b"250+key=") self.send(b"value0")
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 3, "test_score": 0 }, "num_modified_files": 2 }
0.18
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-xdist", "pytest-mock", "pytest-asyncio" ], "pre_install": [ "apt-get update", "apt-get install -y gcc libgeoip-dev" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.16 ansicolors==1.1.8 attrs==25.3.0 Automat==24.8.1 babel==2.17.0 backports.tarfile==1.2.0 cachetools==5.5.2 certifi==2025.1.31 cffi==1.17.1 chardet==5.2.0 charset-normalizer==3.4.1 click==8.1.8 codecov==2.1.13 colorama==0.4.6 constantly==23.10.4 coverage==7.8.0 coveralls==4.0.1 cryptography==44.0.2 cuvner==24.12.1 distlib==0.3.9 docopt==0.6.2 docutils==0.21.2 exceptiongroup==1.2.2 execnet==2.1.1 filelock==3.18.0 GeoIP==1.3.2 hyperlink==21.0.0 id==1.5.0 idna==3.10 imagesize==1.4.1 importlib_metadata==8.6.1 incremental==24.7.2 iniconfig==2.1.0 ipaddress==1.0.23 jaraco.classes==3.4.0 jaraco.context==6.0.1 jaraco.functools==4.1.0 jeepney==0.9.0 Jinja2==3.1.6 keyring==25.6.0 markdown-it-py==3.0.0 MarkupSafe==3.0.2 mdurl==0.1.2 mock==5.2.0 more-itertools==10.6.0 nh3==0.2.21 packaging==24.2 pep8==1.7.1 platformdirs==4.3.7 pluggy==1.5.0 pyasn1==0.6.1 pyasn1_modules==0.4.2 pycparser==2.22 pyflakes==3.3.1 Pygments==2.19.1 pyOpenSSL==25.0.0 pyproject-api==1.9.0 pytest==8.3.5 pytest-asyncio==0.26.0 pytest-cov==6.0.0 pytest-mock==3.14.0 pytest-xdist==3.6.1 readme_renderer==44.0 repoze.sphinx.autointerface==1.0.0 requests==2.32.3 requests-toolbelt==1.0.0 rfc3986==2.0.0 rich==14.0.0 SecretStorage==3.3.3 service-identity==24.2.0 six==1.17.0 snowballstemmer==2.2.0 Sphinx==7.4.7 sphinxcontrib-applehelp==2.0.0 sphinxcontrib-devhelp==2.0.0 sphinxcontrib-htmlhelp==2.1.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==2.0.0 sphinxcontrib-serializinghtml==2.0.0 tomli==2.2.1 tox==4.25.0 twine==6.1.0 Twisted==24.11.0 -e git+https://github.com/meejah/txtorcon.git@8139ebb8f48544121274aaa2892117f02862dc5f#egg=txtorcon typing_extensions==4.13.0 unidiff==0.7.5 urllib3==2.3.0 virtualenv==20.29.3 watchdog==6.0.0 zipp==3.21.0 zope.interface==7.2
name: txtorcon channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.16 - ansicolors==1.1.8 - attrs==25.3.0 - automat==24.8.1 - babel==2.17.0 - backports-tarfile==1.2.0 - cachetools==5.5.2 - certifi==2025.1.31 - cffi==1.17.1 - chardet==5.2.0 - charset-normalizer==3.4.1 - click==8.1.8 - codecov==2.1.13 - colorama==0.4.6 - constantly==23.10.4 - coverage==7.8.0 - coveralls==4.0.1 - cryptography==44.0.2 - cuvner==24.12.1 - distlib==0.3.9 - docopt==0.6.2 - docutils==0.21.2 - exceptiongroup==1.2.2 - execnet==2.1.1 - filelock==3.18.0 - geoip==1.3.2 - hyperlink==21.0.0 - id==1.5.0 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==8.6.1 - incremental==24.7.2 - iniconfig==2.1.0 - ipaddress==1.0.23 - jaraco-classes==3.4.0 - jaraco-context==6.0.1 - jaraco-functools==4.1.0 - jeepney==0.9.0 - jinja2==3.1.6 - keyring==25.6.0 - markdown-it-py==3.0.0 - markupsafe==3.0.2 - mdurl==0.1.2 - mock==5.2.0 - more-itertools==10.6.0 - nh3==0.2.21 - packaging==24.2 - pep8==1.7.1 - platformdirs==4.3.7 - pluggy==1.5.0 - pyasn1==0.6.1 - pyasn1-modules==0.4.2 - pycparser==2.22 - pyflakes==3.3.1 - pygments==2.19.1 - pyopenssl==25.0.0 - pyproject-api==1.9.0 - pytest==8.3.5 - pytest-asyncio==0.26.0 - pytest-cov==6.0.0 - pytest-mock==3.14.0 - pytest-xdist==3.6.1 - readme-renderer==44.0 - repoze-sphinx-autointerface==1.0.0 - requests==2.32.3 - requests-toolbelt==1.0.0 - rfc3986==2.0.0 - rich==14.0.0 - secretstorage==3.3.3 - service-identity==24.2.0 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==7.4.7 - sphinxcontrib-applehelp==2.0.0 - sphinxcontrib-devhelp==2.0.0 - sphinxcontrib-htmlhelp==2.1.0 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==2.0.0 - sphinxcontrib-serializinghtml==2.0.0 - tomli==2.2.1 - tox==4.25.0 - twine==6.1.0 - twisted==24.11.0 - typing-extensions==4.13.0 - unidiff==0.7.5 - urllib3==2.3.0 - virtualenv==20.29.3 - watchdog==6.0.0 - zipp==3.21.0 - zope-interface==7.2 prefix: /opt/conda/envs/txtorcon
[ "test/test_torcontrolprotocol.py::ProtocolTests::test_eventlistener_error" ]
[]
[ "test/test_router.py::UtilityTests::test_hex_converters", "test/test_router.py::RouterTests::test_countrycode", "test/test_router.py::RouterTests::test_ctor", "test/test_router.py::RouterTests::test_flags", "test/test_router.py::RouterTests::test_flags_from_string", "test/test_router.py::RouterTests::test_policy_accept", "test/test_router.py::RouterTests::test_policy_error", "test/test_router.py::RouterTests::test_policy_not_set_error", "test/test_router.py::RouterTests::test_policy_reject", "test/test_router.py::RouterTests::test_repr", "test/test_router.py::RouterTests::test_repr_no_update", "test/test_router.py::RouterTests::test_unique_name", "test/test_router.py::OnionOOTests::test_onionoo_get_fails", "test/test_router.py::OnionOOTests::test_onionoo_success", "test/test_router.py::OnionOOTests::test_onionoo_too_many_answers", "test/test_router.py::OnionOOTests::test_onionoo_wrong_fingerprint", "test/test_torcontrolprotocol.py::InterfaceTests::test_implements", "test/test_torcontrolprotocol.py::InterfaceTests::test_object_implements", "test/test_torcontrolprotocol.py::LogicTests::test_set_conf_wrong_args", "test/test_torcontrolprotocol.py::FactoryTests::test_create", "test/test_torcontrolprotocol.py::AuthenticationTests::test_authenticate_cookie", "test/test_torcontrolprotocol.py::AuthenticationTests::test_authenticate_no_password", "test/test_torcontrolprotocol.py::AuthenticationTests::test_authenticate_null", "test/test_torcontrolprotocol.py::AuthenticationTests::test_authenticate_password", "test/test_torcontrolprotocol.py::AuthenticationTests::test_authenticate_password_deferred", "test/test_torcontrolprotocol.py::AuthenticationTests::test_authenticate_password_deferred_but_no_password", "test/test_torcontrolprotocol.py::AuthenticationTests::test_authenticate_password_not_bytes", "test/test_torcontrolprotocol.py::DisconnectionTests::test_disconnect_callback", "test/test_torcontrolprotocol.py::DisconnectionTests::test_disconnect_errback", "test/test_torcontrolprotocol.py::ProtocolTests::test_650_after_authenticate", "test/test_torcontrolprotocol.py::ProtocolTests::test_addevent", "test/test_torcontrolprotocol.py::ProtocolTests::test_async", "test/test_torcontrolprotocol.py::ProtocolTests::test_async_multiline", "test/test_torcontrolprotocol.py::ProtocolTests::test_authenticate_cookie_without_reading", "test/test_torcontrolprotocol.py::ProtocolTests::test_authenticate_dont_send_cookiefile", "test/test_torcontrolprotocol.py::ProtocolTests::test_authenticate_fail", "test/test_torcontrolprotocol.py::ProtocolTests::test_authenticate_no_auth_line", "test/test_torcontrolprotocol.py::ProtocolTests::test_authenticate_not_enough_cookie_data", "test/test_torcontrolprotocol.py::ProtocolTests::test_authenticate_not_enough_safecookie_data", "test/test_torcontrolprotocol.py::ProtocolTests::test_authenticate_password_when_cookie_unavailable", "test/test_torcontrolprotocol.py::ProtocolTests::test_authenticate_password_when_safecookie_unavailable", "test/test_torcontrolprotocol.py::ProtocolTests::test_authenticate_safecookie", "test/test_torcontrolprotocol.py::ProtocolTests::test_authenticate_safecookie_wrong_hash", "test/test_torcontrolprotocol.py::ProtocolTests::test_authenticate_unexisting_cookie_file", "test/test_torcontrolprotocol.py::ProtocolTests::test_authenticate_unexisting_safecookie_file", "test/test_torcontrolprotocol.py::ProtocolTests::test_bootstrap_callback", "test/test_torcontrolprotocol.py::ProtocolTests::test_bootstrap_tor_does_not_support_signal_names", "test/test_torcontrolprotocol.py::ProtocolTests::test_continuation_line", "test/test_torcontrolprotocol.py::ProtocolTests::test_debug", "test/test_torcontrolprotocol.py::ProtocolTests::test_dot", "test/test_torcontrolprotocol.py::ProtocolTests::test_eventlistener", "test/test_torcontrolprotocol.py::ProtocolTests::test_getconf", "test/test_torcontrolprotocol.py::ProtocolTests::test_getconf_raw", "test/test_torcontrolprotocol.py::ProtocolTests::test_getinfo", "test/test_torcontrolprotocol.py::ProtocolTests::test_getinfo_for_descriptor", "test/test_torcontrolprotocol.py::ProtocolTests::test_getinfo_incremental", "test/test_torcontrolprotocol.py::ProtocolTests::test_getinfo_incremental_continuation", "test/test_torcontrolprotocol.py::ProtocolTests::test_getinfo_multiline", "test/test_torcontrolprotocol.py::ProtocolTests::test_getinfo_one_line", "test/test_torcontrolprotocol.py::ProtocolTests::test_minus_line_no_command", "test/test_torcontrolprotocol.py::ProtocolTests::test_multiline_plus", "test/test_torcontrolprotocol.py::ProtocolTests::test_multiline_plus_embedded_equals", "test/test_torcontrolprotocol.py::ProtocolTests::test_newdesc", "test/test_torcontrolprotocol.py::ProtocolTests::test_notify_after_getinfo", "test/test_torcontrolprotocol.py::ProtocolTests::test_notify_error", "test/test_torcontrolprotocol.py::ProtocolTests::test_plus_line_no_command", "test/test_torcontrolprotocol.py::ProtocolTests::test_quit", "test/test_torcontrolprotocol.py::ProtocolTests::test_remove_eventlistener", "test/test_torcontrolprotocol.py::ProtocolTests::test_remove_eventlistener_multiple", "test/test_torcontrolprotocol.py::ProtocolTests::test_response_with_no_request", "test/test_torcontrolprotocol.py::ProtocolTests::test_setconf", "test/test_torcontrolprotocol.py::ProtocolTests::test_setconf_multi", "test/test_torcontrolprotocol.py::ProtocolTests::test_setconf_with_space", "test/test_torcontrolprotocol.py::ProtocolTests::test_signal", "test/test_torcontrolprotocol.py::ProtocolTests::test_signal_error", "test/test_torcontrolprotocol.py::ProtocolTests::test_statemachine_broadcast_no_code", "test/test_torcontrolprotocol.py::ProtocolTests::test_statemachine_broadcast_unknown_code", "test/test_torcontrolprotocol.py::ProtocolTests::test_statemachine_continuation", "test/test_torcontrolprotocol.py::ProtocolTests::test_statemachine_is_finish", "test/test_torcontrolprotocol.py::ProtocolTests::test_statemachine_multiline", "test/test_torcontrolprotocol.py::ProtocolTests::test_statemachine_singleline", "test/test_torcontrolprotocol.py::ProtocolTests::test_twocommands", "test/test_torcontrolprotocol.py::ParseTests::test_circuit_status", "test/test_torcontrolprotocol.py::ParseTests::test_default_keywords", "test/test_torcontrolprotocol.py::ParseTests::test_keywords", "test/test_torcontrolprotocol.py::ParseTests::test_keywords_mutli_equals", "test/test_torcontrolprotocol.py::ParseTests::test_multientry_keywords_2", "test/test_torcontrolprotocol.py::ParseTests::test_multientry_keywords_3", "test/test_torcontrolprotocol.py::ParseTests::test_multientry_keywords_4", "test/test_torcontrolprotocol.py::ParseTests::test_multiline_keywords", "test/test_torcontrolprotocol.py::ParseTests::test_multiline_keywords_with_spaces", "test/test_torcontrolprotocol.py::ParseTests::test_network_status", "test/test_torcontrolprotocol.py::ParseTests::test_unquoted_keywords", "test/test_torcontrolprotocol.py::ParseTests::test_unquoted_keywords_empty", "test/test_torcontrolprotocol.py::ParseTests::test_unquoted_keywords_singlequote" ]
[]
MIT License
1,060
[ "txtorcon/router.py", "txtorcon/torcontrolprotocol.py" ]
[ "txtorcon/router.py", "txtorcon/torcontrolprotocol.py" ]
cdent__wsgi-intercept-47
21276926ff7f9f341c789dc48ddad1ad9785c429
2017-03-05 15:04:26
21276926ff7f9f341c789dc48ddad1ad9785c429
diff --git a/wsgi_intercept/__init__.py b/wsgi_intercept/__init__.py index 08b9a10..c257295 100644 --- a/wsgi_intercept/__init__.py +++ b/wsgi_intercept/__init__.py @@ -487,7 +487,7 @@ class wsgi_fake_socket: for data in self.write_results: self.output.write(data) - if generator_data: + if generator_data is not None: try: self.output.write(generator_data) except TypeError as exc:
Write ignores response body when first item in iterable is an empty string This line has a check for whether the first return value of the application function's returned iterable is falsey: https://github.com/cdent/wsgi-intercept/blob/ac5f41a/wsgi_intercept/__init__.py#L490 ```python try: generator_data = None try: generator_data = next(self.result) finally: for data in self.write_results: self.output.write(data) if generator_data: try: self.output.write(generator_data) except TypeError as exc: raise TypeError('bytes required in response: %s' % exc) while 1: data = next(self.result) self.output.write(data) except StopIteration: pass ``` I ran into this bug because the first item in my application's returned iterable was an empty bytestring, and this caused the body to be skipped entirely. This seems incorrect, as PEP-3333 includes specific references to empty byte strings being present in the returned iterable.
cdent/wsgi-intercept
diff --git a/wsgi_intercept/tests/test_response_headers.py b/wsgi_intercept/tests/test_response_headers.py index 135983b..448be0f 100644 --- a/wsgi_intercept/tests/test_response_headers.py +++ b/wsgi_intercept/tests/test_response_headers.py @@ -28,7 +28,7 @@ class HeaderApp(object): for header in self.headers: headers.append((header, self.headers[header])) start_response('200 OK', headers) - return [''] + return [b''] def app(headers): diff --git a/wsgi_intercept/tests/test_wsgi_compliance.py b/wsgi_intercept/tests/test_wsgi_compliance.py index 9524596..d2443dd 100644 --- a/wsgi_intercept/tests/test_wsgi_compliance.py +++ b/wsgi_intercept/tests/test_wsgi_compliance.py @@ -105,3 +105,12 @@ def test_post_status_headers(): 'http://some_hopefully_nonexistant_domain/', 'GET') assert app.success() assert resp.get('content-type') == 'text/plain' + + +def test_empty_iterator(): + with InstalledApp(wsgi_app.empty_string_app, host=HOST) as app: + http = httplib2.Http() + resp, content = http.request( + 'http://some_hopefully_nonexistant_domain/', 'GET') + assert app.success() + assert content == b'second' diff --git a/wsgi_intercept/tests/wsgi_app.py b/wsgi_intercept/tests/wsgi_app.py index f0c4225..4e9f441 100644 --- a/wsgi_intercept/tests/wsgi_app.py +++ b/wsgi_intercept/tests/wsgi_app.py @@ -32,3 +32,8 @@ def post_status_headers_app(environ, start_response): def raises_app(environ, start_response): raise TypeError("bah") + + +def empty_string_app(environ, start_response): + start_response('200 OK', [('Content-type', 'text/plain')]) + return [b'', b'second']
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 1 }
1.4
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[testing]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.5", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 httplib2==0.22.0 idna==3.10 importlib-metadata==4.8.3 iniconfig==1.1.1 packaging==21.3 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 requests==2.27.1 six==1.17.0 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 -e git+https://github.com/cdent/wsgi-intercept.git@21276926ff7f9f341c789dc48ddad1ad9785c429#egg=wsgi_intercept zipp==3.6.0
name: wsgi-intercept channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - charset-normalizer==2.0.12 - httplib2==0.22.0 - idna==3.10 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - requests==2.27.1 - six==1.17.0 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/wsgi-intercept
[ "wsgi_intercept/tests/test_wsgi_compliance.py::test_empty_iterator" ]
[ "wsgi_intercept/tests/test_wsgi_compliance.py::test_https_in_environ" ]
[ "wsgi_intercept/tests/test_response_headers.py::test_header_app", "wsgi_intercept/tests/test_response_headers.py::test_encoding_violation", "wsgi_intercept/tests/test_wsgi_compliance.py::test_simple_override", "wsgi_intercept/tests/test_wsgi_compliance.py::test_simple_override_default_port", "wsgi_intercept/tests/test_wsgi_compliance.py::test_more_interesting", "wsgi_intercept/tests/test_wsgi_compliance.py::test_script_name", "wsgi_intercept/tests/test_wsgi_compliance.py::test_encoding_errors", "wsgi_intercept/tests/test_wsgi_compliance.py::test_post_status_headers" ]
[]
null
1,062
[ "wsgi_intercept/__init__.py" ]
[ "wsgi_intercept/__init__.py" ]
scrapy__scrapy-2627
d7b26edf6b419e379a7a0a425093f02cac2fcf33
2017-03-06 15:22:51
d7b26edf6b419e379a7a0a425093f02cac2fcf33
diff --git a/scrapy/spidermiddlewares/referer.py b/scrapy/spidermiddlewares/referer.py index b444e34bb..1ddfb37f4 100644 --- a/scrapy/spidermiddlewares/referer.py +++ b/scrapy/spidermiddlewares/referer.py @@ -261,6 +261,9 @@ _policy_classes = {p.name: p for p in ( DefaultReferrerPolicy, )} +# Reference: https://www.w3.org/TR/referrer-policy/#referrer-policy-empty-string +_policy_classes[''] = NoReferrerWhenDowngradePolicy + def _load_policy_class(policy, warning_only=False): """ @@ -317,8 +320,9 @@ class RefererMiddleware(object): policy_name = request.meta.get('referrer_policy') if policy_name is None: if isinstance(resp_or_url, Response): - policy_name = to_native_str( - resp_or_url.headers.get('Referrer-Policy', '').decode('latin1')) + policy_header = resp_or_url.headers.get('Referrer-Policy') + if policy_header is not None: + policy_name = to_native_str(policy_header.decode('latin1')) if policy_name is None: return self.default_policy()
lots of warnings `RuntimeWarning: Could not load referrer policy ''` when running tests Check `tox -e py36 -- tests/test_crawl.py -s` output. @redapple is it a testing issue, or a problem with the warning? I've first noticed it in https://travis-ci.org/scrapy/scrapy/jobs/208185821 output.
scrapy/scrapy
diff --git a/tests/test_spidermiddleware_referer.py b/tests/test_spidermiddleware_referer.py index b1c815876..f27f31b74 100644 --- a/tests/test_spidermiddleware_referer.py +++ b/tests/test_spidermiddleware_referer.py @@ -526,6 +526,13 @@ class TestPolicyHeaderPredecence003(MixinNoReferrerWhenDowngrade, TestRefererMid settings = {'REFERRER_POLICY': 'scrapy.spidermiddlewares.referer.OriginWhenCrossOriginPolicy'} resp_headers = {'Referrer-Policy': POLICY_NO_REFERRER_WHEN_DOWNGRADE.title()} +class TestPolicyHeaderPredecence004(MixinNoReferrerWhenDowngrade, TestRefererMiddleware): + """ + The empty string means "no-referrer-when-downgrade" + """ + settings = {'REFERRER_POLICY': 'scrapy.spidermiddlewares.referer.OriginWhenCrossOriginPolicy'} + resp_headers = {'Referrer-Policy': ''} + class TestReferrerOnRedirect(TestRefererMiddleware):
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 2, "test_score": 1 }, "num_modified_files": 1 }
1.2
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-xdist", "pytest-mock", "pytest-asyncio" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==25.3.0 Automat==24.8.1 cffi==1.17.1 constantly==23.10.4 coverage==7.8.0 cryptography==44.0.2 cssselect==1.3.0 exceptiongroup==1.2.2 execnet==2.1.1 hyperlink==21.0.0 idna==3.10 incremental==24.7.2 iniconfig==2.1.0 jmespath==1.0.1 lxml==5.3.1 packaging==24.2 parsel==1.10.0 pluggy==1.5.0 pyasn1==0.6.1 pyasn1_modules==0.4.2 pycparser==2.22 PyDispatcher==2.0.7 pyOpenSSL==25.0.0 pytest==8.3.5 pytest-asyncio==0.26.0 pytest-cov==6.0.0 pytest-mock==3.14.0 pytest-xdist==3.6.1 queuelib==1.7.0 -e git+https://github.com/scrapy/scrapy.git@d7b26edf6b419e379a7a0a425093f02cac2fcf33#egg=Scrapy service-identity==24.2.0 six==1.17.0 tomli==2.2.1 Twisted==24.11.0 typing_extensions==4.13.0 w3lib==2.3.1 zope.interface==7.2
name: scrapy channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==25.3.0 - automat==24.8.1 - cffi==1.17.1 - constantly==23.10.4 - coverage==7.8.0 - cryptography==44.0.2 - cssselect==1.3.0 - exceptiongroup==1.2.2 - execnet==2.1.1 - hyperlink==21.0.0 - idna==3.10 - incremental==24.7.2 - iniconfig==2.1.0 - jmespath==1.0.1 - lxml==5.3.1 - packaging==24.2 - parsel==1.10.0 - pluggy==1.5.0 - pyasn1==0.6.1 - pyasn1-modules==0.4.2 - pycparser==2.22 - pydispatcher==2.0.7 - pyopenssl==25.0.0 - pytest==8.3.5 - pytest-asyncio==0.26.0 - pytest-cov==6.0.0 - pytest-mock==3.14.0 - pytest-xdist==3.6.1 - queuelib==1.7.0 - service-identity==24.2.0 - six==1.17.0 - tomli==2.2.1 - twisted==24.11.0 - typing-extensions==4.13.0 - w3lib==2.3.1 - zope-interface==7.2 prefix: /opt/conda/envs/scrapy
[ "tests/test_spidermiddleware_referer.py::TestPolicyHeaderPredecence004::test" ]
[]
[ "tests/test_spidermiddleware_referer.py::TestRefererMiddleware::test", "tests/test_spidermiddleware_referer.py::TestRefererMiddlewareDefault::test", "tests/test_spidermiddleware_referer.py::TestSettingsNoReferrer::test", "tests/test_spidermiddleware_referer.py::TestSettingsNoReferrerWhenDowngrade::test", "tests/test_spidermiddleware_referer.py::TestSettingsSameOrigin::test", "tests/test_spidermiddleware_referer.py::TestSettingsOrigin::test", "tests/test_spidermiddleware_referer.py::TestSettingsStrictOrigin::test", "tests/test_spidermiddleware_referer.py::TestSettingsOriginWhenCrossOrigin::test", "tests/test_spidermiddleware_referer.py::TestSettingsStrictOriginWhenCrossOrigin::test", "tests/test_spidermiddleware_referer.py::TestSettingsUnsafeUrl::test", "tests/test_spidermiddleware_referer.py::TestSettingsCustomPolicy::test", "tests/test_spidermiddleware_referer.py::TestRequestMetaDefault::test", "tests/test_spidermiddleware_referer.py::TestRequestMetaNoReferrer::test", "tests/test_spidermiddleware_referer.py::TestRequestMetaNoReferrerWhenDowngrade::test", "tests/test_spidermiddleware_referer.py::TestRequestMetaSameOrigin::test", "tests/test_spidermiddleware_referer.py::TestRequestMetaOrigin::test", "tests/test_spidermiddleware_referer.py::TestRequestMetaSrictOrigin::test", "tests/test_spidermiddleware_referer.py::TestRequestMetaOriginWhenCrossOrigin::test", "tests/test_spidermiddleware_referer.py::TestRequestMetaStrictOriginWhenCrossOrigin::test", "tests/test_spidermiddleware_referer.py::TestRequestMetaUnsafeUrl::test", "tests/test_spidermiddleware_referer.py::TestRequestMetaPredecence001::test", "tests/test_spidermiddleware_referer.py::TestRequestMetaPredecence002::test", "tests/test_spidermiddleware_referer.py::TestRequestMetaPredecence003::test", "tests/test_spidermiddleware_referer.py::TestRequestMetaSettingFallback::test", "tests/test_spidermiddleware_referer.py::TestSettingsPolicyByName::test_invalid_name", "tests/test_spidermiddleware_referer.py::TestSettingsPolicyByName::test_valid_name", "tests/test_spidermiddleware_referer.py::TestSettingsPolicyByName::test_valid_name_casevariants", "tests/test_spidermiddleware_referer.py::TestPolicyHeaderPredecence001::test", "tests/test_spidermiddleware_referer.py::TestPolicyHeaderPredecence002::test", "tests/test_spidermiddleware_referer.py::TestPolicyHeaderPredecence003::test", "tests/test_spidermiddleware_referer.py::TestReferrerOnRedirect::test", "tests/test_spidermiddleware_referer.py::TestReferrerOnRedirectNoReferrer::test", "tests/test_spidermiddleware_referer.py::TestReferrerOnRedirectSameOrigin::test", "tests/test_spidermiddleware_referer.py::TestReferrerOnRedirectStrictOrigin::test", "tests/test_spidermiddleware_referer.py::TestReferrerOnRedirectOriginWhenCrossOrigin::test", "tests/test_spidermiddleware_referer.py::TestReferrerOnRedirectStrictOriginWhenCrossOrigin::test" ]
[]
BSD 3-Clause "New" or "Revised" License
1,063
[ "scrapy/spidermiddlewares/referer.py" ]
[ "scrapy/spidermiddlewares/referer.py" ]