id
int64
1
6.07M
name
stringlengths
1
295
code
stringlengths
12
426k
language
stringclasses
1 value
source_file
stringlengths
5
202
start_line
int64
1
158k
end_line
int64
1
158k
repo
dict
7,701
format
def format(self, tokensource, outfile): try: outfile.write(b'') except TypeError: raise TypeError('The raw tokens formatter needs a binary ' 'output file') if self.compress == 'gz': import gzip outfile = gzip.GzipFile(''...
python
wandb/vendor/pygments/formatters/other.py
81
116
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,702
write
def write(text): outfile.write(text.encode())
python
wandb/vendor/pygments/formatters/other.py
90
91
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,703
write
def write(text): outfile.write(compressor.compress(text.encode()))
python
wandb/vendor/pygments/formatters/other.py
96
97
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,704
flush
def flush(): outfile.write(compressor.flush()) outfile.flush()
python
wandb/vendor/pygments/formatters/other.py
98
100
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,705
write
def write(text): outfile.write(text.encode())
python
wandb/vendor/pygments/formatters/other.py
102
103
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,706
__init__
def __init__(self, **options): Formatter.__init__(self, **options) if self.encoding is not None and self.encoding != 'utf-8': raise ValueError("Only None and utf-8 are allowed encodings.")
python
wandb/vendor/pygments/formatters/other.py
138
141
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,707
format
def format(self, tokensource, outfile): indentation = ' ' * 12 rawbuf = [] outbuf = [] for ttype, value in tokensource: rawbuf.append(value) outbuf.append('%s(%s, %r),\n' % (indentation, ttype, value)) before = TESTCASE_BEFORE % (u''.join(rawbuf),) ...
python
wandb/vendor/pygments/formatters/other.py
143
160
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,708
__init__
def __init__(self, font_name, font_size=14): self.font_name = font_name self.font_size = font_size self.fonts = {} self.encoding = None if sys.platform.startswith('win'): if not font_name: self.font_name = DEFAULT_FONT_NAME_WIN self._create...
python
wandb/vendor/pygments/formatters/img.py
67
83
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,709
_get_nix_font_path
def _get_nix_font_path(self, name, style): proc = subprocess.Popen(['fc-list', "%s:style=%s" % (name, style), 'file'], stdout=subprocess.PIPE, stderr=None) stdout, _ = proc.communicate() if proc.returncode == 0: lines = stdout.splitlines() ...
python
wandb/vendor/pygments/formatters/img.py
85
97
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,710
_create_nix
def _create_nix(self): for name in STYLES['NORMAL']: path = self._get_nix_font_path(self.font_name, name) if path is not None: self.fonts['NORMAL'] = ImageFont.truetype(path, self.font_size) break else: raise FontNotFound('No usable fon...
python
wandb/vendor/pygments/formatters/img.py
99
118
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,711
_get_mac_font_path
def _get_mac_font_path(self, font_map, name, style): return font_map.get((name + ' ' + style).strip().lower())
python
wandb/vendor/pygments/formatters/img.py
120
121
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,712
_create_mac
def _create_mac(self): font_map = {} for font_dir in (os.path.join(os.getenv("HOME"), 'Library/Fonts/'), '/Library/Fonts/', '/System/Library/Fonts/'): font_map.update( ((os.path.splitext(f)[0].lower(), os.path.join(font_dir, f)) fo...
python
wandb/vendor/pygments/formatters/img.py
123
149
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,713
_lookup_win
def _lookup_win(self, key, basename, styles, fail=False): for suffix in ('', ' (TrueType)'): for style in styles: try: valname = '%s%s%s' % (basename, style and ' '+style, suffix) val, _ = _winreg.QueryValueEx(key, valname) ...
python
wandb/vendor/pygments/formatters/img.py
151
164
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,714
_create_win
def _create_win(self): try: key = _winreg.OpenKey( _winreg.HKEY_LOCAL_MACHINE, r'Software\Microsoft\Windows NT\CurrentVersion\Fonts') except EnvironmentError: try: key = _winreg.OpenKey( _winreg.HKEY_LOCAL_MACHIN...
python
wandb/vendor/pygments/formatters/img.py
166
191
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,715
get_char_size
def get_char_size(self): """ Get the character size. """ return self.fonts['NORMAL'].getsize('M')
python
wandb/vendor/pygments/formatters/img.py
193
197
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,716
get_font
def get_font(self, bold, oblique): """ Get the font based on bold and italic flags. """ if bold and oblique: return self.fonts['BOLDITALIC'] elif bold: return self.fonts['BOLD'] elif oblique: return self.fonts['ITALIC'] else: ...
python
wandb/vendor/pygments/formatters/img.py
199
210
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,717
__init__
def __init__(self, **options): """ See the class docstring for explanation of options. """ if not pil_available: raise PilNotAvailable( 'Python Imaging Library is required for this formatter') Formatter.__init__(self, **options) self.encoding =...
python
wandb/vendor/pygments/formatters/img.py
330
384
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,718
get_style_defs
def get_style_defs(self, arg=''): raise NotImplementedError('The -S option is meaningless for the image ' 'formatter. Use -O style=<stylename> instead.')
python
wandb/vendor/pygments/formatters/img.py
386
388
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,719
_get_line_height
def _get_line_height(self): """ Get the height of a line. """ return self.fonth + self.line_pad
python
wandb/vendor/pygments/formatters/img.py
390
394
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,720
_get_line_y
def _get_line_y(self, lineno): """ Get the Y coordinate of a line number. """ return lineno * self._get_line_height() + self.image_pad
python
wandb/vendor/pygments/formatters/img.py
396
400
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,721
_get_char_width
def _get_char_width(self): """ Get the width of a character. """ return self.fontw
python
wandb/vendor/pygments/formatters/img.py
402
406
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,722
_get_char_x
def _get_char_x(self, charno): """ Get the X coordinate of a character position. """ return charno * self.fontw + self.image_pad + self.line_number_width
python
wandb/vendor/pygments/formatters/img.py
408
412
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,723
_get_text_pos
def _get_text_pos(self, charno, lineno): """ Get the actual position for a character and line position. """ return self._get_char_x(charno), self._get_line_y(lineno)
python
wandb/vendor/pygments/formatters/img.py
414
418
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,724
_get_linenumber_pos
def _get_linenumber_pos(self, lineno): """ Get the actual position for the start of a line number. """ return (self.image_pad, self._get_line_y(lineno))
python
wandb/vendor/pygments/formatters/img.py
420
424
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,725
_get_text_color
def _get_text_color(self, style): """ Get the correct color for the token from the style. """ if style['color'] is not None: fill = '#' + style['color'] else: fill = '#000' return fill
python
wandb/vendor/pygments/formatters/img.py
426
434
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,726
_get_style_font
def _get_style_font(self, style): """ Get the correct font for the style. """ return self.fonts.get_font(style['bold'], style['italic'])
python
wandb/vendor/pygments/formatters/img.py
436
440
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,727
_get_image_size
def _get_image_size(self, maxcharno, maxlineno): """ Get the required image size. """ return (self._get_char_x(maxcharno) + self.image_pad, self._get_line_y(maxlineno + 0) + self.image_pad)
python
wandb/vendor/pygments/formatters/img.py
442
447
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,728
_draw_linenumber
def _draw_linenumber(self, posno, lineno): """ Remember a line number drawable to paint later. """ self._draw_text( self._get_linenumber_pos(posno), str(lineno).rjust(self.line_number_chars), font=self.fonts.get_font(self.line_number_bold, ...
python
wandb/vendor/pygments/formatters/img.py
449
459
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,729
_draw_text
def _draw_text(self, pos, text, font, **kw): """ Remember a single drawable tuple to paint later. """ self.drawables.append((pos, text, font, kw))
python
wandb/vendor/pygments/formatters/img.py
461
465
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,730
_create_drawables
def _create_drawables(self, tokensource): """ Create drawables for the token content. """ lineno = charno = maxcharno = 0 for ttype, value in tokensource: while ttype not in self.styles: ttype = ttype.parent style = self.styles[ttype] ...
python
wandb/vendor/pygments/formatters/img.py
467
498
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,731
_draw_line_numbers
def _draw_line_numbers(self): """ Create drawables for the line numbers. """ if not self.line_numbers: return for p in xrange(self.maxlineno): n = p + self.line_number_start if (n % self.line_number_step) == 0: self._draw_linenu...
python
wandb/vendor/pygments/formatters/img.py
500
509
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,732
_paint_line_number_bg
def _paint_line_number_bg(self, im): """ Paint the line number background on the image. """ if not self.line_numbers: return if self.line_number_fg is None: return draw = ImageDraw.Draw(im) recth = im.size[-1] rectw = self.image_pad...
python
wandb/vendor/pygments/formatters/img.py
511
525
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,733
format
def format(self, tokensource, outfile): """ Format ``tokensource``, an iterable of ``(tokentype, tokenstring)`` tuples and write it into ``outfile``. This implementation calculates where it should draw each token on the pixmap, then calculates the required pixmap size and draws ...
python
wandb/vendor/pygments/formatters/img.py
527
555
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,734
__init__
def __init__(self, fg=None, bg=None, bold=False, underline=False): self.fg = fg self.bg = bg self.bold = bold self.underline = underline
python
wandb/vendor/pygments/formatters/terminal256.py
38
42
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,735
escape
def escape(self, attrs): if len(attrs): return "\x1b[" + ";".join(attrs) + "m" return ""
python
wandb/vendor/pygments/formatters/terminal256.py
44
47
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,736
color_string
def color_string(self): attrs = [] if self.fg is not None: if self.fg in ansicolors: esc = codes[self.fg[5:]] if ';01m' in esc: self.bold = True # extract fg color code. attrs.append(esc[2:4]) els...
python
wandb/vendor/pygments/formatters/terminal256.py
49
71
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,737
true_color_string
def true_color_string(self): attrs = [] if self.fg: attrs.extend(("38", "2", str(self.fg[0]), str(self.fg[1]), str(self.fg[2]))) if self.bg: attrs.extend(("48", "2", str(self.bg[0]), str(self.bg[1]), str(self.bg[2]))) if self.bold: attrs.append("01") ...
python
wandb/vendor/pygments/formatters/terminal256.py
73
83
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,738
reset_string
def reset_string(self): attrs = [] if self.fg is not None: attrs.append("39") if self.bg is not None: attrs.append("49") if self.bold or self.underline: attrs.append("00") return self.escape(attrs)
python
wandb/vendor/pygments/formatters/terminal256.py
85
93
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,739
__init__
def __init__(self, **options): Formatter.__init__(self, **options) self.xterm_colors = [] self.best_match = {} self.style_string = {} self.usebold = 'nobold' not in options self.useunderline = 'nounderline' not in options self._build_color_table() # build an R...
python
wandb/vendor/pygments/formatters/terminal256.py
123
134
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,740
_build_color_table
def _build_color_table(self): # colors 0..15: 16 basic colors self.xterm_colors.append((0x00, 0x00, 0x00)) # 0 self.xterm_colors.append((0xcd, 0x00, 0x00)) # 1 self.xterm_colors.append((0x00, 0xcd, 0x00)) # 2 self.xterm_colors.append((0xcd, 0xcd, 0x00)) # 3 self.xter...
python
wandb/vendor/pygments/formatters/terminal256.py
136
170
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,741
_closest_color
def _closest_color(self, r, g, b): distance = 257*257*3 # "infinity" (>distance from #000000 to #ffffff) match = 0 for i in range(0, 254): values = self.xterm_colors[i] rd = r - values[0] gd = g - values[1] bd = b - values[2] d = rd*...
python
wandb/vendor/pygments/formatters/terminal256.py
172
187
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,742
_color_index
def _color_index(self, color): index = self.best_match.get(color, None) if color in ansicolors: # strip the `#ansi` part and look up code index = color self.best_match[color] = index if index is None: try: rgb = int(str(color), 16) ...
python
wandb/vendor/pygments/formatters/terminal256.py
189
206
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,743
_setup_styles
def _setup_styles(self): for ttype, ndef in self.style: escape = EscapeSequence() # get foreground from ansicolor if set if ndef['ansicolor']: escape.fg = self._color_index(ndef['ansicolor']) elif ndef['color']: escape.fg = self._co...
python
wandb/vendor/pygments/formatters/terminal256.py
208
225
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,744
format
def format(self, tokensource, outfile): # hack: if the output is a terminal and has an encoding set, # use that to avoid unicode encode problems if not self.encoding and hasattr(outfile, "encoding") and \ hasattr(outfile, "isatty") and outfile.isatty() and \ sys.version_inf...
python
wandb/vendor/pygments/formatters/terminal256.py
227
234
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,745
format_unencoded
def format_unencoded(self, tokensource, outfile): for ttype, value in tokensource: not_found = True while ttype and not_found: try: # outfile.write( "<" + str(ttype) + ">" ) on, off = self.style_string[str(ttype)] ...
python
wandb/vendor/pygments/formatters/terminal256.py
236
263
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,746
_build_color_table
def _build_color_table(self): pass
python
wandb/vendor/pygments/formatters/terminal256.py
284
285
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,747
_color_tuple
def _color_tuple(self, color): try: rgb = int(str(color), 16) except ValueError: return None r = (rgb >> 16) & 0xff g = (rgb >> 8) & 0xff b = rgb & 0xff return (r, g, b)
python
wandb/vendor/pygments/formatters/terminal256.py
287
295
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,748
_setup_styles
def _setup_styles(self): for ttype, ndef in self.style: escape = EscapeSequence() if ndef['color']: escape.fg = self._color_tuple(ndef['color']) if ndef['bgcolor']: escape.bg = self._color_tuple(ndef['bgcolor']) if self.usebold and ...
python
wandb/vendor/pygments/formatters/terminal256.py
297
309
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,749
__init__
def __init__(self, **options): r""" Additional options accepted: ``fontface`` Name of the font used. Could for example be ``'Courier New'`` to further specify the default which is ``'\fmodern'``. The RTF specification claims that ``\fmodern`` are "Fixed-pitch...
python
wandb/vendor/pygments/formatters/rtf.py
51
65
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,750
_escape
def _escape(self, text): return text.replace(u'\\', u'\\\\') \ .replace(u'{', u'\\{') \ .replace(u'}', u'\\}')
python
wandb/vendor/pygments/formatters/rtf.py
67
70
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,751
_escape_text
def _escape_text(self, text): # empty strings, should give a small performance improvment if not text: return u'' # escape text text = self._escape(text) buf = [] for c in text: cn = ord(c) if cn < (2**7): # ASCII char...
python
wandb/vendor/pygments/formatters/rtf.py
72
94
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,752
format_unencoded
def format_unencoded(self, tokensource, outfile): # rtf 1.8 header outfile.write(u'{\\rtf1\\ansi\\uc0\\deff0' u'{\\fonttbl{\\f0\\fmodern\\fprq1\\fcharset0%s;}}' u'{\\colortbl;' % (self.fontface and u' ' + self._escape(s...
python
wandb/vendor/pygments/formatters/rtf.py
96
147
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,753
escape_html
def escape_html(text): """Escape &, <, > as well as single and double quotes for HTML.""" return text.replace('&', '&amp;'). \ replace('<', '&lt;'). \ replace('>', '&gt;'). \ replace('"', '&quot;'). \ replace("'", '&#39;')
python
wandb/vendor/pygments/formatters/svg.py
18
24
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,754
__init__
def __init__(self, **options): Formatter.__init__(self, **options) self.nowrap = get_bool_opt(options, 'nowrap', False) self.fontfamily = options.get('fontfamily', 'monospace') self.fontsize = options.get('fontsize', '14px') self.xoffset = get_int_opt(options, 'xoffset', 0) ...
python
wandb/vendor/pygments/formatters/svg.py
80
95
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,755
format_unencoded
def format_unencoded(self, tokensource, outfile): """ Format ``tokensource``, an iterable of ``(tokentype, tokenstring)`` tuples and write it into ``outfile``. For our implementation we put all lines in their own 'line group'. """ x = self.xoffset y = self.yoffse...
python
wandb/vendor/pygments/formatters/svg.py
97
136
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,756
_get_style
def _get_style(self, tokentype): if tokentype in self._stylecache: return self._stylecache[tokentype] otokentype = tokentype while not self.style.styles_token(tokentype): tokentype = tokentype.parent value = self.style.style_for_token(tokentype) result = '...
python
wandb/vendor/pygments/formatters/svg.py
138
153
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,757
__init__
def __init__(self, **options): Formatter.__init__(self, **options) self._code = get_bool_opt(options, 'codetag', False) self._mono = get_bool_opt(options, 'monofont', False) self.styles = {} self._make_styles()
python
wandb/vendor/pygments/formatters/bbcode.py
52
58
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,758
_make_styles
def _make_styles(self): for ttype, ndef in self.style: start = end = '' if ndef['color']: start += '[color=#%s]' % ndef['color'] end = '[/color]' + end if ndef['bold']: start += '[b]' end = '[/b]' + end ...
python
wandb/vendor/pygments/formatters/bbcode.py
60
77
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,759
format_unencoded
def format_unencoded(self, tokensource, outfile): if self._code: outfile.write('[code]') if self._mono: outfile.write('[font=monospace]') lastval = '' lasttype = None for ttype, value in tokensource: while ttype not in self.styles: ...
python
wandb/vendor/pygments/formatters/bbcode.py
79
109
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,760
escape_tex
def escape_tex(text, commandprefix): return text.replace('\\', '\x00'). \ replace('{', '\x01'). \ replace('}', '\x02'). \ replace('\x00', r'\%sZbs{}' % commandprefix). \ replace('\x01', r'\%sZob{}' % commandprefix). \ replace('\x02', r'...
python
wandb/vendor/pygments/formatters/latex.py
24
42
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,761
_get_ttype_name
def _get_ttype_name(ttype): fname = STANDARD_TYPES.get(ttype) if fname: return fname aname = '' while fname is None: aname = ttype[-1] + aname ttype = ttype.parent fname = STANDARD_TYPES.get(ttype) return fname + aname
python
wandb/vendor/pygments/formatters/latex.py
137
146
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,762
__init__
def __init__(self, **options): Formatter.__init__(self, **options) self.docclass = options.get('docclass', 'article') self.preamble = options.get('preamble', '') self.linenos = get_bool_opt(options, 'linenos', False) self.linenostart = abs(get_int_opt(options, 'linenostart', 1)) ...
python
wandb/vendor/pygments/formatters/latex.py
251
271
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,763
_create_stylesheet
def _create_stylesheet(self): t2n = self.ttype2name = {Token: ''} c2d = self.cmd2def = {} cp = self.commandprefix def rgbcolor(col): if col: return ','.join(['%.2f' % (int(col[i] + col[i + 1], 16) / 255.0) for i in (0, 2, 4)])...
python
wandb/vendor/pygments/formatters/latex.py
273
316
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,764
rgbcolor
def rgbcolor(col): if col: return ','.join(['%.2f' % (int(col[i] + col[i + 1], 16) / 255.0) for i in (0, 2, 4)]) else: return '1,1,1'
python
wandb/vendor/pygments/formatters/latex.py
278
283
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,765
get_style_defs
def get_style_defs(self, arg=''): """ Return the command sequences needed to define the commands used to format text in the verbatim environment. ``arg`` is ignored. """ cp = self.commandprefix styles = [] for name, definition in iteritems(self.cmd2def): ...
python
wandb/vendor/pygments/formatters/latex.py
318
329
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,766
format_unencoded
def format_unencoded(self, tokensource, outfile): # TODO: add support for background colors t2n = self.ttype2name cp = self.commandprefix if self.full: realoutfile = outfile outfile = StringIO() outfile.write(u'\\begin{' + self.envname + u'}[commandchars...
python
wandb/vendor/pygments/formatters/latex.py
331
429
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,767
__init__
def __init__(self, left, right, lang, **options): self.left = left self.right = right self.lang = lang Lexer.__init__(self, **options)
python
wandb/vendor/pygments/formatters/latex.py
443
447
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,768
get_tokens_unprocessed
def get_tokens_unprocessed(self, text): buf = '' idx = 0 for i, t, v in self.lang.get_tokens_unprocessed(text): if t in Token.Comment or t in Token.String: if buf: for x in self.get_tokens_aux(idx, buf): yield x ...
python
wandb/vendor/pygments/formatters/latex.py
449
465
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,769
get_tokens_aux
def get_tokens_aux(self, index, text): while text: a, sep1, text = text.partition(self.left) if a: for i, t, v in self.lang.get_tokens_unprocessed(a): yield index + i, t, v index += len(a) if sep1: b, sep...
python
wandb/vendor/pygments/formatters/latex.py
467
482
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,770
get_style_by_name
def get_style_by_name(name): if name in STYLE_MAP: mod, cls = STYLE_MAP[name].split('::') builtin = "yes" else: for found_name, style in find_plugin_styles(): if name == found_name: return style # perhaps it got dropped into our styles package ...
python
wandb/vendor/pygments/styles/__init__.py
50
71
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,771
get_all_styles
def get_all_styles(): """Return an generator for all styles by name, both builtin and plugin.""" for name in STYLE_MAP: yield name for name, _ in find_plugin_styles(): yield name
python
wandb/vendor/pygments/styles/__init__.py
74
80
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,772
__init__
def __init__(self, client): self.client = client
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
14
15
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,773
schema
def schema(self): return self.client.schema
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
18
19
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,774
__getattr__
def __getattr__(self, name): type_def = self.schema.get_type(name) return DSLType(type_def)
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
21
23
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,775
query
def query(self, *args, **kwargs): return self.execute(query(*args, **kwargs))
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
25
26
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,776
mutate
def mutate(self, *args, **kwargs): return self.query(*args, operation='mutate', **kwargs)
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
28
29
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,777
execute
def execute(self, document): return self.client.execute(document)
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
31
32
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,778
__init__
def __init__(self, type): self.type = type
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
36
37
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,779
__getattr__
def __getattr__(self, name): formatted_name, field_def = self.get_field(name) return DSLField(formatted_name, field_def)
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
39
41
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,780
get_field
def get_field(self, name): camel_cased_name = to_camel_case(name) if name in self.type.fields: return name, self.type.fields[name] if camel_cased_name in self.type.fields: return camel_cased_name, self.type.fields[camel_cased_name] raise KeyError('Field {} does...
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
43
52
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,781
selections
def selections(*fields): for _field in fields: yield field(_field).ast
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
55
57
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,782
get_ast_value
def get_ast_value(value): if isinstance(value, ast.Node): return value if isinstance(value, str): return ast.StringValue(value=value) elif isinstance(value, bool): return ast.BooleanValue(value=value) elif isinstance(value, (float, decimal.Decimal)): return ast.FloatValue...
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
60
71
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,783
__init__
def __init__(self, name, field): self.field = field self.ast_field = ast.Field(name=ast.Name(value=name), arguments=[]) self.selection_set = None
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
76
79
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,784
select
def select(self, *fields): if not self.ast_field.selection_set: self.ast_field.selection_set = ast.SelectionSet(selections=[]) self.ast_field.selection_set.selections.extend(selections(*fields)) return self
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
81
85
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,785
__call__
def __call__(self, *args, **kwargs): return self.args(*args, **kwargs)
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
87
88
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,786
alias
def alias(self, alias): self.ast_field.alias = ast.Name(value=alias) return self
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
90
92
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,787
args
def args(self, **args): for name, value in args.items(): arg = self.field.args.get(name) arg_type_serializer = get_arg_serializer(arg.type) value = arg_type_serializer(value) self.ast_field.arguments.append( ast.Argument( name=a...
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
94
105
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,788
ast
def ast(self): return self.ast_field
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
108
109
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,789
__str__
def __str__(self): return print_ast(self.ast_field)
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
111
112
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,790
field
def field(field, **args): if isinstance(field, GraphQLField): return DSLField(field).args(**args) elif isinstance(field, DSLField): return field raise Exception('Received incompatible query field: "{}".'.format(field))
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
115
121
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,791
query
def query(*fields): return ast.Document( definitions=[ast.OperationDefinition( operation='query', selection_set=ast.SelectionSet( selections=list(selections(*fields)) ) )] )
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
124
132
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,792
serialize_list
def serialize_list(serializer, values): assert isinstance(values, Iterable), 'Expected iterable, received "{}"'.format(repr(values)) return [serializer(v) for v in values]
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
135
137
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,793
get_arg_serializer
def get_arg_serializer(arg_type): if isinstance(arg_type, GraphQLNonNull): return get_arg_serializer(arg_type.of_type) if isinstance(arg_type, GraphQLList): inner_serializer = get_arg_serializer(arg_type.of_type) return partial(serialize_list, inner_serializer) if isinstance(arg_type...
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
140
148
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,794
var
def var(name): return ast.Variable(name=name)
python
wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
151
152
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,795
__init__
def __init__(self, retries_count, last_exception): message = "Failed %s retries: %s" % (retries_count, last_exception) super(RetryError, self).__init__(message) self.last_exception = last_exception
python
wandb/vendor/gql-0.2.0/wandb_gql/client.py
13
16
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,796
__init__
def __init__(self, schema=None, introspection=None, type_def=None, transport=None, fetch_schema_from_transport=False, retries=0): assert not(type_def and introspection), 'Cant provide introspection type definition at the same time' if transport and fetch_schema_from_transport: ...
python
wandb/vendor/gql-0.2.0/wandb_gql/client.py
20
39
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,797
validate
def validate(self, document): if not self.schema: raise Exception("Cannot validate locally the document, you need to pass a schema.") validation_errors = validate(self.schema, document) if validation_errors: raise validation_errors[0]
python
wandb/vendor/gql-0.2.0/wandb_gql/client.py
41
46
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,798
execute
def execute(self, document, *args, **kwargs): if self.schema: self.validate(document) result = self._get_result(document, *args, **kwargs) if result.errors: raise Exception(str(result.errors[0])) return result.data
python
wandb/vendor/gql-0.2.0/wandb_gql/client.py
48
56
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,799
_get_result
def _get_result(self, document, *args, **kwargs): if not self.retries: return self.transport.execute(document, *args, **kwargs) last_exception = None retries_count = 0 while retries_count < self.retries: try: result = self.transport.execute(docume...
python
wandb/vendor/gql-0.2.0/wandb_gql/client.py
58
75
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
7,800
to_camel_case
def to_camel_case(snake_str): components = snake_str.split('_') # We capitalize the first letter of each component except the first one # with the 'title' method and join them together. return components[0] + "".join(x.title() if x else '_' for x in components[1:])
python
wandb/vendor/gql-0.2.0/wandb_gql/utils.py
6
10
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }