def load_pull_details(self): self['pull'] = requests.get(self._pr_url).json() if self['state'] == 'open': self['combinedstate'] = 'open' self['combinedstatecolor'] = 'green' elif self['pull.merged']: self['combinedstate'] = 'merged' self['combinedstatecolor'] = 'blue' else: self['combinedstate'] = 'closed' self['combinedstatecolor'] = 'red'
def load_pull_details(self, pulls=None): """Get pull request details also. `pulls` is a dictionary of pull requests, to perhaps avoid making another request. """ if pulls: self._pull = pulls.get(self.number) if not self._pull: self._pull = requests.get(self.pull_request_url).json() if 0: print("---< Pull Request >--------------------------") pprint.pprint(self._pull)
def the_data(cls, filename): """ Returns the data from a particular file name, either locally or remote. """ if filename not in cls._the_data: # Define REPO_TOOLS_LATEST_PEOPLE=1 in the environment to force code to # get the data from GitHub instead of the local copy. if int(os.environ.get('REPO_TOOLS_LATEST_PEOPLE', '0')): # Read from GitHub. resp = requests.get("https://raw.githubusercontent.com/edx/repo-tools/master/" + filename) if not resp.ok: resp.raise_for_status() cls._the_data[filename] = cls.from_string(resp.text) else: # Read from a file. with open(filename) as f: cls._the_data[filename] = cls.from_file(f) return cls._the_data[filename]
def the_data(cls, filename): """ Returns the data from a particular file name, either locally or remote. """ if filename not in cls._the_data: # Define REPO_TOOLS_LATEST_PEOPLE=1 in the environment to force code to # get the data from GitHub instead of the local copy. if int(os.environ.get('REPO_TOOLS_LATEST_PEOPLE', '0')): # Read from GitHub. resp = requests.get( "https://raw.githubusercontent.com/edx/repo-tools-data/master/" + filename) if not resp.ok: resp.raise_for_status() cls._the_data[filename] = cls.from_string(resp.text) else: # Read from a file. with open(os.path.join(cls._data_dir, filename)) as f: cls._the_data[filename] = cls.from_file(f) return cls._the_data[filename]
def load_pull_details(self, pulls=None): """Get pull request details also. `pulls` is a dictionary of pull requests, to perhaps avoid making another request. """ pull_request = None if pulls: pull_request = pulls.get(self['number']) if not pull_request: pull_request = requests.get(self['pull_request.url']).json() self['pull'] = pull_request if self['state'] == 'open': self['combinedstate'] = 'open' self['combinedstatecolor'] = 'green' elif self['pull.merged_at']: self['combinedstate'] = 'merged' self['combinedstatecolor'] = 'blue' else: self['combinedstate'] = 'closed' self['combinedstatecolor'] = 'red'