Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9f3ea211
Commit
9f3ea211
authored
Oct 02, 1998
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all_names(): => unique_names()
aliases_of(): New method
parent
ddb9fc1e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
Tools/pynche/ColorDB.py
Tools/pynche/ColorDB.py
+12
-2
No files found.
Tools/pynche/ColorDB.py
View file @
9f3ea211
...
...
@@ -104,14 +104,24 @@ class ColorDB:
nearest_name
=
name
return
nearest_name
def
all
_names
(
self
):
def
unique
_names
(
self
):
# sorted
if
not
self
.
__allnames
:
self
.
__allnames
=
[]
for
name
,
aliases
in
self
.
__byrgb
.
values
():
self
.
__allnames
.
append
(
name
)
self
.
__allnames
.
sort
()
# sort irregardless of case
def
nocase_cmp
(
n1
,
n2
):
return
cmp
(
string
.
lower
(
n1
),
string
.
lower
(
n2
))
self
.
__allnames
.
sort
(
nocase_cmp
)
return
self
.
__allnames
def
aliases_of
(
self
,
red
,
green
,
blue
):
try
:
name
,
aliases
=
self
.
__byrgb
[(
red
,
green
,
blue
)]
except
KeyError
:
raise
BadColor
((
red
,
green
,
blue
))
return
[
name
]
+
aliases
class
RGBColorDB
(
ColorDB
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment