7
  6   坙栞m_J򁷯2燷�n4陿磑怇[宬7+2�遹缜�N9婆拿 �    import os
import pytest
import tempfile

from . import util


class TestAssumedShapeSumExample(util.F2PyTest):
    sources = [
        util.getpath("tests", "src", "assumed_shape", "foo_free.f90"),
        util.getpath("tests", "src", "assumed_shape", "foo_use.f90"),
        util.getpath("tests", "src", "assumed_shape", "precision.f90"),
        util.getpath("tests", "src", "assumed_shape", "foo_mod.f90"),
        util.getpath("tests", "src", "assumed_shape", ".f2py_f2cmap"),
    ]

    @pytest.mark.slow
    def test_all(self):
        r = self.module.fsum([1, 2])
        assert r == 3
        r = self.module.sum([1, 2])
        assert r == 3
        r = self.module.sum_with_use([1, 2])
        assert r == 3

        r = self.module.mod.sum([1, 2])
        assert r == 3
        r = self.module.mod.fsum([1, 2])
        assert r == 3


class TestF2cmapOption(TestAssumedShapeSumExample):
    def setup_method(self):
        # Use a custom file name for .f2py_f2cmap
        self.sources = list(self.sources)
        f2cmap_src = self.sources.pop(-1)

        self.f2cmap_file = tempfile.NamedTemporaryFile(delete=False)
        with open(f2cmap_src, "rb") as f:
            self.f2cmap_file.write(f.read())
        self.f2cmap_file.close()

        self.sources.append(self.f2cmap_file.name)
        self.options = ["--f2cmap", self.f2cmap_file.name]

        super().setup_method()

    def teardown_method(self):
        os.unlink(self.f2cmap_file.name)
  7   坙栃z緮*i?u8�q癨蔮芽戜球 8�
靲l$ 淊�僪骨拍      online
  =   埧廅B洉橾锛幽笕16莀圛|+a栃z緮*i?u8�q癨阞芽�      int test_flags;
     埪慆B g 遪I[晳3���僪股酒      5
  5   坙栃z緮*i?u8�q梟 
b芽怇B g]Zm洒笏僪故壳      1
     埰攀505目� �    �      蛿Qo�0呥�+铧�7�h腟G悊FQ殾赡�馊6れ紫`猣hl冥=葚99鱸躲餟<橄?M餹~?傞嚪H馽蟘�③l垉1扽[�jV潶襅溝0倡紜苆欂&窚袐p7G/ �惝Bhネ\<丣遮蒃K�4"OQ+e裭&93檈_关菵�+.鶴堔斯懔>\(据ug��鸉籊MC浟嗗rYD莫捫P畺`t攭*.rV<6�2%纑懴摸鋴印蛌_訍A�7齢|;塨B莑妃便歿Ч#t膶厱�2晜�?x駜黺�0鰵X楧艘JU糎�!諵暃�9諯G愰菏KV�%?,启n6香崽/	遈激�"t蚀(,腞嬆*�=饃笞怕敺螩8ふr橸BpT�埄使衭萐x奠勚跫?l汾W� h7\鱖W �I�*�劘g鋙w犝頬二i⺷馲í�赋|`-6钊觌�p}�坯�吸юp蹌缚虰魒鑧?!t痞    6   坙栠i~� 斔mJq@3pM\m�1h�怇\dk8�,扐汽汛缣�o邓世� :    from __future__ import annotations

import os
import sys
from typing import cast

from ._api import BaseFileLock

#: a flag to indicate if the fcntl API is available
has_fcntl = False
if sys.platform == "win32":  # pragma: win32 cover

    class UnixFileLock(BaseFileLock):
        """Uses the :func:`fcntl.flock` to hard lock the lock file on unix systems."""

        def _acquire(self) -> None:
            raise NotImplementedError

        def _release(self) -> None:
            raise NotImplementedError

else:  # pragma: win32 no cover
    try:
        import fcntl
    except ImportError:
        pass
    else:
        has_fcntl = True

    class UnixFileLock(BaseFileLock):
        """Uses the :func:`fcntl.flock` to hard lock the lock file on unix systems."""

        def _acquire(self) -> None:
            open_mode = os.O_RDWR | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW
            fd = os.open(self._lock_file, open_mode)
            try:
                fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
            except OSError:
                os.close(fd)
            else:
                self._lock_file_fd = fd

        def _release(self) -> None:
            # Do not remove the lockfile:
            #   https://github.com/tox-dev/py-filelock/issues/31
            #   https://stackoverflow.com/questions/17708885/flock-removing-locked-file-without-race-condition
            fd = cast(int, self._lock_file_fd)
            self._lock_file_fd = None
            fcntl.flock(fd, fcntl.LOCK_UN)
            os.close(fd)


__all__ = [
    "has_fcntl",
    "UnixFileLock",
]
  7   坙栃z緮*i?u8�q癨阞芽戜球 8�
靲la$��?�