def showStatus(self, message: str, x: bool = False): self.statusBar().styleSheet() self.statusBar().showMessage(message) res = regexCompile(r"\bsuccessfull\b") if x is True: try: QMessageBox.information(self, res.findall(message)[0].capitalize(), message) except IndexError: QMessageBox.information(self, "Unsuccessfull", message)
def __init__(self, version: str): self.logger: Logger = getLogger(__name__) self._re = regexCompile('^' '(\d+)\.(\d+)\.(\d+)' # minor, major, patch '(-[0-9A-Za-z-\.]+)?' # pre-release '(\+[0-9A-Za-z-\.]+)?' # build '$') match: regexMatch = self._re.match(version) if match is None: raise SemanticVersionError(f'Invalid Version: `{version}`') mGroups: Sequence[str] = match.groups() self.major: int = int(mGroups[0]) self.minor: int = int(mGroups[1]) self.patch: int = int(mGroups[2]) self.preRelease: List[Union[int, str]] = self._makeGroup(match.group(4)) self.build: List[Union[int, str]] = self._makeGroup(match.group(5))
depsdDir = join(projectRoot(view), 'deps.d') if not isdir(depsdDir): self._changeDir(items[0], view) return for f in listdir(depsdDir): items.append(f) if len(items) == 1: self._changeDir(items[0], view) return self.window.show_quick_panel(items, lambda x: self._changeDir(items[x], view) if x != -1 else None) def _changeDir(self, name, view): rootDir = projectRoot(view) if name == basename(rootDir): directory = rootDir else: directory = join(rootDir, 'deps.d', name) view.run_command('remote_git_set_root_dir', args=dict(rootDir=directory)) class ReplaceViewContent(TextCommand): def run(self, edit, content, **arguments): name = arguments.get('name', VIEW_PREFIX) replaceView(self.view, edit, content, name=name) p = regexCompile('([A-Z])') class RemoteGitBack(TextCommand): def run(self, edit): command, args = lastCommand(2) command = p.sub(r'_\1', command)[1:].lower() self.view.run_command(command, args=args)
tuples, ) from twisted.trial.unittest import SynchronousTestCase as _SynchronousTestCase from .._repository import InvalidRepositoryNameError, Repository # FIXME: Not publicly available from hypothesis DataStrategy = Any __all__ = () componentRegexText = "[a-z0-9]+(?:[._-][a-z0-9]+)*" componentRegex = regexCompile(f"^{componentRegexText}$") repositoryNameRegexText = f"{componentRegexText}(?:/{componentRegexText})*" repositoryNameRegex = regexCompile(f"^{repositoryNameRegexText}$") # # Strategies # def componentText( min_size: int = 1, max_size: Optional[int] = None ) -> SearchStrategy: # str """ Strategy that generates repository name path components without separators.
""" start.py A USACO start script that retrieves the next training pages practice problem. Copyright (c)2016 Clive Chan MIT License """ from common import * from re import compile as regexCompile mainpage = loginToMainPage() name = getName() fullname = getFull() probpage = newBrowser().get("http://train.usaco.org"+mainpage.soup.select("a")[6]['href']) sampleinput = probpage.soup.find(text=regexCompile("SAMPLE INPUT")).findNext("pre").contents[0].strip() sampleoutput = probpage.soup.find(text=regexCompile("SAMPLE OUTPUT")).findNext("pre").contents[0].strip() # their html is disturbingly bad problemstatement = probpage.soup.decode_contents(formatter="html") problemstatement = html2text(problemstatement) # [0:problemstatement.find("<form action=\"/upload3\"")] startcode = """/* ID: """+username+""" PROG: """+name+""" LANG: C++11 */ #include <fstream> #include <vector> #include <iostream>