Exemplo n.º 1
0
 def parse(cls, s, lineno, file_type=filetypes.requirements_txt):
     # setuptools requires a space before the comment. If this isn't the case, add it.
     if "\t#" in s:
         parsed, = parse_requirements(s.replace("\t#", "\t #"))
     else:
         parsed, = parse_requirements(s)
     return cls(name=parsed.name,
                specs=parsed.specifier,
                line=s,
                lineno=lineno,
                extras=parsed.extras,
                file_type=file_type)
Exemplo n.º 2
0
 def filter(self):
     rqfilter = False
     if "rq.filter:" in self.line:
         rqfilter = self.line.split("rq.filter:")[1].strip().split("#")[0]
     elif "pyup:" in self.line:
         if "pyup: update" not in self.line:
             rqfilter = self.line.split("pyup:")[1].strip().split("#")[0]
             # unset the filter once the date set in 'until' is reached
             if "until" in rqfilter:
                 rqfilter, until = [
                     l.strip() for l in rqfilter.split("until")
                 ]
                 try:
                     until = datetime.strptime(until, "%Y-%m-%d")
                     if until < datetime.now():
                         rqfilter = False
                 except ValueError:
                     # wrong date formatting
                     pass
     if rqfilter:
         try:
             rqfilter, = parse_requirements("filter " + rqfilter)
             if len(rqfilter.specifier._specs) > 0:
                 return rqfilter.specifier
         except ValueError:
             pass
     return False
Exemplo n.º 3
0
 def filter(self):
     rqfilter = False
     if "rq.filter:" in self.line:
         rqfilter = self.line.split("rq.filter:")[1].strip().split("#")[0]
     elif "pyup:" in self.line:
         rqfilter = self.line.split("pyup:")[1].strip().split("#")[0]
     if rqfilter:
         try:
             rqfilter, = parse_requirements("filter " + rqfilter)
             if len(rqfilter.specifier._specs) > 0:
                 return rqfilter.specifier
         except ValueError:
             pass
     return False