Show More
@@ -87,8 +87,8 b' class ErrorController(BaseController):' | |||||
87 | return fapp(request.environ, self.start_response) |
|
87 | return fapp(request.environ, self.start_response) | |
88 |
|
88 | |||
89 | def get_error_explanation(self, code): |
|
89 | def get_error_explanation(self, code): | |
90 |
|
|
90 | """ get the error explanations of int codes | |
91 |
[400, 401, 403, 404, 500] |
|
91 | [400, 401, 403, 404, 500]""" | |
92 | try: |
|
92 | try: | |
93 | code = int(code) |
|
93 | code = int(code) | |
94 | except Exception: |
|
94 | except Exception: |
@@ -144,11 +144,11 b' class ModelGenerator(object):' | |||||
144 | return '\n'.join(out) |
|
144 | return '\n'.join(out) | |
145 |
|
145 | |||
146 | def genB2AMigration(self, indent=' '): |
|
146 | def genB2AMigration(self, indent=' '): | |
147 |
|
|
147 | """Generate a migration from B to A. | |
148 |
|
148 | |||
149 | Was: toUpgradeDowngradePython |
|
149 | Was: toUpgradeDowngradePython | |
150 | Assume model (A) is most current and database (B) is out-of-date. |
|
150 | Assume model (A) is most current and database (B) is out-of-date. | |
151 |
|
|
151 | """ | |
152 |
|
152 | |||
153 | decls = ['from migrate.changeset import schema', |
|
153 | decls = ['from migrate.changeset import schema', | |
154 | 'pre_meta = MetaData()', |
|
154 | 'pre_meta = MetaData()', |
@@ -244,7 +244,7 b' class SchemaDiff(object):' | |||||
244 | self.tables_different[table_name]=td |
|
244 | self.tables_different[table_name]=td | |
245 |
|
245 | |||
246 | def __str__(self): |
|
246 | def __str__(self): | |
247 |
|
|
247 | """ Summarize differences. """ | |
248 | out = [] |
|
248 | out = [] | |
249 | column_template =' %%%is: %%r' % self.label_width |
|
249 | column_template =' %%%is: %%r' % self.label_width | |
250 |
|
250 |
@@ -1,4 +1,4 b'' | |||||
1 | ''' |
|
1 | """ | |
2 | Module provides a class allowing to wrap communication over subprocess.Popen |
|
2 | Module provides a class allowing to wrap communication over subprocess.Popen | |
3 | input, output, error streams into a meaningfull, non-blocking, concurrent |
|
3 | input, output, error streams into a meaningfull, non-blocking, concurrent | |
4 | stream processor exposing the output data as an iterator fitting to be a |
|
4 | stream processor exposing the output data as an iterator fitting to be a | |
@@ -21,7 +21,7 b' GNU Lesser General Public License for mo' | |||||
21 | You should have received a copy of the GNU Lesser General Public License |
|
21 | You should have received a copy of the GNU Lesser General Public License | |
22 | along with git_http_backend.py Project. |
|
22 | along with git_http_backend.py Project. | |
23 | If not, see <http://www.gnu.org/licenses/>. |
|
23 | If not, see <http://www.gnu.org/licenses/>. | |
24 | ''' |
|
24 | """ | |
25 | import os |
|
25 | import os | |
26 | import subprocess |
|
26 | import subprocess | |
27 | from rhodecode.lib.vcs.utils.compat import deque, Event, Thread, _bytes, _bytearray |
|
27 | from rhodecode.lib.vcs.utils.compat import deque, Event, Thread, _bytes, _bytearray | |
@@ -143,7 +143,7 b' class InputStreamChunker(Thread):' | |||||
143 |
|
143 | |||
144 |
|
144 | |||
145 | class BufferedGenerator(): |
|
145 | class BufferedGenerator(): | |
146 | ''' |
|
146 | """ | |
147 | Class behaves as a non-blocking, buffered pipe reader. |
|
147 | Class behaves as a non-blocking, buffered pipe reader. | |
148 | Reads chunks of data (through a thread) |
|
148 | Reads chunks of data (through a thread) | |
149 | from a blocking pipe, and attaches these to an array (Deque) of chunks. |
|
149 | from a blocking pipe, and attaches these to an array (Deque) of chunks. | |
@@ -153,7 +153,7 b' class BufferedGenerator():' | |||||
153 | to be sent or by not returning until there is some data to send |
|
153 | to be sent or by not returning until there is some data to send | |
154 | When we get EOF from underlying source pipe we raise the marker to raise |
|
154 | When we get EOF from underlying source pipe we raise the marker to raise | |
155 | StopIteration after the last chunk of data is yielded. |
|
155 | StopIteration after the last chunk of data is yielded. | |
156 | ''' |
|
156 | """ | |
157 |
|
157 | |||
158 | def __init__(self, source, buffer_size=65536, chunk_size=4096, |
|
158 | def __init__(self, source, buffer_size=65536, chunk_size=4096, | |
159 | starting_values=[], bottomless=False): |
|
159 | starting_values=[], bottomless=False): | |
@@ -229,29 +229,29 b' class BufferedGenerator():' | |||||
229 |
|
229 | |||
230 | @property |
|
230 | @property | |
231 | def done_reading_event(self): |
|
231 | def done_reading_event(self): | |
232 |
|
|
232 | """ | |
233 | Done_reding does not mean that the iterator's buffer is empty. |
|
233 | Done_reding does not mean that the iterator's buffer is empty. | |
234 | Iterator might have done reading from underlying source, but the read |
|
234 | Iterator might have done reading from underlying source, but the read | |
235 | chunks might still be available for serving through .next() method. |
|
235 | chunks might still be available for serving through .next() method. | |
236 |
|
236 | |||
237 | @return An Event class instance. |
|
237 | @return An Event class instance. | |
238 |
|
|
238 | """ | |
239 | return self.worker.EOF |
|
239 | return self.worker.EOF | |
240 |
|
240 | |||
241 | @property |
|
241 | @property | |
242 | def done_reading(self): |
|
242 | def done_reading(self): | |
243 |
|
|
243 | """ | |
244 | Done_reding does not mean that the iterator's buffer is empty. |
|
244 | Done_reding does not mean that the iterator's buffer is empty. | |
245 | Iterator might have done reading from underlying source, but the read |
|
245 | Iterator might have done reading from underlying source, but the read | |
246 | chunks might still be available for serving through .next() method. |
|
246 | chunks might still be available for serving through .next() method. | |
247 |
|
247 | |||
248 | @return An Bool value. |
|
248 | @return An Bool value. | |
249 |
|
|
249 | """ | |
250 | return self.worker.EOF.is_set() |
|
250 | return self.worker.EOF.is_set() | |
251 |
|
251 | |||
252 | @property |
|
252 | @property | |
253 | def length(self): |
|
253 | def length(self): | |
254 |
|
|
254 | """ | |
255 | returns int. |
|
255 | returns int. | |
256 |
|
256 | |||
257 | This is the lenght of the que of chunks, not the length of |
|
257 | This is the lenght of the que of chunks, not the length of | |
@@ -265,7 +265,7 b' class BufferedGenerator():' | |||||
265 | the responce's length will be set to that. In order not to |
|
265 | the responce's length will be set to that. In order not to | |
266 | confuse WSGI PEP3333 servers, we will not implement __len__ |
|
266 | confuse WSGI PEP3333 servers, we will not implement __len__ | |
267 | at all. |
|
267 | at all. | |
268 |
|
|
268 | """ | |
269 | return len(self.data) |
|
269 | return len(self.data) | |
270 |
|
270 | |||
271 | def prepend(self, x): |
|
271 | def prepend(self, x): | |
@@ -282,7 +282,7 b' class BufferedGenerator():' | |||||
282 |
|
282 | |||
283 |
|
283 | |||
284 | class SubprocessIOChunker(object): |
|
284 | class SubprocessIOChunker(object): | |
285 | ''' |
|
285 | """ | |
286 | Processor class wrapping handling of subprocess IO. |
|
286 | Processor class wrapping handling of subprocess IO. | |
287 |
|
287 | |||
288 | In a way, this is a "communicate()" replacement with a twist. |
|
288 | In a way, this is a "communicate()" replacement with a twist. | |
@@ -324,10 +324,10 b' class SubprocessIOChunker(object):' | |||||
324 | # return answer |
|
324 | # return answer | |
325 |
|
325 | |||
326 |
|
326 | |||
327 | ''' |
|
327 | """ | |
328 | def __init__(self, cmd, inputstream=None, buffer_size=65536, |
|
328 | def __init__(self, cmd, inputstream=None, buffer_size=65536, | |
329 | chunk_size=4096, starting_values=[], **kwargs): |
|
329 | chunk_size=4096, starting_values=[], **kwargs): | |
330 |
|
|
330 | """ | |
331 | Initializes SubprocessIOChunker |
|
331 | Initializes SubprocessIOChunker | |
332 |
|
332 | |||
333 | :param cmd: A Subprocess.Popen style "cmd". Can be string or array of strings |
|
333 | :param cmd: A Subprocess.Popen style "cmd". Can be string or array of strings | |
@@ -335,7 +335,7 b' class SubprocessIOChunker(object):' | |||||
335 | :param buffer_size: (Default: 65536) A size of total buffer per stream in bytes. |
|
335 | :param buffer_size: (Default: 65536) A size of total buffer per stream in bytes. | |
336 | :param chunk_size: (Default: 4096) A max size of a chunk. Actual chunk may be smaller. |
|
336 | :param chunk_size: (Default: 4096) A max size of a chunk. Actual chunk may be smaller. | |
337 | :param starting_values: (Default: []) An array of strings to put in front of output que. |
|
337 | :param starting_values: (Default: []) An array of strings to put in front of output que. | |
338 |
|
|
338 | """ | |
339 |
|
339 | |||
340 | if inputstream: |
|
340 | if inputstream: | |
341 | input_streamer = StreamFeeder(inputstream) |
|
341 | input_streamer = StreamFeeder(inputstream) |
@@ -257,7 +257,7 b' class GitChangesetTest(unittest.TestCase' | |||||
257 | .get_node('index.rst')) |
|
257 | .get_node('index.rst')) | |
258 |
|
258 | |||
259 | def test_branch_and_tags(self): |
|
259 | def test_branch_and_tags(self): | |
260 |
|
|
260 | """ | |
261 | rev0 = self.repo.revisions[0] |
|
261 | rev0 = self.repo.revisions[0] | |
262 | chset0 = self.repo.get_changeset(rev0) |
|
262 | chset0 = self.repo.get_changeset(rev0) | |
263 | self.assertEqual(chset0.branch, 'master') |
|
263 | self.assertEqual(chset0.branch, 'master') | |
@@ -274,7 +274,7 b' class GitChangesetTest(unittest.TestCase' | |||||
274 |
|
274 | |||
275 | tip = self.repo.get_changeset('tip') |
|
275 | tip = self.repo.get_changeset('tip') | |
276 | self.assertTrue('tip' in tip.tags) |
|
276 | self.assertTrue('tip' in tip.tags) | |
277 |
|
|
277 | """ | |
278 | # Those tests would fail - branches are now going |
|
278 | # Those tests would fail - branches are now going | |
279 | # to be changed at main API in order to support git backend |
|
279 | # to be changed at main API in order to support git backend | |
280 | pass |
|
280 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now