MCPcopy Index your code
hub / github.com/python/cpython / RuleLine

Class RuleLine

Lib/urllib/robotparser.py:231–245  ·  view source on GitHub ↗

A rule line is a single "Allow:" (allowance==True) or "Disallow:" (allowance==False) followed by a path.

Source from the content-addressed store, hash-verified

229 return '\n\n'.join(map(str, entries))
230
231class RuleLine:
232 """A rule line is a single "Allow:" (allowance==True) or "Disallow:"
233 (allowance==False) followed by a path."""
234 def __init__(self, path, allowance):
235 if path == '' and not allowance:
236 # an empty value means allow all
237 allowance = True
238 self.path = normalize_path(path)
239 self.allowance = allowance
240
241 def applies_to(self, filename):
242 return self.path == "*" or filename.startswith(self.path)
243
244 def __str__(self):
245 return ("Allow" if self.allowance else "Disallow") + ": " + self.path
246
247
248class Entry:

Callers 1

parseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…