repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
saleor
saleor/app/tests/test_app_tasks.py
.py
import logging from unittest.mock import ANY, Mock import pytest from django.utils import timezone from requests import RequestException from requests_hardened import HTTPSession from ...core import JobStatus, private_storage from ...core.models import EventDelivery, EventDeliveryAttempt, EventPayload from ...webhook...
182
5,730
saleor
saleor/app/tests/test_app_commands.py
.py
from unittest.mock import ANY, Mock, call, patch import graphene import pytest from django.core.management import CommandError, call_command from django.forms import ValidationError from django.utils import timezone from requests_hardened import HTTPSession from ... import schema_version from ...core import JobStatus...
429
12,853
saleor
saleor/app/tests/test_utils.py
.py
from ...app.utils import get_active_tax_apps from ...core.tests.test_taxes import app_factory, tax_app_factory # noqa: F401 from ...webhook.event_types import WebhookEventSyncType def test_get_active_tax_apps(app_factory, tax_app_factory): # noqa: F811 # given app = app_factory( name="app1", ...
55
1,316
saleor
saleor/app/tests/tasks/test_saleor3_23.py
.py
from saleor.app.migrations.tasks.saleor3_23 import ( fill_app_extension_settings_task, ) from saleor.app.models import App, AppExtension def test_skip_settings_if_filled(): # given app = App.objects.create(name="Test App", is_active=True) extension = AppExtension.objects.create( app=app, ...
80
2,051
saleor
saleor/app/tests/fixtures/app.py
.py
import pytest from django.utils import timezone from ....app.models import App from ....app.types import AppType from ....webhook.event_types import WebhookEventSyncType from ....webhook.models import Webhook, WebhookEvent @pytest.fixture def app(db): app = App.objects.create( name="Sample app objects", ...
213
5,825
saleor
saleor/app/tests/fixtures/app_extension.py
.py
import pytest from ....app.models import AppExtension @pytest.fixture def app_with_extensions(app_with_token, permission_manage_products): first_app_extension = AppExtension( app=app_with_token, label="Create product with App", url="www.example.com/app-product", mount="product_ove...
50
1,543
saleor
saleor/app/tests/fixtures/app_problem.py
.py
from datetime import datetime import pytest from django.utils import timezone from ....account.models import User from ...models import App, AppProblem @pytest.fixture def app_problem_generator(): def create_problem( app: App, key: str = "test-key", message: str = "Test problem", ...
47
1,400
saleor
saleor/app/tests/fixtures/app_installation.py
.py
import pytest from ....app.models import AppInstallation @pytest.fixture def app_installation(): app_installation = AppInstallation.objects.create( app_name="External App", manifest_url="http://localhost:3000/manifest", ) return app_installation
13
277
saleor
saleor/app/tests/fixtures/webhooks/payment_app.py
.py
import pytest from .....app.models import App from .....webhook.event_types import WebhookEventSyncType from .....webhook.models import Webhook, WebhookEvent from .....webhook.tests.subscription_webhooks import subscription_queries @pytest.fixture def payment_app(db, permission_manage_payments): app = App.object...
303
9,899
saleor
saleor/app/tests/fixtures/webhooks/tax_app.py
.py
import pytest from .....app.models import App from .....app.types import AppType from .....graphql.core.utils import to_global_id_or_none from .....webhook.event_types import WebhookEventSyncType from .....webhook.models import Webhook, WebhookEvent CALCULATE_TAXES_SUBSCRIPTION_QUERY = """ subscription CalculateTaxes...
189
3,968
saleor
saleor/app/tests/fixtures/webhooks/shipping_app.py
.py
import pytest from .....app.models import App from .....webhook.event_types import WebhookEventAsyncType, WebhookEventSyncType from .....webhook.models import Webhook, WebhookEvent @pytest.fixture def shipping_app(db, permission_manage_shipping): app = App.objects.create(name="Shipping App", is_active=True) ...
110
3,199
astropy
setup.py
.py
#!/usr/bin/env python # Licensed under a 3-clause BSD style license - see LICENSE.rst # NOTE: The configuration for the package, including the name, version, and # other information are set in the pyproject.toml file. import sys from pathlib import Path from setuptools import setup from setuptools.command.editable_w...
59
1,597
astropy
conftest.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file is the main file used when running tests with pytest directly, # in particular if running e.g. ``pytest docs/``. import os import hypothesis from astropy import __version__ try: from pytest_astropy_header.display import PYTEST_HEADER_M...
73
2,585
astropy
docs/conf.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # # Astropy documentation build configuration file. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this file. # # All configuration values have a default...
575
22,965
astropy
docs/conftest.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file needs to be included here to make sure commands such # as ``pytest docs/...`` works, since this # will ignore the conftest.py file at the root of the repository # and the one in astropy/conftest.py import os from pathlib import Path import p...
50
1,934
astropy
docs/wcs/examples/programmatic.py
.py
# Set the WCS information manually by setting properties of the WCS # object. import numpy as np from astropy import wcs from astropy.io import fits # Create a new WCS object. The number of axes must be set # from the start w = wcs.WCS(naxis=2) # Set up an "Airy's zenithal" projection # Vector properties may be se...
59
1,862
astropy
docs/wcs/examples/cube_wcs.py
.py
# Define the astropy.wcs.WCS object using a Python dictionary as input import astropy.wcs wcs_dict = { "CTYPE1": "WAVE ", "CUNIT1": "Angstrom", "CDELT1": 0.2, "CRPIX1": 0, "CRVAL1": 10, "NAXIS1": 5, "CTYPE2": "HPLT-TAN", "CUNIT2": "deg", "CDELT2": 0.5, "CRPIX2": 2, "CRVA...
26
504
astropy
docs/wcs/examples/from_file.py
.py
# Load the WCS information from a fits header, and use it # to convert pixel coordinates to world coordinates. import sys import numpy as np from astropy import wcs from astropy.io import fits def load_wcs_from_file(filename): # Load the FITS hdulist using astropy.io.fits hdulist = fits.open(filename) ...
59
1,875
astropy
docs/wcs/examples/planetary_wcs.py
.py
# Create a planetary WCS structure from astropy import units as u from astropy.coordinates import BaseBodycentricRepresentation, BaseCoordinateFrame from astropy.wcs.utils import celestial_frame_to_wcs class MARSCustomBodycentricRepresentation(BaseBodycentricRepresentation): _equatorial_radius = 3399190.0 * u.m ...
24
682
astropy
docs/nddata/examples/cutout2d_tofits.py
.py
# Download an example FITS file, create a 2D cutout, and save it to a # new FITS file, including the updated cutout WCS. from astropy.io import fits from astropy.nddata import Cutout2D from astropy.utils.data import download_file from astropy.wcs import WCS def download_image_save_cutout(url, position, size): # D...
37
1,092
astropy
scripts/update-credits.py
.py
# /// script # requires-python = ">=3.11" # dependencies = [] # /// import re import subprocess import sys import unicodedata MAIN_SECTION = """ Core Package Contributors ========================= """ OTHER_SECTION = """ Other Credits ============= """ # These manual additions are for people who contributed code at ...
107
2,606
astropy
scripts/update-latest-whatsnew-stats.py
.py
# /// script # requires-python = ">=3.11" # dependencies = [] # /// """Update a ``docs/whatsnew/<version>.rst`` file with the release summary. Usage: python scripts/update-latest-whatsnew-stats.py --pat=$GITHUB_PAT python scripts/update-latest-whatsnew-stats.py docs/whatsnew/8.0.rst --pat=$GITHUB_PAT With no ...
294
9,670
astropy
scripts/check-lowest-resolved-tree.py
.py
# /// script # requires-python = ">=3.11" # dependencies = [ # "uv==0.11.19", # ] # /// """ This CLI (re)generates lowest-resolved-tree.txt, which represents a complete, universal and reproducible solution to astropy's dependency constraints, using uv's --resolution=lowest resolution strategy. This solution should...
149
4,043
astropy
astropy/logger.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module defines a logging class based on the built-in logging module. .. note:: This module is meant for internal ``astropy`` usage. For use in other packages, we recommend implementing your own logger instead. """ import inspect import ...
611
20,014
astropy
astropy/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Astropy is a package intended to contain core functionality and some common tools needed for performing astronomy and astrophysics research with Python. It also provides an index for other astronomy packages and tools for managing them. """ import sys...
226
6,143
astropy
astropy/version.py
.py
from packaging.version import Version # NOTE: First try _dev.scm_version if it exists and setuptools_scm is installed # This file is not included in astropy wheels/tarballs, so otherwise it will # fall back on the generated _version module. try: try: from ._dev.scm_version import version except ImportE...
42
976
astropy
astropy/conftest.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This file contains pytest configuration settings that are astropy-specific. """ import builtins import os import sys import warnings from dataclasses import replace from pathlib import Path from threading import Lock try: from pytest_astropy_head...
224
7,355
astropy
astropy/uncertainty/distributions.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Built-in distribution-creation functions. """ from warnings import warn import numpy as np from astropy import units as u from .core import Distribution __all__ = ["normal", "poisson", "uniform"] def normal( center, *, std=None, var=None, i...
207
6,618
astropy
astropy/uncertainty/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This sub-package contains classes and functions for creating distributions that work similar to `~astropy.units.Quantity` or array objects, but can propagate uncertainties. """ from .core import * from .distributions import *
11
296
astropy
astropy/uncertainty/function_helpers.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Helpers for letting numpy functions interact with distributions. The module supplies helper routines for numpy functions that propagate distributions appropriately., for use in the ``__array_function__`` implementation of `~astropy.uncertainty.core.Dis...
160
5,447
astropy
astropy/uncertainty/core.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Distribution class and associated machinery. """ import builtins import numpy as np from numpy.lib._function_base_impl import _parse_gufunc_signature from numpy.lib._stride_tricks_impl import DummyArray from numpy.lib.array_utils import normalize_ax...
671
27,660
astropy
astropy/uncertainty/tests/test_functions.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test numpy functions and ufuncs on Distribution. The tests here are fairly detailed but do not aim for complete coverage. Complete coverage of all numpy functions will be done in test_function_helpers. TODO: start test_function_helpers once more func...
98
3,472
astropy
astropy/uncertainty/tests/test_distribution.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import operator import numpy as np import pytest from numpy.testing import assert_array_equal from astropy import units as u from astropy.coordinates import Angle from astropy.tests.helper import assert_quantity_allclose from astropy.uncertainty import d...
717
25,742
astropy
astropy/uncertainty/tests/test_containers.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test that Distribution works with classes other than ndarray and Quantity.""" import numpy as np import pytest from numpy.testing import assert_array_equal import astropy.units as u from astropy.coordinates import ( Angle, CartesianDifferentia...
232
8,959
astropy
astropy/modeling/_fitting_parallel.py
.py
import traceback import warnings from copy import deepcopy from math import ceil, log10, prod from pathlib import Path import numpy as np import astropy.units as u from astropy.modeling.utils import _combine_equivalency_dict from astropy.nddata import NDUncertainty, StdDevUncertainty, support_nddata from astropy.wcs....
779
30,533
astropy
astropy/modeling/physical_models.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Models that have physical origins. """ # pylint: disable=invalid-name, no-member import warnings import numpy as np from astropy import constants as const from astropy import units as u from astropy.utils.exceptions import AstropyUserWarning from ....
807
26,301
astropy
astropy/modeling/utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module provides utility functions for the models package. """ import warnings # pylint: disable=invalid-name from collections import UserDict from collections.abc import Sequence from inspect import signature from typing import TypeVar, overloa...
344
10,255
astropy
astropy/modeling/mappings.py
.py
""" Special models useful for complex compound models where control is needed over which outputs from a source model are mapped to which inputs of a target model. """ # pylint: disable=invalid-name from astropy.units import Quantity from .core import FittableModel, Model __all__ = ["Identity", "Mapping", "UnitsMappi...
328
10,841
astropy
astropy/modeling/parameters.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name """ This module defines classes that deal with parameters. It is unlikely users will need to work with these classes directly, unless they define their own models. """ import functools import numbers import operator impor...
797
26,728
astropy
astropy/modeling/rotations.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Implements rotations, including spherical rotations as defined in WCS Paper II [1]_. `RotateNative2Celestial` and `RotateCelestial2Native` follow the convention in WCS Paper II to rotate to/from a native sphere and the celestial sphere. The implement...
528
16,214
astropy
astropy/modeling/convolution.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Convolution Model.""" # pylint: disable=line-too-long, too-many-lines, too-many-arguments, invalid-name import numpy as np from .core import CompoundModel class Convolution(CompoundModel): """ Wrapper class for a convolution model. Par...
117
4,085
astropy
astropy/modeling/polynomial.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains models representing polynomials and polynomial series. """ # pylint: disable=invalid-name from math import comb from textwrap import indent import numpy as np from .core import FittableModel, Model from .functional_models impor...
1,956
56,834
astropy
astropy/modeling/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage provides a framework for representing models and performing model evaluation and fitting. It supports 1D and 2D models and fitting with parameter constraints. It has some predefined models and fitting routines. """ from . import fitti...
14
402
astropy
astropy/modeling/separable.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Functions to determine if a model is separable, i.e. if the model outputs are independent. It analyzes ``n_inputs``, ``n_outputs`` and the operators in a compound model by stepping through the transforms and creating a ``coord_matrix`` of shape (``n_...
325
9,876
astropy
astropy/modeling/math_functions.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Define Numpy Ufuncs as Models. """ import numpy as np from astropy.modeling.core import Model trig_ufuncs = [ "sin", "cos", "tan", "arcsin", "arccos", "arctan", "arctan2", "hypot", "sinh", "cosh", "tanh", ...
135
2,572
astropy
astropy/modeling/powerlaws.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Power law model variants. """ # pylint: disable=invalid-name import numpy as np from astropy.units import Magnitude, Quantity, UnitsError, dimensionless_unscaled, mag from .core import Fittable1DModel from .parameters import InputParameterError, Par...
662
21,235
astropy
astropy/modeling/fitting.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module implements classes (called Fitters) which combine optimization algorithms (typically from `scipy.optimize`) with statistic functions to perform fitting. Fitters are implemented as callable classes. In addition to the data to fit, the ``__c...
2,372
89,369
astropy
astropy/modeling/functional_models.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Mathematical models.""" # pylint: disable=line-too-long, too-many-lines, too-many-arguments, invalid-name import warnings import numpy as np from astropy import units as u from astropy.units import Quantity, UnitsError from astropy.utils.compat impo...
3,926
121,081
astropy
astropy/modeling/statistic.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Statistic functions used in `~astropy.modeling.fitting`. """ # pylint: disable=invalid-name import numpy as np __all__ = ["leastsquare", "leastsquare_1d", "leastsquare_2d", "leastsquare_3d"] def leastsquare(measured_vals, updated_model, weights, *...
174
5,416
astropy
astropy/modeling/bounding_box.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module is to contain an improved bounding box. """ import abc import copy import warnings from collections.abc import Callable from typing import Any, NamedTuple, Self import numpy as np from astropy.units import Quantity, UnitBase __all__ = ...
1,630
51,925
astropy
astropy/modeling/tabular.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tabular models. Tabular models of any dimension can be created using `tabular_model`. For convenience `Tabular1D` and `Tabular2D` are provided. Examples -------- >>> table = np.array([[ 3., 0., 0.], ... [ 0., 2., 0.], ... ...
414
12,603
astropy
astropy/modeling/optimizers.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name """ Optimization algorithms used in `~astropy.modeling.fitting`. """ import warnings from abc import ABC, abstractmethod import numpy as np from astropy.utils.exceptions import AstropyUserWarning __all__ = ["SLSQP", "Opt...
271
7,513
astropy
astropy/modeling/projections.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name """ Implements projections--particularly sky projections defined in WCS Paper II [1]_. All angles are set and and displayed in degrees but internally computations are performed in radians. All functions expect inputs and out...
1,677
46,604
astropy
astropy/modeling/spline.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Spline models and fitters.""" # pylint: disable=line-too-long, too-many-lines, too-many-arguments, invalid-name import abc import functools import warnings import numpy as np from astropy.utils.exceptions import AstropyUserWarning from .core import...
910
27,532
astropy
astropy/modeling/core.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module defines base classes for all models. The base class of all models is `~astropy.modeling.Model`. `~astropy.modeling.FittableModel` is the base class for all fittable models. Fittable models can be linear or nonlinear in a regression analys...
4,817
183,737
astropy
astropy/modeling/tests/test_bounding_box.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import unittest.mock as mk import numpy as np import pytest import astropy.units as u from astropy.coordinates import SpectralCoord from astropy.modeling.bounding_box import ( CompoundBoundingBox, ModelBoundingBox, _BaseInterval, _BaseSel...
2,939
114,325
astropy
astropy/modeling/tests/test_core.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import os import re import subprocess import sys import unittest.mock as mk from inspect import signature import numpy as np import pytest from numpy.testing import assert_allclose, assert_equal import astropy import astrop...
1,645
50,586
astropy
astropy/modeling/tests/test_input.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module tests fitting and model evaluation with various inputs """ import numpy as np import pytest from numpy.testing import assert_allclose from astropy.modeling import fitting, models from astropy.modeling.core import Fittable1DModel, Fittable...
1,217
38,992
astropy
astropy/modeling/tests/test_separable.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test separability of models. """ import numpy as np # pylint: disable=invalid-name import pytest from numpy.testing import assert_allclose from astropy.modeling import custom_model, models from astropy.modeling.core import ModelDefinitionError from...
194
5,510
astropy
astropy/modeling/tests/example_models.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Here are all the test parameters and values for the each `~astropy.modeling.FittableModel` defined. There is a dictionary for 1D and a dictionary for 2D models. Explanation of keywords of the dictionaries: "parameters" : list or dict Model parame...
472
13,552
astropy
astropy/modeling/tests/test_quantities_parameters.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests that relate to using quantities/units on parameters of models. """ import numpy as np import pytest from astropy import coordinates as coord from astropy import units as u from astropy.modeling.core import Fittable1DModel, InputParameterError ...
405
12,123
astropy
astropy/modeling/tests/test_compound.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name, pointless-statement import pickle import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_equal import astropy.units as u from astropy.modeling.core import CompoundModel, Model, ModelDefin...
1,316
40,190
astropy
astropy/modeling/tests/test_parameters.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests models.parameters """ # pylint: disable=invalid-name import functools import itertools import unittest.mock as mk import numpy as np import pytest from astropy import units as u from astropy.modeling import fitting, models from astropy.modelin...
1,274
41,319
astropy
astropy/modeling/tests/test_fitters.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Module to test fitting routines """ # pylint: disable=invalid-name import os.path import unittest.mock as mk from contextlib import nullcontext from importlib.metadata import EntryPoint from itertools import combinations from unittest import mock imp...
1,565
56,183
astropy
astropy/modeling/tests/test_quantities_fitting.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests that relate to fitting models with quantity parameters """ import numpy as np import pytest from astropy import units as u from astropy.modeling import fitting, models from astropy.modeling.core import Fittable1DModel, compose_models_with_units...
308
10,549
astropy
astropy/modeling/tests/test_quantities_rotations.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name, no-member import numpy as np import pytest from numpy.testing import assert_allclose from astropy import units as u from astropy.modeling import models from astropy.tests.helper import assert_quantity_allclose from astropy...
118
3,967
astropy
astropy/modeling/tests/test_model_sets.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module tests model set evaluation and fitting for some common use cases. """ import numpy as np # pylint: disable=invalid-name import pytest from numpy.testing import assert_allclose from astropy.modeling.core import Model from astropy.modeling...
603
19,353
astropy
astropy/modeling/tests/test_spline.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for spline models and fitters""" import unittest.mock as mk import numpy as np import pytest from numpy.testing import assert_allclose from astropy.modeling.core import FittableModel, ModelDefinitionError from astropy.modeling.fitting import (...
1,556
53,658
astropy
astropy/modeling/tests/test_convolution.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import numpy as np import pytest from astropy.convolution import convolve_models_fft from astropy.modeling.models import Const1D, Const2D from astropy.utils.compat.optional_deps import HAS_SCIPY @pytest.mark.skipif(not HAS...
97
2,624
astropy
astropy/modeling/tests/test_units_mapping.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from astropy import units as u from astropy.modeling.core import Model, fix_inputs from astropy.modeling.models import Polynomial1D class _ExampleModel(Model): n_inputs = 1 n_outputs = 1 def __init__(self): ...
57
1,665
astropy
astropy/modeling/tests/test_rotations.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import unittest.mock as mk from math import cos, sin import numpy as np import pytest from numpy.testing import assert_allclose import astropy.units as u from astropy.modeling import models, rotations from astropy.table im...
479
16,121
astropy
astropy/modeling/tests/test_projections.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test sky projections defined in WCS Paper II""" # pylint: disable=invalid-name, no-member import os import unittest.mock as mk import numpy as np import pytest from numpy.testing import assert_allclose, assert_almost_equal from astropy import units ...
1,331
43,730
astropy
astropy/modeling/tests/test_statistics.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Module to test statistic functions """ import numpy as np # pylint: disable=invalid-name import pytest from numpy.testing import assert_almost_equal from astropy.modeling.models import Identity, Mapping from astropy.modeling.statistic import ( l...
91
2,990
astropy
astropy/modeling/tests/test_models_quantities.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name, no-member import numpy as np import pytest from astropy import units as u from astropy.modeling.bounding_box import ModelBoundingBox from astropy.modeling.core import fix_inputs from astropy.modeling.fitting import ( D...
1,171
35,032
astropy
astropy/modeling/tests/test_quantities_evaluation.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests that relate to evaluating models with quantity parameters """ import numpy as np import pytest from numpy.testing import assert_allclose from astropy import units as u from astropy.modeling.core import Model from astropy.modeling.models import...
447
12,460
astropy
astropy/modeling/tests/test_models.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst: """ Tests for model evaluation. Compare the results of some models with other programs. """ import unittest.mock as mk import numpy as np # pylint: disable=invalid-name, no-member import pytest from numpy.testing import assert_allclose, assert_equal ...
1,214
41,848
astropy
astropy/modeling/tests/test_mappings.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_equal from astropy import units as u from astropy.modeling.fitting import ( DogBoxLSQFitter, LevMarLSQFitter, LMLSQFitter, ...
206
5,905
astropy
astropy/modeling/tests/test_physical_models.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for physical functions.""" # pylint: disable=no-member, invalid-name import numpy as np import pytest from astropy import cosmology from astropy import units as u from astropy.modeling.fitting import ( DogBoxLSQFitter, LevMarLSQFitter, ...
795
23,389
astropy
astropy/modeling/tests/test_math_func.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_allclose from astropy.modeling import math_functions x = np.linspace(-20, 360, 100) @pytest.mark.filterwarnings(r"ignore:.*:RuntimeWarning") def test_math(): for name in math_functi...
26
846
astropy
astropy/modeling/tests/test_pickle.py
.py
"""Tests that models are picklable.""" from pickle import dumps, loads import numpy as np import pytest from numpy.testing import assert_allclose from astropy import units as u from astropy.modeling import ( functional_models, mappings, math_functions, physical_models, polynomial, powerlaws, ...
211
5,740
astropy
astropy/modeling/tests/test_constraints.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import platform import types import warnings from contextlib import nullcontext import numpy as np import pytest from numpy.random import default_rng from numpy.testing import assert_allclose from astropy.modeling import f...
675
24,145
astropy
astropy/modeling/tests/test_quantities_model.py
.py
# Various tests of models not related to evaluation, fitting, or parameters # pylint: disable=invalid-name, no-member import pytest from astropy import units as u from astropy.modeling import models from astropy.modeling.core import _ModelMeta from astropy.modeling.models import Gaussian1D, Mapping, Pix2Sky_TAN from a...
143
3,736
astropy
astropy/modeling/tests/irafutil.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module provides functions to help with testing against iraf tasks. """ import numpy as np from astropy.logger import log class IdentifyRecord: """ Represents a database record for the onedspec.identify task. Attributes -------...
97
3,037
astropy
astropy/modeling/tests/test_polynomial.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for polynomial models.""" # pylint: disable=invalid-name import os import unittest.mock as mk import warnings import numpy as np import pytest from numpy.testing import assert_allclose from astropy import conf, wcs from astropy.io import fits ...
688
23,784
astropy
astropy/modeling/tests/test_fitting_parallel.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import re import pytest pytest.importorskip("dask") import numpy as np from dask import array as da from numpy.testing import assert_allclose from astropy import units as u from astropy.modeling.fitting import ( FitInfoArrayContainer, ...
1,195
36,237
astropy
astropy/modeling/tests/test_utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import re from inspect import Parameter import numpy as np import pytest from astropy.modeling.utils import ( _SpecialOperatorsDict, _validate_domain_window, get_inputs_and_params, poly_map_domain, quant...
163
5,521
astropy
astropy/modeling/tests/test_functional_models.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name from contextlib import nullcontext import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_equal, assert_array_less from astropy import units as u from astropy.coordinates import Angle from...
627
20,032
astropy
astropy/modeling/tests/data/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from pathlib import Path dpath = str(Path(__file__).parent.resolve())
6
136
astropy
astropy/modeling/models/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Creates a common namespace for all pre-defined models. """ from astropy.modeling import math_functions as math from astropy.modeling.core import custom_model, fix_inputs, hide_inverse from astropy.modeling.functional_models import * from astropy.mode...
97
2,880
astropy
astropy/samp/web_profile.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from urllib.parse import parse_qs from urllib.request import urlopen from astropy.utils.data import get_pkg_data_contents from .standard_profile import SAMPSimpleXMLRPCRequestHandler, ThreadingXMLRPCServer __all__ = [] CROSS_DOMAIN = get_pkg_data_con...
181
5,739
astropy
astropy/samp/hub.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import os import queue import select import socket import threading import time import uuid import warnings import xmlrpc.client as xmlrpc from urllib.parse import urlunparse from astropy import log from .constants import SAMP_STATUS_OK, __...
1,507
56,042
astropy
astropy/samp/standard_profile.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import socketserver import sys import traceback import warnings import xmlrpc.client as xmlrpc from xmlrpc.server import SimpleXMLRPCRequestHandler, SimpleXMLRPCServer from .constants import SAMP_ICON from .errors import SAMPWarning from .utils import s...
164
5,749
astropy
astropy/samp/errors.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Defines custom errors and exceptions used in `astropy.samp`. """ import xmlrpc.client as xmlrpc from astropy.utils.exceptions import AstropyUserWarning __all__ = ["SAMPClientError", "SAMPHubError", "SAMPProxyError", "SAMPWarning"] class SAMPWarnin...
41
738
astropy
astropy/samp/utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Utility functions and classes. """ import inspect import queue import traceback import xmlrpc.client as xmlrpc from io import StringIO from urllib.request import urlopen from .constants import SAMP_STATUS_ERROR from .errors import SAMPProxyError de...
218
6,660
astropy
astropy/samp/hub_script.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import argparse import copy import logging import sys import time from astropy import __version__, log from .hub import SAMPHubServer __all__ = ["hub_script"] def hub_script(timeout=0): """ This main function is executed by the ``samp_hub`` ...
220
6,296
astropy
astropy/samp/hub_proxy.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import xmlrpc.client as xmlrpc from .errors import SAMPHubError from .lockfile_helpers import get_main_running_hub from .utils import SAMPXXEServerProxy, ServerProxyPool __all__ = ["SAMPHubProxy"] class SAMPHubProxy: """ Proxy cla...
198
6,061
astropy
astropy/samp/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ .. warning:: ``astropy.samp`` was deprecated in version 8.0 and will be removed in a future version; please use ``pyvo.samp`` instead. This subpackage provides classes to communicate with other applications via the `Simple Application Messagin...
58
1,512
astropy
astropy/samp/constants.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Defines constants used in `astropy.samp`. """ from astropy.utils.data import get_pkg_data_filename __all__ = [ "SAFE_MTYPES", "SAMP_ICON", "SAMP_STATUS_ERROR", "SAMP_STATUS_OK", "SAMP_STATUS_WARNING", ] __profile_version__ = "1.3...
38
824
astropy
astropy/samp/client.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import os import select import socket import threading import warnings from urllib.parse import urlunparse from .constants import SAMP_STATUS_OK, SAMP_STATUS_WARNING from .errors import SAMPClientError, SAMPWarning from .hub import SAMPHubSe...
743
25,371
astropy
astropy/samp/lockfile_helpers.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # TODO: this file should be refactored to use a more thread-safe and # race-condition-safe lockfile mechanism. import datetime import os import stat import warnings import xmlrpc.client as xmlrpc from contextlib import suppress from pathlib import Path ...
258
8,045