Spaces:
Build error
Build error
add llama 3.1 405b result
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/README.mdAdded+322
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14182/eval.shAdded+62
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14182/patch.diffAdded+131
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14182/report.jsonAdded+38
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14182/run_instance.logAdded+3
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14182/test_output.txtAdded
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14365/eval.shAdded+51
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14365/patch.diffAdded+661
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14365/report.jsonAdded+38
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14365/run_instance.logAdded+3
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14365/test_output.txtAdded
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-6938/eval.shAdded+57
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-6938/patch.diffAdded+1350
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-6938/report.jsonAdded+41
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-6938/run_instance.logAdded+3
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-6938/test_output.txtAdded+647
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-7746/eval.shAdded+44
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-7746/patch.diffAdded
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-7746/report.jsonAdded+86
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-7746/run_instance.logAdded+3
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-7746/test_output.txtAdded+581
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10914/eval.shAdded+35
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10914/patch.diffAdded+653
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10914/report.jsonAdded+127
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10914/run_instance.logAdded+3
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10914/test_output.txtAdded+590
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10924/eval.shAdded+50
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10924/patch.diffAdded+2409
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10924/report.jsonAdded+30
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10924/run_instance.logAdded+3
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10924/test_output.txtAdded+639
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11001/eval.shAdded+56
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11001/patch.diffAdded+1543
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11001/report.jsonAdded+148
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11001/run_instance.logAdded+3
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11001/test_output.txtAdded+567
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11039/eval.shAdded+100
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11039/patch.diffAdded+597
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11039/report.jsonAdded+117
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11039/run_instance.logAdded+3
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11039/test_output.txtAdded+652
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11049/eval.shAdded+35
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11049/patch.diffAdded+1220
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11049/report.jsonAdded+37
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11049/run_instance.logAdded+3
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11049/test_output.txtAdded+418
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11099/eval.shAdded+44
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11099/patch.diffAdded+53
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11099/report.jsonAdded+50
- outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11099/run_instance.logAdded+3
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322# SWE-bench ReportThis folder contains the evaluation results of the SWE-bench using the [official evaluation docker containerization](https://github.com/princeton-nlp/SWE-bench/blob/main/docs/20240627_docker/README.md#choosing-the-right-cache_level).
## Summary- total instances: 300- submitted instances: 300- completed instances: 221- empty patch instances: 79- resolved instances: 42- unresolved instances: 179- error instances: 0- unstopped instances: 0
## Resolved Instances- [django__django-10914](./eval_outputs/django__django-10914/run_instance.log)- [django__django-10924](./eval_outputs/django__django-10924/run_instance.log)- [django__django-11001](./eval_outputs/django__django-11001/run_instance.log)- [django__django-11039](./eval_outputs/django__django-11039/run_instance.log)- [django__django-11099](./eval_outputs/django__django-11099/run_instance.log)- [django__django-11133](./eval_outputs/django__django-11133/run_instance.log)- [django__django-11179](./eval_outputs/django__django-11179/run_instance.log)- [django__django-11583](./eval_outputs/django__django-11583/run_instance.log)- [django__django-12453](./eval_outputs/django__django-12453/run_instance.log)- [django__django-12708](./eval_outputs/django__django-12708/run_instance.log)- [django__django-13028](./eval_outputs/django__django-13028/run_instance.log)- [django__django-13230](./eval_outputs/django__django-13230/run_instance.log)- [django__django-13315](./eval_outputs/django__django-13315/run_instance.log)- [django__django-13590](./eval_outputs/django__django-13590/run_instance.log)- [django__django-13658](./eval_outputs/django__django-13658/run_instance.log)- [django__django-14382](./eval_outputs/django__django-14382/run_instance.log)- [django__django-14608](./eval_outputs/django__django-14608/run_instance.log)- [django__django-14672](./eval_outputs/django__django-14672/run_instance.log)- [django__django-14752](./eval_outputs/django__django-14752/run_instance.log)- [django__django-14855](./eval_outputs/django__django-14855/run_instance.log)- [django__django-15347](./eval_outputs/django__django-15347/run_instance.log)- [django__django-15814](./eval_outputs/django__django-15814/run_instance.log)- [django__django-16046](./eval_outputs/django__django-16046/run_instance.log)- [django__django-16139](./eval_outputs/django__django-16139/run_instance.log)- [django__django-16255](./eval_outputs/django__django-16255/run_instance.log)- [django__django-16527](./eval_outputs/django__django-16527/run_instance.log)- [django__django-16595](./eval_outputs/django__django-16595/run_instance.log)- [matplotlib__matplotlib-24149](./eval_outputs/matplotlib__matplotlib-24149/run_instance.log)- [matplotlib__matplotlib-26020](./eval_outputs/matplotlib__matplotlib-26020/run_instance.log)- [mwaskom__seaborn-3010](./eval_outputs/mwaskom__seaborn-3010/run_instance.log)- [psf__requests-2317](./eval_outputs/psf__requests-2317/run_instance.log)- [psf__requests-863](./eval_outputs/psf__requests-863/run_instance.log)- [pytest-dev__pytest-5227](./eval_outputs/pytest-dev__pytest-5227/run_instance.log)- [pytest-dev__pytest-7373](./eval_outputs/pytest-dev__pytest-7373/run_instance.log)- [scikit-learn__scikit-learn-13439](./eval_outputs/scikit-learn__scikit-learn-13439/run_instance.log)- [scikit-learn__scikit-learn-14894](./eval_outputs/scikit-learn__scikit-learn-14894/run_instance.log)- [sympy__sympy-13480](./eval_outputs/sympy__sympy-13480/run_instance.log)- [sympy__sympy-14774](./eval_outputs/sympy__sympy-14774/run_instance.log)- [sympy__sympy-18057](./eval_outputs/sympy__sympy-18057/run_instance.log)- [sympy__sympy-22714](./eval_outputs/sympy__sympy-22714/run_instance.log)- [sympy__sympy-23262](./eval_outputs/sympy__sympy-23262/run_instance.log)- [sympy__sympy-24152](./eval_outputs/sympy__sympy-24152/run_instance.log)
## Unresolved Instances- [astropy__astropy-14182](./eval_outputs/astropy__astropy-14182/run_instance.log)- [astropy__astropy-14365](./eval_outputs/astropy__astropy-14365/run_instance.log)- [astropy__astropy-6938](./eval_outputs/astropy__astropy-6938/run_instance.log)- [astropy__astropy-7746](./eval_outputs/astropy__astropy-7746/run_instance.log)- [django__django-11049](./eval_outputs/django__django-11049/run_instance.log)- [django__django-11422](./eval_outputs/django__django-11422/run_instance.log)- [django__django-11564](./eval_outputs/django__django-11564/run_instance.log)- [django__django-11620](./eval_outputs/django__django-11620/run_instance.log)- [django__django-11630](./eval_outputs/django__django-11630/run_instance.log)- [django__django-11742](./eval_outputs/django__django-11742/run_instance.log)- [django__django-11848](./eval_outputs/django__django-11848/run_instance.log)- [django__django-11905](./eval_outputs/django__django-11905/run_instance.log)- [django__django-11910](./eval_outputs/django__django-11910/run_instance.log)- [django__django-11964](./eval_outputs/django__django-11964/run_instance.log)- [django__django-12113](./eval_outputs/django__django-12113/run_instance.log)- [django__django-12125](./eval_outputs/django__django-12125/run_instance.log)- [django__django-12308](./eval_outputs/django__django-12308/run_instance.log)- [django__django-12470](./eval_outputs/django__django-12470/run_instance.log)- [django__django-12700](./eval_outputs/django__django-12700/run_instance.log)- [django__django-12747](./eval_outputs/django__django-12747/run_instance.log)- [django__django-12915](./eval_outputs/django__django-12915/run_instance.log)- [django__django-12983](./eval_outputs/django__django-12983/run_instance.log)- [django__django-13033](./eval_outputs/django__django-13033/run_instance.log)- [django__django-13158](./eval_outputs/django__django-13158/run_instance.log)- [django__django-13220](./eval_outputs/django__django-13220/run_instance.log)- [django__django-13265](./eval_outputs/django__django-13265/run_instance.log)- [django__django-13321](./eval_outputs/django__django-13321/run_instance.log)- [django__django-13401](./eval_outputs/django__django-13401/run_instance.log)- [django__django-13447](./eval_outputs/django__django-13447/run_instance.log)- [django__django-13448](./eval_outputs/django__django-13448/run_instance.log)- [django__django-13551](./eval_outputs/django__django-13551/run_instance.log)- [django__django-13660](./eval_outputs/django__django-13660/run_instance.log)- [django__django-13710](./eval_outputs/django__django-13710/run_instance.log)- [django__django-13757](./eval_outputs/django__django-13757/run_instance.log)- [django__django-13768](./eval_outputs/django__django-13768/run_instance.log)- [django__django-13925](./eval_outputs/django__django-13925/run_instance.log)- [django__django-13933](./eval_outputs/django__django-13933/run_instance.log)- [django__django-13964](./eval_outputs/django__django-13964/run_instance.log)- [django__django-14017](./eval_outputs/django__django-14017/run_instance.log)- [django__django-14155](./eval_outputs/django__django-14155/run_instance.log)- [django__django-14411](./eval_outputs/django__django-14411/run_instance.log)- [django__django-14534](./eval_outputs/django__django-14534/run_instance.log)- [django__django-14580](./eval_outputs/django__django-14580/run_instance.log)- [django__django-14667](./eval_outputs/django__django-14667/run_instance.log)- [django__django-14787](./eval_outputs/django__django-14787/run_instance.log)- [django__django-14997](./eval_outputs/django__django-14997/run_instance.log)- [django__django-15061](./eval_outputs/django__django-15061/run_instance.log)- [django__django-15202](./eval_outputs/django__django-15202/run_instance.log)- [django__django-15213](./eval_outputs/django__django-15213/run_instance.log)- [django__django-15252](./eval_outputs/django__django-15252/run_instance.log)- [django__django-15320](./eval_outputs/django__django-15320/run_instance.log)- [django__django-15388](./eval_outputs/django__django-15388/run_instance.log)- [django__django-15400](./eval_outputs/django__django-15400/run_instance.log)- [django__django-15498](./eval_outputs/django__django-15498/run_instance.log)- [django__django-15738](./eval_outputs/django__django-15738/run_instance.log)- [django__django-15789](./eval_outputs/django__django-15789/run_instance.log)- [django__django-15790](./eval_outputs/django__django-15790/run_instance.log)- [django__django-15819](./eval_outputs/django__django-15819/run_instance.log)- [django__django-15851](./eval_outputs/django__django-15851/run_instance.log)- [django__django-15902](./eval_outputs/django__django-15902/run_instance.log)- [django__django-16229](./eval_outputs/django__django-16229/run_instance.log)- [django__django-16379](./eval_outputs/django__django-16379/run_instance.log)- [django__django-16408](./eval_outputs/django__django-16408/run_instance.log)- [django__django-16873](./eval_outputs/django__django-16873/run_instance.log)- [django__django-16910](./eval_outputs/django__django-16910/run_instance.log)- [django__django-17087](./eval_outputs/django__django-17087/run_instance.log)- [matplotlib__matplotlib-18869](./eval_outputs/matplotlib__matplotlib-18869/run_instance.log)- [matplotlib__matplotlib-22711](./eval_outputs/matplotlib__matplotlib-22711/run_instance.log)- [matplotlib__matplotlib-23299](./eval_outputs/matplotlib__matplotlib-23299/run_instance.log)- [matplotlib__matplotlib-23562](./eval_outputs/matplotlib__matplotlib-23562/run_instance.log)- [matplotlib__matplotlib-23964](./eval_outputs/matplotlib__matplotlib-23964/run_instance.log)- [matplotlib__matplotlib-23987](./eval_outputs/matplotlib__matplotlib-23987/run_instance.log)- [matplotlib__matplotlib-24265](./eval_outputs/matplotlib__matplotlib-24265/run_instance.log)- [matplotlib__matplotlib-24334](./eval_outputs/matplotlib__matplotlib-24334/run_instance.log)- [matplotlib__matplotlib-25332](./eval_outputs/matplotlib__matplotlib-25332/run_instance.log)- [matplotlib__matplotlib-25433](./eval_outputs/matplotlib__matplotlib-25433/run_instance.log)- [matplotlib__matplotlib-25442](./eval_outputs/matplotlib__matplotlib-25442/run_instance.log)- [matplotlib__matplotlib-25498](./eval_outputs/matplotlib__matplotlib-25498/run_instance.log)- [mwaskom__seaborn-2848](./eval_outputs/mwaskom__seaborn-2848/run_instance.log)- [mwaskom__seaborn-3190](./eval_outputs/mwaskom__seaborn-3190/run_instance.log)- [mwaskom__seaborn-3407](./eval_outputs/mwaskom__seaborn-3407/run_instance.log)- [pallets__flask-4045](./eval_outputs/pallets__flask-4045/run_instance.log)- [pallets__flask-4992](./eval_outputs/pallets__flask-4992/run_instance.log)- [psf__requests-1963](./eval_outputs/psf__requests-1963/run_instance.log)- [psf__requests-2148](./eval_outputs/psf__requests-2148/run_instance.log)- [psf__requests-2674](./eval_outputs/psf__requests-2674/run_instance.log)- [psf__requests-3362](./eval_outputs/psf__requests-3362/run_instance.log)- [pydata__xarray-3364](./eval_outputs/pydata__xarray-3364/run_instance.log)- [pydata__xarray-4248](./eval_outputs/pydata__xarray-4248/run_instance.log)- [pylint-dev__pylint-6506](./eval_outputs/pylint-dev__pylint-6506/run_instance.log)- [pylint-dev__pylint-7114](./eval_outputs/pylint-dev__pylint-7114/run_instance.log)- [pylint-dev__pylint-7993](./eval_outputs/pylint-dev__pylint-7993/run_instance.log)- [pytest-dev__pytest-11143](./eval_outputs/pytest-dev__pytest-11143/run_instance.log)- [pytest-dev__pytest-5103](./eval_outputs/pytest-dev__pytest-5103/run_instance.log)- [pytest-dev__pytest-5221](./eval_outputs/pytest-dev__pytest-5221/run_instance.log)- [pytest-dev__pytest-5495](./eval_outputs/pytest-dev__pytest-5495/run_instance.log)- [pytest-dev__pytest-5692](./eval_outputs/pytest-dev__pytest-5692/run_instance.log)- [pytest-dev__pytest-6116](./eval_outputs/pytest-dev__pytest-6116/run_instance.log)- [pytest-dev__pytest-7168](./eval_outputs/pytest-dev__pytest-7168/run_instance.log)- [pytest-dev__pytest-7432](./eval_outputs/pytest-dev__pytest-7432/run_instance.log)- [pytest-dev__pytest-7490](./eval_outputs/pytest-dev__pytest-7490/run_instance.log)- [pytest-dev__pytest-8365](./eval_outputs/pytest-dev__pytest-8365/run_instance.log)- [pytest-dev__pytest-8906](./eval_outputs/pytest-dev__pytest-8906/run_instance.log)- [pytest-dev__pytest-9359](./eval_outputs/pytest-dev__pytest-9359/run_instance.log)- [scikit-learn__scikit-learn-10297](./eval_outputs/scikit-learn__scikit-learn-10297/run_instance.log)- [scikit-learn__scikit-learn-10949](./eval_outputs/scikit-learn__scikit-learn-10949/run_instance.log)- [scikit-learn__scikit-learn-11040](./eval_outputs/scikit-learn__scikit-learn-11040/run_instance.log)- [scikit-learn__scikit-learn-12471](./eval_outputs/scikit-learn__scikit-learn-12471/run_instance.log)- [scikit-learn__scikit-learn-13142](./eval_outputs/scikit-learn__scikit-learn-13142/run_instance.log)- [scikit-learn__scikit-learn-13496](./eval_outputs/scikit-learn__scikit-learn-13496/run_instance.log)- [scikit-learn__scikit-learn-13497](./eval_outputs/scikit-learn__scikit-learn-13497/run_instance.log)- [scikit-learn__scikit-learn-13584](./eval_outputs/scikit-learn__scikit-learn-13584/run_instance.log)- [scikit-learn__scikit-learn-13779](./eval_outputs/scikit-learn__scikit-learn-13779/run_instance.log)- [scikit-learn__scikit-learn-14087](./eval_outputs/scikit-learn__scikit-learn-14087/run_instance.log)- [scikit-learn__scikit-learn-15512](./eval_outputs/scikit-learn__scikit-learn-15512/run_instance.log)- [scikit-learn__scikit-learn-25500](./eval_outputs/scikit-learn__scikit-learn-25500/run_instance.log)- [scikit-learn__scikit-learn-25570](./eval_outputs/scikit-learn__scikit-learn-25570/run_instance.log)- [scikit-learn__scikit-learn-25638](./eval_outputs/scikit-learn__scikit-learn-25638/run_instance.log)- [scikit-learn__scikit-learn-25747](./eval_outputs/scikit-learn__scikit-learn-25747/run_instance.log)- [sphinx-doc__sphinx-11445](./eval_outputs/sphinx-doc__sphinx-11445/run_instance.log)- [sphinx-doc__sphinx-7975](./eval_outputs/sphinx-doc__sphinx-7975/run_instance.log)- [sphinx-doc__sphinx-8273](./eval_outputs/sphinx-doc__sphinx-8273/run_instance.log)- [sphinx-doc__sphinx-8282](./eval_outputs/sphinx-doc__sphinx-8282/run_instance.log)- [sphinx-doc__sphinx-8506](./eval_outputs/sphinx-doc__sphinx-8506/run_instance.log)- [sphinx-doc__sphinx-8595](./eval_outputs/sphinx-doc__sphinx-8595/run_instance.log)- [sphinx-doc__sphinx-8627](./eval_outputs/sphinx-doc__sphinx-8627/run_instance.log)- [sphinx-doc__sphinx-8721](./eval_outputs/sphinx-doc__sphinx-8721/run_instance.log)- [sympy__sympy-11400](./eval_outputs/sympy__sympy-11400/run_instance.log)- [sympy__sympy-11870](./eval_outputs/sympy__sympy-11870/run_instance.log)- [sympy__sympy-12171](./eval_outputs/sympy__sympy-12171/run_instance.log)- [sympy__sympy-12236](./eval_outputs/sympy__sympy-12236/run_instance.log)- [sympy__sympy-12419](./eval_outputs/sympy__sympy-12419/run_instance.log)- [sympy__sympy-12454](./eval_outputs/sympy__sympy-12454/run_instance.log)- [sympy__sympy-13031](./eval_outputs/sympy__sympy-13031/run_instance.log)- [sympy__sympy-13043](./eval_outputs/sympy__sympy-13043/run_instance.log)- [sympy__sympy-13146](./eval_outputs/sympy__sympy-13146/run_instance.log)- [sympy__sympy-13177](./eval_outputs/sympy__sympy-13177/run_instance.log)- [sympy__sympy-13437](./eval_outputs/sympy__sympy-13437/run_instance.log)- [sympy__sympy-13471](./eval_outputs/sympy__sympy-13471/run_instance.log)- [sympy__sympy-13647](./eval_outputs/sympy__sympy-13647/run_instance.log)- [sympy__sympy-13773](./eval_outputs/sympy__sympy-13773/run_instance.log)- [sympy__sympy-14024](./eval_outputs/sympy__sympy-14024/run_instance.log)- [sympy__sympy-14396](./eval_outputs/sympy__sympy-14396/run_instance.log)- [sympy__sympy-14817](./eval_outputs/sympy__sympy-14817/run_instance.log)- [sympy__sympy-15011](./eval_outputs/sympy__sympy-15011/run_instance.log)- [sympy__sympy-15308](./eval_outputs/sympy__sympy-15308/run_instance.log)- [sympy__sympy-15345](./eval_outputs/sympy__sympy-15345/run_instance.log)- [sympy__sympy-15346](./eval_outputs/sympy__sympy-15346/run_instance.log)- [sympy__sympy-15678](./eval_outputs/sympy__sympy-15678/run_instance.log)- [sympy__sympy-16281](./eval_outputs/sympy__sympy-16281/run_instance.log)- [sympy__sympy-16503](./eval_outputs/sympy__sympy-16503/run_instance.log)- [sympy__sympy-16792](./eval_outputs/sympy__sympy-16792/run_instance.log)- [sympy__sympy-16988](./eval_outputs/sympy__sympy-16988/run_instance.log)- [sympy__sympy-17022](./eval_outputs/sympy__sympy-17022/run_instance.log)- [sympy__sympy-17139](./eval_outputs/sympy__sympy-17139/run_instance.log)- [sympy__sympy-17630](./eval_outputs/sympy__sympy-17630/run_instance.log)- [sympy__sympy-17655](./eval_outputs/sympy__sympy-17655/run_instance.log)- [sympy__sympy-18087](./eval_outputs/sympy__sympy-18087/run_instance.log)- [sympy__sympy-18189](./eval_outputs/sympy__sympy-18189/run_instance.log)- [sympy__sympy-18199](./eval_outputs/sympy__sympy-18199/run_instance.log)- [sympy__sympy-18532](./eval_outputs/sympy__sympy-18532/run_instance.log)- [sympy__sympy-18621](./eval_outputs/sympy__sympy-18621/run_instance.log)- [sympy__sympy-18698](./eval_outputs/sympy__sympy-18698/run_instance.log)- [sympy__sympy-18835](./eval_outputs/sympy__sympy-18835/run_instance.log)- [sympy__sympy-19007](./eval_outputs/sympy__sympy-19007/run_instance.log)- [sympy__sympy-19254](./eval_outputs/sympy__sympy-19254/run_instance.log)- [sympy__sympy-19487](./eval_outputs/sympy__sympy-19487/run_instance.log)- [sympy__sympy-20049](./eval_outputs/sympy__sympy-20049/run_instance.log)- [sympy__sympy-20154](./eval_outputs/sympy__sympy-20154/run_instance.log)- [sympy__sympy-20442](./eval_outputs/sympy__sympy-20442/run_instance.log)- [sympy__sympy-21171](./eval_outputs/sympy__sympy-21171/run_instance.log)- [sympy__sympy-21627](./eval_outputs/sympy__sympy-21627/run_instance.log)- [sympy__sympy-22005](./eval_outputs/sympy__sympy-22005/run_instance.log)- [sympy__sympy-22840](./eval_outputs/sympy__sympy-22840/run_instance.log)- [sympy__sympy-23117](./eval_outputs/sympy__sympy-23117/run_instance.log)- [sympy__sympy-23191](./eval_outputs/sympy__sympy-23191/run_instance.log)- [sympy__sympy-24066](./eval_outputs/sympy__sympy-24066/run_instance.log)- [sympy__sympy-24102](./eval_outputs/sympy__sympy-24102/run_instance.log)- [sympy__sympy-24213](./eval_outputs/sympy__sympy-24213/run_instance.log)
## Error Instances
## Empty Patch Instances- [astropy__astropy-12907](./eval_outputs/astropy__astropy-12907/run_instance.log)- [astropy__astropy-14995](./eval_outputs/astropy__astropy-14995/run_instance.log)- [django__django-11019](./eval_outputs/django__django-11019/run_instance.log)- [django__django-11283](./eval_outputs/django__django-11283/run_instance.log)- [django__django-11797](./eval_outputs/django__django-11797/run_instance.log)- [django__django-11815](./eval_outputs/django__django-11815/run_instance.log)- [django__django-11999](./eval_outputs/django__django-11999/run_instance.log)- [django__django-12184](./eval_outputs/django__django-12184/run_instance.log)- [django__django-12284](./eval_outputs/django__django-12284/run_instance.log)- [django__django-12286](./eval_outputs/django__django-12286/run_instance.log)- [django__django-12497](./eval_outputs/django__django-12497/run_instance.log)- [django__django-12589](./eval_outputs/django__django-12589/run_instance.log)- [django__django-12856](./eval_outputs/django__django-12856/run_instance.log)- [django__django-12908](./eval_outputs/django__django-12908/run_instance.log)- [django__django-14016](./eval_outputs/django__django-14016/run_instance.log)- [django__django-14238](./eval_outputs/django__django-14238/run_instance.log)- [django__django-14730](./eval_outputs/django__django-14730/run_instance.log)- [django__django-14915](./eval_outputs/django__django-14915/run_instance.log)- [django__django-14999](./eval_outputs/django__django-14999/run_instance.log)- [django__django-15695](./eval_outputs/django__django-15695/run_instance.log)- [django__django-15781](./eval_outputs/django__django-15781/run_instance.log)- [django__django-15996](./eval_outputs/django__django-15996/run_instance.log)- [django__django-16041](./eval_outputs/django__django-16041/run_instance.log)- [django__django-16400](./eval_outputs/django__django-16400/run_instance.log)- [django__django-16816](./eval_outputs/django__django-16816/run_instance.log)- [django__django-16820](./eval_outputs/django__django-16820/run_instance.log)- [django__django-17051](./eval_outputs/django__django-17051/run_instance.log)- [matplotlib__matplotlib-22835](./eval_outputs/matplotlib__matplotlib-22835/run_instance.log)- [matplotlib__matplotlib-23314](./eval_outputs/matplotlib__matplotlib-23314/run_instance.log)- [matplotlib__matplotlib-23476](./eval_outputs/matplotlib__matplotlib-23476/run_instance.log)- [matplotlib__matplotlib-23563](./eval_outputs/matplotlib__matplotlib-23563/run_instance.log)- [matplotlib__matplotlib-23913](./eval_outputs/matplotlib__matplotlib-23913/run_instance.log)- [matplotlib__matplotlib-24970](./eval_outputs/matplotlib__matplotlib-24970/run_instance.log)- [matplotlib__matplotlib-25079](./eval_outputs/matplotlib__matplotlib-25079/run_instance.log)- [matplotlib__matplotlib-25311](./eval_outputs/matplotlib__matplotlib-25311/run_instance.log)- [matplotlib__matplotlib-26011](./eval_outputs/matplotlib__matplotlib-26011/run_instance.log)- [pallets__flask-5063](./eval_outputs/pallets__flask-5063/run_instance.log)- [pydata__xarray-4094](./eval_outputs/pydata__xarray-4094/run_instance.log)- [pydata__xarray-4493](./eval_outputs/pydata__xarray-4493/run_instance.log)- [pydata__xarray-5131](./eval_outputs/pydata__xarray-5131/run_instance.log)- [pylint-dev__pylint-5859](./eval_outputs/pylint-dev__pylint-5859/run_instance.log)- [pylint-dev__pylint-7080](./eval_outputs/pylint-dev__pylint-7080/run_instance.log)- [pylint-dev__pylint-7228](./eval_outputs/pylint-dev__pylint-7228/run_instance.log)- [pytest-dev__pytest-11148](./eval_outputs/pytest-dev__pytest-11148/run_instance.log)- [pytest-dev__pytest-5413](./eval_outputs/pytest-dev__pytest-5413/run_instance.log)- [pytest-dev__pytest-7220](./eval_outputs/pytest-dev__pytest-7220/run_instance.log)- [scikit-learn__scikit-learn-10508](./eval_outputs/scikit-learn__scikit-learn-10508/run_instance.log)- [scikit-learn__scikit-learn-11281](./eval_outputs/scikit-learn__scikit-learn-11281/run_instance.log)- [scikit-learn__scikit-learn-13241](./eval_outputs/scikit-learn__scikit-learn-13241/run_instance.log)- [scikit-learn__scikit-learn-14092](./eval_outputs/scikit-learn__scikit-learn-14092/run_instance.log)- [scikit-learn__scikit-learn-14983](./eval_outputs/scikit-learn__scikit-learn-14983/run_instance.log)- [scikit-learn__scikit-learn-15535](./eval_outputs/scikit-learn__scikit-learn-15535/run_instance.log)- [sphinx-doc__sphinx-10325](./eval_outputs/sphinx-doc__sphinx-10325/run_instance.log)- [sphinx-doc__sphinx-10451](./eval_outputs/sphinx-doc__sphinx-10451/run_instance.log)- [sphinx-doc__sphinx-7686](./eval_outputs/sphinx-doc__sphinx-7686/run_instance.log)- [sphinx-doc__sphinx-7738](./eval_outputs/sphinx-doc__sphinx-7738/run_instance.log)- [sphinx-doc__sphinx-8435](./eval_outputs/sphinx-doc__sphinx-8435/run_instance.log)- [sphinx-doc__sphinx-8474](./eval_outputs/sphinx-doc__sphinx-8474/run_instance.log)- [sphinx-doc__sphinx-8713](./eval_outputs/sphinx-doc__sphinx-8713/run_instance.log)- [sphinx-doc__sphinx-8801](./eval_outputs/sphinx-doc__sphinx-8801/run_instance.log)- [sympy__sympy-11897](./eval_outputs/sympy__sympy-11897/run_instance.log)- [sympy__sympy-12481](./eval_outputs/sympy__sympy-12481/run_instance.log)- [sympy__sympy-13895](./eval_outputs/sympy__sympy-13895/run_instance.log)- [sympy__sympy-13915](./eval_outputs/sympy__sympy-13915/run_instance.log)- [sympy__sympy-13971](./eval_outputs/sympy__sympy-13971/run_instance.log)- [sympy__sympy-14308](./eval_outputs/sympy__sympy-14308/run_instance.log)- [sympy__sympy-14317](./eval_outputs/sympy__sympy-14317/run_instance.log)- [sympy__sympy-15609](./eval_outputs/sympy__sympy-15609/run_instance.log)- [sympy__sympy-16106](./eval_outputs/sympy__sympy-16106/run_instance.log)- [sympy__sympy-20212](./eval_outputs/sympy__sympy-20212/run_instance.log)- [sympy__sympy-20322](./eval_outputs/sympy__sympy-20322/run_instance.log)- [sympy__sympy-20590](./eval_outputs/sympy__sympy-20590/run_instance.log)- [sympy__sympy-20639](./eval_outputs/sympy__sympy-20639/run_instance.log)- [sympy__sympy-21055](./eval_outputs/sympy__sympy-21055/run_instance.log)- [sympy__sympy-21379](./eval_outputs/sympy__sympy-21379/run_instance.log)- [sympy__sympy-21612](./eval_outputs/sympy__sympy-21612/run_instance.log)- [sympy__sympy-21614](./eval_outputs/sympy__sympy-21614/run_instance.log)- [sympy__sympy-21847](./eval_outputs/sympy__sympy-21847/run_instance.log)- [sympy__sympy-24909](./eval_outputs/sympy__sympy-24909/run_instance.log)
## Incomplete Instances1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162#!/bin/bashset -uxo pipefailsource /opt/miniconda3/bin/activateconda activate testbedcd /testbedgit config --global --add safe.directory /testbedcd /testbedgit statusgit showgit diff a5917978be39d13cd90b517e1de4e7a539ffaa48source /opt/miniconda3/bin/activateconda activate testbedpython -m pip install -e .[test] --verbosegit checkout a5917978be39d13cd90b517e1de4e7a539ffaa48 astropy/io/ascii/tests/test_rst.pygit apply -v - <<'EOF_114329324912'diff --git a/astropy/io/ascii/tests/test_rst.py b/astropy/io/ascii/tests/test_rst.py--- a/astropy/io/ascii/tests/test_rst.py+++ b/astropy/io/ascii/tests/test_rst.py@@ -2,7 +2,11 @@ from io import StringIO +import numpy as np++import astropy.units as u from astropy.io import ascii+from astropy.table import QTable from .common import assert_almost_equal, assert_equal @@ -185,3 +189,27 @@ def test_write_normal(): ==== ========= ==== ==== """, )+++def test_rst_with_header_rows():+ """Round-trip a table with header_rows specified"""+ lines = [+ "======= ======== ====",+ " wave response ints",+ " nm ct ",+ "float64 float32 int8",+ "======= ======== ====",+ " 350.0 1.0 1",+ " 950.0 2.0 2",+ "======= ======== ====",+ ]+ tbl = QTable.read(lines, format="ascii.rst", header_rows=["name", "unit", "dtype"])+ assert tbl["wave"].unit == u.nm+ assert tbl["response"].unit == u.ct+ assert tbl["wave"].dtype == np.float64+ assert tbl["response"].dtype == np.float32+ assert tbl["ints"].dtype == np.int8++ out = StringIO()+ tbl.write(out, format="ascii.rst", header_rows=["name", "unit", "dtype"])+ assert out.getvalue().splitlines() == lines
EOF_114329324912pytest -rA astropy/io/ascii/tests/test_rst.pygit checkout a5917978be39d13cd90b517e1de4e7a539ffaa48 astropy/io/ascii/tests/test_rst.py123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131diff --git a/astropy/io/ascii/.backup.rst.py b/astropy/io/ascii/.backup.rst.pynew file mode 100644index 0000000000..70216c026c--- /dev/null+++ b/astropy/io/ascii/.backup.rst.py@@ -0,0 +1,79 @@+# Licensed under a 3-clause BSD style license+"""+:Author: Simon Gibbons (simongibbons@gmail.com)+"""+++from .core import DefaultSplitter+from .fixedwidth import (+ FixedWidth,+ FixedWidthData,+ FixedWidthHeader,+ FixedWidthTwoLineDataSplitter,+)+++class SimpleRSTHeader(FixedWidthHeader):+ position_line = 0+ start_line = 1+ splitter_class = DefaultSplitter+ position_char = "="++ def get_fixedwidth_params(self, line, header_rows=None):+ if header_rows is not None:+ vals = header_rows[0]+ starts = [0]+ for i in range(len(vals) - 1):+ starts.append(starts[-1] + len(vals[i]) + 1)+ ends = starts[1:] + [None]+ else:+ vals, starts, ends = super().get_fixedwidth_params(line)+ # The right hand column can be unbounded+ ends[-1] = None+ return vals, starts, ends+++class SimpleRSTData(FixedWidthData):+ start_line = 3+ end_line = -1+ splitter_class = FixedWidthTwoLineDataSplitter+++class RST(FixedWidth):+ """reStructuredText simple format table.++ See: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#simple-tables++ Example::++ ==== ===== ======+ Col1 Col2 Col3+ ==== ===== ======+ 1 2.3 Hello+ 2 4.5 Worlds+ ==== ===== ======++ Currently there is no support for reading tables which utilize continuation lines,+ or for ones which define column spans through the use of an additional+ line of dashes in the header.++ """++ _format_name = "rst"+ _description = "reStructuredText simple table"+ data_class = SimpleRSTData+ header_class = SimpleRSTHeader++ def __init__(self, header_rows=None):+ self.header_rows = header_rows+ super().__init__(delimiter_pad=None, bookend=False)++ def write(self, lines):+ lines = super().write(lines)+ if self.header_rows is not None:+ header_lines = []+ for row in self.header_rows:+ header_lines.append(self.header.splitter.join(row))+ lines = header_lines + lines+ lines = [lines[1]] + lines + [lines[1]]+ return linesdiff --git a/astropy/io/ascii/rst.py b/astropy/io/ascii/rst.pyindex abdeba8efb..07a6add8a8 100644--- a/astropy/io/ascii/rst.py+++ b/astropy/io/ascii/rst.py@@ -19,10 +19,17 @@ class SimpleRSTHeader(FixedWidthHeader): splitter_class = DefaultSplitter position_char = "=" - def get_fixedwidth_params(self, line):- vals, starts, ends = super().get_fixedwidth_params(line)- # The right hand column can be unbounded- ends[-1] = None+ def get_fixedwidth_params(self, line, header_rows=None):+ if header_rows is not None:+ vals = header_rows[0]+ starts = [0]+ for i in range(len(vals) - 1):+ starts.append(starts[-1] + len(vals[i]) + 1)+ ends = starts[1:] + [None]+ else:+ vals, starts, ends = super().get_fixedwidth_params(line)+ # The right hand column can be unbounded+ ends[-1] = None return vals, starts, ends @@ -57,10 +64,18 @@ class RST(FixedWidth): data_class = SimpleRSTData header_class = SimpleRSTHeader - def __init__(self):+ def __init__(self, header_rows=None):+ self.header_rows = header_rows super().__init__(delimiter_pad=None, bookend=False) def write(self, lines):+ if self.header_rows is not None:+ self.header.get_fixedwidth_params(lines[0], self.header_rows) lines = super().write(lines)+ if self.header_rows is not None:+ header_lines = []+ for row in self.header_rows:+ header_lines.append(self.header.splitter.join(row))+ lines = header_lines + lines lines = [lines[1]] + lines + [lines[1]] return lines1234567891011121314151617181920212223242526272829303132333435363738{ "astropy__astropy-14182": { "patch_is_None": false, "patch_exists": true, "patch_successfully_applied": true, "resolved": false, "tests_status": { "FAIL_TO_PASS": { "success": [], "failure": [ "astropy/io/ascii/tests/test_rst.py::test_rst_with_header_rows" ] }, "PASS_TO_PASS": { "success": [ "astropy/io/ascii/tests/test_rst.py::test_read_normal", "astropy/io/ascii/tests/test_rst.py::test_read_normal_names", "astropy/io/ascii/tests/test_rst.py::test_read_normal_names_include", "astropy/io/ascii/tests/test_rst.py::test_read_normal_exclude", "astropy/io/ascii/tests/test_rst.py::test_read_unbounded_right_column", "astropy/io/ascii/tests/test_rst.py::test_read_unbounded_right_column_header", "astropy/io/ascii/tests/test_rst.py::test_read_right_indented_table", "astropy/io/ascii/tests/test_rst.py::test_trailing_spaces_in_row_definition", "astropy/io/ascii/tests/test_rst.py::test_write_normal" ], "failure": [] }, "FAIL_TO_FAIL": { "success": [], "failure": [] }, "PASS_TO_FAIL": { "success": [], "failure": [] } } }}123version https://git-lfs.github.com/spec/v1oid sha256:11e47e1ca1329e43698987e4c8a39e86908d59b74be42a43d8b6d2df117d850esize 7432123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051#!/bin/bashset -uxo pipefailsource /opt/miniconda3/bin/activateconda activate testbedcd /testbedgit config --global --add safe.directory /testbedcd /testbedgit statusgit showgit diff 7269fa3e33e8d02485a647da91a5a2a60a06af61source /opt/miniconda3/bin/activateconda activate testbedpython -m pip install -e .[test] --verbosegit checkout 7269fa3e33e8d02485a647da91a5a2a60a06af61 astropy/io/ascii/tests/test_qdp.pygit apply -v - <<'EOF_114329324912'diff --git a/astropy/io/ascii/tests/test_qdp.py b/astropy/io/ascii/tests/test_qdp.py--- a/astropy/io/ascii/tests/test_qdp.py+++ b/astropy/io/ascii/tests/test_qdp.py@@ -43,7 +43,18 @@ def test_get_tables_from_qdp_file(tmp_path): assert np.isclose(table2["MJD_nerr"][0], -2.37847222222222e-05) -def test_roundtrip(tmp_path):+def lowercase_header(value):+ """Make every non-comment line lower case."""+ lines = []+ for line in value.splitlines():+ if not line.startswith("!"):+ line = line.lower()+ lines.append(line)+ return "\n".join(lines)+++@pytest.mark.parametrize("lowercase", [False, True])+def test_roundtrip(tmp_path, lowercase): example_qdp = """ ! Swift/XRT hardness ratio of trigger: XXXX, name: BUBU X-2 ! Columns are as labelled@@ -70,6 +81,8 @@ def test_roundtrip(tmp_path): 53000.123456 2.37847222222222e-05 -2.37847222222222e-05 -0.292553 -0.374935 NO 1.14467592592593e-05 -1.14467592592593e-05 0.000000 NO """+ if lowercase:+ example_qdp = lowercase_header(example_qdp) path = str(tmp_path / "test.qdp") path2 = str(tmp_path / "test2.qdp")
EOF_114329324912pytest -rA astropy/io/ascii/tests/test_qdp.pygit checkout 7269fa3e33e8d02485a647da91a5a2a60a06af61 astropy/io/ascii/tests/test_qdp.py123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661diff --git a/astropy/io/ascii/.backup.qdp.py b/astropy/io/ascii/.backup.qdp.pynew file mode 100644index 0000000000..83a4f004aa--- /dev/null+++ b/astropy/io/ascii/.backup.qdp.py@@ -0,0 +1,642 @@+# Licensed under a 3-clause BSD style license - see LICENSE.rst+"""+This package contains functions for reading and writing QDP tables that are+not meant to be used directly, but instead are available as readers/writers in+`astropy.table`. See :ref:`astropy:table_io` for more details.+"""+import copy+import re+import warnings+from collections.abc import Iterable++import numpy as np++from astropy.table import Table+from astropy.utils.exceptions import AstropyUserWarning++from . import basic, core+++def _line_type(line, delimiter=None):+ """Interpret a QDP file line.++ Parameters+ ----------+ line : str+ a single line of the file++ Returns+ -------+ type : str+ Line type: "comment", "command", or "data"++ Examples+ --------+ >>> _line_type("READ SERR 3")+ 'command'+ >>> _line_type(" \\n !some gibberish")+ 'comment'+ >>> _line_type(" ")+ 'comment'+ >>> _line_type(" 21345.45")+ 'data,1'+ >>> _line_type(" 21345.45 1.53e-3 1e-3 .04 NO nan")+ 'data,6'+ >>> _line_type(" 21345.45,1.53e-3,1e-3,.04,NO,nan", delimiter=',')+ 'data,6'+ >>> _line_type(" 21345.45 ! a comment to disturb")+ 'data,1'+ >>> _line_type("NO NO NO NO NO")+ 'new'+ >>> _line_type("NO,NO,NO,NO,NO", delimiter=',')+ 'new'+ >>> _line_type("N O N NOON OON O")+ Traceback (most recent call last):+ ...+ ValueError: Unrecognized QDP line...+ >>> _line_type(" some non-comment gibberish")+ Traceback (most recent call last):+ ...+ ValueError: Unrecognized QDP line...+ """+ _decimal_re = r"[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?"+ _command_re = r"READ [TS]ERR(\s+[0-9]+)+"++ sep = delimiter+ if delimiter is None:+ sep = r"\s+"+ _new_re = rf"NO({sep}NO)+"+ _data_re = rf"({_decimal_re}|NO|[-+]?nan)({sep}({_decimal_re}|NO|[-+]?nan))*)"+ _type_re = rf"^\s*((?P<command>{_command_re})|(?P<new>{_new_re})|(?P<data>{_data_re})?\s*(\!(?P<comment>.*))?\s*$"+ _line_type_re = re.compile(_type_re)+ line = line.strip()+ if not line:+ return "comment"+ match = _line_type_re.match(line)++ if match is None:+ raise ValueError(f"Unrecognized QDP line: {line}")+ for type_, val in match.groupdict().items():+ if val is None:+ continue+ if type_ == "data":+ return f"data,{len(val.split(sep=delimiter))}"+ else:+ return type_+++def _get_type_from_list_of_lines(lines, delimiter=None):+ """Read through the list of QDP file lines and label each line by type.++ Parameters+ ----------+ lines : list+ List containing one file line in each entry++ Returns+ -------+ contents : list+ List containing the type for each line (see `line_type_and_data`)+ ncol : int+ The number of columns in the data lines. Must be the same throughout+ the file++ Examples+ --------+ >>> line0 = "! A comment"+ >>> line1 = "543 12 456.0"+ >>> lines = [line0, line1]+ >>> types, ncol = _get_type_from_list_of_lines(lines)+ >>> types[0]+ 'comment'+ >>> types[1]+ 'data,3'+ >>> ncol+ 3+ >>> lines.append("23")+ >>> _get_type_from_list_of_lines(lines)+ Traceback (most recent call last):+ ...+ ValueError: Inconsistent number of columns+ """+ types = [_line_type(line, delimiter=delimiter) for line in lines]+ current_ncol = None+ for type_ in types:+ if type_.startswith("data,"):+ ncol = int(type_[5:])+ if current_ncol is None:+ current_ncol = ncol+ elif ncol != current_ncol:+ raise ValueError("Inconsistent number of columns")++ return types, current_ncol+++def _get_lines_from_file(qdp_file):+ if "\n" in qdp_file:+ lines = qdp_file.split("\n")+ elif isinstance(qdp_file, str):+ with open(qdp_file) as fobj:+ lines = [line.strip() for line in fobj.readlines()]+ elif isinstance(qdp_file, Iterable):+ lines = qdp_file+ else:+ raise ValueError("invalid value of qdb_file")++ return lines+++def _interpret_err_lines(err_specs, ncols, names=None):+ """Give list of column names from the READ SERR and TERR commands.++ Parameters+ ----------+ err_specs : dict+ ``{'serr': [n0, n1, ...], 'terr': [n2, n3, ...]}``+ Error specifications for symmetric and two-sided errors+ ncols : int+ Number of data columns++ Other Parameters+ ----------------+ names : list of str+ Name of data columns (defaults to ['col1', 'col2', ...]), _not_+ including error columns.++ Returns+ -------+ colnames : list+ List containing the column names. Error columns will have the name+ of the main column plus ``_err`` for symmetric errors, and ``_perr``+ and ``_nerr`` for positive and negative errors respectively++ Examples+ --------+ >>> col_in = ['MJD', 'Rate']+ >>> cols = _interpret_err_lines(None, 2, names=col_in)+ >>> cols[0]+ 'MJD'+ >>> err_specs = {'terr': [1], 'serr': [2]}+ >>> ncols = 5+ >>> cols = _interpret_err_lines(err_specs, ncols, names=col_in)+ >>> cols[0]+ 'MJD'+ >>> cols[2]+ 'MJD_nerr'+ >>> cols[4]+ 'Rate_err'+ >>> _interpret_err_lines(err_specs, 6, names=col_in)+ Traceback (most recent call last):+ ...+ ValueError: Inconsistent number of input colnames+ """+ colnames = ["" for i in range(ncols)]+ if err_specs is None:+ serr_cols = terr_cols = []++ else:+ # I don't want to empty the original one when using `pop` below+ err_specs = copy.deepcopy(err_specs)++ serr_cols = err_specs.pop("serr", [])+ terr_cols = err_specs.pop("terr", [])++ if names is not None:+ all_error_cols = len(serr_cols) + len(terr_cols) * 2+ if all_error_cols + len(names) != ncols:+ raise ValueError("Inconsistent number of input colnames")++ shift = 0+ for i in range(ncols):+ col_num = i + 1 - shift+ if colnames[i] != "":+ continue++ colname_root = f"col{col_num}"++ if names is not None:+ colname_root = names[col_num - 1]++ colnames[i] = f"{colname_root}"+ if col_num in serr_cols:+ colnames[i + 1] = f"{colname_root}_err"+ shift += 1+ continue++ if col_num in terr_cols:+ colnames[i + 1] = f"{colname_root}_perr"+ colnames[i + 2] = f"{colname_root}_nerr"+ shift += 2+ continue++ assert not np.any([c == "" for c in colnames])++ return colnames+++def _get_tables_from_qdp_file(qdp_file, input_colnames=None, delimiter=None):+ """Get all tables from a QDP file.++ Parameters+ ----------+ qdp_file : str+ Input QDP file name++ Other Parameters+ ----------------+ input_colnames : list of str+ Name of data columns (defaults to ['col1', 'col2', ...]), _not_+ including error columns.+ delimiter : str+ Delimiter for the values in the table.++ Returns+ -------+ list of `~astropy.table.Table`+ List containing all the tables present inside the QDP file+ """+ lines = _get_lines_from_file(qdp_file)+ contents, ncol = _get_type_from_list_of_lines(lines, delimiter=delimiter)++ table_list = []+ err_specs = {}+ colnames = None++ comment_text = ""+ initial_comments = ""+ command_lines = ""+ current_rows = None++ for line, datatype in zip(lines, contents):+ line = line.strip().lstrip("!")+ # Is this a comment?+ if datatype == "comment":+ comment_text += line + "\n"+ continue++ if datatype == "command":+ # The first time I find commands, I save whatever comments into+ # The initial comments.+ if command_lines == "":+ initial_comments = comment_text+ comment_text = ""++ if err_specs != {}:+ warnings.warn(+ "This file contains multiple command blocks. Please verify",+ AstropyUserWarning,+ )+ command_lines += line + "\n"+ continue++ if datatype.startswith("data"):+ # The first time I find data, I define err_specs+ if err_specs == {} and command_lines != "":+ for cline in command_lines.strip().split("\n"):+ command = cline.strip().split()+ # This should never happen, but just in case.+ if len(command) < 3:+ continue+ err_specs[command[1].lower()] = [int(c) for c in command[2:]]+ if colnames is None:+ colnames = _interpret_err_lines(err_specs, ncol, names=input_colnames)++ if current_rows is None:+ current_rows = []++ values = []+ for v in line.split(delimiter):+ if v == "NO":+ values.append(np.ma.masked)+ else:+ # Understand if number is int or float+ try:+ values.append(int(v))+ except ValueError:+ values.append(float(v))+ current_rows.append(values)+ continue++ if datatype == "new":+ # Save table to table_list and reset+ if current_rows is not None:+ new_table = Table(names=colnames, rows=current_rows)+ new_table.meta["initial_comments"] = initial_comments.strip().split(+ "\n"+ )+ new_table.meta["comments"] = comment_text.strip().split("\n")+ # Reset comments+ comment_text = ""+ table_list.append(new_table)+ current_rows = None+ continue++ # At the very end, if there is still a table being written, let's save+ # it to the table_list+ if current_rows is not None:+ new_table = Table(names=colnames, rows=current_rows)+ new_table.meta["initial_comments"] = initial_comments.strip().split("\n")+ new_table.meta["comments"] = comment_text.strip().split("\n")+ table_list.append(new_table)++ return table_list+++def _understand_err_col(colnames):+ """Get which column names are error columns.++ Examples+ --------+ >>> colnames = ['a', 'a_err', 'b', 'b_perr', 'b_nerr']+ >>> serr, terr = _understand_err_col(colnames)+ >>> np.allclose(serr, [1])+ True+ >>> np.allclose(terr, [2])+ True+ >>> serr, terr = _understand_err_col(['a', 'a_nerr'])+ Traceback (most recent call last):+ ...+ ValueError: Missing positive error...+ >>> serr, terr = _understand_err_col(['a', 'a_perr'])+ Traceback (most recent call last):+ ...+ ValueError: Missing negative error...+ """+ shift = 0+ serr = []+ terr = []++ for i, col in enumerate(colnames):+ if col.endswith("_err"):+ # The previous column, but they're numbered from 1!+ # Plus, take shift into account+ serr.append(i - shift)+ shift += 1+ elif col.endswith("_perr"):+ terr.append(i - shift)+ if len(colnames) == i + 1 or not colnames[i + 1].endswith("_nerr"):+ raise ValueError("Missing negative error")+ shift += 2+ elif col.endswith("_nerr") and not colnames[i - 1].endswith("_perr"):+ raise ValueError("Missing positive error")+ return serr, terr+++def _read_table_qdp(qdp_file, names=None, table_id=None, delimiter=None):+ """Read a table from a QDP file.++ Parameters+ ----------+ qdp_file : str+ Input QDP file name++ Other Parameters+ ----------------+ names : list of str+ Name of data columns (defaults to ['col1', 'col2', ...]), _not_+ including error columns.++ table_id : int, default 0+ Number of the table to be read from the QDP file. This is useful+ when multiple tables present in the file. By default, the first is read.++ delimiter : str+ Any delimiter accepted by the `sep` argument of str.split()++ Returns+ -------+ tables : list of `~astropy.table.Table`+ List containing all the tables present inside the QDP file+ """+ if table_id is None:+ warnings.warn(+ "table_id not specified. Reading the first available table",+ AstropyUserWarning,+ )+ table_id = 0++ tables = _get_tables_from_qdp_file(+ qdp_file, input_colnames=names, delimiter=delimiter+ )++ return tables[table_id]+++def _write_table_qdp(table, filename=None, err_specs=None):+ """Write a table to a QDP file.++ Parameters+ ----------+ table : :class:`~astropy.table.Table`+ Input table to be written+ filename : str+ Output QDP file name++ Other Parameters+ ----------------+ err_specs : dict+ Dictionary of the format {'serr': [1], 'terr': [2, 3]}, specifying+ which columns have symmetric and two-sided errors (see QDP format+ specification)+ """+ import io++ fobj = io.StringIO()++ if "initial_comments" in table.meta and table.meta["initial_comments"] != []:+ for line in table.meta["initial_comments"]:+ line = line.strip()+ if not line.startswith("!"):+ line = "!" + line+ print(line, file=fobj)++ if err_specs is None:+ serr_cols, terr_cols = _understand_err_col(table.colnames)+ else:+ serr_cols = err_specs.pop("serr", [])+ terr_cols = err_specs.pop("terr", [])+ if serr_cols != []:+ col_string = " ".join([str(val) for val in serr_cols])+ print(f"READ SERR {col_string}", file=fobj)+ if terr_cols != []:+ col_string = " ".join([str(val) for val in terr_cols])+ print(f"READ TERR {col_string}", file=fobj)++ if "comments" in table.meta and table.meta["comments"] != []:+ for line in table.meta["comments"]:+ line = line.strip()+ if not line.startswith("!"):+ line = "!" + line+ print(line, file=fobj)++ colnames = table.colnames+ print("!" + " ".join(colnames), file=fobj)+ for row in table:+ values = []+ for val in row:+ if not np.ma.is_masked(val):+ rep = str(val)+ else:+ rep = "NO"+ values.append(rep)+ print(" ".join(values), file=fobj)++ full_string = fobj.getvalue()+ fobj.close()++ if filename is not None:+ with open(filename, "w") as fobj:+ print(full_string, file=fobj)++ return full_string.split("\n")+++class QDPSplitter(core.DefaultSplitter):+ """+ Split on space for QDP tables.+ """++ delimiter = " "+++class QDPHeader(basic.CommentedHeaderHeader):+ """+ Header that uses the :class:`astropy.io.ascii.basic.QDPSplitter`.+ """++ splitter_class = QDPSplitter+ comment = "!"+ write_comment = "!"+++class QDPData(basic.BasicData):+ """+ Data that uses the :class:`astropy.io.ascii.basic.CsvSplitter`.+ """++ splitter_class = QDPSplitter+ fill_values = [(core.masked, "NO")]+ comment = "!"+ write_comment = None+++class QDP(basic.Basic):+ """Quick and Dandy Plot table.++ Example::++ ! Initial comment line 1+ ! Initial comment line 2+ READ TERR 1+ READ SERR 3+ ! Table 0 comment+ !a a(pos) a(neg) b be c d+ 53000.5 0.25 -0.5 1 1.5 3.5 2+ 54000.5 1.25 -1.5 2 2.5 4.5 3+ NO NO NO NO NO+ ! Table 1 comment+ !a a(pos) a(neg) b be c d+ 54000.5 2.25 -2.5 NO 3.5 5.5 5+ 55000.5 3.25 -3.5 4 4.5 6.5 nan++ The input table above contains some initial comments, the error commands,+ then two tables.+ This file format can contain multiple tables, separated by a line full+ of ``NO``s. Comments are exclamation marks, and missing values are single+ ``NO`` entries. The delimiter is usually whitespace, more rarely a comma.+ The QDP format differentiates between data and error columns. The table+ above has commands::++ READ TERR 1+ READ SERR 3++ which mean that after data column 1 there will be two error columns+ containing its positive and engative error bars, then data column 2 without+ error bars, then column 3, then a column with the symmetric error of column+ 3, then the remaining data columns.++ As explained below, table headers are highly inconsistent. Possible+ comments containing column names will be ignored and columns will be called+ ``col1``, ``col2``, etc. unless the user specifies their names with the+ ``names=`` keyword argument,+ When passing column names, pass **only the names of the data columns, not+ the error columns.**+ Error information will be encoded in the names of the table columns.+ (e.g. ``a_perr`` and ``a_nerr`` for the positive and negative error of+ column ``a``, ``b_err`` the symmetric error of column ``b``.)++ When writing tables to this format, users can pass an ``err_specs`` keyword+ passing a dictionary ``{'serr': [3], 'terr': [1, 2]}``, meaning that data+ columns 1 and two will have two additional columns each with their positive+ and negative errors, and data column 3 will have an additional column with+ a symmetric error (just like the ``READ SERR`` and ``READ TERR`` commands+ above)++ Headers are just comments, and tables distributed by various missions+ can differ greatly in their use of conventions. For example, light curves+ distributed by the Swift-Gehrels mission have an extra space in one header+ entry that makes the number of labels inconsistent with the number of cols.+ For this reason, we ignore the comments that might encode the column names+ and leave the name specification to the user.++ Example::++ > Extra space+ > |+ > v+ >! MJD Err (pos) Err(neg) Rate Error+ >53000.123456 2.378e-05 -2.378472e-05 NO 0.212439++ These readers and writer classes will strive to understand which of the+ comments belong to all the tables, and which ones to each single table.+ General comments will be stored in the ``initial_comments`` meta of each+ table. The comments of each table will be stored in the ``comments`` meta.++ Example::++ t = Table.read(example_qdp, format='ascii.qdp', table_id=1, names=['a', 'b', 'c', 'd'])++ reads the second table (``table_id=1``) in file ``example.qdp`` containing+ the table above. There are four column names but seven data columns, why?+ Because the ``READ SERR`` and ``READ TERR`` commands say that there are+ three error columns.+ ``t.meta['initial_comments']`` will contain the initial two comment lines+ in the file, while ``t.meta['comments']`` will contain ``Table 1 comment``++ The table can be written to another file, preserving the same information,+ as::++ t.write(test_file, err_specs={'terr': [1], 'serr': [3]})++ Note how the ``terr`` and ``serr`` commands are passed to the writer.++ """++ _format_name = "qdp"+ _io_registry_can_write = True+ _io_registry_suffix = ".qdp"+ _description = "Quick and Dandy Plotter"++ header_class = QDPHeader+ data_class = QDPData++ def __init__(self, table_id=None, names=None, err_specs=None, sep=None):+ super().__init__()+ self.table_id = table_id+ self.names = names+ self.err_specs = err_specs+ self.delimiter = sep++ def read(self, table):+ self.lines = self.inputter.get_lines(table, newline="\n")+ return _read_table_qdp(+ self.lines,+ table_id=self.table_id,+ names=self.names,+ delimiter=self.delimiter,+ )++ def write(self, table):+ self._check_multidim_table(table)+ lines = _write_table_qdp(table, err_specs=self.err_specs)+ return linesdiff --git a/astropy/io/ascii/qdp.py b/astropy/io/ascii/qdp.pyindex 83a4f004aa..379dc2e11a 100644--- a/astropy/io/ascii/qdp.py+++ b/astropy/io/ascii/qdp.py@@ -60,7 +60,7 @@ def _line_type(line, delimiter=None): ValueError: Unrecognized QDP line... """ _decimal_re = r"[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?"- _command_re = r"READ [TS]ERR(\s+[0-9]+)+"+ _command_re = r"read [ts]err(\s+[0-9]+)+".lower() sep = delimiter if delimiter is None:1234567891011121314151617181920212223242526272829303132333435363738{ "astropy__astropy-14365": { "patch_is_None": false, "patch_exists": true, "patch_successfully_applied": true, "resolved": false, "tests_status": { "FAIL_TO_PASS": { "success": [], "failure": [ "astropy/io/ascii/tests/test_qdp.py::test_roundtrip[True]" ] }, "PASS_TO_PASS": { "success": [ "astropy/io/ascii/tests/test_qdp.py::test_read_write_simple", "astropy/io/ascii/tests/test_qdp.py::test_read_write_simple_specify_name", "astropy/io/ascii/tests/test_qdp.py::test_get_lines_from_qdp" ], "failure": [ "astropy/io/ascii/tests/test_qdp.py::test_get_tables_from_qdp_file", "astropy/io/ascii/tests/test_qdp.py::test_roundtrip[False]", "astropy/io/ascii/tests/test_qdp.py::test_read_example", "astropy/io/ascii/tests/test_qdp.py::test_roundtrip_example", "astropy/io/ascii/tests/test_qdp.py::test_roundtrip_example_comma" ] }, "FAIL_TO_FAIL": { "success": [], "failure": [] }, "PASS_TO_FAIL": { "success": [], "failure": [] } } }}123version https://git-lfs.github.com/spec/v1oid sha256:b01c71e0afb25d989151841603b6e8ff7e11852364807c22ad897f868892ccffsize 4798123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657#!/bin/bashset -uxo pipefailsource /opt/miniconda3/bin/activateconda activate testbedcd /testbedgit config --global --add safe.directory /testbedcd /testbedgit statusgit showgit diff c76af9ed6bb89bfba45b9f5bc1e635188278e2fasource /opt/miniconda3/bin/activateconda activate testbedpython -m pip install -e .[test] --verbosegit checkout c76af9ed6bb89bfba45b9f5bc1e635188278e2fa astropy/io/fits/tests/test_checksum.py astropy/io/fits/tests/test_table.pygit apply -v - <<'EOF_114329324912'diff --git a/astropy/io/fits/tests/test_checksum.py b/astropy/io/fits/tests/test_checksum.py--- a/astropy/io/fits/tests/test_checksum.py+++ b/astropy/io/fits/tests/test_checksum.py@@ -205,9 +205,9 @@ def test_ascii_table_data(self): # The checksum ends up being different on Windows, possibly due # to slight floating point differences assert 'CHECKSUM' in hdul[1].header- assert hdul[1].header['CHECKSUM'] == '51IDA1G981GCA1G9'+ assert hdul[1].header['CHECKSUM'] == '3rKFAoI94oICAoI9' assert 'DATASUM' in hdul[1].header- assert hdul[1].header['DATASUM'] == '1948208413'+ assert hdul[1].header['DATASUM'] == '1914653725' def test_compressed_image_data(self): with fits.open(self.data('comp.fits')) as h1:diff --git a/astropy/io/fits/tests/test_table.py b/astropy/io/fits/tests/test_table.py--- a/astropy/io/fits/tests/test_table.py+++ b/astropy/io/fits/tests/test_table.py@@ -298,6 +298,19 @@ def test_ascii_table(self): hdul = fits.open(self.temp('toto.fits')) assert comparerecords(hdu.data, hdul[1].data) hdul.close()++ # Test Scaling++ r1 = np.array([11., 12.])+ c2 = fits.Column(name='def', format='D', array=r1, bscale=2.3,+ bzero=0.6)+ hdu = fits.TableHDU.from_columns([c2])+ hdu.writeto(self.temp('toto.fits'), overwrite=True)+ with open(self.temp('toto.fits')) as f:+ assert '4.95652173913043548D+00' in f.read()+ with fits.open(self.temp('toto.fits')) as hdul:+ assert comparerecords(hdu.data, hdul[1].data)+ a.close() def test_endianness(self):
EOF_114329324912pytest -rA -vv -o console_output_style=classic --tb=no astropy/io/fits/tests/test_checksum.py astropy/io/fits/tests/test_table.pygit checkout c76af9ed6bb89bfba45b9f5bc1e635188278e2fa astropy/io/fits/tests/test_checksum.py astropy/io/fits/tests/test_table.py123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350diff --git a/astropy/io/fits/.backup.fitsrec.py b/astropy/io/fits/.backup.fitsrec.pynew file mode 100644index 0000000000..574b4073b1--- /dev/null+++ b/astropy/io/fits/.backup.fitsrec.py@@ -0,0 +1,1331 @@+# Licensed under a 3-clause BSD style license - see PYFITS.rst++import copy+import operator+import warnings+import weakref++from contextlib import suppress+from functools import reduce++import numpy as np++from numpy import char as chararray++from .column import (ASCIITNULL, FITS2NUMPY, ASCII2NUMPY, ASCII2STR, ColDefs,+ _AsciiColDefs, _FormatX, _FormatP, _VLF, _get_index,+ _wrapx, _unwrapx, _makep, Delayed)+from .util import decode_ascii, encode_ascii, _rstrip_inplace+from ...utils import lazyproperty+++class FITS_record:+ """+ FITS record class.++ `FITS_record` is used to access records of the `FITS_rec` object.+ This will allow us to deal with scaled columns. It also handles+ conversion/scaling of columns in ASCII tables. The `FITS_record`+ class expects a `FITS_rec` object as input.+ """++ def __init__(self, input, row=0, start=None, end=None, step=None,+ base=None, **kwargs):+ """+ Parameters+ ----------+ input : array+ The array to wrap.++ row : int, optional+ The starting logical row of the array.++ start : int, optional+ The starting column in the row associated with this object.+ Used for subsetting the columns of the `FITS_rec` object.++ end : int, optional+ The ending column in the row associated with this object.+ Used for subsetting the columns of the `FITS_rec` object.+ """++ self.array = input+ self.row = row+ if base:+ width = len(base)+ else:+ width = self.array._nfields++ s = slice(start, end, step).indices(width)+ self.start, self.end, self.step = s+ self.base = base++ def __getitem__(self, key):+ if isinstance(key, str):+ indx = _get_index(self.array.names, key)++ if indx < self.start or indx > self.end - 1:+ raise KeyError("Key '{}' does not exist.".format(key))+ elif isinstance(key, slice):+ return type(self)(self.array, self.row, key.start, key.stop,+ key.step, self)+ else:+ indx = self._get_index(key)++ if indx > self.array._nfields - 1:+ raise IndexError('Index out of bounds')++ return self.array.field(indx)[self.row]++ def __setitem__(self, key, value):+ if isinstance(key, str):+ indx = _get_index(self.array.names, key)++ if indx < self.start or indx > self.end - 1:+ raise KeyError("Key '{}' does not exist.".format(key))+ elif isinstance(key, slice):+ for indx in range(slice.start, slice.stop, slice.step):+ indx = self._get_indx(indx)+ self.array.field(indx)[self.row] = value+ else:+ indx = self._get_index(key)+ if indx > self.array._nfields - 1:+ raise IndexError('Index out of bounds')++ self.array.field(indx)[self.row] = value++ def __len__(self):+ return len(range(self.start, self.end, self.step))++ def __repr__(self):+ """+ Display a single row.+ """++ outlist = []+ for idx in range(len(self)):+ outlist.append(repr(self[idx]))+ return '({})'.format(', '.join(outlist))++ def field(self, field):+ """+ Get the field data of the record.+ """++ return self.__getitem__(field)++ def setfield(self, field, value):+ """+ Set the field data of the record.+ """++ self.__setitem__(field, value)++ @lazyproperty+ def _bases(self):+ bases = [weakref.proxy(self)]+ base = self.base+ while base:+ bases.append(base)+ base = base.base+ return bases++ def _get_index(self, indx):+ indices = np.ogrid[:self.array._nfields]+ for base in reversed(self._bases):+ if base.step < 1:+ s = slice(base.start, None, base.step)+ else:+ s = slice(base.start, base.end, base.step)+ indices = indices[s]+ return indices[indx]+++class FITS_rec(np.recarray):+ """+ FITS record array class.++ `FITS_rec` is the data part of a table HDU's data part. This is a layer+ over the `~numpy.recarray`, so we can deal with scaled columns.++ It inherits all of the standard methods from `numpy.ndarray`.+ """++ _record_type = FITS_record+ _character_as_bytes = False++ def __new__(subtype, input):+ """+ Construct a FITS record array from a recarray.+ """++ # input should be a record array+ if input.dtype.subdtype is None:+ self = np.recarray.__new__(subtype, input.shape, input.dtype,+ buf=input.data)+ else:+ self = np.recarray.__new__(subtype, input.shape, input.dtype,+ buf=input.data, strides=input.strides)++ self._init()+ if self.dtype.fields:+ self._nfields = len(self.dtype.fields)++ return self++ def __setstate__(self, state):+ meta = state[-1]+ column_state = state[-2]+ state = state[:-2]++ super().__setstate__(state)++ self._col_weakrefs = weakref.WeakSet()++ for attr, value in zip(meta, column_state):+ setattr(self, attr, value)++ def __reduce__(self):+ """+ Return a 3-tuple for pickling a FITS_rec. Use the super-class+ functionality but then add in a tuple of FITS_rec-specific+ values that get used in __setstate__.+ """++ reconst_func, reconst_func_args, state = super().__reduce__()++ # Define FITS_rec-specific attrs that get added to state+ column_state = []+ meta = []++ for attrs in ['_converted', '_heapoffset', '_heapsize', '_nfields',+ '_gap', '_uint', 'parnames', '_coldefs']:++ with suppress(AttributeError):+ # _coldefs can be Delayed, and file objects cannot be+ # picked, it needs to be deepcopied first+ if attrs == '_coldefs':+ column_state.append(self._coldefs.__deepcopy__(None))+ else:+ column_state.append(getattr(self, attrs))+ meta.append(attrs)++ state = state + (column_state, meta)++ return reconst_func, reconst_func_args, state++ def __array_finalize__(self, obj):+ if obj is None:+ return++ if isinstance(obj, FITS_rec):+ self._character_as_bytes = obj._character_as_bytes++ if isinstance(obj, FITS_rec) and obj.dtype == self.dtype:+ self._converted = obj._converted+ self._heapoffset = obj._heapoffset+ self._heapsize = obj._heapsize+ self._col_weakrefs = obj._col_weakrefs+ self._coldefs = obj._coldefs+ self._nfields = obj._nfields+ self._gap = obj._gap+ self._uint = obj._uint+ elif self.dtype.fields is not None:+ # This will allow regular ndarrays with fields, rather than+ # just other FITS_rec objects+ self._nfields = len(self.dtype.fields)+ self._converted = {}++ self._heapoffset = getattr(obj, '_heapoffset', 0)+ self._heapsize = getattr(obj, '_heapsize', 0)++ self._gap = getattr(obj, '_gap', 0)+ self._uint = getattr(obj, '_uint', False)+ self._col_weakrefs = weakref.WeakSet()+ self._coldefs = ColDefs(self)++ # Work around chicken-egg problem. Column.array relies on the+ # _coldefs attribute to set up ref back to parent FITS_rec; however+ # in the above line the self._coldefs has not been assigned yet so+ # this fails. This patches that up...+ for col in self._coldefs:+ del col.array+ col._parent_fits_rec = weakref.ref(self)+ else:+ self._init()++ def _init(self):+ """Initializes internal attributes specific to FITS-isms."""++ self._nfields = 0+ self._converted = {}+ self._heapoffset = 0+ self._heapsize = 0+ self._col_weakrefs = weakref.WeakSet()+ self._coldefs = None+ self._gap = 0+ self._uint = False++ @classmethod+ def from_columns(cls, columns, nrows=0, fill=False, character_as_bytes=False):+ """+ Given a `ColDefs` object of unknown origin, initialize a new `FITS_rec`+ object.++ .. note::++ This was originally part of the ``new_table`` function in the table+ module but was moved into a class method since most of its+ functionality always had more to do with initializing a `FITS_rec`+ object than anything else, and much of it also overlapped with+ ``FITS_rec._scale_back``.++ Parameters+ ----------+ columns : sequence of `Column` or a `ColDefs`+ The columns from which to create the table data. If these+ columns have data arrays attached that data may be used in+ initializing the new table. Otherwise the input columns+ will be used as a template for a new table with the requested+ number of rows.++ nrows : int+ Number of rows in the new table. If the input columns have data+ associated with them, the size of the largest input column is used.+ Otherwise the default is 0.++ fill : bool+ If `True`, will fill all cells with zeros or blanks. If+ `False`, copy the data from input, undefined cells will still+ be filled with zeros/blanks.+ """++ if not isinstance(columns, ColDefs):+ columns = ColDefs(columns)++ # read the delayed data+ for column in columns:+ arr = column.array+ if isinstance(arr, Delayed):+ if arr.hdu.data is None:+ column.array = None+ else:+ column.array = _get_recarray_field(arr.hdu.data,+ arr.field)+ # Reset columns._arrays (which we may want to just do away with+ # altogether+ del columns._arrays++ # use the largest column shape as the shape of the record+ if nrows == 0:+ for arr in columns._arrays:+ if arr is not None:+ dim = arr.shape[0]+ else:+ dim = 0+ if dim > nrows:+ nrows = dim++ raw_data = np.empty(columns.dtype.itemsize * nrows, dtype=np.uint8)+ raw_data.fill(ord(columns._padding_byte))+ data = np.recarray(nrows, dtype=columns.dtype, buf=raw_data).view(cls)+ data._character_as_bytes = character_as_bytes++ # Make sure the data is a listener for changes to the columns+ columns._add_listener(data)++ # Previously this assignment was made from hdu.columns, but that's a+ # bug since if a _TableBaseHDU has a FITS_rec in its .data attribute+ # the _TableBaseHDU.columns property is actually returned from+ # .data._coldefs, so this assignment was circular! Don't make that+ # mistake again.+ # All of this is an artifact of the fragility of the FITS_rec class,+ # and that it can't just be initialized by columns...+ data._coldefs = columns++ # If fill is True we don't copy anything from the column arrays. We're+ # just using them as a template, and returning a table filled with+ # zeros/blanks+ if fill:+ return data++ # Otherwise we have to fill the recarray with data from the input+ # columns+ for idx, column in enumerate(columns):+ # For each column in the ColDef object, determine the number of+ # rows in that column. This will be either the number of rows in+ # the ndarray associated with the column, or the number of rows+ # given in the call to this function, which ever is smaller. If+ # the input FILL argument is true, the number of rows is set to+ # zero so that no data is copied from the original input data.+ arr = column.array++ if arr is None:+ array_size = 0+ else:+ array_size = len(arr)++ n = min(array_size, nrows)++ # TODO: At least *some* of this logic is mostly redundant with the+ # _convert_foo methods in this class; see if we can eliminate some+ # of that duplication.++ if not n:+ # The input column had an empty array, so just use the fill+ # value+ continue++ field = _get_recarray_field(data, idx)+ name = column.name+ fitsformat = column.format+ recformat = fitsformat.recformat++ outarr = field[:n]+ inarr = arr[:n]++ if isinstance(recformat, _FormatX):+ # Data is a bit array+ if inarr.shape[-1] == recformat.repeat:+ _wrapx(inarr, outarr, recformat.repeat)+ continue+ elif isinstance(recformat, _FormatP):+ data._cache_field(name, _makep(inarr, field, recformat,+ nrows=nrows))+ continue+ # TODO: Find a better way of determining that the column is meant+ # to be FITS L formatted+ elif recformat[-2:] == FITS2NUMPY['L'] and inarr.dtype == bool:+ # column is boolean+ # The raw data field should be filled with either 'T' or 'F'+ # (not 0). Use 'F' as a default+ field[:] = ord('F')+ # Also save the original boolean array in data._converted so+ # that it doesn't have to be re-converted+ converted = np.zeros(field.shape, dtype=bool)+ converted[:n] = inarr+ data._cache_field(name, converted)+ # TODO: Maybe this step isn't necessary at all if _scale_back+ # will handle it?+ inarr = np.where(inarr == np.False_, ord('F'), ord('T'))+ elif (columns[idx]._physical_values and+ columns[idx]._pseudo_unsigned_ints):+ # Temporary hack...+ bzero = column.bzero+ converted = np.zeros(field.shape, dtype=inarr.dtype)+ converted[:n] = inarr+ data._cache_field(name, converted)+ if n < nrows:+ # Pre-scale rows below the input data+ field[n:] = -bzero++ inarr = inarr - bzero+ elif isinstance(columns, _AsciiColDefs):+ # Regardless whether the format is character or numeric, if the+ # input array contains characters then it's already in the raw+ # format for ASCII tables+ if fitsformat._pseudo_logical:+ # Hack to support converting from 8-bit T/F characters+ # Normally the column array is a chararray of 1 character+ # strings, but we need to view it as a normal ndarray of+ # 8-bit ints to fill it with ASCII codes for 'T' and 'F'+ outarr = field.view(np.uint8, np.ndarray)[:n]+ elif arr.dtype.kind not in ('S', 'U'):+ # Set up views of numeric columns with the appropriate+ # numeric dtype+ # Fill with the appropriate blanks for the column format+ data._cache_field(name, np.zeros(nrows, dtype=arr.dtype))+ outarr = data._converted[name][:n]++ outarr[:] = inarr+ continue++ if inarr.shape != outarr.shape:+ if (inarr.dtype.kind == outarr.dtype.kind and+ inarr.dtype.kind in ('U', 'S') and+ inarr.dtype != outarr.dtype):++ inarr_rowsize = inarr[0].size+ inarr = inarr.flatten().view(outarr.dtype)++ # This is a special case to handle input arrays with+ # non-trivial TDIMn.+ # By design each row of the outarray is 1-D, while each row of+ # the input array may be n-D+ if outarr.ndim > 1:+ # The normal case where the first dimension is the rows+ inarr_rowsize = inarr[0].size+ inarr = inarr.reshape(n, inarr_rowsize)+ outarr[:, :inarr_rowsize] = inarr+ else:+ # Special case for strings where the out array only has one+ # dimension (the second dimension is rolled up into the+ # strings+ outarr[:n] = inarr.ravel()+ else:+ outarr[:] = inarr++ # Now replace the original column array references with the new+ # fields+ # This is required to prevent the issue reported in+ # https://github.com/spacetelescope/PyFITS/issues/99+ for idx in range(len(columns)):+ columns._arrays[idx] = data.field(idx)++ return data++ def __repr__(self):+ # Force use of the normal ndarray repr (rather than the new+ # one added for recarray in Numpy 1.10) for backwards compat+ return np.ndarray.__repr__(self)++ def __getitem__(self, key):+ if self._coldefs is None:+ return super().__getitem__(key)++ if isinstance(key, str):+ return self.field(key)++ # Have to view as a recarray then back as a FITS_rec, otherwise the+ # circular reference fix/hack in FITS_rec.field() won't preserve+ # the slice.+ out = self.view(np.recarray)[key]+ if type(out) is not np.recarray:+ # Oops, we got a single element rather than a view. In that case,+ # return a Record, which has no __getstate__ and is more efficient.+ return self._record_type(self, key)++ # We got a view; change it back to our class, and add stuff+ out = out.view(type(self))+ out._coldefs = ColDefs(self._coldefs)+ arrays = []+ out._converted = {}+ for idx, name in enumerate(self._coldefs.names):+ #+ # Store the new arrays for the _coldefs object+ #+ arrays.append(self._coldefs._arrays[idx][key])++ # Ensure that the sliced FITS_rec will view the same scaled+ # columns as the original; this is one of the few cases where+ # it is not necessary to use _cache_field()+ if name in self._converted:+ dummy = self._converted[name]+ field = np.ndarray.__getitem__(dummy, key)+ out._converted[name] = field++ out._coldefs._arrays = arrays+ return out++ def __setitem__(self, key, value):+ if self._coldefs is None:+ return super().__setitem__(key, value)++ if isinstance(key, str):+ self[key][:] = value+ return++ if isinstance(key, slice):+ end = min(len(self), key.stop or len(self))+ end = max(0, end)+ start = max(0, key.start or 0)+ end = min(end, start + len(value))++ for idx in range(start, end):+ self.__setitem__(idx, value[idx - start])+ return++ if isinstance(value, FITS_record):+ for idx in range(self._nfields):+ self.field(self.names[idx])[key] = value.field(self.names[idx])+ elif isinstance(value, (tuple, list, np.void)):+ if self._nfields == len(value):+ for idx in range(self._nfields):+ self.field(idx)[key] = value[idx]+ else:+ raise ValueError('Input tuple or list required to have {} '+ 'elements.'.format(self._nfields))+ else:+ raise TypeError('Assignment requires a FITS_record, tuple, or '+ 'list as input.')++ def copy(self, order='C'):+ """+ The Numpy documentation lies; `numpy.ndarray.copy` is not equivalent to+ `numpy.copy`. Differences include that it re-views the copied array as+ self's ndarray subclass, as though it were taking a slice; this means+ ``__array_finalize__`` is called and the copy shares all the array+ attributes (including ``._converted``!). So we need to make a deep+ copy of all those attributes so that the two arrays truly do not share+ any data.+ """++ new = super().copy(order=order)++ new.__dict__ = copy.deepcopy(self.__dict__)+ return new++ @property+ def columns(self):+ """+ A user-visible accessor for the coldefs.++ See https://aeon.stsci.edu/ssb/trac/pyfits/ticket/44+ """++ return self._coldefs++ @property+ def _coldefs(self):+ # This used to be a normal internal attribute, but it was changed to a+ # property as a quick and transparent way to work around the reference+ # leak bug fixed in https://github.com/astropy/astropy/pull/4539+ #+ # See the long comment in the Column.array property for more details+ # on this. But in short, FITS_rec now has a ._col_weakrefs attribute+ # which is a WeakSet of weakrefs to each Column in _coldefs.+ #+ # So whenever ._coldefs is set we also add each Column in the ColDefs+ # to the weakrefs set. This is an easy way to find out if a Column has+ # any references to it external to the FITS_rec (i.e. a user assigned a+ # column to a variable). If the column is still in _col_weakrefs then+ # there are other references to it external to this FITS_rec. We use+ # that information in __del__ to save off copies of the array data+ # for those columns to their Column.array property before our memory+ # is freed.+ return self.__dict__.get('_coldefs')++ @_coldefs.setter+ def _coldefs(self, cols):+ self.__dict__['_coldefs'] = cols+ if isinstance(cols, ColDefs):+ for col in cols.columns:+ self._col_weakrefs.add(col)++ @_coldefs.deleter+ def _coldefs(self):+ try:+ del self.__dict__['_coldefs']+ except KeyError as exc:+ raise AttributeError(exc.args[0])++ def __del__(self):+ try:+ del self._coldefs+ if self.dtype.fields is not None:+ for col in self._col_weakrefs:++ if col.array is not None:+ col.array = col.array.copy()++ # See issues #4690 and #4912+ except (AttributeError, TypeError): # pragma: no cover+ pass++ @property+ def names(self):+ """List of column names."""++ if self.dtype.fields:+ return list(self.dtype.names)+ elif getattr(self, '_coldefs', None) is not None:+ return self._coldefs.names+ else:+ return None++ @property+ def formats(self):+ """List of column FITS formats."""++ if getattr(self, '_coldefs', None) is not None:+ return self._coldefs.formats++ return None++ @property+ def _raw_itemsize(self):+ """+ Returns the size of row items that would be written to the raw FITS+ file, taking into account the possibility of unicode columns being+ compactified.++ Currently for internal use only.+ """++ if _has_unicode_fields(self):+ total_itemsize = 0+ for field in self.dtype.fields.values():+ itemsize = field[0].itemsize+ if field[0].kind == 'U':+ itemsize = itemsize // 4+ total_itemsize += itemsize+ return total_itemsize+ else:+ # Just return the normal itemsize+ return self.itemsize++ def field(self, key):+ """+ A view of a `Column`'s data as an array.+ """++ # NOTE: The *column* index may not be the same as the field index in+ # the recarray, if the column is a phantom column+ column = self.columns[key]+ name = column.name+ format = column.format++ if format.dtype.itemsize == 0:+ warnings.warn(+ 'Field {!r} has a repeat count of 0 in its format code, '+ 'indicating an empty field.'.format(key))+ return np.array([], dtype=format.dtype)++ # If field's base is a FITS_rec, we can run into trouble because it+ # contains a reference to the ._coldefs object of the original data;+ # this can lead to a circular reference; see ticket #49+ base = self+ while (isinstance(base, FITS_rec) and+ isinstance(base.base, np.recarray)):+ base = base.base+ # base could still be a FITS_rec in some cases, so take care to+ # use rec.recarray.field to avoid a potential infinite+ # recursion+ field = _get_recarray_field(base, name)++ if name not in self._converted:+ recformat = format.recformat+ # TODO: If we're now passing the column to these subroutines, do we+ # really need to pass them the recformat?+ if isinstance(recformat, _FormatP):+ # for P format+ converted = self._convert_p(column, field, recformat)+ else:+ # Handle all other column data types which are fixed-width+ # fields+ converted = self._convert_other(column, field, recformat)++ # Note: Never assign values directly into the self._converted dict;+ # always go through self._cache_field; this way self._converted is+ # only used to store arrays that are not already direct views of+ # our own data.+ self._cache_field(name, converted)+ return converted++ return self._converted[name]++ def _cache_field(self, name, field):+ """+ Do not store fields in _converted if one of its bases is self,+ or if it has a common base with self.++ This results in a reference cycle that cannot be broken since+ ndarrays do not participate in cyclic garbage collection.+ """++ base = field+ while True:+ self_base = self+ while True:+ if self_base is base:+ return++ if getattr(self_base, 'base', None) is not None:+ self_base = self_base.base+ else:+ break++ if getattr(base, 'base', None) is not None:+ base = base.base+ else:+ break++ self._converted[name] = field++ def _update_column_attribute_changed(self, column, idx, attr, old_value,+ new_value):+ """+ Update how the data is formatted depending on changes to column+ attributes initiated by the user through the `Column` interface.++ Dispatches column attribute change notifications to individual methods+ for each attribute ``_update_column_<attr>``+ """++ method_name = '_update_column_{0}'.format(attr)+ if hasattr(self, method_name):+ # Right now this is so we can be lazy and not implement updaters+ # for every attribute yet--some we may not need at all, TBD+ getattr(self, method_name)(column, idx, old_value, new_value)++ def _update_column_name(self, column, idx, old_name, name):+ """Update the dtype field names when a column name is changed."""++ dtype = self.dtype+ # Updating the names on the dtype should suffice+ dtype.names = dtype.names[:idx] + (name,) + dtype.names[idx + 1:]++ def _convert_x(self, field, recformat):+ """Convert a raw table column to a bit array as specified by the+ FITS X format.+ """++ dummy = np.zeros(self.shape + (recformat.repeat,), dtype=np.bool_)+ _unwrapx(field, dummy, recformat.repeat)+ return dummy++ def _convert_p(self, column, field, recformat):+ """Convert a raw table column of FITS P or Q format descriptors+ to a VLA column with the array data returned from the heap.+ """++ dummy = _VLF([None] * len(self), dtype=recformat.dtype)+ raw_data = self._get_raw_data()++ if raw_data is None:+ raise OSError(+ "Could not find heap data for the {!r} variable-length "+ "array column.".format(column.name))++ for idx in range(len(self)):+ offset = field[idx, 1] + self._heapoffset+ count = field[idx, 0]++ if recformat.dtype == 'a':+ dt = np.dtype(recformat.dtype + str(1))+ arr_len = count * dt.itemsize+ da = raw_data[offset:offset + arr_len].view(dt)+ da = np.char.array(da.view(dtype=dt), itemsize=count)+ dummy[idx] = decode_ascii(da)+ else:+ dt = np.dtype(recformat.dtype)+ arr_len = count * dt.itemsize+ dummy[idx] = raw_data[offset:offset + arr_len].view(dt)+ dummy[idx].dtype = dummy[idx].dtype.newbyteorder('>')+ # Each array in the field may now require additional+ # scaling depending on the other scaling parameters+ # TODO: The same scaling parameters apply to every+ # array in the column so this is currently very slow; we+ # really only need to check once whether any scaling will+ # be necessary and skip this step if not+ # TODO: Test that this works for X format; I don't think+ # that it does--the recformat variable only applies to the P+ # format not the X format+ dummy[idx] = self._convert_other(column, dummy[idx],+ recformat)++ return dummy++ def _convert_ascii(self, column, field):+ """+ Special handling for ASCII table columns to convert columns containing+ numeric types to actual numeric arrays from the string representation.+ """++ format = column.format+ recformat = ASCII2NUMPY[format[0]]+ # if the string = TNULL, return ASCIITNULL+ nullval = str(column.null).strip().encode('ascii')+ if len(nullval) > format.width:+ nullval = nullval[:format.width]++ # Before using .replace make sure that any trailing bytes in each+ # column are filled with spaces, and *not*, say, nulls; this causes+ # functions like replace to potentially leave gibberish bytes in the+ # array buffer.+ dummy = np.char.ljust(field, format.width)+ dummy = np.char.replace(dummy, encode_ascii('D'), encode_ascii('E'))+ null_fill = encode_ascii(str(ASCIITNULL).rjust(format.width))++ # Convert all fields equal to the TNULL value (nullval) to empty fields.+ # TODO: These fields really should be conerted to NaN or something else undefined.+ # Currently they are converted to empty fields, which are then set to zero.+ dummy = np.where(np.char.strip(dummy) == nullval, null_fill, dummy)++ # always replace empty fields, see https://github.com/astropy/astropy/pull/5394+ if nullval != b'':+ dummy = np.where(np.char.strip(dummy) == b'', null_fill, dummy)++ try:+ dummy = np.array(dummy, dtype=recformat)+ except ValueError as exc:+ indx = self.names.index(column.name)+ raise ValueError(+ '{}; the header may be missing the necessary TNULL{} '+ 'keyword or the table contains invalid data'.format(+ exc, indx + 1))++ return dummy++ def _convert_other(self, column, field, recformat):+ """Perform conversions on any other fixed-width column data types.++ This may not perform any conversion at all if it's not necessary, in+ which case the original column array is returned.+ """++ if isinstance(recformat, _FormatX):+ # special handling for the X format+ return self._convert_x(field, recformat)++ (_str, _bool, _number, _scale, _zero, bscale, bzero, dim) = \+ self._get_scale_factors(column)++ indx = self.names.index(column.name)++ # ASCII table, convert strings to numbers+ # TODO:+ # For now, check that these are ASCII columns by checking the coldefs+ # type; in the future all columns (for binary tables, ASCII tables, or+ # otherwise) should "know" what type they are already and how to handle+ # converting their data from FITS format to native format and vice+ # versa...+ if not _str and isinstance(self._coldefs, _AsciiColDefs):+ field = self._convert_ascii(column, field)++ # Test that the dimensions given in dim are sensible; otherwise+ # display a warning and ignore them+ if dim:+ # See if the dimensions already match, if not, make sure the+ # number items will fit in the specified dimensions+ if field.ndim > 1:+ actual_shape = field.shape[1:]+ if _str:+ actual_shape = actual_shape + (field.itemsize,)+ else:+ actual_shape = field.shape[0]++ if dim == actual_shape:+ # The array already has the correct dimensions, so we+ # ignore dim and don't convert+ dim = None+ else:+ nitems = reduce(operator.mul, dim)+ if _str:+ actual_nitems = field.itemsize+ elif len(field.shape) == 1: # No repeat count in TFORMn, equivalent to 1+ actual_nitems = 1+ else:+ actual_nitems = field.shape[1]+ if nitems > actual_nitems:+ warnings.warn(+ 'TDIM{} value {:d} does not fit with the size of '+ 'the array items ({:d}). TDIM{:d} will be ignored.'+ .format(indx + 1, self._coldefs[indx].dims,+ actual_nitems, indx + 1))+ dim = None++ # further conversion for both ASCII and binary tables+ # For now we've made columns responsible for *knowing* whether their+ # data has been scaled, but we make the FITS_rec class responsible for+ # actually doing the scaling+ # TODO: This also needs to be fixed in the effort to make Columns+ # responsible for scaling their arrays to/from FITS native values+ if not column.ascii and column.format.p_format:+ format_code = column.format.p_format+ else:+ # TODO: Rather than having this if/else it might be nice if the+ # ColumnFormat class had an attribute guaranteed to give the format+ # of actual values in a column regardless of whether the true+ # format is something like P or Q+ format_code = column.format.format++ if (_number and (_scale or _zero) and not column._physical_values):+ # This is to handle pseudo unsigned ints in table columns+ # TODO: For now this only really works correctly for binary tables+ # Should it work for ASCII tables as well?+ if self._uint:+ if bzero == 2**15 and format_code == 'I':+ field = np.array(field, dtype=np.uint16)+ elif bzero == 2**31 and format_code == 'J':+ field = np.array(field, dtype=np.uint32)+ elif bzero == 2**63 and format_code == 'K':+ field = np.array(field, dtype=np.uint64)+ bzero64 = np.uint64(2 ** 63)+ else:+ field = np.array(field, dtype=np.float64)+ else:+ field = np.array(field, dtype=np.float64)++ if _scale:+ np.multiply(field, bscale, field)+ if _zero:+ if self._uint and format_code == 'K':+ # There is a chance of overflow, so be careful+ test_overflow = field.copy()+ try:+ test_overflow += bzero64+ except OverflowError:+ warnings.warn(+ "Overflow detected while applying TZERO{0:d}. "+ "Returning unscaled data.".format(indx + 1))+ else:+ field = test_overflow+ else:+ field += bzero+ elif _bool and field.dtype != bool:+ field = np.equal(field, ord('T'))+ elif _str:+ if not self._character_as_bytes:+ with suppress(UnicodeDecodeError):+ field = decode_ascii(field)++ if dim:+ # Apply the new field item dimensions+ nitems = reduce(operator.mul, dim)+ if field.ndim > 1:+ field = field[:, :nitems]+ if _str:+ fmt = field.dtype.char+ dtype = ('|{}{}'.format(fmt, dim[-1]), dim[:-1])+ field.dtype = dtype+ else:+ field.shape = (field.shape[0],) + dim++ return field++ def _get_heap_data(self):+ """+ Returns a pointer into the table's raw data to its heap (if present).++ This is returned as a numpy byte array.+ """++ if self._heapsize:+ raw_data = self._get_raw_data().view(np.ubyte)+ heap_end = self._heapoffset + self._heapsize+ return raw_data[self._heapoffset:heap_end]+ else:+ return np.array([], dtype=np.ubyte)++ def _get_raw_data(self):+ """+ Returns the base array of self that "raw data array" that is the+ array in the format that it was first read from a file before it was+ sliced or viewed as a different type in any way.++ This is determined by walking through the bases until finding one that+ has at least the same number of bytes as self, plus the heapsize. This+ may be the immediate .base but is not always. This is used primarily+ for variable-length array support which needs to be able to find the+ heap (the raw data *may* be larger than nbytes + heapsize if it+ contains a gap or padding).++ May return ``None`` if no array resembling the "raw data" according to+ the stated criteria can be found.+ """++ raw_data_bytes = self.nbytes + self._heapsize+ base = self+ while hasattr(base, 'base') and base.base is not None:+ base = base.base+ if hasattr(base, 'nbytes') and base.nbytes >= raw_data_bytes:+ return base++ def _get_scale_factors(self, column):+ """Get all the scaling flags and factors for one column."""++ # TODO: Maybe this should be a method/property on Column? Or maybe+ # it's not really needed at all...+ _str = column.format.format == 'A'+ _bool = column.format.format == 'L'++ _number = not (_bool or _str)+ bscale = column.bscale+ bzero = column.bzero++ _scale = bscale not in ('', None, 1)+ _zero = bzero not in ('', None, 0)++ # ensure bscale/bzero are numbers+ if not _scale:+ bscale = 1+ if not _zero:+ bzero = 0++ # column._dims gives a tuple, rather than column.dim which returns the+ # original string format code from the FITS header...+ dim = column._dims++ return (_str, _bool, _number, _scale, _zero, bscale, bzero, dim)++ def _scale_back(self, update_heap_pointers=True):+ """+ Update the parent array, using the (latest) scaled array.++ If ``update_heap_pointers`` is `False`, this will leave all the heap+ pointers in P/Q columns as they are verbatim--it only makes sense to do+ this if there is already data on the heap and it can be guaranteed that+ that data has not been modified, and there is not new data to add to+ the heap. Currently this is only used as an optimization for+ CompImageHDU that does its own handling of the heap.+ """++ # Running total for the new heap size+ heapsize = 0++ for indx, name in enumerate(self.dtype.names):+ column = self._coldefs[indx]+ recformat = column.format.recformat+ raw_field = _get_recarray_field(self, indx)++ # add the location offset of the heap area for each+ # variable length column+ if isinstance(recformat, _FormatP):+ # Irritatingly, this can return a different dtype than just+ # doing np.dtype(recformat.dtype); but this returns the results+ # that we want. For example if recformat.dtype is 'a' we want+ # an array of characters.+ dtype = np.array([], dtype=recformat.dtype).dtype++ if update_heap_pointers and name in self._converted:+ # The VLA has potentially been updated, so we need to+ # update the array descriptors+ raw_field[:] = 0 # reset+ npts = [len(arr) for arr in self._converted[name]]++ raw_field[:len(npts), 0] = npts+ raw_field[1:, 1] = (np.add.accumulate(raw_field[:-1, 0]) *+ dtype.itemsize)+ raw_field[:, 1][:] += heapsize++ heapsize += raw_field[:, 0].sum() * dtype.itemsize+ # Even if this VLA has not been read or updated, we need to+ # include the size of its constituent arrays in the heap size+ # total++ if isinstance(recformat, _FormatX) and name in self._converted:+ _wrapx(self._converted[name], raw_field, recformat.repeat)+ continue++ _str, _bool, _number, _scale, _zero, bscale, bzero, _ = \+ self._get_scale_factors(column)++ field = self._converted.get(name, raw_field)++ # conversion for both ASCII and binary tables+ if _number or _str:+ if _number and (_scale or _zero) and column._physical_values:+ dummy = field.copy()+ if _zero:+ dummy -= bzero+ if _scale:+ dummy /= bscale+ # This will set the raw values in the recarray back to+ # their non-physical storage values, so the column should+ # be mark is not scaled+ column._physical_values = False+ elif _str or isinstance(self._coldefs, _AsciiColDefs):+ dummy = field+ else:+ continue++ # ASCII table, convert numbers to strings+ if isinstance(self._coldefs, _AsciiColDefs):+ self._scale_back_ascii(indx, dummy, raw_field)+ # binary table string column+ elif isinstance(raw_field, chararray.chararray):+ self._scale_back_strings(indx, dummy, raw_field)+ # all other binary table columns+ else:+ if len(raw_field) and isinstance(raw_field[0],+ np.integer):+ dummy = np.around(dummy)++ if raw_field.shape == dummy.shape:+ raw_field[:] = dummy+ else:+ # Reshaping the data is necessary in cases where the+ # TDIMn keyword was used to shape a column's entries+ # into arrays+ raw_field[:] = dummy.ravel().view(raw_field.dtype)++ del dummy++ # ASCII table does not have Boolean type+ elif _bool and name in self._converted:+ choices = (np.array([ord('F')], dtype=np.int8)[0],+ np.array([ord('T')], dtype=np.int8)[0])+ raw_field[:] = np.choose(field, choices)++ # Store the updated heapsize+ self._heapsize = heapsize++ def _scale_back_strings(self, col_idx, input_field, output_field):+ # There are a few possibilities this has to be able to handle properly+ # The input_field, which comes from the _converted column is of dtype+ # 'Un' so that elements read out of the array are normal str+ # objects (i.e. unicode strings)+ #+ # At the other end the *output_field* may also be of type 'S' or of+ # type 'U'. It will *usually* be of type 'S' because when reading+ # an existing FITS table the raw data is just ASCII strings, and+ # represented in Numpy as an S array. However, when a user creates+ # a new table from scratch, they *might* pass in a column containing+ # unicode strings (dtype 'U'). Therefore the output_field of the+ # raw array is actually a unicode array. But we still want to make+ # sure the data is encodable as ASCII. Later when we write out the+ # array we use, in the dtype 'U' case, a different write routine+ # that writes row by row and encodes any 'U' columns to ASCII.++ # If the output_field is non-ASCII we will worry about ASCII encoding+ # later when writing; otherwise we can do it right here+ if input_field.dtype.kind == 'U' and output_field.dtype.kind == 'S':+ try:+ _ascii_encode(input_field, out=output_field)+ except _UnicodeArrayEncodeError as exc:+ raise ValueError(+ "Could not save column '{0}': Contains characters that "+ "cannot be encoded as ASCII as required by FITS, starting "+ "at the index {1!r} of the column, and the index {2} of "+ "the string at that location.".format(+ self._coldefs[col_idx].name,+ exc.index[0] if len(exc.index) == 1 else exc.index,+ exc.start))+ else:+ # Otherwise go ahead and do a direct copy into--if both are type+ # 'U' we'll handle encoding later+ input_field = input_field.flatten().view(output_field.dtype)+ output_field.flat[:] = input_field++ # Ensure that blanks at the end of each string are+ # converted to nulls instead of spaces, see Trac #15+ # and #111+ _rstrip_inplace(output_field)++ def _scale_back_ascii(self, col_idx, input_field, output_field):+ """+ Convert internal array values back to ASCII table representation.++ The ``input_field`` is the internal representation of the values, and+ the ``output_field`` is the character array representing the ASCII+ output that will be written.+ """++ starts = self._coldefs.starts[:]+ spans = self._coldefs.spans+ format = self._coldefs[col_idx].format++ # The the index of the "end" column of the record, beyond+ # which we can't write+ end = super().field(-1).itemsize+ starts.append(end + starts[-1])++ if col_idx > 0:+ lead = starts[col_idx] - starts[col_idx - 1] - spans[col_idx - 1]+ else:+ lead = 0++ if lead < 0:+ warnings.warn('Column {!r} starting point overlaps the previous '+ 'column.'.format(col_idx + 1))++ trail = starts[col_idx + 1] - starts[col_idx] - spans[col_idx]++ if trail < 0:+ warnings.warn('Column {!r} ending point overlaps the next '+ 'column.'.format(col_idx + 1))++ # TODO: It would be nice if these string column formatting+ # details were left to a specialized class, as is the case+ # with FormatX and FormatP+ if 'A' in format:+ _pc = '{:'+ else:+ _pc = '{:>'++ fmt = ''.join([_pc, format[1:], ASCII2STR[format[0]], '}',+ (' ' * trail)])++ # Even if the format precision is 0, we should output a decimal point+ # as long as there is space to do so--not including a decimal point in+ # a float value is discouraged by the FITS Standard+ trailing_decimal = (format.precision == 0 and+ format.format in ('F', 'E', 'D'))++ # not using numarray.strings's num2char because the+ # result is not allowed to expand (as C/Python does).+ for jdx, value in enumerate(input_field):+ value = fmt.format(value)+ if len(value) > starts[col_idx + 1] - starts[col_idx]:+ raise ValueError(+ "Value {!r} does not fit into the output's itemsize of "+ "{}.".format(value, spans[col_idx]))++ if trailing_decimal and value[0] == ' ':+ # We have some extra space in the field for the trailing+ # decimal point+ value = value[1:] + '.'++ output_field[jdx] = value++ # Replace exponent separator in floating point numbers+ if 'D' in format:+ output_field.replace(encode_ascii('E'), encode_ascii('D'))+++def _get_recarray_field(array, key):+ """+ Compatibility function for using the recarray base class's field method.+ This incorporates the legacy functionality of returning string arrays as+ Numeric-style chararray objects.+ """++ # Numpy >= 1.10.dev recarray no longer returns chararrays for strings+ # This is currently needed for backwards-compatibility and for+ # automatic truncation of trailing whitespace+ field = np.recarray.field(array, key)+ if (field.dtype.char in ('S', 'U') and+ not isinstance(field, chararray.chararray)):+ field = field.view(chararray.chararray)+ return field+++class _UnicodeArrayEncodeError(UnicodeEncodeError):+ def __init__(self, encoding, object_, start, end, reason, index):+ super().__init__(encoding, object_, start, end, reason)+ self.index = index+++def _ascii_encode(inarray, out=None):+ """+ Takes a unicode array and fills the output string array with the ASCII+ encodings (if possible) of the elements of the input array. The two arrays+ must be the same size (though not necessarily the same shape).++ This is like an inplace version of `np.char.encode` though simpler since+ it's only limited to ASCII, and hence the size of each character is+ guaranteed to be 1 byte.++ If any strings are non-ASCII an UnicodeArrayEncodeError is raised--this is+ just a `UnicodeEncodeError` with an additional attribute for the index of+ the item that couldn't be encoded.+ """++ out_dtype = np.dtype(('S{0}'.format(inarray.dtype.itemsize // 4),+ inarray.dtype.shape))+ if out is not None:+ out = out.view(out_dtype)++ op_dtypes = [inarray.dtype, out_dtype]+ op_flags = [['readonly'], ['writeonly', 'allocate']]+ it = np.nditer([inarray, out], op_dtypes=op_dtypes,+ op_flags=op_flags, flags=['zerosize_ok'])++ try:+ for initem, outitem in it:+ outitem[...] = initem.item().encode('ascii')+ except UnicodeEncodeError as exc:+ index = np.unravel_index(it.iterindex, inarray.shape)+ raise _UnicodeArrayEncodeError(*(exc.args + (index,)))++ return it.operands[1]+++def _has_unicode_fields(array):+ """+ Returns True if any fields in a structured array have Unicode dtype.+ """++ dtypes = (d[0] for d in array.dtype.fields.values())+ return any(d.kind == 'U' for d in dtypes)diff --git a/astropy/io/fits/fitsrec.py b/astropy/io/fits/fitsrec.pyindex 574b4073b1..cb79142dce 100644--- a/astropy/io/fits/fitsrec.py+++ b/astropy/io/fits/fitsrec.py@@ -1261,7 +1261,7 @@ class FITS_rec(np.recarray): # Replace exponent separator in floating point numbers if 'D' in format:- output_field.replace(encode_ascii('E'), encode_ascii('D'))+ output_field = output_field.replace(encode_ascii('E'), encode_ascii('D')) def _get_recarray_field(array, key):1234567891011121314151617181920212223242526272829303132333435363738394041{ "astropy__astropy-6938": { "patch_is_None": false, "patch_exists": true, "patch_successfully_applied": true, "resolved": false, "tests_status": { "FAIL_TO_PASS": { "success": [], "failure": [ "astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_ascii_table_data", "astropy/io/fits/tests/test_table.py::TestTableFunctions::test_ascii_table" ] }, "PASS_TO_PASS": { "success": [ "astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_sample_file", "astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_image_create", "astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_scaled_data", "astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_scaled_data_auto_rescale", "astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_uint16_data", "astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_groups_hdu_data", "astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_open_with_no_keywords", "astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_writeto_convenience", "astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_hdu_writeto", "astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_datasum_only", "astropy/io/fits/tests/test_table.py::test_regression_scalar_indexing" ], "failure": [] }, "FAIL_TO_FAIL": { "success": [], "failure": [] }, "PASS_TO_FAIL": { "success": [], "failure": [] } } }}123version https://git-lfs.github.com/spec/v1oid sha256:45b5d2d228e57d63fbeb186b7f2869a22baf20f8e5b91569c447c551d38ff67csize 4771123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647+ source /opt/miniconda3/bin/activate++ _CONDA_ROOT=/opt/miniconda3++ . /opt/miniconda3/etc/profile.d/conda.sh+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ '[' -z '' ']'+++ export CONDA_SHLVL=0+++ CONDA_SHLVL=0+++ '[' -n '' ']'+++++ dirname /opt/miniconda3/bin/conda++++ dirname /opt/miniconda3/bin+++ PATH=/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export PATH+++ '[' -z '' ']'+++ PS1=++ conda activate++ local cmd=activate++ case "$cmd" in++ __conda_activate activate++ '[' -n '' ']'++ local ask_conda+++ PS1=+++ __conda_exe shell.posix activate+++ /opt/miniconda3/bin/conda shell.posix activate++ ask_conda='PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''1'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ eval 'PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''1'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+++ PS1='(base) '+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export CONDA_PREFIX=/opt/miniconda3+++ CONDA_PREFIX=/opt/miniconda3+++ export CONDA_SHLVL=1+++ CONDA_SHLVL=1+++ export CONDA_DEFAULT_ENV=base+++ CONDA_DEFAULT_ENV=base+++ export 'CONDA_PROMPT_MODIFIER=(base) '+++ CONDA_PROMPT_MODIFIER='(base) '+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ __conda_hashr++ '[' -n '' ']'++ '[' -n '' ']'++ hash -r+ conda activate testbed+ local cmd=activate+ case "$cmd" in+ __conda_activate activate testbed+ '[' -n '' ']'+ local ask_conda++ PS1='(base) '++ __conda_exe shell.posix activate testbed++ /opt/miniconda3/bin/conda shell.posix activate testbed+ ask_conda='PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''2'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_1='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+ eval 'PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''2'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_1='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ PS1='(testbed) '++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed++ CONDA_PREFIX=/opt/miniconda3/envs/testbed++ export CONDA_SHLVL=2++ CONDA_SHLVL=2++ export CONDA_DEFAULT_ENV=testbed++ CONDA_DEFAULT_ENV=testbed++ export 'CONDA_PROMPT_MODIFIER=(testbed) '++ CONDA_PROMPT_MODIFIER='(testbed) '++ export CONDA_PREFIX_1=/opt/miniconda3++ CONDA_PREFIX_1=/opt/miniconda3++ export CONDA_EXE=/opt/miniconda3/bin/conda++ CONDA_EXE=/opt/miniconda3/bin/conda++ export _CE_M=++ _CE_M=++ export _CE_CONDA=++ _CE_CONDA=++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+ __conda_hashr+ '[' -n '' ']'+ '[' -n '' ']'+ hash -r+ cd /testbed+ git config --global --add safe.directory /testbed+ cd /testbed+ git statusOn branch mainChanges not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: astropy/io/fits/fitsrec.py
Untracked files: (use "git add <file>..." to include in what will be committed) astropy/io/fits/.backup.fitsrec.py
no changes added to commit (use "git add" and/or "git commit -a")+ git showcommit c76af9ed6bb89bfba45b9f5bc1e635188278e2faMerge: 9126c929c7 15581fa87fAuthor: Pey Lian Lim <lim@stsci.edu>Date: Thu Dec 21 17:09:47 2017 -0500
Merge pull request #6981 from mhvk/iers-b-for-3.0 Update IERS-B table to Dec 2017.
diff --cc astropy/utils/iers/tests/test_iers.pyindex cb87ca3b69,3adb7fc4d1..0cddea7377--- a/astropy/utils/iers/tests/test_iers.py+++ b/astropy/utils/iers/tests/test_iers.py@@@ -121,23 -113,8 +122,23 @@@ class TestIERS_AExcerpt() # match to double precision accuracy. assert_quantity_allclose(ut1_utc, [-0.4916557, -0.4925323, -0.4934373] * u.s,- atol=1.*u.ns)+ atol=0.1*u.ms) + + dcip_x,dcip_y, status = iers_tab.dcip_xy(t, return_status=True) + assert status[0] == iers.FROM_IERS_B + assert np.all(status[1:] == iers.FROM_IERS_A) + # These values are *exactly* as given in the table, so they should + # match to double precision accuracy. + print(dcip_x) + print(dcip_y) + assert_quantity_allclose(dcip_x, + [-0.086, -0.093, -0.087] * u.marcsec, + atol=1.*u.narcsec) + assert_quantity_allclose(dcip_y, + [0.094, 0.081, 0.072] * u.marcsec, + atol=1*u.narcsec) + pm_x, pm_y, status = iers_tab.pm_xy(t, return_status=True) assert status[0] == iers.FROM_IERS_B assert np.all(status[1:] == iers.FROM_IERS_A)+ git diff c76af9ed6bb89bfba45b9f5bc1e635188278e2fadiff --git a/astropy/io/fits/fitsrec.py b/astropy/io/fits/fitsrec.pyindex 574b4073b1..cb79142dce 100644--- a/astropy/io/fits/fitsrec.py+++ b/astropy/io/fits/fitsrec.py@@ -1261,7 +1261,7 @@ class FITS_rec(np.recarray): # Replace exponent separator in floating point numbers if 'D' in format:- output_field.replace(encode_ascii('E'), encode_ascii('D'))+ output_field = output_field.replace(encode_ascii('E'), encode_ascii('D')) def _get_recarray_field(array, key):+ source /opt/miniconda3/bin/activate++ _CONDA_ROOT=/opt/miniconda3++ . /opt/miniconda3/etc/profile.d/conda.sh+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ '[' -z x ']'++ conda activate++ local cmd=activate++ case "$cmd" in++ __conda_activate activate++ '[' -n '' ']'++ local ask_conda+++ PS1='(testbed) '+++ __conda_exe shell.posix activate+++ /opt/miniconda3/bin/conda shell.posix activate++ ask_conda='PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''3'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ eval 'PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''3'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+++ PS1='(base) '+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export CONDA_PREFIX=/opt/miniconda3+++ CONDA_PREFIX=/opt/miniconda3+++ export CONDA_SHLVL=3+++ CONDA_SHLVL=3+++ export CONDA_DEFAULT_ENV=base+++ CONDA_DEFAULT_ENV=base+++ export 'CONDA_PROMPT_MODIFIER=(base) '+++ CONDA_PROMPT_MODIFIER='(base) '+++ export CONDA_PREFIX_2=/opt/miniconda3/envs/testbed+++ CONDA_PREFIX_2=/opt/miniconda3/envs/testbed+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ __conda_hashr++ '[' -n '' ']'++ '[' -n '' ']'++ hash -r+ conda activate testbed+ local cmd=activate+ case "$cmd" in+ __conda_activate activate testbed+ '[' -n '' ']'+ local ask_conda++ PS1='(base) '++ __conda_exe shell.posix activate testbed++ /opt/miniconda3/bin/conda shell.posix activate testbed+ ask_conda='PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''4'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_3='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+ eval 'PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''4'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_3='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ PS1='(testbed) '++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed++ CONDA_PREFIX=/opt/miniconda3/envs/testbed++ export CONDA_SHLVL=4++ CONDA_SHLVL=4++ export CONDA_DEFAULT_ENV=testbed++ CONDA_DEFAULT_ENV=testbed++ export 'CONDA_PROMPT_MODIFIER=(testbed) '++ CONDA_PROMPT_MODIFIER='(testbed) '++ export CONDA_PREFIX_3=/opt/miniconda3++ CONDA_PREFIX_3=/opt/miniconda3++ export CONDA_EXE=/opt/miniconda3/bin/conda++ CONDA_EXE=/opt/miniconda3/bin/conda++ export _CE_M=++ _CE_M=++ export _CE_CONDA=++ _CE_CONDA=++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+ __conda_hashr+ '[' -n '' ']'+ '[' -n '' ']'+ hash -r+ python -m pip install -e '.[test]' --verboseUsing pip 21.2.2 from /opt/miniconda3/envs/testbed/lib/python3.6/site-packages/pip (python 3.6)Obtaining file:///testbed Running command python setup.py egg_info running egg_info creating /tmp/pip-pip-egg-info-f1pl_t8n/astropy.egg-info writing /tmp/pip-pip-egg-info-f1pl_t8n/astropy.egg-info/PKG-INFO writing dependency_links to /tmp/pip-pip-egg-info-f1pl_t8n/astropy.egg-info/dependency_links.txt writing entry points to /tmp/pip-pip-egg-info-f1pl_t8n/astropy.egg-info/entry_points.txt writing requirements to /tmp/pip-pip-egg-info-f1pl_t8n/astropy.egg-info/requires.txt writing top-level names to /tmp/pip-pip-egg-info-f1pl_t8n/astropy.egg-info/top_level.txt writing manifest file '/tmp/pip-pip-egg-info-f1pl_t8n/astropy.egg-info/SOURCES.txt' reading manifest file '/tmp/pip-pip-egg-info-f1pl_t8n/astropy.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'astropy/utils/misc/data/.hidden_file.txt' warning: no files found matching '*' under directory 'scripts' warning: no files found matching '*' under directory 'astropy/sphinx/themes' no previously-included directories found matching 'docs/_build' no previously-included directories found matching 'build' warning: no files found matching '*.pyx' under directory 'astropy_helpers/astropy_helpers' warning: no files found matching '*.h' under directory 'astropy_helpers/astropy_helpers' no previously-included directories found matching 'astropy_helpers/build' warning: no previously-included files matching '*.o' found anywhere in distribution writing manifest file '/tmp/pip-pip-egg-info-f1pl_t8n/astropy.egg-info/SOURCES.txt'Requirement already satisfied: numpy>=1.10.0 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from astropy==3.0.dev20979) (1.16.0)Requirement already satisfied: pytest-astropy in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from astropy==3.0.dev20979) (0.2.1)Requirement already satisfied: pytest-openfiles>=0.2.0 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest-astropy->astropy==3.0.dev20979) (0.2.0)Requirement already satisfied: pytest-remotedata>=0.2.0 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest-astropy->astropy==3.0.dev20979) (0.2.0)Requirement already satisfied: pytest>=3.1.0 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest-astropy->astropy==3.0.dev20979) (3.3.1)Requirement already satisfied: pytest-arraydiff in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest-astropy->astropy==3.0.dev20979) (0.1)Requirement already satisfied: pytest-doctestplus>=0.1.2 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest-astropy->astropy==3.0.dev20979) (0.1.2)Requirement already satisfied: six>=1.10.0 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest>=3.1.0->pytest-astropy->astropy==3.0.dev20979) (1.16.0)Requirement already satisfied: pluggy<0.7,>=0.5 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest>=3.1.0->pytest-astropy->astropy==3.0.dev20979) (0.6.0)Requirement already satisfied: setuptools in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest>=3.1.0->pytest-astropy->astropy==3.0.dev20979) (38.2.4)Requirement already satisfied: attrs>=17.2.0 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest>=3.1.0->pytest-astropy->astropy==3.0.dev20979) (17.3.0)Requirement already satisfied: py>=1.5.0 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest>=3.1.0->pytest-astropy->astropy==3.0.dev20979) (1.11.0)Requirement already satisfied: psutil in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest-openfiles>=0.2.0->pytest-astropy->astropy==3.0.dev20979) (5.4.2)Installing collected packages: astropy Attempting uninstall: astropy Found existing installation: astropy 3.0.dev20979 Uninstalling astropy-3.0.dev20979: Removing file or directory /opt/miniconda3/envs/testbed/bin/fits2bitmap Removing file or directory /opt/miniconda3/envs/testbed/bin/fitscheck Removing file or directory /opt/miniconda3/envs/testbed/bin/fitsdiff Removing file or directory /opt/miniconda3/envs/testbed/bin/fitsheader Removing file or directory /opt/miniconda3/envs/testbed/bin/fitsinfo Removing file or directory /opt/miniconda3/envs/testbed/bin/samp_hub Removing file or directory /opt/miniconda3/envs/testbed/bin/showtable Removing file or directory /opt/miniconda3/envs/testbed/bin/volint Removing file or directory /opt/miniconda3/envs/testbed/bin/wcslint Removing file or directory /opt/miniconda3/envs/testbed/lib/python3.6/site-packages/astropy.egg-link Removing pth entries from /opt/miniconda3/envs/testbed/lib/python3.6/site-packages/easy-install.pth: Removing entry: /testbed Successfully uninstalled astropy-3.0.dev20979 Running setup.py develop for astropy Running command /opt/miniconda3/envs/testbed/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/testbed/setup.py'"'"'; __file__='"'"'/testbed/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps running develop running egg_info writing astropy.egg-info/PKG-INFO writing dependency_links to astropy.egg-info/dependency_links.txt writing entry points to astropy.egg-info/entry_points.txt writing requirements to astropy.egg-info/requires.txt writing top-level names to astropy.egg-info/top_level.txt reading manifest file 'astropy.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'astropy/utils/misc/data/.hidden_file.txt' warning: no files found matching '*' under directory 'scripts' warning: no files found matching '*' under directory 'astropy/sphinx/themes' no previously-included directories found matching 'docs/_build' no previously-included directories found matching 'build' warning: no files found matching '*.pyx' under directory 'astropy_helpers/astropy_helpers' warning: no files found matching '*.h' under directory 'astropy_helpers/astropy_helpers' no previously-included directories found matching 'astropy_helpers/build' warning: no previously-included files matching '*.o' found anywhere in distribution writing manifest file 'astropy.egg-info/SOURCES.txt' running build_ext running pre_hook from astropy._erfa.setup_package for build_ext command running pre_hook from astropy.modeling.setup_package for build_ext command building 'astropy._compiler' extension gcc -pthread -B /opt/miniconda3/envs/testbed/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/miniconda3/envs/testbed/include/python3.6m -c astropy/_compiler.c -o build/temp.linux-x86_64-3.6/astropy/_compiler.o gcc -pthread -shared -B /opt/miniconda3/envs/testbed/compiler_compat -L/opt/miniconda3/envs/testbed/lib -Wl,-rpath=/opt/miniconda3/envs/testbed/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/astropy/_compiler.o -o /testbed/astropy/_compiler.cpython-36m-x86_64-linux-gnu.so skipping 'astropy/table/_np_utils.c' Cython extension (up-to-date) skipping 'astropy/table/_column_mixins.c' Cython extension (up-to-date) skipping 'astropy/io/ascii/cparser.c' Cython extension (up-to-date) skipping 'astropy/convolution/boundary_none.c' Cython extension (up-to-date) skipping 'astropy/convolution/boundary_fill.c' Cython extension (up-to-date) skipping 'astropy/convolution/boundary_wrap.c' Cython extension (up-to-date) skipping 'astropy/convolution/boundary_extend.c' Cython extension (up-to-date) skipping 'astropy/cosmology/scalar_inv_efuncs.c' Cython extension (up-to-date) skipping 'astropy/stats/lombscargle/implementations/cython_impl.c' Cython extension (up-to-date) Creating /opt/miniconda3/envs/testbed/lib/python3.6/site-packages/astropy.egg-link (link to .) Adding astropy 3.0.dev20979 to easy-install.pth file Installing fits2bitmap script to /opt/miniconda3/envs/testbed/bin Installing fitscheck script to /opt/miniconda3/envs/testbed/bin Installing fitsdiff script to /opt/miniconda3/envs/testbed/bin Installing fitsheader script to /opt/miniconda3/envs/testbed/bin Installing fitsinfo script to /opt/miniconda3/envs/testbed/bin Installing samp_hub script to /opt/miniconda3/envs/testbed/bin Installing showtable script to /opt/miniconda3/envs/testbed/bin Installing volint script to /opt/miniconda3/envs/testbed/bin Installing wcslint script to /opt/miniconda3/envs/testbed/bin
Installed /testbedSuccessfully installed astropy-3.0.dev20979WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/9f/8b/a094f5da22d7abf5098205367b3296dd15b914f4232af5ca39ba6214d08c/pip-22.0-py3-none-any.whl#sha256=6cb1ea2bd7fda0668e26ae8c3e45188f301a7ef17ff22efe1f70f3643e56a822 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/4a/ca/e72b3b399d7a8cb34311aa8f52924108591c013b09f0268820afb4cd96fb/pip-22.0.tar.gz#sha256=d3fa5c3e42b33de52bddce89de40268c9a263cd6ef7c94c40774808dafb32c82 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/89/a1/2f4e58eda11e591fbfa518233378835679fc5ab766b690b3df85215014d5/pip-22.0.1-py3-none-any.whl#sha256=30739ac5fb973cfa4399b0afff0523d4fe6bed2f7a5229333f64d9c2ce0d1933 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/63/71/5686e51f06fa59da55f7e81c3101844e57434a30f4a0d7456674d1459841/pip-22.0.1.tar.gz#sha256=7fd7a92f2fb1d2ac2ae8c72fb10b1e640560a0361ed4427453509e2bcc18605b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/83/b5/df8640236faa5a3cb80bfafd68e9fb4b22578208b8398c032ccff803f9e0/pip-22.0.2-py3-none-any.whl#sha256=682eabc4716bfce606aca8dab488e9c7b58b0737e9001004eb858cdafcd8dbdd (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/d9/c1/146b24a7648fdf3f8b4dc6521ab0b26ac151ef903bac0b63a4e1450cb4d1/pip-22.0.2.tar.gz#sha256=27b4b70c34ec35f77947f777070d8331adbb1e444842e98e7150c288dc0caea4 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/6a/df/a6ef77a6574781a668791419ffe366c8acd1c3cf4709d210cb53cd5ce1c2/pip-22.0.3-py3-none-any.whl#sha256=c146f331f0805c77017c6bb9740cec4a49a0d4582d0c3cc8244b057f83eca359 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/88/d9/761f0b1e0551a3559afe4d34bd9bf68fc8de3292363b3775dda39b62ce84/pip-22.0.3.tar.gz#sha256=f29d589df8c8ab99c060e68ad294c4a9ed896624f6368c5349d70aa581b333d0 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/4d/16/0a14ca596f30316efd412a60bdfac02a7259bf8673d4d917dc60b9a21812/pip-22.0.4-py3-none-any.whl#sha256=c6aca0f2f081363f689f041d90dab2a07a9a07fb840284db2218117a52da800b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/33/c9/e2164122d365d8f823213a53970fa3005eb16218edcfc56ca24cb6deba2b/pip-22.0.4.tar.gz#sha256=b3a9de2c6ef801e9247d1527a4b16f92f2cc141cd1489f3fffaf6a9e96729764 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/79/3a/d341ae105c8b49eac912bee40739d496ae80f9441efa7df6c68f4997bbc8/pip-22.1b1-py3-none-any.whl#sha256=09e9e8f8e10f2515134b59600ad3630219430eabb734336079cbc6ffb2e01a0e (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/a7/c0/794f22836ef3202a7ad61f0872278ee7ac62e8c7617e4c9a08f01b5e82da/pip-22.1b1.tar.gz#sha256=f54ab61985754b56c5589178cfd7dfca5ed9f98d5c8f2de2eecb29f1341200f1 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/f3/77/23152f90de45957b59591c34dcb39b78194eb67d088d4f8799e9aa9726c4/pip-22.1-py3-none-any.whl#sha256=802e797fb741be1c2d475533d4ea951957e4940091422bd4a24848a7ac95609d (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/99/bb/696e256f4f445809f25efd4e4ce42ff99664dc089cafa1e097d5fec7fc33/pip-22.1.tar.gz#sha256=2debf847016cfe643fa1512e2d781d3ca9e5c878ba0652583842d50cc2bcc605 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/9b/e6/aa8149e048eda381f2a433599be9b1f5e5e3a189636cd6cf9614aa2ff5be/pip-22.1.1-py3-none-any.whl#sha256=e7bcf0b2cbdec2af84cc1b7b79b25fdbd7228fbdb61a4dca0b82810d0ba9d18b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/3e/0a/6125e67aa4d3245faeed476e4e26f190b5209f84f01efd733ac6372eb247/pip-22.1.1.tar.gz#sha256=8dfb15d8a1c3d3085a4cbe11f29e19527dfaf2ba99354326fd62cec013eaee81 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/96/2f/caec18213f6a67852f6997fb0673ae08d2e93d1b81573edb93ba4ef06970/pip-22.1.2-py3-none-any.whl#sha256=a3edacb89022ef5258bf61852728bf866632a394da837ca49eb4303635835f17 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/4b/b6/0fa7aa968a9fa4ef63a51b3ff0644e59f49dcd7235b3fd6cceb23f202e08/pip-22.1.2.tar.gz#sha256=6d55b27e10f506312894a87ccc59f280136bad9061719fac9101bdad5a6bce69 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/9b/9e/9e0610f25e65e2cdf90b1ee9c47ca710865401904038558ac0129ea23cbc/pip-22.2-py3-none-any.whl#sha256=9abf423d5d64f3289ab9d5bf31da9e6234f2e9c5d8dcf1423bcb46b809a02c2c (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/cd/b6/cf07132d631444dd7ce0ed199f2327eb34e2418f1675145e5b10e1ee65cd/pip-22.2.tar.gz#sha256=8d63fcd4ee293e30b644827268a0a973d080e5c7425ef26d427f5eb2126c7681 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/84/25/5734a44897751d8bac6822efb819acda2d969bcc1b915bbd7d48102952cb/pip-22.2.1-py3-none-any.whl#sha256=0bbbc87dfbe6eed217beff0021f8b7dea04c8f4a0baa9d31dc4cff281ffc5b2b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/46/28/addd7e66bb3af799d35a5dcbb79407b591a7ed674f4efd2bd8f930c40821/pip-22.2.1.tar.gz#sha256=50516e47a2b79e77446f0d05649f0d53772c192571486236b1905492bfc24bac (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/1f/2c/d9626f045e7b49a6225c6b09257861f24da78f4e5f23af2ddbdf852c99b8/pip-22.2.2-py3-none-any.whl#sha256=b61a374b5bc40a6e982426aede40c9b5a08ff20e640f5b56977f4f91fed1e39a (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/4b/30/e15b806597e67057e07a5acdc135216ccbf76a5f1681a324533b61066b0b/pip-22.2.2.tar.gz#sha256=3fd1929db052f056d7a998439176d3333fa1b3f6c1ad881de1885c0717608a4b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/47/ef/8b5470b5b94b36231ed9c0bde90caa71c0d4322d4a15f009b2b7f4287fe0/pip-22.3-py3-none-any.whl#sha256=1daab4b8d3b97d1d763caeb01a4640a2250a0ea899e257b1e44b9eded91e15ab (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/f8/08/7f92782ff571c7c7cb6c5eeb8ebbb1f68cb02bdb24e55c5de4dd9ce98bc3/pip-22.3.tar.gz#sha256=8182aec21dad6c0a49a2a3d121a87cd524b950e0b6092b181625f07ebdde7530 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/09/bd/2410905c76ee14c62baf69e3f4aa780226c1bbfc9485731ad018e35b0cb5/pip-22.3.1-py3-none-any.whl#sha256=908c78e6bc29b676ede1c4d57981d490cb892eb45cd8c214ab6298125119e077 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/a3/50/c4d2727b99052780aad92c7297465af5fe6eec2dbae490aa9763273ffdc1/pip-22.3.1.tar.gz#sha256=65fd48317359f3af8e593943e6ae1506b66325085ea64b706a998c6e83eeaf38 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/ab/43/508c403c38eeaa5fc86516eb13bb470ce77601b6d2bbcdb16e26328d0a15/pip-23.0-py3-none-any.whl#sha256=b5f88adff801f5ef052bcdef3daa31b55eb67b0fccd6d0106c206fa248e0463c (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/b5/16/5e24bf63cff51dcc169f43bd43b86b005c49941e09cc3482a5b370db239e/pip-23.0.tar.gz#sha256=aee438284e82c8def684b0bcc50b1f6ed5e941af97fa940e83e2e8ef1a59da9b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/07/51/2c0959c5adf988c44d9e1e0d940f5b074516ecc87e96b1af25f59de9ba38/pip-23.0.1-py3-none-any.whl#sha256=236bcb61156d76c4b8a05821b988c7b8c35bf0da28a4b614e8d6ab5212c25c6f (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/6b/8b/0b16094553ecc680e43ded8f920c3873b01b1da79a54274c98f08cb29fca/pip-23.0.1.tar.gz#sha256=cd015ea1bfb0fcef59d8a286c1f8bebcb983f6317719d415dc5351efb7cd7024 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/ae/db/a8821cdac455a1740580c92de3ed7b7f257cfdbad8b1ba8864e6abe58a08/pip-23.1-py3-none-any.whl#sha256=64b1d4528e491aa835ec6ece0c1ac40ce6ab6d886e60740f6519db44b2e9634d (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/da/bf/1bdbe62f5fbde085351693e3a8e387a59f8220932b911b1719fe65efa2d7/pip-23.1.tar.gz#sha256=408539897ee535dbfb83a153f7bc4d620f990d8bd44a52a986efc0b4d330d34a (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/f8/f8/17bd3f7c13515523d811ce4104410c16c03e3c6830f9276612e2f4b28382/pip-23.1.1-py3-none-any.whl#sha256=3d8d72fa0714e93c9d3c2a0ede91e898c64596e0fa7d4523f72dd95728efc418 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/43/7d/1f52f99a7f2eae870483b2c2a3064511487de87911bce146df8a154fbe81/pip-23.1.1.tar.gz#sha256=c95b53d309f903f33dfe5fd37e502a5c3a05ee3454d518e45df522a4f091b728 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/08/e3/57d4c24a050aa0bcca46b2920bff40847db79535dc78141eb83581a52eb8/pip-23.1.2-py3-none-any.whl#sha256=3ef6ac33239e4027d9a5598a381b9d30880a1477e50039db2eac6e8a8f6d1b18 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/fa/ee/74ff76da0ab649eec7581233daeb43d8aa35383d8f75317b2ab3b80c922f/pip-23.1.2.tar.gz#sha256=0e7c86f486935893c708287b30bd050a36ac827ec7fe5e43fe7cb198dd835fba (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/02/65/f15431ddee78562355ccb39097bf9160a1689f2db40dc418754be98806a1/pip-23.2-py3-none-any.whl#sha256=78e5353a9dda374b462f2054f83a7b63f3f065c98236a68361845c1b0ee7e35f (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/3d/ab/21fa8d1ecf5648559f056fda732b0f9fca0585eb2688252e67f70e74deaf/pip-23.2.tar.gz#sha256=a160a170f3331d9ca1a0247eb1cd79c758879f1f81158f9cd05bbb5df80bea5c (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/50/c2/e06851e8cc28dcad7c155f4753da8833ac06a5c704c109313b8d5a62968a/pip-23.2.1-py3-none-any.whl#sha256=7ccf472345f20d35bdc9d1841ff5f313260c2c33fe417f48c30ac46cccabf5be (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/ba/19/e63fb4e0d20e48bd2167bb7e857abc0e21679e24805ba921a224df8977c0/pip-23.2.1.tar.gz#sha256=fb0bd5435b3200c602b5bf61d2d43c2f13c02e29c1707567ae7fbc514eb9faf2 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/e0/63/b428aaca15fcd98c39b07ca7149e24bc14205ad0f1c80ba2b01835aedde1/pip-23.3-py3-none-any.whl#sha256=bc38bb52bc286514f8f7cb3a1ba5ed100b76aaef29b521d48574329331c5ae7b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/0d/f6/07ef4561bb911285c229fa46ed3df1877bd6c5325c4c67d516560d59a6e6/pip-23.3.tar.gz#sha256=bb7d4f69f488432e4e96394612f43ab43dd478d073ef7422604a570f7157561e (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/47/6a/453160888fab7c6a432a6e25f8afe6256d0d9f2cbd25971021da6491d899/pip-23.3.1-py3-none-any.whl#sha256=55eb67bb6171d37447e82213be585b75fe2b12b359e993773aca4de9247a052b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/1f/7f/4da15e07ccd11c84c1ccc8f6e24288d5e76c99441bf80e315b33542db951/pip-23.3.1.tar.gz#sha256=1fcaa041308d01f14575f6d0d2ea4b75a3e2871fe4f9c694976f908768e14174 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/15/aa/3f4c7bcee2057a76562a5b33ecbd199be08cdb4443a02e26bd2c3cf6fc39/pip-23.3.2-py3-none-any.whl#sha256=5052d7889c1f9d05224cd41741acb7c5d6fa735ab34e339624a614eaaa7e7d76 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/b7/06/6b1ad0ae8f97d7a0d6f6ad640db10780578999e647a9593512ceb6f06469/pip-23.3.2.tar.gz#sha256=7fd9972f96db22c8077a1ee2691b172c8089b17a5652a44494a9ecb0d78f9149 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/8a/6a/19e9fe04fca059ccf770861c7d5721ab4c2aebc539889e97c7977528a53b/pip-24.0-py3-none-any.whl#sha256=ba0d021a166865d2265246961bec0152ff124de910c5cc39f1156ce3fa7c69dc (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/94/59/6638090c25e9bc4ce0c42817b5a234e183872a1129735a9330c472cc2056/pip-24.0.tar.gz#sha256=ea9bd1a847e8c5774a5777bb398c19e80bcd4e2aa16a4b301b718fe6f593aba2 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/1e/65/22725f8ba583376d0c300c3b9b52b9a67cfd93d786a80be73c167e45abc8/pip-24.1b1-py3-none-any.whl#sha256=752516cffafef5cf29d3fb2f06c978f27e98709654689cf277b2fce984c7a591 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/71/38/b0cb3d68b4776b6208a2f16b6d444a848a1fe465a78ce4b7dbbeb8a4fc58/pip-24.1b1.tar.gz#sha256=a9bd4c037d72325b4e903ec3f383263deea3eb73cd01db7a844edd026fc68afe (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/c1/64/0f1528ed3dfd75a56e084caab3c8dbed596bf87a1dfc40cbc57166bb0c25/pip-24.1b2-py3-none-any.whl#sha256=7b4ae01a2af4bfae0386860c5a12c035fcc228364ddef89192a1c31d48d263a1 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/0b/b2/1d1eac32a16fd9478fb9bc6eb6b899f91e6fecceba194fa097c35d385e9a/pip-24.1b2.tar.gz#sha256=926201900a0e26929387023907bf395c9a6c0d37bbea176942ca5e1b6b27e815 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/25/49/2255373efd193c6fbd97dc22399e9c830a6517a0f02ca77fbc0bd83ac5cc/pip-24.1-py3-none-any.whl#sha256=a775837439bf5da2c1a0c2fa43d5744854497c689ddbd9344cf3ea6d00598540 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/df/60/7538a9cd4d76829c2f585b73d6e400c833a1769408451c813354c58de6cc/pip-24.1.tar.gz#sha256=bdae551038c0ce6a83030b4aedef27fc95f0daa683593fea22fa05e55ed8e317 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/f4/ab/e3c039b5ddba9335bd8f82d599eb310de1d2a2db0411b8d804d507405c74/pip-24.1.1-py3-none-any.whl#sha256=efca15145a95e95c00608afeab66311d40bfb73bb2266a855befd705e6bb15a0 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/c0/d0/9641dc7b05877874c6418f8034ddefc809495e65caa14d38c7551cd114bb/pip-24.1.1.tar.gz#sha256=5aa64f65e1952733ee0a9a9b1f52496ebdb3f3077cc46f80a16d983b58d1180a (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/e7/54/0c1c068542cee73d8863336e974fc881e608d0170f3af15d0c0f28644531/pip-24.1.2-py3-none-any.whl#sha256=7cd207eed4c60b0f411b444cd1464198fe186671c323b6cd6d433ed80fc9d247 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/12/3d/d899257cace386bebb7bdf8a872d5fe3b935cc6381c3ddb76d3e5d99890d/pip-24.1.2.tar.gz#sha256=e5458a0b89f2755e0ee8c0c77613fe5273e05f337907874d64f13171a898a7ff (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/d4/55/90db48d85f7689ec6f81c0db0622d704306c5284850383c090e6c7195a5c/pip-24.2-py3-none-any.whl#sha256=2cd581cf58ab7fcfca4ce8efa6dcacd0de5bf8d0a3eb9ec927e07405f4d9e2a2 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/4d/87/fb90046e096a03aeab235e139436b3fe804cdd447ed2093b0d70eba3f7f8/pip-24.2.tar.gz#sha256=5b5e490b5e9cb275c879595064adce9ebd31b854e3e803740b72f9ccf34a45b8 (from https://pypi.org/simple/pip/) (requires-python:>=3.8)+ git checkout c76af9ed6bb89bfba45b9f5bc1e635188278e2fa astropy/io/fits/tests/test_checksum.py astropy/io/fits/tests/test_table.pyUpdated 0 paths from 7d1c65ae84+ git apply -v -Checking patch astropy/io/fits/tests/test_checksum.py...Checking patch astropy/io/fits/tests/test_table.py...Applied patch astropy/io/fits/tests/test_checksum.py cleanly.Applied patch astropy/io/fits/tests/test_table.py cleanly.+ pytest -rA -vv -o console_output_style=classic --tb=no astropy/io/fits/tests/test_checksum.py astropy/io/fits/tests/test_table.pyInternet access disabled============================= test session starts ==============================platform linux -- Python 3.6.13, pytest-3.3.1, py-1.11.0, pluggy-0.6.0 -- /opt/miniconda3/envs/testbed/bin/pythoncachedir: .
Running tests with Astropy version 3.0.dev20979.Running tests in astropy/io/fits/tests/test_checksum.py astropy/io/fits/tests/test_table.py.
Date: 2024-09-29T16:35:14
Platform: Linux-6.1.0-23-cloud-amd64-x86_64-with-debian-bookworm-sid
Executable: /opt/miniconda3/envs/testbed/bin/python
Full Python Version: 3.6.13 |Anaconda, Inc.| (default, Jun 4 2021, 14:25:59) [GCC 7.5.0]
encodings: sys: utf-8, locale: ANSI_X3.4-1968, filesystem: asciibyteorder: littlefloat info: dig: 15, mant_dig: 15
Numpy: 1.16.0Scipy: not availableMatplotlib: not availableh5py: not availablePandas: not availableCython: 0.27.3Using Astropy options: remote_data: none.
rootdir: /testbed, inifile: setup.cfgplugins: xdist-1.20.1, remotedata-0.2.0, openfiles-0.2.0, mock-1.6.3, forked-0.2, filter-subpackage-0.1, doctestplus-0.1.2, cov-2.5.1, astropy-header-0.1, arraydiff-0.1, hypothesis-3.44.2collecting ... collected 107 items
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_sample_file PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_image_create PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_scaled_data PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_scaled_data_auto_rescale PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_uint16_data PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_groups_hdu_data PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_binary_table_data PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_variable_length_table_data PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_ascii_table_data FAILEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_compressed_image_data PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_compressed_image_data_int16 PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_compressed_image_data_float32 PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_open_with_no_keywords PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_append PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_writeto_convenience PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_hdu_writeto PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_hdu_writeto_existing PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_datasum_only PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_open_update_mode_preserve_checksum PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_open_update_mode_update_checksum PASSEDastropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_overwrite_invalid PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_constructor_copies_header PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_open PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_binary_table PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_ascii_table FAILEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_endianness PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_column_endianness PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_recarray_to_bintablehdu PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_numpy_ndarray_to_bintablehdu PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_numpy_ndarray_to_bintablehdu_with_unicode PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_new_table_from_recarray PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_new_fitsrec PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_appending_a_column PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_adding_a_column PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_merge_tables PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_modify_column_attributes PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_mask_array PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_slice_a_row PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_fits_record_len PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_add_data_by_rows PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_assign_multiple_rows_to_table PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_verify_data_references PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_new_table_with_ndarray PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_new_table_with_fits_rec PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_bin_table_hdu_constructor PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_constructor_name_arg PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_constructor_ver_arg PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_unicode_colname PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_bin_table_with_logical_array PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_fits_rec_column_access PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_table_with_zero_width_column PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_string_column_padding PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_multi_dimensional_columns PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_bin_table_init_from_string_array_column PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_columns_with_truncating_tdim PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_string_array_round_trip PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_new_table_with_nd_column PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_mismatched_tform_and_tdim PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_tdim_of_size_one PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_slicing PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_array_slicing PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_array_broadcasting PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_array_slicing_readonly PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_dump_load_round_trip PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_dump_load_array_colums PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_load_guess_format PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_attribute_field_shadowing PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_table_from_bool_fields PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_table_from_bool_fields2 PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_bool_column_update PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_missing_tnull PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_blank_field_zero PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_column_array_type_mismatch PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_table_none PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_unncessary_table_load PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_table_from_columns_of_other_table PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_bintable_to_asciitable PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_pickle PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_zero_length_table PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_dim_column_byte_order_mismatch PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_fits_rec_from_existing PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_update_string_column_inplace PASSEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_reference_leak SKIPPEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_reference_leak2 SKIPPEDastropy/io/fits/tests/test_table.py::TestTableFunctions::test_dump_clobber_vs_overwrite PASSEDastropy/io/fits/tests/test_table.py::TestVLATables::test_variable_length_columns PASSEDastropy/io/fits/tests/test_table.py::TestVLATables::test_extend_variable_length_array PASSEDastropy/io/fits/tests/test_table.py::TestVLATables::test_variable_length_table_format_pd_from_object_array PASSEDastropy/io/fits/tests/test_table.py::TestVLATables::test_variable_length_table_format_pd_from_list PASSEDastropy/io/fits/tests/test_table.py::TestVLATables::test_variable_length_table_format_pa_from_object_array PASSEDastropy/io/fits/tests/test_table.py::TestVLATables::test_variable_length_table_format_pa_from_list PASSEDastropy/io/fits/tests/test_table.py::TestVLATables::test_getdata_vla PASSEDastropy/io/fits/tests/test_table.py::TestVLATables::test_copy_vla PASSEDastropy/io/fits/tests/test_table.py::TestColumnFunctions::test_column_format_interpretation PASSEDastropy/io/fits/tests/test_table.py::TestColumnFunctions::test_zero_precision_float_column PASSEDastropy/io/fits/tests/test_table.py::TestColumnFunctions::test_column_array_type_mismatch PASSEDastropy/io/fits/tests/test_table.py::TestColumnFunctions::test_new_coldefs_with_invalid_seqence PASSEDastropy/io/fits/tests/test_table.py::TestColumnFunctions::test_pickle PASSEDastropy/io/fits/tests/test_table.py::TestColumnFunctions::test_column_lookup_by_name PASSEDastropy/io/fits/tests/test_table.py::TestColumnFunctions::test_column_attribute_change_after_removal PASSEDastropy/io/fits/tests/test_table.py::TestColumnFunctions::test_x_column_deepcopy PASSEDastropy/io/fits/tests/test_table.py::TestColumnFunctions::test_p_column_deepcopy PASSEDastropy/io/fits/tests/test_table.py::TestColumnFunctions::test_column_verify_keywords PASSEDastropy/io/fits/tests/test_table.py::TestColumnFunctions::test_column_verify_start PASSEDastropy/io/fits/tests/test_table.py::test_regression_5383 PASSEDastropy/io/fits/tests/test_table.py::test_table_to_hdu PASSEDastropy/io/fits/tests/test_table.py::test_regression_scalar_indexing PASSED
=============================== warnings summary ===============================None Module already imported so cannot be rewritten: astropy.tests.plugins.display
-- Docs: http://doc.pytest.org/en/latest/warnings.html========= 2 failed, 103 passed, 2 skipped, 1 warnings in 3.20 seconds ==========sys:1: ResourceWarning: unclosed file <_io.FileIO name='/testbed/astropy/io/fits/tests/data/ascii.fits' mode='rb' closefd=True>+ git checkout c76af9ed6bb89bfba45b9f5bc1e635188278e2fa astropy/io/fits/tests/test_checksum.py astropy/io/fits/tests/test_table.pyUpdated 2 paths from 7d1c65ae841234567891011121314151617181920212223242526272829303132333435363738394041424344#!/bin/bashset -uxo pipefailsource /opt/miniconda3/bin/activateconda activate testbedcd /testbedgit config --global --add safe.directory /testbedcd /testbedgit statusgit showgit diff d5bd3f68bb6d5ce3a61bdce9883ee750d1afade5source /opt/miniconda3/bin/activateconda activate testbedpython -m pip install -e .[test] --verbosegit checkout d5bd3f68bb6d5ce3a61bdce9883ee750d1afade5 astropy/wcs/tests/test_wcs.pygit apply -v - <<'EOF_114329324912'diff --git a/astropy/wcs/tests/test_wcs.py b/astropy/wcs/tests/test_wcs.py--- a/astropy/wcs/tests/test_wcs.py+++ b/astropy/wcs/tests/test_wcs.py@@ -1093,3 +1093,21 @@ def test_keyedsip(): assert isinstance( w.sip, wcs.Sip ) assert w.sip.crpix[0] == 2048 assert w.sip.crpix[1] == 1026+++def test_zero_size_input():+ with fits.open(get_pkg_data_filename('data/sip.fits')) as f:+ w = wcs.WCS(f[0].header)++ inp = np.zeros((0, 2))+ assert_array_equal(inp, w.all_pix2world(inp, 0))+ assert_array_equal(inp, w.all_world2pix(inp, 0))++ inp = [], [1]+ result = w.all_pix2world([], [1], 0)+ assert_array_equal(inp[0], result[0])+ assert_array_equal(inp[1], result[1])++ result = w.all_world2pix([], [1], 0)+ assert_array_equal(inp[0], result[0])+ assert_array_equal(inp[1], result[1])
EOF_114329324912pytest -rA -vv -o console_output_style=classic --tb=no astropy/wcs/tests/test_wcs.pygit checkout d5bd3f68bb6d5ce3a61bdce9883ee750d1afade5 astropy/wcs/tests/test_wcs.py1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586{ "astropy__astropy-7746": { "patch_is_None": false, "patch_exists": true, "patch_successfully_applied": true, "resolved": false, "tests_status": { "FAIL_TO_PASS": { "success": [], "failure": [ "astropy/wcs/tests/test_wcs.py::test_zero_size_input" ] }, "PASS_TO_PASS": { "success": [ "astropy/wcs/tests/test_wcs.py::TestMaps::test_consistency", "astropy/wcs/tests/test_wcs.py::TestSpectra::test_consistency", "astropy/wcs/tests/test_wcs.py::test_warning_about_defunct_keywords_exception" ], "failure": [ "astropy/wcs/tests/test_wcs.py::TestMaps::test_maps", "astropy/wcs/tests/test_wcs.py::TestSpectra::test_spectra", "astropy/wcs/tests/test_wcs.py::test_fixes", "astropy/wcs/tests/test_wcs.py::test_outside_sky", "astropy/wcs/tests/test_wcs.py::test_pix2world", "astropy/wcs/tests/test_wcs.py::test_load_fits_path", "astropy/wcs/tests/test_wcs.py::test_dict_init", "astropy/wcs/tests/test_wcs.py::test_extra_kwarg", "astropy/wcs/tests/test_wcs.py::test_3d_shapes", "astropy/wcs/tests/test_wcs.py::test_preserve_shape", "astropy/wcs/tests/test_wcs.py::test_broadcasting", "astropy/wcs/tests/test_wcs.py::test_shape_mismatch", "astropy/wcs/tests/test_wcs.py::test_invalid_shape", "astropy/wcs/tests/test_wcs.py::test_warning_about_defunct_keywords", "astropy/wcs/tests/test_wcs.py::test_to_header_string", "astropy/wcs/tests/test_wcs.py::test_to_fits", "astropy/wcs/tests/test_wcs.py::test_to_header_warning", "astropy/wcs/tests/test_wcs.py::test_no_comments_in_header", "astropy/wcs/tests/test_wcs.py::test_find_all_wcs_crash", "astropy/wcs/tests/test_wcs.py::test_validate", "astropy/wcs/tests/test_wcs.py::test_validate_with_2_wcses", "astropy/wcs/tests/test_wcs.py::test_crpix_maps_to_crval", "astropy/wcs/tests/test_wcs.py::test_all_world2pix", "astropy/wcs/tests/test_wcs.py::test_scamp_sip_distortion_parameters", "astropy/wcs/tests/test_wcs.py::test_fixes2", "astropy/wcs/tests/test_wcs.py::test_unit_normalization", "astropy/wcs/tests/test_wcs.py::test_footprint_to_file", "astropy/wcs/tests/test_wcs.py::test_validate_faulty_wcs", "astropy/wcs/tests/test_wcs.py::test_error_message", "astropy/wcs/tests/test_wcs.py::test_out_of_bounds", "astropy/wcs/tests/test_wcs.py::test_calc_footprint_1", "astropy/wcs/tests/test_wcs.py::test_calc_footprint_2", "astropy/wcs/tests/test_wcs.py::test_calc_footprint_3", "astropy/wcs/tests/test_wcs.py::test_sip", "astropy/wcs/tests/test_wcs.py::test_printwcs", "astropy/wcs/tests/test_wcs.py::test_invalid_spherical", "astropy/wcs/tests/test_wcs.py::test_no_iteration", "astropy/wcs/tests/test_wcs.py::test_sip_tpv_agreement", "astropy/wcs/tests/test_wcs.py::test_tpv_copy", "astropy/wcs/tests/test_wcs.py::test_hst_wcs", "astropy/wcs/tests/test_wcs.py::test_list_naxis", "astropy/wcs/tests/test_wcs.py::test_sip_broken", "astropy/wcs/tests/test_wcs.py::test_no_truncate_crval", "astropy/wcs/tests/test_wcs.py::test_no_truncate_crval_try2", "astropy/wcs/tests/test_wcs.py::test_no_truncate_crval_p17", "astropy/wcs/tests/test_wcs.py::test_no_truncate_using_compare", "astropy/wcs/tests/test_wcs.py::test_passing_ImageHDU", "astropy/wcs/tests/test_wcs.py::test_inconsistent_sip", "astropy/wcs/tests/test_wcs.py::test_bounds_check", "astropy/wcs/tests/test_wcs.py::test_naxis", "astropy/wcs/tests/test_wcs.py::test_sip_with_altkey", "astropy/wcs/tests/test_wcs.py::test_to_fits_1", "astropy/wcs/tests/test_wcs.py::test_keyedsip" ] }, "FAIL_TO_FAIL": { "success": [], "failure": [] }, "PASS_TO_FAIL": { "success": [], "failure": [] } } }}123version https://git-lfs.github.com/spec/v1oid sha256:6459b0df012d92d88c46c3e0bc6fd86e858bcf84d7e106489d09fda974bda601size 7284123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581+ source /opt/miniconda3/bin/activate++ _CONDA_ROOT=/opt/miniconda3++ . /opt/miniconda3/etc/profile.d/conda.sh+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ '[' -z '' ']'+++ export CONDA_SHLVL=0+++ CONDA_SHLVL=0+++ '[' -n '' ']'+++++ dirname /opt/miniconda3/bin/conda++++ dirname /opt/miniconda3/bin+++ PATH=/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export PATH+++ '[' -z '' ']'+++ PS1=++ conda activate++ local cmd=activate++ case "$cmd" in++ __conda_activate activate++ '[' -n '' ']'++ local ask_conda+++ PS1=+++ __conda_exe shell.posix activate+++ /opt/miniconda3/bin/conda shell.posix activate++ ask_conda='PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''1'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ eval 'PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''1'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+++ PS1='(base) '+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export CONDA_PREFIX=/opt/miniconda3+++ CONDA_PREFIX=/opt/miniconda3+++ export CONDA_SHLVL=1+++ CONDA_SHLVL=1+++ export CONDA_DEFAULT_ENV=base+++ CONDA_DEFAULT_ENV=base+++ export 'CONDA_PROMPT_MODIFIER=(base) '+++ CONDA_PROMPT_MODIFIER='(base) '+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ __conda_hashr++ '[' -n '' ']'++ '[' -n '' ']'++ hash -r+ conda activate testbed+ local cmd=activate+ case "$cmd" in+ __conda_activate activate testbed+ '[' -n '' ']'+ local ask_conda++ PS1='(base) '++ __conda_exe shell.posix activate testbed++ /opt/miniconda3/bin/conda shell.posix activate testbed+ ask_conda='PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''2'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_1='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+ eval 'PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''2'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_1='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ PS1='(testbed) '++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed++ CONDA_PREFIX=/opt/miniconda3/envs/testbed++ export CONDA_SHLVL=2++ CONDA_SHLVL=2++ export CONDA_DEFAULT_ENV=testbed++ CONDA_DEFAULT_ENV=testbed++ export 'CONDA_PROMPT_MODIFIER=(testbed) '++ CONDA_PROMPT_MODIFIER='(testbed) '++ export CONDA_PREFIX_1=/opt/miniconda3++ CONDA_PREFIX_1=/opt/miniconda3++ export CONDA_EXE=/opt/miniconda3/bin/conda++ CONDA_EXE=/opt/miniconda3/bin/conda++ export _CE_M=++ _CE_M=++ export _CE_CONDA=++ _CE_CONDA=++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+ __conda_hashr+ '[' -n '' ']'+ '[' -n '' ']'+ hash -r+ cd /testbed+ git config --global --add safe.directory /testbed+ cd /testbed+ git statusOn branch mainChanges not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: astropy/wcs/wcs.py
Untracked files: (use "git add <file>..." to include in what will be committed) astropy/wcs/.backup.wcs.py
no changes added to commit (use "git add" and/or "git commit -a")+ git showcommit d5bd3f68bb6d5ce3a61bdce9883ee750d1afade5Merge: 413277e789 2f83e2b3e6Author: Brigitta Sipocz <bsipocz@gmail.com>Date: Wed Aug 15 16:36:50 2018 +0100
Merge pull request #7742 from astrofrog/travis-egg-info Travis: Remove some egg_info builds
+ git diff d5bd3f68bb6d5ce3a61bdce9883ee750d1afade5diff --git a/astropy/wcs/wcs.py b/astropy/wcs/wcs.pyindex d3a06f2b31..66710778a0 100644--- a/astropy/wcs/wcs.py+++ b/astropy/wcs/wcs.py@@ -1275,9 +1275,11 @@ reduce these to 2 dimensions using the naxis kwarg. "given.".format( self.naxis, self.naxis + 1, len(args))) - def all_pix2world(self, *args, **kwargs):- return self._array_converter(- self._all_pix2world, 'output', *args, **kwargs)+def all_pix2world(self, *args, **kwargs):+ if len(args) == 2 and len(args[0]) == 0 and len(args[1]) == 0:+ return [], []+ return self._array_converter(+ self._all_pix2world, 'output', *args, **kwargs) all_pix2world.__doc__ = """ Transforms pixel coordinates to world coordinates. + source /opt/miniconda3/bin/activate++ _CONDA_ROOT=/opt/miniconda3++ . /opt/miniconda3/etc/profile.d/conda.sh+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ '[' -z x ']'++ conda activate++ local cmd=activate++ case "$cmd" in++ __conda_activate activate++ '[' -n '' ']'++ local ask_conda+++ PS1='(testbed) '+++ __conda_exe shell.posix activate+++ /opt/miniconda3/bin/conda shell.posix activate++ ask_conda='PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''3'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ eval 'PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''3'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+++ PS1='(base) '+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export CONDA_PREFIX=/opt/miniconda3+++ CONDA_PREFIX=/opt/miniconda3+++ export CONDA_SHLVL=3+++ CONDA_SHLVL=3+++ export CONDA_DEFAULT_ENV=base+++ CONDA_DEFAULT_ENV=base+++ export 'CONDA_PROMPT_MODIFIER=(base) '+++ CONDA_PROMPT_MODIFIER='(base) '+++ export CONDA_PREFIX_2=/opt/miniconda3/envs/testbed+++ CONDA_PREFIX_2=/opt/miniconda3/envs/testbed+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ __conda_hashr++ '[' -n '' ']'++ '[' -n '' ']'++ hash -r+ conda activate testbed+ local cmd=activate+ case "$cmd" in+ __conda_activate activate testbed+ '[' -n '' ']'+ local ask_conda++ PS1='(base) '++ __conda_exe shell.posix activate testbed++ /opt/miniconda3/bin/conda shell.posix activate testbed+ ask_conda='PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''4'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_3='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+ eval 'PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''4'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_3='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ PS1='(testbed) '++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed++ CONDA_PREFIX=/opt/miniconda3/envs/testbed++ export CONDA_SHLVL=4++ CONDA_SHLVL=4++ export CONDA_DEFAULT_ENV=testbed++ CONDA_DEFAULT_ENV=testbed++ export 'CONDA_PROMPT_MODIFIER=(testbed) '++ CONDA_PROMPT_MODIFIER='(testbed) '++ export CONDA_PREFIX_3=/opt/miniconda3++ CONDA_PREFIX_3=/opt/miniconda3++ export CONDA_EXE=/opt/miniconda3/bin/conda++ CONDA_EXE=/opt/miniconda3/bin/conda++ export _CE_M=++ _CE_M=++ export _CE_CONDA=++ _CE_CONDA=++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+ __conda_hashr+ '[' -n '' ']'+ '[' -n '' ']'+ hash -r+ python -m pip install -e '.[test]' --verboseUsing pip 21.2.2 from /opt/miniconda3/envs/testbed/lib/python3.6/site-packages/pip (python 3.6)Obtaining file:///testbed Running command python setup.py egg_info running egg_info creating /tmp/pip-pip-egg-info-92ewty0k/astropy.egg-info writing /tmp/pip-pip-egg-info-92ewty0k/astropy.egg-info/PKG-INFO writing dependency_links to /tmp/pip-pip-egg-info-92ewty0k/astropy.egg-info/dependency_links.txt writing entry points to /tmp/pip-pip-egg-info-92ewty0k/astropy.egg-info/entry_points.txt writing requirements to /tmp/pip-pip-egg-info-92ewty0k/astropy.egg-info/requires.txt writing top-level names to /tmp/pip-pip-egg-info-92ewty0k/astropy.egg-info/top_level.txt writing manifest file '/tmp/pip-pip-egg-info-92ewty0k/astropy.egg-info/SOURCES.txt' reading manifest file '/tmp/pip-pip-egg-info-92ewty0k/astropy.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'ez_setup.py' warning: no files found matching 'astropy/utils/misc/data/.hidden_file.txt' warning: no files found matching '*' under directory 'scripts' warning: no files found matching '*' under directory 'astropy/sphinx/themes' no previously-included directories found matching 'docs/_build' no previously-included directories found matching 'build' warning: no files found matching 'astropy_helpers/ez_setup.py' warning: no files found matching '*.pyx' under directory 'astropy_helpers/astropy_helpers' warning: no files found matching '*.h' under directory 'astropy_helpers/astropy_helpers' warning: no files found matching '*.rst' under directory 'astropy_helpers/astropy_helpers' no previously-included directories found matching 'astropy_helpers/build' warning: no previously-included files matching '*.pyc' found anywhere in distribution warning: no previously-included files matching '*.o' found anywhere in distribution writing manifest file '/tmp/pip-pip-egg-info-92ewty0k/astropy.egg-info/SOURCES.txt'Requirement already satisfied: numpy>=1.13.0 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from astropy==3.1.dev22336) (1.16.0)Requirement already satisfied: pytest-astropy in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from astropy==3.1.dev22336) (0.2.1)Requirement already satisfied: pytest-openfiles>=0.2.0 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest-astropy->astropy==3.1.dev22336) (0.2.0)Requirement already satisfied: pytest-arraydiff in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest-astropy->astropy==3.1.dev22336) (0.1)Requirement already satisfied: pytest-remotedata>=0.2.0 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest-astropy->astropy==3.1.dev22336) (0.2.0)Requirement already satisfied: pytest>=3.1.0 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest-astropy->astropy==3.1.dev22336) (3.3.1)Requirement already satisfied: pytest-doctestplus>=0.1.2 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest-astropy->astropy==3.1.dev22336) (0.1.2)Requirement already satisfied: pluggy<0.7,>=0.5 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest>=3.1.0->pytest-astropy->astropy==3.1.dev22336) (0.6.0)Requirement already satisfied: setuptools in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest>=3.1.0->pytest-astropy->astropy==3.1.dev22336) (38.2.4)Requirement already satisfied: six>=1.10.0 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest>=3.1.0->pytest-astropy->astropy==3.1.dev22336) (1.16.0)Requirement already satisfied: attrs>=17.2.0 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest>=3.1.0->pytest-astropy->astropy==3.1.dev22336) (17.3.0)Requirement already satisfied: py>=1.5.0 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest>=3.1.0->pytest-astropy->astropy==3.1.dev22336) (1.11.0)Requirement already satisfied: psutil in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from pytest-openfiles>=0.2.0->pytest-astropy->astropy==3.1.dev22336) (5.4.2)Installing collected packages: astropy Attempting uninstall: astropy Found existing installation: astropy 3.1.dev22336 Uninstalling astropy-3.1.dev22336: Removing file or directory /opt/miniconda3/envs/testbed/bin/fits2bitmap Removing file or directory /opt/miniconda3/envs/testbed/bin/fitscheck Removing file or directory /opt/miniconda3/envs/testbed/bin/fitsdiff Removing file or directory /opt/miniconda3/envs/testbed/bin/fitsheader Removing file or directory /opt/miniconda3/envs/testbed/bin/fitsinfo Removing file or directory /opt/miniconda3/envs/testbed/bin/samp_hub Removing file or directory /opt/miniconda3/envs/testbed/bin/showtable Removing file or directory /opt/miniconda3/envs/testbed/bin/volint Removing file or directory /opt/miniconda3/envs/testbed/bin/wcslint Removing file or directory /opt/miniconda3/envs/testbed/lib/python3.6/site-packages/astropy.egg-link Removing pth entries from /opt/miniconda3/envs/testbed/lib/python3.6/site-packages/easy-install.pth: Removing entry: /testbed Successfully uninstalled astropy-3.1.dev22336 Running setup.py develop for astropy Running command /opt/miniconda3/envs/testbed/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/testbed/setup.py'"'"'; __file__='"'"'/testbed/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps running develop running egg_info writing astropy.egg-info/PKG-INFO writing dependency_links to astropy.egg-info/dependency_links.txt writing entry points to astropy.egg-info/entry_points.txt writing requirements to astropy.egg-info/requires.txt writing top-level names to astropy.egg-info/top_level.txt reading manifest file 'astropy.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'ez_setup.py' warning: no files found matching 'astropy/utils/misc/data/.hidden_file.txt' warning: no files found matching '*' under directory 'scripts' warning: no files found matching '*' under directory 'astropy/sphinx/themes' no previously-included directories found matching 'docs/_build' no previously-included directories found matching 'build' warning: no files found matching 'astropy_helpers/ez_setup.py' warning: no files found matching '*.pyx' under directory 'astropy_helpers/astropy_helpers' warning: no files found matching '*.h' under directory 'astropy_helpers/astropy_helpers' warning: no files found matching '*.rst' under directory 'astropy_helpers/astropy_helpers' no previously-included directories found matching 'astropy_helpers/build' warning: no previously-included files matching '*.pyc' found anywhere in distribution warning: no previously-included files matching '*.o' found anywhere in distribution writing manifest file 'astropy.egg-info/SOURCES.txt' running build_ext running pre_hook from astropy._erfa.setup_package for build_ext command running pre_hook from astropy.modeling.setup_package for build_ext command building 'astropy._compiler' extension gcc -pthread -B /opt/miniconda3/envs/testbed/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/miniconda3/envs/testbed/include/python3.6m -c astropy/_compiler.c -o build/temp.linux-x86_64-3.6/astropy/_compiler.o gcc -pthread -shared -B /opt/miniconda3/envs/testbed/compiler_compat -L/opt/miniconda3/envs/testbed/lib -Wl,-rpath=/opt/miniconda3/envs/testbed/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/astropy/_compiler.o -o /testbed/astropy/_compiler.cpython-36m-x86_64-linux-gnu.so skipping 'astropy/table/_np_utils.c' Cython extension (up-to-date) skipping 'astropy/table/_column_mixins.c' Cython extension (up-to-date) skipping 'astropy/io/ascii/cparser.c' Cython extension (up-to-date) skipping 'astropy/stats/bls/_impl.c' Cython extension (up-to-date) skipping 'astropy/convolution/boundary_none.c' Cython extension (up-to-date) skipping 'astropy/convolution/boundary_fill.c' Cython extension (up-to-date) skipping 'astropy/convolution/boundary_wrap.c' Cython extension (up-to-date) skipping 'astropy/convolution/boundary_extend.c' Cython extension (up-to-date) skipping 'astropy/cosmology/scalar_inv_efuncs.c' Cython extension (up-to-date) skipping 'astropy/stats/lombscargle/implementations/cython_impl.c' Cython extension (up-to-date) Creating /opt/miniconda3/envs/testbed/lib/python3.6/site-packages/astropy.egg-link (link to .) Adding astropy 3.1.dev22336 to easy-install.pth file Installing fits2bitmap script to /opt/miniconda3/envs/testbed/bin Installing fitscheck script to /opt/miniconda3/envs/testbed/bin Installing fitsdiff script to /opt/miniconda3/envs/testbed/bin Installing fitsheader script to /opt/miniconda3/envs/testbed/bin Installing fitsinfo script to /opt/miniconda3/envs/testbed/bin Installing samp_hub script to /opt/miniconda3/envs/testbed/bin Installing showtable script to /opt/miniconda3/envs/testbed/bin Installing volint script to /opt/miniconda3/envs/testbed/bin Installing wcslint script to /opt/miniconda3/envs/testbed/bin
Installed /testbedWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venvSuccessfully installed astropy-3.1.dev22336 Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/9f/8b/a094f5da22d7abf5098205367b3296dd15b914f4232af5ca39ba6214d08c/pip-22.0-py3-none-any.whl#sha256=6cb1ea2bd7fda0668e26ae8c3e45188f301a7ef17ff22efe1f70f3643e56a822 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/4a/ca/e72b3b399d7a8cb34311aa8f52924108591c013b09f0268820afb4cd96fb/pip-22.0.tar.gz#sha256=d3fa5c3e42b33de52bddce89de40268c9a263cd6ef7c94c40774808dafb32c82 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/89/a1/2f4e58eda11e591fbfa518233378835679fc5ab766b690b3df85215014d5/pip-22.0.1-py3-none-any.whl#sha256=30739ac5fb973cfa4399b0afff0523d4fe6bed2f7a5229333f64d9c2ce0d1933 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/63/71/5686e51f06fa59da55f7e81c3101844e57434a30f4a0d7456674d1459841/pip-22.0.1.tar.gz#sha256=7fd7a92f2fb1d2ac2ae8c72fb10b1e640560a0361ed4427453509e2bcc18605b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/83/b5/df8640236faa5a3cb80bfafd68e9fb4b22578208b8398c032ccff803f9e0/pip-22.0.2-py3-none-any.whl#sha256=682eabc4716bfce606aca8dab488e9c7b58b0737e9001004eb858cdafcd8dbdd (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/d9/c1/146b24a7648fdf3f8b4dc6521ab0b26ac151ef903bac0b63a4e1450cb4d1/pip-22.0.2.tar.gz#sha256=27b4b70c34ec35f77947f777070d8331adbb1e444842e98e7150c288dc0caea4 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/6a/df/a6ef77a6574781a668791419ffe366c8acd1c3cf4709d210cb53cd5ce1c2/pip-22.0.3-py3-none-any.whl#sha256=c146f331f0805c77017c6bb9740cec4a49a0d4582d0c3cc8244b057f83eca359 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/88/d9/761f0b1e0551a3559afe4d34bd9bf68fc8de3292363b3775dda39b62ce84/pip-22.0.3.tar.gz#sha256=f29d589df8c8ab99c060e68ad294c4a9ed896624f6368c5349d70aa581b333d0 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/4d/16/0a14ca596f30316efd412a60bdfac02a7259bf8673d4d917dc60b9a21812/pip-22.0.4-py3-none-any.whl#sha256=c6aca0f2f081363f689f041d90dab2a07a9a07fb840284db2218117a52da800b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/33/c9/e2164122d365d8f823213a53970fa3005eb16218edcfc56ca24cb6deba2b/pip-22.0.4.tar.gz#sha256=b3a9de2c6ef801e9247d1527a4b16f92f2cc141cd1489f3fffaf6a9e96729764 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/79/3a/d341ae105c8b49eac912bee40739d496ae80f9441efa7df6c68f4997bbc8/pip-22.1b1-py3-none-any.whl#sha256=09e9e8f8e10f2515134b59600ad3630219430eabb734336079cbc6ffb2e01a0e (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/a7/c0/794f22836ef3202a7ad61f0872278ee7ac62e8c7617e4c9a08f01b5e82da/pip-22.1b1.tar.gz#sha256=f54ab61985754b56c5589178cfd7dfca5ed9f98d5c8f2de2eecb29f1341200f1 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/f3/77/23152f90de45957b59591c34dcb39b78194eb67d088d4f8799e9aa9726c4/pip-22.1-py3-none-any.whl#sha256=802e797fb741be1c2d475533d4ea951957e4940091422bd4a24848a7ac95609d (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/99/bb/696e256f4f445809f25efd4e4ce42ff99664dc089cafa1e097d5fec7fc33/pip-22.1.tar.gz#sha256=2debf847016cfe643fa1512e2d781d3ca9e5c878ba0652583842d50cc2bcc605 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/9b/e6/aa8149e048eda381f2a433599be9b1f5e5e3a189636cd6cf9614aa2ff5be/pip-22.1.1-py3-none-any.whl#sha256=e7bcf0b2cbdec2af84cc1b7b79b25fdbd7228fbdb61a4dca0b82810d0ba9d18b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/3e/0a/6125e67aa4d3245faeed476e4e26f190b5209f84f01efd733ac6372eb247/pip-22.1.1.tar.gz#sha256=8dfb15d8a1c3d3085a4cbe11f29e19527dfaf2ba99354326fd62cec013eaee81 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/96/2f/caec18213f6a67852f6997fb0673ae08d2e93d1b81573edb93ba4ef06970/pip-22.1.2-py3-none-any.whl#sha256=a3edacb89022ef5258bf61852728bf866632a394da837ca49eb4303635835f17 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/4b/b6/0fa7aa968a9fa4ef63a51b3ff0644e59f49dcd7235b3fd6cceb23f202e08/pip-22.1.2.tar.gz#sha256=6d55b27e10f506312894a87ccc59f280136bad9061719fac9101bdad5a6bce69 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/9b/9e/9e0610f25e65e2cdf90b1ee9c47ca710865401904038558ac0129ea23cbc/pip-22.2-py3-none-any.whl#sha256=9abf423d5d64f3289ab9d5bf31da9e6234f2e9c5d8dcf1423bcb46b809a02c2c (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/cd/b6/cf07132d631444dd7ce0ed199f2327eb34e2418f1675145e5b10e1ee65cd/pip-22.2.tar.gz#sha256=8d63fcd4ee293e30b644827268a0a973d080e5c7425ef26d427f5eb2126c7681 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/84/25/5734a44897751d8bac6822efb819acda2d969bcc1b915bbd7d48102952cb/pip-22.2.1-py3-none-any.whl#sha256=0bbbc87dfbe6eed217beff0021f8b7dea04c8f4a0baa9d31dc4cff281ffc5b2b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/46/28/addd7e66bb3af799d35a5dcbb79407b591a7ed674f4efd2bd8f930c40821/pip-22.2.1.tar.gz#sha256=50516e47a2b79e77446f0d05649f0d53772c192571486236b1905492bfc24bac (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/1f/2c/d9626f045e7b49a6225c6b09257861f24da78f4e5f23af2ddbdf852c99b8/pip-22.2.2-py3-none-any.whl#sha256=b61a374b5bc40a6e982426aede40c9b5a08ff20e640f5b56977f4f91fed1e39a (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/4b/30/e15b806597e67057e07a5acdc135216ccbf76a5f1681a324533b61066b0b/pip-22.2.2.tar.gz#sha256=3fd1929db052f056d7a998439176d3333fa1b3f6c1ad881de1885c0717608a4b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/47/ef/8b5470b5b94b36231ed9c0bde90caa71c0d4322d4a15f009b2b7f4287fe0/pip-22.3-py3-none-any.whl#sha256=1daab4b8d3b97d1d763caeb01a4640a2250a0ea899e257b1e44b9eded91e15ab (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/f8/08/7f92782ff571c7c7cb6c5eeb8ebbb1f68cb02bdb24e55c5de4dd9ce98bc3/pip-22.3.tar.gz#sha256=8182aec21dad6c0a49a2a3d121a87cd524b950e0b6092b181625f07ebdde7530 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/09/bd/2410905c76ee14c62baf69e3f4aa780226c1bbfc9485731ad018e35b0cb5/pip-22.3.1-py3-none-any.whl#sha256=908c78e6bc29b676ede1c4d57981d490cb892eb45cd8c214ab6298125119e077 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/a3/50/c4d2727b99052780aad92c7297465af5fe6eec2dbae490aa9763273ffdc1/pip-22.3.1.tar.gz#sha256=65fd48317359f3af8e593943e6ae1506b66325085ea64b706a998c6e83eeaf38 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/ab/43/508c403c38eeaa5fc86516eb13bb470ce77601b6d2bbcdb16e26328d0a15/pip-23.0-py3-none-any.whl#sha256=b5f88adff801f5ef052bcdef3daa31b55eb67b0fccd6d0106c206fa248e0463c (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/b5/16/5e24bf63cff51dcc169f43bd43b86b005c49941e09cc3482a5b370db239e/pip-23.0.tar.gz#sha256=aee438284e82c8def684b0bcc50b1f6ed5e941af97fa940e83e2e8ef1a59da9b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/07/51/2c0959c5adf988c44d9e1e0d940f5b074516ecc87e96b1af25f59de9ba38/pip-23.0.1-py3-none-any.whl#sha256=236bcb61156d76c4b8a05821b988c7b8c35bf0da28a4b614e8d6ab5212c25c6f (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/6b/8b/0b16094553ecc680e43ded8f920c3873b01b1da79a54274c98f08cb29fca/pip-23.0.1.tar.gz#sha256=cd015ea1bfb0fcef59d8a286c1f8bebcb983f6317719d415dc5351efb7cd7024 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/ae/db/a8821cdac455a1740580c92de3ed7b7f257cfdbad8b1ba8864e6abe58a08/pip-23.1-py3-none-any.whl#sha256=64b1d4528e491aa835ec6ece0c1ac40ce6ab6d886e60740f6519db44b2e9634d (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/da/bf/1bdbe62f5fbde085351693e3a8e387a59f8220932b911b1719fe65efa2d7/pip-23.1.tar.gz#sha256=408539897ee535dbfb83a153f7bc4d620f990d8bd44a52a986efc0b4d330d34a (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/f8/f8/17bd3f7c13515523d811ce4104410c16c03e3c6830f9276612e2f4b28382/pip-23.1.1-py3-none-any.whl#sha256=3d8d72fa0714e93c9d3c2a0ede91e898c64596e0fa7d4523f72dd95728efc418 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/43/7d/1f52f99a7f2eae870483b2c2a3064511487de87911bce146df8a154fbe81/pip-23.1.1.tar.gz#sha256=c95b53d309f903f33dfe5fd37e502a5c3a05ee3454d518e45df522a4f091b728 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/08/e3/57d4c24a050aa0bcca46b2920bff40847db79535dc78141eb83581a52eb8/pip-23.1.2-py3-none-any.whl#sha256=3ef6ac33239e4027d9a5598a381b9d30880a1477e50039db2eac6e8a8f6d1b18 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/fa/ee/74ff76da0ab649eec7581233daeb43d8aa35383d8f75317b2ab3b80c922f/pip-23.1.2.tar.gz#sha256=0e7c86f486935893c708287b30bd050a36ac827ec7fe5e43fe7cb198dd835fba (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/02/65/f15431ddee78562355ccb39097bf9160a1689f2db40dc418754be98806a1/pip-23.2-py3-none-any.whl#sha256=78e5353a9dda374b462f2054f83a7b63f3f065c98236a68361845c1b0ee7e35f (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/3d/ab/21fa8d1ecf5648559f056fda732b0f9fca0585eb2688252e67f70e74deaf/pip-23.2.tar.gz#sha256=a160a170f3331d9ca1a0247eb1cd79c758879f1f81158f9cd05bbb5df80bea5c (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/50/c2/e06851e8cc28dcad7c155f4753da8833ac06a5c704c109313b8d5a62968a/pip-23.2.1-py3-none-any.whl#sha256=7ccf472345f20d35bdc9d1841ff5f313260c2c33fe417f48c30ac46cccabf5be (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/ba/19/e63fb4e0d20e48bd2167bb7e857abc0e21679e24805ba921a224df8977c0/pip-23.2.1.tar.gz#sha256=fb0bd5435b3200c602b5bf61d2d43c2f13c02e29c1707567ae7fbc514eb9faf2 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/e0/63/b428aaca15fcd98c39b07ca7149e24bc14205ad0f1c80ba2b01835aedde1/pip-23.3-py3-none-any.whl#sha256=bc38bb52bc286514f8f7cb3a1ba5ed100b76aaef29b521d48574329331c5ae7b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/0d/f6/07ef4561bb911285c229fa46ed3df1877bd6c5325c4c67d516560d59a6e6/pip-23.3.tar.gz#sha256=bb7d4f69f488432e4e96394612f43ab43dd478d073ef7422604a570f7157561e (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/47/6a/453160888fab7c6a432a6e25f8afe6256d0d9f2cbd25971021da6491d899/pip-23.3.1-py3-none-any.whl#sha256=55eb67bb6171d37447e82213be585b75fe2b12b359e993773aca4de9247a052b (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/1f/7f/4da15e07ccd11c84c1ccc8f6e24288d5e76c99441bf80e315b33542db951/pip-23.3.1.tar.gz#sha256=1fcaa041308d01f14575f6d0d2ea4b75a3e2871fe4f9c694976f908768e14174 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/15/aa/3f4c7bcee2057a76562a5b33ecbd199be08cdb4443a02e26bd2c3cf6fc39/pip-23.3.2-py3-none-any.whl#sha256=5052d7889c1f9d05224cd41741acb7c5d6fa735ab34e339624a614eaaa7e7d76 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/b7/06/6b1ad0ae8f97d7a0d6f6ad640db10780578999e647a9593512ceb6f06469/pip-23.3.2.tar.gz#sha256=7fd9972f96db22c8077a1ee2691b172c8089b17a5652a44494a9ecb0d78f9149 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/8a/6a/19e9fe04fca059ccf770861c7d5721ab4c2aebc539889e97c7977528a53b/pip-24.0-py3-none-any.whl#sha256=ba0d021a166865d2265246961bec0152ff124de910c5cc39f1156ce3fa7c69dc (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.7'): https://files.pythonhosted.org/packages/94/59/6638090c25e9bc4ce0c42817b5a234e183872a1129735a9330c472cc2056/pip-24.0.tar.gz#sha256=ea9bd1a847e8c5774a5777bb398c19e80bcd4e2aa16a4b301b718fe6f593aba2 (from https://pypi.org/simple/pip/) (requires-python:>=3.7) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/1e/65/22725f8ba583376d0c300c3b9b52b9a67cfd93d786a80be73c167e45abc8/pip-24.1b1-py3-none-any.whl#sha256=752516cffafef5cf29d3fb2f06c978f27e98709654689cf277b2fce984c7a591 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/71/38/b0cb3d68b4776b6208a2f16b6d444a848a1fe465a78ce4b7dbbeb8a4fc58/pip-24.1b1.tar.gz#sha256=a9bd4c037d72325b4e903ec3f383263deea3eb73cd01db7a844edd026fc68afe (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/c1/64/0f1528ed3dfd75a56e084caab3c8dbed596bf87a1dfc40cbc57166bb0c25/pip-24.1b2-py3-none-any.whl#sha256=7b4ae01a2af4bfae0386860c5a12c035fcc228364ddef89192a1c31d48d263a1 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/0b/b2/1d1eac32a16fd9478fb9bc6eb6b899f91e6fecceba194fa097c35d385e9a/pip-24.1b2.tar.gz#sha256=926201900a0e26929387023907bf395c9a6c0d37bbea176942ca5e1b6b27e815 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/25/49/2255373efd193c6fbd97dc22399e9c830a6517a0f02ca77fbc0bd83ac5cc/pip-24.1-py3-none-any.whl#sha256=a775837439bf5da2c1a0c2fa43d5744854497c689ddbd9344cf3ea6d00598540 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/df/60/7538a9cd4d76829c2f585b73d6e400c833a1769408451c813354c58de6cc/pip-24.1.tar.gz#sha256=bdae551038c0ce6a83030b4aedef27fc95f0daa683593fea22fa05e55ed8e317 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/f4/ab/e3c039b5ddba9335bd8f82d599eb310de1d2a2db0411b8d804d507405c74/pip-24.1.1-py3-none-any.whl#sha256=efca15145a95e95c00608afeab66311d40bfb73bb2266a855befd705e6bb15a0 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/c0/d0/9641dc7b05877874c6418f8034ddefc809495e65caa14d38c7551cd114bb/pip-24.1.1.tar.gz#sha256=5aa64f65e1952733ee0a9a9b1f52496ebdb3f3077cc46f80a16d983b58d1180a (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/e7/54/0c1c068542cee73d8863336e974fc881e608d0170f3af15d0c0f28644531/pip-24.1.2-py3-none-any.whl#sha256=7cd207eed4c60b0f411b444cd1464198fe186671c323b6cd6d433ed80fc9d247 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/12/3d/d899257cace386bebb7bdf8a872d5fe3b935cc6381c3ddb76d3e5d99890d/pip-24.1.2.tar.gz#sha256=e5458a0b89f2755e0ee8c0c77613fe5273e05f337907874d64f13171a898a7ff (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/d4/55/90db48d85f7689ec6f81c0db0622d704306c5284850383c090e6c7195a5c/pip-24.2-py3-none-any.whl#sha256=2cd581cf58ab7fcfca4ce8efa6dcacd0de5bf8d0a3eb9ec927e07405f4d9e2a2 (from https://pypi.org/simple/pip/) (requires-python:>=3.8) Link requires a different Python (3.6.13 not in: '>=3.8'): https://files.pythonhosted.org/packages/4d/87/fb90046e096a03aeab235e139436b3fe804cdd447ed2093b0d70eba3f7f8/pip-24.2.tar.gz#sha256=5b5e490b5e9cb275c879595064adce9ebd31b854e3e803740b72f9ccf34a45b8 (from https://pypi.org/simple/pip/) (requires-python:>=3.8)+ git checkout d5bd3f68bb6d5ce3a61bdce9883ee750d1afade5 astropy/wcs/tests/test_wcs.pyUpdated 0 paths from 9b09445a86+ git apply -v -Checking patch astropy/wcs/tests/test_wcs.py...Applied patch astropy/wcs/tests/test_wcs.py cleanly.+ pytest -rA -vv -o console_output_style=classic --tb=no astropy/wcs/tests/test_wcs.pyInternet access disabled============================= test session starts ==============================platform linux -- Python 3.6.13, pytest-3.3.1, py-1.11.0, pluggy-0.6.0 -- /opt/miniconda3/envs/testbed/bin/pythoncachedir: .
Running tests with Astropy version 3.1.dev22336.Running tests in astropy/wcs/tests/test_wcs.py.
Date: 2024-09-29T16:35:14
Platform: Linux-6.1.0-23-cloud-amd64-x86_64-with-debian-bookworm-sid
Executable: /opt/miniconda3/envs/testbed/bin/python
Full Python Version: 3.6.13 |Anaconda, Inc.| (default, Jun 4 2021, 14:25:59) [GCC 7.5.0]
encodings: sys: utf-8, locale: ANSI_X3.4-1968, filesystem: asciibyteorder: littlefloat info: dig: 15, mant_dig: 15
Numpy: 1.16.0Scipy: not availableMatplotlib: not availableh5py: not availablePandas: not availableCython: 0.27.3astropy_helpers: 3.1.dev957Using Astropy options: remote_data: none.
rootdir: /testbed, inifile: setup.cfgplugins: xdist-1.20.1, remotedata-0.2.0, openfiles-0.2.0, mock-1.6.3, forked-0.2, filter-subpackage-0.1, doctestplus-0.1.2, cov-2.5.1, astropy-header-0.1, arraydiff-0.1, hypothesis-3.44.2collecting ... collected 57 items
astropy/wcs/tests/test_wcs.py::TestMaps::test_consistency PASSEDastropy/wcs/tests/test_wcs.py::TestMaps::test_maps FAILEDastropy/wcs/tests/test_wcs.py::TestSpectra::test_consistency PASSEDastropy/wcs/tests/test_wcs.py::TestSpectra::test_spectra FAILEDastropy/wcs/tests/test_wcs.py::test_fixes FAILEDastropy/wcs/tests/test_wcs.py::test_outside_sky FAILEDastropy/wcs/tests/test_wcs.py::test_pix2world FAILEDastropy/wcs/tests/test_wcs.py::test_load_fits_path FAILEDastropy/wcs/tests/test_wcs.py::test_dict_init FAILEDastropy/wcs/tests/test_wcs.py::test_extra_kwarg FAILEDastropy/wcs/tests/test_wcs.py::test_3d_shapes FAILEDastropy/wcs/tests/test_wcs.py::test_preserve_shape FAILEDastropy/wcs/tests/test_wcs.py::test_broadcasting FAILEDastropy/wcs/tests/test_wcs.py::test_shape_mismatch FAILEDastropy/wcs/tests/test_wcs.py::test_invalid_shape FAILEDastropy/wcs/tests/test_wcs.py::test_warning_about_defunct_keywords FAILEDastropy/wcs/tests/test_wcs.py::test_warning_about_defunct_keywords_exception PASSEDastropy/wcs/tests/test_wcs.py::test_to_header_string FAILEDastropy/wcs/tests/test_wcs.py::test_to_fits FAILEDastropy/wcs/tests/test_wcs.py::test_to_header_warning FAILEDastropy/wcs/tests/test_wcs.py::test_no_comments_in_header FAILEDastropy/wcs/tests/test_wcs.py::test_find_all_wcs_crash FAILEDastropy/wcs/tests/test_wcs.py::test_validate FAILEDastropy/wcs/tests/test_wcs.py::test_validate_with_2_wcses FAILEDastropy/wcs/tests/test_wcs.py::test_crpix_maps_to_crval FAILEDastropy/wcs/tests/test_wcs.py::test_all_world2pix FAILEDastropy/wcs/tests/test_wcs.py::test_scamp_sip_distortion_parameters FAILEDastropy/wcs/tests/test_wcs.py::test_fixes2 FAILEDastropy/wcs/tests/test_wcs.py::test_unit_normalization FAILEDastropy/wcs/tests/test_wcs.py::test_footprint_to_file FAILEDastropy/wcs/tests/test_wcs.py::test_validate_faulty_wcs FAILEDastropy/wcs/tests/test_wcs.py::test_error_message FAILEDastropy/wcs/tests/test_wcs.py::test_out_of_bounds FAILEDastropy/wcs/tests/test_wcs.py::test_calc_footprint_1 FAILEDastropy/wcs/tests/test_wcs.py::test_calc_footprint_2 FAILEDastropy/wcs/tests/test_wcs.py::test_calc_footprint_3 FAILEDastropy/wcs/tests/test_wcs.py::test_sip FAILEDastropy/wcs/tests/test_wcs.py::test_printwcs FAILEDastropy/wcs/tests/test_wcs.py::test_invalid_spherical FAILEDastropy/wcs/tests/test_wcs.py::test_no_iteration FAILEDastropy/wcs/tests/test_wcs.py::test_sip_tpv_agreement FAILEDastropy/wcs/tests/test_wcs.py::test_tpv_copy FAILEDastropy/wcs/tests/test_wcs.py::test_hst_wcs FAILEDastropy/wcs/tests/test_wcs.py::test_list_naxis FAILEDastropy/wcs/tests/test_wcs.py::test_sip_broken FAILEDastropy/wcs/tests/test_wcs.py::test_no_truncate_crval FAILEDastropy/wcs/tests/test_wcs.py::test_no_truncate_crval_try2 FAILEDastropy/wcs/tests/test_wcs.py::test_no_truncate_crval_p17 FAILEDastropy/wcs/tests/test_wcs.py::test_no_truncate_using_compare FAILEDastropy/wcs/tests/test_wcs.py::test_passing_ImageHDU FAILEDastropy/wcs/tests/test_wcs.py::test_inconsistent_sip FAILEDastropy/wcs/tests/test_wcs.py::test_bounds_check FAILEDastropy/wcs/tests/test_wcs.py::test_naxis FAILEDastropy/wcs/tests/test_wcs.py::test_sip_with_altkey FAILEDastropy/wcs/tests/test_wcs.py::test_to_fits_1 FAILEDastropy/wcs/tests/test_wcs.py::test_keyedsip FAILEDastropy/wcs/tests/test_wcs.py::test_zero_size_input FAILED
=============================== warnings summary ===============================None Module already imported so cannot be rewritten: astropy.tests.plugins.display
-- Docs: http://doc.pytest.org/en/latest/warnings.html=============== 54 failed, 3 passed, 1 warnings in 3.81 seconds ================+ git checkout d5bd3f68bb6d5ce3a61bdce9883ee750d1afade5 astropy/wcs/tests/test_wcs.pyUpdated 1 path from 9b09445a861234567891011121314151617181920212223242526272829303132333435#!/bin/bashset -uxo pipefailsource /opt/miniconda3/bin/activateconda activate testbedcd /testbedsed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-genexport LANG=en_US.UTF-8export LANGUAGE=en_US:enexport LC_ALL=en_US.UTF-8git config --global --add safe.directory /testbedcd /testbedgit statusgit showgit diff e7fd69d051eaa67cb17f172a39b57253e9cb831asource /opt/miniconda3/bin/activateconda activate testbedpython -m pip install -e .git checkout e7fd69d051eaa67cb17f172a39b57253e9cb831a tests/test_utils/tests.pygit apply -v - <<'EOF_114329324912'diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py--- a/tests/test_utils/tests.py+++ b/tests/test_utils/tests.py@@ -1099,7 +1099,7 @@ def test_override_file_upload_permissions(self): the file_permissions_mode attribute of django.core.files.storage.default_storage. """- self.assertIsNone(default_storage.file_permissions_mode)+ self.assertEqual(default_storage.file_permissions_mode, 0o644) with self.settings(FILE_UPLOAD_PERMISSIONS=0o777): self.assertEqual(default_storage.file_permissions_mode, 0o777)
EOF_114329324912./tests/runtests.py --verbosity 2 --settings=test_sqlite --parallel 1 test_utils.testsgit checkout e7fd69d051eaa67cb17f172a39b57253e9cb831a tests/test_utils/tests.py123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653diff --git a/django/conf/.backup.global_settings.py b/django/conf/.backup.global_settings.pynew file mode 100644index 0000000000..acee9887d2--- /dev/null+++ b/django/conf/.backup.global_settings.py@@ -0,0 +1,634 @@+"""+Default Django settings. Override these with settings in the module pointed to+by the DJANGO_SETTINGS_MODULE environment variable.+"""+++# This is defined here as a do-nothing function because we can't import+# django.utils.translation -- that module depends on the settings.+def gettext_noop(s):+ return s+++####################+# CORE #+####################++DEBUG = False++# Whether the framework should propagate raw exceptions rather than catching+# them. This is useful under some testing situations and should never be used+# on a live site.+DEBUG_PROPAGATE_EXCEPTIONS = False++# People who get code error notifications.+# In the format [('Full Name', 'email@example.com'), ('Full Name', 'anotheremail@example.com')]+ADMINS = []++# List of IP addresses, as strings, that:+# * See debug comments, when DEBUG is true+# * Receive x-headers+INTERNAL_IPS = []++# Hosts/domain names that are valid for this site.+# "*" matches anything, ".example.com" matches example.com and all subdomains+ALLOWED_HOSTS = []++# Local time zone for this installation. All choices can be found here:+# https://en.wikipedia.org/wiki/List_of_tz_zones_by_name (although not all+# systems may support all possibilities). When USE_TZ is True, this is+# interpreted as the default user time zone.+TIME_ZONE = 'America/Chicago'++# If you set this to True, Django will use timezone-aware datetimes.+USE_TZ = False++# Language code for this installation. All choices can be found here:+# http://www.i18nguy.com/unicode/language-identifiers.html+LANGUAGE_CODE = 'en-us'++# Languages we provide translations for, out of the box.+LANGUAGES = [+ ('af', gettext_noop('Afrikaans')),+ ('ar', gettext_noop('Arabic')),+ ('ast', gettext_noop('Asturian')),+ ('az', gettext_noop('Azerbaijani')),+ ('bg', gettext_noop('Bulgarian')),+ ('be', gettext_noop('Belarusian')),+ ('bn', gettext_noop('Bengali')),+ ('br', gettext_noop('Breton')),+ ('bs', gettext_noop('Bosnian')),+ ('ca', gettext_noop('Catalan')),+ ('cs', gettext_noop('Czech')),+ ('cy', gettext_noop('Welsh')),+ ('da', gettext_noop('Danish')),+ ('de', gettext_noop('German')),+ ('dsb', gettext_noop('Lower Sorbian')),+ ('el', gettext_noop('Greek')),+ ('en', gettext_noop('English')),+ ('en-au', gettext_noop('Australian English')),+ ('en-gb', gettext_noop('British English')),+ ('eo', gettext_noop('Esperanto')),+ ('es', gettext_noop('Spanish')),+ ('es-ar', gettext_noop('Argentinian Spanish')),+ ('es-co', gettext_noop('Colombian Spanish')),+ ('es-mx', gettext_noop('Mexican Spanish')),+ ('es-ni', gettext_noop('Nicaraguan Spanish')),+ ('es-ve', gettext_noop('Venezuelan Spanish')),+ ('et', gettext_noop('Estonian')),+ ('eu', gettext_noop('Basque')),+ ('fa', gettext_noop('Persian')),+ ('fi', gettext_noop('Finnish')),+ ('fr', gettext_noop('French')),+ ('fy', gettext_noop('Frisian')),+ ('ga', gettext_noop('Irish')),+ ('gd', gettext_noop('Scottish Gaelic')),+ ('gl', gettext_noop('Galician')),+ ('he', gettext_noop('Hebrew')),+ ('hi', gettext_noop('Hindi')),+ ('hr', gettext_noop('Croatian')),+ ('hsb', gettext_noop('Upper Sorbian')),+ ('hu', gettext_noop('Hungarian')),+ ('hy', gettext_noop('Armenian')),+ ('ia', gettext_noop('Interlingua')),+ ('id', gettext_noop('Indonesian')),+ ('io', gettext_noop('Ido')),+ ('is', gettext_noop('Icelandic')),+ ('it', gettext_noop('Italian')),+ ('ja', gettext_noop('Japanese')),+ ('ka', gettext_noop('Georgian')),+ ('kab', gettext_noop('Kabyle')),+ ('kk', gettext_noop('Kazakh')),+ ('km', gettext_noop('Khmer')),+ ('kn', gettext_noop('Kannada')),+ ('ko', gettext_noop('Korean')),+ ('lb', gettext_noop('Luxembourgish')),+ ('lt', gettext_noop('Lithuanian')),+ ('lv', gettext_noop('Latvian')),+ ('mk', gettext_noop('Macedonian')),+ ('ml', gettext_noop('Malayalam')),+ ('mn', gettext_noop('Mongolian')),+ ('mr', gettext_noop('Marathi')),+ ('my', gettext_noop('Burmese')),+ ('nb', gettext_noop('Norwegian Bokmål')),+ ('ne', gettext_noop('Nepali')),+ ('nl', gettext_noop('Dutch')),+ ('nn', gettext_noop('Norwegian Nynorsk')),+ ('os', gettext_noop('Ossetic')),+ ('pa', gettext_noop('Punjabi')),+ ('pl', gettext_noop('Polish')),+ ('pt', gettext_noop('Portuguese')),+ ('pt-br', gettext_noop('Brazilian Portuguese')),+ ('ro', gettext_noop('Romanian')),+ ('ru', gettext_noop('Russian')),+ ('sk', gettext_noop('Slovak')),+ ('sl', gettext_noop('Slovenian')),+ ('sq', gettext_noop('Albanian')),+ ('sr', gettext_noop('Serbian')),+ ('sr-latn', gettext_noop('Serbian Latin')),+ ('sv', gettext_noop('Swedish')),+ ('sw', gettext_noop('Swahili')),+ ('ta', gettext_noop('Tamil')),+ ('te', gettext_noop('Telugu')),+ ('th', gettext_noop('Thai')),+ ('tr', gettext_noop('Turkish')),+ ('tt', gettext_noop('Tatar')),+ ('udm', gettext_noop('Udmurt')),+ ('uk', gettext_noop('Ukrainian')),+ ('ur', gettext_noop('Urdu')),+ ('vi', gettext_noop('Vietnamese')),+ ('zh-hans', gettext_noop('Simplified Chinese')),+ ('zh-hant', gettext_noop('Traditional Chinese')),+]++# Languages using BiDi (right-to-left) layout+LANGUAGES_BIDI = ["he", "ar", "fa", "ur"]++# If you set this to False, Django will make some optimizations so as not+# to load the internationalization machinery.+USE_I18N = True+LOCALE_PATHS = []++# Settings for language cookie+LANGUAGE_COOKIE_NAME = 'django_language'+LANGUAGE_COOKIE_AGE = None+LANGUAGE_COOKIE_DOMAIN = None+LANGUAGE_COOKIE_PATH = '/'+++# If you set this to True, Django will format dates, numbers and calendars+# according to user current locale.+USE_L10N = False++# Not-necessarily-technical managers of the site. They get broken link+# notifications and other various emails.+MANAGERS = ADMINS++# Default charset to use for all HttpResponse objects, if a MIME type isn't+# manually specified. It's used to construct the Content-Type header.+DEFAULT_CHARSET = 'utf-8'++# Encoding of files read from disk (template and initial SQL files).+FILE_CHARSET = 'utf-8'++# Email address that error messages come from.+SERVER_EMAIL = 'root@localhost'++# Database connection info. If left empty, will default to the dummy backend.+DATABASES = {}++# Classes used to implement DB routing behavior.+DATABASE_ROUTERS = []++# The email backend to use. For possible shortcuts see django.core.mail.+# The default is to use the SMTP backend.+# Third-party backends can be specified by providing a Python path+# to a module that defines an EmailBackend class.+EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'++# Host for sending email.+EMAIL_HOST = 'localhost'++# Port for sending email.+EMAIL_PORT = 25++# Whether to send SMTP 'Date' header in the local time zone or in UTC.+EMAIL_USE_LOCALTIME = False++# Optional SMTP authentication information for EMAIL_HOST.+EMAIL_HOST_USER = ''+EMAIL_HOST_PASSWORD = ''+EMAIL_USE_TLS = False+EMAIL_USE_SSL = False+EMAIL_SSL_CERTFILE = None+EMAIL_SSL_KEYFILE = None+EMAIL_TIMEOUT = None++# List of strings representing installed apps.+INSTALLED_APPS = []++TEMPLATES = []++# Default form rendering class.+FORM_RENDERER = 'django.forms.renderers.DjangoTemplates'++# Default email address to use for various automated correspondence from+# the site managers.+DEFAULT_FROM_EMAIL = 'webmaster@localhost'++# Subject-line prefix for email messages send with django.core.mail.mail_admins+# or ...mail_managers. Make sure to include the trailing space.+EMAIL_SUBJECT_PREFIX = '[Django] '++# Whether to append trailing slashes to URLs.+APPEND_SLASH = True++# Whether to prepend the "www." subdomain to URLs that don't have it.+PREPEND_WWW = False++# Override the server-derived value of SCRIPT_NAME+FORCE_SCRIPT_NAME = None++# List of compiled regular expression objects representing User-Agent strings+# that are not allowed to visit any page, systemwide. Use this for bad+# robots/crawlers. Here are a few examples:+# import re+# DISALLOWED_USER_AGENTS = [+# re.compile(r'^NaverBot.*'),+# re.compile(r'^EmailSiphon.*'),+# re.compile(r'^SiteSucker.*'),+# re.compile(r'^sohu-search'),+# ]+DISALLOWED_USER_AGENTS = []++ABSOLUTE_URL_OVERRIDES = {}++# List of compiled regular expression objects representing URLs that need not+# be reported by BrokenLinkEmailsMiddleware. Here are a few examples:+# import re+# IGNORABLE_404_URLS = [+# re.compile(r'^/apple-touch-icon.*\.png$'),+# re.compile(r'^/favicon.ico$'),+# re.compile(r'^/robots.txt$'),+# re.compile(r'^/phpmyadmin/'),+# re.compile(r'\.(cgi|php|pl)$'),+# ]+IGNORABLE_404_URLS = []++# A secret key for this particular Django installation. Used in secret-key+# hashing algorithms. Set this in your settings, or Django will complain+# loudly.+SECRET_KEY = ''++# Default file storage mechanism that holds media.+DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'++# Absolute filesystem path to the directory that will hold user-uploaded files.+# Example: "/var/www/example.com/media/"+MEDIA_ROOT = ''++# URL that handles the media served from MEDIA_ROOT.+# Examples: "http://example.com/media/", "http://media.example.com/"+MEDIA_URL = ''++# Absolute path to the directory static files should be collected to.+# Example: "/var/www/example.com/static/"+STATIC_ROOT = None++# URL that handles the static files served from STATIC_ROOT.+# Example: "http://example.com/static/", "http://static.example.com/"+STATIC_URL = None++# List of upload handler classes to be applied in order.+FILE_UPLOAD_HANDLERS = [+ 'django.core.files.uploadhandler.MemoryFileUploadHandler',+ 'django.core.files.uploadhandler.TemporaryFileUploadHandler',+]++# Maximum size, in bytes, of a request before it will be streamed to the+# file system instead of into memory.+FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440 # i.e. 2.5 MB++# Maximum size in bytes of request data (excluding file uploads) that will be+# read before a SuspiciousOperation (RequestDataTooBig) is raised.+DATA_UPLOAD_MAX_MEMORY_SIZE = 2621440 # i.e. 2.5 MB++# Maximum number of GET/POST parameters that will be read before a+# SuspiciousOperation (TooManyFieldsSent) is raised.+DATA_UPLOAD_MAX_NUMBER_FIELDS = 1000++# Directory in which upload streamed files will be temporarily saved. A value of+# `None` will make Django use the operating system's default temporary directory+# (i.e. "/tmp" on *nix systems).+FILE_UPLOAD_TEMP_DIR = None++# The numeric mode to set newly-uploaded files to. The value should be a mode+# you'd pass directly to os.chmod; see https://docs.python.org/library/os.html#files-and-directories.+FILE_UPLOAD_PERMISSIONS = None++# The numeric mode to assign to newly-created directories, when uploading files.+# The value should be a mode as you'd pass to os.chmod;+# see https://docs.python.org/library/os.html#files-and-directories.+FILE_UPLOAD_DIRECTORY_PERMISSIONS = None++# Python module path where user will place custom format definition.+# The directory where this setting is pointing should contain subdirectories+# named as the locales, containing a formats.py file+# (i.e. "myproject.locale" for myproject/locale/en/formats.py etc. use)+FORMAT_MODULE_PATH = None++# Default formatting for date objects. See all available format strings here:+# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date+DATE_FORMAT = 'N j, Y'++# Default formatting for datetime objects. See all available format strings here:+# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date+DATETIME_FORMAT = 'N j, Y, P'++# Default formatting for time objects. See all available format strings here:+# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date+TIME_FORMAT = 'P'++# Default formatting for date objects when only the year and month are relevant.+# See all available format strings here:+# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date+YEAR_MONTH_FORMAT = 'F Y'++# Default formatting for date objects when only the month and day are relevant.+# See all available format strings here:+# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date+MONTH_DAY_FORMAT = 'F j'++# Default short formatting for date objects. See all available format strings here:+# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date+SHORT_DATE_FORMAT = 'm/d/Y'++# Default short formatting for datetime objects.+# See all available format strings here:+# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date+SHORT_DATETIME_FORMAT = 'm/d/Y P'++# Default formats to be used when parsing dates from input boxes, in order+# See all available format string here:+# https://docs.python.org/library/datetime.html#strftime-behavior+# * Note that these format strings are different from the ones to display dates+DATE_INPUT_FORMATS = [+ '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'+ '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'+ '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'+ '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006'+ '%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006'+]++# Default formats to be used when parsing times from input boxes, in order+# See all available format string here:+# https://docs.python.org/library/datetime.html#strftime-behavior+# * Note that these format strings are different from the ones to display dates+TIME_INPUT_FORMATS = [+ '%H:%M:%S', # '14:30:59'+ '%H:%M:%S.%f', # '14:30:59.000200'+ '%H:%M', # '14:30'+]++# Default formats to be used when parsing dates and times from input boxes,+# in order+# See all available format string here:+# https://docs.python.org/library/datetime.html#strftime-behavior+# * Note that these format strings are different from the ones to display dates+DATETIME_INPUT_FORMATS = [+ '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'+ '%Y-%m-%d %H:%M:%S.%f', # '2006-10-25 14:30:59.000200'+ '%Y-%m-%d %H:%M', # '2006-10-25 14:30'+ '%Y-%m-%d', # '2006-10-25'+ '%m/%d/%Y %H:%M:%S', # '10/25/2006 14:30:59'+ '%m/%d/%Y %H:%M:%S.%f', # '10/25/2006 14:30:59.000200'+ '%m/%d/%Y %H:%M', # '10/25/2006 14:30'+ '%m/%d/%Y', # '10/25/2006'+ '%m/%d/%y %H:%M:%S', # '10/25/06 14:30:59'+ '%m/%d/%y %H:%M:%S.%f', # '10/25/06 14:30:59.000200'+ '%m/%d/%y %H:%M', # '10/25/06 14:30'+ '%m/%d/%y', # '10/25/06'+]++# First day of week, to be used on calendars+# 0 means Sunday, 1 means Monday...+FIRST_DAY_OF_WEEK = 0++# Decimal separator symbol+DECIMAL_SEPARATOR = '.'++# Boolean that sets whether to add thousand separator when formatting numbers+USE_THOUSAND_SEPARATOR = False++# Number of digits that will be together, when splitting them by+# THOUSAND_SEPARATOR. 0 means no grouping, 3 means splitting by thousands...+NUMBER_GROUPING = 0++# Thousand separator symbol+THOUSAND_SEPARATOR = ','++# The tablespaces to use for each model when not specified otherwise.+DEFAULT_TABLESPACE = ''+DEFAULT_INDEX_TABLESPACE = ''++# Default X-Frame-Options header value+X_FRAME_OPTIONS = 'SAMEORIGIN'++USE_X_FORWARDED_HOST = False+USE_X_FORWARDED_PORT = False++# The Python dotted path to the WSGI application that Django's internal server+# (runserver) will use. If `None`, the return value of+# 'django.core.wsgi.get_wsgi_application' is used, thus preserving the same+# behavior as previous versions of Django. Otherwise this should point to an+# actual WSGI application object.+WSGI_APPLICATION = None++# If your Django app is behind a proxy that sets a header to specify secure+# connections, AND that proxy ensures that user-submitted headers with the+# same name are ignored (so that people can't spoof it), set this value to+# a tuple of (header_name, header_value). For any requests that come in with+# that header/value, request.is_secure() will return True.+# WARNING! Only set this if you fully understand what you're doing. Otherwise,+# you may be opening yourself up to a security risk.+SECURE_PROXY_SSL_HEADER = None++##############+# MIDDLEWARE #+##############++# List of middleware to use. Order is important; in the request phase, these+# middleware will be applied in the order given, and in the response+# phase the middleware will be applied in reverse order.+MIDDLEWARE = []++############+# SESSIONS #+############++# Cache to store session data if using the cache session backend.+SESSION_CACHE_ALIAS = 'default'+# Cookie name. This can be whatever you want.+SESSION_COOKIE_NAME = 'sessionid'+# Age of cookie, in seconds (default: 2 weeks).+SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2+# A string like "example.com", or None for standard domain cookie.+SESSION_COOKIE_DOMAIN = None+# Whether the session cookie should be secure (https:// only).+SESSION_COOKIE_SECURE = False+# The path of the session cookie.+SESSION_COOKIE_PATH = '/'+# Whether to use the non-RFC standard httpOnly flag (IE, FF3+, others)+SESSION_COOKIE_HTTPONLY = True+# Whether to set the flag restricting cookie leaks on cross-site requests.+# This can be 'Lax', 'Strict', or None to disable the flag.+SESSION_COOKIE_SAMESITE = 'Lax'+# Whether to save the session data on every request.+SESSION_SAVE_EVERY_REQUEST = False+# Whether a user's session cookie expires when the Web browser is closed.+SESSION_EXPIRE_AT_BROWSER_CLOSE = False+# The module to store session data+SESSION_ENGINE = 'django.contrib.sessions.backends.db'+# Directory to store session files if using the file session module. If None,+# the backend will use a sensible default.+SESSION_FILE_PATH = None+# class to serialize session data+SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'++#########+# CACHE #+#########++# The cache backends to use.+CACHES = {+ 'default': {+ 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',+ }+}+CACHE_MIDDLEWARE_KEY_PREFIX = ''+CACHE_MIDDLEWARE_SECONDS = 600+CACHE_MIDDLEWARE_ALIAS = 'default'++##################+# AUTHENTICATION #+##################++AUTH_USER_MODEL = 'auth.User'++AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend']++LOGIN_URL = '/accounts/login/'++LOGIN_REDIRECT_URL = '/accounts/profile/'++LOGOUT_REDIRECT_URL = None++# The number of days a password reset link is valid for+PASSWORD_RESET_TIMEOUT_DAYS = 3++# the first hasher in this list is the preferred algorithm. any+# password using different algorithms will be converted automatically+# upon login+PASSWORD_HASHERS = [+ 'django.contrib.auth.hashers.PBKDF2PasswordHasher',+ 'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',+ 'django.contrib.auth.hashers.Argon2PasswordHasher',+ 'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',+]++AUTH_PASSWORD_VALIDATORS = []++###########+# SIGNING #+###########++SIGNING_BACKEND = 'django.core.signing.TimestampSigner'++########+# CSRF #+########++# Dotted path to callable to be used as view when a request is+# rejected by the CSRF middleware.+CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'++# Settings for CSRF cookie.+CSRF_COOKIE_NAME = 'csrftoken'+CSRF_COOKIE_AGE = 60 * 60 * 24 * 7 * 52+CSRF_COOKIE_DOMAIN = None+CSRF_COOKIE_PATH = '/'+CSRF_COOKIE_SECURE = False+CSRF_COOKIE_HTTPONLY = False+CSRF_COOKIE_SAMESITE = 'Lax'+CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN'+CSRF_TRUSTED_ORIGINS = []+CSRF_USE_SESSIONS = False++############+# MESSAGES #+############++# Class to use as messages backend+MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'++# Default values of MESSAGE_LEVEL and MESSAGE_TAGS are defined within+# django.contrib.messages to avoid imports in this settings file.++###########+# LOGGING #+###########++# The callable to use to configure logging+LOGGING_CONFIG = 'logging.config.dictConfig'++# Custom logging configuration.+LOGGING = {}++# Default exception reporter filter class used in case none has been+# specifically assigned to the HttpRequest instance.+DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter'++###########+# TESTING #+###########++# The name of the class to use to run the test suite+TEST_RUNNER = 'django.test.runner.DiscoverRunner'++# Apps that don't need to be serialized at test database creation time+# (only apps with migrations are to start with)+TEST_NON_SERIALIZED_APPS = []++############+# FIXTURES #+############++# The list of directories to search for fixtures+FIXTURE_DIRS = []++###############+# STATICFILES #+###############++# A list of locations of additional static files+STATICFILES_DIRS = []++# The default file storage backend used during the build process+STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'++# List of finder classes that know how to find static files in+# various locations.+STATICFILES_FINDERS = [+ 'django.contrib.staticfiles.finders.FileSystemFinder',+ 'django.contrib.staticfiles.finders.AppDirectoriesFinder',+ # 'django.contrib.staticfiles.finders.DefaultStorageFinder',+]++##############+# MIGRATIONS #+##############++# Migration module overrides for apps, by app label.+MIGRATION_MODULES = {}++#################+# SYSTEM CHECKS #+#################++# List of all issues generated by system checks that should be silenced. Light+# issues like warnings, infos or debugs will not generate a message. Silencing+# serious issues like errors and criticals does not result in hiding the+# message, but Django will not stop you from e.g. running server.+SILENCED_SYSTEM_CHECKS = []++#######################+# SECURITY MIDDLEWARE #+#######################+SECURE_BROWSER_XSS_FILTER = False+SECURE_CONTENT_TYPE_NOSNIFF = False+SECURE_HSTS_INCLUDE_SUBDOMAINS = False+SECURE_HSTS_PRELOAD = False+SECURE_HSTS_SECONDS = 0+SECURE_REDIRECT_EXEMPT = []+SECURE_SSL_HOST = None+SECURE_SSL_REDIRECT = Falsediff --git a/django/conf/global_settings.py b/django/conf/global_settings.pyindex acee9887d2..bdeec80610 100644--- a/django/conf/global_settings.py+++ b/django/conf/global_settings.py@@ -304,7 +304,7 @@ FILE_UPLOAD_TEMP_DIR = None # The numeric mode to set newly-uploaded files to. The value should be a mode # you'd pass directly to os.chmod; see https://docs.python.org/library/os.html#files-and-directories.-FILE_UPLOAD_PERMISSIONS = None+FILE_UPLOAD_PERMISSIONS = 0o644 # The numeric mode to assign to newly-created directories, when uploading files. # The value should be a mode as you'd pass to os.chmod;123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127{ "django__django-10914": { "patch_is_None": false, "patch_exists": true, "patch_successfully_applied": true, "resolved": true, "tests_status": { "FAIL_TO_PASS": { "success": [ "test_override_file_upload_permissions (test_utils.tests.OverrideSettingsTests)" ], "failure": [] }, "PASS_TO_PASS": { "success": [ "test_allowed_database_chunked_cursor_queries (test_utils.tests.AllowedDatabaseQueriesTests)", "test_allowed_database_queries (test_utils.tests.AllowedDatabaseQueriesTests)", "test_skip_if_db_feature (test_utils.tests.SkippingTestCase)", "test_skip_unless_db_feature (test_utils.tests.SkippingTestCase)", "test_equal_parsing_errors (test_utils.tests.JSONEqualTests)", "test_not_equal_parsing_errors (test_utils.tests.JSONEqualTests)", "test_simple_equal (test_utils.tests.JSONEqualTests)", "test_simple_equal_raise (test_utils.tests.JSONEqualTests)", "test_simple_equal_unordered (test_utils.tests.JSONEqualTests)", "test_simple_not_equal (test_utils.tests.JSONEqualTests)", "test_simple_not_equal_raise (test_utils.tests.JSONEqualTests)", "test_assert_raises_message (test_utils.tests.AssertRaisesMsgTest)", "assertRaisesMessage shouldn't interpret RE special chars.", "test_failure_in_setUpTestData_should_rollback_transaction (test_utils.tests.TestBadSetUpTestData)", "test_all (test_utils.tests.DatabaseAliasTests)", "test_close_match (test_utils.tests.DatabaseAliasTests)", "test_match (test_utils.tests.DatabaseAliasTests)", "test_no_close_match (test_utils.tests.DatabaseAliasTests)", "test_missing_default_databases (test_utils.tests.SkippingClassTestCase)", "test_skip_class_unless_db_feature (test_utils.tests.SkippingClassTestCase)", "test_ordered (test_utils.tests.AssertQuerysetEqualTests)", "test_repeated_values (test_utils.tests.AssertQuerysetEqualTests)", "test_transform (test_utils.tests.AssertQuerysetEqualTests)", "test_undefined_order (test_utils.tests.AssertQuerysetEqualTests)", "test_unordered (test_utils.tests.AssertQuerysetEqualTests)", "test_disallowed_database_chunked_cursor_queries (test_utils.tests.DisallowedDatabaseQueriesTests)", "test_disallowed_database_connections (test_utils.tests.DisallowedDatabaseQueriesTests)", "test_disallowed_database_queries (test_utils.tests.DisallowedDatabaseQueriesTests)", "test_equal (test_utils.tests.AssertURLEqualTests)", "test_message (test_utils.tests.AssertURLEqualTests)", "test_msg_prefix (test_utils.tests.AssertURLEqualTests)", "test_not_equal (test_utils.tests.AssertURLEqualTests)", "test_allowed_hosts (test_utils.tests.SetupTestEnvironmentTests)", "test_setup_test_environment_calling_more_than_once (test_utils.tests.SetupTestEnvironmentTests)", "An exception is setUp() is reraised after disable() is called.", "test_callable (test_utils.tests.AssertWarnsMessageTests)", "test_context_manager (test_utils.tests.AssertWarnsMessageTests)", "test_context_manager_failure (test_utils.tests.AssertWarnsMessageTests)", "test_special_re_chars (test_utils.tests.AssertWarnsMessageTests)", "test_comment_root (test_utils.tests.XMLEqualTests)", "test_parsing_errors (test_utils.tests.XMLEqualTests)", "test_simple_equal (test_utils.tests.XMLEqualTests)", "test_simple_equal_raise (test_utils.tests.XMLEqualTests)", "test_simple_equal_raises_message (test_utils.tests.XMLEqualTests)", "test_simple_equal_unordered (test_utils.tests.XMLEqualTests)", "test_simple_equal_with_leading_or_trailing_whitespace (test_utils.tests.XMLEqualTests)", "test_simple_not_equal (test_utils.tests.XMLEqualTests)", "test_simple_not_equal_raise (test_utils.tests.XMLEqualTests)", "test_simple_not_equal_with_whitespace_in_the_middle (test_utils.tests.XMLEqualTests)", "test_attributes (test_utils.tests.HTMLEqualTests)", "test_complex_examples (test_utils.tests.HTMLEqualTests)", "test_contains_html (test_utils.tests.HTMLEqualTests)", "test_count (test_utils.tests.HTMLEqualTests)", "test_html_contain (test_utils.tests.HTMLEqualTests)", "test_html_parser (test_utils.tests.HTMLEqualTests)", "test_ignore_comments (test_utils.tests.HTMLEqualTests)", "test_parse_html_in_script (test_utils.tests.HTMLEqualTests)", "test_parsing_errors (test_utils.tests.HTMLEqualTests)", "test_self_closing_tags (test_utils.tests.HTMLEqualTests)", "test_simple_equal_html (test_utils.tests.HTMLEqualTests)", "test_unequal_html (test_utils.tests.HTMLEqualTests)", "test_unicode_handling (test_utils.tests.HTMLEqualTests)", "test_assert_field_output (test_utils.tests.AssertFieldOutputTests)", "test_custom_required_message (test_utils.tests.AssertFieldOutputTests)", "test_class_decoration (test_utils.tests.IsolatedAppsTests)", "test_context_manager (test_utils.tests.IsolatedAppsTests)", "test_installed_apps (test_utils.tests.IsolatedAppsTests)", "test_method_decoration (test_utils.tests.IsolatedAppsTests)", "test_nested (test_utils.tests.IsolatedAppsTests)", "test_ignores_connection_configuration_queries (test_utils.tests.AssertNumQueriesUponConnectionTests)", "test_override_database_routers (test_utils.tests.OverrideSettingsTests)", "test_override_file_upload_directory_permissions (test_utils.tests.OverrideSettingsTests)", "test_override_media_root (test_utils.tests.OverrideSettingsTests)", "test_override_media_url (test_utils.tests.OverrideSettingsTests)", "test_override_static_root (test_utils.tests.OverrideSettingsTests)", "test_override_static_url (test_utils.tests.OverrideSettingsTests)", "test_override_staticfiles_dirs (test_utils.tests.OverrideSettingsTests)", "test_override_staticfiles_finders (test_utils.tests.OverrideSettingsTests)", "test_override_staticfiles_storage (test_utils.tests.OverrideSettingsTests)", "test_urlconf_cache (test_utils.tests.OverrideSettingsTests)", "test_urlconf_first (test_utils.tests.OverrideSettingsTests)", "test_urlconf_second (test_utils.tests.OverrideSettingsTests)", "test_failure (test_utils.tests.AssertNumQueriesContextManagerTests)", "test_simple (test_utils.tests.AssertNumQueriesContextManagerTests)", "test_with_client (test_utils.tests.AssertNumQueriesContextManagerTests)", "test_assert_used_on_http_response (test_utils.tests.AssertTemplateUsedContextManagerTests)", "test_error_message (test_utils.tests.AssertTemplateUsedContextManagerTests)", "test_failure (test_utils.tests.AssertTemplateUsedContextManagerTests)", "test_nested_usage (test_utils.tests.AssertTemplateUsedContextManagerTests)", "test_not_used (test_utils.tests.AssertTemplateUsedContextManagerTests)", "test_usage (test_utils.tests.AssertTemplateUsedContextManagerTests)", "test_failure (test_utils.tests.CaptureQueriesContextManagerTests)", "test_nested (test_utils.tests.CaptureQueriesContextManagerTests)", "test_simple (test_utils.tests.CaptureQueriesContextManagerTests)", "test_with_client (test_utils.tests.CaptureQueriesContextManagerTests)", "test_within (test_utils.tests.CaptureQueriesContextManagerTests)", "test_assert_num_queries (test_utils.tests.AssertNumQueriesTests)", "test_assert_num_queries_with_client (test_utils.tests.AssertNumQueriesTests)" ], "failure": [] }, "FAIL_TO_FAIL": { "success": [], "failure": [] }, "PASS_TO_FAIL": { "success": [], "failure": [] } } }}123version https://git-lfs.github.com/spec/v1oid sha256:f292dc18b38c1a02538d86f46ff5a66b283c891b23cc5080eb71e6064a9aa51fsize 10604123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590+ source /opt/miniconda3/bin/activate++ _CONDA_ROOT=/opt/miniconda3++ . /opt/miniconda3/etc/profile.d/conda.sh+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ '[' -z '' ']'+++ export CONDA_SHLVL=0+++ CONDA_SHLVL=0+++ '[' -n '' ']'+++++ dirname /opt/miniconda3/bin/conda++++ dirname /opt/miniconda3/bin+++ PATH=/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export PATH+++ '[' -z '' ']'+++ PS1=++ conda activate++ local cmd=activate++ case "$cmd" in++ __conda_activate activate++ '[' -n '' ']'++ local ask_conda+++ PS1=+++ __conda_exe shell.posix activate+++ /opt/miniconda3/bin/conda shell.posix activate++ ask_conda='PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''1'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ eval 'PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''1'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+++ PS1='(base) '+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export CONDA_PREFIX=/opt/miniconda3+++ CONDA_PREFIX=/opt/miniconda3+++ export CONDA_SHLVL=1+++ CONDA_SHLVL=1+++ export CONDA_DEFAULT_ENV=base+++ CONDA_DEFAULT_ENV=base+++ export 'CONDA_PROMPT_MODIFIER=(base) '+++ CONDA_PROMPT_MODIFIER='(base) '+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ __conda_hashr++ '[' -n '' ']'++ '[' -n '' ']'++ hash -r+ conda activate testbed+ local cmd=activate+ case "$cmd" in+ __conda_activate activate testbed+ '[' -n '' ']'+ local ask_conda++ PS1='(base) '++ __conda_exe shell.posix activate testbed++ /opt/miniconda3/bin/conda shell.posix activate testbed+ ask_conda='PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''2'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_1='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+ eval 'PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''2'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_1='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ PS1='(testbed) '++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed++ CONDA_PREFIX=/opt/miniconda3/envs/testbed++ export CONDA_SHLVL=2++ CONDA_SHLVL=2++ export CONDA_DEFAULT_ENV=testbed++ CONDA_DEFAULT_ENV=testbed++ export 'CONDA_PROMPT_MODIFIER=(testbed) '++ CONDA_PROMPT_MODIFIER='(testbed) '++ export CONDA_PREFIX_1=/opt/miniconda3++ CONDA_PREFIX_1=/opt/miniconda3++ export CONDA_EXE=/opt/miniconda3/bin/conda++ CONDA_EXE=/opt/miniconda3/bin/conda++ export _CE_M=++ _CE_M=++ export _CE_CONDA=++ _CE_CONDA=++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+ __conda_hashr+ '[' -n '' ']'+ '[' -n '' ']'+ hash -r+ cd /testbed+ sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen+ locale-genGenerating locales (this might take a while)... en_US.UTF-8... doneGeneration complete.+ export LANG=en_US.UTF-8+ LANG=en_US.UTF-8+ export LANGUAGE=en_US:en+ LANGUAGE=en_US:en+ export LC_ALL=en_US.UTF-8+ LC_ALL=en_US.UTF-8+ git config --global --add safe.directory /testbed+ cd /testbed+ git status+ git showOn branch mainChanges not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: django/conf/global_settings.py
Untracked files: (use "git add <file>..." to include in what will be committed) django/conf/.backup.global_settings.py
no changes added to commit (use "git add" and/or "git commit -a")commit e7fd69d051eaa67cb17f172a39b57253e9cb831aAuthor: Tim Graham <timograham@gmail.com>Date: Thu Feb 7 19:10:34 2019 -0500
Fixed #30166 -- Dropped support for GDAL 1.11.
diff --git a/django/contrib/gis/gdal/geometries.py b/django/contrib/gis/gdal/geometries.pyindex 6bc5df53cf..a3a145ecd4 100644--- a/django/contrib/gis/gdal/geometries.py+++ b/django/contrib/gis/gdal/geometries.py@@ -46,7 +46,6 @@ from django.contrib.gis.gdal.base import GDALBase from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope from django.contrib.gis.gdal.error import GDALException, SRSException from django.contrib.gis.gdal.geomtype import OGRGeomType-from django.contrib.gis.gdal.libgdal import GDAL_VERSION from django.contrib.gis.gdal.prototypes import geom as capi, srs as srs_api from django.contrib.gis.gdal.srs import CoordTransform, SpatialReference from django.contrib.gis.geometry import hex_regex, json_regex, wkt_regex@@ -140,14 +139,7 @@ class OGRGeometry(GDALBase): @staticmethod def _from_json(geom_input):- ptr = capi.from_json(geom_input)- if GDAL_VERSION < (2, 0):- try:- capi.get_geom_srs(ptr)- except SRSException:- srs = SpatialReference(4326)- capi.assign_srs(ptr, srs.ptr)- return ptr+ return capi.from_json(geom_input) @classmethod def from_bbox(cls, bbox):diff --git a/django/contrib/gis/gdal/libgdal.py b/django/contrib/gis/gdal/libgdal.pyindex 5232e58717..f76943625c 100644--- a/django/contrib/gis/gdal/libgdal.py+++ b/django/contrib/gis/gdal/libgdal.py@@ -20,10 +20,10 @@ if lib_path: lib_names = None elif os.name == 'nt': # Windows NT shared libraries- lib_names = ['gdal203', 'gdal202', 'gdal201', 'gdal20', 'gdal111']+ lib_names = ['gdal203', 'gdal202', 'gdal201', 'gdal20'] elif os.name == 'posix': # *NIX library names.- lib_names = ['gdal', 'GDAL', 'gdal2.3.0', 'gdal2.2.0', 'gdal2.1.0', 'gdal2.0.0', 'gdal1.11.0']+ lib_names = ['gdal', 'GDAL', 'gdal2.3.0', 'gdal2.2.0', 'gdal2.1.0', 'gdal2.0.0'] else: raise ImproperlyConfigured('GDAL is unsupported on OS "%s".' % os.name) diff --git a/django/contrib/gis/gdal/prototypes/ds.py b/django/contrib/gis/gdal/prototypes/ds.pyindex 5a10de3575..907589cf86 100644--- a/django/contrib/gis/gdal/prototypes/ds.py+++ b/django/contrib/gis/gdal/prototypes/ds.py@@ -68,8 +68,7 @@ get_field_as_datetime = int_output( ) get_field_as_double = double_output(lgdal.OGR_F_GetFieldAsDouble, [c_void_p, c_int]) get_field_as_integer = int_output(lgdal.OGR_F_GetFieldAsInteger, [c_void_p, c_int])-if GDAL_VERSION >= (2, 0):- get_field_as_integer64 = int64_output(lgdal.OGR_F_GetFieldAsInteger64, [c_void_p, c_int])+get_field_as_integer64 = int64_output(lgdal.OGR_F_GetFieldAsInteger64, [c_void_p, c_int]) if GDAL_VERSION >= (2, 2): is_field_set = bool_output(lgdal.OGR_F_IsFieldSetAndNotNull, [c_void_p, c_int]) else:diff --git a/docs/ref/contrib/gis/install/geolibs.txt b/docs/ref/contrib/gis/install/geolibs.txtindex 2ca69a1e76..8ffe864c9d 100644--- a/docs/ref/contrib/gis/install/geolibs.txt+++ b/docs/ref/contrib/gis/install/geolibs.txt@@ -10,7 +10,7 @@ Program Description Required ======================== ==================================== ================================ =================================== :doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.7, 3.6, 3.5, 3.4 `PROJ.4`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 5.2, 5.1, 5.0, 4.x-:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 2.3, 2.2, 2.1, 2.0, 1.11+:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 2.3, 2.2, 2.1, 2.0 :doc:`GeoIP <../geoip2>` IP-based geolocation library No 2 `PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 2.5, 2.4, 2.3, 2.2 `SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 4.3@@ -25,7 +25,6 @@ totally fine with GeoDjango. Your mileage may vary. GEOS 3.5.0 2015-08-15 GEOS 3.6.0 2016-10-25 GEOS 3.7.0 2018-09-10- GDAL 1.11.0 2014-04-25 GDAL 2.0.0 2015-06 GDAL 2.1.0 2016-04 GDAL 2.2.0 2017-05diff --git a/docs/releases/3.0.txt b/docs/releases/3.0.txtindex f089b1bb11..5d9bff086e 100644--- a/docs/releases/3.0.txt+++ b/docs/releases/3.0.txt@@ -229,6 +229,8 @@ backends. * Support for SpatiaLite 4.1 and 4.2 is removed. +* Support for GDAL 1.11 is removed.+ Dropped support for PostgreSQL 9.4 ---------------------------------- diff --git a/tests/gis_tests/gdal_tests/test_ds.py b/tests/gis_tests/gdal_tests/test_ds.pyindex 10ad8436b3..d462bec971 100644--- a/tests/gis_tests/gdal_tests/test_ds.py+++ b/tests/gis_tests/gdal_tests/test_ds.py@@ -3,7 +3,7 @@ import re from datetime import datetime from django.contrib.gis.gdal import (- GDAL_VERSION, DataSource, Envelope, GDALException, OGRGeometry,+ DataSource, Envelope, GDALException, OGRGeometry, ) from django.contrib.gis.gdal.field import ( OFTDateTime, OFTInteger, OFTReal, OFTString,@@ -38,7 +38,7 @@ ds_list = ( ), TestDS( 'test_vrt', ext='vrt', nfeat=3, nfld=3, geom='POINT', gtype='Point25D',- driver='OGR_VRT' if GDAL_VERSION >= (2, 0) else 'VRT',+ driver='OGR_VRT', fields={ 'POINT_X': OFTString, 'POINT_Y': OFTString,diff --git a/tests/gis_tests/inspectapp/tests.py b/tests/gis_tests/inspectapp/tests.pyindex 431818ebfd..35fedf8eb6 100644--- a/tests/gis_tests/inspectapp/tests.py+++ b/tests/gis_tests/inspectapp/tests.py@@ -74,7 +74,7 @@ class OGRInspectTest(SimpleTestCase): '', 'class MyModel(models.Model):', ' float = models.FloatField()',- ' int = models.{}()'.format('BigIntegerField' if GDAL_VERSION >= (2, 0) else 'FloatField'),+ ' int = models.BigIntegerField()', ' str = models.CharField(max_length=80)', ' geom = models.PolygonField(%s)' % self.expected_srid, ]@@ -102,7 +102,7 @@ class OGRInspectTest(SimpleTestCase): '', 'class City(models.Model):', ' name = models.CharField(max_length=80)',- ' population = models.{}()'.format('BigIntegerField' if GDAL_VERSION >= (2, 0) else 'FloatField'),+ ' population = models.BigIntegerField()', ' density = models.FloatField()', ' created = models.DateField()', ' geom = models.PointField(%s)' % self.expected_srid,+ git diff e7fd69d051eaa67cb17f172a39b57253e9cb831adiff --git a/django/conf/global_settings.py b/django/conf/global_settings.pyindex acee9887d2..bdeec80610 100644--- a/django/conf/global_settings.py+++ b/django/conf/global_settings.py@@ -304,7 +304,7 @@ FILE_UPLOAD_TEMP_DIR = None # The numeric mode to set newly-uploaded files to. The value should be a mode # you'd pass directly to os.chmod; see https://docs.python.org/library/os.html#files-and-directories.-FILE_UPLOAD_PERMISSIONS = None+FILE_UPLOAD_PERMISSIONS = 0o644 # The numeric mode to assign to newly-created directories, when uploading files. # The value should be a mode as you'd pass to os.chmod;+ source /opt/miniconda3/bin/activate++ _CONDA_ROOT=/opt/miniconda3++ . /opt/miniconda3/etc/profile.d/conda.sh+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ '[' -z x ']'++ conda activate++ local cmd=activate++ case "$cmd" in++ __conda_activate activate++ '[' -n '' ']'++ local ask_conda+++ PS1='(testbed) '+++ __conda_exe shell.posix activate+++ /opt/miniconda3/bin/conda shell.posix activate++ ask_conda='PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''3'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ eval 'PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''3'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+++ PS1='(base) '+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export CONDA_PREFIX=/opt/miniconda3+++ CONDA_PREFIX=/opt/miniconda3+++ export CONDA_SHLVL=3+++ CONDA_SHLVL=3+++ export CONDA_DEFAULT_ENV=base+++ CONDA_DEFAULT_ENV=base+++ export 'CONDA_PROMPT_MODIFIER=(base) '+++ CONDA_PROMPT_MODIFIER='(base) '+++ export CONDA_PREFIX_2=/opt/miniconda3/envs/testbed+++ CONDA_PREFIX_2=/opt/miniconda3/envs/testbed+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ __conda_hashr++ '[' -n '' ']'++ '[' -n '' ']'++ hash -r+ conda activate testbed+ local cmd=activate+ case "$cmd" in+ __conda_activate activate testbed+ '[' -n '' ']'+ local ask_conda++ PS1='(base) '++ __conda_exe shell.posix activate testbed++ /opt/miniconda3/bin/conda shell.posix activate testbed+ ask_conda='PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''4'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_3='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+ eval 'PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''4'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_3='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ PS1='(testbed) '++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed++ CONDA_PREFIX=/opt/miniconda3/envs/testbed++ export CONDA_SHLVL=4++ CONDA_SHLVL=4++ export CONDA_DEFAULT_ENV=testbed++ CONDA_DEFAULT_ENV=testbed++ export 'CONDA_PROMPT_MODIFIER=(testbed) '++ CONDA_PROMPT_MODIFIER='(testbed) '++ export CONDA_PREFIX_3=/opt/miniconda3++ CONDA_PREFIX_3=/opt/miniconda3++ export CONDA_EXE=/opt/miniconda3/bin/conda++ CONDA_EXE=/opt/miniconda3/bin/conda++ export _CE_M=++ _CE_M=++ export _CE_CONDA=++ _CE_CONDA=++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+ __conda_hashr+ '[' -n '' ']'+ '[' -n '' ']'+ hash -r+ python -m pip install -e .Obtaining file:///testbedRequirement already satisfied: pytz in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from Django==3.0.dev20190208190805) (2024.1)Requirement already satisfied: sqlparse in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from Django==3.0.dev20190208190805) (0.4.4)Installing collected packages: Django Attempting uninstall: Django Found existing installation: Django 3.0.dev20190208190805 Uninstalling Django-3.0.dev20190208190805: Successfully uninstalled Django-3.0.dev20190208190805 Running setup.py develop for DjangoSuccessfully installed Django-3.0.dev20190208190805WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv+ git checkout e7fd69d051eaa67cb17f172a39b57253e9cb831a tests/test_utils/tests.pyUpdated 0 paths from 7960b600c1+ git apply -v -Checking patch tests/test_utils/tests.py...Applied patch tests/test_utils/tests.py cleanly.+ ./tests/runtests.py --verbosity 2 --settings=test_sqlite --parallel 1 test_utils.testsCreating test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')…test_failure (test_utils.tests.AssertNumQueriesContextManagerTests) ... oktest_simple (test_utils.tests.AssertNumQueriesContextManagerTests) ... oktest_with_client (test_utils.tests.AssertNumQueriesContextManagerTests) ... oktest_assert_num_queries (test_utils.tests.AssertNumQueriesTests) ... oktest_assert_num_queries_with_client (test_utils.tests.AssertNumQueriesTests) ... oktest_ordered (test_utils.tests.AssertQuerysetEqualTests) ... oktest_repeated_values (test_utils.tests.AssertQuerysetEqualTests) ... oktest_transform (test_utils.tests.AssertQuerysetEqualTests) ... oktest_undefined_order (test_utils.tests.AssertQuerysetEqualTests) ... oktest_unordered (test_utils.tests.AssertQuerysetEqualTests) ... oktest_failure (test_utils.tests.CaptureQueriesContextManagerTests) ... oktest_nested (test_utils.tests.CaptureQueriesContextManagerTests) ... oktest_simple (test_utils.tests.CaptureQueriesContextManagerTests) ... oktest_with_client (test_utils.tests.CaptureQueriesContextManagerTests) ... oktest_within (test_utils.tests.CaptureQueriesContextManagerTests) ... oktest_missing_default_databases (test_utils.tests.SkippingClassTestCase) ... oktest_skip_class_unless_db_feature (test_utils.tests.SkippingClassTestCase) ... oktest_fixtures_are_skipped (test_utils.tests.SkippingExtraTests) ... skipped 'Fixture loading should not be performed for skipped tests.'test_failure_in_setUpTestData_should_rollback_transaction (test_utils.tests.TestBadSetUpTestData) ... oktest_allowed_database_chunked_cursor_queries (test_utils.tests.AllowedDatabaseQueriesTests) ... oktest_allowed_database_queries (test_utils.tests.AllowedDatabaseQueriesTests) ... oktest_assert_field_output (test_utils.tests.AssertFieldOutputTests) ... oktest_custom_required_message (test_utils.tests.AssertFieldOutputTests) ... oktest_ignores_connection_configuration_queries (test_utils.tests.AssertNumQueriesUponConnectionTests) ... oktest_assert_raises_message (test_utils.tests.AssertRaisesMsgTest) ... oktest_special_re_chars (test_utils.tests.AssertRaisesMsgTest)assertRaisesMessage shouldn't interpret RE special chars. ... oktest_assert_used_on_http_response (test_utils.tests.AssertTemplateUsedContextManagerTests) ... oktest_error_message (test_utils.tests.AssertTemplateUsedContextManagerTests) ... oktest_failure (test_utils.tests.AssertTemplateUsedContextManagerTests) ... oktest_nested_usage (test_utils.tests.AssertTemplateUsedContextManagerTests) ... oktest_not_used (test_utils.tests.AssertTemplateUsedContextManagerTests) ... oktest_usage (test_utils.tests.AssertTemplateUsedContextManagerTests) ... oktest_equal (test_utils.tests.AssertURLEqualTests) ... oktest_message (test_utils.tests.AssertURLEqualTests) ... oktest_msg_prefix (test_utils.tests.AssertURLEqualTests) ... oktest_not_equal (test_utils.tests.AssertURLEqualTests) ... oktest_callable (test_utils.tests.AssertWarnsMessageTests) ... oktest_context_manager (test_utils.tests.AssertWarnsMessageTests) ... oktest_context_manager_failure (test_utils.tests.AssertWarnsMessageTests) ... oktest_special_re_chars (test_utils.tests.AssertWarnsMessageTests) ... oktest_all (test_utils.tests.DatabaseAliasTests) ... oktest_close_match (test_utils.tests.DatabaseAliasTests) ... oktest_match (test_utils.tests.DatabaseAliasTests) ... oktest_no_close_match (test_utils.tests.DatabaseAliasTests) ... oktest_disallowed_database_chunked_cursor_queries (test_utils.tests.DisallowedDatabaseQueriesTests) ... oktest_disallowed_database_connections (test_utils.tests.DisallowedDatabaseQueriesTests) ... oktest_disallowed_database_queries (test_utils.tests.DisallowedDatabaseQueriesTests) ... oktest_attributes (test_utils.tests.HTMLEqualTests) ... oktest_complex_examples (test_utils.tests.HTMLEqualTests) ... oktest_contains_html (test_utils.tests.HTMLEqualTests) ... oktest_count (test_utils.tests.HTMLEqualTests) ... oktest_html_contain (test_utils.tests.HTMLEqualTests) ... oktest_html_parser (test_utils.tests.HTMLEqualTests) ... oktest_ignore_comments (test_utils.tests.HTMLEqualTests) ... oktest_parse_html_in_script (test_utils.tests.HTMLEqualTests) ... oktest_parsing_errors (test_utils.tests.HTMLEqualTests) ... oktest_self_closing_tags (test_utils.tests.HTMLEqualTests) ... oktest_simple_equal_html (test_utils.tests.HTMLEqualTests) ... oktest_unequal_html (test_utils.tests.HTMLEqualTests) ... oktest_unicode_handling (test_utils.tests.HTMLEqualTests) ... oktest_class_decoration (test_utils.tests.IsolatedAppsTests) ... oktest_context_manager (test_utils.tests.IsolatedAppsTests) ... oktest_installed_apps (test_utils.tests.IsolatedAppsTests) ... oktest_method_decoration (test_utils.tests.IsolatedAppsTests) ... oktest_nested (test_utils.tests.IsolatedAppsTests) ... oktest_equal_parsing_errors (test_utils.tests.JSONEqualTests) ... oktest_not_equal_parsing_errors (test_utils.tests.JSONEqualTests) ... oktest_simple_equal (test_utils.tests.JSONEqualTests) ... oktest_simple_equal_raise (test_utils.tests.JSONEqualTests) ... oktest_simple_equal_unordered (test_utils.tests.JSONEqualTests) ... oktest_simple_not_equal (test_utils.tests.JSONEqualTests) ... oktest_simple_not_equal_raise (test_utils.tests.JSONEqualTests) ... oktest_override_database_routers (test_utils.tests.OverrideSettingsTests) ... oktest_override_file_upload_directory_permissions (test_utils.tests.OverrideSettingsTests) ... oktest_override_file_upload_permissions (test_utils.tests.OverrideSettingsTests) ... oktest_override_media_root (test_utils.tests.OverrideSettingsTests) ... oktest_override_media_url (test_utils.tests.OverrideSettingsTests) ... oktest_override_static_root (test_utils.tests.OverrideSettingsTests) ... oktest_override_static_url (test_utils.tests.OverrideSettingsTests) ... oktest_override_staticfiles_dirs (test_utils.tests.OverrideSettingsTests) ... oktest_override_staticfiles_finders (test_utils.tests.OverrideSettingsTests) ... oktest_override_staticfiles_storage (test_utils.tests.OverrideSettingsTests) ... oktest_urlconf_cache (test_utils.tests.OverrideSettingsTests) ... oktest_urlconf_first (test_utils.tests.OverrideSettingsTests) ... oktest_urlconf_second (test_utils.tests.OverrideSettingsTests) ... oktest_allowed_hosts (test_utils.tests.SetupTestEnvironmentTests) ... oktest_setup_test_environment_calling_more_than_once (test_utils.tests.SetupTestEnvironmentTests) ... oktest_skip_if_db_feature (test_utils.tests.SkippingTestCase) ... oktest_skip_unless_db_feature (test_utils.tests.SkippingTestCase) ... oktest_exception_in_setup (test_utils.tests.TestContextDecoratorTests)An exception is setUp() is reraised after disable() is called. ... oktest_comment_root (test_utils.tests.XMLEqualTests) ... oktest_parsing_errors (test_utils.tests.XMLEqualTests) ... oktest_simple_equal (test_utils.tests.XMLEqualTests) ... oktest_simple_equal_raise (test_utils.tests.XMLEqualTests) ... oktest_simple_equal_raises_message (test_utils.tests.XMLEqualTests) ... oktest_simple_equal_unordered (test_utils.tests.XMLEqualTests) ... oktest_simple_equal_with_leading_or_trailing_whitespace (test_utils.tests.XMLEqualTests) ... oktest_simple_not_equal (test_utils.tests.XMLEqualTests) ... oktest_simple_not_equal_raise (test_utils.tests.XMLEqualTests) ... oktest_simple_not_equal_with_whitespace_in_the_middle (test_utils.tests.XMLEqualTests) ... Testing against Django installed in '/testbed/django'Importing application test_utilsSkipping setup of unused database(s): other.Operations to perform: Synchronize unmigrated apps: auth, contenttypes, messages, sessions, staticfiles, test_utils Apply all migrations: admin, sitesSynchronizing apps without migrations: Creating tables… Creating table django_content_type Creating table auth_permission Creating table auth_group Creating table auth_user Creating table django_session Creating table test_utils_car Creating table test_utils_person Creating table test_utils_possessedcar Running deferred SQL…Running migrations: Applying admin.0001_initial… OK Applying admin.0002_logentry_remove_auto_add… OK Applying admin.0003_logentry_add_action_flag_choices… OK Applying sites.0001_initial… OK Applying sites.0002_alter_domain_unique… OKSystem check identified no issues (0 silenced).ok
----------------------------------------------------------------------Ran 100 tests in 0.095s
OK (skipped=1)Destroying test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')…+ git checkout e7fd69d051eaa67cb17f172a39b57253e9cb831a tests/test_utils/tests.pyUpdated 1 path from 7960b600c11234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950#!/bin/bashset -uxo pipefailsource /opt/miniconda3/bin/activateconda activate testbedcd /testbedsed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-genexport LANG=en_US.UTF-8export LANGUAGE=en_US:enexport LC_ALL=en_US.UTF-8git config --global --add safe.directory /testbedcd /testbedgit statusgit showgit diff bceadd2788dc2dad53eba0caae172bd8522fd483source /opt/miniconda3/bin/activateconda activate testbedpython -m pip install -e .git checkout bceadd2788dc2dad53eba0caae172bd8522fd483 git apply -v - <<'EOF_114329324912'diff --git a/tests/model_fields/test_filepathfield.py b/tests/model_fields/test_filepathfield.pynew file mode 100644--- /dev/null+++ b/tests/model_fields/test_filepathfield.py@@ -0,0 +1,22 @@+import os++from django.db.models import FilePathField+from django.test import SimpleTestCase+++class FilePathFieldTests(SimpleTestCase):+ def test_path(self):+ path = os.path.dirname(__file__)+ field = FilePathField(path=path)+ self.assertEqual(field.path, path)+ self.assertEqual(field.formfield().path, path)++ def test_callable_path(self):+ path = os.path.dirname(__file__)++ def generate_path():+ return path++ field = FilePathField(path=generate_path)+ self.assertEqual(field.path(), path)+ self.assertEqual(field.formfield().path, path)
EOF_114329324912./tests/runtests.py --verbosity 2 --settings=test_sqlite --parallel 1 model_fields.test_filepathfieldgit checkout bceadd2788dc2dad53eba0caae172bd8522fd483 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409diff --git a/django/db/models/fields/.backup.__init__.py b/django/db/models/fields/.backup.__init__.pynew file mode 100644index 0000000000..fbff5c5fe3--- /dev/null+++ b/django/db/models/fields/.backup.__init__.py@@ -0,0 +1,2370 @@+import collections.abc+import copy+import datetime+import decimal+import operator+import uuid+import warnings+from base64 import b64decode, b64encode+from functools import partialmethod, total_ordering++from django import forms+from django.apps import apps+from django.conf import settings+from django.core import checks, exceptions, validators+# When the _meta object was formalized, this exception was moved to+# django.core.exceptions. It is retained here for backwards compatibility+# purposes.+from django.core.exceptions import FieldDoesNotExist # NOQA+from django.db import connection, connections, router+from django.db.models.constants import LOOKUP_SEP+from django.db.models.query_utils import DeferredAttribute, RegisterLookupMixin+from django.utils import timezone+from django.utils.datastructures import DictWrapper+from django.utils.dateparse import (+ parse_date, parse_datetime, parse_duration, parse_time,+)+from django.utils.duration import duration_microseconds, duration_string+from django.utils.functional import Promise, cached_property+from django.utils.ipv6 import clean_ipv6_address+from django.utils.itercompat import is_iterable+from django.utils.text import capfirst+from django.utils.translation import gettext_lazy as _++__all__ = [+ 'AutoField', 'BLANK_CHOICE_DASH', 'BigAutoField', 'BigIntegerField',+ 'BinaryField', 'BooleanField', 'CharField', 'CommaSeparatedIntegerField',+ 'DateField', 'DateTimeField', 'DecimalField', 'DurationField',+ 'EmailField', 'Empty', 'Field', 'FieldDoesNotExist', 'FilePathField',+ 'FloatField', 'GenericIPAddressField', 'IPAddressField', 'IntegerField',+ 'NOT_PROVIDED', 'NullBooleanField', 'PositiveIntegerField',+ 'PositiveSmallIntegerField', 'SlugField', 'SmallIntegerField', 'TextField',+ 'TimeField', 'URLField', 'UUIDField',+]+++class Empty:+ pass+++class NOT_PROVIDED:+ pass+++# The values to use for "blank" in SelectFields. Will be appended to the start+# of most "choices" lists.+BLANK_CHOICE_DASH = [("", "---------")]+++def _load_field(app_label, model_name, field_name):+ return apps.get_model(app_label, model_name)._meta.get_field(field_name)+++# A guide to Field parameters:+#+# * name: The name of the field specified in the model.+# * attname: The attribute to use on the model object. This is the same as+# "name", except in the case of ForeignKeys, where "_id" is+# appended.+# * db_column: The db_column specified in the model (or None).+# * column: The database column for this field. This is the same as+# "attname", except if db_column is specified.+#+# Code that introspects values, or does other dynamic things, should use+# attname. For example, this gets the primary key value of object "obj":+#+# getattr(obj, opts.pk.attname)++def _empty(of_cls):+ new = Empty()+ new.__class__ = of_cls+ return new+++def return_None():+ return None+++@total_ordering+class Field(RegisterLookupMixin):+ """Base class for all field types"""++ # Designates whether empty strings fundamentally are allowed at the+ # database level.+ empty_strings_allowed = True+ empty_values = list(validators.EMPTY_VALUES)++ # These track each time a Field instance is created. Used to retain order.+ # The auto_creation_counter is used for fields that Django implicitly+ # creates, creation_counter is used for all user-specified fields.+ creation_counter = 0+ auto_creation_counter = -1+ default_validators = [] # Default set of validators+ default_error_messages = {+ 'invalid_choice': _('Value %(value)r is not a valid choice.'),+ 'null': _('This field cannot be null.'),+ 'blank': _('This field cannot be blank.'),+ 'unique': _('%(model_name)s with this %(field_label)s '+ 'already exists.'),+ # Translators: The 'lookup_type' is one of 'date', 'year' or 'month'.+ # Eg: "Title must be unique for pub_date year"+ 'unique_for_date': _("%(field_label)s must be unique for "+ "%(date_field_label)s %(lookup_type)s."),+ }+ system_check_deprecated_details = None+ system_check_removed_details = None++ # Field flags+ hidden = False++ many_to_many = None+ many_to_one = None+ one_to_many = None+ one_to_one = None+ related_model = None++ # Generic field type description, usually overridden by subclasses+ def _description(self):+ return _('Field of type: %(field_type)s') % {+ 'field_type': self.__class__.__name__+ }+ description = property(_description)++ def __init__(self, verbose_name=None, name=None, primary_key=False,+ max_length=None, unique=False, blank=False, null=False,+ db_index=False, rel=None, default=NOT_PROVIDED, editable=True,+ serialize=True, unique_for_date=None, unique_for_month=None,+ unique_for_year=None, choices=None, help_text='', db_column=None,+ db_tablespace=None, auto_created=False, validators=(),+ error_messages=None):+ self.name = name+ self.verbose_name = verbose_name # May be set by set_attributes_from_name+ self._verbose_name = verbose_name # Store original for deconstruction+ self.primary_key = primary_key+ self.max_length, self._unique = max_length, unique+ self.blank, self.null = blank, null+ self.remote_field = rel+ self.is_relation = self.remote_field is not None+ self.default = default+ self.editable = editable+ self.serialize = serialize+ self.unique_for_date = unique_for_date+ self.unique_for_month = unique_for_month+ self.unique_for_year = unique_for_year+ if isinstance(choices, collections.abc.Iterator):+ choices = list(choices)+ self.choices = choices+ self.help_text = help_text+ self.db_index = db_index+ self.db_column = db_column+ self._db_tablespace = db_tablespace+ self.auto_created = auto_created++ # Adjust the appropriate creation counter, and save our local copy.+ if auto_created:+ self.creation_counter = Field.auto_creation_counter+ Field.auto_creation_counter -= 1+ else:+ self.creation_counter = Field.creation_counter+ Field.creation_counter += 1++ self._validators = list(validators) # Store for deconstruction later++ messages = {}+ for c in reversed(self.__class__.__mro__):+ messages.update(getattr(c, 'default_error_messages', {}))+ messages.update(error_messages or {})+ self._error_messages = error_messages # Store for deconstruction later+ self.error_messages = messages++ def __str__(self):+ """+ Return "app_label.model_label.field_name" for fields attached to+ models.+ """+ if not hasattr(self, 'model'):+ return super().__str__()+ model = self.model+ app = model._meta.app_label+ return '%s.%s.%s' % (app, model._meta.object_name, self.name)++ def __repr__(self):+ """Display the module, class, and name of the field."""+ path = '%s.%s' % (self.__class__.__module__, self.__class__.__qualname__)+ name = getattr(self, 'name', None)+ if name is not None:+ return '<%s: %s>' % (path, name)+ return '<%s>' % path++ def check(self, **kwargs):+ return [+ *self._check_field_name(),+ *self._check_choices(),+ *self._check_db_index(),+ *self._check_null_allowed_for_primary_keys(),+ *self._check_backend_specific_checks(**kwargs),+ *self._check_validators(),+ *self._check_deprecation_details(),+ ]++ def _check_field_name(self):+ """+ Check if field name is valid, i.e. 1) does not end with an+ underscore, 2) does not contain "__" and 3) is not "pk".+ """+ if self.name.endswith('_'):+ return [+ checks.Error(+ 'Field names must not end with an underscore.',+ obj=self,+ id='fields.E001',+ )+ ]+ elif LOOKUP_SEP in self.name:+ return [+ checks.Error(+ 'Field names must not contain "%s".' % (LOOKUP_SEP,),+ obj=self,+ id='fields.E002',+ )+ ]+ elif self.name == 'pk':+ return [+ checks.Error(+ "'pk' is a reserved word that cannot be used as a field name.",+ obj=self,+ id='fields.E003',+ )+ ]+ else:+ return []++ def _check_choices(self):+ if not self.choices:+ return []++ def is_value(value, accept_promise=True):+ return isinstance(value, (str, Promise) if accept_promise else str) or not is_iterable(value)++ if is_value(self.choices, accept_promise=False):+ return [+ checks.Error(+ "'choices' must be an iterable (e.g., a list or tuple).",+ obj=self,+ id='fields.E004',+ )+ ]++ # Expect [group_name, [value, display]]+ for choices_group in self.choices:+ try:+ group_name, group_choices = choices_group+ except (TypeError, ValueError):+ # Containing non-pairs+ break+ try:+ if not all(+ is_value(value) and is_value(human_name)+ for value, human_name in group_choices+ ):+ break+ except (TypeError, ValueError):+ # No groups, choices in the form [value, display]+ value, human_name = group_name, group_choices+ if not is_value(value) or not is_value(human_name):+ break++ # Special case: choices=['ab']+ if isinstance(choices_group, str):+ break+ else:+ return []++ return [+ checks.Error(+ "'choices' must be an iterable containing "+ "(actual value, human readable name) tuples.",+ obj=self,+ id='fields.E005',+ )+ ]++ def _check_db_index(self):+ if self.db_index not in (None, True, False):+ return [+ checks.Error(+ "'db_index' must be None, True or False.",+ obj=self,+ id='fields.E006',+ )+ ]+ else:+ return []++ def _check_null_allowed_for_primary_keys(self):+ if (self.primary_key and self.null and+ not connection.features.interprets_empty_strings_as_nulls):+ # We cannot reliably check this for backends like Oracle which+ # consider NULL and '' to be equal (and thus set up+ # character-based fields a little differently).+ return [+ checks.Error(+ 'Primary keys must not have null=True.',+ hint=('Set null=False on the field, or '+ 'remove primary_key=True argument.'),+ obj=self,+ id='fields.E007',+ )+ ]+ else:+ return []++ def _check_backend_specific_checks(self, **kwargs):+ app_label = self.model._meta.app_label+ for db in connections:+ if router.allow_migrate(db, app_label, model_name=self.model._meta.model_name):+ return connections[db].validation.check_field(self, **kwargs)+ return []++ def _check_validators(self):+ errors = []+ for i, validator in enumerate(self.validators):+ if not callable(validator):+ errors.append(+ checks.Error(+ "All 'validators' must be callable.",+ hint=(+ "validators[{i}] ({repr}) isn't a function or "+ "instance of a validator class.".format(+ i=i, repr=repr(validator),+ )+ ),+ obj=self,+ id='fields.E008',+ )+ )+ return errors++ def _check_deprecation_details(self):+ if self.system_check_removed_details is not None:+ return [+ checks.Error(+ self.system_check_removed_details.get(+ 'msg',+ '%s has been removed except for support in historical '+ 'migrations.' % self.__class__.__name__+ ),+ hint=self.system_check_removed_details.get('hint'),+ obj=self,+ id=self.system_check_removed_details.get('id', 'fields.EXXX'),+ )+ ]+ elif self.system_check_deprecated_details is not None:+ return [+ checks.Warning(+ self.system_check_deprecated_details.get(+ 'msg',+ '%s has been deprecated.' % self.__class__.__name__+ ),+ hint=self.system_check_deprecated_details.get('hint'),+ obj=self,+ id=self.system_check_deprecated_details.get('id', 'fields.WXXX'),+ )+ ]+ return []++ def get_col(self, alias, output_field=None):+ if output_field is None:+ output_field = self+ if alias != self.model._meta.db_table or output_field != self:+ from django.db.models.expressions import Col+ return Col(alias, self, output_field)+ else:+ return self.cached_col++ @cached_property+ def cached_col(self):+ from django.db.models.expressions import Col+ return Col(self.model._meta.db_table, self)++ def select_format(self, compiler, sql, params):+ """+ Custom format for select clauses. For example, GIS columns need to be+ selected as AsText(table.col) on MySQL as the table.col data can't be+ used by Django.+ """+ return sql, params++ def deconstruct(self):+ """+ Return enough information to recreate the field as a 4-tuple:++ * The name of the field on the model, if contribute_to_class() has+ been run.+ * The import path of the field, including the class:e.g.+ django.db.models.IntegerField This should be the most portable+ version, so less specific may be better.+ * A list of positional arguments.+ * A dict of keyword arguments.++ Note that the positional or keyword arguments must contain values of+ the following types (including inner values of collection types):++ * None, bool, str, int, float, complex, set, frozenset, list, tuple,+ dict+ * UUID+ * datetime.datetime (naive), datetime.date+ * top-level classes, top-level functions - will be referenced by their+ full import path+ * Storage instances - these have their own deconstruct() method++ This is because the values here must be serialized into a text format+ (possibly new Python code, possibly JSON) and these are the only types+ with encoding handlers defined.++ There's no need to return the exact way the field was instantiated this+ time, just ensure that the resulting field is the same - prefer keyword+ arguments over positional ones, and omit parameters with their default+ values.+ """+ # Short-form way of fetching all the default parameters+ keywords = {}+ possibles = {+ "verbose_name": None,+ "primary_key": False,+ "max_length": None,+ "unique": False,+ "blank": False,+ "null": False,+ "db_index": False,+ "default": NOT_PROVIDED,+ "editable": True,+ "serialize": True,+ "unique_for_date": None,+ "unique_for_month": None,+ "unique_for_year": None,+ "choices": None,+ "help_text": '',+ "db_column": None,+ "db_tablespace": None,+ "auto_created": False,+ "validators": [],+ "error_messages": None,+ }+ attr_overrides = {+ "unique": "_unique",+ "error_messages": "_error_messages",+ "validators": "_validators",+ "verbose_name": "_verbose_name",+ "db_tablespace": "_db_tablespace",+ }+ equals_comparison = {"choices", "validators"}+ for name, default in possibles.items():+ value = getattr(self, attr_overrides.get(name, name))+ # Unroll anything iterable for choices into a concrete list+ if name == "choices" and isinstance(value, collections.abc.Iterable):+ value = list(value)+ # Do correct kind of comparison+ if name in equals_comparison:+ if value != default:+ keywords[name] = value+ else:+ if value is not default:+ keywords[name] = value+ # Work out path - we shorten it for known Django core fields+ path = "%s.%s" % (self.__class__.__module__, self.__class__.__qualname__)+ if path.startswith("django.db.models.fields.related"):+ path = path.replace("django.db.models.fields.related", "django.db.models")+ if path.startswith("django.db.models.fields.files"):+ path = path.replace("django.db.models.fields.files", "django.db.models")+ if path.startswith("django.db.models.fields.proxy"):+ path = path.replace("django.db.models.fields.proxy", "django.db.models")+ if path.startswith("django.db.models.fields"):+ path = path.replace("django.db.models.fields", "django.db.models")+ # Return basic info - other fields should override this.+ return (self.name, path, [], keywords)++ def clone(self):+ """+ Uses deconstruct() to clone a new copy of this Field.+ Will not preserve any class attachments/attribute names.+ """+ name, path, args, kwargs = self.deconstruct()+ return self.__class__(*args, **kwargs)++ def __eq__(self, other):+ # Needed for @total_ordering+ if isinstance(other, Field):+ return self.creation_counter == other.creation_counter+ return NotImplemented++ def __lt__(self, other):+ # This is needed because bisect does not take a comparison function.+ if isinstance(other, Field):+ return self.creation_counter < other.creation_counter+ return NotImplemented++ def __hash__(self):+ return hash(self.creation_counter)++ def __deepcopy__(self, memodict):+ # We don't have to deepcopy very much here, since most things are not+ # intended to be altered after initial creation.+ obj = copy.copy(self)+ if self.remote_field:+ obj.remote_field = copy.copy(self.remote_field)+ if hasattr(self.remote_field, 'field') and self.remote_field.field is self:+ obj.remote_field.field = obj+ memodict[id(self)] = obj+ return obj++ def __copy__(self):+ # We need to avoid hitting __reduce__, so define this+ # slightly weird copy construct.+ obj = Empty()+ obj.__class__ = self.__class__+ obj.__dict__ = self.__dict__.copy()+ return obj++ def __reduce__(self):+ """+ Pickling should return the model._meta.fields instance of the field,+ not a new copy of that field. So, use the app registry to load the+ model and then the field back.+ """+ if not hasattr(self, 'model'):+ # Fields are sometimes used without attaching them to models (for+ # example in aggregation). In this case give back a plain field+ # instance. The code below will create a new empty instance of+ # class self.__class__, then update its dict with self.__dict__+ # values - so, this is very close to normal pickle.+ state = self.__dict__.copy()+ # The _get_default cached_property can't be pickled due to lambda+ # usage.+ state.pop('_get_default', None)+ return _empty, (self.__class__,), state+ return _load_field, (self.model._meta.app_label, self.model._meta.object_name,+ self.name)++ def get_pk_value_on_save(self, instance):+ """+ Hook to generate new PK values on save. This method is called when+ saving instances with no primary key value set. If this method returns+ something else than None, then the returned value is used when saving+ the new instance.+ """+ if self.default:+ return self.get_default()+ return None++ def to_python(self, value):+ """+ Convert the input value into the expected Python data type, raising+ django.core.exceptions.ValidationError if the data can't be converted.+ Return the converted value. Subclasses should override this.+ """+ return value++ @cached_property+ def validators(self):+ """+ Some validators can't be created at field initialization time.+ This method provides a way to delay their creation until required.+ """+ return [*self.default_validators, *self._validators]++ def run_validators(self, value):+ if value in self.empty_values:+ return++ errors = []+ for v in self.validators:+ try:+ v(value)+ except exceptions.ValidationError as e:+ if hasattr(e, 'code') and e.code in self.error_messages:+ e.message = self.error_messages[e.code]+ errors.extend(e.error_list)++ if errors:+ raise exceptions.ValidationError(errors)++ def validate(self, value, model_instance):+ """+ Validate value and raise ValidationError if necessary. Subclasses+ should override this to provide validation logic.+ """+ if not self.editable:+ # Skip validation for non-editable fields.+ return++ if self.choices is not None and value not in self.empty_values:+ for option_key, option_value in self.choices:+ if isinstance(option_value, (list, tuple)):+ # This is an optgroup, so look inside the group for+ # options.+ for optgroup_key, optgroup_value in option_value:+ if value == optgroup_key:+ return+ elif value == option_key:+ return+ raise exceptions.ValidationError(+ self.error_messages['invalid_choice'],+ code='invalid_choice',+ params={'value': value},+ )++ if value is None and not self.null:+ raise exceptions.ValidationError(self.error_messages['null'], code='null')++ if not self.blank and value in self.empty_values:+ raise exceptions.ValidationError(self.error_messages['blank'], code='blank')++ def clean(self, value, model_instance):+ """+ Convert the value's type and run validation. Validation errors+ from to_python() and validate() are propagated. Return the correct+ value if no error is raised.+ """+ value = self.to_python(value)+ self.validate(value, model_instance)+ self.run_validators(value)+ return value++ def db_type_parameters(self, connection):+ return DictWrapper(self.__dict__, connection.ops.quote_name, 'qn_')++ def db_check(self, connection):+ """+ Return the database column check constraint for this field, for the+ provided connection. Works the same way as db_type() for the case that+ get_internal_type() does not map to a preexisting model field.+ """+ data = self.db_type_parameters(connection)+ try:+ return connection.data_type_check_constraints[self.get_internal_type()] % data+ except KeyError:+ return None++ def db_type(self, connection):+ """+ Return the database column data type for this field, for the provided+ connection.+ """+ # The default implementation of this method looks at the+ # backend-specific data_types dictionary, looking up the field by its+ # "internal type".+ #+ # A Field class can implement the get_internal_type() method to specify+ # which *preexisting* Django Field class it's most similar to -- i.e.,+ # a custom field might be represented by a TEXT column type, which is+ # the same as the TextField Django field type, which means the custom+ # field's get_internal_type() returns 'TextField'.+ #+ # But the limitation of the get_internal_type() / data_types approach+ # is that it cannot handle database column types that aren't already+ # mapped to one of the built-in Django field types. In this case, you+ # can implement db_type() instead of get_internal_type() to specify+ # exactly which wacky database column type you want to use.+ data = self.db_type_parameters(connection)+ try:+ return connection.data_types[self.get_internal_type()] % data+ except KeyError:+ return None++ def rel_db_type(self, connection):+ """+ Return the data type that a related field pointing to this field should+ use. For example, this method is called by ForeignKey and OneToOneField+ to determine its data type.+ """+ return self.db_type(connection)++ def cast_db_type(self, connection):+ """Return the data type to use in the Cast() function."""+ db_type = connection.ops.cast_data_types.get(self.get_internal_type())+ if db_type:+ return db_type % self.db_type_parameters(connection)+ return self.db_type(connection)++ def db_parameters(self, connection):+ """+ Extension of db_type(), providing a range of different return values+ (type, checks). This will look at db_type(), allowing custom model+ fields to override it.+ """+ type_string = self.db_type(connection)+ check_string = self.db_check(connection)+ return {+ "type": type_string,+ "check": check_string,+ }++ def db_type_suffix(self, connection):+ return connection.data_types_suffix.get(self.get_internal_type())++ def get_db_converters(self, connection):+ if hasattr(self, 'from_db_value'):+ return [self.from_db_value]+ return []++ @property+ def unique(self):+ return self._unique or self.primary_key++ @property+ def db_tablespace(self):+ return self._db_tablespace or settings.DEFAULT_INDEX_TABLESPACE++ def set_attributes_from_name(self, name):+ self.name = self.name or name+ self.attname, self.column = self.get_attname_column()+ self.concrete = self.column is not None+ if self.verbose_name is None and self.name:+ self.verbose_name = self.name.replace('_', ' ')++ def contribute_to_class(self, cls, name, private_only=False):+ """+ Register the field with the model class it belongs to.++ If private_only is True, create a separate instance of this field+ for every subclass of cls, even if cls is not an abstract model.+ """+ self.set_attributes_from_name(name)+ self.model = cls+ cls._meta.add_field(self, private=private_only)+ if self.column:+ # Don't override classmethods with the descriptor. This means that+ # if you have a classmethod and a field with the same name, then+ # such fields can't be deferred (we don't have a check for this).+ if not getattr(cls, self.attname, None):+ setattr(cls, self.attname, DeferredAttribute(self.attname))+ if self.choices is not None:+ setattr(cls, 'get_%s_display' % self.name,+ partialmethod(cls._get_FIELD_display, field=self))++ def get_filter_kwargs_for_object(self, obj):+ """+ Return a dict that when passed as kwargs to self.model.filter(), would+ yield all instances having the same value for this field as obj has.+ """+ return {self.name: getattr(obj, self.attname)}++ def get_attname(self):+ return self.name++ def get_attname_column(self):+ attname = self.get_attname()+ column = self.db_column or attname+ return attname, column++ def get_internal_type(self):+ return self.__class__.__name__++ def pre_save(self, model_instance, add):+ """Return field's value just before saving."""+ return getattr(model_instance, self.attname)++ def get_prep_value(self, value):+ """Perform preliminary non-db specific value checks and conversions."""+ if isinstance(value, Promise):+ value = value._proxy____cast()+ return value++ def get_db_prep_value(self, value, connection, prepared=False):+ """+ Return field's value prepared for interacting with the database backend.++ Used by the default implementations of get_db_prep_save().+ """+ if not prepared:+ value = self.get_prep_value(value)+ return value++ def get_db_prep_save(self, value, connection):+ """Return field's value prepared for saving into a database."""+ return self.get_db_prep_value(value, connection=connection, prepared=False)++ def has_default(self):+ """Return a boolean of whether this field has a default value."""+ return self.default is not NOT_PROVIDED++ def get_default(self):+ """Return the default value for this field."""+ return self._get_default()++ @cached_property+ def _get_default(self):+ if self.has_default():+ if callable(self.default):+ return self.default+ return lambda: self.default++ if not self.empty_strings_allowed or self.null and not connection.features.interprets_empty_strings_as_nulls:+ return return_None+ return str # return empty string++ def get_choices(self, include_blank=True, blank_choice=BLANK_CHOICE_DASH, limit_choices_to=None, ordering=()):+ """+ Return choices with a default blank choices included, for use+ as <select> choices for this field.+ """+ if self.choices is not None:+ choices = list(self.choices)+ if include_blank:+ blank_defined = any(choice in ('', None) for choice, _ in self.flatchoices)+ if not blank_defined:+ choices = blank_choice + choices+ return choices+ rel_model = self.remote_field.model+ limit_choices_to = limit_choices_to or self.get_limit_choices_to()+ choice_func = operator.attrgetter(+ self.remote_field.get_related_field().attname+ if hasattr(self.remote_field, 'get_related_field')+ else 'pk'+ )+ return (blank_choice if include_blank else []) + [+ (choice_func(x), str(x))+ for x in rel_model._default_manager.complex_filter(limit_choices_to).order_by(*ordering)+ ]++ def value_to_string(self, obj):+ """+ Return a string value of this field from the passed obj.+ This is used by the serialization framework.+ """+ return str(self.value_from_object(obj))++ def _get_flatchoices(self):+ """Flattened version of choices tuple."""+ if self.choices is None:+ return []+ flat = []+ for choice, value in self.choices:+ if isinstance(value, (list, tuple)):+ flat.extend(value)+ else:+ flat.append((choice, value))+ return flat+ flatchoices = property(_get_flatchoices)++ def save_form_data(self, instance, data):+ setattr(instance, self.name, data)++ def formfield(self, form_class=None, choices_form_class=None, **kwargs):+ """Return a django.forms.Field instance for this field."""+ defaults = {+ 'required': not self.blank,+ 'label': capfirst(self.verbose_name),+ 'help_text': self.help_text,+ }+ if self.has_default():+ if callable(self.default):+ defaults['initial'] = self.default+ defaults['show_hidden_initial'] = True+ else:+ defaults['initial'] = self.get_default()+ if self.choices is not None:+ # Fields with choices get special treatment.+ include_blank = (self.blank or+ not (self.has_default() or 'initial' in kwargs))+ defaults['choices'] = self.get_choices(include_blank=include_blank)+ defaults['coerce'] = self.to_python+ if self.null:+ defaults['empty_value'] = None+ if choices_form_class is not None:+ form_class = choices_form_class+ else:+ form_class = forms.TypedChoiceField+ # Many of the subclass-specific formfield arguments (min_value,+ # max_value) don't apply for choice fields, so be sure to only pass+ # the values that TypedChoiceField will understand.+ for k in list(kwargs):+ if k not in ('coerce', 'empty_value', 'choices', 'required',+ 'widget', 'label', 'initial', 'help_text',+ 'error_messages', 'show_hidden_initial', 'disabled'):+ del kwargs[k]+ defaults.update(kwargs)+ if form_class is None:+ form_class = forms.CharField+ return form_class(**defaults)++ def value_from_object(self, obj):+ """Return the value of this field in the given model instance."""+ return getattr(obj, self.attname)+++class AutoField(Field):+ description = _("Integer")++ empty_strings_allowed = False+ default_error_messages = {+ 'invalid': _("'%(value)s' value must be an integer."),+ }++ def __init__(self, *args, **kwargs):+ kwargs['blank'] = True+ super().__init__(*args, **kwargs)++ def check(self, **kwargs):+ return [+ *super().check(**kwargs),+ *self._check_primary_key(),+ ]++ def _check_primary_key(self):+ if not self.primary_key:+ return [+ checks.Error(+ 'AutoFields must set primary_key=True.',+ obj=self,+ id='fields.E100',+ ),+ ]+ else:+ return []++ def deconstruct(self):+ name, path, args, kwargs = super().deconstruct()+ del kwargs['blank']+ kwargs['primary_key'] = True+ return name, path, args, kwargs++ def get_internal_type(self):+ return "AutoField"++ def to_python(self, value):+ if value is None:+ return value+ try:+ return int(value)+ except (TypeError, ValueError):+ raise exceptions.ValidationError(+ self.error_messages['invalid'],+ code='invalid',+ params={'value': value},+ )++ def rel_db_type(self, connection):+ return IntegerField().db_type(connection=connection)++ def validate(self, value, model_instance):+ pass++ def get_db_prep_value(self, value, connection, prepared=False):+ if not prepared:+ value = self.get_prep_value(value)+ value = connection.ops.validate_autopk_value(value)+ return value++ def get_prep_value(self, value):+ from django.db.models.expressions import OuterRef+ value = super().get_prep_value(value)+ if value is None or isinstance(value, OuterRef):+ return value+ return int(value)++ def contribute_to_class(self, cls, name, **kwargs):+ assert not cls._meta.auto_field, "Model %s can't have more than one AutoField." % cls._meta.label+ super().contribute_to_class(cls, name, **kwargs)+ cls._meta.auto_field = self++ def formfield(self, **kwargs):+ return None+++class BigAutoField(AutoField):+ description = _("Big (8 byte) integer")++ def get_internal_type(self):+ return "BigAutoField"++ def rel_db_type(self, connection):+ return BigIntegerField().db_type(connection=connection)+++class BooleanField(Field):+ empty_strings_allowed = False+ default_error_messages = {+ 'invalid': _("'%(value)s' value must be either True or False."),+ 'invalid_nullable': _("'%(value)s' value must be either True, False, or None."),+ }+ description = _("Boolean (Either True or False)")++ def get_internal_type(self):+ return "BooleanField"++ def to_python(self, value):+ if self.null and value in self.empty_values:+ return None+ if value in (True, False):+ # 1/0 are equal to True/False. bool() converts former to latter.+ return bool(value)+ if value in ('t', 'True', '1'):+ return True+ if value in ('f', 'False', '0'):+ return False+ raise exceptions.ValidationError(+ self.error_messages['invalid_nullable' if self.null else 'invalid'],+ code='invalid',+ params={'value': value},+ )++ def get_prep_value(self, value):+ value = super().get_prep_value(value)+ if value is None:+ return None+ return self.to_python(value)++ def formfield(self, **kwargs):+ if self.choices is not None:+ include_blank = not (self.has_default() or 'initial' in kwargs)+ defaults = {'choices': self.get_choices(include_blank=include_blank)}+ else:+ form_class = forms.NullBooleanField if self.null else forms.BooleanField+ # In HTML checkboxes, 'required' means "must be checked" which is+ # different from the choices case ("must select some value").+ # required=False allows unchecked checkboxes.+ defaults = {'form_class': form_class, 'required': False}+ return super().formfield(**{**defaults, **kwargs})+++class CharField(Field):+ description = _("String (up to %(max_length)s)")++ def __init__(self, *args, **kwargs):+ super().__init__(*args, **kwargs)+ self.validators.append(validators.MaxLengthValidator(self.max_length))++ def check(self, **kwargs):+ return [+ *super().check(**kwargs),+ *self._check_max_length_attribute(**kwargs),+ ]++ def _check_max_length_attribute(self, **kwargs):+ if self.max_length is None:+ return [+ checks.Error(+ "CharFields must define a 'max_length' attribute.",+ obj=self,+ id='fields.E120',+ )+ ]+ elif (not isinstance(self.max_length, int) or isinstance(self.max_length, bool) or+ self.max_length <= 0):+ return [+ checks.Error(+ "'max_length' must be a positive integer.",+ obj=self,+ id='fields.E121',+ )+ ]+ else:+ return []++ def cast_db_type(self, connection):+ if self.max_length is None:+ return connection.ops.cast_char_field_without_max_length+ return super().cast_db_type(connection)++ def get_internal_type(self):+ return "CharField"++ def to_python(self, value):+ if isinstance(value, str) or value is None:+ return value+ return str(value)++ def get_prep_value(self, value):+ value = super().get_prep_value(value)+ return self.to_python(value)++ def formfield(self, **kwargs):+ # Passing max_length to forms.CharField means that the value's length+ # will be validated twice. This is considered acceptable since we want+ # the value in the form field (to pass into widget for example).+ defaults = {'max_length': self.max_length}+ # TODO: Handle multiple backends with different feature flags.+ if self.null and not connection.features.interprets_empty_strings_as_nulls:+ defaults['empty_value'] = None+ defaults.update(kwargs)+ return super().formfield(**defaults)+++class CommaSeparatedIntegerField(CharField):+ default_validators = [validators.validate_comma_separated_integer_list]+ description = _("Comma-separated integers")+ system_check_removed_details = {+ 'msg': (+ 'CommaSeparatedIntegerField is removed except for support in '+ 'historical migrations.'+ ),+ 'hint': (+ 'Use CharField(validators=[validate_comma_separated_integer_list]) '+ 'instead.'+ ),+ 'id': 'fields.E901',+ }+++class DateTimeCheckMixin:++ def check(self, **kwargs):+ return [+ *super().check(**kwargs),+ *self._check_mutually_exclusive_options(),+ *self._check_fix_default_value(),+ ]++ def _check_mutually_exclusive_options(self):+ # auto_now, auto_now_add, and default are mutually exclusive+ # options. The use of more than one of these options together+ # will trigger an Error+ mutually_exclusive_options = [self.auto_now_add, self.auto_now, self.has_default()]+ enabled_options = [option not in (None, False) for option in mutually_exclusive_options].count(True)+ if enabled_options > 1:+ return [+ checks.Error(+ "The options auto_now, auto_now_add, and default "+ "are mutually exclusive. Only one of these options "+ "may be present.",+ obj=self,+ id='fields.E160',+ )+ ]+ else:+ return []++ def _check_fix_default_value(self):+ return []+++class DateField(DateTimeCheckMixin, Field):+ empty_strings_allowed = False+ default_error_messages = {+ 'invalid': _("'%(value)s' value has an invalid date format. It must be "+ "in YYYY-MM-DD format."),+ 'invalid_date': _("'%(value)s' value has the correct format (YYYY-MM-DD) "+ "but it is an invalid date."),+ }+ description = _("Date (without time)")++ def __init__(self, verbose_name=None, name=None, auto_now=False,+ auto_now_add=False, **kwargs):+ self.auto_now, self.auto_now_add = auto_now, auto_now_add+ if auto_now or auto_now_add:+ kwargs['editable'] = False+ kwargs['blank'] = True+ super().__init__(verbose_name, name, **kwargs)++ def _check_fix_default_value(self):+ """+ Warn that using an actual date or datetime value is probably wrong;+ it's only evaluated on server startup.+ """+ if not self.has_default():+ return []++ now = timezone.now()+ if not timezone.is_naive(now):+ now = timezone.make_naive(now, timezone.utc)+ value = self.default+ if isinstance(value, datetime.datetime):+ if not timezone.is_naive(value):+ value = timezone.make_naive(value, timezone.utc)+ value = value.date()+ elif isinstance(value, datetime.date):+ # Nothing to do, as dates don't have tz information+ pass+ else:+ # No explicit date / datetime value -- no checks necessary+ return []+ offset = datetime.timedelta(days=1)+ lower = (now - offset).date()+ upper = (now + offset).date()+ if lower <= value <= upper:+ return [+ checks.Warning(+ 'Fixed default value provided.',+ hint='It seems you set a fixed date / time / datetime '+ 'value as default for this field. This may not be '+ 'what you want. If you want to have the current date '+ 'as default, use `django.utils.timezone.now`',+ obj=self,+ id='fields.W161',+ )+ ]++ return []++ def deconstruct(self):+ name, path, args, kwargs = super().deconstruct()+ if self.auto_now:+ kwargs['auto_now'] = True+ if self.auto_now_add:+ kwargs['auto_now_add'] = True+ if self.auto_now or self.auto_now_add:+ del kwargs['editable']+ del kwargs['blank']+ return name, path, args, kwargs++ def get_internal_type(self):+ return "DateField"++ def to_python(self, value):+ if value is None:+ return value+ if isinstance(value, datetime.datetime):+ if settings.USE_TZ and timezone.is_aware(value):+ # Convert aware datetimes to the default time zone+ # before casting them to dates (#17742).+ default_timezone = timezone.get_default_timezone()+ value = timezone.make_naive(value, default_timezone)+ return value.date()+ if isinstance(value, datetime.date):+ return value++ try:+ parsed = parse_date(value)+ if parsed is not None:+ return parsed+ except ValueError:+ raise exceptions.ValidationError(+ self.error_messages['invalid_date'],+ code='invalid_date',+ params={'value': value},+ )++ raise exceptions.ValidationError(+ self.error_messages['invalid'],+ code='invalid',+ params={'value': value},+ )++ def pre_save(self, model_instance, add):+ if self.auto_now or (self.auto_now_add and add):+ value = datetime.date.today()+ setattr(model_instance, self.attname, value)+ return value+ else:+ return super().pre_save(model_instance, add)++ def contribute_to_class(self, cls, name, **kwargs):+ super().contribute_to_class(cls, name, **kwargs)+ if not self.null:+ setattr(+ cls, 'get_next_by_%s' % self.name,+ partialmethod(cls._get_next_or_previous_by_FIELD, field=self, is_next=True)+ )+ setattr(+ cls, 'get_previous_by_%s' % self.name,+ partialmethod(cls._get_next_or_previous_by_FIELD, field=self, is_next=False)+ )++ def get_prep_value(self, value):+ value = super().get_prep_value(value)+ return self.to_python(value)++ def get_db_prep_value(self, value, connection, prepared=False):+ # Casts dates into the format expected by the backend+ if not prepared:+ value = self.get_prep_value(value)+ return connection.ops.adapt_datefield_value(value)++ def value_to_string(self, obj):+ val = self.value_from_object(obj)+ return '' if val is None else val.isoformat()++ def formfield(self, **kwargs):+ return super().formfield(**{+ 'form_class': forms.DateField,+ **kwargs,+ })+++class DateTimeField(DateField):+ empty_strings_allowed = False+ default_error_messages = {+ 'invalid': _("'%(value)s' value has an invalid format. It must be in "+ "YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ] format."),+ 'invalid_date': _("'%(value)s' value has the correct format "+ "(YYYY-MM-DD) but it is an invalid date."),+ 'invalid_datetime': _("'%(value)s' value has the correct format "+ "(YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ]) "+ "but it is an invalid date/time."),+ }+ description = _("Date (with time)")++ # __init__ is inherited from DateField++ def _check_fix_default_value(self):+ """+ Warn that using an actual date or datetime value is probably wrong;+ it's only evaluated on server startup.+ """+ if not self.has_default():+ return []++ now = timezone.now()+ if not timezone.is_naive(now):+ now = timezone.make_naive(now, timezone.utc)+ value = self.default+ if isinstance(value, datetime.datetime):+ second_offset = datetime.timedelta(seconds=10)+ lower = now - second_offset+ upper = now + second_offset+ if timezone.is_aware(value):+ value = timezone.make_naive(value, timezone.utc)+ elif isinstance(value, datetime.date):+ second_offset = datetime.timedelta(seconds=10)+ lower = now - second_offset+ lower = datetime.datetime(lower.year, lower.month, lower.day)+ upper = now + second_offset+ upper = datetime.datetime(upper.year, upper.month, upper.day)+ value = datetime.datetime(value.year, value.month, value.day)+ else:+ # No explicit date / datetime value -- no checks necessary+ return []+ if lower <= value <= upper:+ return [+ checks.Warning(+ 'Fixed default value provided.',+ hint='It seems you set a fixed date / time / datetime '+ 'value as default for this field. This may not be '+ 'what you want. If you want to have the current date '+ 'as default, use `django.utils.timezone.now`',+ obj=self,+ id='fields.W161',+ )+ ]++ return []++ def get_internal_type(self):+ return "DateTimeField"++ def to_python(self, value):+ if value is None:+ return value+ if isinstance(value, datetime.datetime):+ return value+ if isinstance(value, datetime.date):+ value = datetime.datetime(value.year, value.month, value.day)+ if settings.USE_TZ:+ # For backwards compatibility, interpret naive datetimes in+ # local time. This won't work during DST change, but we can't+ # do much about it, so we let the exceptions percolate up the+ # call stack.+ warnings.warn("DateTimeField %s.%s received a naive datetime "+ "(%s) while time zone support is active." %+ (self.model.__name__, self.name, value),+ RuntimeWarning)+ default_timezone = timezone.get_default_timezone()+ value = timezone.make_aware(value, default_timezone)+ return value++ try:+ parsed = parse_datetime(value)+ if parsed is not None:+ return parsed+ except ValueError:+ raise exceptions.ValidationError(+ self.error_messages['invalid_datetime'],+ code='invalid_datetime',+ params={'value': value},+ )++ try:+ parsed = parse_date(value)+ if parsed is not None:+ return datetime.datetime(parsed.year, parsed.month, parsed.day)+ except ValueError:+ raise exceptions.ValidationError(+ self.error_messages['invalid_date'],+ code='invalid_date',+ params={'value': value},+ )++ raise exceptions.ValidationError(+ self.error_messages['invalid'],+ code='invalid',+ params={'value': value},+ )++ def pre_save(self, model_instance, add):+ if self.auto_now or (self.auto_now_add and add):+ value = timezone.now()+ setattr(model_instance, self.attname, value)+ return value+ else:+ return super().pre_save(model_instance, add)++ # contribute_to_class is inherited from DateField, it registers+ # get_next_by_FOO and get_prev_by_FOO++ def get_prep_value(self, value):+ value = super().get_prep_value(value)+ value = self.to_python(value)+ if value is not None and settings.USE_TZ and timezone.is_naive(value):+ # For backwards compatibility, interpret naive datetimes in local+ # time. This won't work during DST change, but we can't do much+ # about it, so we let the exceptions percolate up the call stack.+ try:+ name = '%s.%s' % (self.model.__name__, self.name)+ except AttributeError:+ name = '(unbound)'+ warnings.warn("DateTimeField %s received a naive datetime (%s)"+ " while time zone support is active." %+ (name, value),+ RuntimeWarning)+ default_timezone = timezone.get_default_timezone()+ value = timezone.make_aware(value, default_timezone)+ return value++ def get_db_prep_value(self, value, connection, prepared=False):+ # Casts datetimes into the format expected by the backend+ if not prepared:+ value = self.get_prep_value(value)+ return connection.ops.adapt_datetimefield_value(value)++ def value_to_string(self, obj):+ val = self.value_from_object(obj)+ return '' if val is None else val.isoformat()++ def formfield(self, **kwargs):+ return super().formfield(**{+ 'form_class': forms.DateTimeField,+ **kwargs,+ })+++class DecimalField(Field):+ empty_strings_allowed = False+ default_error_messages = {+ 'invalid': _("'%(value)s' value must be a decimal number."),+ }+ description = _("Decimal number")++ def __init__(self, verbose_name=None, name=None, max_digits=None,+ decimal_places=None, **kwargs):+ self.max_digits, self.decimal_places = max_digits, decimal_places+ super().__init__(verbose_name, name, **kwargs)++ def check(self, **kwargs):+ errors = super().check(**kwargs)++ digits_errors = [+ *self._check_decimal_places(),+ *self._check_max_digits(),+ ]+ if not digits_errors:+ errors.extend(self._check_decimal_places_and_max_digits(**kwargs))+ else:+ errors.extend(digits_errors)+ return errors++ def _check_decimal_places(self):+ try:+ decimal_places = int(self.decimal_places)+ if decimal_places < 0:+ raise ValueError()+ except TypeError:+ return [+ checks.Error(+ "DecimalFields must define a 'decimal_places' attribute.",+ obj=self,+ id='fields.E130',+ )+ ]+ except ValueError:+ return [+ checks.Error(+ "'decimal_places' must be a non-negative integer.",+ obj=self,+ id='fields.E131',+ )+ ]+ else:+ return []++ def _check_max_digits(self):+ try:+ max_digits = int(self.max_digits)+ if max_digits <= 0:+ raise ValueError()+ except TypeError:+ return [+ checks.Error(+ "DecimalFields must define a 'max_digits' attribute.",+ obj=self,+ id='fields.E132',+ )+ ]+ except ValueError:+ return [+ checks.Error(+ "'max_digits' must be a positive integer.",+ obj=self,+ id='fields.E133',+ )+ ]+ else:+ return []++ def _check_decimal_places_and_max_digits(self, **kwargs):+ if int(self.decimal_places) > int(self.max_digits):+ return [+ checks.Error(+ "'max_digits' must be greater or equal to 'decimal_places'.",+ obj=self,+ id='fields.E134',+ )+ ]+ return []++ @cached_property+ def validators(self):+ return super().validators + [+ validators.DecimalValidator(self.max_digits, self.decimal_places)+ ]++ @cached_property+ def context(self):+ return decimal.Context(prec=self.max_digits)++ def deconstruct(self):+ name, path, args, kwargs = super().deconstruct()+ if self.max_digits is not None:+ kwargs['max_digits'] = self.max_digits+ if self.decimal_places is not None:+ kwargs['decimal_places'] = self.decimal_places+ return name, path, args, kwargs++ def get_internal_type(self):+ return "DecimalField"++ def to_python(self, value):+ if value is None:+ return value+ if isinstance(value, float):+ return self.context.create_decimal_from_float(value)+ try:+ return decimal.Decimal(value)+ except decimal.InvalidOperation:+ raise exceptions.ValidationError(+ self.error_messages['invalid'],+ code='invalid',+ params={'value': value},+ )++ def get_db_prep_save(self, value, connection):+ return connection.ops.adapt_decimalfield_value(self.to_python(value), self.max_digits, self.decimal_places)++ def get_prep_value(self, value):+ value = super().get_prep_value(value)+ return self.to_python(value)++ def formfield(self, **kwargs):+ return super().formfield(**{+ 'max_digits': self.max_digits,+ 'decimal_places': self.decimal_places,+ 'form_class': forms.DecimalField,+ **kwargs,+ })+++class DurationField(Field):+ """+ Store timedelta objects.++ Use interval on PostgreSQL, INTERVAL DAY TO SECOND on Oracle, and bigint+ of microseconds on other databases.+ """+ empty_strings_allowed = False+ default_error_messages = {+ 'invalid': _("'%(value)s' value has an invalid format. It must be in "+ "[DD] [[HH:]MM:]ss[.uuuuuu] format.")+ }+ description = _("Duration")++ def get_internal_type(self):+ return "DurationField"++ def to_python(self, value):+ if value is None:+ return value+ if isinstance(value, datetime.timedelta):+ return value+ try:+ parsed = parse_duration(value)+ except ValueError:+ pass+ else:+ if parsed is not None:+ return parsed++ raise exceptions.ValidationError(+ self.error_messages['invalid'],+ code='invalid',+ params={'value': value},+ )++ def get_db_prep_value(self, value, connection, prepared=False):+ if connection.features.has_native_duration_field:+ return value+ if value is None:+ return None+ return duration_microseconds(value)++ def get_db_converters(self, connection):+ converters = []+ if not connection.features.has_native_duration_field:+ converters.append(connection.ops.convert_durationfield_value)+ return converters + super().get_db_converters(connection)++ def value_to_string(self, obj):+ val = self.value_from_object(obj)+ return '' if val is None else duration_string(val)++ def formfield(self, **kwargs):+ return super().formfield(**{+ 'form_class': forms.DurationField,+ **kwargs,+ })+++class EmailField(CharField):+ default_validators = [validators.validate_email]+ description = _("Email address")++ def __init__(self, *args, **kwargs):+ # max_length=254 to be compliant with RFCs 3696 and 5321+ kwargs.setdefault('max_length', 254)+ super().__init__(*args, **kwargs)++ def deconstruct(self):+ name, path, args, kwargs = super().deconstruct()+ # We do not exclude max_length if it matches default as we want to change+ # the default in future.+ return name, path, args, kwargs++ def formfield(self, **kwargs):+ # As with CharField, this will cause email validation to be performed+ # twice.+ return super().formfield(**{+ 'form_class': forms.EmailField,+ **kwargs,+ })+++class FilePathField(Field):+ description = _("File path")++ def __init__(self, verbose_name=None, name=None, path=None, match=None,+ recursive=False, allow_files=True, allow_folders=False, **kwargs):+ self.path, self.match, self.recursive = path, match, recursive+ self.allow_files, self.allow_folders = allow_files, allow_folders+ kwargs.setdefault('max_length', 100)+ super().__init__(verbose_name, name, **kwargs)++ def check(self, **kwargs):+ return [+ *super().check(**kwargs),+ *self._check_allowing_files_or_folders(**kwargs),+ ]++ def _check_allowing_files_or_folders(self, **kwargs):+ if not self.allow_files and not self.allow_folders:+ return [+ checks.Error(+ "FilePathFields must have either 'allow_files' or 'allow_folders' set to True.",+ obj=self,+ id='fields.E140',+ )+ ]+ return []++ def deconstruct(self):+ name, path, args, kwargs = super().deconstruct()+ if callable(self.path):+ kwargs['path'] = self.path()+ elif self.path != '':+ kwargs['path'] = self.path+ if self.match is not None:+ kwargs['match'] = self.match+ if self.recursive is not False:+ kwargs['recursive'] = self.recursive+ if self.allow_files is not True:+ kwargs['allow_files'] = self.allow_files+ if self.allow_folders is not False:+ kwargs['allow_folders'] = self.allow_folders+ if kwargs.get("max_length") == 100:+ del kwargs["max_length"]+ return name, path, args, kwargs++ def get_prep_value(self, value):+ value = super().get_prep_value(value)+ if value is None:+ return None+ return str(value)++ def formfield(self, **kwargs):+ return super().formfield(**{+ 'path': self.path,+ 'match': self.match,+ 'recursive': self.recursive,+ 'form_class': forms.FilePathField,+ 'allow_files': self.allow_files,+ 'allow_folders': self.allow_folders,+ **kwargs,+ })++ def get_internal_type(self):+ return "FilePathField"+++class FloatField(Field):+ empty_strings_allowed = False+ default_error_messages = {+ 'invalid': _("'%(value)s' value must be a float."),+ }+ description = _("Floating point number")++ def get_prep_value(self, value):+ value = super().get_prep_value(value)+ if value is None:+ return None+ return float(value)++ def get_internal_type(self):+ return "FloatField"++ def to_python(self, value):+ if value is None:+ return value+ try:+ return float(value)+ except (TypeError, ValueError):+ raise exceptions.ValidationError(+ self.error_messages['invalid'],+ code='invalid',+ params={'value': value},+ )++ def formfield(self, **kwargs):+ return super().formfield(**{+ 'form_class': forms.FloatField,+ **kwargs,+ })+++class IntegerField(Field):+ empty_strings_allowed = False+ default_error_messages = {+ 'invalid': _("'%(value)s' value must be an integer."),+ }+ description = _("Integer")++ def check(self, **kwargs):+ return [+ *super().check(**kwargs),+ *self._check_max_length_warning(),+ ]++ def _check_max_length_warning(self):+ if self.max_length is not None:+ return [+ checks.Warning(+ "'max_length' is ignored when used with %s." % self.__class__.__name__,+ hint="Remove 'max_length' from field",+ obj=self,+ id='fields.W122',+ )+ ]+ return []++ @cached_property+ def validators(self):+ # These validators can't be added at field initialization time since+ # they're based on values retrieved from `connection`.+ validators_ = super().validators+ internal_type = self.get_internal_type()+ min_value, max_value = connection.ops.integer_field_range(internal_type)+ if min_value is not None and not any(+ (+ isinstance(validator, validators.MinValueValidator) and (+ validator.limit_value()+ if callable(validator.limit_value)+ else validator.limit_value+ ) >= min_value+ ) for validator in validators_+ ):+ validators_.append(validators.MinValueValidator(min_value))+ if max_value is not None and not any(+ (+ isinstance(validator, validators.MaxValueValidator) and (+ validator.limit_value()+ if callable(validator.limit_value)+ else validator.limit_value+ ) <= max_value+ ) for validator in validators_+ ):+ validators_.append(validators.MaxValueValidator(max_value))+ return validators_++ def get_prep_value(self, value):+ value = super().get_prep_value(value)+ if value is None:+ return None+ return int(value)++ def get_internal_type(self):+ return "IntegerField"++ def to_python(self, value):+ if value is None:+ return value+ try:+ return int(value)+ except (TypeError, ValueError):+ raise exceptions.ValidationError(+ self.error_messages['invalid'],+ code='invalid',+ params={'value': value},+ )++ def formfield(self, **kwargs):+ return super().formfield(**{+ 'form_class': forms.IntegerField,+ **kwargs,+ })+++class BigIntegerField(IntegerField):+ description = _("Big (8 byte) integer")+ MAX_BIGINT = 9223372036854775807++ def get_internal_type(self):+ return "BigIntegerField"++ def formfield(self, **kwargs):+ return super().formfield(**{+ 'min_value': -BigIntegerField.MAX_BIGINT - 1,+ 'max_value': BigIntegerField.MAX_BIGINT,+ **kwargs,+ })+++class IPAddressField(Field):+ empty_strings_allowed = False+ description = _("IPv4 address")+ system_check_removed_details = {+ 'msg': (+ 'IPAddressField has been removed except for support in '+ 'historical migrations.'+ ),+ 'hint': 'Use GenericIPAddressField instead.',+ 'id': 'fields.E900',+ }++ def __init__(self, *args, **kwargs):+ kwargs['max_length'] = 15+ super().__init__(*args, **kwargs)++ def deconstruct(self):+ name, path, args, kwargs = super().deconstruct()+ del kwargs['max_length']+ return name, path, args, kwargs++ def get_prep_value(self, value):+ value = super().get_prep_value(value)+ if value is None:+ return None+ return str(value)++ def get_internal_type(self):+ return "IPAddressField"+++class GenericIPAddressField(Field):+ empty_strings_allowed = False+ description = _("IP address")+ default_error_messages = {}++ def __init__(self, verbose_name=None, name=None, protocol='both',+ unpack_ipv4=False, *args, **kwargs):+ self.unpack_ipv4 = unpack_ipv4+ self.protocol = protocol+ self.default_validators, invalid_error_message = \+ validators.ip_address_validators(protocol, unpack_ipv4)+ self.default_error_messages['invalid'] = invalid_error_message+ kwargs['max_length'] = 39+ super().__init__(verbose_name, name, *args, **kwargs)++ def check(self, **kwargs):+ return [+ *super().check(**kwargs),+ *self._check_blank_and_null_values(**kwargs),+ ]++ def _check_blank_and_null_values(self, **kwargs):+ if not getattr(self, 'null', False) and getattr(self, 'blank', False):+ return [+ checks.Error(+ 'GenericIPAddressFields cannot have blank=True if null=False, '+ 'as blank values are stored as nulls.',+ obj=self,+ id='fields.E150',+ )+ ]+ return []++ def deconstruct(self):+ name, path, args, kwargs = super().deconstruct()+ if self.unpack_ipv4 is not False:+ kwargs['unpack_ipv4'] = self.unpack_ipv4+ if self.protocol != "both":+ kwargs['protocol'] = self.protocol+ if kwargs.get("max_length") == 39:+ del kwargs['max_length']+ return name, path, args, kwargs++ def get_internal_type(self):+ return "GenericIPAddressField"++ def to_python(self, value):+ if value is None:+ return None+ if not isinstance(value, str):+ value = str(value)+ value = value.strip()+ if ':' in value:+ return clean_ipv6_address(value, self.unpack_ipv4, self.error_messages['invalid'])+ return value++ def get_db_prep_value(self, value, connection, prepared=False):+ if not prepared:+ value = self.get_prep_value(value)+ return connection.ops.adapt_ipaddressfield_value(value)++ def get_prep_value(self, value):+ value = super().get_prep_value(value)+ if value is None:+ return None+ if value and ':' in value:+ try:+ return clean_ipv6_address(value, self.unpack_ipv4)+ except exceptions.ValidationError:+ pass+ return str(value)++ def formfield(self, **kwargs):+ return super().formfield(**{+ 'protocol': self.protocol,+ 'form_class': forms.GenericIPAddressField,+ **kwargs,+ })+++class NullBooleanField(BooleanField):+ default_error_messages = {+ 'invalid': _("'%(value)s' value must be either None, True or False."),+ 'invalid_nullable': _("'%(value)s' value must be either None, True or False."),+ }+ description = _("Boolean (Either True, False or None)")++ def __init__(self, *args, **kwargs):+ kwargs['null'] = True+ kwargs['blank'] = True+ super().__init__(*args, **kwargs)++ def deconstruct(self):+ name, path, args, kwargs = super().deconstruct()+ del kwargs['null']+ del kwargs['blank']+ return name, path, args, kwargs++ def get_internal_type(self):+ return "NullBooleanField"+++class PositiveIntegerRelDbTypeMixin:++ def rel_db_type(self, connection):+ """+ Return the data type that a related field pointing to this field should+ use. In most cases, a foreign key pointing to a positive integer+ primary key will have an integer column data type but some databases+ (e.g. MySQL) have an unsigned integer type. In that case+ (related_fields_match_type=True), the primary key should return its+ db_type.+ """+ if connection.features.related_fields_match_type:+ return self.db_type(connection)+ else:+ return IntegerField().db_type(connection=connection)+++class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField):+ description = _("Positive integer")++ def get_internal_type(self):+ return "PositiveIntegerField"++ def formfield(self, **kwargs):+ return super().formfield(**{+ 'min_value': 0,+ **kwargs,+ })+++class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField):+ description = _("Positive small integer")++ def get_internal_type(self):+ return "PositiveSmallIntegerField"++ def formfield(self, **kwargs):+ return super().formfield(**{+ 'min_value': 0,+ **kwargs,+ })+++class SlugField(CharField):+ default_validators = [validators.validate_slug]+ description = _("Slug (up to %(max_length)s)")++ def __init__(self, *args, max_length=50, db_index=True, allow_unicode=False, **kwargs):+ self.allow_unicode = allow_unicode+ if self.allow_unicode:+ self.default_validators = [validators.validate_unicode_slug]+ super().__init__(*args, max_length=max_length, db_index=db_index, **kwargs)++ def deconstruct(self):+ name, path, args, kwargs = super().deconstruct()+ if kwargs.get("max_length") == 50:+ del kwargs['max_length']+ if self.db_index is False:+ kwargs['db_index'] = False+ else:+ del kwargs['db_index']+ if self.allow_unicode is not False:+ kwargs['allow_unicode'] = self.allow_unicode+ return name, path, args, kwargs++ def get_internal_type(self):+ return "SlugField"++ def formfield(self, **kwargs):+ return super().formfield(**{+ 'form_class': forms.SlugField,+ 'allow_unicode': self.allow_unicode,+ **kwargs,+ })+++class SmallIntegerField(IntegerField):+ description = _("Small integer")++ def get_internal_type(self):+ return "SmallIntegerField"+++class TextField(Field):+ description = _("Text")++ def get_internal_type(self):+ return "TextField"++ def to_python(self, value):+ if isinstance(value, str) or value is None:+ return value+ return str(value)++ def get_prep_value(self, value):+ value = super().get_prep_value(value)+ return self.to_python(value)++ def formfield(self, **kwargs):+ # Passing max_length to forms.CharField means that the value's length+ # will be validated twice. This is considered acceptable since we want+ # the value in the form field (to pass into widget for example).+ return super().formfield(**{+ 'max_length': self.max_length,+ **({} if self.choices is not None else {'widget': forms.Textarea}),+ **kwargs,+ })+++class TimeField(DateTimeCheckMixin, Field):+ empty_strings_allowed = False+ default_error_messages = {+ 'invalid': _("'%(value)s' value has an invalid format. It must be in "+ "HH:MM[:ss[.uuuuuu]] format."),+ 'invalid_time': _("'%(value)s' value has the correct format "+ "(HH:MM[:ss[.uuuuuu]]) but it is an invalid time."),+ }+ description = _("Time")++ def __init__(self, verbose_name=None, name=None, auto_now=False,+ auto_now_add=False, **kwargs):+ self.auto_now, self.auto_now_add = auto_now, auto_now_add+ if auto_now or auto_now_add:+ kwargs['editable'] = False+ kwargs['blank'] = True+ super().__init__(verbose_name, name, **kwargs)++ def _check_fix_default_value(self):+ """+ Warn that using an actual date or datetime value is probably wrong;+ it's only evaluated on server startup.+ """+ if not self.has_default():+ return []++ now = timezone.now()+ if not timezone.is_naive(now):+ now = timezone.make_naive(now, timezone.utc)+ value = self.default+ if isinstance(value, datetime.datetime):+ second_offset = datetime.timedelta(seconds=10)+ lower = now - second_offset+ upper = now + second_offset+ if timezone.is_aware(value):+ value = timezone.make_naive(value, timezone.utc)+ elif isinstance(value, datetime.time):+ second_offset = datetime.timedelta(seconds=10)+ lower = now - second_offset+ upper = now + second_offset+ value = datetime.datetime.combine(now.date(), value)+ if timezone.is_aware(value):+ value = timezone.make_naive(value, timezone.utc).time()+ else:+ # No explicit time / datetime value -- no checks necessary+ return []+ if lower <= value <= upper:+ return [+ checks.Warning(+ 'Fixed default value provided.',+ hint='It seems you set a fixed date / time / datetime '+ 'value as default for this field. This may not be '+ 'what you want. If you want to have the current date '+ 'as default, use `django.utils.timezone.now`',+ obj=self,+ id='fields.W161',+ )+ ]++ return []++ def deconstruct(self):+ name, path, args, kwargs = super().deconstruct()+ if self.auto_now is not False:+ kwargs["auto_now"] = self.auto_now+ if self.auto_now_add is not False:+ kwargs["auto_now_add"] = self.auto_now_add+ if self.auto_now or self.auto_now_add:+ del kwargs['blank']+ del kwargs['editable']+ return name, path, args, kwargs++ def get_internal_type(self):+ return "TimeField"++ def to_python(self, value):+ if value is None:+ return None+ if isinstance(value, datetime.time):+ return value+ if isinstance(value, datetime.datetime):+ # Not usually a good idea to pass in a datetime here (it loses+ # information), but this can be a side-effect of interacting with a+ # database backend (e.g. Oracle), so we'll be accommodating.+ return value.time()++ try:+ parsed = parse_time(value)+ if parsed is not None:+ return parsed+ except ValueError:+ raise exceptions.ValidationError(+ self.error_messages['invalid_time'],+ code='invalid_time',+ params={'value': value},+ )++ raise exceptions.ValidationError(+ self.error_messages['invalid'],+ code='invalid',+ params={'value': value},+ )++ def pre_save(self, model_instance, add):+ if self.auto_now or (self.auto_now_add and add):+ value = datetime.datetime.now().time()+ setattr(model_instance, self.attname, value)+ return value+ else:+ return super().pre_save(model_instance, add)++ def get_prep_value(self, value):+ value = super().get_prep_value(value)+ return self.to_python(value)++ def get_db_prep_value(self, value, connection, prepared=False):+ # Casts times into the format expected by the backend+ if not prepared:+ value = self.get_prep_value(value)+ return connection.ops.adapt_timefield_value(value)++ def value_to_string(self, obj):+ val = self.value_from_object(obj)+ return '' if val is None else val.isoformat()++ def formfield(self, **kwargs):+ return super().formfield(**{+ 'form_class': forms.TimeField,+ **kwargs,+ })+++class URLField(CharField):+ default_validators = [validators.URLValidator()]+ description = _("URL")++ def __init__(self, verbose_name=None, name=None, **kwargs):+ kwargs.setdefault('max_length', 200)+ super().__init__(verbose_name, name, **kwargs)++ def deconstruct(self):+ name, path, args, kwargs = super().deconstruct()+ if kwargs.get("max_length") == 200:+ del kwargs['max_length']+ return name, path, args, kwargs++ def formfield(self, **kwargs):+ # As with CharField, this will cause URL validation to be performed+ # twice.+ return super().formfield(**{+ 'form_class': forms.URLField,+ **kwargs,+ })+++class BinaryField(Field):+ description = _("Raw binary data")+ empty_values = [None, b'']++ def __init__(self, *args, **kwargs):+ kwargs.setdefault('editable', False)+ super().__init__(*args, **kwargs)+ if self.max_length is not None:+ self.validators.append(validators.MaxLengthValidator(self.max_length))++ def check(self, **kwargs):+ return [*super().check(**kwargs), *self._check_str_default_value()]++ def _check_str_default_value(self):+ if self.has_default() and isinstance(self.default, str):+ return [+ checks.Error(+ "BinaryField's default cannot be a string. Use bytes "+ "content instead.",+ obj=self,+ id='fields.E170',+ )+ ]+ return []++ def deconstruct(self):+ name, path, args, kwargs = super().deconstruct()+ if self.editable:+ kwargs['editable'] = True+ else:+ del kwargs['editable']+ return name, path, args, kwargs++ def get_internal_type(self):+ return "BinaryField"++ def get_placeholder(self, value, compiler, connection):+ return connection.ops.binary_placeholder_sql(value)++ def get_default(self):+ if self.has_default() and not callable(self.default):+ return self.default+ default = super().get_default()+ if default == '':+ return b''+ return default++ def get_db_prep_value(self, value, connection, prepared=False):+ value = super().get_db_prep_value(value, connection, prepared)+ if value is not None:+ return connection.Database.Binary(value)+ return value++ def value_to_string(self, obj):+ """Binary data is serialized as base64"""+ return b64encode(self.value_from_object(obj)).decode('ascii')++ def to_python(self, value):+ # If it's a string, it should be base64-encoded data+ if isinstance(value, str):+ return memoryview(b64decode(value.encode('ascii')))+ return value+++class UUIDField(Field):+ default_error_messages = {+ 'invalid': _("'%(value)s' is not a valid UUID."),+ }+ description = _('Universally unique identifier')+ empty_strings_allowed = False++ def __init__(self, verbose_name=None, **kwargs):+ kwargs['max_length'] = 32+ super().__init__(verbose_name, **kwargs)++ def deconstruct(self):+ name, path, args, kwargs = super().deconstruct()+ del kwargs['max_length']+ return name, path, args, kwargs++ def get_internal_type(self):+ return "UUIDField"++ def get_prep_value(self, value):+ value = super().get_prep_value(value)+ return self.to_python(value)++ def get_db_prep_value(self, value, connection, prepared=False):+ if value is None:+ return None+ if not isinstance(value, uuid.UUID):+ value = self.to_python(value)++ if connection.features.has_native_uuid_field:+ return value+ return value.hex++ def to_python(self, value):+ if value is not None and not isinstance(value, uuid.UUID):+ input_form = 'int' if isinstance(value, int) else 'hex'+ try:+ return uuid.UUID(**{input_form: value})+ except (AttributeError, ValueError):+ raise exceptions.ValidationError(+ self.error_messages['invalid'],+ code='invalid',+ params={'value': value},+ )+ return value++ def formfield(self, **kwargs):+ return super().formfield(**{+ 'form_class': forms.UUIDField,+ **kwargs,+ })diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.pyindex 0c64748ccd..6ab8257987 100644--- a/django/db/models/fields/__init__.py+++ b/django/db/models/fields/__init__.py@@ -1661,7 +1661,7 @@ class EmailField(CharField): class FilePathField(Field): description = _("File path") - def __init__(self, verbose_name=None, name=None, path='', match=None,+ def __init__(self, verbose_name=None, name=None, path=None, match=None, recursive=False, allow_files=True, allow_folders=False, **kwargs): self.path, self.match, self.recursive = path, match, recursive self.allow_files, self.allow_folders = allow_files, allow_folders@@ -1687,7 +1687,9 @@ class FilePathField(Field): def deconstruct(self): name, path, args, kwargs = super().deconstruct()- if self.path != '':+ if callable(self.path):+ kwargs['path'] = self.path()+ elif self.path != '': kwargs['path'] = self.path if self.match is not None: kwargs['match'] = self.match@@ -1709,7 +1711,7 @@ class FilePathField(Field): def formfield(self, **kwargs): return super().formfield(**{- 'path': self.path,+ 'path': self.path() if callable(self.path) else self.path, 'match': self.match, 'recursive': self.recursive, 'form_class': forms.FilePathField,123456789101112131415161718192021222324252627282930{ "django__django-10924": { "patch_is_None": false, "patch_exists": true, "patch_successfully_applied": true, "resolved": true, "tests_status": { "FAIL_TO_PASS": { "success": [ "test_callable_path (model_fields.test_filepathfield.FilePathFieldTests)" ], "failure": [] }, "PASS_TO_PASS": { "success": [ "test_path (model_fields.test_filepathfield.FilePathFieldTests)" ], "failure": [] }, "FAIL_TO_FAIL": { "success": [], "failure": [] }, "PASS_TO_FAIL": { "success": [], "failure": [] } } }}123version https://git-lfs.github.com/spec/v1oid sha256:c153e7e58e23e89eb8fbeea657eb088de4451efb22df212ee1e27fbae28223b8size 5677123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639+ source /opt/miniconda3/bin/activate++ _CONDA_ROOT=/opt/miniconda3++ . /opt/miniconda3/etc/profile.d/conda.sh+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ '[' -z '' ']'+++ export CONDA_SHLVL=0+++ CONDA_SHLVL=0+++ '[' -n '' ']'+++++ dirname /opt/miniconda3/bin/conda++++ dirname /opt/miniconda3/bin+++ PATH=/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export PATH+++ '[' -z '' ']'+++ PS1=++ conda activate++ local cmd=activate++ case "$cmd" in++ __conda_activate activate++ '[' -n '' ']'++ local ask_conda+++ PS1=+++ __conda_exe shell.posix activate+++ /opt/miniconda3/bin/conda shell.posix activate++ ask_conda='PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''1'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ eval 'PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''1'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+++ PS1='(base) '+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export CONDA_PREFIX=/opt/miniconda3+++ CONDA_PREFIX=/opt/miniconda3+++ export CONDA_SHLVL=1+++ CONDA_SHLVL=1+++ export CONDA_DEFAULT_ENV=base+++ CONDA_DEFAULT_ENV=base+++ export 'CONDA_PROMPT_MODIFIER=(base) '+++ CONDA_PROMPT_MODIFIER='(base) '+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ __conda_hashr++ '[' -n '' ']'++ '[' -n '' ']'++ hash -r+ conda activate testbed+ local cmd=activate+ case "$cmd" in+ __conda_activate activate testbed+ '[' -n '' ']'+ local ask_conda++ PS1='(base) '++ __conda_exe shell.posix activate testbed++ /opt/miniconda3/bin/conda shell.posix activate testbed+ ask_conda='PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''2'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_1='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+ eval 'PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''2'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_1='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ PS1='(testbed) '++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed++ CONDA_PREFIX=/opt/miniconda3/envs/testbed++ export CONDA_SHLVL=2++ CONDA_SHLVL=2++ export CONDA_DEFAULT_ENV=testbed++ CONDA_DEFAULT_ENV=testbed++ export 'CONDA_PROMPT_MODIFIER=(testbed) '++ CONDA_PROMPT_MODIFIER='(testbed) '++ export CONDA_PREFIX_1=/opt/miniconda3++ CONDA_PREFIX_1=/opt/miniconda3++ export CONDA_EXE=/opt/miniconda3/bin/conda++ CONDA_EXE=/opt/miniconda3/bin/conda++ export _CE_M=++ _CE_M=++ export _CE_CONDA=++ _CE_CONDA=++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+ __conda_hashr+ '[' -n '' ']'+ '[' -n '' ']'+ hash -r+ cd /testbed+ sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen+ locale-genGenerating locales (this might take a while)... en_US.UTF-8... doneGeneration complete.+ export LANG=en_US.UTF-8+ LANG=en_US.UTF-8+ export LANGUAGE=en_US:en+ LANGUAGE=en_US:en+ export LC_ALL=en_US.UTF-8+ LC_ALL=en_US.UTF-8+ git config --global --add safe.directory /testbed+ cd /testbed+ git statusOn branch mainChanges not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: django/db/models/fields/__init__.py
Untracked files: (use "git add <file>..." to include in what will be committed) django/db/models/fields/.backup.__init__.py
no changes added to commit (use "git add" and/or "git commit -a")+ git showcommit bceadd2788dc2dad53eba0caae172bd8522fd483Author: can <cansarigol@derinbilgi.com.tr>Date: Wed May 1 16:39:02 2019 +0300
Fixed #30396 -- Added system checks for uniqueness of indexes and constraints names. Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
diff --git a/AUTHORS b/AUTHORSindex 6983965cd1..e9c027167c 100644--- a/AUTHORS+++ b/AUTHORS@@ -152,6 +152,7 @@ answer newbie questions, and generally made Django that much better: Cameron Curry Cameron Knight (ckknight) Can Burak Çilingir <canburak@cs.bilgi.edu.tr>+ Can Sarıgöl <ertugrulsarigol@gmail.com> Carl Meyer <carl@oddbird.net> Carles Pina i Estany <carles@pina.cat> Carlos Eduardo de Paula <carlosedp@gmail.com>diff --git a/django/core/checks/model_checks.py b/django/core/checks/model_checks.pyindex 6c6ac2c7f4..5c2266ca1d 100644--- a/django/core/checks/model_checks.py+++ b/django/core/checks/model_checks.py@@ -10,6 +10,8 @@ from django.core.checks import Error, Tags, register @register(Tags.models) def check_all_models(app_configs=None, **kwargs): db_table_models = defaultdict(list)+ indexes = defaultdict(list)+ constraints = defaultdict(list) errors = [] if app_configs is None: models = apps.get_models()@@ -29,6 +31,10 @@ def check_all_models(app_configs=None, **kwargs): ) else: errors.extend(model.check(**kwargs))+ for model_index in model._meta.indexes:+ indexes[model_index.name].append(model._meta.label)+ for model_constraint in model._meta.constraints:+ constraints[model_constraint.name].append(model._meta.label) for db_table, model_labels in db_table_models.items(): if len(model_labels) != 1: errors.append(@@ -39,6 +45,32 @@ def check_all_models(app_configs=None, **kwargs): id='models.E028', ) )+ for index_name, model_labels in indexes.items():+ if len(model_labels) > 1:+ model_labels = set(model_labels)+ errors.append(+ Error(+ "index name '%s' is not unique %s %s." % (+ index_name,+ 'for model' if len(model_labels) == 1 else 'amongst models:',+ ', '.join(sorted(model_labels)),+ ),+ id='models.E029' if len(model_labels) == 1 else 'models.E030',+ ),+ )+ for constraint_name, model_labels in constraints.items():+ if len(model_labels) > 1:+ model_labels = set(model_labels)+ errors.append(+ Error(+ "constraint name '%s' is not unique %s %s." % (+ constraint_name,+ 'for model' if len(model_labels) == 1 else 'amongst models:',+ ', '.join(sorted(model_labels)),+ ),+ id='models.E031' if len(model_labels) == 1 else 'models.E032',+ ),+ ) return errors diff --git a/docs/ref/checks.txt b/docs/ref/checks.txtindex 973ccebe90..a15eb558fe 100644--- a/docs/ref/checks.txt+++ b/docs/ref/checks.txt@@ -306,6 +306,13 @@ Models * **models.W027**: ``<database>`` does not support check constraints. * **models.E028**: ``db_table`` ``<db_table>`` is used by multiple models: ``<model list>``.+* **models.E029**: index name ``<index>`` is not unique for model ``<model>``.+* **models.E030**: index name ``<index>`` is not unique amongst models:+ ``<model list>``.+* **models.E031**: constraint name ``<constraint>`` is not unique for model+ ``<model>``.+* **models.E032**: constraint name ``<constraint>`` is not unique amongst+ models: ``<model list>``. Security --------diff --git a/tests/check_framework/test_model_checks.py b/tests/check_framework/test_model_checks.pyindex 2e55ad637d..0cbc0aff44 100644--- a/tests/check_framework/test_model_checks.py+++ b/tests/check_framework/test_model_checks.py@@ -1,7 +1,7 @@ from django.core import checks from django.core.checks import Error from django.db import models-from django.test import SimpleTestCase+from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature from django.test.utils import ( isolate_apps, modify_settings, override_system_checks, )@@ -73,3 +73,166 @@ class DuplicateDBTableTests(SimpleTestCase): self.assertEqual(Model._meta.db_table, ProxyModel._meta.db_table) self.assertEqual(checks.run_checks(app_configs=self.apps.get_app_configs()), [])+++@isolate_apps('check_framework', attr_name='apps')+@override_system_checks([checks.model_checks.check_all_models])+class IndexNameTests(SimpleTestCase):+ def test_collision_in_same_model(self):+ index = models.Index(fields=['id'], name='foo')++ class Model(models.Model):+ class Meta:+ indexes = [index, index]++ self.assertEqual(checks.run_checks(app_configs=self.apps.get_app_configs()), [+ Error(+ "index name 'foo' is not unique for model check_framework.Model.",+ id='models.E029',+ ),+ ])++ def test_collision_in_different_models(self):+ index = models.Index(fields=['id'], name='foo')++ class Model1(models.Model):+ class Meta:+ indexes = [index]++ class Model2(models.Model):+ class Meta:+ indexes = [index]++ self.assertEqual(checks.run_checks(app_configs=self.apps.get_app_configs()), [+ Error(+ "index name 'foo' is not unique amongst models: "+ "check_framework.Model1, check_framework.Model2.",+ id='models.E030',+ ),+ ])++ def test_collision_abstract_model(self):+ class AbstractModel(models.Model):+ class Meta:+ indexes = [models.Index(fields=['id'], name='foo')]+ abstract = True++ class Model1(AbstractModel):+ pass++ class Model2(AbstractModel):+ pass++ self.assertEqual(checks.run_checks(app_configs=self.apps.get_app_configs()), [+ Error(+ "index name 'foo' is not unique amongst models: "+ "check_framework.Model1, check_framework.Model2.",+ id='models.E030',+ ),+ ])++ @modify_settings(INSTALLED_APPS={'append': 'basic'})+ @isolate_apps('basic', 'check_framework', kwarg_name='apps')+ def test_collision_across_apps(self, apps):+ index = models.Index(fields=['id'], name='foo')++ class Model1(models.Model):+ class Meta:+ app_label = 'basic'+ indexes = [index]++ class Model2(models.Model):+ class Meta:+ app_label = 'check_framework'+ indexes = [index]++ self.assertEqual(checks.run_checks(app_configs=apps.get_app_configs()), [+ Error(+ "index name 'foo' is not unique amongst models: basic.Model1, "+ "check_framework.Model2.",+ id='models.E030',+ ),+ ])+++@isolate_apps('check_framework', attr_name='apps')+@override_system_checks([checks.model_checks.check_all_models])+@skipUnlessDBFeature('supports_table_check_constraints')+class ConstraintNameTests(TestCase):+ def test_collision_in_same_model(self):+ class Model(models.Model):+ class Meta:+ constraints = [+ models.CheckConstraint(check=models.Q(id__gt=0), name='foo'),+ models.CheckConstraint(check=models.Q(id__lt=100), name='foo'),+ ]++ self.assertEqual(checks.run_checks(app_configs=self.apps.get_app_configs()), [+ Error(+ "constraint name 'foo' is not unique for model "+ "check_framework.Model.",+ id='models.E031',+ ),+ ])++ def test_collision_in_different_models(self):+ constraint = models.CheckConstraint(check=models.Q(id__gt=0), name='foo')++ class Model1(models.Model):+ class Meta:+ constraints = [constraint]++ class Model2(models.Model):+ class Meta:+ constraints = [constraint]++ self.assertEqual(checks.run_checks(app_configs=self.apps.get_app_configs()), [+ Error(+ "constraint name 'foo' is not unique amongst models: "+ "check_framework.Model1, check_framework.Model2.",+ id='models.E032',+ ),+ ])++ def test_collision_abstract_model(self):+ class AbstractModel(models.Model):+ class Meta:+ constraints = [models.CheckConstraint(check=models.Q(id__gt=0), name='foo')]+ abstract = True++ class Model1(AbstractModel):+ pass++ class Model2(AbstractModel):+ pass++ self.assertEqual(checks.run_checks(app_configs=self.apps.get_app_configs()), [+ Error(+ "constraint name 'foo' is not unique amongst models: "+ "check_framework.Model1, check_framework.Model2.",+ id='models.E032',+ ),+ ])++ @modify_settings(INSTALLED_APPS={'append': 'basic'})+ @isolate_apps('basic', 'check_framework', kwarg_name='apps')+ def test_collision_across_apps(self, apps):+ constraint = models.CheckConstraint(check=models.Q(id__gt=0), name='foo')++ class Model1(models.Model):+ class Meta:+ app_label = 'basic'+ constraints = [constraint]++ class Model2(models.Model):+ class Meta:+ app_label = 'check_framework'+ constraints = [constraint]++ self.assertEqual(checks.run_checks(app_configs=apps.get_app_configs()), [+ Error(+ "constraint name 'foo' is not unique amongst models: "+ "basic.Model1, check_framework.Model2.",+ id='models.E032',+ ),+ ])+ git diff bceadd2788dc2dad53eba0caae172bd8522fd483diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.pyindex 0c64748ccd..6ab8257987 100644--- a/django/db/models/fields/__init__.py+++ b/django/db/models/fields/__init__.py@@ -1661,7 +1661,7 @@ class EmailField(CharField): class FilePathField(Field): description = _("File path") - def __init__(self, verbose_name=None, name=None, path='', match=None,+ def __init__(self, verbose_name=None, name=None, path=None, match=None, recursive=False, allow_files=True, allow_folders=False, **kwargs): self.path, self.match, self.recursive = path, match, recursive self.allow_files, self.allow_folders = allow_files, allow_folders@@ -1687,7 +1687,9 @@ class FilePathField(Field): def deconstruct(self): name, path, args, kwargs = super().deconstruct()- if self.path != '':+ if callable(self.path):+ kwargs['path'] = self.path()+ elif self.path != '': kwargs['path'] = self.path if self.match is not None: kwargs['match'] = self.match@@ -1709,7 +1711,7 @@ class FilePathField(Field): def formfield(self, **kwargs): return super().formfield(**{- 'path': self.path,+ 'path': self.path() if callable(self.path) else self.path, 'match': self.match, 'recursive': self.recursive, 'form_class': forms.FilePathField,+ source /opt/miniconda3/bin/activate++ _CONDA_ROOT=/opt/miniconda3++ . /opt/miniconda3/etc/profile.d/conda.sh+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ '[' -z x ']'++ conda activate++ local cmd=activate++ case "$cmd" in++ __conda_activate activate++ '[' -n '' ']'++ local ask_conda+++ PS1='(testbed) '+++ __conda_exe shell.posix activate+++ /opt/miniconda3/bin/conda shell.posix activate++ ask_conda='PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''3'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ eval 'PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''3'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+++ PS1='(base) '+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export CONDA_PREFIX=/opt/miniconda3+++ CONDA_PREFIX=/opt/miniconda3+++ export CONDA_SHLVL=3+++ CONDA_SHLVL=3+++ export CONDA_DEFAULT_ENV=base+++ CONDA_DEFAULT_ENV=base+++ export 'CONDA_PROMPT_MODIFIER=(base) '+++ CONDA_PROMPT_MODIFIER='(base) '+++ export CONDA_PREFIX_2=/opt/miniconda3/envs/testbed+++ CONDA_PREFIX_2=/opt/miniconda3/envs/testbed+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ __conda_hashr++ '[' -n '' ']'++ '[' -n '' ']'++ hash -r+ conda activate testbed+ local cmd=activate+ case "$cmd" in+ __conda_activate activate testbed+ '[' -n '' ']'+ local ask_conda++ PS1='(base) '++ __conda_exe shell.posix activate testbed++ /opt/miniconda3/bin/conda shell.posix activate testbed+ ask_conda='PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''4'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_3='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+ eval 'PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''4'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_3='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ PS1='(testbed) '++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed++ CONDA_PREFIX=/opt/miniconda3/envs/testbed++ export CONDA_SHLVL=4++ CONDA_SHLVL=4++ export CONDA_DEFAULT_ENV=testbed++ CONDA_DEFAULT_ENV=testbed++ export 'CONDA_PROMPT_MODIFIER=(testbed) '++ CONDA_PROMPT_MODIFIER='(testbed) '++ export CONDA_PREFIX_3=/opt/miniconda3++ CONDA_PREFIX_3=/opt/miniconda3++ export CONDA_EXE=/opt/miniconda3/bin/conda++ CONDA_EXE=/opt/miniconda3/bin/conda++ export _CE_M=++ _CE_M=++ export _CE_CONDA=++ _CE_CONDA=++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+ __conda_hashr+ '[' -n '' ']'+ '[' -n '' ']'+ hash -r+ python -m pip install -e .Obtaining file:///testbedRequirement already satisfied: pytz in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from Django==3.0.dev20190502071320) (2024.1)Requirement already satisfied: sqlparse in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from Django==3.0.dev20190502071320) (0.4.4)Installing collected packages: Django Attempting uninstall: Django Found existing installation: Django 3.0.dev20190502071320 Uninstalling Django-3.0.dev20190502071320: Successfully uninstalled Django-3.0.dev20190502071320 Running setup.py develop for DjangoSuccessfully installed Django-3.0.dev20190502071320WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv+ git checkout bceadd2788dc2dad53eba0caae172bd8522fd483Note: switching to 'bceadd2788dc2dad53eba0caae172bd8522fd483'.
You are in 'detached HEAD' state. You can look around, make experimentalchanges and commit them, and you can discard any commits you make in thisstate without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you maydo so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at bceadd2788 Fixed #30396 -- Added system checks for uniqueness of indexes and constraints names.M django/db/models/fields/__init__.py+ git apply -v -Checking patch tests/model_fields/test_filepathfield.py...Applied patch tests/model_fields/test_filepathfield.py cleanly.+ ./tests/runtests.py --verbosity 2 --settings=test_sqlite --parallel 1 model_fields.test_filepathfieldtest_callable_path (model_fields.test_filepathfield.FilePathFieldTests) ... oktest_path (model_fields.test_filepathfield.FilePathFieldTests) ... ok
----------------------------------------------------------------------Ran 2 tests in 0.001s
OKTesting against Django installed in '/testbed/django'Importing application model_fieldsSkipping setup of unused database(s): default, other.System check identified no issues (0 silenced).+ git checkout bceadd2788dc2dad53eba0caae172bd8522fd483HEAD is now at bceadd2788 Fixed #30396 -- Added system checks for uniqueness of indexes and constraints names.M django/db/models/fields/__init__.py1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556#!/bin/bashset -uxo pipefailsource /opt/miniconda3/bin/activateconda activate testbedcd /testbedsed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-genexport LANG=en_US.UTF-8export LANGUAGE=en_US:enexport LC_ALL=en_US.UTF-8git config --global --add safe.directory /testbedcd /testbedgit statusgit showgit diff ef082ebb84f00e38af4e8880d04e8365c2766d34source /opt/miniconda3/bin/activateconda activate testbedpython -m pip install -e .git checkout ef082ebb84f00e38af4e8880d04e8365c2766d34 tests/expressions/tests.pygit apply -v - <<'EOF_114329324912'diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py--- a/tests/expressions/tests.py+++ b/tests/expressions/tests.py@@ -384,6 +384,29 @@ def test_order_by_exists(self): ) self.assertSequenceEqual(mustermanns_by_seniority, [self.max, mary]) + def test_order_by_multiline_sql(self):+ raw_order_by = (+ RawSQL('''+ CASE WHEN num_employees > 1000+ THEN num_chairs+ ELSE 0 END+ ''', []).desc(),+ RawSQL('''+ CASE WHEN num_chairs > 1+ THEN 1+ ELSE 0 END+ ''', []).asc()+ )+ for qs in (+ Company.objects.all(),+ Company.objects.distinct(),+ ):+ with self.subTest(qs=qs):+ self.assertSequenceEqual(+ qs.order_by(*raw_order_by),+ [self.example_inc, self.gmbh, self.foobar_ltd],+ )+ def test_outerref(self): inner = Company.objects.filter(point_of_contact=OuterRef('pk')) msg = (
EOF_114329324912./tests/runtests.py --verbosity 2 --settings=test_sqlite --parallel 1 expressions.testsgit checkout ef082ebb84f00e38af4e8880d04e8365c2766d34 tests/expressions/tests.py1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543diff --git a/django/db/models/sql/.backup.compiler.py b/django/db/models/sql/.backup.compiler.pynew file mode 100644index 0000000000..f96d8f30ac--- /dev/null+++ b/django/db/models/sql/.backup.compiler.py@@ -0,0 +1,1508 @@+import collections+import re+import warnings+from itertools import chain++from django.core.exceptions import EmptyResultSet, FieldError+from django.db.models.constants import LOOKUP_SEP+from django.db.models.expressions import OrderBy, Random, RawSQL, Ref+from django.db.models.query_utils import QueryWrapper, select_related_descend+from django.db.models.sql.constants import (+ CURSOR, GET_ITERATOR_CHUNK_SIZE, MULTI, NO_RESULTS, ORDER_DIR, SINGLE,+)+from django.db.models.sql.query import Query, get_order_dir+from django.db.transaction import TransactionManagementError+from django.db.utils import DatabaseError, NotSupportedError+from django.utils.deprecation import RemovedInDjango31Warning+from django.utils.hashable import make_hashable++FORCE = object()+++class SQLCompiler:+ def __init__(self, query, connection, using):+ self.query = query+ self.connection = connection+ self.using = using+ self.quote_cache = {'*': '*'}+ # The select, klass_info, and annotations are needed by QuerySet.iterator()+ # these are set as a side-effect of executing the query. Note that we calculate+ # separately a list of extra select columns needed for grammatical correctness+ # of the query, but these columns are not included in self.select.+ self.select = None+ self.annotation_col_map = None+ self.klass_info = None+ self.ordering_parts = re.compile(r'(.*)\s(ASC|DESC)(.*)')+ self._meta_ordering = None++ def setup_query(self):+ if all(self.query.alias_refcount[a] == 0 for a in self.query.alias_map):+ self.query.get_initial_alias()+ self.select, self.klass_info, self.annotation_col_map = self.get_select()+ self.col_count = len(self.select)++ def pre_sql_setup(self):+ """+ Do any necessary class setup immediately prior to producing SQL. This+ is for things that can't necessarily be done in __init__ because we+ might not have all the pieces in place at that time.+ """+ self.setup_query()+ order_by = self.get_order_by()+ self.where, self.having = self.query.where.split_having()+ extra_select = self.get_extra_select(order_by, self.select)+ self.has_extra_select = bool(extra_select)+ group_by = self.get_group_by(self.select + extra_select, order_by)+ return extra_select, order_by, group_by++ def get_group_by(self, select, order_by):+ """+ Return a list of 2-tuples of form (sql, params).++ The logic of what exactly the GROUP BY clause contains is hard+ to describe in other words than "if it passes the test suite,+ then it is correct".+ """+ # Some examples:+ # SomeModel.objects.annotate(Count('somecol'))+ # GROUP BY: all fields of the model+ #+ # SomeModel.objects.values('name').annotate(Count('somecol'))+ # GROUP BY: name+ #+ # SomeModel.objects.annotate(Count('somecol')).values('name')+ # GROUP BY: all cols of the model+ #+ # SomeModel.objects.values('name', 'pk').annotate(Count('somecol')).values('pk')+ # GROUP BY: name, pk+ #+ # SomeModel.objects.values('name').annotate(Count('somecol')).values('pk')+ # GROUP BY: name, pk+ #+ # In fact, the self.query.group_by is the minimal set to GROUP BY. It+ # can't be ever restricted to a smaller set, but additional columns in+ # HAVING, ORDER BY, and SELECT clauses are added to it. Unfortunately+ # the end result is that it is impossible to force the query to have+ # a chosen GROUP BY clause - you can almost do this by using the form:+ # .values(*wanted_cols).annotate(AnAggregate())+ # but any later annotations, extra selects, values calls that+ # refer some column outside of the wanted_cols, order_by, or even+ # filter calls can alter the GROUP BY clause.++ # The query.group_by is either None (no GROUP BY at all), True+ # (group by select fields), or a list of expressions to be added+ # to the group by.+ if self.query.group_by is None:+ return []+ expressions = []+ if self.query.group_by is not True:+ # If the group by is set to a list (by .values() call most likely),+ # then we need to add everything in it to the GROUP BY clause.+ # Backwards compatibility hack for setting query.group_by. Remove+ # when we have public API way of forcing the GROUP BY clause.+ # Converts string references to expressions.+ for expr in self.query.group_by:+ if not hasattr(expr, 'as_sql'):+ expressions.append(self.query.resolve_ref(expr))+ else:+ expressions.append(expr)+ # Note that even if the group_by is set, it is only the minimal+ # set to group by. So, we need to add cols in select, order_by, and+ # having into the select in any case.+ for expr, _, _ in select:+ cols = expr.get_group_by_cols()+ for col in cols:+ expressions.append(col)+ for expr, (sql, params, is_ref) in order_by:+ # Skip References to the select clause, as all expressions in the+ # select clause are already part of the group by.+ if not expr.contains_aggregate and not is_ref:+ expressions.extend(expr.get_source_expressions())+ having_group_by = self.having.get_group_by_cols() if self.having else ()+ for expr in having_group_by:+ expressions.append(expr)+ result = []+ seen = set()+ expressions = self.collapse_group_by(expressions, having_group_by)++ for expr in expressions:+ sql, params = self.compile(expr)+ params_hash = make_hashable(params)+ if (sql, params_hash) not in seen:+ result.append((sql, params))+ seen.add((sql, params_hash))+ return result++ def collapse_group_by(self, expressions, having):+ # If the DB can group by primary key, then group by the primary key of+ # query's main model. Note that for PostgreSQL the GROUP BY clause must+ # include the primary key of every table, but for MySQL it is enough to+ # have the main table's primary key.+ if self.connection.features.allows_group_by_pk:+ # Determine if the main model's primary key is in the query.+ pk = None+ for expr in expressions:+ # Is this a reference to query's base table primary key? If the+ # expression isn't a Col-like, then skip the expression.+ if (getattr(expr, 'target', None) == self.query.model._meta.pk and+ getattr(expr, 'alias', None) == self.query.base_table):+ pk = expr+ break+ # If the main model's primary key is in the query, group by that+ # field, HAVING expressions, and expressions associated with tables+ # that don't have a primary key included in the grouped columns.+ if pk:+ pk_aliases = {+ expr.alias for expr in expressions+ if hasattr(expr, 'target') and expr.target.primary_key+ }+ expressions = [pk] + [+ expr for expr in expressions+ if expr in having or (+ getattr(expr, 'alias', None) is not None and expr.alias not in pk_aliases+ )+ ]+ elif self.connection.features.allows_group_by_selected_pks:+ # Filter out all expressions associated with a table's primary key+ # present in the grouped columns. This is done by identifying all+ # tables that have their primary key included in the grouped+ # columns and removing non-primary key columns referring to them.+ # Unmanaged models are excluded because they could be representing+ # database views on which the optimization might not be allowed.+ pks = {+ expr for expr in expressions+ if hasattr(expr, 'target') and expr.target.primary_key and expr.target.model._meta.managed+ }+ aliases = {expr.alias for expr in pks}+ expressions = [+ expr for expr in expressions if expr in pks or getattr(expr, 'alias', None) not in aliases+ ]+ return expressions++ def get_select(self):+ """+ Return three values:+ - a list of 3-tuples of (expression, (sql, params), alias)+ - a klass_info structure,+ - a dictionary of annotations++ The (sql, params) is what the expression will produce, and alias is the+ "AS alias" for the column (possibly None).++ The klass_info structure contains the following information:+ - The base model of the query.+ - Which columns for that model are present in the query (by+ position of the select clause).+ - related_klass_infos: [f, klass_info] to descent into++ The annotations is a dictionary of {'attname': column position} values.+ """+ select = []+ klass_info = None+ annotations = {}+ select_idx = 0+ for alias, (sql, params) in self.query.extra_select.items():+ annotations[alias] = select_idx+ select.append((RawSQL(sql, params), alias))+ select_idx += 1+ assert not (self.query.select and self.query.default_cols)+ if self.query.default_cols:+ cols = self.get_default_columns()+ else:+ # self.query.select is a special case. These columns never go to+ # any model.+ cols = self.query.select+ if cols:+ select_list = []+ for col in cols:+ select_list.append(select_idx)+ select.append((col, None))+ select_idx += 1+ klass_info = {+ 'model': self.query.model,+ 'select_fields': select_list,+ }+ for alias, annotation in self.query.annotation_select.items():+ annotations[alias] = select_idx+ select.append((annotation, alias))+ select_idx += 1++ if self.query.select_related:+ related_klass_infos = self.get_related_selections(select)+ klass_info['related_klass_infos'] = related_klass_infos++ def get_select_from_parent(klass_info):+ for ki in klass_info['related_klass_infos']:+ if ki['from_parent']:+ ki['select_fields'] = (klass_info['select_fields'] ++ ki['select_fields'])+ get_select_from_parent(ki)+ get_select_from_parent(klass_info)++ ret = []+ for col, alias in select:+ try:+ sql, params = self.compile(col, select_format=True)+ except EmptyResultSet:+ # Select a predicate that's always False.+ sql, params = '0', ()+ ret.append((col, (sql, params), alias))+ return ret, klass_info, annotations++ def get_order_by(self):+ """+ Return a list of 2-tuples of form (expr, (sql, params, is_ref)) for the+ ORDER BY clause.++ The order_by clause can alter the select clause (for example it+ can add aliases to clauses that do not yet have one, or it can+ add totally new select clauses).+ """+ if self.query.extra_order_by:+ ordering = self.query.extra_order_by+ elif not self.query.default_ordering:+ ordering = self.query.order_by+ elif self.query.order_by:+ ordering = self.query.order_by+ elif self.query.get_meta().ordering:+ ordering = self.query.get_meta().ordering+ self._meta_ordering = ordering+ else:+ ordering = []+ if self.query.standard_ordering:+ asc, desc = ORDER_DIR['ASC']+ else:+ asc, desc = ORDER_DIR['DESC']++ order_by = []+ for field in ordering:+ if hasattr(field, 'resolve_expression'):+ if not isinstance(field, OrderBy):+ field = field.asc()+ if not self.query.standard_ordering:+ field.reverse_ordering()+ order_by.append((field, False))+ continue+ if field == '?': # random+ order_by.append((OrderBy(Random()), False))+ continue++ col, order = get_order_dir(field, asc)+ descending = order == 'DESC'++ if col in self.query.annotation_select:+ # Reference to expression in SELECT clause+ order_by.append((+ OrderBy(Ref(col, self.query.annotation_select[col]), descending=descending),+ True))+ continue+ if col in self.query.annotations:+ # References to an expression which is masked out of the SELECT clause+ order_by.append((+ OrderBy(self.query.annotations[col], descending=descending),+ False))+ continue++ if '.' in field:+ # This came in through an extra(order_by=...) addition. Pass it+ # on verbatim.+ table, col = col.split('.', 1)+ order_by.append((+ OrderBy(+ RawSQL('%s.%s' % (self.quote_name_unless_alias(table), col), []),+ descending=descending+ ), False))+ continue++ if not self.query.extra or col not in self.query.extra:+ # 'col' is of the form 'field' or 'field1__field2' or+ # '-field1__field2__field', etc.+ order_by.extend(self.find_ordering_name(+ field, self.query.get_meta(), default_order=asc))+ else:+ if col not in self.query.extra_select:+ order_by.append((+ OrderBy(RawSQL(*self.query.extra[col]), descending=descending),+ False))+ else:+ order_by.append((+ OrderBy(Ref(col, RawSQL(*self.query.extra[col])), descending=descending),+ True))+ result = []+ seen = set()++ for expr, is_ref in order_by:+ resolved = expr.resolve_expression(self.query, allow_joins=True, reuse=None)+ if self.query.combinator:+ src = resolved.get_source_expressions()[0]+ # Relabel order by columns to raw numbers if this is a combined+ # query; necessary since the columns can't be referenced by the+ # fully qualified name and the simple column names may collide.+ for idx, (sel_expr, _, col_alias) in enumerate(self.select):+ if is_ref and col_alias == src.refs:+ src = src.source+ elif col_alias:+ continue+ if src == sel_expr:+ resolved.set_source_expressions([RawSQL('%d' % (idx + 1), ())])+ break+ else:+ raise DatabaseError('ORDER BY term does not match any column in the result set.')+ sql, params = self.compile(resolved)+# Don't add the same column twice, but the order direction is+ # not taken into account so we strip it. When this entire method+ # is refactored into expressions, then we can check each part as we+ # generate it.+ sql_oneline = ' '.join(sql.split('\n'))+ without_ordering = self.ordering_parts.search(sql_oneline).group(1)+ params_hash = make_hashable(params)+ if (without_ordering, params_hash) in seen:+ continue+ seen.add((without_ordering, params_hash))+ result.append((resolved, (sql, params, is_ref)))+ return result++ def get_extra_select(self, order_by, select):+ extra_select = []+ if self.query.distinct and not self.query.distinct_fields:+ select_sql = [t[1] for t in select]+ for expr, (sql, params, is_ref) in order_by:+ without_ordering = self.ordering_parts.search(sql).group(1)+ if not is_ref and (without_ordering, params) not in select_sql:+ extra_select.append((expr, (without_ordering, params), None))+ return extra_select++ def quote_name_unless_alias(self, name):+ """+ A wrapper around connection.ops.quote_name that doesn't quote aliases+ for table names. This avoids problems with some SQL dialects that treat+ quoted strings specially (e.g. PostgreSQL).+ """+ if name in self.quote_cache:+ return self.quote_cache[name]+ if ((name in self.query.alias_map and name not in self.query.table_map) or+ name in self.query.extra_select or (+ name in self.query.external_aliases and name not in self.query.table_map)):+ self.quote_cache[name] = name+ return name+ r = self.connection.ops.quote_name(name)+ self.quote_cache[name] = r+ return r++ def compile(self, node, select_format=False):+ vendor_impl = getattr(node, 'as_' + self.connection.vendor, None)+ if vendor_impl:+ sql, params = vendor_impl(self, self.connection)+ else:+ sql, params = node.as_sql(self, self.connection)+ if select_format is FORCE or (select_format and not self.query.subquery):+ return node.output_field.select_format(self, sql, params)+ return sql, params++ def get_combinator_sql(self, combinator, all):+ features = self.connection.features+ compilers = [+ query.get_compiler(self.using, self.connection)+ for query in self.query.combined_queries if not query.is_empty()+ ]+ if not features.supports_slicing_ordering_in_compound:+ for query, compiler in zip(self.query.combined_queries, compilers):+ if query.low_mark or query.high_mark:+ raise DatabaseError('LIMIT/OFFSET not allowed in subqueries of compound statements.')+ if compiler.get_order_by():+ raise DatabaseError('ORDER BY not allowed in subqueries of compound statements.')+ parts = ()+ for compiler in compilers:+ try:+ # If the columns list is limited, then all combined queries+ # must have the same columns list. Set the selects defined on+ # the query on all combined queries, if not already set.+ if not compiler.query.values_select and self.query.values_select:+ compiler.query.set_values((+ *self.query.extra_select,+ *self.query.values_select,+ *self.query.annotation_select,+ ))+ part_sql, part_args = compiler.as_sql()+ if compiler.query.combinator:+ # Wrap in a subquery if wrapping in parentheses isn't+ # supported.+ if not features.supports_parentheses_in_compound:+ part_sql = 'SELECT * FROM ({})'.format(part_sql)+ # Add parentheses when combining with compound query if not+ # already added for all compound queries.+ elif not features.supports_slicing_ordering_in_compound:+ part_sql = '({})'.format(part_sql)+ parts += ((part_sql, part_args),)+ except EmptyResultSet:+ # Omit the empty queryset with UNION and with DIFFERENCE if the+ # first queryset is nonempty.+ if combinator == 'union' or (combinator == 'difference' and parts):+ continue+ raise+ if not parts:+ raise EmptyResultSet+ combinator_sql = self.connection.ops.set_operators[combinator]+ if all and combinator == 'union':+ combinator_sql += ' ALL'+ braces = '({})' if features.supports_slicing_ordering_in_compound else '{}'+ sql_parts, args_parts = zip(*((braces.format(sql), args) for sql, args in parts))+ result = [' {} '.format(combinator_sql).join(sql_parts)]+ params = []+ for part in args_parts:+ params.extend(part)+ return result, params++ def as_sql(self, with_limits=True, with_col_aliases=False):+ """+ Create the SQL for this query. Return the SQL string and list of+ parameters.++ If 'with_limits' is False, any limit/offset information is not included+ in the query.+ """+ refcounts_before = self.query.alias_refcount.copy()+ try:+ extra_select, order_by, group_by = self.pre_sql_setup()+ for_update_part = None+ # Is a LIMIT/OFFSET clause needed?+ with_limit_offset = with_limits and (self.query.high_mark is not None or self.query.low_mark)+ combinator = self.query.combinator+ features = self.connection.features+ if combinator:+ if not getattr(features, 'supports_select_{}'.format(combinator)):+ raise NotSupportedError('{} is not supported on this database backend.'.format(combinator))+ result, params = self.get_combinator_sql(combinator, self.query.combinator_all)+ else:+ distinct_fields, distinct_params = self.get_distinct()+ # This must come after 'select', 'ordering', and 'distinct'+ # (see docstring of get_from_clause() for details).+ from_, f_params = self.get_from_clause()+ where, w_params = self.compile(self.where) if self.where is not None else ("", [])+ having, h_params = self.compile(self.having) if self.having is not None else ("", [])+ result = ['SELECT']+ params = []++ if self.query.distinct:+ distinct_result, distinct_params = self.connection.ops.distinct_sql(+ distinct_fields,+ distinct_params,+ )+ result += distinct_result+ params += distinct_params++ out_cols = []+ col_idx = 1+ for _, (s_sql, s_params), alias in self.select + extra_select:+ if alias:+ s_sql = '%s AS %s' % (s_sql, self.connection.ops.quote_name(alias))+ elif with_col_aliases:+ s_sql = '%s AS %s' % (s_sql, 'Col%d' % col_idx)+ col_idx += 1+ params.extend(s_params)+ out_cols.append(s_sql)++ result += [', '.join(out_cols), 'FROM', *from_]+ params.extend(f_params)++ if self.query.select_for_update and self.connection.features.has_select_for_update:+ if self.connection.get_autocommit():+ raise TransactionManagementError('select_for_update cannot be used outside of a transaction.')++ if with_limit_offset and not self.connection.features.supports_select_for_update_with_limit:+ raise NotSupportedError(+ 'LIMIT/OFFSET is not supported with '+ 'select_for_update on this database backend.'+ )+ nowait = self.query.select_for_update_nowait+ skip_locked = self.query.select_for_update_skip_locked+ of = self.query.select_for_update_of+ # If it's a NOWAIT/SKIP LOCKED/OF query but the backend+ # doesn't support it, raise NotSupportedError to prevent a+ # possible deadlock.+ if nowait and not self.connection.features.has_select_for_update_nowait:+ raise NotSupportedError('NOWAIT is not supported on this database backend.')+ elif skip_locked and not self.connection.features.has_select_for_update_skip_locked:+ raise NotSupportedError('SKIP LOCKED is not supported on this database backend.')+ elif of and not self.connection.features.has_select_for_update_of:+ raise NotSupportedError('FOR UPDATE OF is not supported on this database backend.')+ for_update_part = self.connection.ops.for_update_sql(+ nowait=nowait,+ skip_locked=skip_locked,+ of=self.get_select_for_update_of_arguments(),+ )++ if for_update_part and self.connection.features.for_update_after_from:+ result.append(for_update_part)++ if where:+ result.append('WHERE %s' % where)+ params.extend(w_params)++ grouping = []+ for g_sql, g_params in group_by:+ grouping.append(g_sql)+ params.extend(g_params)+ if grouping:+ if distinct_fields:+ raise NotImplementedError('annotate() + distinct(fields) is not implemented.')+ order_by = order_by or self.connection.ops.force_no_ordering()+ result.append('GROUP BY %s' % ', '.join(grouping))+ if self._meta_ordering:+ # When the deprecation ends, replace with:+ # order_by = None+ warnings.warn(+ "%s QuerySet won't use Meta.ordering in Django 3.1. "+ "Add .order_by('%s') to retain the current query." % (+ self.query.model.__name__,+ "', '".join(self._meta_ordering)+ ),+ RemovedInDjango31Warning,+ stacklevel=4,+ )+ if having:+ result.append('HAVING %s' % having)+ params.extend(h_params)++ if self.query.explain_query:+ result.insert(0, self.connection.ops.explain_query_prefix(+ self.query.explain_format,+ **self.query.explain_options+ ))++ if order_by:+ ordering = []+ for _, (o_sql, o_params, _) in order_by:+ ordering.append(o_sql)+ params.extend(o_params)+ result.append('ORDER BY %s' % ', '.join(ordering))++ if with_limit_offset:+ result.append(self.connection.ops.limit_offset_sql(self.query.low_mark, self.query.high_mark))++ if for_update_part and not self.connection.features.for_update_after_from:+ result.append(for_update_part)++ if self.query.subquery and extra_select:+ # If the query is used as a subquery, the extra selects would+ # result in more columns than the left-hand side expression is+ # expecting. This can happen when a subquery uses a combination+ # of order_by() and distinct(), forcing the ordering expressions+ # to be selected as well. Wrap the query in another subquery+ # to exclude extraneous selects.+ sub_selects = []+ sub_params = []+ for index, (select, _, alias) in enumerate(self.select, start=1):+ if not alias and with_col_aliases:+ alias = 'col%d' % index+ if alias:+ sub_selects.append("%s.%s" % (+ self.connection.ops.quote_name('subquery'),+ self.connection.ops.quote_name(alias),+ ))+ else:+ select_clone = select.relabeled_clone({select.alias: 'subquery'})+ subselect, subparams = select_clone.as_sql(self, self.connection)+ sub_selects.append(subselect)+ sub_params.extend(subparams)+ return 'SELECT %s FROM (%s) subquery' % (+ ', '.join(sub_selects),+ ' '.join(result),+ ), tuple(sub_params + params)++ return ' '.join(result), tuple(params)+ finally:+ # Finally do cleanup - get rid of the joins we created above.+ self.query.reset_refcounts(refcounts_before)++ def get_default_columns(self, start_alias=None, opts=None, from_parent=None):+ """+ Compute the default columns for selecting every field in the base+ model. Will sometimes be called to pull in related models (e.g. via+ select_related), in which case "opts" and "start_alias" will be given+ to provide a starting point for the traversal.++ Return a list of strings, quoted appropriately for use in SQL+ directly, as well as a set of aliases used in the select statement (if+ 'as_pairs' is True, return a list of (alias, col_name) pairs instead+ of strings as the first component and None as the second component).+ """+ result = []+ if opts is None:+ opts = self.query.get_meta()+ only_load = self.deferred_to_columns()+ start_alias = start_alias or self.query.get_initial_alias()+ # The 'seen_models' is used to optimize checking the needed parent+ # alias for a given field. This also includes None -> start_alias to+ # be used by local fields.+ seen_models = {None: start_alias}++ for field in opts.concrete_fields:+ model = field.model._meta.concrete_model+ # A proxy model will have a different model and concrete_model. We+ # will assign None if the field belongs to this model.+ if model == opts.model:+ model = None+ if from_parent and model is not None and issubclass(+ from_parent._meta.concrete_model, model._meta.concrete_model):+ # Avoid loading data for already loaded parents.+ # We end up here in the case select_related() resolution+ # proceeds from parent model to child model. In that case the+ # parent model data is already present in the SELECT clause,+ # and we want to avoid reloading the same data again.+ continue+ if field.model in only_load and field.attname not in only_load[field.model]:+ continue+ alias = self.query.join_parent_model(opts, model, start_alias,+ seen_models)+ column = field.get_col(alias)+ result.append(column)+ return result++ def get_distinct(self):+ """+ Return a quoted list of fields to use in DISTINCT ON part of the query.++ This method can alter the tables in the query, and thus it must be+ called before get_from_clause().+ """+ result = []+ params = []+ opts = self.query.get_meta()++ for name in self.query.distinct_fields:+ parts = name.split(LOOKUP_SEP)+ _, targets, alias, joins, path, _, transform_function = self._setup_joins(parts, opts, None)+ targets, alias, _ = self.query.trim_joins(targets, joins, path)+ for target in targets:+ if name in self.query.annotation_select:+ result.append(name)+ else:+ r, p = self.compile(transform_function(target, alias))+ result.append(r)+ params.append(p)+ return result, params++ def find_ordering_name(self, name, opts, alias=None, default_order='ASC',+ already_seen=None):+ """+ Return the table alias (the name might be ambiguous, the alias will+ not be) and column name for ordering by the given 'name' parameter.+ The 'name' is of the form 'field1__field2__...__fieldN'.+ """+ name, order = get_order_dir(name, default_order)+ descending = order == 'DESC'+ pieces = name.split(LOOKUP_SEP)+ field, targets, alias, joins, path, opts, transform_function = self._setup_joins(pieces, opts, alias)++ # If we get to this point and the field is a relation to another model,+ # append the default ordering for that model unless the attribute name+ # of the field is specified.+ if field.is_relation and opts.ordering and getattr(field, 'attname', None) != name:+ # Firstly, avoid infinite loops.+ already_seen = already_seen or set()+ join_tuple = tuple(getattr(self.query.alias_map[j], 'join_cols', None) for j in joins)+ if join_tuple in already_seen:+ raise FieldError('Infinite loop caused by ordering.')+ already_seen.add(join_tuple)++ results = []+ for item in opts.ordering:+ results.extend(self.find_ordering_name(item, opts, alias,+ order, already_seen))+ return results+ targets, alias, _ = self.query.trim_joins(targets, joins, path)+ return [(OrderBy(transform_function(t, alias), descending=descending), False) for t in targets]++ def _setup_joins(self, pieces, opts, alias):+ """+ Helper method for get_order_by() and get_distinct().++ get_ordering() and get_distinct() must produce same target columns on+ same input, as the prefixes of get_ordering() and get_distinct() must+ match. Executing SQL where this is not true is an error.+ """+ alias = alias or self.query.get_initial_alias()+ field, targets, opts, joins, path, transform_function = self.query.setup_joins(pieces, opts, alias)+ alias = joins[-1]+ return field, targets, alias, joins, path, opts, transform_function++ def get_from_clause(self):+ """+ Return a list of strings that are joined together to go after the+ "FROM" part of the query, as well as a list any extra parameters that+ need to be included. Subclasses, can override this to create a+ from-clause via a "select".++ This should only be called after any SQL construction methods that+ might change the tables that are needed. This means the select columns,+ ordering, and distinct must be done first.+ """+ result = []+ params = []+ for alias in tuple(self.query.alias_map):+ if not self.query.alias_refcount[alias]:+ continue+ try:+ from_clause = self.query.alias_map[alias]+ except KeyError:+ # Extra tables can end up in self.tables, but not in the+ # alias_map if they aren't in a join. That's OK. We skip them.+ continue+ clause_sql, clause_params = self.compile(from_clause)+ result.append(clause_sql)+ params.extend(clause_params)+ for t in self.query.extra_tables:+ alias, _ = self.query.table_alias(t)+ # Only add the alias if it's not already present (the table_alias()+ # call increments the refcount, so an alias refcount of one means+ # this is the only reference).+ if alias not in self.query.alias_map or self.query.alias_refcount[alias] == 1:+ result.append(', %s' % self.quote_name_unless_alias(alias))+ return result, params++ def get_related_selections(self, select, opts=None, root_alias=None, cur_depth=1,+ requested=None, restricted=None):+ """+ Fill in the information needed for a select_related query. The current+ depth is measured as the number of connections away from the root model+ (for example, cur_depth=1 means we are looking at models with direct+ connections to the root model).+ """+ def _get_field_choices():+ direct_choices = (f.name for f in opts.fields if f.is_relation)+ reverse_choices = (+ f.field.related_query_name()+ for f in opts.related_objects if f.field.unique+ )+ return chain(direct_choices, reverse_choices, self.query._filtered_relations)++ related_klass_infos = []+ if not restricted and cur_depth > self.query.max_depth:+ # We've recursed far enough; bail out.+ return related_klass_infos++ if not opts:+ opts = self.query.get_meta()+ root_alias = self.query.get_initial_alias()+ only_load = self.query.get_loaded_field_names()++ # Setup for the case when only particular related fields should be+ # included in the related selection.+ fields_found = set()+ if requested is None:+ restricted = isinstance(self.query.select_related, dict)+ if restricted:+ requested = self.query.select_related++ def get_related_klass_infos(klass_info, related_klass_infos):+ klass_info['related_klass_infos'] = related_klass_infos++ for f in opts.fields:+ field_model = f.model._meta.concrete_model+ fields_found.add(f.name)++ if restricted:+ next = requested.get(f.name, {})+ if not f.is_relation:+ # If a non-related field is used like a relation,+ # or if a single non-relational field is given.+ if next or f.name in requested:+ raise FieldError(+ "Non-relational field given in select_related: '%s'. "+ "Choices are: %s" % (+ f.name,+ ", ".join(_get_field_choices()) or '(none)',+ )+ )+ else:+ next = False++ if not select_related_descend(f, restricted, requested,+ only_load.get(field_model)):+ continue+ klass_info = {+ 'model': f.remote_field.model,+ 'field': f,+ 'reverse': False,+ 'local_setter': f.set_cached_value,+ 'remote_setter': f.remote_field.set_cached_value if f.unique else lambda x, y: None,+ 'from_parent': False,+ }+ related_klass_infos.append(klass_info)+ select_fields = []+ _, _, _, joins, _, _ = self.query.setup_joins(+ [f.name], opts, root_alias)+ alias = joins[-1]+ columns = self.get_default_columns(start_alias=alias, opts=f.remote_field.model._meta)+ for col in columns:+ select_fields.append(len(select))+ select.append((col, None))+ klass_info['select_fields'] = select_fields+ next_klass_infos = self.get_related_selections(+ select, f.remote_field.model._meta, alias, cur_depth + 1, next, restricted)+ get_related_klass_infos(klass_info, next_klass_infos)++ if restricted:+ related_fields = [+ (o.field, o.related_model)+ for o in opts.related_objects+ if o.field.unique and not o.many_to_many+ ]+ for f, model in related_fields:+ if not select_related_descend(f, restricted, requested,+ only_load.get(model), reverse=True):+ continue++ related_field_name = f.related_query_name()+ fields_found.add(related_field_name)++ join_info = self.query.setup_joins([related_field_name], opts, root_alias)+ alias = join_info.joins[-1]+ from_parent = issubclass(model, opts.model) and model is not opts.model+ klass_info = {+ 'model': model,+ 'field': f,+ 'reverse': True,+ 'local_setter': f.remote_field.set_cached_value,+ 'remote_setter': f.set_cached_value,+ 'from_parent': from_parent,+ }+ related_klass_infos.append(klass_info)+ select_fields = []+ columns = self.get_default_columns(+ start_alias=alias, opts=model._meta, from_parent=opts.model)+ for col in columns:+ select_fields.append(len(select))+ select.append((col, None))+ klass_info['select_fields'] = select_fields+ next = requested.get(f.related_query_name(), {})+ next_klass_infos = self.get_related_selections(+ select, model._meta, alias, cur_depth + 1,+ next, restricted)+ get_related_klass_infos(klass_info, next_klass_infos)+ for name in list(requested):+ # Filtered relations work only on the topmost level.+ if cur_depth > 1:+ break+ if name in self.query._filtered_relations:+ fields_found.add(name)+ f, _, join_opts, joins, _, _ = self.query.setup_joins([name], opts, root_alias)+ model = join_opts.model+ alias = joins[-1]+ from_parent = issubclass(model, opts.model) and model is not opts.model++ def local_setter(obj, from_obj):+ # Set a reverse fk object when relation is non-empty.+ if from_obj:+ f.remote_field.set_cached_value(from_obj, obj)++ def remote_setter(obj, from_obj):+ setattr(from_obj, name, obj)+ klass_info = {+ 'model': model,+ 'field': f,+ 'reverse': True,+ 'local_setter': local_setter,+ 'remote_setter': remote_setter,+ 'from_parent': from_parent,+ }+ related_klass_infos.append(klass_info)+ select_fields = []+ columns = self.get_default_columns(+ start_alias=alias, opts=model._meta,+ from_parent=opts.model,+ )+ for col in columns:+ select_fields.append(len(select))+ select.append((col, None))+ klass_info['select_fields'] = select_fields+ next_requested = requested.get(name, {})+ next_klass_infos = self.get_related_selections(+ select, opts=model._meta, root_alias=alias,+ cur_depth=cur_depth + 1, requested=next_requested,+ restricted=restricted,+ )+ get_related_klass_infos(klass_info, next_klass_infos)+ fields_not_found = set(requested).difference(fields_found)+ if fields_not_found:+ invalid_fields = ("'%s'" % s for s in fields_not_found)+ raise FieldError(+ 'Invalid field name(s) given in select_related: %s. '+ 'Choices are: %s' % (+ ', '.join(invalid_fields),+ ', '.join(_get_field_choices()) or '(none)',+ )+ )+ return related_klass_infos++ def get_select_for_update_of_arguments(self):+ """+ Return a quoted list of arguments for the SELECT FOR UPDATE OF part of+ the query.+ """+ def _get_field_choices():+ """Yield all allowed field paths in breadth-first search order."""+ queue = collections.deque([(None, self.klass_info)])+ while queue:+ parent_path, klass_info = queue.popleft()+ if parent_path is None:+ path = []+ yield 'self'+ else:+ field = klass_info['field']+ if klass_info['reverse']:+ field = field.remote_field+ path = parent_path + [field.name]+ yield LOOKUP_SEP.join(path)+ queue.extend(+ (path, klass_info)+ for klass_info in klass_info.get('related_klass_infos', [])+ )+ result = []+ invalid_names = []+ for name in self.query.select_for_update_of:+ parts = [] if name == 'self' else name.split(LOOKUP_SEP)+ klass_info = self.klass_info+ for part in parts:+ for related_klass_info in klass_info.get('related_klass_infos', []):+ field = related_klass_info['field']+ if related_klass_info['reverse']:+ field = field.remote_field+ if field.name == part:+ klass_info = related_klass_info+ break+ else:+ klass_info = None+ break+ if klass_info is None:+ invalid_names.append(name)+ continue+ select_index = klass_info['select_fields'][0]+ col = self.select[select_index][0]+ if self.connection.features.select_for_update_of_column:+ result.append(self.compile(col)[0])+ else:+ result.append(self.quote_name_unless_alias(col.alias))+ if invalid_names:+ raise FieldError(+ 'Invalid field name(s) given in select_for_update(of=(...)): %s. '+ 'Only relational fields followed in the query are allowed. '+ 'Choices are: %s.' % (+ ', '.join(invalid_names),+ ', '.join(_get_field_choices()),+ )+ )+ return result++ def deferred_to_columns(self):+ """+ Convert the self.deferred_loading data structure to mapping of table+ names to sets of column names which are to be loaded. Return the+ dictionary.+ """+ columns = {}+ self.query.deferred_to_data(columns, self.query.get_loaded_field_names_cb)+ return columns++ def get_converters(self, expressions):+ converters = {}+ for i, expression in enumerate(expressions):+ if expression:+ backend_converters = self.connection.ops.get_db_converters(expression)+ field_converters = expression.get_db_converters(self.connection)+ if backend_converters or field_converters:+ converters[i] = (backend_converters + field_converters, expression)+ return converters++ def apply_converters(self, rows, converters):+ connection = self.connection+ converters = list(converters.items())+ for row in map(list, rows):+ for pos, (convs, expression) in converters:+ value = row[pos]+ for converter in convs:+ value = converter(value, expression, connection)+ row[pos] = value+ yield row++ def results_iter(self, results=None, tuple_expected=False, chunked_fetch=False,+ chunk_size=GET_ITERATOR_CHUNK_SIZE):+ """Return an iterator over the results from executing this query."""+ if results is None:+ results = self.execute_sql(MULTI, chunked_fetch=chunked_fetch, chunk_size=chunk_size)+ fields = [s[0] for s in self.select[0:self.col_count]]+ converters = self.get_converters(fields)+ rows = chain.from_iterable(results)+ if converters:+ rows = self.apply_converters(rows, converters)+ if tuple_expected:+ rows = map(tuple, rows)+ return rows++ def has_results(self):+ """+ Backends (e.g. NoSQL) can override this in order to use optimized+ versions of "query has any results."+ """+ # This is always executed on a query clone, so we can modify self.query+ self.query.add_extra({'a': 1}, None, None, None, None, None)+ self.query.set_extra_mask(['a'])+ return bool(self.execute_sql(SINGLE))++ def execute_sql(self, result_type=MULTI, chunked_fetch=False, chunk_size=GET_ITERATOR_CHUNK_SIZE):+ """+ Run the query against the database and return the result(s). The+ return value is a single data item if result_type is SINGLE, or an+ iterator over the results if the result_type is MULTI.++ result_type is either MULTI (use fetchmany() to retrieve all rows),+ SINGLE (only retrieve a single row), or None. In this last case, the+ cursor is returned if any query is executed, since it's used by+ subclasses such as InsertQuery). It's possible, however, that no query+ is needed, as the filters describe an empty set. In that case, None is+ returned, to avoid any unnecessary database interaction.+ """+ result_type = result_type or NO_RESULTS+ try:+ sql, params = self.as_sql()+ if not sql:+ raise EmptyResultSet+ except EmptyResultSet:+ if result_type == MULTI:+ return iter([])+ else:+ return+ if chunked_fetch:+ cursor = self.connection.chunked_cursor()+ else:+ cursor = self.connection.cursor()+ try:+ cursor.execute(sql, params)+ except Exception:+ # Might fail for server-side cursors (e.g. connection closed)+ cursor.close()+ raise++ if result_type == CURSOR:+ # Give the caller the cursor to process and close.+ return cursor+ if result_type == SINGLE:+ try:+ val = cursor.fetchone()+ if val:+ return val[0:self.col_count]+ return val+ finally:+ # done with the cursor+ cursor.close()+ if result_type == NO_RESULTS:+ cursor.close()+ return++ result = cursor_iter(+ cursor, self.connection.features.empty_fetchmany_value,+ self.col_count if self.has_extra_select else None,+ chunk_size,+ )+ if not chunked_fetch or not self.connection.features.can_use_chunked_reads:+ try:+ # If we are using non-chunked reads, we return the same data+ # structure as normally, but ensure it is all read into memory+ # before going any further. Use chunked_fetch if requested,+ # unless the database doesn't support it.+ return list(result)+ finally:+ # done with the cursor+ cursor.close()+ return result++ def as_subquery_condition(self, alias, columns, compiler):+ qn = compiler.quote_name_unless_alias+ qn2 = self.connection.ops.quote_name++ for index, select_col in enumerate(self.query.select):+ lhs_sql, lhs_params = self.compile(select_col)+ rhs = '%s.%s' % (qn(alias), qn2(columns[index]))+ self.query.where.add(+ QueryWrapper('%s = %s' % (lhs_sql, rhs), lhs_params), 'AND')++ sql, params = self.as_sql()+ return 'EXISTS (%s)' % sql, params++ def explain_query(self):+ result = list(self.execute_sql())+ # Some backends return 1 item tuples with strings, and others return+ # tuples with integers and strings. Flatten them out into strings.+ for row in result[0]:+ if not isinstance(row, str):+ yield ' '.join(str(c) for c in row)+ else:+ yield row+++class SQLInsertCompiler(SQLCompiler):+ return_id = False++ def field_as_sql(self, field, val):+ """+ Take a field and a value intended to be saved on that field, and+ return placeholder SQL and accompanying params. Check for raw values,+ expressions, and fields with get_placeholder() defined in that order.++ When field is None, consider the value raw and use it as the+ placeholder, with no corresponding parameters returned.+ """+ if field is None:+ # A field value of None means the value is raw.+ sql, params = val, []+ elif hasattr(val, 'as_sql'):+ # This is an expression, let's compile it.+ sql, params = self.compile(val)+ elif hasattr(field, 'get_placeholder'):+ # Some fields (e.g. geo fields) need special munging before+ # they can be inserted.+ sql, params = field.get_placeholder(val, self, self.connection), [val]+ else:+ # Return the common case for the placeholder+ sql, params = '%s', [val]++ # The following hook is only used by Oracle Spatial, which sometimes+ # needs to yield 'NULL' and [] as its placeholder and params instead+ # of '%s' and [None]. The 'NULL' placeholder is produced earlier by+ # OracleOperations.get_geom_placeholder(). The following line removes+ # the corresponding None parameter. See ticket #10888.+ params = self.connection.ops.modify_insert_params(sql, params)++ return sql, params++ def prepare_value(self, field, value):+ """+ Prepare a value to be used in a query by resolving it if it is an+ expression and otherwise calling the field's get_db_prep_save().+ """+ if hasattr(value, 'resolve_expression'):+ value = value.resolve_expression(self.query, allow_joins=False, for_save=True)+ # Don't allow values containing Col expressions. They refer to+ # existing columns on a row, but in the case of insert the row+ # doesn't exist yet.+ if value.contains_column_references:+ raise ValueError(+ 'Failed to insert expression "%s" on %s. F() expressions '+ 'can only be used to update, not to insert.' % (value, field)+ )+ if value.contains_aggregate:+ raise FieldError(+ 'Aggregate functions are not allowed in this query '+ '(%s=%r).' % (field.name, value)+ )+ if value.contains_over_clause:+ raise FieldError(+ 'Window expressions are not allowed in this query (%s=%r).'+ % (field.name, value)+ )+ else:+ value = field.get_db_prep_save(value, connection=self.connection)+ return value++ def pre_save_val(self, field, obj):+ """+ Get the given field's value off the given obj. pre_save() is used for+ things like auto_now on DateTimeField. Skip it if this is a raw query.+ """+ if self.query.raw:+ return getattr(obj, field.attname)+ return field.pre_save(obj, add=True)++ def assemble_as_sql(self, fields, value_rows):+ """+ Take a sequence of N fields and a sequence of M rows of values, and+ generate placeholder SQL and parameters for each field and value.+ Return a pair containing:+ * a sequence of M rows of N SQL placeholder strings, and+ * a sequence of M rows of corresponding parameter values.++ Each placeholder string may contain any number of '%s' interpolation+ strings, and each parameter row will contain exactly as many params+ as the total number of '%s's in the corresponding placeholder row.+ """+ if not value_rows:+ return [], []++ # list of (sql, [params]) tuples for each object to be saved+ # Shape: [n_objs][n_fields][2]+ rows_of_fields_as_sql = (+ (self.field_as_sql(field, v) for field, v in zip(fields, row))+ for row in value_rows+ )++ # tuple like ([sqls], [[params]s]) for each object to be saved+ # Shape: [n_objs][2][n_fields]+ sql_and_param_pair_rows = (zip(*row) for row in rows_of_fields_as_sql)++ # Extract separate lists for placeholders and params.+ # Each of these has shape [n_objs][n_fields]+ placeholder_rows, param_rows = zip(*sql_and_param_pair_rows)++ # Params for each field are still lists, and need to be flattened.+ param_rows = [[p for ps in row for p in ps] for row in param_rows]++ return placeholder_rows, param_rows++ def as_sql(self):+ # We don't need quote_name_unless_alias() here, since these are all+ # going to be column names (so we can avoid the extra overhead).+ qn = self.connection.ops.quote_name+ opts = self.query.get_meta()+ insert_statement = self.connection.ops.insert_statement(ignore_conflicts=self.query.ignore_conflicts)+ result = ['%s %s' % (insert_statement, qn(opts.db_table))]+ fields = self.query.fields or [opts.pk]+ result.append('(%s)' % ', '.join(qn(f.column) for f in fields))++ if self.query.fields:+ value_rows = [+ [self.prepare_value(field, self.pre_save_val(field, obj)) for field in fields]+ for obj in self.query.objs+ ]+ else:+ # An empty object.+ value_rows = [[self.connection.ops.pk_default_value()] for _ in self.query.objs]+ fields = [None]++ # Currently the backends just accept values when generating bulk+ # queries and generate their own placeholders. Doing that isn't+ # necessary and it should be possible to use placeholders and+ # expressions in bulk inserts too.+ can_bulk = (not self.return_id and self.connection.features.has_bulk_insert)++ placeholder_rows, param_rows = self.assemble_as_sql(fields, value_rows)++ ignore_conflicts_suffix_sql = self.connection.ops.ignore_conflicts_suffix_sql(+ ignore_conflicts=self.query.ignore_conflicts+ )+ if self.return_id and self.connection.features.can_return_columns_from_insert:+ if self.connection.features.can_return_rows_from_bulk_insert:+ result.append(self.connection.ops.bulk_insert_sql(fields, placeholder_rows))+ params = param_rows+ else:+ result.append("VALUES (%s)" % ", ".join(placeholder_rows[0]))+ params = [param_rows[0]]+ if ignore_conflicts_suffix_sql:+ result.append(ignore_conflicts_suffix_sql)+ col = "%s.%s" % (qn(opts.db_table), qn(opts.pk.column))+ r_fmt, r_params = self.connection.ops.return_insert_id()+ # Skip empty r_fmt to allow subclasses to customize behavior for+ # 3rd party backends. Refs #19096.+ if r_fmt:+ result.append(r_fmt % col)+ params += [r_params]+ return [(" ".join(result), tuple(chain.from_iterable(params)))]++ if can_bulk:+ result.append(self.connection.ops.bulk_insert_sql(fields, placeholder_rows))+ if ignore_conflicts_suffix_sql:+ result.append(ignore_conflicts_suffix_sql)+ return [(" ".join(result), tuple(p for ps in param_rows for p in ps))]+ else:+ if ignore_conflicts_suffix_sql:+ result.append(ignore_conflicts_suffix_sql)+ return [+ (" ".join(result + ["VALUES (%s)" % ", ".join(p)]), vals)+ for p, vals in zip(placeholder_rows, param_rows)+ ]++ def execute_sql(self, return_id=False):+ assert not (+ return_id and len(self.query.objs) != 1 and+ not self.connection.features.can_return_rows_from_bulk_insert+ )+ self.return_id = return_id+ with self.connection.cursor() as cursor:+ for sql, params in self.as_sql():+ cursor.execute(sql, params)+ if not return_id:+ return+ if self.connection.features.can_return_rows_from_bulk_insert and len(self.query.objs) > 1:+ return self.connection.ops.fetch_returned_insert_ids(cursor)+ if self.connection.features.can_return_columns_from_insert:+ assert len(self.query.objs) == 1+ return self.connection.ops.fetch_returned_insert_id(cursor)+ return self.connection.ops.last_insert_id(+ cursor, self.query.get_meta().db_table, self.query.get_meta().pk.column+ )+++class SQLDeleteCompiler(SQLCompiler):+ def as_sql(self):+ """+ Create the SQL for this query. Return the SQL string and list of+ parameters.+ """+ assert len([t for t in self.query.alias_map if self.query.alias_refcount[t] > 0]) == 1, \+ "Can only delete from one table at a time."+ qn = self.quote_name_unless_alias+ result = ['DELETE FROM %s' % qn(self.query.base_table)]+ where, params = self.compile(self.query.where)+ if where:+ result.append('WHERE %s' % where)+ return ' '.join(result), tuple(params)+++class SQLUpdateCompiler(SQLCompiler):+ def as_sql(self):+ """+ Create the SQL for this query. Return the SQL string and list of+ parameters.+ """+ self.pre_sql_setup()+ if not self.query.values:+ return '', ()+ qn = self.quote_name_unless_alias+ values, update_params = [], []+ for field, model, val in self.query.values:+ if hasattr(val, 'resolve_expression'):+ val = val.resolve_expression(self.query, allow_joins=False, for_save=True)+ if val.contains_aggregate:+ raise FieldError(+ 'Aggregate functions are not allowed in this query '+ '(%s=%r).' % (field.name, val)+ )+ if val.contains_over_clause:+ raise FieldError(+ 'Window expressions are not allowed in this query '+ '(%s=%r).' % (field.name, val)+ )+ elif hasattr(val, 'prepare_database_save'):+ if field.remote_field:+ val = field.get_db_prep_save(+ val.prepare_database_save(field),+ connection=self.connection,+ )+ else:+ raise TypeError(+ "Tried to update field %s with a model instance, %r. "+ "Use a value compatible with %s."+ % (field, val, field.__class__.__name__)+ )+ else:+ val = field.get_db_prep_save(val, connection=self.connection)++ # Getting the placeholder for the field.+ if hasattr(field, 'get_placeholder'):+ placeholder = field.get_placeholder(val, self, self.connection)+ else:+ placeholder = '%s'+ name = field.column+ if hasattr(val, 'as_sql'):+ sql, params = self.compile(val)+ values.append('%s = %s' % (qn(name), placeholder % sql))+ update_params.extend(params)+ elif val is not None:+ values.append('%s = %s' % (qn(name), placeholder))+ update_params.append(val)+ else:+ values.append('%s = NULL' % qn(name))+ table = self.query.base_table+ result = [+ 'UPDATE %s SET' % qn(table),+ ', '.join(values),+ ]+ where, params = self.compile(self.query.where)+ if where:+ result.append('WHERE %s' % where)+ return ' '.join(result), tuple(update_params + params)++ def execute_sql(self, result_type):+ """+ Execute the specified update. Return the number of rows affected by+ the primary update query. The "primary update query" is the first+ non-empty query that is executed. Row counts for any subsequent,+ related queries are not available.+ """+ cursor = super().execute_sql(result_type)+ try:+ rows = cursor.rowcount if cursor else 0+ is_empty = cursor is None+ finally:+ if cursor:+ cursor.close()+ for query in self.query.get_related_updates():+ aux_rows = query.get_compiler(self.using).execute_sql(result_type)+ if is_empty and aux_rows:+ rows = aux_rows+ is_empty = False+ return rows++ def pre_sql_setup(self):+ """+ If the update depends on results from other tables, munge the "where"+ conditions to match the format required for (portable) SQL updates.++ If multiple updates are required, pull out the id values to update at+ this point so that they don't change as a result of the progressive+ updates.+ """+ refcounts_before = self.query.alias_refcount.copy()+ # Ensure base table is in the query+ self.query.get_initial_alias()+ count = self.query.count_active_tables()+ if not self.query.related_updates and count == 1:+ return+ query = self.query.chain(klass=Query)+ query.select_related = False+ query.clear_ordering(True)+ query.extra = {}+ query.select = []+ query.add_fields([query.get_meta().pk.name])+ super().pre_sql_setup()++ must_pre_select = count > 1 and not self.connection.features.update_can_self_select++ # Now we adjust the current query: reset the where clause and get rid+ # of all the tables we don't need (since they're in the sub-select).+ self.query.where = self.query.where_class()+ if self.query.related_updates or must_pre_select:+ # Either we're using the idents in multiple update queries (so+ # don't want them to change), or the db backend doesn't support+ # selecting from the updating table (e.g. MySQL).+ idents = []+ for rows in query.get_compiler(self.using).execute_sql(MULTI):+ idents.extend(r[0] for r in rows)+ self.query.add_filter(('pk__in', idents))+ self.query.related_ids = idents+ else:+ # The fast path. Filters and updates in one query.+ self.query.add_filter(('pk__in', query))+ self.query.reset_refcounts(refcounts_before)+++class SQLAggregateCompiler(SQLCompiler):+ def as_sql(self):+ """+ Create the SQL for this query. Return the SQL string and list of+ parameters.+ """+ sql, params = [], []+ for annotation in self.query.annotation_select.values():+ ann_sql, ann_params = self.compile(annotation, select_format=FORCE)+ sql.append(ann_sql)+ params.extend(ann_params)+ self.col_count = len(self.query.annotation_select)+ sql = ', '.join(sql)+ params = tuple(params)++ sql = 'SELECT %s FROM (%s) subquery' % (sql, self.query.subquery)+ params = params + self.query.sub_params+ return sql, params+++def cursor_iter(cursor, sentinel, col_count, itersize):+ """+ Yield blocks of rows from a cursor and ensure the cursor is closed when+ done.+ """+ try:+ for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):+ yield rows if col_count is None else [r[:col_count] for r in rows]+ finally:+ cursor.close()diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.pyindex 7649c39262..a3d0ffe1bd 100644--- a/django/db/models/sql/compiler.py+++ b/django/db/models/sql/compiler.py@@ -349,11 +349,12 @@ class SQLCompiler: else: raise DatabaseError('ORDER BY term does not match any column in the result set.') sql, params = self.compile(resolved)- # Don't add the same column twice, but the order direction is+# Don't add the same column twice, but the order direction is # not taken into account so we strip it. When this entire method # is refactored into expressions, then we can check each part as we # generate it.- without_ordering = self.ordering_parts.search(sql).group(1)+ sql_oneline = ' '.join(sql.split('\n'))+ without_ordering = self.ordering_parts.search(sql_oneline).group(1) params_hash = make_hashable(params) if (without_ordering, params_hash) in seen: continue@@ -366,7 +367,8 @@ class SQLCompiler: if self.query.distinct and not self.query.distinct_fields: select_sql = [t[1] for t in select] for expr, (sql, params, is_ref) in order_by:- without_ordering = self.ordering_parts.search(sql).group(1)+ sql_oneline = ' '.join(sql.split('\n'))+ without_ordering = self.ordering_parts.search(sql_oneline).group(1) if not is_ref and (without_ordering, params) not in select_sql: extra_select.append((expr, (without_ordering, params), None)) return extra_select123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148{ "django__django-11001": { "patch_is_None": false, "patch_exists": true, "patch_successfully_applied": true, "resolved": true, "tests_status": { "FAIL_TO_PASS": { "success": [ "test_order_by_multiline_sql (expressions.tests.BasicExpressionsTests)", "test_order_of_operations (expressions.tests.BasicExpressionsTests)" ], "failure": [] }, "PASS_TO_PASS": { "success": [ "test_deconstruct (expressions.tests.FTests)", "test_deepcopy (expressions.tests.FTests)", "test_equal (expressions.tests.FTests)", "test_hash (expressions.tests.FTests)", "test_not_equal_Value (expressions.tests.FTests)", "test_and (expressions.tests.CombinableTests)", "test_negation (expressions.tests.CombinableTests)", "test_or (expressions.tests.CombinableTests)", "test_reversed_and (expressions.tests.CombinableTests)", "test_reversed_or (expressions.tests.CombinableTests)", "test_aggregates (expressions.tests.ReprTests)", "test_distinct_aggregates (expressions.tests.ReprTests)", "test_expressions (expressions.tests.ReprTests)", "test_filtered_aggregates (expressions.tests.ReprTests)", "test_functions (expressions.tests.ReprTests)", "test_equal (expressions.tests.SimpleExpressionTests)", "test_hash (expressions.tests.SimpleExpressionTests)", "test_month_aggregation (expressions.tests.FieldTransformTests)", "test_multiple_transforms_in_values (expressions.tests.FieldTransformTests)", "test_transform_in_values (expressions.tests.FieldTransformTests)", "test_deconstruct (expressions.tests.ValueTests)", "test_deconstruct_output_field (expressions.tests.ValueTests)", "test_equal (expressions.tests.ValueTests)", "test_equal_output_field (expressions.tests.ValueTests)", "test_hash (expressions.tests.ValueTests)", "test_raise_empty_expressionlist (expressions.tests.ValueTests)", "test_update_TimeField_using_Value (expressions.tests.ValueTests)", "test_update_UUIDField_using_Value (expressions.tests.ValueTests)", "test_complex_expressions (expressions.tests.ExpressionsNumericTests)", "test_fill_with_value_from_same_object (expressions.tests.ExpressionsNumericTests)", "test_filter_not_equals_other_field (expressions.tests.ExpressionsNumericTests)", "test_increment_value (expressions.tests.ExpressionsNumericTests)", "test_F_reuse (expressions.tests.ExpressionsTests)", "test_insensitive_patterns_escape (expressions.tests.ExpressionsTests)", "test_patterns_escape (expressions.tests.ExpressionsTests)", "test_complex_expressions_do_not_introduce_sql_injection_via_untrusted_string_inclusion (expressions.tests.IterableLookupInnerExpressionsTests)", "test_expressions_in_lookups_join_choice (expressions.tests.IterableLookupInnerExpressionsTests)", "test_in_lookup_allows_F_expressions_and_expressions_for_datetimes (expressions.tests.IterableLookupInnerExpressionsTests)", "test_in_lookup_allows_F_expressions_and_expressions_for_integers (expressions.tests.IterableLookupInnerExpressionsTests)", "test_range_lookup_allows_F_expressions_and_expressions_for_integers (expressions.tests.IterableLookupInnerExpressionsTests)", "test_lefthand_addition (expressions.tests.ExpressionOperatorTests)", "test_lefthand_bitwise_and (expressions.tests.ExpressionOperatorTests)", "test_lefthand_bitwise_left_shift_operator (expressions.tests.ExpressionOperatorTests)", "test_lefthand_bitwise_or (expressions.tests.ExpressionOperatorTests)", "test_lefthand_bitwise_right_shift_operator (expressions.tests.ExpressionOperatorTests)", "test_lefthand_division (expressions.tests.ExpressionOperatorTests)", "test_lefthand_modulo (expressions.tests.ExpressionOperatorTests)", "test_lefthand_multiplication (expressions.tests.ExpressionOperatorTests)", "test_lefthand_power (expressions.tests.ExpressionOperatorTests)", "test_lefthand_subtraction (expressions.tests.ExpressionOperatorTests)", "test_right_hand_addition (expressions.tests.ExpressionOperatorTests)", "test_right_hand_division (expressions.tests.ExpressionOperatorTests)", "test_right_hand_modulo (expressions.tests.ExpressionOperatorTests)", "test_right_hand_multiplication (expressions.tests.ExpressionOperatorTests)", "test_right_hand_subtraction (expressions.tests.ExpressionOperatorTests)", "test_righthand_power (expressions.tests.ExpressionOperatorTests)", "test_aggregate_subquery_annotation (expressions.tests.BasicExpressionsTests)", "test_annotate_values_aggregate (expressions.tests.BasicExpressionsTests)", "test_annotate_values_count (expressions.tests.BasicExpressionsTests)", "test_annotate_values_filter (expressions.tests.BasicExpressionsTests)", "test_annotation_with_outerref (expressions.tests.BasicExpressionsTests)", "test_annotations_within_subquery (expressions.tests.BasicExpressionsTests)", "test_arithmetic (expressions.tests.BasicExpressionsTests)", "test_exist_single_field_output_field (expressions.tests.BasicExpressionsTests)", "test_explicit_output_field (expressions.tests.BasicExpressionsTests)", "test_filter_inter_attribute (expressions.tests.BasicExpressionsTests)", "test_filter_with_join (expressions.tests.BasicExpressionsTests)", "test_filtering_on_annotate_that_uses_q (expressions.tests.BasicExpressionsTests)", "test_in_subquery (expressions.tests.BasicExpressionsTests)", "test_incorrect_field_in_F_expression (expressions.tests.BasicExpressionsTests)", "test_incorrect_joined_field_in_F_expression (expressions.tests.BasicExpressionsTests)", "test_nested_subquery (expressions.tests.BasicExpressionsTests)", "test_nested_subquery_outer_ref_2 (expressions.tests.BasicExpressionsTests)", "test_nested_subquery_outer_ref_with_autofield (expressions.tests.BasicExpressionsTests)", "test_new_object_create (expressions.tests.BasicExpressionsTests)", "test_new_object_save (expressions.tests.BasicExpressionsTests)", "test_object_create_with_aggregate (expressions.tests.BasicExpressionsTests)", "test_object_update (expressions.tests.BasicExpressionsTests)", "test_object_update_fk (expressions.tests.BasicExpressionsTests)", "test_object_update_unsaved_objects (expressions.tests.BasicExpressionsTests)", "test_order_by_exists (expressions.tests.BasicExpressionsTests)", "test_outerref (expressions.tests.BasicExpressionsTests)", "test_outerref_mixed_case_table_name (expressions.tests.BasicExpressionsTests)", "test_outerref_with_operator (expressions.tests.BasicExpressionsTests)", "test_parenthesis_priority (expressions.tests.BasicExpressionsTests)", "test_pickle_expression (expressions.tests.BasicExpressionsTests)", "test_subquery (expressions.tests.BasicExpressionsTests)", "test_subquery_filter_by_aggregate (expressions.tests.BasicExpressionsTests)", "test_subquery_references_joined_table_twice (expressions.tests.BasicExpressionsTests)", "test_ticket_11722_iexact_lookup (expressions.tests.BasicExpressionsTests)", "test_ticket_16731_startswith_lookup (expressions.tests.BasicExpressionsTests)", "test_ticket_18375_chained_filters (expressions.tests.BasicExpressionsTests)", "test_ticket_18375_join_reuse (expressions.tests.BasicExpressionsTests)", "test_ticket_18375_kwarg_ordering (expressions.tests.BasicExpressionsTests)", "test_ticket_18375_kwarg_ordering_2 (expressions.tests.BasicExpressionsTests)", "test_update (expressions.tests.BasicExpressionsTests)", "test_update_inherited_field_value (expressions.tests.BasicExpressionsTests)", "test_update_with_fk (expressions.tests.BasicExpressionsTests)", "test_update_with_none (expressions.tests.BasicExpressionsTests)", "test_uuid_pk_subquery (expressions.tests.BasicExpressionsTests)", "test_date_comparison (expressions.tests.FTimeDeltaTests)", "test_date_minus_duration (expressions.tests.FTimeDeltaTests)", "test_date_subtraction (expressions.tests.FTimeDeltaTests)", "test_datetime_subtraction (expressions.tests.FTimeDeltaTests)", "test_datetime_subtraction_microseconds (expressions.tests.FTimeDeltaTests)", "test_delta_add (expressions.tests.FTimeDeltaTests)", "test_delta_subtract (expressions.tests.FTimeDeltaTests)", "test_delta_update (expressions.tests.FTimeDeltaTests)", "test_duration_with_datetime (expressions.tests.FTimeDeltaTests)", "test_duration_with_datetime_microseconds (expressions.tests.FTimeDeltaTests)", "test_durationfield_add (expressions.tests.FTimeDeltaTests)", "test_exclude (expressions.tests.FTimeDeltaTests)", "test_invalid_operator (expressions.tests.FTimeDeltaTests)", "test_mixed_comparisons2 (expressions.tests.FTimeDeltaTests)", "test_multiple_query_compilation (expressions.tests.FTimeDeltaTests)", "test_negative_timedelta_update (expressions.tests.FTimeDeltaTests)", "test_query_clone (expressions.tests.FTimeDeltaTests)", "test_time_subtraction (expressions.tests.FTimeDeltaTests)" ], "failure": [] }, "FAIL_TO_FAIL": { "success": [], "failure": [] }, "PASS_TO_FAIL": { "success": [], "failure": [] } } }}123version https://git-lfs.github.com/spec/v1oid sha256:4410fd115195a68599d85220b33cee4793a4d9ffd9b7ceef7b8c7a0271792be3size 14380123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567+ source /opt/miniconda3/bin/activate++ _CONDA_ROOT=/opt/miniconda3++ . /opt/miniconda3/etc/profile.d/conda.sh+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ '[' -z '' ']'+++ export CONDA_SHLVL=0+++ CONDA_SHLVL=0+++ '[' -n '' ']'+++++ dirname /opt/miniconda3/bin/conda++++ dirname /opt/miniconda3/bin+++ PATH=/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export PATH+++ '[' -z '' ']'+++ PS1=++ conda activate++ local cmd=activate++ case "$cmd" in++ __conda_activate activate++ '[' -n '' ']'++ local ask_conda+++ PS1=+++ __conda_exe shell.posix activate+++ /opt/miniconda3/bin/conda shell.posix activate++ ask_conda='PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''1'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ eval 'PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''1'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+++ PS1='(base) '+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export CONDA_PREFIX=/opt/miniconda3+++ CONDA_PREFIX=/opt/miniconda3+++ export CONDA_SHLVL=1+++ CONDA_SHLVL=1+++ export CONDA_DEFAULT_ENV=base+++ CONDA_DEFAULT_ENV=base+++ export 'CONDA_PROMPT_MODIFIER=(base) '+++ CONDA_PROMPT_MODIFIER='(base) '+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ __conda_hashr++ '[' -n '' ']'++ '[' -n '' ']'++ hash -r+ conda activate testbed+ local cmd=activate+ case "$cmd" in+ __conda_activate activate testbed+ '[' -n '' ']'+ local ask_conda++ PS1='(base) '++ __conda_exe shell.posix activate testbed++ /opt/miniconda3/bin/conda shell.posix activate testbed+ ask_conda='PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''2'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_1='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+ eval 'PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''2'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_1='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ PS1='(testbed) '++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed++ CONDA_PREFIX=/opt/miniconda3/envs/testbed++ export CONDA_SHLVL=2++ CONDA_SHLVL=2++ export CONDA_DEFAULT_ENV=testbed++ CONDA_DEFAULT_ENV=testbed++ export 'CONDA_PROMPT_MODIFIER=(testbed) '++ CONDA_PROMPT_MODIFIER='(testbed) '++ export CONDA_PREFIX_1=/opt/miniconda3++ CONDA_PREFIX_1=/opt/miniconda3++ export CONDA_EXE=/opt/miniconda3/bin/conda++ CONDA_EXE=/opt/miniconda3/bin/conda++ export _CE_M=++ _CE_M=++ export _CE_CONDA=++ _CE_CONDA=++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+ __conda_hashr+ '[' -n '' ']'+ '[' -n '' ']'+ hash -r+ cd /testbed+ sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen+ locale-genGenerating locales (this might take a while)... en_US.UTF-8...+ export LANG=en_US.UTF-8+ LANG=en_US.UTF-8+ export LANGUAGE=en_US:en+ LANGUAGE=en_US:en+ export LC_ALL=en_US.UTF-8+ LC_ALL=en_US.UTF-8+ git config --global --add safe.directory /testbed+ cd /testbed+ git status doneGeneration complete.On branch mainChanges not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: django/db/models/sql/compiler.py
Untracked files: (use "git add <file>..." to include in what will be committed) django/db/models/sql/.backup.compiler.py
no changes added to commit (use "git add" and/or "git commit -a")+ git showcommit ef082ebb84f00e38af4e8880d04e8365c2766d34Author: Mykola Kokalko <jajcee@gmail.com>Date: Thu May 2 10:42:10 2019 +0200
Fixed #29529 -- Allowed models.fields.FilePathField to accept a callable path.
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.pyindex 0c64748ccd..4d7eb11151 100644--- a/django/db/models/fields/__init__.py+++ b/django/db/models/fields/__init__.py@@ -1709,7 +1709,7 @@ class FilePathField(Field): def formfield(self, **kwargs): return super().formfield(**{- 'path': self.path,+ 'path': self.path() if callable(self.path) else self.path, 'match': self.match, 'recursive': self.recursive, 'form_class': forms.FilePathField,diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txtindex e352e8b007..fbcba2bd66 100644--- a/docs/ref/models/fields.txt+++ b/docs/ref/models/fields.txt@@ -868,6 +868,23 @@ directory on the filesystem. Has three special arguments, of which the first is Required. The absolute filesystem path to a directory from which this :class:`FilePathField` should get its choices. Example: ``"/home/images"``. + ``path`` may also be a callable, such as a function to dynamically set the+ path at runtime. Example::++ import os+ from django.conf import settings+ from django.db import models++ def images_path():+ return os.path.join(settings.LOCAL_FILE_DIR, 'images')++ class MyModel(models.Model):+ file = models.FilePathField(path=images_path)++ .. versionchanged:: 3.0++ ``path`` can now be a callable.+ .. attribute:: FilePathField.match Optional. A regular expression, as a string, that :class:`FilePathField`diff --git a/docs/releases/3.0.txt b/docs/releases/3.0.txtindex b78d4bd6ab..966644385b 100644--- a/docs/releases/3.0.txt+++ b/docs/releases/3.0.txt@@ -206,6 +206,8 @@ Models * ``connection.queries`` now shows ``COPY … TO`` statements on PostgreSQL. +* :class:`~django.db.models.FilePathField` now accepts a callable ``path``.+ Requests and Responses ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/model_fields/test_filepathfield.py b/tests/model_fields/test_filepathfield.pyindex d5d43ff6f6..362d12d0db 100644--- a/tests/model_fields/test_filepathfield.py+++ b/tests/model_fields/test_filepathfield.py@@ -10,3 +10,13 @@ class FilePathFieldTests(SimpleTestCase): field = FilePathField(path=path) self.assertEqual(field.path, path) self.assertEqual(field.formfield().path, path)++ def test_callable_path(self):+ path = os.path.dirname(__file__)++ def generate_path():+ return path++ field = FilePathField(path=generate_path)+ self.assertEqual(field.path(), path)+ self.assertEqual(field.formfield().path, path)+ git diff ef082ebb84f00e38af4e8880d04e8365c2766d34diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.pyindex 7649c39262..a3d0ffe1bd 100644--- a/django/db/models/sql/compiler.py+++ b/django/db/models/sql/compiler.py@@ -349,11 +349,12 @@ class SQLCompiler: else: raise DatabaseError('ORDER BY term does not match any column in the result set.') sql, params = self.compile(resolved)- # Don't add the same column twice, but the order direction is+# Don't add the same column twice, but the order direction is # not taken into account so we strip it. When this entire method # is refactored into expressions, then we can check each part as we # generate it.- without_ordering = self.ordering_parts.search(sql).group(1)+ sql_oneline = ' '.join(sql.split('\n'))+ without_ordering = self.ordering_parts.search(sql_oneline).group(1) params_hash = make_hashable(params) if (without_ordering, params_hash) in seen: continue@@ -366,7 +367,8 @@ class SQLCompiler: if self.query.distinct and not self.query.distinct_fields: select_sql = [t[1] for t in select] for expr, (sql, params, is_ref) in order_by:- without_ordering = self.ordering_parts.search(sql).group(1)+ sql_oneline = ' '.join(sql.split('\n'))+ without_ordering = self.ordering_parts.search(sql_oneline).group(1) if not is_ref and (without_ordering, params) not in select_sql: extra_select.append((expr, (without_ordering, params), None)) return extra_select+ source /opt/miniconda3/bin/activate++ _CONDA_ROOT=/opt/miniconda3++ . /opt/miniconda3/etc/profile.d/conda.sh+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ '[' -z x ']'++ conda activate++ local cmd=activate++ case "$cmd" in++ __conda_activate activate++ '[' -n '' ']'++ local ask_conda+++ PS1='(testbed) '+++ __conda_exe shell.posix activate+++ /opt/miniconda3/bin/conda shell.posix activate++ ask_conda='PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''3'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ eval 'PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''3'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+++ PS1='(base) '+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export CONDA_PREFIX=/opt/miniconda3+++ CONDA_PREFIX=/opt/miniconda3+++ export CONDA_SHLVL=3+++ CONDA_SHLVL=3+++ export CONDA_DEFAULT_ENV=base+++ CONDA_DEFAULT_ENV=base+++ export 'CONDA_PROMPT_MODIFIER=(base) '+++ CONDA_PROMPT_MODIFIER='(base) '+++ export CONDA_PREFIX_2=/opt/miniconda3/envs/testbed+++ CONDA_PREFIX_2=/opt/miniconda3/envs/testbed+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ __conda_hashr++ '[' -n '' ']'++ '[' -n '' ']'++ hash -r+ conda activate testbed+ local cmd=activate+ case "$cmd" in+ __conda_activate activate testbed+ '[' -n '' ']'+ local ask_conda++ PS1='(base) '++ __conda_exe shell.posix activate testbed++ /opt/miniconda3/bin/conda shell.posix activate testbed+ ask_conda='PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''4'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_3='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+ eval 'PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''4'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_3='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ PS1='(testbed) '++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed++ CONDA_PREFIX=/opt/miniconda3/envs/testbed++ export CONDA_SHLVL=4++ CONDA_SHLVL=4++ export CONDA_DEFAULT_ENV=testbed++ CONDA_DEFAULT_ENV=testbed++ export 'CONDA_PROMPT_MODIFIER=(testbed) '++ CONDA_PROMPT_MODIFIER='(testbed) '++ export CONDA_PREFIX_3=/opt/miniconda3++ CONDA_PREFIX_3=/opt/miniconda3++ export CONDA_EXE=/opt/miniconda3/bin/conda++ CONDA_EXE=/opt/miniconda3/bin/conda++ export _CE_M=++ _CE_M=++ export _CE_CONDA=++ _CE_CONDA=++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+ __conda_hashr+ '[' -n '' ']'+ '[' -n '' ']'+ hash -r+ python -m pip install -e .Obtaining file:///testbedRequirement already satisfied: pytz in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from Django==3.0.dev20190502091156) (2024.1)Requirement already satisfied: sqlparse in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from Django==3.0.dev20190502091156) (0.4.4)Installing collected packages: Django Attempting uninstall: Django Found existing installation: Django 3.0.dev20190502091156 Uninstalling Django-3.0.dev20190502091156: Successfully uninstalled Django-3.0.dev20190502091156 Running setup.py develop for DjangoSuccessfully installed Django-3.0.dev20190502091156WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv+ git checkout ef082ebb84f00e38af4e8880d04e8365c2766d34 tests/expressions/tests.pyUpdated 0 paths from 1b6d22c787+ git apply -v -Checking patch tests/expressions/tests.py...Applied patch tests/expressions/tests.py cleanly.+ ./tests/runtests.py --verbosity 2 --settings=test_sqlite --parallel 1 expressions.testsCreating test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...test_aggregate_subquery_annotation (expressions.tests.BasicExpressionsTests) ... oktest_annotate_values_aggregate (expressions.tests.BasicExpressionsTests) ... oktest_annotate_values_count (expressions.tests.BasicExpressionsTests) ... oktest_annotate_values_filter (expressions.tests.BasicExpressionsTests) ... oktest_annotation_with_outerref (expressions.tests.BasicExpressionsTests) ... oktest_annotations_within_subquery (expressions.tests.BasicExpressionsTests) ... oktest_arithmetic (expressions.tests.BasicExpressionsTests) ... oktest_exist_single_field_output_field (expressions.tests.BasicExpressionsTests) ... oktest_explicit_output_field (expressions.tests.BasicExpressionsTests) ... oktest_filter_inter_attribute (expressions.tests.BasicExpressionsTests) ... oktest_filter_with_join (expressions.tests.BasicExpressionsTests) ... oktest_filtering_on_annotate_that_uses_q (expressions.tests.BasicExpressionsTests) ... oktest_in_subquery (expressions.tests.BasicExpressionsTests) ... oktest_incorrect_field_in_F_expression (expressions.tests.BasicExpressionsTests) ... oktest_incorrect_joined_field_in_F_expression (expressions.tests.BasicExpressionsTests) ... oktest_nested_subquery (expressions.tests.BasicExpressionsTests) ... oktest_nested_subquery_outer_ref_2 (expressions.tests.BasicExpressionsTests) ... oktest_nested_subquery_outer_ref_with_autofield (expressions.tests.BasicExpressionsTests) ... oktest_new_object_create (expressions.tests.BasicExpressionsTests) ... oktest_new_object_save (expressions.tests.BasicExpressionsTests) ... oktest_object_create_with_aggregate (expressions.tests.BasicExpressionsTests) ... oktest_object_update (expressions.tests.BasicExpressionsTests) ... oktest_object_update_fk (expressions.tests.BasicExpressionsTests) ... oktest_object_update_unsaved_objects (expressions.tests.BasicExpressionsTests) ... oktest_order_by_exists (expressions.tests.BasicExpressionsTests) ... oktest_order_by_multiline_sql (expressions.tests.BasicExpressionsTests) ... oktest_order_of_operations (expressions.tests.BasicExpressionsTests) ... oktest_outerref (expressions.tests.BasicExpressionsTests) ... oktest_outerref_mixed_case_table_name (expressions.tests.BasicExpressionsTests) ... oktest_outerref_with_operator (expressions.tests.BasicExpressionsTests) ... oktest_parenthesis_priority (expressions.tests.BasicExpressionsTests) ... oktest_pickle_expression (expressions.tests.BasicExpressionsTests) ... oktest_subquery (expressions.tests.BasicExpressionsTests) ... oktest_subquery_filter_by_aggregate (expressions.tests.BasicExpressionsTests) ... oktest_subquery_references_joined_table_twice (expressions.tests.BasicExpressionsTests) ... oktest_ticket_11722_iexact_lookup (expressions.tests.BasicExpressionsTests) ... oktest_ticket_16731_startswith_lookup (expressions.tests.BasicExpressionsTests) ... oktest_ticket_18375_chained_filters (expressions.tests.BasicExpressionsTests) ... oktest_ticket_18375_join_reuse (expressions.tests.BasicExpressionsTests) ... oktest_ticket_18375_kwarg_ordering (expressions.tests.BasicExpressionsTests) ... oktest_ticket_18375_kwarg_ordering_2 (expressions.tests.BasicExpressionsTests) ... oktest_update (expressions.tests.BasicExpressionsTests) ... oktest_update_inherited_field_value (expressions.tests.BasicExpressionsTests) ... oktest_update_with_fk (expressions.tests.BasicExpressionsTests) ... oktest_update_with_none (expressions.tests.BasicExpressionsTests) ... oktest_uuid_pk_subquery (expressions.tests.BasicExpressionsTests) ... oktest_lefthand_addition (expressions.tests.ExpressionOperatorTests) ... oktest_lefthand_bitwise_and (expressions.tests.ExpressionOperatorTests) ... oktest_lefthand_bitwise_left_shift_operator (expressions.tests.ExpressionOperatorTests) ... oktest_lefthand_bitwise_or (expressions.tests.ExpressionOperatorTests) ... oktest_lefthand_bitwise_right_shift_operator (expressions.tests.ExpressionOperatorTests) ... oktest_lefthand_division (expressions.tests.ExpressionOperatorTests) ... oktest_lefthand_modulo (expressions.tests.ExpressionOperatorTests) ... oktest_lefthand_multiplication (expressions.tests.ExpressionOperatorTests) ... oktest_lefthand_power (expressions.tests.ExpressionOperatorTests) ... oktest_lefthand_subtraction (expressions.tests.ExpressionOperatorTests) ... oktest_right_hand_addition (expressions.tests.ExpressionOperatorTests) ... oktest_right_hand_division (expressions.tests.ExpressionOperatorTests) ... oktest_right_hand_modulo (expressions.tests.ExpressionOperatorTests) ... oktest_right_hand_multiplication (expressions.tests.ExpressionOperatorTests) ... oktest_right_hand_subtraction (expressions.tests.ExpressionOperatorTests) ... oktest_righthand_power (expressions.tests.ExpressionOperatorTests) ... oktest_complex_expressions (expressions.tests.ExpressionsNumericTests) ... oktest_fill_with_value_from_same_object (expressions.tests.ExpressionsNumericTests) ... oktest_filter_not_equals_other_field (expressions.tests.ExpressionsNumericTests) ... oktest_increment_value (expressions.tests.ExpressionsNumericTests) ... oktest_F_reuse (expressions.tests.ExpressionsTests) ... oktest_insensitive_patterns_escape (expressions.tests.ExpressionsTests) ... oktest_patterns_escape (expressions.tests.ExpressionsTests) ... oktest_date_comparison (expressions.tests.FTimeDeltaTests) ... oktest_date_minus_duration (expressions.tests.FTimeDeltaTests) ... oktest_date_subtraction (expressions.tests.FTimeDeltaTests) ... oktest_datetime_subtraction (expressions.tests.FTimeDeltaTests) ... oktest_datetime_subtraction_microseconds (expressions.tests.FTimeDeltaTests) ... oktest_delta_add (expressions.tests.FTimeDeltaTests) ... oktest_delta_subtract (expressions.tests.FTimeDeltaTests) ... oktest_delta_update (expressions.tests.FTimeDeltaTests) ... oktest_duration_with_datetime (expressions.tests.FTimeDeltaTests) ... oktest_duration_with_datetime_microseconds (expressions.tests.FTimeDeltaTests) ... oktest_durationfield_add (expressions.tests.FTimeDeltaTests) ... oktest_exclude (expressions.tests.FTimeDeltaTests) ... oktest_invalid_operator (expressions.tests.FTimeDeltaTests) ... oktest_mixed_comparisons1 (expressions.tests.FTimeDeltaTests) ... skipped "Database doesn't support feature(s): supports_mixed_date_datetime_comparisons"test_mixed_comparisons2 (expressions.tests.FTimeDeltaTests) ... oktest_multiple_query_compilation (expressions.tests.FTimeDeltaTests) ... oktest_negative_timedelta_update (expressions.tests.FTimeDeltaTests) ... oktest_query_clone (expressions.tests.FTimeDeltaTests) ... oktest_time_subtraction (expressions.tests.FTimeDeltaTests) ... oktest_month_aggregation (expressions.tests.FieldTransformTests) ... oktest_multiple_transforms_in_values (expressions.tests.FieldTransformTests) ... oktest_transform_in_values (expressions.tests.FieldTransformTests) ... oktest_complex_expressions_do_not_introduce_sql_injection_via_untrusted_string_inclusion (expressions.tests.IterableLookupInnerExpressionsTests) ... oktest_expressions_in_lookups_join_choice (expressions.tests.IterableLookupInnerExpressionsTests) ... oktest_in_lookup_allows_F_expressions_and_expressions_for_datetimes (expressions.tests.IterableLookupInnerExpressionsTests) ... oktest_in_lookup_allows_F_expressions_and_expressions_for_integers (expressions.tests.IterableLookupInnerExpressionsTests) ... oktest_range_lookup_allows_F_expressions_and_expressions_for_integers (expressions.tests.IterableLookupInnerExpressionsTests) ... oktest_deconstruct (expressions.tests.ValueTests) ... oktest_deconstruct_output_field (expressions.tests.ValueTests) ... oktest_equal (expressions.tests.ValueTests) ... oktest_equal_output_field (expressions.tests.ValueTests) ... oktest_hash (expressions.tests.ValueTests) ... oktest_raise_empty_expressionlist (expressions.tests.ValueTests) ... oktest_update_TimeField_using_Value (expressions.tests.ValueTests) ... oktest_update_UUIDField_using_Value (expressions.tests.ValueTests) ... oktest_and (expressions.tests.CombinableTests) ... oktest_negation (expressions.tests.CombinableTests) ... oktest_or (expressions.tests.CombinableTests) ... oktest_reversed_and (expressions.tests.CombinableTests) ... oktest_reversed_or (expressions.tests.CombinableTests) ... oktest_deconstruct (expressions.tests.FTests) ... oktest_deepcopy (expressions.tests.FTests) ... oktest_equal (expressions.tests.FTests) ... oktest_hash (expressions.tests.FTests) ... oktest_not_equal_Value (expressions.tests.FTests) ... oktest_aggregates (expressions.tests.ReprTests) ... oktest_distinct_aggregates (expressions.tests.ReprTests) ... oktest_expressions (expressions.tests.ReprTests) ... oktest_filtered_aggregates (expressions.tests.ReprTests) ... oktest_functions (expressions.tests.ReprTests) ... oktest_equal (expressions.tests.SimpleExpressionTests) ... oktest_hash (expressions.tests.SimpleExpressionTests) ... ok
----------------------------------------------------------------------Ran 121 tests in 0.245s
OK (skipped=1)Destroying test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...Testing against Django installed in '/testbed/django'Importing application expressionsSkipping setup of unused database(s): other.Operations to perform: Synchronize unmigrated apps: auth, contenttypes, expressions, messages, sessions, staticfiles Apply all migrations: admin, sitesSynchronizing apps without migrations: Creating tables... Creating table django_content_type Creating table auth_permission Creating table auth_group Creating table auth_user Creating table django_session Creating table expressions_employee Creating table expressions_remoteemployee Creating table expressions_company Creating table expressions_number Creating table expressions_ExPeRiMeNt Creating table expressions_result Creating table expressions_time Creating table expressions_simulationrun Creating table expressions_uuidpk Creating table expressions_uuid Running deferred SQL...Running migrations: Applying admin.0001_initial... OK Applying admin.0002_logentry_remove_auto_add... OK Applying admin.0003_logentry_add_action_flag_choices... OK Applying sites.0001_initial... OK Applying sites.0002_alter_domain_unique... OKSystem check identified no issues (0 silenced).+ git checkout ef082ebb84f00e38af4e8880d04e8365c2766d34 tests/expressions/tests.pyUpdated 1 path from 1b6d22c787123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100#!/bin/bashset -uxo pipefailsource /opt/miniconda3/bin/activateconda activate testbedcd /testbedsed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-genexport LANG=en_US.UTF-8export LANGUAGE=en_US:enexport LC_ALL=en_US.UTF-8git config --global --add safe.directory /testbedcd /testbedgit statusgit showgit diff d5276398046ce4a102776a1e67dcac2884d80dfesource /opt/miniconda3/bin/activateconda activate testbedpython -m pip install -e .git checkout d5276398046ce4a102776a1e67dcac2884d80dfe tests/migrations/test_commands.pygit apply -v - <<'EOF_114329324912'diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py--- a/tests/migrations/test_commands.py+++ b/tests/migrations/test_commands.py@@ -536,7 +536,13 @@ def test_sqlmigrate_forwards(self): index_op_desc_unique_together = output.find('-- alter unique_together') index_tx_end = output.find(connection.ops.end_transaction_sql().lower()) - self.assertGreater(index_tx_start, -1, "Transaction start not found")+ if connection.features.can_rollback_ddl:+ self.assertGreater(index_tx_start, -1, "Transaction start not found")+ self.assertGreater(+ index_tx_end, index_op_desc_unique_together,+ "Transaction end not found or found before operation description (unique_together)"+ )+ self.assertGreater( index_op_desc_author, index_tx_start, "Operation description (author) not found or found before transaction start"@@ -553,10 +559,6 @@ def test_sqlmigrate_forwards(self): index_op_desc_unique_together, index_op_desc_tribble, "Operation description (unique_together) not found or found before operation description (tribble)" )- self.assertGreater(- index_tx_end, index_op_desc_unique_together,- "Transaction end not found or found before operation description (unique_together)"- ) @override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"}) def test_sqlmigrate_backwards(self):@@ -577,7 +579,12 @@ def test_sqlmigrate_backwards(self): index_drop_table = output.rfind('drop table') index_tx_end = output.find(connection.ops.end_transaction_sql().lower()) - self.assertGreater(index_tx_start, -1, "Transaction start not found")+ if connection.features.can_rollback_ddl:+ self.assertGreater(index_tx_start, -1, "Transaction start not found")+ self.assertGreater(+ index_tx_end, index_op_desc_unique_together,+ "Transaction end not found or found before DROP TABLE"+ ) self.assertGreater( index_op_desc_unique_together, index_tx_start, "Operation description (unique_together) not found or found before transaction start"@@ -595,10 +602,6 @@ def test_sqlmigrate_backwards(self): index_drop_table, index_op_desc_author, "DROP TABLE not found or found before operation description (author)" )- self.assertGreater(- index_tx_end, index_op_desc_unique_together,- "Transaction end not found or found before DROP TABLE"- ) # Cleanup by unmigrating everything call_command("migrate", "migrations", "zero", verbosity=0)@@ -616,6 +619,22 @@ def test_sqlmigrate_for_non_atomic_migration(self): self.assertNotIn(connection.ops.start_transaction_sql().lower(), queries) self.assertNotIn(connection.ops.end_transaction_sql().lower(), queries) + @override_settings(MIGRATION_MODULES={'migrations': 'migrations.test_migrations'})+ def test_sqlmigrate_for_non_transactional_databases(self):+ """+ Transaction wrappers aren't shown for databases that don't support+ transactional DDL.+ """+ out = io.StringIO()+ with mock.patch.object(connection.features, 'can_rollback_ddl', False):+ call_command('sqlmigrate', 'migrations', '0001', stdout=out)+ output = out.getvalue().lower()+ queries = [q.strip() for q in output.splitlines()]+ start_transaction_sql = connection.ops.start_transaction_sql()+ if start_transaction_sql:+ self.assertNotIn(start_transaction_sql.lower(), queries)+ self.assertNotIn(connection.ops.end_transaction_sql().lower(), queries)+ @override_settings( INSTALLED_APPS=[ "migrations.migrations_test_apps.migrated_app",
EOF_114329324912./tests/runtests.py --verbosity 2 --settings=test_sqlite --parallel 1 migrations.test_commandsgit checkout d5276398046ce4a102776a1e67dcac2884d80dfe tests/migrations/test_commands.py123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597diff --git a/django/core/management/commands/.backup.sqlmigrate.py b/django/core/management/commands/.backup.sqlmigrate.pynew file mode 100644index 0000000000..f0b663222a--- /dev/null+++ b/django/core/management/commands/.backup.sqlmigrate.py@@ -0,0 +1,65 @@+from django.apps import apps+from django.core.management.base import BaseCommand, CommandError+from django.db import DEFAULT_DB_ALIAS, connections+from django.db.migrations.executor import MigrationExecutor+from django.db.migrations.loader import AmbiguityError+++class Command(BaseCommand):+ help = "Prints the SQL statements for the named migration."++ output_transaction = True++ def add_arguments(self, parser):+ parser.add_argument('app_label', help='App label of the application containing the migration.')+ parser.add_argument('migration_name', help='Migration name to print the SQL for.')+ parser.add_argument(+ '--database', default=DEFAULT_DB_ALIAS,+ help='Nominates a database to create SQL for. Defaults to the "default" database.',+ )+ parser.add_argument(+ '--backwards', action='store_true',+ help='Creates SQL to unapply the migration, rather than to apply it',+ )++ def execute(self, *args, **options):+ # sqlmigrate doesn't support coloring its output but we need to force+ # no_color=True so that the BEGIN/COMMIT statements added by+ # output_transaction don't get colored either.+ options['no_color'] = True+ return super().execute(*args, **options)++ def handle(self, *args, **options):+ # Get the database we're operating from+ connection = connections[options['database']]++ # Load up an executor to get all the migration data+ executor = MigrationExecutor(connection)++ # Resolve command-line arguments into a migration+ app_label, migration_name = options['app_label'], options['migration_name']+ # Validate app_label+ try:+ apps.get_app_config(app_label)+ except LookupError as err:+ raise CommandError(str(err))+ if app_label not in executor.loader.migrated_apps:+ raise CommandError("App '%s' does not have migrations" % app_label)+ try:+ migration = executor.loader.get_migration_by_prefix(app_label, migration_name)+ except AmbiguityError:+ raise CommandError("More than one migration matches '%s' in app '%s'. Please be more specific." % (+ migration_name, app_label))+ except KeyError:+ raise CommandError("Cannot find a migration matching '%s' from app '%s'. Is it in INSTALLED_APPS?" % (+ migration_name, app_label))+ targets = [(app_label, migration.name)]++ # Show begin/end around output only for atomic migrations+ self.output_transaction = migration.atomic++ # Make a plan that represents just the requested migrations and show SQL+ # for it+ plan = [(executor.loader.graph.nodes[targets[0]], options['backwards'])]+ sql_statements = executor.collect_sql(plan)+ return '\n'.join(sql_statements)diff --git a/django/core/management/commands/sqlmigrate.py b/django/core/management/commands/sqlmigrate.pyindex f0b663222a..b51d1739a4 100644--- a/django/core/management/commands/sqlmigrate.py+++ b/django/core/management/commands/sqlmigrate.py@@ -56,7 +56,7 @@ class Command(BaseCommand): targets = [(app_label, migration.name)] # Show begin/end around output only for atomic migrations- self.output_transaction = migration.atomic+ self.output_transaction = migration.atomic and connection.features.can_rollback_ddl # Make a plan that represents just the requested migrations and show SQL # for itdiff --git a/myproject/.backup.test_sqlmigrate.py b/myproject/.backup.test_sqlmigrate.pynew file mode 100644index 0000000000..af1b4ae72d--- /dev/null+++ b/myproject/.backup.test_sqlmigrate.py@@ -0,0 +1,20 @@+from django.core.management.commands.sqlmigrate import Command+from django.db import connections+from django.test import TestCase++class TestSqlmigrate(TestCase):+ def test_sqlmigrate_output_transaction(self):+ # Mock connection.features.can_rollback_ddl to False+ connections['default'].features.can_rollback_ddl = False++ # Create a Command instance+ command = Command()++ # Set the output_transaction attribute+ command.output_transaction = True++ # Call the handle method+ command.handle(app_label='myapp', migration_name='0001_initial', database='default', backwards=False)++ # Assert that output_transaction is False+ self.assertFalse(command.output_transaction)diff --git a/myproject/db.sqlite3 b/myproject/db.sqlite3new file mode 100644index 0000000000..e69de29bb2diff --git a/myproject/manage.py b/myproject/manage.pynew file mode 100755index 0000000000..6bb3761245--- /dev/null+++ b/myproject/manage.py@@ -0,0 +1,21 @@+#!/usr/bin/env python+"""Django's command-line utility for administrative tasks."""+import os+import sys+++def main():+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')+ try:+ from django.core.management import execute_from_command_line+ except ImportError as exc:+ raise ImportError(+ "Couldn't import Django. Are you sure it's installed and "+ "available on your PYTHONPATH environment variable? Did you "+ "forget to activate a virtual environment?"+ ) from exc+ execute_from_command_line(sys.argv)+++if __name__ == '__main__':+ main()diff --git a/myproject/myapp/.backup.models.py b/myproject/myapp/.backup.models.pynew file mode 100644index 0000000000..71a8362390--- /dev/null+++ b/myproject/myapp/.backup.models.py@@ -0,0 +1,3 @@+from django.db import models++# Create your models here.diff --git a/myproject/myapp/__init__.py b/myproject/myapp/__init__.pynew file mode 100644index 0000000000..e69de29bb2diff --git a/myproject/myapp/admin.py b/myproject/myapp/admin.pynew file mode 100644index 0000000000..8c38f3f3da--- /dev/null+++ b/myproject/myapp/admin.py@@ -0,0 +1,3 @@+from django.contrib import admin++# Register your models here.diff --git a/myproject/myapp/apps.py b/myproject/myapp/apps.pynew file mode 100644index 0000000000..74d6d13183--- /dev/null+++ b/myproject/myapp/apps.py@@ -0,0 +1,5 @@+from django.apps import AppConfig+++class MyappConfig(AppConfig):+ name = 'myapp'diff --git a/myproject/myapp/migrations/0001_initial.py b/myproject/myapp/migrations/0001_initial.pynew file mode 100644index 0000000000..797826cc44--- /dev/null+++ b/myproject/myapp/migrations/0001_initial.py@@ -0,0 +1,21 @@+# Generated by Django 3.0.dev20190307150218 on 2024-09-28 18:15++from django.db import migrations, models+++class Migration(migrations.Migration):++ initial = True++ dependencies = [+ ]++ operations = [+ migrations.CreateModel(+ name='MyModel',+ fields=[+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),+ ('name', models.CharField(max_length=255)),+ ],+ ),+ ]diff --git a/myproject/myapp/migrations/__init__.py b/myproject/myapp/migrations/__init__.pynew file mode 100644index 0000000000..e69de29bb2diff --git a/myproject/myapp/models.py b/myproject/myapp/models.pynew file mode 100644index 0000000000..f199ad7359--- /dev/null+++ b/myproject/myapp/models.py@@ -0,0 +1,7 @@+from django.db import models++# Create your models here.+from django.db import models++class MyModel(models.Model):+ name = models.CharField(max_length=255)diff --git a/myproject/myapp/tests.py b/myproject/myapp/tests.pynew file mode 100644index 0000000000..7ce503c2dd--- /dev/null+++ b/myproject/myapp/tests.py@@ -0,0 +1,3 @@+from django.test import TestCase++# Create your tests here.diff --git a/myproject/myapp/views.py b/myproject/myapp/views.pynew file mode 100644index 0000000000..91ea44a218--- /dev/null+++ b/myproject/myapp/views.py@@ -0,0 +1,3 @@+from django.shortcuts import render++# Create your views here.diff --git a/myproject/myproject/.backup.settings.py b/myproject/myproject/.backup.settings.pynew file mode 100644index 0000000000..70e164b0e8--- /dev/null+++ b/myproject/myproject/.backup.settings.py@@ -0,0 +1,120 @@+"""+Django settings for myproject project.++Generated by 'django-admin startproject' using Django 3.0.dev20190307150218.++For more information on this file, see+https://docs.djangoproject.com/en/dev/topics/settings/++For the full list of settings and their values, see+https://docs.djangoproject.com/en/dev/ref/settings/+"""++import os++# Build paths inside the project like this: os.path.join(BASE_DIR, ...)+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))+++# Quick-start development settings - unsuitable for production+# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/++# SECURITY WARNING: keep the secret key used in production secret!+SECRET_KEY = '!c7roc^ja^p^(+5(5m3--_0sujh&z#0)tv0$ny4^jb+kl6$e-n'++# SECURITY WARNING: don't run with debug turned on in production!+DEBUG = True++ALLOWED_HOSTS = []+++# Application definition++INSTALLED_APPS = [+ 'django.contrib.admin',+ 'django.contrib.auth',+ 'django.contrib.contenttypes',+ 'django.contrib.sessions',+ 'django.contrib.messages',+ 'django.contrib.staticfiles',+]++MIDDLEWARE = [+ 'django.middleware.security.SecurityMiddleware',+ 'django.contrib.sessions.middleware.SessionMiddleware',+ 'django.middleware.common.CommonMiddleware',+ 'django.middleware.csrf.CsrfViewMiddleware',+ 'django.contrib.auth.middleware.AuthenticationMiddleware',+ 'django.contrib.messages.middleware.MessageMiddleware',+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',+]++ROOT_URLCONF = 'myproject.urls'++TEMPLATES = [+ {+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',+ 'DIRS': [],+ 'APP_DIRS': True,+ 'OPTIONS': {+ 'context_processors': [+ 'django.template.context_processors.debug',+ 'django.template.context_processors.request',+ 'django.contrib.auth.context_processors.auth',+ 'django.contrib.messages.context_processors.messages',+ ],+ },+ },+]++WSGI_APPLICATION = 'myproject.wsgi.application'+++# Database+# https://docs.djangoproject.com/en/dev/ref/settings/#databases++DATABASES = {+ 'default': {+ 'ENGINE': 'django.db.backends.sqlite3',+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),+ }+}+++# Password validation+# https://docs.djangoproject.com/en/dev/ref/settings/#auth-password-validators++AUTH_PASSWORD_VALIDATORS = [+ {+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',+ },+ {+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',+ },+ {+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',+ },+ {+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',+ },+]+++# Internationalization+# https://docs.djangoproject.com/en/dev/topics/i18n/++LANGUAGE_CODE = 'en-us'++TIME_ZONE = 'UTC'++USE_I18N = True++USE_L10N = True++USE_TZ = True+++# Static files (CSS, JavaScript, Images)+# https://docs.djangoproject.com/en/dev/howto/static-files/++STATIC_URL = '/static/'diff --git a/myproject/myproject/__init__.py b/myproject/myproject/__init__.pynew file mode 100644index 0000000000..e69de29bb2diff --git a/myproject/myproject/settings.py b/myproject/myproject/settings.pynew file mode 100644index 0000000000..acebed9499--- /dev/null+++ b/myproject/myproject/settings.py@@ -0,0 +1,121 @@+"""+Django settings for myproject project.++Generated by 'django-admin startproject' using Django 3.0.dev20190307150218.++For more information on this file, see+https://docs.djangoproject.com/en/dev/topics/settings/++For the full list of settings and their values, see+https://docs.djangoproject.com/en/dev/ref/settings/+"""++import os++# Build paths inside the project like this: os.path.join(BASE_DIR, ...)+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))+++# Quick-start development settings - unsuitable for production+# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/++# SECURITY WARNING: keep the secret key used in production secret!+SECRET_KEY = '!c7roc^ja^p^(+5(5m3--_0sujh&z#0)tv0$ny4^jb+kl6$e-n'++# SECURITY WARNING: don't run with debug turned on in production!+DEBUG = True++ALLOWED_HOSTS = []+++# Application definition++INSTALLED_APPS = [+ 'django.contrib.admin',+ 'django.contrib.auth',+ 'django.contrib.contenttypes',+ 'django.contrib.sessions',+ 'django.contrib.messages',+ 'django.contrib.staticfiles',+ 'myapp',+]++MIDDLEWARE = [+ 'django.middleware.security.SecurityMiddleware',+ 'django.contrib.sessions.middleware.SessionMiddleware',+ 'django.middleware.common.CommonMiddleware',+ 'django.middleware.csrf.CsrfViewMiddleware',+ 'django.contrib.auth.middleware.AuthenticationMiddleware',+ 'django.contrib.messages.middleware.MessageMiddleware',+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',+]++ROOT_URLCONF = 'myproject.urls'++TEMPLATES = [+ {+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',+ 'DIRS': [],+ 'APP_DIRS': True,+ 'OPTIONS': {+ 'context_processors': [+ 'django.template.context_processors.debug',+ 'django.template.context_processors.request',+ 'django.contrib.auth.context_processors.auth',+ 'django.contrib.messages.context_processors.messages',+ ],+ },+ },+]++WSGI_APPLICATION = 'myproject.wsgi.application'+++# Database+# https://docs.djangoproject.com/en/dev/ref/settings/#databases++DATABASES = {+ 'default': {+ 'ENGINE': 'django.db.backends.sqlite3',+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),+ }+}+++# Password validation+# https://docs.djangoproject.com/en/dev/ref/settings/#auth-password-validators++AUTH_PASSWORD_VALIDATORS = [+ {+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',+ },+ {+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',+ },+ {+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',+ },+ {+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',+ },+]+++# Internationalization+# https://docs.djangoproject.com/en/dev/topics/i18n/++LANGUAGE_CODE = 'en-us'++TIME_ZONE = 'UTC'++USE_I18N = True++USE_L10N = True++USE_TZ = True+++# Static files (CSS, JavaScript, Images)+# https://docs.djangoproject.com/en/dev/howto/static-files/++STATIC_URL = '/static/'diff --git a/myproject/myproject/urls.py b/myproject/myproject/urls.pynew file mode 100644index 0000000000..f1bb5b6525--- /dev/null+++ b/myproject/myproject/urls.py@@ -0,0 +1,21 @@+"""myproject URL Configuration++The `urlpatterns` list routes URLs to views. For more information please see:+ https://docs.djangoproject.com/en/dev/topics/http/urls/+Examples:+Function views+ 1. Add an import: from my_app import views+ 2. Add a URL to urlpatterns: path('', views.home, name='home')+Class-based views+ 1. Add an import: from other_app.views import Home+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')+Including another URLconf+ 1. Import the include() function: from django.urls import include, path+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))+"""+from django.contrib import admin+from django.urls import path++urlpatterns = [+ path('admin/', admin.site.urls),+]diff --git a/myproject/myproject/wsgi.py b/myproject/myproject/wsgi.pynew file mode 100644index 0000000000..b3f18eed49--- /dev/null+++ b/myproject/myproject/wsgi.py@@ -0,0 +1,16 @@+"""+WSGI config for myproject project.++It exposes the WSGI callable as a module-level variable named ``application``.++For more information on this file, see+https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/+"""++import os++from django.core.wsgi import get_wsgi_application++os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')++application = get_wsgi_application()diff --git a/myproject/test_sqlmigrate.py b/myproject/test_sqlmigrate.pynew file mode 100644index 0000000000..96e4a7bfda--- /dev/null+++ b/myproject/test_sqlmigrate.py@@ -0,0 +1,20 @@+from django.core.management.commands.sqlmigrate import Command+from django.db import connections+from django.test import TestCase++class TestSqlmigrate(TestCase):+ def test_sqlmigrate_output_transaction(self):+ # Mock connection.features.can_rollback_ddl to False+ connections['default'].features.can_rollback_ddl = True++ # Create a Command instance+ command = Command()++ # Set the output_transaction attribute+ command.output_transaction = True++ # Call the handle method+ command.handle(app_label='myapp', migration_name='0001_initial', database='default', backwards=False)++ # Assert that output_transaction is False+ self.assertFalse(command.output_transaction)diff --git a/tests/migrations/.backup.test_sqlmigrate.py b/tests/migrations/.backup.test_sqlmigrate.pynew file mode 100644index 0000000000..8b13789179--- /dev/null+++ b/tests/migrations/.backup.test_sqlmigrate.py@@ -0,0 +1 @@+diff --git a/tests/migrations/test_sqlmigrate.py b/tests/migrations/test_sqlmigrate.pynew file mode 100644index 0000000000..19b3cb4e53--- /dev/null+++ b/tests/migrations/test_sqlmigrate.py@@ -0,0 +1,20 @@+from django.core.management.commands.sqlmigrate import Command+from django.db import connections+from django.test import TestCase++class TestSqlmigrate(TestCase):+ def test_sqlmigrate_output_transaction(self):+ # Mock connection.features.can_rollback_ddl to False+ connections['default'].features.can_rollback_ddl = False++ # Create a Command instance+ command = Command()++ # Set the output_transaction attribute+ command.output_transaction = True++ # Call the handle method+ command.handle('app_label', 'migration_name')++ # Assert that output_transaction is False+ self.assertFalse(command.output_transaction)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117{ "django__django-11039": { "patch_is_None": false, "patch_exists": true, "patch_successfully_applied": true, "resolved": true, "tests_status": { "FAIL_TO_PASS": { "success": [ "test_sqlmigrate_for_non_transactional_databases (migrations.test_commands.MigrateTests)" ], "failure": [] }, "PASS_TO_PASS": { "success": [ "test_makemigrations_app_name_specified_as_label (migrations.test_commands.AppLabelErrorTests)", "test_makemigrations_nonexistent_app_label (migrations.test_commands.AppLabelErrorTests)", "test_migrate_app_name_specified_as_label (migrations.test_commands.AppLabelErrorTests)", "test_migrate_nonexistent_app_label (migrations.test_commands.AppLabelErrorTests)", "test_showmigrations_app_name_specified_as_label (migrations.test_commands.AppLabelErrorTests)", "test_showmigrations_nonexistent_app_label (migrations.test_commands.AppLabelErrorTests)", "test_sqlmigrate_app_name_specified_as_label (migrations.test_commands.AppLabelErrorTests)", "test_sqlmigrate_nonexistent_app_label (migrations.test_commands.AppLabelErrorTests)", "test_squashmigrations_app_name_specified_as_label (migrations.test_commands.AppLabelErrorTests)", "test_squashmigrations_nonexistent_app_label (migrations.test_commands.AppLabelErrorTests)", "--squashed-name specifies the new migration's name.", "--squashed-name also works if a start migration is omitted.", "test_squashmigrations_initial_attribute (migrations.test_commands.SquashMigrationsTests)", "test_squashmigrations_invalid_start (migrations.test_commands.SquashMigrationsTests)", "test_squashmigrations_optimizes (migrations.test_commands.SquashMigrationsTests)", "test_squashmigrations_squashes (migrations.test_commands.SquashMigrationsTests)", "test_squashmigrations_valid_start (migrations.test_commands.SquashMigrationsTests)", "test_ticket_23799_squashmigrations_no_optimize (migrations.test_commands.SquashMigrationsTests)", "test_failing_migration (migrations.test_commands.MakeMigrationsTests)", "test_files_content (migrations.test_commands.MakeMigrationsTests)", "test_makemigration_merge_dry_run (migrations.test_commands.MakeMigrationsTests)", "test_makemigration_merge_dry_run_verbosity_3 (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_auto_now_add_interactive (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_check (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_conflict_exit (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_consistency_checks_respect_routers (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_default_merge_name (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_disabled_migrations_for_app (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_dry_run (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_dry_run_verbosity_3 (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_empty_connections (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_empty_migration (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_empty_no_app_specified (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_handle_merge (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_inconsistent_history (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_interactive_accept (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_interactive_by_default (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_interactive_reject (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_merge_dont_output_dependency_operations (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_merge_no_conflict (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_migration_path_output (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_migration_path_output_valueerror (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_migrations_announce (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_migrations_modules_nonexistent_toplevel_package (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_migrations_modules_path_not_exist (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_no_apps_initial (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_no_changes (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_no_changes_no_apps (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_no_common_ancestor (migrations.test_commands.MakeMigrationsTests)", "Migration directories without an __init__.py file are allowed.", "test_makemigrations_non_interactive_no_field_rename (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_non_interactive_no_model_rename (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_non_interactive_not_null_addition (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_non_interactive_not_null_alteration (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_order (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_unspecified_app_with_conflict_merge (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_unspecified_app_with_conflict_no_merge (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_with_custom_name (migrations.test_commands.MakeMigrationsTests)", "test_makemigrations_with_invalid_custom_name (migrations.test_commands.MakeMigrationsTests)", "test_ambigious_prefix (migrations.test_commands.MigrateTests)", "test_app_without_migrations (migrations.test_commands.MigrateTests)", "test_migrate (migrations.test_commands.MigrateTests)", "test_migrate_conflict_exit (migrations.test_commands.MigrateTests)", "test_migrate_fake_initial (migrations.test_commands.MigrateTests)", "test_migrate_fake_split_initial (migrations.test_commands.MigrateTests)", "test_migrate_inconsistent_history (migrations.test_commands.MigrateTests)", "test_migrate_initial_false (migrations.test_commands.MigrateTests)", "Tests migrate --plan output.", "test_migrate_record_replaced (migrations.test_commands.MigrateTests)", "test_migrate_record_squashed (migrations.test_commands.MigrateTests)", "test_migrate_syncdb_app_label (migrations.test_commands.MigrateTests)", "test_migrate_syncdb_app_with_migrations (migrations.test_commands.MigrateTests)", "test_migrate_syncdb_deferred_sql_executed_with_schemaeditor (migrations.test_commands.MigrateTests)", "test_migrate_with_system_checks (migrations.test_commands.MigrateTests)", "test_regression_22823_unmigrated_fk_to_migrated_model (migrations.test_commands.MigrateTests)", "test_showmigrations_list (migrations.test_commands.MigrateTests)", "test_showmigrations_no_migrations (migrations.test_commands.MigrateTests)", "test_showmigrations_plan (migrations.test_commands.MigrateTests)", "test_showmigrations_plan_app_label_no_migrations (migrations.test_commands.MigrateTests)", "test_showmigrations_plan_multiple_app_labels (migrations.test_commands.MigrateTests)", "test_showmigrations_plan_no_migrations (migrations.test_commands.MigrateTests)", "test_showmigrations_plan_single_app_label (migrations.test_commands.MigrateTests)", "test_showmigrations_plan_squashed (migrations.test_commands.MigrateTests)", "test_showmigrations_unmigrated_app (migrations.test_commands.MigrateTests)", "test_sqlmigrate_backwards (migrations.test_commands.MigrateTests)", "test_sqlmigrate_for_non_atomic_migration (migrations.test_commands.MigrateTests)", "test_sqlmigrate_forwards (migrations.test_commands.MigrateTests)", "test_unknown_prefix (migrations.test_commands.MigrateTests)" ], "failure": [] }, "FAIL_TO_FAIL": { "success": [], "failure": [] }, "PASS_TO_FAIL": { "success": [], "failure": [] } } }}123version https://git-lfs.github.com/spec/v1oid sha256:2b538045d5bc6e76a5912d949d9c4c61a2d65a85d33df323e14d812d1623c3f4size 12436123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652+ source /opt/miniconda3/bin/activate++ _CONDA_ROOT=/opt/miniconda3++ . /opt/miniconda3/etc/profile.d/conda.sh+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ '[' -z '' ']'+++ export CONDA_SHLVL=0+++ CONDA_SHLVL=0+++ '[' -n '' ']'+++++ dirname /opt/miniconda3/bin/conda++++ dirname /opt/miniconda3/bin+++ PATH=/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export PATH+++ '[' -z '' ']'+++ PS1=++ conda activate++ local cmd=activate++ case "$cmd" in++ __conda_activate activate++ '[' -n '' ']'++ local ask_conda+++ PS1=+++ __conda_exe shell.posix activate+++ /opt/miniconda3/bin/conda shell.posix activate++ ask_conda='PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''1'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ eval 'PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''1'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+++ PS1='(base) '+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export CONDA_PREFIX=/opt/miniconda3+++ CONDA_PREFIX=/opt/miniconda3+++ export CONDA_SHLVL=1+++ CONDA_SHLVL=1+++ export CONDA_DEFAULT_ENV=base+++ CONDA_DEFAULT_ENV=base+++ export 'CONDA_PROMPT_MODIFIER=(base) '+++ CONDA_PROMPT_MODIFIER='(base) '+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ __conda_hashr++ '[' -n '' ']'++ '[' -n '' ']'++ hash -r+ conda activate testbed+ local cmd=activate+ case "$cmd" in+ __conda_activate activate testbed+ '[' -n '' ']'+ local ask_conda++ PS1='(base) '++ __conda_exe shell.posix activate testbed++ /opt/miniconda3/bin/conda shell.posix activate testbed+ ask_conda='PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''2'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_1='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+ eval 'PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''2'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_1='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ PS1='(testbed) '++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed++ CONDA_PREFIX=/opt/miniconda3/envs/testbed++ export CONDA_SHLVL=2++ CONDA_SHLVL=2++ export CONDA_DEFAULT_ENV=testbed++ CONDA_DEFAULT_ENV=testbed++ export 'CONDA_PROMPT_MODIFIER=(testbed) '++ CONDA_PROMPT_MODIFIER='(testbed) '++ export CONDA_PREFIX_1=/opt/miniconda3++ CONDA_PREFIX_1=/opt/miniconda3++ export CONDA_EXE=/opt/miniconda3/bin/conda++ CONDA_EXE=/opt/miniconda3/bin/conda++ export _CE_M=++ _CE_M=++ export _CE_CONDA=++ _CE_CONDA=++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+ __conda_hashr+ '[' -n '' ']'+ '[' -n '' ']'+ hash -r+ cd /testbed+ sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen+ locale-genGenerating locales (this might take a while)... en_US.UTF-8... doneGeneration complete.+ export LANG=en_US.UTF-8+ LANG=en_US.UTF-8+ export LANGUAGE=en_US:en+ LANGUAGE=en_US:en+ export LC_ALL=en_US.UTF-8+ LC_ALL=en_US.UTF-8+ git config --global --add safe.directory /testbed+ cd /testbed+ git statusOn branch mainChanges not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: django/core/management/commands/sqlmigrate.py
Untracked files: (use "git add <file>..." to include in what will be committed) django/core/management/commands/.backup.sqlmigrate.py myproject/ tests/migrations/.backup.test_sqlmigrate.py tests/migrations/test_sqlmigrate.py
no changes added to commit (use "git add" and/or "git commit -a")+ git showcommit d5276398046ce4a102776a1e67dcac2884d80dfeAuthor: ahbk <alexander.holmback@gmail.com>Date: Thu Mar 7 16:02:18 2019 +0100
Fixed #29754 -- Added is_dst parameter to Trunc database functions.
diff --git a/django/db/models/functions/datetime.py b/django/db/models/functions/datetime.pyindex 177715ecfa..7a582aa404 100644--- a/django/db/models/functions/datetime.py+++ b/django/db/models/functions/datetime.py@@ -170,8 +170,9 @@ class TruncBase(TimezoneMixin, Transform): kind = None tzinfo = None - def __init__(self, expression, output_field=None, tzinfo=None, **extra):+ def __init__(self, expression, output_field=None, tzinfo=None, is_dst=None, **extra): self.tzinfo = tzinfo+ self.is_dst = is_dst super().__init__(expression, output_field=output_field, **extra) def as_sql(self, compiler, connection):@@ -222,7 +223,7 @@ class TruncBase(TimezoneMixin, Transform): pass elif value is not None: value = value.replace(tzinfo=None)- value = timezone.make_aware(value, self.tzinfo)+ value = timezone.make_aware(value, self.tzinfo, is_dst=self.is_dst) elif not connection.features.has_zoneinfo_database: raise ValueError( 'Database returned an invalid datetime value. Are time '@@ -240,9 +241,12 @@ class TruncBase(TimezoneMixin, Transform): class Trunc(TruncBase): - def __init__(self, expression, kind, output_field=None, tzinfo=None, **extra):+ def __init__(self, expression, kind, output_field=None, tzinfo=None, is_dst=None, **extra): self.kind = kind- super().__init__(expression, output_field=output_field, tzinfo=tzinfo, **extra)+ super().__init__(+ expression, output_field=output_field, tzinfo=tzinfo,+ is_dst=is_dst, **extra+ ) class TruncYear(TruncBase):diff --git a/docs/ref/models/database-functions.txt b/docs/ref/models/database-functions.txtindex c6203f92c4..46b41251a0 100644--- a/docs/ref/models/database-functions.txt+++ b/docs/ref/models/database-functions.txt@@ -442,7 +442,7 @@ Usage example:: ``Trunc`` --------- -.. class:: Trunc(expression, kind, output_field=None, tzinfo=None, **extra)+.. class:: Trunc(expression, kind, output_field=None, tzinfo=None, is_dst=None, **extra) Truncates a date up to a significant component. @@ -460,6 +460,14 @@ value. If ``output_field`` is omitted, it will default to the ``output_field`` of ``expression``. A ``tzinfo`` subclass, usually provided by ``pytz``, can be passed to truncate a value in a specific timezone. +The ``is_dst`` parameter indicates whether or not ``pytz`` should interpret+nonexistent and ambiguous datetimes in daylight saving time. By default (when+``is_dst=None``), ``pytz`` raises an exception for such datetimes.++.. versionadded:: 3.0++ The ``is_dst`` parameter was added.+ Given the datetime ``2015-06-15 14:30:50.000321+00:00``, the built-in ``kind``\s return: @@ -525,21 +533,21 @@ Usage example:: ``DateField`` truncation ~~~~~~~~~~~~~~~~~~~~~~~~ -.. class:: TruncYear(expression, output_field=None, tzinfo=None, **extra)+.. class:: TruncYear(expression, output_field=None, tzinfo=None, is_dst=None, **extra) .. attribute:: kind = 'year' -.. class:: TruncMonth(expression, output_field=None, tzinfo=None, **extra)+.. class:: TruncMonth(expression, output_field=None, tzinfo=None, is_dst=None, **extra) .. attribute:: kind = 'month' -.. class:: TruncWeek(expression, output_field=None, tzinfo=None, **extra)+.. class:: TruncWeek(expression, output_field=None, tzinfo=None, is_dst=None, **extra) Truncates to midnight on the Monday of the week. .. attribute:: kind = 'week' -.. class:: TruncQuarter(expression, output_field=None, tzinfo=None, **extra)+.. class:: TruncQuarter(expression, output_field=None, tzinfo=None, is_dst=None, **extra) .. attribute:: kind = 'quarter' @@ -603,19 +611,19 @@ truncate function. It's also registered as a transform on ``DateTimeField`` as truncate function. It's also registered as a transform on ``DateTimeField`` as ``__time``. -.. class:: TruncDay(expression, output_field=None, tzinfo=None, **extra)+.. class:: TruncDay(expression, output_field=None, tzinfo=None, is_dst=None, **extra) .. attribute:: kind = 'day' -.. class:: TruncHour(expression, output_field=None, tzinfo=None, **extra)+.. class:: TruncHour(expression, output_field=None, tzinfo=None, is_dst=None, **extra) .. attribute:: kind = 'hour' -.. class:: TruncMinute(expression, output_field=None, tzinfo=None, **extra)+.. class:: TruncMinute(expression, output_field=None, tzinfo=None, is_dst=None, **extra) .. attribute:: kind = 'minute' -.. class:: TruncSecond(expression, output_field=None, tzinfo=None, **extra)+.. class:: TruncSecond(expression, output_field=None, tzinfo=None, is_dst=None, **extra) .. attribute:: kind = 'second' @@ -653,15 +661,15 @@ Usage example:: ``TimeField`` truncation ~~~~~~~~~~~~~~~~~~~~~~~~ -.. class:: TruncHour(expression, output_field=None, tzinfo=None, **extra)+.. class:: TruncHour(expression, output_field=None, tzinfo=None, is_dst=None, **extra) .. attribute:: kind = 'hour' -.. class:: TruncMinute(expression, output_field=None, tzinfo=None, **extra)+.. class:: TruncMinute(expression, output_field=None, tzinfo=None, is_dst=None, **extra) .. attribute:: kind = 'minute' -.. class:: TruncSecond(expression, output_field=None, tzinfo=None, **extra)+.. class:: TruncSecond(expression, output_field=None, tzinfo=None, is_dst=None, **extra) .. attribute:: kind = 'second' diff --git a/docs/releases/3.0.txt b/docs/releases/3.0.txtindex 7d09d94399..1d4df533bd 100644--- a/docs/releases/3.0.txt+++ b/docs/releases/3.0.txt@@ -164,6 +164,10 @@ Models * Added the :class:`~django.db.models.functions.MD5` database function. +* The new ``is_dst`` parameter of the+ :class:`~django.db.models.functions.Trunc` database functions determines the+ treatment of nonexistent and ambiguous datetimes.+ Requests and Responses ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/db_functions/datetime/test_extract_trunc.py b/tests/db_functions/datetime/test_extract_trunc.pyindex 065a06f4be..2088d09d06 100644--- a/tests/db_functions/datetime/test_extract_trunc.py+++ b/tests/db_functions/datetime/test_extract_trunc.py@@ -1044,6 +1044,30 @@ class DateFunctionWithTimeZoneTests(DateFunctionTests): self.assertEqual(model.melb_year.year, 2016) self.assertEqual(model.pacific_year.year, 2015) + def test_trunc_ambiguous_and_invalid_times(self):+ sao = pytz.timezone('America/Sao_Paulo')+ utc = pytz.timezone('UTC')+ start_datetime = utc.localize(datetime(2016, 10, 16, 13))+ end_datetime = utc.localize(datetime(2016, 2, 21, 1))+ self.create_model(start_datetime, end_datetime)+ with timezone.override(sao):+ with self.assertRaisesMessage(pytz.NonExistentTimeError, '2016-10-16 00:00:00'):+ model = DTModel.objects.annotate(truncated_start=TruncDay('start_datetime')).get()+ with self.assertRaisesMessage(pytz.AmbiguousTimeError, '2016-02-20 23:00:00'):+ model = DTModel.objects.annotate(truncated_end=TruncHour('end_datetime')).get()+ model = DTModel.objects.annotate(+ truncated_start=TruncDay('start_datetime', is_dst=False),+ truncated_end=TruncHour('end_datetime', is_dst=False),+ ).get()+ self.assertEqual(model.truncated_start.dst(), timedelta(0))+ self.assertEqual(model.truncated_end.dst(), timedelta(0))+ model = DTModel.objects.annotate(+ truncated_start=TruncDay('start_datetime', is_dst=True),+ truncated_end=TruncHour('end_datetime', is_dst=True),+ ).get()+ self.assertEqual(model.truncated_start.dst(), timedelta(0, 3600))+ self.assertEqual(model.truncated_end.dst(), timedelta(0, 3600))+ def test_trunc_func_with_timezone(self): """ If the truncated datetime transitions to a different offset (daylight+ git diff d5276398046ce4a102776a1e67dcac2884d80dfediff --git a/django/core/management/commands/sqlmigrate.py b/django/core/management/commands/sqlmigrate.pyindex f0b663222a..b51d1739a4 100644--- a/django/core/management/commands/sqlmigrate.py+++ b/django/core/management/commands/sqlmigrate.py@@ -56,7 +56,7 @@ class Command(BaseCommand): targets = [(app_label, migration.name)] # Show begin/end around output only for atomic migrations- self.output_transaction = migration.atomic+ self.output_transaction = migration.atomic and connection.features.can_rollback_ddl # Make a plan that represents just the requested migrations and show SQL # for it+ source /opt/miniconda3/bin/activate++ _CONDA_ROOT=/opt/miniconda3++ . /opt/miniconda3/etc/profile.d/conda.sh+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ '[' -z x ']'++ conda activate++ local cmd=activate++ case "$cmd" in++ __conda_activate activate++ '[' -n '' ']'++ local ask_conda+++ PS1='(testbed) '+++ __conda_exe shell.posix activate+++ /opt/miniconda3/bin/conda shell.posix activate++ ask_conda='PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''3'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ eval 'PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''3'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+++ PS1='(base) '+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export CONDA_PREFIX=/opt/miniconda3+++ CONDA_PREFIX=/opt/miniconda3+++ export CONDA_SHLVL=3+++ CONDA_SHLVL=3+++ export CONDA_DEFAULT_ENV=base+++ CONDA_DEFAULT_ENV=base+++ export 'CONDA_PROMPT_MODIFIER=(base) '+++ CONDA_PROMPT_MODIFIER='(base) '+++ export CONDA_PREFIX_2=/opt/miniconda3/envs/testbed+++ CONDA_PREFIX_2=/opt/miniconda3/envs/testbed+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ __conda_hashr++ '[' -n '' ']'++ '[' -n '' ']'++ hash -r+ conda activate testbed+ local cmd=activate+ case "$cmd" in+ __conda_activate activate testbed+ '[' -n '' ']'+ local ask_conda++ PS1='(base) '++ __conda_exe shell.posix activate testbed++ /opt/miniconda3/bin/conda shell.posix activate testbed+ ask_conda='PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''4'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_3='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+ eval 'PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''4'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_3='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ PS1='(testbed) '++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed++ CONDA_PREFIX=/opt/miniconda3/envs/testbed++ export CONDA_SHLVL=4++ CONDA_SHLVL=4++ export CONDA_DEFAULT_ENV=testbed++ CONDA_DEFAULT_ENV=testbed++ export 'CONDA_PROMPT_MODIFIER=(testbed) '++ CONDA_PROMPT_MODIFIER='(testbed) '++ export CONDA_PREFIX_3=/opt/miniconda3++ CONDA_PREFIX_3=/opt/miniconda3++ export CONDA_EXE=/opt/miniconda3/bin/conda++ CONDA_EXE=/opt/miniconda3/bin/conda++ export _CE_M=++ _CE_M=++ export _CE_CONDA=++ _CE_CONDA=++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+ __conda_hashr+ '[' -n '' ']'+ '[' -n '' ']'+ hash -r+ python -m pip install -e .Obtaining file:///testbedRequirement already satisfied: pytz in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from Django==3.0.dev20190307150218) (2024.1)Requirement already satisfied: sqlparse in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from Django==3.0.dev20190307150218) (0.4.4)Installing collected packages: Django Attempting uninstall: Django Found existing installation: Django 3.0.dev20190307150218 Uninstalling Django-3.0.dev20190307150218: Successfully uninstalled Django-3.0.dev20190307150218 Running setup.py develop for DjangoSuccessfully installed Django-3.0.dev20190307150218WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv+ git checkout d5276398046ce4a102776a1e67dcac2884d80dfe tests/migrations/test_commands.pyUpdated 0 paths from 99ec65f48c+ git apply -v -Checking patch tests/migrations/test_commands.py...Applied patch tests/migrations/test_commands.py cleanly.+ ./tests/runtests.py --verbosity 2 --settings=test_sqlite --parallel 1 migrations.test_commandsCreating test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...Creating test database for alias 'other' ('file:memorydb_other?mode=memory&cache=shared')...test_makemigrations_app_name_specified_as_label (migrations.test_commands.AppLabelErrorTests) ... oktest_makemigrations_nonexistent_app_label (migrations.test_commands.AppLabelErrorTests) ... oktest_migrate_app_name_specified_as_label (migrations.test_commands.AppLabelErrorTests) ... oktest_migrate_nonexistent_app_label (migrations.test_commands.AppLabelErrorTests) ... oktest_showmigrations_app_name_specified_as_label (migrations.test_commands.AppLabelErrorTests) ... oktest_showmigrations_nonexistent_app_label (migrations.test_commands.AppLabelErrorTests) ... oktest_sqlmigrate_app_name_specified_as_label (migrations.test_commands.AppLabelErrorTests) ... oktest_sqlmigrate_nonexistent_app_label (migrations.test_commands.AppLabelErrorTests) ... oktest_squashmigrations_app_name_specified_as_label (migrations.test_commands.AppLabelErrorTests) ... oktest_squashmigrations_nonexistent_app_label (migrations.test_commands.AppLabelErrorTests) ... oktest_failing_migration (migrations.test_commands.MakeMigrationsTests) ... oktest_files_content (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigration_merge_dry_run (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigration_merge_dry_run_verbosity_3 (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_auto_now_add_interactive (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_check (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_conflict_exit (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_consistency_checks_respect_routers (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_default_merge_name (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_disabled_migrations_for_app (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_dry_run (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_dry_run_verbosity_3 (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_empty_connections (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_empty_migration (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_empty_no_app_specified (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_handle_merge (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_inconsistent_history (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_interactive_accept (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_interactive_by_default (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_interactive_reject (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_merge_dont_output_dependency_operations (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_merge_no_conflict (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_migration_path_output (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_migration_path_output_valueerror (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_migrations_announce (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_migrations_modules_nonexistent_toplevel_package (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_migrations_modules_path_not_exist (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_no_apps_initial (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_no_changes (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_no_changes_no_apps (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_no_common_ancestor (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_no_init (migrations.test_commands.MakeMigrationsTests)Migration directories without an __init__.py file are allowed. ... oktest_makemigrations_non_interactive_no_field_rename (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_non_interactive_no_model_rename (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_non_interactive_not_null_addition (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_non_interactive_not_null_alteration (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_order (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_unspecified_app_with_conflict_merge (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_unspecified_app_with_conflict_no_merge (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_with_custom_name (migrations.test_commands.MakeMigrationsTests) ... oktest_makemigrations_with_invalid_custom_name (migrations.test_commands.MakeMigrationsTests) ... oktest_ambigious_prefix (migrations.test_commands.MigrateTests) ... oktest_app_without_migrations (migrations.test_commands.MigrateTests) ... oktest_migrate (migrations.test_commands.MigrateTests) ... oktest_migrate_conflict_exit (migrations.test_commands.MigrateTests) ... oktest_migrate_fake_initial (migrations.test_commands.MigrateTests) ... oktest_migrate_fake_split_initial (migrations.test_commands.MigrateTests) ... oktest_migrate_inconsistent_history (migrations.test_commands.MigrateTests) ... oktest_migrate_initial_false (migrations.test_commands.MigrateTests) ... oktest_migrate_plan (migrations.test_commands.MigrateTests)Tests migrate --plan output. ... oktest_migrate_record_replaced (migrations.test_commands.MigrateTests) ... oktest_migrate_record_squashed (migrations.test_commands.MigrateTests) ... oktest_migrate_syncdb_app_label (migrations.test_commands.MigrateTests) ... oktest_migrate_syncdb_app_with_migrations (migrations.test_commands.MigrateTests) ... oktest_migrate_syncdb_deferred_sql_executed_with_schemaeditor (migrations.test_commands.MigrateTests) ... oktest_migrate_with_system_checks (migrations.test_commands.MigrateTests) ... oktest_regression_22823_unmigrated_fk_to_migrated_model (migrations.test_commands.MigrateTests) ... oktest_showmigrations_list (migrations.test_commands.MigrateTests) ... oktest_showmigrations_no_migrations (migrations.test_commands.MigrateTests) ... oktest_showmigrations_plan (migrations.test_commands.MigrateTests) ... oktest_showmigrations_plan_app_label_no_migrations (migrations.test_commands.MigrateTests) ... oktest_showmigrations_plan_multiple_app_labels (migrations.test_commands.MigrateTests) ... oktest_showmigrations_plan_no_migrations (migrations.test_commands.MigrateTests) ... oktest_showmigrations_plan_single_app_label (migrations.test_commands.MigrateTests) ... oktest_showmigrations_plan_squashed (migrations.test_commands.MigrateTests) ... oktest_showmigrations_unmigrated_app (migrations.test_commands.MigrateTests) ... oktest_sqlmigrate_backwards (migrations.test_commands.MigrateTests) ... oktest_sqlmigrate_for_non_atomic_migration (migrations.test_commands.MigrateTests) ... oktest_sqlmigrate_for_non_transactional_databases (migrations.test_commands.MigrateTests) ... oktest_sqlmigrate_forwards (migrations.test_commands.MigrateTests) ... oktest_unknown_prefix (migrations.test_commands.MigrateTests) ... oktest_squashed_name_with_start_migration_name (migrations.test_commands.SquashMigrationsTests)--squashed-name specifies the new migration's name. ... oktest_squashed_name_without_start_migration_name (migrations.test_commands.SquashMigrationsTests)--squashed-name also works if a start migration is omitted. ... oktest_squashmigrations_initial_attribute (migrations.test_commands.SquashMigrationsTests) ... oktest_squashmigrations_invalid_start (migrations.test_commands.SquashMigrationsTests) ... oktest_squashmigrations_optimizes (migrations.test_commands.SquashMigrationsTests) ... oktest_squashmigrations_squashes (migrations.test_commands.SquashMigrationsTests) ... oktest_squashmigrations_valid_start (migrations.test_commands.SquashMigrationsTests) ... oktest_ticket_23799_squashmigrations_no_optimize (migrations.test_commands.SquashMigrationsTests) ... ok
----------------------------------------------------------------------Ran 89 tests in 0.938s
OKDestroying test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...Destroying test database for alias 'other' ('file:memorydb_other?mode=memory&cache=shared')...Testing against Django installed in '/testbed/django'Importing application migrationsOperations to perform: Synchronize unmigrated apps: auth, contenttypes, messages, migrations, sessions, staticfiles Apply all migrations: admin, sitesSynchronizing apps without migrations: Creating tables... Creating table django_content_type Creating table auth_permission Creating table auth_group Creating table auth_user Creating table django_session Creating table migrations_modelwithcustombase Creating table migrations_unmigratedmodel Running deferred SQL...Running migrations: Applying admin.0001_initial... OK Applying admin.0002_logentry_remove_auto_add... OK Applying admin.0003_logentry_add_action_flag_choices... OK Applying sites.0001_initial... OK Applying sites.0002_alter_domain_unique... OKOperations to perform: Synchronize unmigrated apps: auth, contenttypes, messages, migrations, sessions, staticfiles Apply all migrations: admin, sitesSynchronizing apps without migrations: Creating tables... Creating table django_content_type Creating table auth_permission Creating table auth_group Creating table auth_user Creating table django_session Creating table migrations_modelwithcustombase Creating table migrations_unmigratedmodel Running deferred SQL...Running migrations: Applying admin.0001_initial... OK Applying admin.0002_logentry_remove_auto_add... OK Applying admin.0003_logentry_add_action_flag_choices... OK Applying sites.0001_initial... OK Applying sites.0002_alter_domain_unique... OKSystem check identified no issues (0 silenced).+ git checkout d5276398046ce4a102776a1e67dcac2884d80dfe tests/migrations/test_commands.pyUpdated 1 path from 99ec65f48c1234567891011121314151617181920212223242526272829303132333435#!/bin/bashset -uxo pipefailsource /opt/miniconda3/bin/activateconda activate testbedcd /testbedsed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-genexport LANG=en_US.UTF-8export LANGUAGE=en_US:enexport LC_ALL=en_US.UTF-8git config --global --add safe.directory /testbedcd /testbedgit statusgit showgit diff 17455e924e243e7a55e8a38f45966d8cbb27c273source /opt/miniconda3/bin/activateconda activate testbedpython -m pip install -e .git checkout 17455e924e243e7a55e8a38f45966d8cbb27c273 tests/model_fields/test_durationfield.pygit apply -v - <<'EOF_114329324912'diff --git a/tests/model_fields/test_durationfield.py b/tests/model_fields/test_durationfield.py--- a/tests/model_fields/test_durationfield.py+++ b/tests/model_fields/test_durationfield.py@@ -75,7 +75,7 @@ def test_invalid_string(self): self.assertEqual( cm.exception.message % cm.exception.params, "'not a datetime' value has an invalid format. "- "It must be in [DD] [HH:[MM:]]ss[.uuuuuu] format."+ "It must be in [DD] [[HH:]MM:]ss[.uuuuuu] format." )
EOF_114329324912./tests/runtests.py --verbosity 2 --settings=test_sqlite --parallel 1 model_fields.test_durationfieldgit checkout 17455e924e243e7a55e8a38f45966d8cbb27c273 tests/model_fields/test_durationfield.py12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220diff --git a/django/forms/.backup.fields.py b/django/forms/.backup.fields.pynew file mode 100644index 0000000000..a977256525--- /dev/null+++ b/django/forms/.backup.fields.py@@ -0,0 +1,1202 @@+"""+Field classes.+"""++import copy+import datetime+import math+import operator+import os+import re+import uuid+from decimal import Decimal, DecimalException+from io import BytesIO+from urllib.parse import urlsplit, urlunsplit++from django.core import validators+from django.core.exceptions import ValidationError+# Provide this import for backwards compatibility.+from django.core.validators import EMPTY_VALUES # NOQA+from django.forms.boundfield import BoundField+from django.forms.utils import from_current_timezone, to_current_timezone+from django.forms.widgets import (+ FILE_INPUT_CONTRADICTION, CheckboxInput, ClearableFileInput, DateInput,+ DateTimeInput, EmailInput, FileInput, HiddenInput, MultipleHiddenInput,+ NullBooleanSelect, NumberInput, Select, SelectMultiple,+ SplitDateTimeWidget, SplitHiddenDateTimeWidget, TextInput, TimeInput,+ URLInput,+)+from django.utils import formats+from django.utils.dateparse import parse_duration+from django.utils.duration import duration_string+from django.utils.ipv6 import clean_ipv6_address+from django.utils.translation import gettext_lazy as _, ngettext_lazy++__all__ = (+ 'Field', 'CharField', 'IntegerField',+ 'DateField', 'TimeField', 'DateTimeField', 'DurationField',+ 'RegexField', 'EmailField', 'FileField', 'ImageField', 'URLField',+ 'BooleanField', 'NullBooleanField', 'ChoiceField', 'MultipleChoiceField',+ 'ComboField', 'MultiValueField', 'FloatField', 'DecimalField',+ 'SplitDateTimeField', 'GenericIPAddressField', 'FilePathField',+ 'SlugField', 'TypedChoiceField', 'TypedMultipleChoiceField', 'UUIDField',+)+++class Field:+ widget = TextInput # Default widget to use when rendering this type of Field.+ hidden_widget = HiddenInput # Default widget to use when rendering this as "hidden".+ default_validators = [] # Default set of validators+ # Add an 'invalid' entry to default_error_message if you want a specific+ # field error message not raised by the field validators.+ default_error_messages = {+ 'required': _('This field is required.'),+ }+ empty_values = list(validators.EMPTY_VALUES)++ def __init__(self, *, required=True, widget=None, label=None, initial=None,+ help_text='', error_messages=None, show_hidden_initial=False,+ validators=(), localize=False, disabled=False, label_suffix=None):+ # required -- Boolean that specifies whether the field is required.+ # True by default.+ # widget -- A Widget class, or instance of a Widget class, that should+ # be used for this Field when displaying it. Each Field has a+ # default Widget that it'll use if you don't specify this. In+ # most cases, the default widget is TextInput.+ # label -- A verbose name for this field, for use in displaying this+ # field in a form. By default, Django will use a "pretty"+ # version of the form field name, if the Field is part of a+ # Form.+ # initial -- A value to use in this Field's initial display. This value+ # is *not* used as a fallback if data isn't given.+ # help_text -- An optional string to use as "help text" for this Field.+ # error_messages -- An optional dictionary to override the default+ # messages that the field will raise.+ # show_hidden_initial -- Boolean that specifies if it is needed to render a+ # hidden widget with initial value after widget.+ # validators -- List of additional validators to use+ # localize -- Boolean that specifies if the field should be localized.+ # disabled -- Boolean that specifies whether the field is disabled, that+ # is its widget is shown in the form but not editable.+ # label_suffix -- Suffix to be added to the label. Overrides+ # form's label_suffix.+ self.required, self.label, self.initial = required, label, initial+ self.show_hidden_initial = show_hidden_initial+ self.help_text = help_text+ self.disabled = disabled+ self.label_suffix = label_suffix+ widget = widget or self.widget+ if isinstance(widget, type):+ widget = widget()+ else:+ widget = copy.deepcopy(widget)++ # Trigger the localization machinery if needed.+ self.localize = localize+ if self.localize:+ widget.is_localized = True++ # Let the widget know whether it should display as required.+ widget.is_required = self.required++ # Hook into self.widget_attrs() for any Field-specific HTML attributes.+ extra_attrs = self.widget_attrs(widget)+ if extra_attrs:+ widget.attrs.update(extra_attrs)++ self.widget = widget++ messages = {}+ for c in reversed(self.__class__.__mro__):+ messages.update(getattr(c, 'default_error_messages', {}))+ messages.update(error_messages or {})+ self.error_messages = messages++ self.validators = [*self.default_validators, *validators]++ super().__init__()++ def prepare_value(self, value):+ return value++ def to_python(self, value):+ return value++ def validate(self, value):+ if value in self.empty_values and self.required:+ raise ValidationError(self.error_messages['required'], code='required')++ def run_validators(self, value):+ if value in self.empty_values:+ return+ errors = []+ for v in self.validators:+ try:+ v(value)+ except ValidationError as e:+ if hasattr(e, 'code') and e.code in self.error_messages:+ e.message = self.error_messages[e.code]+ errors.extend(e.error_list)+ if errors:+ raise ValidationError(errors)++ def clean(self, value):+ """+ Validate the given value and return its "cleaned" value as an+ appropriate Python object. Raise ValidationError for any errors.+ """+ value = self.to_python(value)+ self.validate(value)+ self.run_validators(value)+ return value++ def bound_data(self, data, initial):+ """+ Return the value that should be shown for this field on render of a+ bound form, given the submitted POST data for the field and the initial+ data, if any.++ For most fields, this will simply be data; FileFields need to handle it+ a bit differently.+ """+ if self.disabled:+ return initial+ return data++ def widget_attrs(self, widget):+ """+ Given a Widget instance (*not* a Widget class), return a dictionary of+ any HTML attributes that should be added to the Widget, based on this+ Field.+ """+ return {}++ def has_changed(self, initial, data):+ """Return True if data differs from initial."""+ # Always return False if the field is disabled since self.bound_data+ # always uses the initial value in this case.+ if self.disabled:+ return False+ try:+ data = self.to_python(data)+ if hasattr(self, '_coerce'):+ return self._coerce(data) != self._coerce(initial)+ except ValidationError:+ return True+ # For purposes of seeing whether something has changed, None is+ # the same as an empty string, if the data or initial value we get+ # is None, replace it with ''.+ initial_value = initial if initial is not None else ''+ data_value = data if data is not None else ''+ return initial_value != data_value++ def get_bound_field(self, form, field_name):+ """+ Return a BoundField instance that will be used when accessing the form+ field in a template.+ """+ return BoundField(form, self, field_name)++ def __deepcopy__(self, memo):+ result = copy.copy(self)+ memo[id(self)] = result+ result.widget = copy.deepcopy(self.widget, memo)+ result.validators = self.validators[:]+ return result+++class CharField(Field):+ def __init__(self, *, max_length=None, min_length=None, strip=True, empty_value='', **kwargs):+ self.max_length = max_length+ self.min_length = min_length+ self.strip = strip+ self.empty_value = empty_value+ super().__init__(**kwargs)+ if min_length is not None:+ self.validators.append(validators.MinLengthValidator(int(min_length)))+ if max_length is not None:+ self.validators.append(validators.MaxLengthValidator(int(max_length)))+ self.validators.append(validators.ProhibitNullCharactersValidator())++ def to_python(self, value):+ """Return a string."""+ if value not in self.empty_values:+ value = str(value)+ if self.strip:+ value = value.strip()+ if value in self.empty_values:+ return self.empty_value+ return value++ def widget_attrs(self, widget):+ attrs = super().widget_attrs(widget)+ if self.max_length is not None and not widget.is_hidden:+ # The HTML attribute is maxlength, not max_length.+ attrs['maxlength'] = str(self.max_length)+ if self.min_length is not None and not widget.is_hidden:+ # The HTML attribute is minlength, not min_length.+ attrs['minlength'] = str(self.min_length)+ return attrs+++class IntegerField(Field):+ widget = NumberInput+ default_error_messages = {+ 'invalid': _('Enter a whole number.'),+ }+ re_decimal = re.compile(r'\.0*\s*$')++ def __init__(self, *, max_value=None, min_value=None, **kwargs):+ self.max_value, self.min_value = max_value, min_value+ if kwargs.get('localize') and self.widget == NumberInput:+ # Localized number input is not well supported on most browsers+ kwargs.setdefault('widget', super().widget)+ super().__init__(**kwargs)++ if max_value is not None:+ self.validators.append(validators.MaxValueValidator(max_value))+ if min_value is not None:+ self.validators.append(validators.MinValueValidator(min_value))++ def to_python(self, value):+ """+ Validate that int() can be called on the input. Return the result+ of int() or None for empty values.+ """+ value = super().to_python(value)+ if value in self.empty_values:+ return None+ if self.localize:+ value = formats.sanitize_separators(value)+ # Strip trailing decimal and zeros.+ try:+ value = int(self.re_decimal.sub('', str(value)))+ except (ValueError, TypeError):+ raise ValidationError(self.error_messages['invalid'], code='invalid')+ return value++ def widget_attrs(self, widget):+ attrs = super().widget_attrs(widget)+ if isinstance(widget, NumberInput):+ if self.min_value is not None:+ attrs['min'] = self.min_value+ if self.max_value is not None:+ attrs['max'] = self.max_value+ return attrs+++class FloatField(IntegerField):+ default_error_messages = {+ 'invalid': _('Enter a number.'),+ }++ def to_python(self, value):+ """+ Validate that float() can be called on the input. Return the result+ of float() or None for empty values.+ """+ value = super(IntegerField, self).to_python(value)+ if value in self.empty_values:+ return None+ if self.localize:+ value = formats.sanitize_separators(value)+ try:+ value = float(value)+ except (ValueError, TypeError):+ raise ValidationError(self.error_messages['invalid'], code='invalid')+ return value++ def validate(self, value):+ super().validate(value)+ if value in self.empty_values:+ return+ if not math.isfinite(value):+ raise ValidationError(self.error_messages['invalid'], code='invalid')++ def widget_attrs(self, widget):+ attrs = super().widget_attrs(widget)+ if isinstance(widget, NumberInput) and 'step' not in widget.attrs:+ attrs.setdefault('step', 'any')+ return attrs+++class DecimalField(IntegerField):+ default_error_messages = {+ 'invalid': _('Enter a number.'),+ }++ def __init__(self, *, max_value=None, min_value=None, max_digits=None, decimal_places=None, **kwargs):+ self.max_digits, self.decimal_places = max_digits, decimal_places+ super().__init__(max_value=max_value, min_value=min_value, **kwargs)+ self.validators.append(validators.DecimalValidator(max_digits, decimal_places))++ def to_python(self, value):+ """+ Validate that the input is a decimal number. Return a Decimal+ instance or None for empty values. Ensure that there are no more+ than max_digits in the number and no more than decimal_places digits+ after the decimal point.+ """+ if value in self.empty_values:+ return None+ if self.localize:+ value = formats.sanitize_separators(value)+ value = str(value).strip()+ try:+ value = Decimal(value)+ except DecimalException:+ raise ValidationError(self.error_messages['invalid'], code='invalid')+ return value++ def validate(self, value):+ super().validate(value)+ if value in self.empty_values:+ return+ if not value.is_finite():+ raise ValidationError(self.error_messages['invalid'], code='invalid')++ def widget_attrs(self, widget):+ attrs = super().widget_attrs(widget)+ if isinstance(widget, NumberInput) and 'step' not in widget.attrs:+ if self.decimal_places is not None:+ # Use exponential notation for small values since they might+ # be parsed as 0 otherwise. ref #20765+ step = str(Decimal(1).scaleb(-self.decimal_places)).lower()+ else:+ step = 'any'+ attrs.setdefault('step', step)+ return attrs+++class BaseTemporalField(Field):++ def __init__(self, *, input_formats=None, **kwargs):+ super().__init__(**kwargs)+ if input_formats is not None:+ self.input_formats = input_formats++ def to_python(self, value):+ value = value.strip()+ # Try to strptime against each input format.+ for format in self.input_formats:+ try:+ return self.strptime(value, format)+ except (ValueError, TypeError):+ continue+ raise ValidationError(self.error_messages['invalid'], code='invalid')++ def strptime(self, value, format):+ raise NotImplementedError('Subclasses must define this method.')+++class DateField(BaseTemporalField):+ widget = DateInput+ input_formats = formats.get_format_lazy('DATE_INPUT_FORMATS')+ default_error_messages = {+ 'invalid': _('Enter a valid date.'),+ }++ def to_python(self, value):+ """+ Validate that the input can be converted to a date. Return a Python+ datetime.date object.+ """+ if value in self.empty_values:+ return None+ if isinstance(value, datetime.datetime):+ return value.date()+ if isinstance(value, datetime.date):+ return value+ return super().to_python(value)++ def strptime(self, value, format):+ return datetime.datetime.strptime(value, format).date()+++class TimeField(BaseTemporalField):+ widget = TimeInput+ input_formats = formats.get_format_lazy('TIME_INPUT_FORMATS')+ default_error_messages = {+ 'invalid': _('Enter a valid time.')+ }++ def to_python(self, value):+ """+ Validate that the input can be converted to a time. Return a Python+ datetime.time object.+ """+ if value in self.empty_values:+ return None+ if isinstance(value, datetime.time):+ return value+ return super().to_python(value)++ def strptime(self, value, format):+ return datetime.datetime.strptime(value, format).time()+++class DateTimeField(BaseTemporalField):+ widget = DateTimeInput+ input_formats = formats.get_format_lazy('DATETIME_INPUT_FORMATS')+ default_error_messages = {+ 'invalid': _('Enter a valid date/time.'),+ }++ def prepare_value(self, value):+ if isinstance(value, datetime.datetime):+ value = to_current_timezone(value)+ return value++ def to_python(self, value):+ """+ Validate that the input can be converted to a datetime. Return a+ Python datetime.datetime object.+ """+ if value in self.empty_values:+ return None+ if isinstance(value, datetime.datetime):+ return from_current_timezone(value)+ if isinstance(value, datetime.date):+ result = datetime.datetime(value.year, value.month, value.day)+ return from_current_timezone(result)+ result = super().to_python(value)+ return from_current_timezone(result)++ def strptime(self, value, format):+ return datetime.datetime.strptime(value, format)+++class DurationField(Field):+ default_error_messages = {+ 'invalid': _('Enter a valid duration.'),+ 'overflow': _('The number of days must be between {min_days} and {max_days}.')+ }++ def prepare_value(self, value):+ if isinstance(value, datetime.timedelta):+ return duration_string(value)+ return value++ def to_python(self, value):+ if value in self.empty_values:+ return None+ if isinstance(value, datetime.timedelta):+ return value+ try:+ value = parse_duration(str(value))+ except OverflowError:+ raise ValidationError(self.error_messages['overflow'].format(+ min_days=datetime.timedelta.min.days,+ max_days=datetime.timedelta.max.days,+ ), code='overflow')+ if value is None:+ raise ValidationError(self.error_messages['invalid'], code='invalid')+ return value+++class RegexField(CharField):+ def __init__(self, regex, **kwargs):+ """+ regex can be either a string or a compiled regular expression object.+ """+ kwargs.setdefault('strip', False)+ super().__init__(**kwargs)+ self._set_regex(regex)++ def _get_regex(self):+ return self._regex++ def _set_regex(self, regex):+ if isinstance(regex, str):+ regex = re.compile(regex)+ self._regex = regex+ if hasattr(self, '_regex_validator') and self._regex_validator in self.validators:+ self.validators.remove(self._regex_validator)+ self._regex_validator = validators.RegexValidator(regex=regex)+ self.validators.append(self._regex_validator)++ regex = property(_get_regex, _set_regex)+++class EmailField(CharField):+ widget = EmailInput+ default_validators = [validators.validate_email]++ def __init__(self, **kwargs):+ super().__init__(strip=True, **kwargs)+++class FileField(Field):+ widget = ClearableFileInput+ default_error_messages = {+ 'invalid': _("No file was submitted. Check the encoding type on the form."),+ 'missing': _("No file was submitted."),+ 'empty': _("The submitted file is empty."),+ 'max_length': ngettext_lazy(+ 'Ensure this filename has at most %(max)d character (it has %(length)d).',+ 'Ensure this filename has at most %(max)d characters (it has %(length)d).',+ 'max'),+ 'contradiction': _('Please either submit a file or check the clear checkbox, not both.')+ }++ def __init__(self, *, max_length=None, allow_empty_file=False, **kwargs):+ self.max_length = max_length+ self.allow_empty_file = allow_empty_file+ super().__init__(**kwargs)++ def to_python(self, data):+ if data in self.empty_values:+ return None++ # UploadedFile objects should have name and size attributes.+ try:+ file_name = data.name+ file_size = data.size+ except AttributeError:+ raise ValidationError(self.error_messages['invalid'], code='invalid')++ if self.max_length is not None and len(file_name) > self.max_length:+ params = {'max': self.max_length, 'length': len(file_name)}+ raise ValidationError(self.error_messages['max_length'], code='max_length', params=params)+ if not file_name:+ raise ValidationError(self.error_messages['invalid'], code='invalid')+ if not self.allow_empty_file and not file_size:+ raise ValidationError(self.error_messages['empty'], code='empty')++ return data++ def clean(self, data, initial=None):+ # If the widget got contradictory inputs, we raise a validation error+ if data is FILE_INPUT_CONTRADICTION:+ raise ValidationError(self.error_messages['contradiction'], code='contradiction')+ # False means the field value should be cleared; further validation is+ # not needed.+ if data is False:+ if not self.required:+ return False+ # If the field is required, clearing is not possible (the widget+ # shouldn't return False data in that case anyway). False is not+ # in self.empty_value; if a False value makes it this far+ # it should be validated from here on out as None (so it will be+ # caught by the required check).+ data = None+ if not data and initial:+ return initial+ return super().clean(data)++ def bound_data(self, data, initial):+ if data in (None, FILE_INPUT_CONTRADICTION):+ return initial+ return data++ def has_changed(self, initial, data):+ return not self.disabled and data is not None+++class ImageField(FileField):+ default_validators = [validators.validate_image_file_extension]+ default_error_messages = {+ 'invalid_image': _(+ "Upload a valid image. The file you uploaded was either not an "+ "image or a corrupted image."+ ),+ }++ def to_python(self, data):+ """+ Check that the file-upload field data contains a valid image (GIF, JPG,+ PNG, etc. -- whatever Pillow supports).+ """+ f = super().to_python(data)+ if f is None:+ return None++ from PIL import Image++ # We need to get a file object for Pillow. We might have a path or we might+ # have to read the data into memory.+ if hasattr(data, 'temporary_file_path'):+ file = data.temporary_file_path()+ else:+ if hasattr(data, 'read'):+ file = BytesIO(data.read())+ else:+ file = BytesIO(data['content'])++ try:+ # load() could spot a truncated JPEG, but it loads the entire+ # image in memory, which is a DoS vector. See #3848 and #18520.+ image = Image.open(file)+ # verify() must be called immediately after the constructor.+ image.verify()++ # Annotating so subclasses can reuse it for their own validation+ f.image = image+ # Pillow doesn't detect the MIME type of all formats. In those+ # cases, content_type will be None.+ f.content_type = Image.MIME.get(image.format)+ except Exception as exc:+ # Pillow doesn't recognize it as an image.+ raise ValidationError(+ self.error_messages['invalid_image'],+ code='invalid_image',+ ) from exc+ if hasattr(f, 'seek') and callable(f.seek):+ f.seek(0)+ return f++ def widget_attrs(self, widget):+ attrs = super().widget_attrs(widget)+ if isinstance(widget, FileInput) and 'accept' not in widget.attrs:+ attrs.setdefault('accept', 'image/*')+ return attrs+++class URLField(CharField):+ widget = URLInput+ default_error_messages = {+ 'invalid': _('Enter a valid URL.'),+ }+ default_validators = [validators.URLValidator()]++ def __init__(self, **kwargs):+ super().__init__(strip=True, **kwargs)++ def to_python(self, value):++ def split_url(url):+ """+ Return a list of url parts via urlparse.urlsplit(), or raise+ ValidationError for some malformed URLs.+ """+ try:+ return list(urlsplit(url))+ except ValueError:+ # urlparse.urlsplit can raise a ValueError with some+ # misformatted URLs.+ raise ValidationError(self.error_messages['invalid'], code='invalid')++ value = super().to_python(value)+ if value:+ url_fields = split_url(value)+ if not url_fields[0]:+ # If no URL scheme given, assume http://+ url_fields[0] = 'http'+ if not url_fields[1]:+ # Assume that if no domain is provided, that the path segment+ # contains the domain.+ url_fields[1] = url_fields[2]+ url_fields[2] = ''+ # Rebuild the url_fields list, since the domain segment may now+ # contain the path too.+ url_fields = split_url(urlunsplit(url_fields))+ value = urlunsplit(url_fields)+ return value+++class BooleanField(Field):+ widget = CheckboxInput++ def to_python(self, value):+ """Return a Python boolean object."""+ # Explicitly check for the string 'False', which is what a hidden field+ # will submit for False. Also check for '0', since this is what+ # RadioSelect will provide. Because bool("True") == bool('1') == True,+ # we don't need to handle that explicitly.+ if isinstance(value, str) and value.lower() in ('false', '0'):+ value = False+ else:+ value = bool(value)+ return super().to_python(value)++ def validate(self, value):+ if not value and self.required:+ raise ValidationError(self.error_messages['required'], code='required')++ def has_changed(self, initial, data):+ if self.disabled:+ return False+ # Sometimes data or initial may be a string equivalent of a boolean+ # so we should run it through to_python first to get a boolean value+ return self.to_python(initial) != self.to_python(data)+++class NullBooleanField(BooleanField):+ """+ A field whose valid values are None, True, and False. Clean invalid values+ to None.+ """+ widget = NullBooleanSelect++ def to_python(self, value):+ """+ Explicitly check for the string 'True' and 'False', which is what a+ hidden field will submit for True and False, for 'true' and 'false',+ which are likely to be returned by JavaScript serializations of forms,+ and for '1' and '0', which is what a RadioField will submit. Unlike+ the Booleanfield, this field must check for True because it doesn't+ use the bool() function.+ """+ if value in (True, 'True', 'true', '1'):+ return True+ elif value in (False, 'False', 'false', '0'):+ return False+ else:+ return None++ def validate(self, value):+ pass+++class CallableChoiceIterator:+ def __init__(self, choices_func):+ self.choices_func = choices_func++ def __iter__(self):+ yield from self.choices_func()+++class ChoiceField(Field):+ widget = Select+ default_error_messages = {+ 'invalid_choice': _('Select a valid choice. %(value)s is not one of the available choices.'),+ }++ def __init__(self, *, choices=(), **kwargs):+ super().__init__(**kwargs)+ self.choices = choices++ def __deepcopy__(self, memo):+ result = super().__deepcopy__(memo)+ result._choices = copy.deepcopy(self._choices, memo)+ return result++ def _get_choices(self):+ return self._choices++ def _set_choices(self, value):+ # Setting choices also sets the choices on the widget.+ # choices can be any iterable, but we call list() on it because+ # it will be consumed more than once.+ if callable(value):+ value = CallableChoiceIterator(value)+ else:+ value = list(value)++ self._choices = self.widget.choices = value++ choices = property(_get_choices, _set_choices)++ def to_python(self, value):+ """Return a string."""+ if value in self.empty_values:+ return ''+ return str(value)++ def validate(self, value):+ """Validate that the input is in self.choices."""+ super().validate(value)+ if value and not self.valid_value(value):+ raise ValidationError(+ self.error_messages['invalid_choice'],+ code='invalid_choice',+ params={'value': value},+ )++ def valid_value(self, value):+ """Check to see if the provided value is a valid choice."""+ text_value = str(value)+ for k, v in self.choices:+ if isinstance(v, (list, tuple)):+ # This is an optgroup, so look inside the group for options+ for k2, v2 in v:+ if value == k2 or text_value == str(k2):+ return True+ else:+ if value == k or text_value == str(k):+ return True+ return False+++class TypedChoiceField(ChoiceField):+ def __init__(self, *, coerce=lambda val: val, empty_value='', **kwargs):+ self.coerce = coerce+ self.empty_value = empty_value+ super().__init__(**kwargs)++ def _coerce(self, value):+ """+ Validate that the value can be coerced to the right type (if not empty).+ """+ if value == self.empty_value or value in self.empty_values:+ return self.empty_value+ try:+ value = self.coerce(value)+ except (ValueError, TypeError, ValidationError):+ raise ValidationError(+ self.error_messages['invalid_choice'],+ code='invalid_choice',+ params={'value': value},+ )+ return value++ def clean(self, value):+ value = super().clean(value)+ return self._coerce(value)+++class MultipleChoiceField(ChoiceField):+ hidden_widget = MultipleHiddenInput+ widget = SelectMultiple+ default_error_messages = {+ 'invalid_choice': _('Select a valid choice. %(value)s is not one of the available choices.'),+ 'invalid_list': _('Enter a list of values.'),+ }++ def to_python(self, value):+ if not value:+ return []+ elif not isinstance(value, (list, tuple)):+ raise ValidationError(self.error_messages['invalid_list'], code='invalid_list')+ return [str(val) for val in value]++ def validate(self, value):+ """Validate that the input is a list or tuple."""+ if self.required and not value:+ raise ValidationError(self.error_messages['required'], code='required')+ # Validate that each value in the value list is in self.choices.+ for val in value:+ if not self.valid_value(val):+ raise ValidationError(+ self.error_messages['invalid_choice'],+ code='invalid_choice',+ params={'value': val},+ )++ def has_changed(self, initial, data):+ if self.disabled:+ return False+ if initial is None:+ initial = []+ if data is None:+ data = []+ if len(initial) != len(data):+ return True+ initial_set = {str(value) for value in initial}+ data_set = {str(value) for value in data}+ return data_set != initial_set+++class TypedMultipleChoiceField(MultipleChoiceField):+ def __init__(self, *, coerce=lambda val: val, **kwargs):+ self.coerce = coerce+ self.empty_value = kwargs.pop('empty_value', [])+ super().__init__(**kwargs)++ def _coerce(self, value):+ """+ Validate that the values are in self.choices and can be coerced to the+ right type.+ """+ if value == self.empty_value or value in self.empty_values:+ return self.empty_value+ new_value = []+ for choice in value:+ try:+ new_value.append(self.coerce(choice))+ except (ValueError, TypeError, ValidationError):+ raise ValidationError(+ self.error_messages['invalid_choice'],+ code='invalid_choice',+ params={'value': choice},+ )+ return new_value++ def clean(self, value):+ value = super().clean(value)+ return self._coerce(value)++ def validate(self, value):+ if value != self.empty_value:+ super().validate(value)+ elif self.required:+ raise ValidationError(self.error_messages['required'], code='required')+++class ComboField(Field):+ """+ A Field whose clean() method calls multiple Field clean() methods.+ """+ def __init__(self, fields, **kwargs):+ super().__init__(**kwargs)+ # Set 'required' to False on the individual fields, because the+ # required validation will be handled by ComboField, not by those+ # individual fields.+ for f in fields:+ f.required = False+ self.fields = fields++ def clean(self, value):+ """+ Validate the given value against all of self.fields, which is a+ list of Field instances.+ """+ super().clean(value)+ for field in self.fields:+ value = field.clean(value)+ return value+++class MultiValueField(Field):+ """+ Aggregate the logic of multiple Fields.++ Its clean() method takes a "decompressed" list of values, which are then+ cleaned into a single value according to self.fields. Each value in+ this list is cleaned by the corresponding field -- the first value is+ cleaned by the first field, the second value is cleaned by the second+ field, etc. Once all fields are cleaned, the list of clean values is+ "compressed" into a single value.++ Subclasses should not have to implement clean(). Instead, they must+ implement compress(), which takes a list of valid values and returns a+ "compressed" version of those values -- a single value.++ You'll probably want to use this with MultiWidget.+ """+ default_error_messages = {+ 'invalid': _('Enter a list of values.'),+ 'incomplete': _('Enter a complete value.'),+ }++ def __init__(self, fields, *, require_all_fields=True, **kwargs):+ self.require_all_fields = require_all_fields+ super().__init__(**kwargs)+ for f in fields:+ f.error_messages.setdefault('incomplete',+ self.error_messages['incomplete'])+ if self.disabled:+ f.disabled = True+ if self.require_all_fields:+ # Set 'required' to False on the individual fields, because the+ # required validation will be handled by MultiValueField, not+ # by those individual fields.+ f.required = False+ self.fields = fields++ def __deepcopy__(self, memo):+ result = super().__deepcopy__(memo)+ result.fields = tuple(x.__deepcopy__(memo) for x in self.fields)+ return result++ def validate(self, value):+ pass++ def clean(self, value):+ """+ Validate every value in the given list. A value is validated against+ the corresponding Field in self.fields.++ For example, if this MultiValueField was instantiated with+ fields=(DateField(), TimeField()), clean() would call+ DateField.clean(value[0]) and TimeField.clean(value[1]).+ """+ clean_data = []+ errors = []+ if self.disabled and not isinstance(value, list):+ value = self.widget.decompress(value)+ if not value or isinstance(value, (list, tuple)):+ if not value or not [v for v in value if v not in self.empty_values]:+ if self.required:+ raise ValidationError(self.error_messages['required'], code='required')+ else:+ return self.compress([])+ else:+ raise ValidationError(self.error_messages['invalid'], code='invalid')+ for i, field in enumerate(self.fields):+ try:+ field_value = value[i]+ except IndexError:+ field_value = None+ if field_value in self.empty_values:+ if self.require_all_fields:+ # Raise a 'required' error if the MultiValueField is+ # required and any field is empty.+ if self.required:+ raise ValidationError(self.error_messages['required'], code='required')+ elif field.required:+ # Otherwise, add an 'incomplete' error to the list of+ # collected errors and skip field cleaning, if a required+ # field is empty.+ if field.error_messages['incomplete'] not in errors:+ errors.append(field.error_messages['incomplete'])+ continue+ try:+ clean_data.append(field.clean(field_value))+ except ValidationError as e:+ # Collect all validation errors in a single list, which we'll+ # raise at the end of clean(), rather than raising a single+ # exception for the first error we encounter. Skip duplicates.+ errors.extend(m for m in e.error_list if m not in errors)+ if errors:+ raise ValidationError(errors)++ out = self.compress(clean_data)+ self.validate(out)+ self.run_validators(out)+ return out++ def compress(self, data_list):+ """+ Return a single value for the given list of values. The values can be+ assumed to be valid.++ For example, if this MultiValueField was instantiated with+ fields=(DateField(), TimeField()), this might return a datetime+ object created by combining the date and time in data_list.+ """+ raise NotImplementedError('Subclasses must implement this method.')++ def has_changed(self, initial, data):+ if self.disabled:+ return False+ if initial is None:+ initial = ['' for x in range(0, len(data))]+ else:+ if not isinstance(initial, list):+ initial = self.widget.decompress(initial)+ for field, initial, data in zip(self.fields, initial, data):+ try:+ initial = field.to_python(initial)+ except ValidationError:+ return True+ if field.has_changed(initial, data):+ return True+ return False+++class FilePathField(ChoiceField):+ def __init__(self, path, *, match=None, recursive=False, allow_files=True,+ allow_folders=False, **kwargs):+ self.path, self.match, self.recursive = path, match, recursive+ self.allow_files, self.allow_folders = allow_files, allow_folders+ super().__init__(choices=(), **kwargs)++ if self.required:+ self.choices = []+ else:+ self.choices = [("", "---------")]++ if self.match is not None:+ self.match_re = re.compile(self.match)++ if recursive:+ for root, dirs, files in sorted(os.walk(self.path)):+ if self.allow_files:+ for f in sorted(files):+ if self.match is None or self.match_re.search(f):+ f = os.path.join(root, f)+ self.choices.append((f, f.replace(path, "", 1)))+ if self.allow_folders:+ for f in sorted(dirs):+ if f == '__pycache__':+ continue+ if self.match is None or self.match_re.search(f):+ f = os.path.join(root, f)+ self.choices.append((f, f.replace(path, "", 1)))+ else:+ choices = []+ for f in os.scandir(self.path):+ if f.name == '__pycache__':+ continue+ if (((self.allow_files and f.is_file()) or+ (self.allow_folders and f.is_dir())) and+ (self.match is None or self.match_re.search(f.name))):+ choices.append((f.path, f.name))+ choices.sort(key=operator.itemgetter(1))+ self.choices.extend(choices)++ self.widget.choices = self.choices+++class SplitDateTimeField(MultiValueField):+ widget = SplitDateTimeWidget+ hidden_widget = SplitHiddenDateTimeWidget+ default_error_messages = {+ 'invalid_date': _('Enter a valid date.'),+ 'invalid_time': _('Enter a valid time.'),+ }++ def __init__(self, *, input_date_formats=None, input_time_formats=None, **kwargs):+ errors = self.default_error_messages.copy()+ if 'error_messages' in kwargs:+ errors.update(kwargs['error_messages'])+ localize = kwargs.get('localize', False)+ fields = (+ DateField(input_formats=input_date_formats,+ error_messages={'invalid': errors['invalid_date']},+ localize=localize),+ TimeField(input_formats=input_time_formats,+ error_messages={'invalid': errors['invalid_time']},+ localize=localize),+ )+ super().__init__(fields, **kwargs)++ def compress(self, data_list):+ if data_list:+ # Raise a validation error if time or date is empty+ # (possible if SplitDateTimeField has required=False).+ if data_list[0] in self.empty_values:+ raise ValidationError(self.error_messages['invalid_date'], code='invalid_date')+ if data_list[1] in self.empty_values:+ raise ValidationError(self.error_messages['invalid_time'], code='invalid_time')+ result = datetime.datetime.combine(*data_list)+ return from_current_timezone(result)+ return None+++class GenericIPAddressField(CharField):+ def __init__(self, *, protocol='both', unpack_ipv4=False, **kwargs):+ self.unpack_ipv4 = unpack_ipv4+ self.default_validators = validators.ip_address_validators(protocol, unpack_ipv4)[0]+ super().__init__(**kwargs)++ def to_python(self, value):+ if value in self.empty_values:+ return ''+ value = value.strip()+ if value and ':' in value:+ return clean_ipv6_address(value, self.unpack_ipv4)+ return value+++class SlugField(CharField):+ default_validators = [validators.validate_slug]++ def __init__(self, *, allow_unicode=False, **kwargs):+ self.allow_unicode = allow_unicode+ if self.allow_unicode:+ self.default_validators = [validators.validate_unicode_slug]+ super().__init__(**kwargs)+++class UUIDField(CharField):+ default_error_messages = {+ 'invalid': _('Enter a valid UUID.'),+ }++ def prepare_value(self, value):+ if isinstance(value, uuid.UUID):+ return str(value)+ return value++ def to_python(self, value):+ value = super().to_python(value)+ if value in self.empty_values:+ return None+ if not isinstance(value, uuid.UUID):+ try:+ value = uuid.UUID(value)+ except ValueError:+ raise ValidationError(self.error_messages['invalid'], code='invalid')+ return valuediff --git a/django/forms/fields.py b/django/forms/fields.pyindex a977256525..7315d4e42d 100644--- a/django/forms/fields.py+++ b/django/forms/fields.py@@ -468,7 +468,7 @@ class DateTimeField(BaseTemporalField): class DurationField(Field): default_error_messages = {- 'invalid': _('Enter a valid duration.'),+ 'invalid': _('Enter a valid duration in the format [DD] [[HH:]MM:]ss[.uuuuuu].'), 'overflow': _('The number of days must be between {min_days} and {max_days}.') }12345678910111213141516171819202122232425262728293031323334353637{ "django__django-11049": { "patch_is_None": false, "patch_exists": true, "patch_successfully_applied": true, "resolved": false, "tests_status": { "FAIL_TO_PASS": { "success": [], "failure": [ "test_invalid_string (model_fields.test_durationfield.TestValidation)" ] }, "PASS_TO_PASS": { "success": [ "test_dumping (model_fields.test_durationfield.TestSerialization)", "test_loading (model_fields.test_durationfield.TestSerialization)", "test_formfield (model_fields.test_durationfield.TestFormField)", "test_exact (model_fields.test_durationfield.TestQuerying)", "test_gt (model_fields.test_durationfield.TestQuerying)", "test_create_empty (model_fields.test_durationfield.TestSaveLoad)", "test_fractional_seconds (model_fields.test_durationfield.TestSaveLoad)", "test_simple_roundtrip (model_fields.test_durationfield.TestSaveLoad)" ], "failure": [] }, "FAIL_TO_FAIL": { "success": [], "failure": [] }, "PASS_TO_FAIL": { "success": [], "failure": [] } } }}123version https://git-lfs.github.com/spec/v1oid sha256:2bbfb03e085e2caea18f47a8966ee47fab905108a56e37caf6ac05ca4f7277bfsize 4243123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418+ source /opt/miniconda3/bin/activate++ _CONDA_ROOT=/opt/miniconda3++ . /opt/miniconda3/etc/profile.d/conda.sh+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ '[' -z '' ']'+++ export CONDA_SHLVL=0+++ CONDA_SHLVL=0+++ '[' -n '' ']'+++++ dirname /opt/miniconda3/bin/conda++++ dirname /opt/miniconda3/bin+++ PATH=/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export PATH+++ '[' -z '' ']'+++ PS1=++ conda activate++ local cmd=activate++ case "$cmd" in++ __conda_activate activate++ '[' -n '' ']'++ local ask_conda+++ PS1=+++ __conda_exe shell.posix activate+++ /opt/miniconda3/bin/conda shell.posix activate++ ask_conda='PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''1'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ eval 'PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''1'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+++ PS1='(base) '+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export CONDA_PREFIX=/opt/miniconda3+++ CONDA_PREFIX=/opt/miniconda3+++ export CONDA_SHLVL=1+++ CONDA_SHLVL=1+++ export CONDA_DEFAULT_ENV=base+++ CONDA_DEFAULT_ENV=base+++ export 'CONDA_PROMPT_MODIFIER=(base) '+++ CONDA_PROMPT_MODIFIER='(base) '+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ __conda_hashr++ '[' -n '' ']'++ '[' -n '' ']'++ hash -r+ conda activate testbed+ local cmd=activate+ case "$cmd" in+ __conda_activate activate testbed+ '[' -n '' ']'+ local ask_conda++ PS1='(base) '++ __conda_exe shell.posix activate testbed++ /opt/miniconda3/bin/conda shell.posix activate testbed+ ask_conda='PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''2'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_1='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+ eval 'PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''2'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_1='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ PS1='(testbed) '++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed++ CONDA_PREFIX=/opt/miniconda3/envs/testbed++ export CONDA_SHLVL=2++ CONDA_SHLVL=2++ export CONDA_DEFAULT_ENV=testbed++ CONDA_DEFAULT_ENV=testbed++ export 'CONDA_PROMPT_MODIFIER=(testbed) '++ CONDA_PROMPT_MODIFIER='(testbed) '++ export CONDA_PREFIX_1=/opt/miniconda3++ CONDA_PREFIX_1=/opt/miniconda3++ export CONDA_EXE=/opt/miniconda3/bin/conda++ CONDA_EXE=/opt/miniconda3/bin/conda++ export _CE_M=++ _CE_M=++ export _CE_CONDA=++ _CE_CONDA=++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+ __conda_hashr+ '[' -n '' ']'+ '[' -n '' ']'+ hash -r+ cd /testbed+ sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen+ locale-genGenerating locales (this might take a while)... en_US.UTF-8...+ export LANG=en_US.UTF-8+ LANG=en_US.UTF-8+ export LANGUAGE=en_US:en+ LANGUAGE=en_US:en+ export LC_ALL=en_US.UTF-8+ LC_ALL=en_US.UTF-8+ git config --global --add safe.directory /testbed doneGeneration complete.+ cd /testbed+ git statusOn branch mainChanges not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: django/forms/fields.py
Untracked files: (use "git add <file>..." to include in what will be committed) django/forms/.backup.fields.py
no changes added to commit (use "git add" and/or "git commit -a")+ git showcommit 17455e924e243e7a55e8a38f45966d8cbb27c273Author: Jon Dufresne <jon.dufresne@gmail.com>Date: Mon Mar 4 07:35:08 2019 -0800
Removed executable bit from static asset xregexp.js.
diff --git a/django/contrib/admin/static/admin/js/vendor/xregexp/xregexp.js b/django/contrib/admin/static/admin/js/vendor/xregexp/xregexp.jsold mode 100755new mode 100644+ git diff 17455e924e243e7a55e8a38f45966d8cbb27c273diff --git a/django/forms/fields.py b/django/forms/fields.pyindex a977256525..7315d4e42d 100644--- a/django/forms/fields.py+++ b/django/forms/fields.py@@ -468,7 +468,7 @@ class DateTimeField(BaseTemporalField): class DurationField(Field): default_error_messages = {- 'invalid': _('Enter a valid duration.'),+ 'invalid': _('Enter a valid duration in the format [DD] [[HH:]MM:]ss[.uuuuuu].'), 'overflow': _('The number of days must be between {min_days} and {max_days}.') } + source /opt/miniconda3/bin/activate++ _CONDA_ROOT=/opt/miniconda3++ . /opt/miniconda3/etc/profile.d/conda.sh+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ '[' -z x ']'++ conda activate++ local cmd=activate++ case "$cmd" in++ __conda_activate activate++ '[' -n '' ']'++ local ask_conda+++ PS1='(testbed) '+++ __conda_exe shell.posix activate+++ /opt/miniconda3/bin/conda shell.posix activate++ ask_conda='PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''3'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ eval 'PS1='\''(base) '\''export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3'\''export CONDA_SHLVL='\''3'\''export CONDA_DEFAULT_ENV='\''base'\''export CONDA_PROMPT_MODIFIER='\''(base) '\''export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+++ PS1='(base) '+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+++ export CONDA_PREFIX=/opt/miniconda3+++ CONDA_PREFIX=/opt/miniconda3+++ export CONDA_SHLVL=3+++ CONDA_SHLVL=3+++ export CONDA_DEFAULT_ENV=base+++ CONDA_DEFAULT_ENV=base+++ export 'CONDA_PROMPT_MODIFIER=(base) '+++ CONDA_PROMPT_MODIFIER='(base) '+++ export CONDA_PREFIX_2=/opt/miniconda3/envs/testbed+++ CONDA_PREFIX_2=/opt/miniconda3/envs/testbed+++ export CONDA_EXE=/opt/miniconda3/bin/conda+++ CONDA_EXE=/opt/miniconda3/bin/conda+++ export _CE_M=+++ _CE_M=+++ export _CE_CONDA=+++ _CE_CONDA=+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ __conda_hashr++ '[' -n '' ']'++ '[' -n '' ']'++ hash -r+ conda activate testbed+ local cmd=activate+ case "$cmd" in+ __conda_activate activate testbed+ '[' -n '' ']'+ local ask_conda++ PS1='(base) '++ __conda_exe shell.posix activate testbed++ /opt/miniconda3/bin/conda shell.posix activate testbed+ ask_conda='PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''4'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_3='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''+ eval 'PS1='\''(testbed) '\''export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''export CONDA_SHLVL='\''4'\''export CONDA_DEFAULT_ENV='\''testbed'\''export CONDA_PROMPT_MODIFIER='\''(testbed) '\''export CONDA_PREFIX_3='\''/opt/miniconda3'\''export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''export _CE_M='\'''\''export _CE_CONDA='\'''\''export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''++ PS1='(testbed) '++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed++ CONDA_PREFIX=/opt/miniconda3/envs/testbed++ export CONDA_SHLVL=4++ CONDA_SHLVL=4++ export CONDA_DEFAULT_ENV=testbed++ CONDA_DEFAULT_ENV=testbed++ export 'CONDA_PROMPT_MODIFIER=(testbed) '++ CONDA_PROMPT_MODIFIER='(testbed) '++ export CONDA_PREFIX_3=/opt/miniconda3++ CONDA_PREFIX_3=/opt/miniconda3++ export CONDA_EXE=/opt/miniconda3/bin/conda++ CONDA_EXE=/opt/miniconda3/bin/conda++ export _CE_M=++ _CE_M=++ export _CE_CONDA=++ _CE_CONDA=++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python+ __conda_hashr+ '[' -n '' ']'+ '[' -n '' ']'+ hash -r+ python -m pip install -e .Obtaining file:///testbedRequirement already satisfied: pytz in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from Django==3.0.dev20190304153508) (2024.1)Requirement already satisfied: sqlparse in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from Django==3.0.dev20190304153508) (0.4.4)Installing collected packages: Django Attempting uninstall: Django Found existing installation: Django 3.0.dev20190304153508 Uninstalling Django-3.0.dev20190304153508: Successfully uninstalled Django-3.0.dev20190304153508 Running setup.py develop for DjangoSuccessfully installed Django-3.0.dev20190304153508WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv+ git checkout 17455e924e243e7a55e8a38f45966d8cbb27c273 tests/model_fields/test_durationfield.pyUpdated 0 paths from 0e0ab1ad1e+ git apply -v -Checking patch tests/model_fields/test_durationfield.py...Applied patch tests/model_fields/test_durationfield.py cleanly.+ ./tests/runtests.py --verbosity 2 --settings=test_sqlite --parallel 1 model_fields.test_durationfieldCreating test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...test_exact (model_fields.test_durationfield.TestQuerying) ... oktest_gt (model_fields.test_durationfield.TestQuerying) ... oktest_create_empty (model_fields.test_durationfield.TestSaveLoad) ... oktest_fractional_seconds (model_fields.test_durationfield.TestSaveLoad) ... oktest_simple_roundtrip (model_fields.test_durationfield.TestSaveLoad) ... oktest_formfield (model_fields.test_durationfield.TestFormField) ... oktest_dumping (model_fields.test_durationfield.TestSerialization) ... oktest_loading (model_fields.test_durationfield.TestSerialization) ... oktest_invalid_string (model_fields.test_durationfield.TestValidation) ... Testing against Django installed in '/testbed/django'Importing application model_fieldsSkipping setup of unused database(s): other.Operations to perform: Synchronize unmigrated apps: auth, contenttypes, messages, model_fields, sessions, staticfiles Apply all migrations: admin, sitesSynchronizing apps without migrations: Creating tables... Creating table django_content_type Creating table auth_permission Creating table auth_group Creating table auth_user Creating table django_session Creating table model_fields_foo Creating table model_fields_bar Creating table model_fields_whiz Creating table model_fields_whizdelayed Creating table model_fields_whiziter Creating table model_fields_whiziterempty Creating table model_fields_choiceful Creating table model_fields_bigd Creating table model_fields_floatmodel Creating table model_fields_bigs Creating table model_fields_unicodeslugfield Creating table model_fields_smallintegermodel Creating table model_fields_integermodel Creating table model_fields_bigintegermodel Creating table model_fields_positivesmallintegermodel Creating table model_fields_positiveintegermodel Creating table model_fields_post Creating table model_fields_nullbooleanmodel Creating table model_fields_booleanmodel Creating table model_fields_datetimemodel Creating table model_fields_durationmodel Creating table model_fields_nulldurationmodel Creating table model_fields_primarykeycharmodel Creating table model_fields_fkstobooleans Creating table model_fields_fktochar Creating table model_fields_renamedfield Creating table model_fields_verbosenamefield Creating table model_fields_genericipaddress Creating table model_fields_decimallessthanone Creating table model_fields_fieldclassattributemodel Creating table model_fields_datamodel Creating table model_fields_document Creating table model_fields_person Creating table model_fields_personwithheight Creating table model_fields_personwithheightandwidth Creating table model_fields_persondimensionsfirst Creating table model_fields_persontwoimages Creating table model_fields_allfieldsmodel Creating table model_fields_manytomany Creating table model_fields_uuidmodel Creating table model_fields_nullableuuidmodel Creating table model_fields_primarykeyuuidmodel Creating table model_fields_relatedtouuidmodel Creating table model_fields_uuidchild Creating table model_fields_uuidgrandchild Running deferred SQL...Running migrations: Applying admin.0001_initial... OK Applying admin.0002_logentry_remove_auto_add... OK Applying admin.0003_logentry_add_action_flag_choices... OK Applying sites.0001_initial... OK Applying sites.0002_alter_domain_unique... OKSystem check identified no issues (0 silenced).FAIL
======================================================================FAIL: test_invalid_string (model_fields.test_durationfield.TestValidation)----------------------------------------------------------------------Traceback (most recent call last): File "/testbed/tests/model_fields/test_durationfield.py", line 77, in test_invalid_string "'not a datetime' value has an invalid format. "AssertionError: "'not[28 chars]valid format. It must be in [DD] [HH:[MM:]]ss[.uuuuuu] format." != "'not[28 chars]valid format. It must be in [DD] [[HH:]MM:]ss[.uuuuuu] format."- 'not a datetime' value has an invalid format. It must be in [DD] [HH:[MM:]]ss[.uuuuuu] format.? ^ -+ 'not a datetime' value has an invalid format. It must be in [DD] [[HH:]MM:]ss[.uuuuuu] format.? + ^
----------------------------------------------------------------------Ran 9 tests in 0.008s
FAILED (failures=1)Destroying test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...+ git checkout 17455e924e243e7a55e8a38f45966d8cbb27c273 tests/model_fields/test_durationfield.pyUpdated 1 path from 0e0ab1ad1e1234567891011121314151617181920212223242526272829303132333435363738394041424344#!/bin/bashset -uxo pipefailsource /opt/miniconda3/bin/activateconda activate testbedcd /testbedsed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-genexport LANG=en_US.UTF-8export LANGUAGE=en_US:enexport LC_ALL=en_US.UTF-8git config --global --add safe.directory /testbedcd /testbedgit statusgit showgit diff d26b2424437dabeeca94d7900b37d2df4410da0csource /opt/miniconda3/bin/activateconda activate testbedpython -m pip install -e .git checkout d26b2424437dabeeca94d7900b37d2df4410da0c tests/auth_tests/test_validators.pygit apply -v - <<'EOF_114329324912'diff --git a/tests/auth_tests/test_validators.py b/tests/auth_tests/test_validators.py--- a/tests/auth_tests/test_validators.py+++ b/tests/auth_tests/test_validators.py@@ -237,7 +237,7 @@ def test_unicode_validator(self): invalid_usernames = [ "o'connell", "عبد ال", "zerowidth\u200Bspace", "nonbreaking\u00A0space",- "en\u2013dash",+ "en\u2013dash", 'trailingnewline\u000A', ] v = validators.UnicodeUsernameValidator() for valid in valid_usernames:@@ -250,7 +250,7 @@ def test_unicode_validator(self): def test_ascii_validator(self): valid_usernames = ['glenn', 'GLEnN', 'jean-marc']- invalid_usernames = ["o'connell", 'Éric', 'jean marc', "أحمد"]+ invalid_usernames = ["o'connell", 'Éric', 'jean marc', "أحمد", 'trailingnewline\n'] v = validators.ASCIIUsernameValidator() for valid in valid_usernames: with self.subTest(valid=valid):
EOF_114329324912./tests/runtests.py --verbosity 2 --settings=test_sqlite --parallel 1 auth_tests.test_validatorsgit checkout d26b2424437dabeeca94d7900b37d2df4410da0c tests/auth_tests/test_validators.py1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253diff --git a/django/contrib/auth/.backup.validators.py b/django/contrib/auth/.backup.validators.pynew file mode 100644index 0000000000..118da28408--- /dev/null+++ b/django/contrib/auth/.backup.validators.py@@ -0,0 +1,25 @@+import re++from django.core import validators+from django.utils.deconstruct import deconstructible+from django.utils.translation import gettext_lazy as _+++@deconstructible+class ASCIIUsernameValidator(validators.RegexValidator):+ regex = r'\A[\w.@+-]+\Z'+ message = _(+ 'Enter a valid username. This value may contain only English letters, '+ 'numbers, and @/./+/-/_ characters.'+ )+ flags = re.ASCII+++@deconstructible+class UnicodeUsernameValidator(validators.RegexValidator):+ regex = r'^[\w.@+-]+$'+ message = _(+ 'Enter a valid username. This value may contain only letters, '+ 'numbers, and @/./+/-/_ characters.'+ )+ flags = 0diff --git a/django/contrib/auth/validators.py b/django/contrib/auth/validators.pyindex b4878cfd45..1304f20a60 100644--- a/django/contrib/auth/validators.py+++ b/django/contrib/auth/validators.py@@ -7,7 +7,7 @@ from django.utils.translation import gettext_lazy as _ @deconstructible class ASCIIUsernameValidator(validators.RegexValidator):- regex = r'^[\w.@+-]+$'+ regex = r'\A[\w.@+-]+\Z' message = _( 'Enter a valid username. This value may contain only English letters, ' 'numbers, and @/./+/-/_ characters.'@@ -17,7 +17,7 @@ class ASCIIUsernameValidator(validators.RegexValidator): @deconstructible class UnicodeUsernameValidator(validators.RegexValidator):- regex = r'^[\w.@+-]+$'+ regex = r'\A[\w.@+-]+\Z' message = _( 'Enter a valid username. This value may contain only letters, ' 'numbers, and @/./+/-/_ characters.'1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950{ "django__django-11099": { "patch_is_None": false, "patch_exists": true, "patch_successfully_applied": true, "resolved": true, "tests_status": { "FAIL_TO_PASS": { "success": [ "test_ascii_validator (auth_tests.test_validators.UsernameValidatorsTests)", "test_unicode_validator (auth_tests.test_validators.UsernameValidatorsTests)", "test_help_text (auth_tests.test_validators.UserAttributeSimilarityValidatorTest)" ], "failure": [] }, "PASS_TO_PASS": { "success": [ "test_help_text (auth_tests.test_validators.MinimumLengthValidatorTest)", "test_validate (auth_tests.test_validators.MinimumLengthValidatorTest)", "test_help_text (auth_tests.test_validators.NumericPasswordValidatorTest)", "test_validate (auth_tests.test_validators.NumericPasswordValidatorTest)", "test_validate (auth_tests.test_validators.UserAttributeSimilarityValidatorTest)", "test_validate_property (auth_tests.test_validators.UserAttributeSimilarityValidatorTest)", "test_empty_password_validator_help_text_html (auth_tests.test_validators.PasswordValidationTest)", "test_get_default_password_validators (auth_tests.test_validators.PasswordValidationTest)", "test_get_password_validators_custom (auth_tests.test_validators.PasswordValidationTest)", "test_password_changed (auth_tests.test_validators.PasswordValidationTest)", "test_password_changed_with_custom_validator (auth_tests.test_validators.PasswordValidationTest)", "test_password_validators_help_text_html (auth_tests.test_validators.PasswordValidationTest)", "test_password_validators_help_text_html_escaping (auth_tests.test_validators.PasswordValidationTest)", "test_password_validators_help_texts (auth_tests.test_validators.PasswordValidationTest)", "test_validate_password (auth_tests.test_validators.PasswordValidationTest)", "test_help_text (auth_tests.test_validators.CommonPasswordValidatorTest)", "test_validate (auth_tests.test_validators.CommonPasswordValidatorTest)", "test_validate_custom_list (auth_tests.test_validators.CommonPasswordValidatorTest)", "test_validate_django_supplied_file (auth_tests.test_validators.CommonPasswordValidatorTest)" ], "failure": [] }, "FAIL_TO_FAIL": { "success": [], "failure": [] }, "PASS_TO_FAIL": { "success": [], "failure": [] } } }}123version https://git-lfs.github.com/spec/v1oid sha256:e94b535faf4b753b81733ef2c75fcfc3461386fa0f92174f9c31ac6997865db4size 6300outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/README.mdAdded+322
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14182/eval.shAdded+62
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14182/patch.diffAdded+131
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14182/report.jsonAdded+38
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14182/run_instance.logAdded+3
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14182/test_output.txtAdded
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14365/eval.shAdded+51
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14365/patch.diffAdded+661
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14365/report.jsonAdded+38
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14365/run_instance.logAdded+3
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-14365/test_output.txtAdded
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-6938/eval.shAdded+57
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-6938/patch.diffAdded+1350
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-6938/report.jsonAdded+41
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-6938/run_instance.logAdded+3
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-6938/test_output.txtAdded+647
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-7746/eval.shAdded+44
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-7746/patch.diffAdded
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-7746/report.jsonAdded+86
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-7746/run_instance.logAdded+3
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/astropy__astropy-7746/test_output.txtAdded+581
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10914/eval.shAdded+35
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10914/patch.diffAdded+653
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10914/report.jsonAdded+127
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10914/run_instance.logAdded+3
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10914/test_output.txtAdded+590
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10924/eval.shAdded+50
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10924/patch.diffAdded+2409
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10924/report.jsonAdded+30
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10924/run_instance.logAdded+3
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-10924/test_output.txtAdded+639
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11001/eval.shAdded+56
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11001/patch.diffAdded+1543
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11001/report.jsonAdded+148
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11001/run_instance.logAdded+3
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11001/test_output.txtAdded+567
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11039/eval.shAdded+100
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11039/patch.diffAdded+597
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11039/report.jsonAdded+117
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11039/run_instance.logAdded+3
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11039/test_output.txtAdded+652
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11049/eval.shAdded+35
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11049/patch.diffAdded+1220
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11049/report.jsonAdded+37
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11049/run_instance.logAdded+3
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11049/test_output.txtAdded+418
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11099/eval.shAdded+44
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11099/patch.diffAdded+53
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11099/report.jsonAdded+50
outputs/swe_bench_lite/CodeActAgent/llama-3.1-405b-instruct_maxiter_30_N_v1.9-no-hint-eval-24-sep/eval_outputs/django__django-11099/run_instance.logAdded+3