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

Side by Side Diff: pylib/gyp/common.py

Issue 10449026: Fixing leftover from prior reveiew, plus more lint. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from __future__ import with_statement 5 from __future__ import with_statement
6 6
7 import errno 7 import errno
8 import filecmp 8 import filecmp
9 import os.path 9 import os.path
10 import re 10 import re
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 385
386 386
387 # From Alex Martelli, 387 # From Alex Martelli,
388 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560 388 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560
389 # ASPN: Python Cookbook: Remove duplicates from a sequence 389 # ASPN: Python Cookbook: Remove duplicates from a sequence
390 # First comment, dated 2001/10/13. 390 # First comment, dated 2001/10/13.
391 # (Also in the printed Python Cookbook.) 391 # (Also in the printed Python Cookbook.)
392 392
393 def uniquer(seq, idfun=None): 393 def uniquer(seq, idfun=None):
394 if idfun is None: 394 if idfun is None:
395 def idfun(x): return x 395 def ident_idfun(x): return x
396 idfun = ident_idfun
Nico 2012/05/25 19:34:49 idfun = lamba x: x
396 seen = {} 397 seen = {}
397 result = [] 398 result = []
398 for item in seq: 399 for item in seq:
399 marker = idfun(item) 400 marker = idfun(item)
400 if marker in seen: continue 401 if marker in seen: continue
401 seen[marker] = 1 402 seen[marker] = 1
402 result.append(item) 403 result.append(item)
403 return result 404 return result
404 405
405 406
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 return 444 return
444 visited.add(node) 445 visited.add(node)
445 visiting.add(node) 446 visiting.add(node)
446 for neighbor in get_edges(node): 447 for neighbor in get_edges(node):
447 Visit(neighbor) 448 Visit(neighbor)
448 visiting.remove(node) 449 visiting.remove(node)
449 ordered_nodes.insert(0, node) 450 ordered_nodes.insert(0, node)
450 for node in sorted(graph): 451 for node in sorted(graph):
451 Visit(node) 452 Visit(node)
452 return ordered_nodes 453 return ordered_nodes
OLDNEW
« no previous file with comments | « pylib/gyp/SCons.py ('k') | pylib/gyp/generator/make.py » ('j') | pylib/gyp/generator/make.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698