Git Product home page Git Product logo

Comments (1)

N-Coder avatar N-Coder commented on August 19, 2024
  • with the globally managed model classes, one Course can exist within multiple Semesters, so some invariants the VirtualPath relies on no longer hold
  • as _known_tokens uses the most specific known data, the path of a child VirtualPath may change in comparison to its parent (due to the above point and more specific values for children, e.g. creation time)
  • path / known_data validation should be reenabled in VirtualPath, once changing known_data is fixed. InvalidVirtualPathException should be thrown and handled gracefully

Old checks that assume that one Course can only exist within one Semester:

if self._course:
    assert not self._semester or self._course.semester == self._semester, \
        "virtual path %s describes course %s of semester %s, " \
        "which doesn't match the semester of the virtual path %s" % \
        (self, self._course, self._course.semester, self._semester)
if self._file:
    assert not self._semester or self._file.semester == self._semester, \
        "virtual path %s describes file %s of semester %s, " \
        "which doesn't match the semester of the virtual path %s" % \
        (self, self._file, self._file.semester, self._semester)
    assert not self._course or self._file.course == self._course, \
        "virtual path %s describes file %s of course %s %s, " \
        "which doesn't match the course of the virtual path %s %s" % \
        (self, self._file, self._file.course, self._file.course.semester, self._course, self._course.semester)

New checks that ensure that known_data doesn't change:

if self.parent:
    assert self.partial_path.startswith(self.parent.partial_path), \
        "Path of child file %s doesn't start with the path of its parent %s. " \
        "Does your path format specification make sense?" % (self, self.parent)
    assert set(self._known_tokens.items()).issuperset(self.parent._known_tokens.items()), \
        "Known data of child file %s doesn't include all data of its parent %s. " \
        "Does your path format specification make sense? " \
        "Offending keys are:\n%s" % (self, self.parent, tabulate(
            ((key, self.parent._known_tokens.get(key, "unset"), self._known_tokens.get(key, "unset"))
             for key in set(chain(self._known_tokens.keys(), self.parent._known_tokens.keys()))),
            headers=["key", "parent value", "child value"], missingval="None"
        ))

from studip-fuse.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.