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

Side by Side Diff: third_party/psutil/psutil/error.py

Issue 8919026: Remove psutil from tree, install via install-build-deps.sh (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Sort package list. Created 9 years 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
« no previous file with comments | « third_party/psutil/psutil/arch/osx/process_info.c ('k') | third_party/psutil/setup.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # $Id: error.py 1142 2011-10-05 18:45:49Z g.rodola $
4 #
5 # Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved.
6 # Use of this source code is governed by a BSD-style license that can be
7 # found in the LICENSE file.
8
9 """psutil exception classes; do not import this directly"""
10
11
12 class Error(Exception):
13 """Base exception class. All other psutil exceptions inherit
14 from this one.
15 """
16
17 class NoSuchProcess(Error):
18 """Exception raised when a process with a certain PID doesn't
19 or no longer exists (zombie).
20 """
21
22 def __init__(self, pid, name=None, msg=None):
23 self.pid = pid
24 self.name = name
25 self.msg = msg
26 if msg is None:
27 if name:
28 details = "(pid=%s, name=%s)" % (self.pid, repr(self.name))
29 else:
30 details = "(pid=%s)" % self.pid
31 self.msg = "process no longer exists " + details
32
33 def __str__(self):
34 return self.msg
35
36
37 class AccessDenied(Error):
38 """Exception raised when permission to perform an action is denied."""
39
40 def __init__(self, pid=None, name=None, msg=None):
41 self.pid = pid
42 self.name = name
43 self.msg = msg
44 if msg is None:
45 if (pid is not None) and (name is not None):
46 self.msg = "(pid=%s, name=%s)" % (pid, repr(name))
47 elif (pid is not None):
48 self.msg = "(pid=%s)" % self.pid
49 else:
50 self.msg = ""
51
52 def __str__(self):
53 return self.msg
54
55
56 class TimeoutExpired(Error):
57 """Raised on Process.wait(timeout) if timeout expires and process
58 is still alive.
59 """
60
61 def __init__(self, pid=None, name=None):
62 self.pid = pid
63 self.name = name
64 if (pid is not None) and (name is not None):
65 self.msg = "(pid=%s, name=%s)" % (pid, repr(name))
66 elif (pid is not None):
67 self.msg = "(pid=%s)" % self.pid
68 else:
69 self.msg = ""
70
71 def __str__(self):
72 return self.msg
73
OLDNEW
« no previous file with comments | « third_party/psutil/psutil/arch/osx/process_info.c ('k') | third_party/psutil/setup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698