/usr/lib/python2.7/dist-packages/openpyxl/styles/borders.py is in python-openpyxl 2.3.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
from openpyxl.compat import safe_string
from openpyxl.descriptors import NoneSet, Typed, Bool, Alias
from .colors import ColorDescriptor
from .hashable import HashableObject
BORDER_NONE = None
BORDER_DASHDOT = 'dashDot'
BORDER_DASHDOTDOT = 'dashDotDot'
BORDER_DASHED = 'dashed'
BORDER_DOTTED = 'dotted'
BORDER_DOUBLE = 'double'
BORDER_HAIR = 'hair'
BORDER_MEDIUM = 'medium'
BORDER_MEDIUMDASHDOT = 'mediumDashDot'
BORDER_MEDIUMDASHDOTDOT = 'mediumDashDotDot'
BORDER_MEDIUMDASHED = 'mediumDashed'
BORDER_SLANTDASHDOT = 'slantDashDot'
BORDER_THICK = 'thick'
BORDER_THIN = 'thin'
class Side(HashableObject):
"""Border options for use in styles.
Caution: if you do not specify a border_style, other attributes will
have no effect !"""
__fields__ = ('style',
'color')
color = ColorDescriptor(allow_none=True)
style = NoneSet(values=('dashDot','dashDotDot', 'dashed','dotted',
'double','hair', 'medium', 'mediumDashDot', 'mediumDashDotDot',
'mediumDashed', 'slantDashDot', 'thick', 'thin')
)
border_style = Alias('style')
def __init__(self, style=None, color=None, border_style=None):
if border_style is not None:
style = border_style
self.style = style
self.color = color
class Border(HashableObject):
"""Border positioning for use in styles."""
tagname = "border"
__fields__ = ('left',
'right',
'top',
'bottom',
'diagonal',
'diagonal_direction',
'vertical',
'horizontal')
__elements__ = ('start', 'end', 'left', 'right', 'top', 'bottom',
'diagonal', 'vertical', 'horizontal')
# child elements
start = Typed(expected_type=Side, allow_none=True)
end = Typed(expected_type=Side, allow_none=True)
left = Typed(expected_type=Side, allow_none=True)
right = Typed(expected_type=Side, allow_none=True)
top = Typed(expected_type=Side, allow_none=True)
bottom = Typed(expected_type=Side)
diagonal = Typed(expected_type=Side, allow_none=True)
vertical = Typed(expected_type=Side, allow_none=True)
horizontal = Typed(expected_type=Side, allow_none=True)
# attributes
outline = Bool()
diagonalUp = Bool()
diagonalDown = Bool()
def __init__(self, left=Side(), right=Side(), top=Side(),
bottom=Side(), diagonal=Side(), diagonal_direction=None,
vertical=None, horizontal=None, diagonalUp=False, diagonalDown=False,
outline=True, start=None, end=None):
self.left = left
self.right = right
self.top = top
self.bottom = bottom
self.diagonal = diagonal
self.vertical = vertical
self.horizontal = horizontal
self.diagonal_direction = diagonal_direction
self.diagonalUp = diagonalUp
self.diagonalDown = diagonalDown
self.outline = outline
self.start = start
self.end = end
def __iter__(self):
for attr in self.__attrs__:
value = getattr(self, attr)
if value and attr != "outline":
yield attr, value
elif attr == "outline" and not value:
yield attr, value
DEFAULT_BORDER = Border()
|