def _do_diff_fired(self): if self.selected_commits: lhs = self.selected_lhs rhs = self.selected_rhs lhsid = lhs.hexsha[:8] lhsdate = isoformat_date(lhs.date) rhsid = rhs.hexsha[:8] rhsdate = rhs.date.isoformat() diffs = [] for a in ('blanks', 'icfactors', 'intercepts'): p = analysis_path((self.uuid, self.record_id), self.repository_identifier, modifier=a) dd = get_diff(self.repo, lhs.hexsha, rhs.hexsha, p) if dd: diffs.append((a, dd)) if diffs: v = DiffView(self.record_id, lhsid, rhsid, lhsdate, rhsdate) for a, (aa, bb) in diffs: func = getattr(v, 'set_{}'.format(a)) a = aa.data_stream.read().decode('utf-8') b = bb.data_stream.read().decode('utf-8') func(json.loads(a), json.loads(b)) v.finish() open_view(v) else: information(None, 'No Differences between {} and {}'.format(lhsid, rhsid))
def _do_diff_fired(self): if self.selected_commits: lhs = self.selected_lhs rhs = self.selected_rhs lhsid = lhs.hexsha[:8] lhsdate = isoformat_date(lhs.date) rhsid = rhs.hexsha[:8] rhsdate = rhs.date.isoformat() diffs = [] for a in ('blanks', 'icfactors', 'intercepts'): p = analysis_path((self.uuid, self.record_id), self.repository_identifier, modifier=a) dd = get_diff(self.repo, lhs.hexsha, rhs.hexsha, p) if dd: diffs.append((a, dd)) if diffs: v = DiffView(self.record_id, lhsid, rhsid, lhsdate, rhsdate) for a, (aa, bb) in diffs: func = getattr(v, 'set_{}'.format(a)) a = aa.data_stream.read().decode('utf-8') b = bb.data_stream.read().decode('utf-8') func(json.loads(a), json.loads(b)) v.finish() open_view(v) else: information( None, 'No Differences between {} and {}'.format(lhsid, rhsid))
def _rget(ci): r = s.get(ci, headers=headers) result = json.loads(r.text) if attr: result = [di[attr] for di in result] try: dd = _rget(r.links['next']['url']) except KeyError: return result if attr: dd = [di[attr] for di in dd] result.extend(dd) return result
def _rget(ci): r = s.get(ci) if r.status_code == 401: raise CredentialException(self._get_authorization()) d = json.loads(r.text) result = [] if isinstance(d, list): result.extend(d) else: result.append(d) try: dd = _rget(r.links['next']['url']) except KeyError: return result if isinstance(dd, list): result.extend(dd) else: result.append(dd) return result
def info(self): cmd = make_request(self.base_cmd) doc = requests.get(cmd) return json.loads(doc.text)