Esempio n. 1
0
async def main():
    logger.configure()
    win = MainWindow()

    async with qtrio.enter_emissions_channel(signals=[win.closed]) as emissions:
        win.show()
        await emissions.channel.receive()
Esempio n. 2
0
async def main():
    async with trio.open_nursery() as nursery:
        logger.configure()

        srv = SimpleServerInterface(nursery)
        win = MainWindow(nursery, srv)

        async with qtrio.enter_emissions_channel(signals=[win.closed]) as emissions:
            await srv.start()

            win.show()
            await emissions.channel.receive()

        srv.stop()
Esempio n. 3
0
async def main():
    logger.configure()

    log = logging.getLogger("test lean server")

    async with trio.open_nursery() as nursery:
        srv = Lean_Server( nursery )
        await srv.start()

        st,template = read_lean_template()
        rq = SyncRequest(file_name="superfichier",content=template)

        res = await srv.send(rq)
        log.info(f"Result is : {res}")

        await srv.running_monitor.wait_ready()

        log.info("SERVEUR IS RADIS !")
Esempio n. 4
0
def test_basic(capsys):
    # Date/time information is masked with regex numbers
    RESP = re.compile( r"\d{4}-\d+-\d+ \d+:\d+:\d+,\d+ DEBUG    : This is debug\n"   \
                       r"\d{4}-\d+-\d+ \d+:\d+:\d+,\d+ INFO     : This is info\n"    \
                       r"\d{4}-\d+-\d+ \d+:\d+:\d+,\d+ WARNING  : This is warning\n" \
                       r"\d{4}-\d+-\d+ \d+:\d+:\d+,\d+ ERROR    : This is error\n"   \
                       r"\d{4}-\d+-\d+ \d+:\d+:\d+,\d+ CRITICAL : This is broken\n"  )

    logger.configure()

    log = logging.getLogger("logger test")

    log.debug    ("This is debug"  )
    log.info     ("This is info"   )
    log.warning  ("This is warning")
    log.error    ("This is error"  )
    log.critical ("This is broken" )

    captured = capsys.readouterr()
    print(captured.err)
    assert RESP.match(captured.err)
Esempio n. 5
0
async def main():
    async with trio.open_nursery() as nursery:
        logger.configure()

        course = Course.from_file(
            Path("../../tests/lean_files/short_course/exercises.lean"))
        for counter, statement in enumerate(course.statements):
            print(f"Statement n°{counter:2d}: "
                  f"(exercise: {isinstance(statement, Exercise)}) "
                  f"{statement.lean_name}"
                  f" ({statement.pretty_name})")

        statement_id = int(input("Exercice n° ? "))
        exercise = course.statements[statement_id]

        win = ExerciseWindow(nursery, exercise)

        async with qtrio.enter_emissions_channel(
                signals=[win.closed]) as emissions:
            win.show()
            await emissions.channel.receive()
Esempio n. 6
0
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    d∃∀duction is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with d∃∀duction. If not, see <https://www.gnu.org/licenses/>.
"""

from deaduction.pylib import logger

logger.configure(debug=True)

import os
import toml
import logging

from pathlib import Path
from pep517.wrappers import Pep517HookCaller

log = logging.getLogger(__name__)

# ┌────────────────────────────────────────┐
# │ Global configuration                   │
# └────────────────────────────────────────┘
SRC_PATH = (Path(__file__) / "..").resolve()
SHARE_PATH = (SRC_PATH / "src/share")
Esempio n. 7
0
        if (not item.is_selected) and (not item in self.current_selection):
            item.mark_selected(True)
            self.current_selection.append(item)
        elif item.is_selected:
            item.mark_selected(False)
            self.current_selection.remove(item)

        log.debug(self.pretty_selection())

    @Slot()
    def clear_selection(self):
        for item in self.current_selection:
            item.mark_selected(False)

        self.current_selection = []

        log.debug(self.pretty_selection())


if __name__ == '__main__':
    logger.configure()
    log = logging.getLogger(__name__)

    app = QApplication()

    c = Container()
    c.show()

    sys.exit(app.exec_())
Esempio n. 8
0
# (non-exhaustive) list of logger domains:
# ['lean', 'ServerInterface', 'Course', 'deaduction.dui',
#  'deaduction.pylib.coursedata', 'deaduction.pylib.mathobj', 'LeanServer']

###################
# Configuring log #
###################
# Change your own settings in .deaduction-dev/config.toml
log_domains = cvars.get("logs.domains", "")
log_level = cvars.get("logs.display_level", 'info')

if os.getenv("DEADUCTION_DEV_MODE", False):
    log_level = 'debug'
    log_domains = ["deaduction", "__main__", 'ServerInterface']

logger.configure(domains=log_domains, display_level=log_level)

log = logging.getLogger(__name__)

###########################
# Configuring args parser #
###########################

arg_parser = argparse.ArgumentParser("Start deaduction graphical interface "
                                     "for Lean theorem prover")
arg_parser.add_argument('--course', '-c', help="Course filename")
arg_parser.add_argument('--exercise', '-e', help="Exercise (piece of) name")


############################
# Check dependencies stage #
Esempio n. 9
0
    # Process each course
    for course in courses:
        async with trio.open_nursery() as nursery:
            servint = ServerInterfaceAllStatements(nursery)
            await servint.start()
            await servint.set_statements(course)
            servint.stop()

        log.debug("Got all proof states, saving")
        # Save pkl course file
        relative_course_path = course.relative_course_path
        directory_name = relative_course_path.parent
        course_hash = hash(course.file_content)

        # search for pkl file, and compare contents
        # so that only unprocessed statements will be processed
        unprocessed_statements = []
        filename = relative_course_path.stem + '.pkl'
        course_pkl_path = directory_name.joinpath(Path(filename))

        save_objects([course], course_pkl_path)

        print("===================================")
        print_goal(course)


if __name__ == '__main__':
    logger.configure(domains=['ServerInterface', '__main__'])
    log.debug("starting pre-processing...")
    qtrio.run(main_alt)
Esempio n. 10
0
This file is part of d∃∀duction.

    d∃∀duction is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    d∃∀duction is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with d∃∀duction. If not, see <https://www.gnu.org/licenses/>.
"""

import deaduction.pylib.logger as log
import deaduction.pylib.config.environ as cenv
import deaduction.pylib.config.dirs as cdirs
import deaduction.pylib.config.vars as cvars
import deaduction.pylib.config.site_installation as inst

# Stuff init
log.configure()
#cvars.load()
cenv.init()
cdirs.init()
inst.init()

print("Welcome to the d∃∀duction shell !!!")