Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: dashboard/dashboard/pinpoint/models/change/patch.py

Issue 3013013002: [pinpoint] Change refactor. (Closed)
Patch Set: UI Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import collections
6
7
8 class Patch(collections.namedtuple('Patch', ('server', 'issue', 'patchset'))):
9 """A patch in Rietveld."""
10 # TODO: Support Gerrit.
11 # https://github.com/catapult-project/catapult/issues/3599
12
13 def __str__(self):
14 return self.id_string
15
16 @property
17 def id_string(self):
18 return '%s/%d/%d' % (self.server, self.issue, self.patchset)
19
20 def AsDict(self):
21 return self._asdict()
22
23 @classmethod
24 def FromDict(cls, data):
25 # TODO: Validate to ensure the patch exists on the server.
26 return cls(data['server'], data['issue'], data['patchset'])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698