blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
616
content_id
stringlengths
40
40
detected_licenses
listlengths
0
112
license_type
stringclasses
2 values
repo_name
stringlengths
5
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
777 values
visit_date
timestamp[us]date
2015-08-06 10:31:46
2023-09-06 10:44:38
revision_date
timestamp[us]date
1970-01-01 02:38:32
2037-05-03 13:00:00
committer_date
timestamp[us]date
1970-01-01 02:38:32
2023-09-06 01:08:06
github_id
int64
4.92k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-04 01:52:49
2023-09-14 21:59:50
gha_created_at
timestamp[us]date
2008-05-22 07:58:19
2023-08-21 12:35:19
gha_language
stringclasses
149 values
src_encoding
stringclasses
26 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
3
10.2M
extension
stringclasses
188 values
content
stringlengths
3
10.2M
authors
listlengths
1
1
author_id
stringlengths
1
132
5ee5cb9bf9402ad2216dd4aa9568e06ed20148e8
fc3ffd1a5f4f229bc585f62fe8ae0db55c8a435a
/ml4rt/jtech2021/make_site_figure.py
4ec16416b1ffe3a449e986c5e9e41a278f8de660
[]
no_license
thunderhoser/ml4rt
b587d96ae7094e672d0445458e7b812c33941fc6
517d7cb2008a0ff06014c81e158c13bf8e17590a
refs/heads/master
2023-08-05T04:28:29.691564
2023-07-31T22:25:50
2023-07-31T22:25:50
270,113,792
4
1
null
null
null
null
UTF-8
Python
false
false
4,692
py
"""Creates paneled figure with different views of sites.""" import os import argparse from gewittergefahr.gg_utils import file_system_utils from gewittergefahr.plotting import imagemagick_utils PATHLESS_INPUT_FILE_NAMES = [ 'all_sites.jpg', 'tropical_sites.jpg', 'assorted2_sites.jpg' ] CONVERT_EXE_NAME = '/usr/bin/convert' TITLE_FONT_SIZE = 100 TITLE_FONT_NAME = 'DejaVu-Sans-Bold' PANEL_SIZE_PX = int(5e6) CONCAT_FIGURE_SIZE_PX = int(2e7) INPUT_DIR_ARG_NAME = 'input_dir_name' OUTPUT_DIR_ARG_NAME = 'output_dir_name' INPUT_DIR_HELP_STRING = ( 'Name of input directory, containing images to be paneled together.' ) OUTPUT_DIR_HELP_STRING = ( 'Name of output directory. Output images (paneled figure and temporary ' 'figures) will be saved here.' ) INPUT_ARG_PARSER = argparse.ArgumentParser() INPUT_ARG_PARSER.add_argument( '--' + INPUT_DIR_ARG_NAME, type=str, required=True, help=INPUT_DIR_HELP_STRING ) INPUT_ARG_PARSER.add_argument( '--' + OUTPUT_DIR_ARG_NAME, type=str, required=True, help=OUTPUT_DIR_HELP_STRING ) def _overlay_text( image_file_name, x_offset_from_left_px, y_offset_from_top_px, text_string): """Overlays text on image. :param image_file_name: Path to image file. :param x_offset_from_left_px: Left-relative x-coordinate (pixels). :param y_offset_from_top_px: Top-relative y-coordinate (pixels). :param text_string: String to overlay. :raises: ValueError: if ImageMagick command (which is ultimately a Unix command) fails. """ command_string = ( '"{0:s}" "{1:s}" -pointsize {2:d} -font "{3:s}" ' '-fill "rgb(0, 0, 0)" -annotate {4:+d}{5:+d} "{6:s}" "{1:s}"' ).format( CONVERT_EXE_NAME, image_file_name, TITLE_FONT_SIZE, TITLE_FONT_NAME, x_offset_from_left_px, y_offset_from_top_px, text_string ) exit_code = os.system(command_string) if exit_code == 0: return raise ValueError(imagemagick_utils.ERROR_STRING) def _run(input_dir_name, output_dir_name): """Creates paneled figure with different views of sites. This is effectively the main method. :param input_dir_name: See documentation at top of file. :param output_dir_name: Same. """ file_system_utils.mkdir_recursive_if_necessary( directory_name=output_dir_name ) panel_file_names = [ '{0:s}/{1:s}'.format(input_dir_name, p) for p in PATHLESS_INPUT_FILE_NAMES ] resized_panel_file_names = [ '{0:s}/{1:s}'.format(output_dir_name, p) for p in PATHLESS_INPUT_FILE_NAMES ] letter_label = None for i in range(len(panel_file_names)): print('Resizing panel and saving to: "{0:s}"...'.format( resized_panel_file_names[i] )) imagemagick_utils.trim_whitespace( input_file_name=panel_file_names[i], output_file_name=resized_panel_file_names[i], border_width_pixels=TITLE_FONT_SIZE + 75 ) if letter_label is None: letter_label = 'a' else: letter_label = chr(ord(letter_label) + 1) _overlay_text( image_file_name=resized_panel_file_names[i], x_offset_from_left_px=0, y_offset_from_top_px=TITLE_FONT_SIZE + 150, text_string='({0:s})'.format(letter_label) ) imagemagick_utils.trim_whitespace( input_file_name=resized_panel_file_names[i], output_file_name=resized_panel_file_names[i] ) imagemagick_utils.resize_image( input_file_name=resized_panel_file_names[i], output_file_name=resized_panel_file_names[i], output_size_pixels=PANEL_SIZE_PX ) concat_figure_file_name = '{0:s}/sites_concat.jpg'.format(output_dir_name) print('Concatenating panels to: "{0:s}"...'.format(concat_figure_file_name)) imagemagick_utils.concatenate_images( input_file_names=resized_panel_file_names, output_file_name=concat_figure_file_name, num_panel_rows=len(resized_panel_file_names), num_panel_columns=1 ) imagemagick_utils.trim_whitespace( input_file_name=concat_figure_file_name, output_file_name=concat_figure_file_name ) imagemagick_utils.resize_image( input_file_name=concat_figure_file_name, output_file_name=concat_figure_file_name, output_size_pixels=CONCAT_FIGURE_SIZE_PX ) if __name__ == '__main__': INPUT_ARG_OBJECT = INPUT_ARG_PARSER.parse_args() _run( input_dir_name=getattr(INPUT_ARG_OBJECT, INPUT_DIR_ARG_NAME), output_dir_name=getattr(INPUT_ARG_OBJECT, OUTPUT_DIR_ARG_NAME) )
b32f5035cf85169d11f1cb0b73654819c498f5d6
15fae17aadc1ff83ad84ad2ee3db14ec40c6ffce
/app/articles/admin.py
c6bc56c32480f9df92b025a4cb61be49c96cb0c5
[]
no_license
elmcrest/feincms3-example
2eaaed3bd2bb68b9cfa6c21c9e60b190c193e08f
3ec92b1bb23656d52c3cb46f4a0c8a138a088cbf
refs/heads/master
2020-03-21T23:29:33.704979
2017-08-18T10:08:59
2017-08-18T10:08:59
139,190,393
0
0
null
2018-06-29T19:59:32
2018-06-29T19:59:32
null
UTF-8
Python
false
false
954
py
from __future__ import unicode_literals from django.contrib import admin from feincms3.plugins.versatileimage import AlwaysChangedModelForm from . import models class ImageInline(admin.TabularInline): form = AlwaysChangedModelForm model = models.Image extra = 0 @admin.register(models.Article) class ArticleAdmin(admin.ModelAdmin): date_hierarchy = 'publication_date' inlines = [ImageInline] list_display = [ 'title', 'is_active', 'publication_date', 'category'] list_editable = ['is_active'] list_filter = ['is_active', 'category'] prepopulated_fields = { 'slug': ('title',), } radio_fields = { 'category': admin.HORIZONTAL, } fieldsets = [ (None, { 'fields': ( ('is_active',), ('title', 'slug'), 'publication_date', 'category', 'body', ) }), ]
681140367c0aacb15268f68df64bf7845fba3c57
b0f0473f10df2fdb0018165785cc23c34b0c99e7
/Peach.Core/Lib/nntplib.py
d3212d2505d233f917f2760ad751ae01e67b3489
[]
no_license
wimton/Meter-peach
d9294a56ec0c1fb2d1a2a4acec1c2bf47b0932df
af0302d1789a852746a3c900c6129ed9c15fb0f4
refs/heads/master
2023-04-25T22:54:31.696184
2021-05-19T13:14:55
2021-05-19T13:14:55
355,202,202
0
0
null
null
null
null
UTF-8
Python
false
false
21,500
py
"""An NNTP client class based on RFC 977: Network News Transfer Protocol. Example: >>> from nntplib import NNTP >>> s = NNTP('news') >>> resp, count, first, last, name = s.group('comp.lang.python') >>> print 'Group', name, 'has', count, 'articles, range', first, 'to', last Group comp.lang.python has 51 articles, range 5770 to 5821 >>> resp, subs = s.xhdr('subject', first + '-' + last) >>> resp = s.quit() >>> Here 'resp' is the server response line. Error responses are turned into exceptions. To post an article from a file: >>> f = open(filename, 'r') # file containing article, including header >>> resp = s.post(f) >>> For descriptions of all methods, read the comments in the code below. Note that all arguments and return values representing article numbers are strings, not numbers, since they are rarely used for calculations. """ # RFC 977 by Brian Kantor and Phil Lapsley. # xover, xgtitle, xpath, date methods by Kevan Heydon # Imports import re import socket __all__ = ["NNTP","NNTPReplyError","NNTPTemporaryError", "NNTPPermanentError","NNTPProtocolError","NNTPDataError", "error_reply","error_temp","error_perm","error_proto", "error_data",] # maximal line length when calling readline(). This is to prevent # reading arbitrary length lines. RFC 3977 limits NNTP line length to # 512 characters, including CRLF. We have selected 2048 just to be on # the safe side. _MAXLINE = 2048 # Exceptions raised when an error or invalid response is received class NNTPError(Exception): """Base class for all nntplib exceptions""" def __init__(self, *args): Exception.__init__(self, *args) try: self.response = args[0] except IndexError: self.response = 'No response given' class NNTPReplyError(NNTPError): """Unexpected [123]xx reply""" pass class NNTPTemporaryError(NNTPError): """4xx errors""" pass class NNTPPermanentError(NNTPError): """5xx errors""" pass class NNTPProtocolError(NNTPError): """Response does not begin with [1-5]""" pass class NNTPDataError(NNTPError): """Error in response data""" pass # for backwards compatibility error_reply = NNTPReplyError error_temp = NNTPTemporaryError error_perm = NNTPPermanentError error_proto = NNTPProtocolError error_data = NNTPDataError # Standard port used by NNTP servers NNTP_PORT = 119 # Response numbers that are followed by additional text (e.g. article) LONGRESP = ['100', '215', '220', '221', '222', '224', '230', '231', '282'] # Line terminators (we always output CRLF, but accept any of CRLF, CR, LF) CRLF = '\r\n' # The class itself class NNTP: def __init__(self, host, port=NNTP_PORT, user=None, password=None, readermode=None, usenetrc=True): """Initialize an instance. Arguments: - host: hostname to connect to - port: port to connect to (default the standard NNTP port) - user: username to authenticate with - password: password to use with username - readermode: if true, send 'mode reader' command after connecting. readermode is sometimes necessary if you are connecting to an NNTP server on the local machine and intend to call reader-specific commands, such as `group'. If you get unexpected NNTPPermanentErrors, you might need to set readermode. """ self.host = host self.port = port self.sock = socket.create_connection((host, port)) self.file = self.sock.makefile('rb') self.debugging = 0 self.welcome = self.getresp() # 'mode reader' is sometimes necessary to enable 'reader' mode. # However, the order in which 'mode reader' and 'authinfo' need to # arrive differs between some NNTP servers. Try to send # 'mode reader', and if it fails with an authorization failed # error, try again after sending authinfo. readermode_afterauth = 0 if readermode: try: self.welcome = self.shortcmd('mode reader') except NNTPPermanentError: # error 500, probably 'not implemented' pass except NNTPTemporaryError as e: if user and e.response[:3] == '480': # Need authorization before 'mode reader' readermode_afterauth = 1 else: raise # If no login/password was specified, try to get them from ~/.netrc # Presume that if .netc has an entry, NNRP authentication is required. try: if usenetrc and not user: import netrc credentials = netrc.netrc() auth = credentials.authenticators(host) if auth: user = auth[0] password = auth[2] except IOError: pass # Perform NNRP authentication if needed. if user: resp = self.shortcmd('authinfo user '+user) if resp[:3] == '381': if not password: raise NNTPReplyError(resp) else: resp = self.shortcmd( 'authinfo pass '+password) if resp[:3] != '281': raise NNTPPermanentError(resp) if readermode_afterauth: try: self.welcome = self.shortcmd('mode reader') except NNTPPermanentError: # error 500, probably 'not implemented' pass # Get the welcome message from the server # (this is read and squirreled away by __init__()). # If the response code is 200, posting is allowed; # if it 201, posting is not allowed def getwelcome(self): """Get the welcome message from the server (this is read and squirreled away by __init__()). If the response code is 200, posting is allowed; if it 201, posting is not allowed.""" if self.debugging: print(('*welcome*', repr(self.welcome))) return self.welcome def set_debuglevel(self, level): """Set the debugging level. Argument 'level' means: 0: no debugging output (default) 1: print commands and responses but not body text etc. 2: also print raw lines read and sent before stripping CR/LF""" self.debugging = level debug = set_debuglevel def putline(self, line): """Internal: send one line to the server, appending CRLF.""" line = line + CRLF if self.debugging > 1: print(('*put*', repr(line))) self.sock.sendall(line) def putcmd(self, line): """Internal: send one command to the server (through putline()).""" if self.debugging: print(('*cmd*', repr(line))) self.putline(line) def getline(self): """Internal: return one line from the server, stripping CRLF. Raise EOFError if the connection is closed.""" line = self.file.readline(_MAXLINE + 1) if len(line) > _MAXLINE: raise NNTPDataError('line too long') if self.debugging > 1: print(('*get*', repr(line))) if not line: raise EOFError if line[-2:] == CRLF: line = line[:-2] elif line[-1:] in CRLF: line = line[:-1] return line def getresp(self): """Internal: get a response from the server. Raise various errors if the response indicates an error.""" resp = self.getline() if self.debugging: print(('*resp*', repr(resp))) c = resp[:1] if c == '4': raise NNTPTemporaryError(resp) if c == '5': raise NNTPPermanentError(resp) if c not in '123': raise NNTPProtocolError(resp) return resp def getlongresp(self, file=None): """Internal: get a response plus following text from the server. Raise various errors if the response indicates an error.""" openedFile = None try: # If a string was passed then open a file with that name if isinstance(file, str): openedFile = file = open(file, "w") resp = self.getresp() if resp[:3] not in LONGRESP: raise NNTPReplyError(resp) list = [] while 1: line = self.getline() if line == '.': break if line[:2] == '..': line = line[1:] if file: file.write(line + "\n") else: list.append(line) finally: # If this method created the file, then it must close it if openedFile: openedFile.close() return resp, list def shortcmd(self, line): """Internal: send a command and get the response.""" self.putcmd(line) return self.getresp() def longcmd(self, line, file=None): """Internal: send a command and get the response plus following text.""" self.putcmd(line) return self.getlongresp(file) def newgroups(self, date, time, file=None): """Process a NEWGROUPS command. Arguments: - date: string 'yymmdd' indicating the date - time: string 'hhmmss' indicating the time Return: - resp: server response if successful - list: list of newsgroup names""" return self.longcmd('NEWGROUPS ' + date + ' ' + time, file) def newnews(self, group, date, time, file=None): """Process a NEWNEWS command. Arguments: - group: group name or '*' - date: string 'yymmdd' indicating the date - time: string 'hhmmss' indicating the time Return: - resp: server response if successful - list: list of message ids""" cmd = 'NEWNEWS ' + group + ' ' + date + ' ' + time return self.longcmd(cmd, file) def list(self, file=None): """Process a LIST command. Return: - resp: server response if successful - list: list of (group, last, first, flag) (strings)""" resp, list = self.longcmd('LIST', file) for i in range(len(list)): # Parse lines into "group last first flag" list[i] = tuple(list[i].split()) return resp, list def description(self, group): """Get a description for a single group. If more than one group matches ('group' is a pattern), return the first. If no group matches, return an empty string. This elides the response code from the server, since it can only be '215' or '285' (for xgtitle) anyway. If the response code is needed, use the 'descriptions' method. NOTE: This neither checks for a wildcard in 'group' nor does it check whether the group actually exists.""" resp, lines = self.descriptions(group) if len(lines) == 0: return "" else: return lines[0][1] def descriptions(self, group_pattern): """Get descriptions for a range of groups.""" line_pat = re.compile("^(?P<group>[^ \t]+)[ \t]+(.*)$") # Try the more std (acc. to RFC2980) LIST NEWSGROUPS first resp, raw_lines = self.longcmd('LIST NEWSGROUPS ' + group_pattern) if resp[:3] != "215": # Now the deprecated XGTITLE. This either raises an error # or succeeds with the same output structure as LIST # NEWSGROUPS. resp, raw_lines = self.longcmd('XGTITLE ' + group_pattern) lines = [] for raw_line in raw_lines: match = line_pat.search(raw_line.strip()) if match: lines.append(match.group(1, 2)) return resp, lines def group(self, name): """Process a GROUP command. Argument: - group: the group name Returns: - resp: server response if successful - count: number of articles (string) - first: first article number (string) - last: last article number (string) - name: the group name""" resp = self.shortcmd('GROUP ' + name) if resp[:3] != '211': raise NNTPReplyError(resp) words = resp.split() count = first = last = 0 n = len(words) if n > 1: count = words[1] if n > 2: first = words[2] if n > 3: last = words[3] if n > 4: name = words[4].lower() return resp, count, first, last, name def help(self, file=None): """Process a HELP command. Returns: - resp: server response if successful - list: list of strings""" return self.longcmd('HELP',file) def statparse(self, resp): """Internal: parse the response of a STAT, NEXT or LAST command.""" if resp[:2] != '22': raise NNTPReplyError(resp) words = resp.split() nr = 0 id = '' n = len(words) if n > 1: nr = words[1] if n > 2: id = words[2] return resp, nr, id def statcmd(self, line): """Internal: process a STAT, NEXT or LAST command.""" resp = self.shortcmd(line) return self.statparse(resp) def stat(self, id): """Process a STAT command. Argument: - id: article number or message id Returns: - resp: server response if successful - nr: the article number - id: the message id""" return self.statcmd('STAT ' + id) def __next__(self): """Process a NEXT command. No arguments. Return as for STAT.""" return self.statcmd('NEXT') def last(self): """Process a LAST command. No arguments. Return as for STAT.""" return self.statcmd('LAST') def artcmd(self, line, file=None): """Internal: process a HEAD, BODY or ARTICLE command.""" resp, list = self.longcmd(line, file) resp, nr, id = self.statparse(resp) return resp, nr, id, list def head(self, id): """Process a HEAD command. Argument: - id: article number or message id Returns: - resp: server response if successful - nr: article number - id: message id - list: the lines of the article's header""" return self.artcmd('HEAD ' + id) def body(self, id, file=None): """Process a BODY command. Argument: - id: article number or message id - file: Filename string or file object to store the article in Returns: - resp: server response if successful - nr: article number - id: message id - list: the lines of the article's body or an empty list if file was used""" return self.artcmd('BODY ' + id, file) def article(self, id): """Process an ARTICLE command. Argument: - id: article number or message id Returns: - resp: server response if successful - nr: article number - id: message id - list: the lines of the article""" return self.artcmd('ARTICLE ' + id) def slave(self): """Process a SLAVE command. Returns: - resp: server response if successful""" return self.shortcmd('SLAVE') def xhdr(self, hdr, str, file=None): """Process an XHDR command (optional server extension). Arguments: - hdr: the header type (e.g. 'subject') - str: an article nr, a message id, or a range nr1-nr2 Returns: - resp: server response if successful - list: list of (nr, value) strings""" pat = re.compile('^([0-9]+) ?(.*)\n?') resp, lines = self.longcmd('XHDR ' + hdr + ' ' + str, file) for i in range(len(lines)): line = lines[i] m = pat.match(line) if m: lines[i] = m.group(1, 2) return resp, lines def xover(self, start, end, file=None): """Process an XOVER command (optional server extension) Arguments: - start: start of range - end: end of range Returns: - resp: server response if successful - list: list of (art-nr, subject, poster, date, id, references, size, lines)""" resp, lines = self.longcmd('XOVER ' + start + '-' + end, file) xover_lines = [] for line in lines: elem = line.split("\t") try: xover_lines.append((elem[0], elem[1], elem[2], elem[3], elem[4], elem[5].split(), elem[6], elem[7])) except IndexError: raise NNTPDataError(line) return resp,xover_lines def xgtitle(self, group, file=None): """Process an XGTITLE command (optional server extension) Arguments: - group: group name wildcard (i.e. news.*) Returns: - resp: server response if successful - list: list of (name,title) strings""" line_pat = re.compile("^([^ \t]+)[ \t]+(.*)$") resp, raw_lines = self.longcmd('XGTITLE ' + group, file) lines = [] for raw_line in raw_lines: match = line_pat.search(raw_line.strip()) if match: lines.append(match.group(1, 2)) return resp, lines def xpath(self,id): """Process an XPATH command (optional server extension) Arguments: - id: Message id of article Returns: resp: server response if successful path: directory path to article""" resp = self.shortcmd("XPATH " + id) if resp[:3] != '223': raise NNTPReplyError(resp) try: [resp_num, path] = resp.split() except ValueError: raise NNTPReplyError(resp) else: return resp, path def date (self): """Process the DATE command. Arguments: None Returns: resp: server response if successful date: Date suitable for newnews/newgroups commands etc. time: Time suitable for newnews/newgroups commands etc.""" resp = self.shortcmd("DATE") if resp[:3] != '111': raise NNTPReplyError(resp) elem = resp.split() if len(elem) != 2: raise NNTPDataError(resp) date = elem[1][2:8] time = elem[1][-6:] if len(date) != 6 or len(time) != 6: raise NNTPDataError(resp) return resp, date, time def post(self, f): """Process a POST command. Arguments: - f: file containing the article Returns: - resp: server response if successful""" resp = self.shortcmd('POST') # Raises error_??? if posting is not allowed if resp[0] != '3': raise NNTPReplyError(resp) while 1: line = f.readline() if not line: break if line[-1] == '\n': line = line[:-1] if line[:1] == '.': line = '.' + line self.putline(line) self.putline('.') return self.getresp() def ihave(self, id, f): """Process an IHAVE command. Arguments: - id: message-id of the article - f: file containing the article Returns: - resp: server response if successful Note that if the server refuses the article an exception is raised.""" resp = self.shortcmd('IHAVE ' + id) # Raises error_??? if the server already has it if resp[0] != '3': raise NNTPReplyError(resp) while 1: line = f.readline() if not line: break if line[-1] == '\n': line = line[:-1] if line[:1] == '.': line = '.' + line self.putline(line) self.putline('.') return self.getresp() def quit(self): """Process a QUIT command and close the socket. Returns: - resp: server response if successful""" resp = self.shortcmd('QUIT') self.file.close() self.sock.close() del self.file, self.sock return resp # Test retrieval when run as a script. # Assumption: if there's a local news server, it's called 'news'. # Assumption: if user queries a remote news server, it's named # in the environment variable NNTPSERVER (used by slrn and kin) # and we want readermode off. if __name__ == '__main__': import os newshost = 'news' and os.environ["NNTPSERVER"] if newshost.find('.') == -1: mode = 'readermode' else: mode = None s = NNTP(newshost, readermode=mode) resp, count, first, last, name = s.group('comp.lang.python') print(resp) print(('Group', name, 'has', count, 'articles, range', first, 'to', last)) resp, subs = s.xhdr('subject', first + '-' + last) print(resp) for item in subs: print(("%7s %s" % item)) resp = s.quit() print(resp)
486fda6e1753ed2136f830174096f2c571d665ad
29f830670675cea44bf3aad6e50e98e5b1692f70
/scripts/import_permissions_and_roles.py
867979ebca2c717d403bdf57b45d34d2dce26019
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
forksbot/byceps
02db20149f1f0559b812dacad276e4210993e300
ac29a0cb50e2ef450d4e5ebd33419ed490c96e4f
refs/heads/main
2023-03-04T05:55:07.743161
2021-02-14T06:03:37
2021-02-14T06:19:53
null
0
0
null
null
null
null
UTF-8
Python
false
false
798
py
#!/usr/bin/env python """Import permissions, roles, and their relations from a TOML file. :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ import click from byceps.services.authorization import impex_service from byceps.util.system import get_config_filename_from_env_or_exit from _util import app_context @click.command() @click.argument('data_file', type=click.File()) def execute(data_file): permission_count, role_count = impex_service.import_from_file(data_file) click.secho( f'Imported {permission_count} permissions and {role_count} roles.', fg='green', ) if __name__ == '__main__': config_filename = get_config_filename_from_env_or_exit() with app_context(config_filename): execute()
b936ffc9e6684b9c97da4d88a0f2e59e3e42aab1
cc101e71d4b47e1ade22159bc3273aab5386a49e
/integration-tests/fake_spine/fake_spine/vnp_request_matcher_wrappers.py
3591870d8d4679c49b285dbbc7a413cba93a0ceb
[ "Apache-2.0" ]
permissive
nhsconnect/integration-adaptors
20f613f40562a79428e610df916835f4e3c3e455
8420d9d4b800223bff6a648015679684f5aba38c
refs/heads/develop
2023-02-22T22:04:31.193431
2022-03-15T16:01:25
2022-03-15T16:01:25
179,653,046
15
7
Apache-2.0
2023-08-23T14:52:10
2019-04-05T09:18:56
Python
UTF-8
Python
false
false
803
py
from fake_spine.request_matching import RequestMatcher def async_express(): return RequestMatcher('async-express-vnp', lambda request: '<eb:Action>QUPC_IN160101UK05</eb:Action>' in request.body.decode()) def async_reliable(): return RequestMatcher('async-reliable-vnp', lambda request: '<eb:Action>REPC_IN150016UK05</eb:Action>' in request.body.decode()) def sync(): return RequestMatcher('sync-vnp', lambda request: '<wsa:Action>urn:nhs:names:services:pdsquery/QUPA_IN040000UK32</wsa:Action>' in request.body.decode()) def forward_reliable(): return RequestMatcher('forward-reliable-vnp', lambda request: '<eb:Action>COPC_IN000001UK01</eb:Action>' in request.body.decode())
a2dcbf9b1d89748680c0d4367c744d3038686cc4
8e86b14e153a6c626739d12666d0131c5fcc24fd
/requirements.py
af2e789d7fa56fb50e86563d6fbef6b454a4caeb
[ "MIT" ]
permissive
Kromey/err-nanobot
16e4db659edc142df33fcb48aa637d3f6cc1756a
af07232512b2fc04efb19d5271064decd4c14d08
refs/heads/master
2021-05-04T10:11:47.659386
2017-11-07T21:49:29
2017-11-07T21:49:29
45,268,537
1
0
null
null
null
null
UTF-8
Python
false
false
14
py
pynano==0.1.1
525929dc1eeca4dacff44536fcb21918ee9ee501
3f41bafb8012f264605724dbe9b1a6ee11a1f767
/competitions/EMNIST/resize_380_B4.py
80995b99e649cb8fcb0364b6c8c07df6932621e3
[]
no_license
pervin0527/pervinco
6d0c9aad8dbf6d944960b2e2c963054d1d91b29a
9ced846438130341726e31954cc7e45a887281ef
refs/heads/master
2022-11-26T02:11:00.848871
2022-11-24T00:56:14
2022-11-24T00:56:14
223,062,903
5
3
null
null
null
null
UTF-8
Python
false
false
6,169
py
import cv2, pathlib, datetime, os import numpy as np import pandas as pd import tensorflow as tf from matplotlib import pyplot as plt from functools import partial from tqdm import tqdm from sklearn.model_selection import KFold # GPU setup gpus = tf.config.experimental.list_physical_devices('GPU') if len(gpus) > 1: try: print("Activate Multi GPU") for gpu in gpus: tf.config.experimental.set_memory_growth(gpu, True) strategy = tf.distribute.MirroredStrategy(cross_device_ops=tf.distribute.HierarchicalCopyAllReduce()) except RuntimeError as e: print(e) else: try: print("Activate Sigle GPU") tf.config.experimental.set_memory_growth(gpus[0], True) strategy = tf.distribute.experimental.CentralStorageStrategy() except RuntimeError as e: print(e) # Disable AutoShard. options = tf.data.Options() options.experimental_distribute.auto_shard_policy = tf.data.experimental.AutoShardPolicy.OFF def get_dataset(df): CLASSES = [c for c in df] CLASSES = CLASSES[1:] # print(len(df)) X = np.zeros([len(df), IMG_SIZE, IMG_SIZE, 3], dtype=np.uint8) y = np.zeros([len(df), len(CLASSES)], dtype=np.uint8) for idx in tqdm(range(len(df))): file_name = str(df.iloc[idx, 0]).zfill(5) image = cv2.imread(f'{TRAIN_DS_PATH}/{file_name}.png') image2 = np.where((image <= 254) & (image != 0), 0, image) X[idx] = image2 label = df.iloc[idx, 1:].values.astype('float') y[idx] = label return X, y, CLASSES def normalize_image(image, label): image = tf.image.resize(image, [RE_SIZE, RE_SIZE]) image = tf.cast(image, tf.float32) image = tf.keras.applications.resnet.preprocess_input(image) label = tf.cast(label, tf.float32) return image, label def make_tf_dataset(images, labels): images = tf.data.Dataset.from_tensor_slices(images) labels = tf.data.Dataset.from_tensor_slices(labels) dataset = tf.data.Dataset.zip((images, labels)) dataset = dataset.repeat() dataset = dataset.map(normalize_image, num_parallel_calls=AUTOTUNE) dataset = dataset.batch(BATCH_SIZE) dataset = dataset.prefetch(AUTOTUNE) dataset = dataset.with_options(options) return dataset def get_model(): with strategy.scope(): base_model = tf.keras.applications.EfficientNetB4(input_shape=(RE_SIZE, RE_SIZE, 3), weights='imagenet', # noisy-student include_top=False) base_model.trainable = True avg = tf.keras.layers.GlobalAveragePooling2D()(base_model.output) output = tf.keras.layers.Dense(26, activation="sigmoid")(avg) model = tf.keras.Model(inputs=base_model.input, outputs=output) model.compile(optimizer='adam', loss = 'binary_crossentropy', metrics = ['binary_accuracy']) return model def split_dataset(): df = pd.read_csv(f'{DS_PATH}/dirty_mnist_2nd_answer.csv') kfold = KFold(n_splits=N_FOLD) for fold, (train, valid) in enumerate(kfold.split(df, df.index)): df.loc[valid, 'kfold'] = int(fold) if not(os.path.isdir(f'{DS_PATH}/custom_split')): os.makedirs(f'{DS_PATH}/custom_split') df.to_csv(f'{DS_PATH}/custom_split/split_kfold.csv', index=False) def train_cross_validate(): split_dataset() df = pd.read_csv(f'{DS_PATH}/custom_split/split_kfold.csv') if not(os.path.isdir(f'/{SAVED_PATH}/{LOG_TIME}')): os.makedirs(f'/{SAVED_PATH}/{LOG_TIME}') os.system('clear') for i in range(N_FOLD): df_train = df[df['kfold'] != i].reset_index(drop=True) df_valid = df[df['kfold'] == i].reset_index(drop=True) df_train.drop(['kfold'], axis=1).to_csv(f'{DS_PATH}/custom_split/train-kfold-{i}.csv', index=False) df_valid.drop(['kfold'], axis=1).to_csv(f'{DS_PATH}/custom_split/valid-kfold-{i}.csv', index=False) df_train = pd.read_csv(f'{DS_PATH}/custom_split/train-kfold-{i}.csv') df_valid = pd.read_csv(f'{DS_PATH}/custom_split/valid-kfold-{i}.csv') train_x, train_y, _ = get_dataset(df_train) valid_x, valid_y, _ = get_dataset(df_valid) print('FOLD', i + 1) output_path = f'/{SAVED_PATH}/{LOG_TIME}/{i+1}' os.makedirs(output_path) print(train_x.shape, train_y.shape, valid_x.shape, valid_y.shape) WEIGHT_FNAME = '{epoch:02d}-{val_binary_accuracy:.2f}.hdf5' checkpoint_path = f'{output_path}/{i+1}-{WEIGHT_FNAME}' cb_checkpointer = tf.keras.callbacks.ModelCheckpoint(filepath=checkpoint_path, monitor='val_binary_accuracy', save_best_only=True, mode='max') cb_early_stopping = tf.keras.callbacks.EarlyStopping(monitor='val_loss', patience=5) TRAIN_STEPS_PER_EPOCH = int(tf.math.ceil(len(train_x) / BATCH_SIZE).numpy()) VALID_STEPS_PER_EPOCH = int(tf.math.ceil(len(valid_x) / BATCH_SIZE).numpy()) model = get_model() model.fit(make_tf_dataset(train_x, train_y), steps_per_epoch = TRAIN_STEPS_PER_EPOCH, epochs = EPOCHS, validation_data = make_tf_dataset(valid_x, valid_y), validation_steps = VALID_STEPS_PER_EPOCH, verbose=1, callbacks = [cb_checkpointer, cb_early_stopping]) model.save(f'{output_path}/{i+1}_dmnist.h5') del train_x, train_y del valid_x, valid_y if __name__ == "__main__": EPOCHS = 100 IMG_SIZE = 256 RE_SIZE = IMG_SIZE + 124 AUTOTUNE = tf.data.experimental.AUTOTUNE BATCH_SIZE = 5 * strategy.num_replicas_in_sync N_FOLD = 5 DS_PATH = '/data/tf_workspace/datasets/dirty_mnist_2' SAVED_PATH = '/data/tf_workspace/model/dirty_mnist' TRAIN_DS_PATH = f'{DS_PATH}/dirty_mnist_2nd' LOG_TIME = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M") train_cross_validate()
1446845eeccf87263d870b37805acf3b3c96d21d
4c8c0f857500b5f4b572f139602e46a6c813f6e3
/Polymorhphism_and_Magic_methods_exercises/project/cat.py
12c5083c335f08076e5581860eca49af0764f67d
[]
no_license
svetoslavastoyanova/Python_OOP
3d21fb0480c088ecad11211c2d9a01139cde031f
518f73ecc8a39e7085d4b8bf5657a1556da3dcfa
refs/heads/main
2023-08-04T19:46:58.906739
2021-09-18T07:46:02
2021-09-18T07:46:02
352,304,158
1
0
null
null
null
null
UTF-8
Python
false
false
250
py
from project.animal import Animal class Cat(Animal): def __repr__(self): return f"This is {self.name}. {self.name} is a {self.age} year old {self.gender} {self.__class__.__name__}" def make_sound(self): return f"Meow meow!"
5efcb7fb86370b09e864d1c00759871aabe142ae
593b23cd61932e8206d89e43925f038c86758288
/covid19_pipeline/engine/module.py
c9e80824df08107c21b3a61deabe4888864d0db2
[]
no_license
HDU-DSRC-AI/HKBU_HPML_COVID-19
ad4f311777176d469b07c155e252df26d57f5056
0f685312d26c0b50fffb433408a913243638a14a
refs/heads/master
2022-10-12T09:32:15.635509
2020-06-09T13:53:42
2020-06-09T13:53:42
271,016,743
1
0
null
2020-06-09T13:55:31
2020-06-09T13:55:28
null
UTF-8
Python
false
false
6,807
py
import os from collections import OrderedDict import numpy as np import torch from sklearn import metrics from torchline.engine import MODULE_REGISTRY, DefaultModule, build_module from torchline.utils import AverageMeterGroup, topk_acc from .utils import mixup_data, mixup_loss_fn __all__ = [ 'CTModule' ] @MODULE_REGISTRY.register() class CTModule(DefaultModule): def __init__(self, cfg): super(CTModule, self).__init__(cfg) h, w = self.cfg.input.size self.example_input_array = torch.rand(1, 3, 2, h, w) self.crt_batch_idx = 0 self.inputs = self.example_input_array def training_step_end(self, output): self.print_log(self.trainer.batch_idx, True, self.inputs, self.train_meters) return output def validation_step_end(self, output): self.crt_batch_idx += 1 self.print_log(self.crt_batch_idx, False, self.inputs, self.valid_meters) return output def training_step(self, batch, batch_idx): """ Lightning calls this inside the training loop :param batch: :return: """ try: # forward pass inputs, gt_labels, paths = batch self.crt_batch_idx = batch_idx self.inputs = inputs if self.cfg.mixup.enable: inputs, gt_labels_a, gt_labels_b, lam = mixup_data(inputs, gt_labels, self.cfg.mixup.alpha) mixup_y = [gt_labels_a, gt_labels_b, lam] predictions = self.forward(inputs) # calculate loss if self.cfg.mixup.enable: loss_val = mixup_loss_fn(self.loss, predictions, *mixup_y) else: loss_val = self.loss(predictions, gt_labels) # acc acc_results = topk_acc(predictions, gt_labels, self.cfg.topk) tqdm_dict = {} if self.on_gpu: acc_results = [torch.tensor(x).to(loss_val.device.index) for x in acc_results] # in DP mode (default) make sure if result is scalar, there's another dim in the beginning if self.trainer.use_dp or self.trainer.use_ddp2: loss_val = loss_val.unsqueeze(0) acc_results = [x.unsqueeze(0) for x in acc_results] tqdm_dict['train_loss'] = loss_val for i, k in enumerate(self.cfg.topk): tqdm_dict[f'train_acc_{k}'] = acc_results[i] output = OrderedDict({ 'loss': loss_val, 'progress_bar': tqdm_dict, 'log': tqdm_dict }) self.train_meters.update({key: val.item() for key, val in tqdm_dict.items()}) # can also return just a scalar instead of a dict (return loss_val) return output except Exception as e: print(str(e)) print(batch_idx, paths) pass def validation_step(self, batch, batch_idx): """ Lightning calls this inside the validation loop :param batch: :return: """ inputs, gt_labels, paths = batch self.inputs = inputs predictions = self.forward(inputs) loss_val = self.loss(predictions, gt_labels) # acc val_acc_1, val_acc_k = topk_acc(predictions, gt_labels, self.cfg.topk) if self.on_gpu: val_acc_1 = val_acc_1.cuda(loss_val.device.index) val_acc_k = val_acc_k.cuda(loss_val.device.index) # in DP mode (default) make sure if result is scalar, there's another dim in the beginning if self.trainer.use_dp or self.trainer.use_ddp2: loss_val = loss_val.unsqueeze(0) val_acc_1 = val_acc_1.unsqueeze(0) val_acc_k = val_acc_k.unsqueeze(0) output = OrderedDict({ 'valid_loss': torch.tensor(loss_val), 'valid_acc_1': torch.tensor(val_acc_1), f'valid_acc_{self.cfg.topk[-1]}': val_acc_k, }) tqdm_dict = {k: v for k, v in dict(output).items()} self.valid_meters.update({key: val.item() for key, val in tqdm_dict.items()}) # self.print_log(batch_idx, False, inputs, self.valid_meters) if self.cfg.module.analyze_result: output.update({ 'predictions': predictions.detach(), 'gt_labels': gt_labels.detach(), }) # can also return just a scalar instead of a dict (return loss_val) return output def validation_epoch_end(self, outputs): """ Called at the end of validation to aggregate outputs :param outputs: list of individual outputs of each validation step :return: """ # if returned a scalar from validation_step, outputs is a list of tensor scalars # we return just the average in this case (if we want) # return torch.stack(outputs).mean() self.crt_batch_idx = 0 tqdm_dict = {key: val.avg for key, val in self.valid_meters.meters.items()} valid_loss = torch.tensor(self.valid_meters.meters['valid_loss'].avg) valid_acc_1 = torch.tensor(self.valid_meters.meters['valid_acc_1'].avg) result = {'progress_bar': tqdm_dict, 'log': tqdm_dict, 'valid_loss': valid_loss, 'valid_acc_1': valid_acc_1} if self.cfg.module.analyze_result: predictions = [] gt_labels = [] for output in outputs: predictions.append(output['predictions']) gt_labels.append(output['gt_labels']) predictions = torch.cat(predictions) gt_labels = torch.cat(gt_labels) analyze_result = self.analyze_result(gt_labels, predictions) self.log_info(analyze_result) result.update({'analyze_result': analyze_result, 'predictions': predictions, 'gt_labels': gt_labels}) return result def test_step(self, batch, batch_idx): return self.validation_step(batch, batch_idx) def test_epoch_end(self, outputs): result = self.validation_epoch_end(outputs) predictions = result['predictions'].cpu().detach().numpy() gt_labels = result['gt_labels'].cpu().detach().numpy() path = self.cfg.log.path np.save(os.path.join(path,'predictions.npy'), predictions) np.save(os.path.join(path,'gt_labels.npy'), gt_labels) result = {key:val for key, val in result.items() if key not in ['predictions', 'gt_labels']} return result def analyze_result(self, gt_labels, predictions): ''' Args: gt_lables: tensor (N) predictions: tensor (N*C) ''' return str(metrics.classification_report(gt_labels.cpu(), predictions.cpu().argmax(1), digits=4))
80ff391e57858bfe6654bb74b3b2aad7a68da33c
ab5ef28065b0ad3f8d86fc894be569074a4569ea
/mirari/SV/migrations/0020_auto_20190321_1210.py
063b11284a810c9cdddd97f51c5c6e61e556b605
[ "MIT" ]
permissive
gcastellan0s/mirariapp
1b30dce3ac2ee56945951f340691d39494b55e95
24a9db06d10f96c894d817ef7ccfeec2a25788b7
refs/heads/master
2023-01-22T22:21:30.558809
2020-09-25T22:37:24
2020-09-25T22:37:24
148,203,907
0
0
null
null
null
null
UTF-8
Python
false
false
522
py
# Generated by Django 2.0.5 on 2019-03-21 18:10 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('SV', '0019_auto_20190315_1330'), ] operations = [ migrations.AlterModelOptions( name='ticket', options={'default_permissions': [], 'ordering': ['-id'], 'permissions': [('Can_View__Ticket', 'Ve tickets'), ('Can_Delete__Ticket', 'Elimina tickets')], 'verbose_name': 'Ticket', 'verbose_name_plural': 'Tickets'}, ), ]
ba6e5b9e1e9ff2e71c68568c7835e0414609b61d
0062ceae0071aaa3e4e8ecd9025e8cc9443bcb3b
/solved/2579.py
90890849ba15de80636cc12fe760fd9e34b65942
[]
no_license
developyoun/AlgorithmSolve
8c7479082528f67be9de33f0a337ac6cc3bfc093
5926924c7c44ffab2eb8fd43290dc6aa029f818d
refs/heads/master
2023-03-28T12:02:37.260233
2021-03-24T05:05:48
2021-03-24T05:05:48
323,359,039
0
0
null
null
null
null
UTF-8
Python
false
false
286
py
N = int(input()) arr = [int(input()) for _ in range(N)] dp = [[0, 0] for _ in range(N)] dp[0][0] = arr[0] if N != 1: dp[1][0] = arr[1] dp[1][1] = arr[0] + arr[1] for i in range(2, N): dp[i][0] = max(dp[i-2]) + arr[i] dp[i][1] = dp[i-1][0] + arr[i] print(max(dp[N-1]))
39a0c47ca4248562ba9920e235e06a51a43f6be8
aa76391d5789b5082702d3f76d2b6e13488d30be
/BOJ-Solution/2440.py
442fb8f075508e999d021ff816b95a6a2762b386
[]
no_license
B2SIC/python_playground
118957fe4ca3dc9395bc78b56825b9a014ef95cb
14cbc32affbeec57abbd8e8c4ff510aaa986874e
refs/heads/master
2023-02-28T21:27:34.148351
2021-02-12T10:20:49
2021-02-12T10:20:49
104,154,645
0
0
null
null
null
null
UTF-8
Python
false
false
59
py
n = int(input()) for i in range(0, n): print("*"*(n-i))
190cb5e443625842236cc6cbe8c93583f288a126
6c524d7c4114531dd0b9872090bd7389a3cd3fd8
/poems/migrations/0003_auto_20200731_1245.py
ec917ae86031cdc2623eba1b2a2431d466946ae0
[]
no_license
cement-hools/poems_project
e33bcd03ca8b2b1f1fa558d1036928aee73c87c9
493e6d517b65faab6b25a9fda485e165b6eea03d
refs/heads/master
2022-11-28T02:11:50.837816
2020-08-01T10:12:16
2020-08-01T10:12:16
284,234,726
0
0
null
null
null
null
UTF-8
Python
false
false
1,340
py
# Generated by Django 2.2.14 on 2020-07-31 09:45 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('poems', '0002_auto_20200731_1219'), ] operations = [ migrations.AlterModelOptions( name='poem', options={'ordering': ('title',), 'verbose_name': 'Стихотворение'}, ), migrations.AddField( model_name='poem', name='author', field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='poems.Poet', verbose_name='Автор(ша)'), preserve_default=False, ), migrations.AddField( model_name='poem', name='text', field=models.TextField(default=1, verbose_name='Текст'), preserve_default=False, ), migrations.AddField( model_name='poem', name='title', field=models.CharField(default=1, max_length=250, verbose_name='Название'), preserve_default=False, ), migrations.AddField( model_name='poem', name='year', field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Год(ы)'), ), ]
a15de310a575dd2dfa1b63f03ee73cd8ee65edf5
13084338fa9d1c72fe32d323bcd2df1417b98e83
/src/bxcommon/models/blockchain_peer_info.py
7ad272ad39cc2493b806aa95ec618225f48830a7
[ "MIT" ]
permissive
bloXroute-Labs/bxcommon
ad45e3a060a7d1afd119513248da036818c7f885
03c4cc5adab1ae182e59a609eff273957499ba5d
refs/heads/master
2023-02-22T00:10:46.755175
2022-08-16T19:38:22
2022-08-16T19:38:22
220,556,144
14
7
MIT
2023-02-07T22:58:14
2019-11-08T22:16:37
Python
UTF-8
Python
false
false
896
py
from dataclasses import dataclass from typing import Optional from bxcommon.utils.blockchain_utils.eth import eth_common_constants @dataclass class BlockchainPeerInfo: ip: str port: int node_public_key: Optional[str] = None blockchain_protocol_version: int = eth_common_constants.ETH_PROTOCOL_VERSION connection_established: bool = False def __repr__(self): return f"BlockchainPeerInfo(ip address: {self.ip}, " \ f"port: {self.port}, " \ f"node public key: {self.node_public_key}, " \ f"blockchain protocol version: {self.blockchain_protocol_version})" def __eq__(self, other) -> bool: return ( isinstance(other, BlockchainPeerInfo) and other.port == self.port and other.ip == self.ip ) def __hash__(self): return hash(f"{self.ip}:{self.port}")
b137928399ca34af62b565e767f81889f316ac21
2af28d499c4865311d7b350d7b8f96305af05407
/model-optimizer/mo/front/mxnet/extractor.py
bce78e371dcb4aa4d043ad108a22efe1cbaf7f3d
[ "Apache-2.0" ]
permissive
Dipet/dldt
cfccedac9a4c38457ea49b901c8c645f8805a64b
549aac9ca210cc5f628a63174daf3e192b8d137e
refs/heads/master
2021-02-15T11:19:34.938541
2020-03-05T15:12:30
2020-03-05T15:12:30
244,893,475
1
0
Apache-2.0
2020-03-04T12:22:46
2020-03-04T12:22:45
null
UTF-8
Python
false
false
2,912
py
""" Copyright (c) 2018-2019 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from mo.front.mxnet.extractors.batchnorm import batch_norm_ext from mo.front.mxnet.extractors.concat import concat_ext from mo.front.mxnet.extractors.crop import crop_ext from mo.front.mxnet.extractors.l2_normalization import l2_normalization_ext from mo.front.mxnet.extractors.lrn import lrn_ext from mo.front.mxnet.extractors.multibox_detection import multi_box_detection_ext from mo.front.mxnet.extractors.multibox_prior import multi_box_prior_ext from mo.front.mxnet.extractors.null import null_ext from mo.front.mxnet.extractors.scaleshift import scale_shift_ext from mo.front.mxnet.extractors.slice_axis import slice_axis_ext from mo.front.mxnet.extractors.utils import get_mxnet_layer_attrs from mo.graph.graph import Node from mo.utils.error import Error from mo.utils.utils import refer_to_faq_msg def extractor_wrapper(mxnet_extractor): return lambda node: mxnet_extractor(get_mxnet_layer_attrs(node.symbol_dict)) mxnet_op_extractors = { 'BatchNorm': extractor_wrapper(batch_norm_ext), 'ScaleShift': extractor_wrapper(scale_shift_ext), 'slice_axis': extractor_wrapper(slice_axis_ext), 'null': lambda node: null_ext(node.symbol_dict), 'Concat': extractor_wrapper(concat_ext), 'LRN': extractor_wrapper(lrn_ext), 'L2Normalization': extractor_wrapper(l2_normalization_ext), '_contrib_MultiBoxPrior': extractor_wrapper(multi_box_prior_ext), '_contrib_MultiBoxDetection': extractor_wrapper(multi_box_detection_ext), } def common_mxnet_fields(node: Node): return { 'kind': 'op', 'name': node.id, 'type': node['symbol_dict']['op'], 'op': node['symbol_dict']['op'], 'infer': None, 'precision': 'FP32' } def mxnet_op_extractor(node: Node): result = common_mxnet_fields(node) op = result['op'] if op not in mxnet_op_extractors: raise Error( "Operation '{}' not supported. Please register it as custom op. " + refer_to_faq_msg(86), op) result_attr = mxnet_op_extractors[op](node) if result_attr is None: raise Error('Model Optimizer does not support layer "{}". Please, implement extension. '.format(node.name) + refer_to_faq_msg(45)) result.update(result_attr) supported = bool(result_attr) return supported, result
49881c0afd820a8d03c284c032931f34cb14c3ef
e23a4f57ce5474d468258e5e63b9e23fb6011188
/_use_in_my_scripts/switch/008_decorators_template_Simulating a simple Switch in Python with dict.py
00900f8959a0911755babf3db801ea1c231eaa31
[]
no_license
syurskyi/Python_Topics
52851ecce000cb751a3b986408efe32f0b4c0835
be331826b490b73f0a176e6abed86ef68ff2dd2b
refs/heads/master
2023-06-08T19:29:16.214395
2023-05-29T17:09:11
2023-05-29T17:09:11
220,583,118
3
2
null
2023-02-16T03:08:10
2019-11-09T02:58:47
Python
UTF-8
Python
false
false
459
py
def dow_switch_dict(dow): dow_dict = { 1: lambda: print('Monday'), 2: lambda: print('Tuesday'), 3: lambda: print('Wednesday'), 4: lambda: print('Thursday'), 5: lambda: print('Friday'), 6: lambda: print('Saturday'), 7: lambda: print('Sunday'), 'default': lambda: print('Invalid day of week') } return dow_dict.get(dow, dow_dict['default'])() dow_switch_dict(1) dow_switch_dict(100)
16ca6ca8294bb2452eda7a18ad8e9c5ef5fc649e
a12bd907b26934978a09173039e7eed361d09670
/nbs/models/supplier.py
c1c899d7caac32a40f373b6ffc86e1e8f7ad3a0f
[ "MIT" ]
permissive
coyotevz/nobix-app
489e2dc8cafc40a3022ef02913461e324bc9f752
9523d150e0299b851779f42927992810184e862d
refs/heads/master
2020-12-20T23:22:10.302025
2015-12-18T22:06:44
2015-12-18T22:06:44
32,998,125
0
0
null
null
null
null
UTF-8
Python
false
false
2,051
py
# -*- coding: utf-8 -*- from sqlalchemy.ext.associationproxy import association_proxy from nbs.models import db from nbs.models.entity import Entity class Supplier(Entity): __tablename__ = 'supplier' __mapper_args__ = {'polymorphic_identity': u'supplier'} FREIGHT_SUPPLIER = 'FREIGHT_SUPPLIER' FREIGHT_CUSTOMER = 'FREIGHT_CUSTOMER' _freight_types = { FREIGHT_SUPPLIER: 'Flete de proveedor', FREIGHT_CUSTOMER: 'Flete de cliente', } supplier_id = db.Column(db.Integer, db.ForeignKey('entity.id'), primary_key=True) name = Entity._name_1 fiscal_data_id = db.Column(db.Integer, db.ForeignKey('fiscal_data.id')) fiscal_data = db.relationship('FiscalData', backref=db.backref('supplier', uselist=False)) #: our number as customer with this supplier customer_no = db.Column(db.Unicode) payment_term = db.Column(db.Integer) # in days freight_type = db.Column(db.Enum(*_freight_types.keys(), name='freight_type'), default=FREIGHT_CUSTOMER) leap_time = db.Column(db.Integer) # in days supplier_contacts = db.relationship('SupplierContact', cascade='all,delete-orphan', backref='supplier') contacts = association_proxy('supplier_contacts', 'contact') #: 'bank_accounts' attribute added by BankAccount.supplier relation #: 'purchases' attribute added by PurchaseDocument.supplier relation #: 'orders' attribute added by PurchaseOrder.supplier relation #: Inherited from Entity #: - address (collection) #: - phone (collection) #: - email (collection) #: - extrafield (collection) @property def freight_type_str(self): return self._freight_types[self.freight_type] def add_contact(self, contact, role): self.supplier_contacts.append(SupplierContact(contact, role))
90ad9fcdb2334a3144853bebdcabed989714fc08
d54e1b89dbd0ec5baa6a018464a419e718c1beac
/Python from others/文件/wk_03_分行读取文件.py
ae79c246fb71c837847b4312137a77ae4ae62097
[]
no_license
cjx1996/vscode_Pythoncode
eda438279b7318e6cb73211e26107c7e1587fdfb
f269ebf7ed80091b22334c48839af2a205a15549
refs/heads/master
2021-01-03T19:16:18.103858
2020-05-07T13:51:31
2020-05-07T13:51:31
240,205,057
0
0
null
null
null
null
UTF-8
Python
false
false
207
py
# 1. 打开文件 file = open("README") # 2. 读取文件内容 while True: text = file.readline() # 判断时候有内容 if not text: break print(text) # 3. 关闭 file.close()
bfd6fab30015421b87ddfbb130b4c0fda5ced7dd
8e474edd3954c4679061bb95970ba40e20c39c2d
/pre_analysis/observable_analysis/qtq0eff_mass_mc_intervals.py
83a06fd90bb8b0503b0d5ac9de8309a5479a28ad
[ "MIT" ]
permissive
JinKiwoog/LatticeAnalyser
c12f5c11f2777c343a2e1e1cd4e70e91471b4e79
6179263e30555d14192e80d94121f924a37704c9
refs/heads/master
2020-04-17T18:35:24.240467
2019-01-21T11:25:19
2019-01-21T11:25:19
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,597
py
from pre_analysis.observable_analysis import QtQ0EffectiveMassAnalyser import copy import numpy as np import os from tools.folderreadingtools import check_folder import statistics.parallel_tools as ptools class QtQ0EffectiveMassMCAnalyser(QtQ0EffectiveMassAnalyser): """Correlator of <QtQ0> in euclidean time analysis class.""" observable_name = r"" observable_name_compact = "qtq0effmc" x_label = r"$t_e[fm]$" y_label = r"$am_\textrm{eff} = \ln \frac{\langle Q_{t_e} Q_0 \rangle}{\langle Q_{t_e+1} Q_0 \rangle}$" mark_interval = 1 error_mark_interval = 1 def __str__(self): def info_string(s1, s2): return "\n{0:<20s}: {1:<20s}".format(s1, s2) return_string = "" return_string += "\n" + self.section_seperator return_string += info_string("Data batch folder", self.batch_data_folder) return_string += info_string("Batch name", self.batch_name) return_string += info_string("Observable", self.observable_name_compact) return_string += info_string("Beta", "%.2f" % self.beta) return_string += info_string("Flow time t0", "%.2f" % self.q0_flow_time) return_string += info_string("MC-interval: ", "[%d,%d)" % self.mc_interval) return_string += "\n" + self.section_seperator return return_string def main(): exit("Module QtQ0EffectiveMassAnalyser not intended for standalone usage.") if __name__ == '__main__': main()
455467f723018a27dbe6a7830158e27d70b9d9a8
7a915ae2c07c652cb3abffccd3b1b54c04fd2918
/main/views.py
26333397c360b25743f2035cebddc66815dfc322
[]
no_license
YUNKWANGYOU/healingWheel
410135bd21f9a4f6922051e63bc50fcf090edc3c
416434e5ee8f79b366cdee7b81d58382e073020e
refs/heads/master
2022-10-18T17:59:33.272890
2020-06-14T04:10:36
2020-06-14T04:10:36
264,862,011
0
0
null
null
null
null
UTF-8
Python
false
false
1,211
py
from django.shortcuts import render,redirect from .forms import DrivingTimeForm from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from datetime import timedelta def index(request): return render(request,'main/index.html',) def aboutus(request): return render(request,'main/aboutus.html',) def loc_ren(request): return render(request,'main/loc_ren.html',) def how_to(request): return render(request,'main/how_to.html') def contact(request): return render(request,'main/contact.html') @login_required def charge(request): if request.method == 'POST': us = request.user profile = us.profile if request.POST['detail_menu'] == '10': profile.duration += timedelta(minutes = 10) elif request.POST['detail_menu'] == '30': profile.duration += timedelta(minutes = 30) else: profile.duration += timedelta(minutes = 60) profile.save() return redirect('profile') return render(request,'main/charge.html',{ }) @login_required def profile(request): us = request.user return render(request,'main/profile.html',{ 'user' : us })
abe9c326d87ac84ae84d1b1abc67baad6d8cd389
657d549ffa47c4ef599aa5e0f5760af8de77fec4
/src/runner/predictors/base_predictor.py
865569b96277b12446c2ca90d1e3595b99495a53
[]
no_license
Tung-I/Incremental_Learning
68357d3db5a646aa6b3df844b85e12fa45e3eb3e
95602f404ab8dd627c5dd5fcc94a4a071ad330ab
refs/heads/master
2021-01-14T15:18:21.941132
2020-03-30T04:04:13
2020-03-30T04:04:13
242,659,450
2
0
null
null
null
null
UTF-8
Python
false
false
2,531
py
import logging import torch from tqdm import tqdm from src.runner.utils import EpochLog LOGGER = logging.getLogger(__name__.split('.')[-1]) class BasePredictor: """The base class for all predictors. Args: device (torch.device): The device. test_dataloader (Dataloader): The testing dataloader. net (BaseNet): The network architecture. loss_fns (LossFns): The loss functions. loss_weights (LossWeights): The corresponding weights of loss functions. metric_fns (MetricFns): The metric functions. """ def __init__(self, saved_dir, device, test_dataloader, net, loss_fns, loss_weights, metric_fns): self.saved_dir = saved_dir self.device = device self.test_dataloader = test_dataloader self.net = net.to(device) self.loss_fns = loss_fns self.loss_weights = loss_weights self.metric_fns = metric_fns def predict(self): """The testing process. """ self.net.eval() dataloader = self.test_dataloader pbar = tqdm(dataloader, desc='test', ascii=True) epoch_log = EpochLog() for i, batch in enumerate(pbar): with torch.no_grad(): test_dict = self._test_step(batch) loss = test_dict['loss'] losses = test_dict.get('losses') metrics = test_dict.get('metrics') if (i + 1) == len(dataloader) and not dataloader.drop_last: batch_size = len(dataloader.dataset) % dataloader.batch_size else: batch_size = dataloader.batch_size epoch_log.update(batch_size, loss, losses, metrics) pbar.set_postfix(**epoch_log.on_step_end_log) test_log = epoch_log.on_epoch_end_log LOGGER.info(f'Test log: {test_log}.') def _test_step(self, batch): """The user-defined testing logic. Args: batch (dict or sequence): A batch of the data. Returns: test_dict (dict): The computed results. test_dict['loss'] (torch.Tensor) test_dict['losses'] (dict, optional) test_dict['metrics'] (dict, optional) """ raise NotImplementedError def load(self, path): """Load the model checkpoint. Args: path (Path): The path to load the model checkpoint. """ checkpoint = torch.load(path, map_location='cpu') self.net.load_state_dict(checkpoint['net'])
0f0b1fd4c55e34e3152eb2d5b014c46a1f681429
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p03125/s620551773.py
2fa87780ec501f96d186ec29b97ba692ec344e65
[]
no_license
Aasthaengg/IBMdataset
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
refs/heads/main
2023-04-22T10:22:44.763102
2021-05-13T17:27:22
2021-05-13T17:27:22
367,112,348
0
0
null
null
null
null
UTF-8
Python
false
false
105
py
A, B = map(int, raw_input().split()) if B % A == 0: ans = A + B else: ans = B - A print str(ans)
dfe4cdb4b2cd3b16377380d041e286d9589ad92f
a26b8a208259b61ad5d77a9092d0edf02a7f5fe3
/爬虫/py/zeran_answer.py
67edd655f6fbf8abedfe14a057a2ad70c2e5c55f
[]
no_license
yiyue21/PythonCode
e088aa8661c0c88bd9971a2f1f7cd1cac9eaf1c6
39445a0898c404836f3c60fd067d8489ab804fb4
refs/heads/master
2020-06-19T04:23:28.019604
2019-06-09T17:08:45
2019-06-09T17:08:45
null
0
0
null
null
null
null
UTF-8
Python
false
false
89,180
py
#coding:utf-8 import requests import re text = u"{"paging": {"is_end": false, "totals": 2628, "previous": "https://www.zhihu.com/api/v4/members/ze.ran/answers?sort_by=created&include=data%5B%2A%5D.is_normal%2Cadmin_closed_comment%2Creward_info%2Cis_collapsed%2Cannotation_action%2Cannotation_detail%2Ccollapse_reason%2Ccollapsed_by%2Csuggest_edit%2Ccomment_count%2Ccan_comment%2Ccontent%2Cvoteup_count%2Creshipment_settings%2Ccomment_permission%2Cmark_infos%2Ccreated_time%2Cupdated_time%2Creview_info%2Cquestion%2Cexcerpt%2Crelationship.is_authorized%2Cvoting%2Cis_author%2Cis_thanked%2Cis_nothelp%2Cupvoted_followees%3Bdata%5B%2A%5D.author.badge%5B%3F%28type%3Dbest_answerer%29%5D.topics&limit=20&offset=20", "is_start": false, "next": "https://www.zhihu.com/api/v4/members/ze.ran/answers?sort_by=created&include=data%5B%2A%5D.is_normal%2Cadmin_closed_comment%2Creward_info%2Cis_collapsed%2Cannotation_action%2Cannotation_detail%2Ccollapse_reason%2Ccollapsed_by%2Csuggest_edit%2Ccomment_count%2Ccan_comment%2Ccontent%2Cvoteup_count%2Creshipment_settings%2Ccomment_permission%2Cmark_infos%2Ccreated_time%2Cupdated_time%2Creview_info%2Cquestion%2Cexcerpt%2Crelationship.is_authorized%2Cvoting%2Cis_author%2Cis_thanked%2Cis_nothelp%2Cupvoted_followees%3Bdata%5B%2A%5D.author.badge%5B%3F%28type%3Dbest_answerer%29%5D.topics&limit=20&offset=60"}, "data": [{"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u5411\u5f80\u4e8b\u81f4\u656c\uff0c\u4e3a\u9752\u6625\u4e70\u5355\u3002", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1495856597, "id": 175137221, "voteup_count": 247, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/175137221", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1309518830, "url": "https://www.zhihu.com/api/v4/questions/19744711", "title": "\u4ec0\u4e48\u662f\u60c5\u6000\uff1f", "type": "question", "id": 19744711, "updated_time": 1365174164}, "updated_time": 1495856598, "content": "\u5411\u5f80\u4e8b\u81f4\u656c\uff0c\u4e3a\u9752\u6625\u4e70\u5355\u3002", "comment_count": 18, "extras": "", "reshipment_settings": "allowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": true, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u5341\u51e0\u5e74\u524d\uff0c\u6211\u6b63\u7528 VC++, WTL \u5199 ActiveX\u3002\u90a3\u662f\u4e2a windows \u7a0b\u5e8f\uff0c\u51e0\u5343\u4e2a\u5546\u4e1a\u7528\u6237\u4f7f\u7528\uff0c\u5206\u5e03\u5728\u4e16\u754c\u5404\u5730\uff0c\u5404\u5730\u8fd8\u6709\u5206\u516c\u53f8\uff0c\u5f00\u53d1\u81ea\u5df1\u7684\u5546\u4e1a\u6a21\u5757\uff0c\u6211\u4eec\u516c\u53f8\u8d1f\u8d23\u4e3b\u7a0b\u5e8f\u3002VC++\u5199\u7684\u6846\u67b6\u91cc\u5d4c\u5957\u4e86IE\u7684\u63a7\u4ef6\uff0cIE\u8c03\u7528ActiveX\u63a7\u4ef6\uff0c\u5e76\u68c0\u6d4b\u662f\u5426\u6709\u6700\u65b0\u7248\u672c\uff0c\u81ea\u52a8\u5347\u7ea7\u3002\u8fd9\u4e5f\u2026", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1495535576, "id": 173537489, "voteup_count": 698, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/173537489", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1495175244, "url": "https://www.zhihu.com/api/v4/questions/60044384", "title": "\u7a0b\u5e8f\u5458\u6240\u79ef\u7d2f\u7684\u7f16\u7a0b\u77e5\u8bc6\u5728\u5341\u5e74\u540e\u5c06\u6709\u591a\u5c11\u53d8\u5f97\u6ca1\u7528\uff1f", "type": "question", "id": 60044384, "updated_time": 1495175244}, "updated_time": 1495546331, "content": "<p>\u5341\u51e0\u5e74\u524d\uff0c\u6211\u6b63\u7528 VC++, WTL \u5199 ActiveX\u3002<\/p><p>\u90a3\u662f\u4e2a windows \u7a0b\u5e8f\uff0c\u51e0\u5343\u4e2a\u5546\u4e1a\u7528\u6237\u4f7f\u7528\uff0c\u5206\u5e03\u5728\u4e16\u754c\u5404\u5730\uff0c\u5404\u5730\u8fd8\u6709\u5206\u516c\u53f8\uff0c\u5f00\u53d1\u81ea\u5df1\u7684\u5546\u4e1a\u6a21\u5757\uff0c\u6211\u4eec\u516c\u53f8\u8d1f\u8d23\u4e3b\u7a0b\u5e8f\u3002<\/p><p>VC++\u5199\u7684\u6846\u67b6\u91cc\u5d4c\u5957\u4e86IE\u7684\u63a7\u4ef6\uff0cIE\u8c03\u7528ActiveX\u63a7\u4ef6\uff0c\u5e76\u68c0\u6d4b\u662f\u5426\u6709\u6700\u65b0\u7248\u672c\uff0c\u81ea\u52a8\u5347\u7ea7\u3002\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u8981\u7528ActiveX\u3002\u81f3\u4e8eWTL\uff0c\u5f53\u65f6\u7f51\u7edc\u6162\uff0cWTL\u5199\u51fa\u7684UI\u7701\u7a7a\u95f4\uff0c\u6240\u4ee5\u7528\u5b83\u3002<\/p><p>\u540e\u6765\u6211\u4eec\u8001\u5927\u53d1\u73b0\uff0c\u5206\u516c\u53f8\u7684\u4ebaC++\u4e0d\u884c\uff0c\u7ecf\u5e38\u5199bug\uff0c\u628a\u6574\u4e2a\u7a0b\u5e8f\u641e\u5d29\u6e83\uff0c\u75db\u5b9a\u601d\u75db\uff0c\u5728\u6846\u67b6\u91cc\u53c8\u5d4c\u5957\u4e86\u4e2a Web \u63a7\u4ef6\uff0c\u8ba9\u5927\u5bb6\u7528 HTML\uff0cjavascript\u5199\u6a21\u5757\uff0c\u4ece\u6b64\u5c31\u544a\u522b\u4e86C++\u5199UI\u7684\u523a\u6fc0\u751f\u6d3b\u3002\u8fd9\u90e8\u5206\u91cd\u6784\u8fd8\u662f\u6211\u8d1f\u8d23\u7684\u3002<\/p><p>\u5f53\u7136\uff0c\u73b0\u5728\u6211\u4e0d\u5199\u8fd9\u4e9b\u4e1c\u897f\u4e86\uff0c\u6280\u672f\u7ec6\u8282\u4e5f\u5fd8\u7684\u5dee\u4e0d\u591a\u4e86\u3002<\/p><p>\u4f46\u662f\uff0c\u518d\u770b\u770b\u90a3\u65f6\u9762\u5bf9\u7684\u95ee\u9898\uff0c\u662f\u4e0d\u662f\u6709\u4e9b\u773c\u719f\uff1f<\/p><p>IE\u63a7\u4ef6\uff0cActiveX\uff0cWTL\uff0cHTML\uff0c\u8bf4\u5230\u5e95\uff0c\u5c31\u662f\u4e3a\u4e86\u70ed\u66f4\u65b0\u3002<\/p><p>\u6301\u7eed\u96c6\u6210\uff0c\u6301\u7eed\u4ea4\u4ed8\uff0c\u70ed\u66f4\u65b0\uff0c\u5f53\u524d\u7684 app \u4e5f\u6709\u7740\u5404\u79cd\u5404\u6837\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u800c\u4e14\u539f\u7406\u4e0a\uff0c\u548c\u5341\u51e0\u5e74\u524d\u6211\u4eec\u7684\u7cfb\u7edf\u4e5f\u4e00\u8109\u76f8\u627f\u3002<\/p><p>\u6280\u672f\u53d8\u4e86\uff0c\u5e73\u53f0\u53d8\u4e86\uff0c\u4f46\u95ee\u9898\u7684\u6a21\u5f0f\u6ca1\u53d8\u3002<\/p><p>\u6280\u672f\u7ec6\u8282\uff0c\u4f1a\u968f\u7740\u6280\u672f\u6d88\u4ea1\uff0c\u4f46\u7559\u4e0b\u6765\u7684\u662f\u5206\u6790\u95ee\u9898\uff0c\u89e3\u51b3\u95ee\u9898\u7684\u80fd\u529b\u3002<\/p><p>\u5b66\u4e00\u4e2a\u7c7b\u5e93\uff0c\u53ef\u80fd\u4e00\u4e24\u5e74\u6709\u7528\u3002<\/p><p>\u638c\u63e1\u4e2a\u6846\u67b6\uff0c\u53ef\u80fd\u4e09\u56db\u5e74\u6709\u7528\u3002<\/p><p>\u80cc\u4f1a\u4e2a\u6807\u51c6\uff0c\u53ef\u80fd\u4e94\u516d\u5e74\u6709\u7528\u3002<\/p><p>\u5b66\u4f1a\u95e8\u8bed\u8a00\uff0c\u53ef\u80fd\u4e03\u516b\u5e74\u6709\u7528\u3002<\/p><p>\u5927\u5b66\u91cc\u7684\u57fa\u7840\u8bfe\uff0c\u53ef\u80fd\u5341\u5e74\u4ee5\u4e0a\u90fd\u6709\u7528\u3002<\/p><p>\u90a3\u53c8\u5982\u4f55\uff1f<\/p><p>\u6846\u67b6\u6709\u5751\uff0c\u4eca\u5929\u4f60\u8e29\u4e86\uff0c\u5c31\u7b97\u4ee5\u540e\u6ca1\u7528\uff0c\u4f60\u4e5f\u5f97\u60f3\u6cd5\u7ed9\u5b83\u586b\u4e86\uff0c\u65e5\u5b50\u8981\u8fc7\uff0c\u9879\u76ee\u8981\u4ea4\uff0c\u53ea\u8981\u4eca\u5929\u6709\u7528\uff0c\u90a3\u5c31\u8981\u5b66\uff01<\/p><p>Javascript \u90a3\u4e48\u591a\u5751\uff0c\u524d\u7aef\u5e93\u5982\u8fc7\u6c5f\u4e4b\u9cab\uff0c\u8fd8\u4e0d\u5f97\u542d\u54e7\u542d\u54e7\u7684\u5b66\uff0c\u8c01\u4e5f\u4e0d\u6562\u8bf4\uff0c\u8fd9\u6280\u672f\u5341\u5e74\u540e\u53ef\u80fd\u7528\u4e0d\u4e0a\uff0c\u6240\u4ee5\u5c31\u4e0d\u5b66\u4e86\u3002<\/p><p>\u6280\u672f\u662f\u53d8\u7740\u6cd5\u7684\u89e3\u51b3\u95ee\u9898\uff0c\u4e00\u4e2a\u6280\u672f\u6d88\u5931\uff0c\u610f\u5473\u7740\u6709\u66f4\u597d\u7684\u89e3\u6cd5\u4e86\uff0c\u4e0d\u5fc5\u7ea0\u7ed3\uff0c\u628a\u773c\u5149\u653e\u5728\u5206\u6790\u95ee\u9898\uff0c\u89e3\u51b3\u95ee\u9898\u4e0a\uff0c\u5f80\u5f80\u4f1a\u6709\u66f4\u597d\u7684\u63d0\u9ad8\u3002<\/p>", "comment_count": 52, "extras": "", "reshipment_settings": "allowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": true, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u201c\u56fd\u5185\u7a7a\u6c14\u4e0d\u597d...\u201d\u542c\u8fc7\u5f88\u591a\u4eba\u8bf4\u8fd9\u53e5\u8bdd\uff0c\u6709\u56fd\u5185\u7684\u540c\u5b66\uff0c\u56fd\u5916\u7684\u670b\u53cb\uff0c\u6211\u7238\u5988\u4e5f\u8bf4\u8fc7\u3002\u6709\u7684\u4eba\u607c\u706b\uff0c\u6709\u7684\u4eba\u65e0\u5948\uff0c\u6709\u7684\u53ea\u662f\u968f\u53e3\u8bf4\u8bf4\uff0c\u4f46\u6ca1\u4eba\u5174\u9ad8\u91c7\u70c8\uff0c\u5f97\u610f\u6d0b\u6d0b\u3002\u770b\u4e86\u89c6\u9891\uff0c\u5bf9\u4e8e\u56fd\u5185\u7684\u4e0d\u597d\uff0c\u8fd9\u4f4d\u5973\u751f\u662f\u6709\u51e0\u5206\u5f97\u610f\u7684\u3002\u5f97\u610f\u7684\u662f\uff0c\u6211\u4e0d\u4f4f\u5728\u90a3\u91cc\u4e86\uff0c\u80fd\u77e5\u9053\u4ed6\u4eec\u5f88\u7cdf\u2026", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1495503461, "id": 173288843, "voteup_count": 1212, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/173288843", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1495401294, "url": "https://www.zhihu.com/api/v4/questions/60142187", "title": "\u5982\u4f55\u770b\u5f85\u6bd5\u4e1a\u751f\u6768\u8212\u5e73\u5728\u9a6c\u91cc\u5170\u5927\u5b66 2017 \u5e74\u6bd5\u4e1a\u5178\u793c\u7684\u53d1\u8a00?", "type": "question", "id": 60142187, "updated_time": 1502006717}, "updated_time": 1495536370, "content": "<p>\u201c\u56fd\u5185\u7a7a\u6c14\u4e0d\u597d...\u201d<\/p><p>\u542c\u8fc7\u5f88\u591a\u4eba\u8bf4\u8fd9\u53e5\u8bdd\uff0c\u6709\u56fd\u5185\u7684\u540c\u5b66\uff0c\u56fd\u5916\u7684\u670b\u53cb\uff0c\u6211\u7238\u5988\u4e5f\u8bf4\u8fc7\u3002<\/p><p>\u6709\u7684\u4eba\u607c\u706b\uff0c\u6709\u7684\u4eba\u65e0\u5948\uff0c\u6709\u7684\u53ea\u662f\u968f\u53e3\u8bf4\u8bf4\uff0c\u4f46\u6ca1\u4eba\u5174\u9ad8\u91c7\u70c8\uff0c\u5f97\u610f\u6d0b\u6d0b\u3002<\/p><p>\u770b\u4e86\u89c6\u9891\uff0c\u5bf9\u4e8e\u56fd\u5185\u7684\u4e0d\u597d\uff0c\u8fd9\u4f4d\u5973\u751f\u662f\u6709\u51e0\u5206\u5f97\u610f\u7684\u3002\u5f97\u610f\u7684\u662f\uff0c\u6211\u4e0d\u4f4f\u5728\u90a3\u91cc\u4e86\uff0c\u80fd\u77e5\u9053\u4ed6\u4eec\u5f88\u7cdf\u7cd5\uff0c\u6211\u5f88\u5f00\u5fc3\uff0c\u8fd8\u8981\u628a\u5f00\u5fc3\u5206\u4eab\u7ed9\u65b0\u540c\u80de\u4eec\u542c\u3002<\/p><p>\u6709\u79cd\u9694\u5cb8\u89c2\u706b\u7684\u5feb\u611f\u3002<\/p><p>\u914d\u4e0a\u505a\u4f5c\u7684\u6f14\u8bb2\u98ce\u683c\uff0c\u8c04\u5a9a\u7684\u8868\u8fbe\u65b9\u5f0f\uff0c\u770b\u8d77\u6765\u5206\u5916\u7684\u714e\u71ac\u3002<\/p><p>\u7b97\u4e0d\u4e0a\u8fb1\u534e\uff0c\u4f46\u8ba9\u4eba\u53cd\u611f\u3002<\/p>", "comment_count": 102, "extras": "", "reshipment_settings": "allowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": true, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u4e0d\u4f1a\u3002 \u548c\u7236\u6bcd\u4e0d\u540c\u7684\u662f\uff0c\u6211\u4eec\u8fd9\u4e00\u4ee3\u666e\u904d\u63a5\u53d7\u8fc7\u57fa\u7840\u7684\u7406\u5316\u6559\u80b2\uff0c\u5177\u5907\u57fa\u672c\u7406\u8bba\u77e5\u8bc6\u3002\u5bf9\u4e8e\u7236\u6bcd\uff0c\u79d1\u6280\u4ea7\u54c1\u662f\u9ed1\u9b54\u6cd5\uff0c\u662f\u795e\u79d8\u7684\uff0c\u4e0d\u53ef\u7406\u89e3\u7684\uff1b\u800c\u5bf9\u6211\u4eec\uff0c\u5b83\u4eec\u5e76\u4e0d\u795e\u79d8\uff0c\u56e0\u4e3a\u77e5\u9053\u5927\u6982\u7684\u539f\u7406\u3002\u9664\u975e\u5728\u672a\u6765\u4e8c\u5341\u5e74\u51fa\u73b0\u98a0\u8986\u6027\u7406\u8bba\uff0c\u5e76\u5e7f\u6cdb\u5e94\u7528\u4e8e\u751f\u6d3b\u4ea7\u54c1\uff0c\u5426\u5219\u60f3\u4e0d\u51fa\u6709\u2026", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1495255524, "id": 172021569, "voteup_count": 672, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/172021569", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1495176071, "url": "https://www.zhihu.com/api/v4/questions/60044902", "title": "\u6211\u4eec\u8001\u540e\uff0c\u4f1a\u50cf\u7236\u8f88\u4eba\u4e00\u6837\u4e0d\u719f\u6089\u4ee5\u540e\u7684\u79d1\u6280\u5417\uff1f", "type": "question", "id": 60044902, "updated_time": 1495360534}, "updated_time": 1495255525, "content": "\u4e0d\u4f1a\u3002<br><br>\u548c\u7236\u6bcd\u4e0d\u540c\u7684\u662f\uff0c\u6211\u4eec\u8fd9\u4e00\u4ee3\u666e\u904d\u63a5\u53d7\u8fc7\u57fa\u7840\u7684\u7406\u5316\u6559\u80b2\uff0c\u5177\u5907\u57fa\u672c\u7406\u8bba\u77e5\u8bc6\u3002\u5bf9\u4e8e\u7236\u6bcd\uff0c\u79d1\u6280\u4ea7\u54c1\u662f\u9ed1\u9b54\u6cd5\uff0c\u662f\u795e\u79d8\u7684\uff0c\u4e0d\u53ef\u7406\u89e3\u7684\uff1b\u800c\u5bf9\u6211\u4eec\uff0c\u5b83\u4eec\u5e76\u4e0d\u795e\u79d8\uff0c\u56e0\u4e3a\u77e5\u9053\u5927\u6982\u7684\u539f\u7406\u3002\u9664\u975e\u5728\u672a\u6765\u4e8c\u5341\u5e74\u51fa\u73b0\u98a0\u8986\u6027\u7406\u8bba\uff0c\u5e76\u5e7f\u6cdb\u5e94\u7528\u4e8e\u751f\u6d3b\u4ea7\u54c1\uff0c\u5426\u5219\u60f3\u4e0d\u51fa\u6709\u4ec0\u4e48\u7406\u89e3\u4e0d\u4e86\u7684\u5730\u65b9\u3002<br><br>\u53e6\u4e00\u70b9\u4e0d\u540c\u7684\u662f\uff0c\u7236\u6bcd\u662f\u5728\u5173\u7cfb\u793e\u4f1a\u91cc\u957f\u5927\u7684\uff0c\u5c24\u5176\u662f\u7ecf\u5386\u8fc7\u6587\u9769\u7684\u4e00\u4ee3\uff0c\u5bf9\u4e8e\u77e5\u8bc6\u662f\u6709\u4e9b\u4e0d\u4e0a\u5fc3\u7684\uff0c\u66f4\u770b\u91cd\u4eba\u9645\u5173\u7cfb\uff1b\u800c\u6211\u4eec\u8fd9\u4e00\u4ee3\u662f\u5728\u5e94\u8bd5\u6559\u80b2\u4e0b\u957f\u5927\u7684\uff0c\u5bf9\u4e8e\u77e5\u8bc6\u4e0d\u591f\u6709\u79cd\u672c\u80fd\u7684\u5371\u673a\u611f\uff0c\u66f4\u5bb3\u6015\u8ddf\u4e0d\u4e0a\u65f6\u4ee3\u7684\u811a\u6b65\uff0c\u6240\u4ee5\u66f4\u6709\u9a71\u52a8\u529b\u63a5\u53d7\u65b0\u77e5\u8bc6\u3002", "comment_count": 98, "extras": "", "reshipment_settings": "allowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": true, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u77e5\u8bc6\u4f53\u7cfb\uff0c\u5f88\u5927\u7a0b\u5ea6\u4e0a\u8bf4\uff0c\u5c31\u662f\u4e00\u7ec4\u4e92\u76f8\u8054\u7cfb\u7684\u77e5\u8bc6\u70b9\u3002 \u800c\u77e5\u8bc6\u70b9\uff0c\u5177\u4f53\u5230\u788e\u7247\u9605\u8bfb\u4e0a\uff0c\u5c31\u662f\u90a3\u4e9b\u6bb5\u843d\u4e2d\u770b\u4e0d\u61c2\u7684\u672f\u8bed\uff0c\u7f29\u5199\uff0c\u6982\u5ff5\u3002\u600e\u4e48\u529e\uff1f \u67e5\uff01 \u770b\u4e0d\u61c2\u5c31\u67e5\uff0cgoogle/\u7ef4\u57fa/\u767e\u5ea6\uff0c\u7acb\u523b\u67e5\uff0c\u5148\u67e5\u51fa\u5b83\u662f\u4ec0\u4e48\uff0c\u6ca1\u5174\u8da3\uff0c\u5c31\u5230\u6b64\u4e3a\u6b62\uff0c\u6709\u5174\u8da3\uff0c\u5c31\u6269\u5c55\u8c03\u67e5\uff0c\u95ee\u4e24\u4e2a\u95ee\u9898\u2026", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1494814276, "id": 169590099, "voteup_count": 195, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/169590099", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1391924713, "url": "https://www.zhihu.com/api/v4/questions/22696632", "title": "\u788e\u7247\u9605\u8bfb\u5982\u4f55\u5f62\u6210\u77e5\u8bc6\u4f53\u7cfb\uff1f", "type": "question", "id": 22696632, "updated_time": 1495635538}, "updated_time": 1494814276, "content": "\u77e5\u8bc6\u4f53\u7cfb\uff0c\u5f88\u5927\u7a0b\u5ea6\u4e0a\u8bf4\uff0c\u5c31\u662f\u4e00\u7ec4\u4e92\u76f8\u8054\u7cfb\u7684\u77e5\u8bc6\u70b9\u3002<br><br>\u800c\u77e5\u8bc6\u70b9\uff0c\u5177\u4f53\u5230\u788e\u7247\u9605\u8bfb\u4e0a\uff0c\u5c31\u662f\u90a3\u4e9b\u6bb5\u843d\u4e2d\u770b\u4e0d\u61c2\u7684\u672f\u8bed\uff0c\u7f29\u5199\uff0c\u6982\u5ff5\u3002\u600e\u4e48\u529e\uff1f<br><br>\u67e5\uff01<br><br>\u770b\u4e0d\u61c2\u5c31\u67e5\uff0cgoogle/\u7ef4\u57fa/\u767e\u5ea6\uff0c\u7acb\u523b\u67e5\uff0c\u5148\u67e5\u51fa\u5b83\u662f\u4ec0\u4e48\uff0c\u6ca1\u5174\u8da3\uff0c\u5c31\u5230\u6b64\u4e3a\u6b62\uff0c\u6709\u5174\u8da3\uff0c\u5c31\u6269\u5c55\u8c03\u67e5\uff0c\u95ee\u4e24\u4e2a\u95ee\u9898\uff0c<br><br>\u4e3a\u4ec0\u4e48\uff1f\u4e3a\u4ec0\u4e48\u6709\u8fd9\u4e2a\u6982\u5ff5\uff0c\u63d0\u51fa\u8fd9\u4e2a\u6982\u5ff5\u7684\u76ee\u7684\u4ec0\u4e48\uff0c\u8981\u89e3\u51b3\u4ec0\u4e48\u95ee\u9898\u3002<br><br><br>\u8c01\u5728\u7528\uff1f\u8c01\u5728\u5021\u5bfc\uff0c\u8c01\u5728\u63a8\u52a8\uff0c\u8c01\u5728\u4f7f\u7528\u3002<br><br>\u5728\u8c03\u67e5\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4e0d\u53ef\u907f\u514d\u7684\u4f1a\u9047\u5230\u65b0\u540d\u8bcd\uff0c\u65b0\u6982\u5ff5\uff0c\u540c\u6837\u5904\u7406\uff0c\u65e2\u6269\u5c55\u4e86\u77e5\u8bc6\u70b9\uff0c\u53c8\u5efa\u7acb\u4e86\u4e4b\u95f4\u7684\u8054\u7cfb\u3002<br><br>\u70b9\u591a\u4e86\uff0c\u7ebf\u591a\u4e86\uff0c\u4f53\u7cfb\u5c31\u6709\u4e86\u3002<br><br>\u8fd9\u5c31\u53eb\u9762\u5411\u7ef4\u57fa\u7684\u5b66\u4e60\u6cd5:)", "comment_count": 17, "extras": "", "reshipment_settings": "allowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": true, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [{"avatar_url_template": "https://pic1.zhimg.com/da8e974dc_{size}.jpg", "type": "people", "name": "\u8d3a\u5e08\u4fca", "url": "https://www.zhihu.com/api/v4/people/3ec3b166992a5a90a1083945d2490d38", "gender": 1, "user_type": "people", "url_token": "he-shi-jun", "is_advertiser": false, "avatar_url": "https://pic1.zhimg.com/da8e974dc_is.jpg", "is_org": false, "headline": "Web\u5f00\u53d1\u8005", "badge": [{"type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "3ec3b166992a5a90a1083945d2490d38"}], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "bug\u6709\u4e24\u79cd\uff0c\u53ef\u91cd\u73b0\u7684\uff0c\u548c\u4e0d\u53ef\u91cd\u73b0\u7684\u3002\u53ef\u91cd\u73b0\u7684\u4e0d\u7528\u62c5\u5fc3\uff0c\u603b\u662f\u53ef\u4ee5\u89e3\u51b3\uff0c\u4e0d\u662f\u4eca\u5929\uff0c\u5c31\u662f\u660e\u5929\uff0c\u5927\u53ef\u4ee5\u653e\u5fc3\u7761\u89c9\u3002 \u4e0d\u53ef\u91cd\u73b0\u7684bug\u6709\u4e24\u79cd\uff0c\u5e38\u51fa\u73b0\u7684\uff0c\u548c\u4e0d\u5e38\u51fa\u73b0\u7684\u3002\u5e38\u51fa\u73b0\u7684\u4e0d\u7528\u62c5\u5fc3\uff0c\u6a21\u62df\u73af\u5883\uff0c\u63d0\u9ad8\u8d1f\u8f7d\uff0c\u5b64\u7acb\u5355\u5143\uff0c\u5206\u6790\u65e5\u5fd7\uff0c\u627e\u5230\u89c4\u5f8b\uff0c\u5c31\u6210\u4e86\u53ef\u91cd\u73b0\u7684\u4e86\u3002 \u4e0d\u2026", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1493708483, "id": 163649145, "voteup_count": 1746, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/163649145", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1493196686, "url": "https://www.zhihu.com/api/v4/questions/59045209", "title": "\u665a\u4e0a\u8111\u5b50\u91cc\u4e5f\u60f3\u7740bug\uff0c\u7761\u4e0d\u597d\u600e\u4e48\u529e\uff1f", "type": "question", "id": 59045209, "updated_time": 1494519324}, "updated_time": 1493708483, "content": "<p>bug\u6709\u4e24\u79cd\uff0c\u53ef\u91cd\u73b0\u7684\uff0c\u548c\u4e0d\u53ef\u91cd\u73b0\u7684\u3002<\/p><p>\u53ef\u91cd\u73b0\u7684\u4e0d\u7528\u62c5\u5fc3\uff0c\u603b\u662f\u53ef\u4ee5\u89e3\u51b3\uff0c\u4e0d\u662f\u4eca\u5929\uff0c\u5c31\u662f\u660e\u5929\uff0c\u5927\u53ef\u4ee5\u653e\u5fc3\u7761\u89c9\u3002<\/p><br><p>\u4e0d\u53ef\u91cd\u73b0\u7684bug\u6709\u4e24\u79cd\uff0c\u5e38\u51fa\u73b0\u7684\uff0c\u548c\u4e0d\u5e38\u51fa\u73b0\u7684\u3002<\/p><p>\u5e38\u51fa\u73b0\u7684\u4e0d\u7528\u62c5\u5fc3\uff0c\u6a21\u62df\u73af\u5883\uff0c\u63d0\u9ad8\u8d1f\u8f7d\uff0c\u5b64\u7acb\u5355\u5143\uff0c\u5206\u6790\u65e5\u5fd7\uff0c\u627e\u5230\u89c4\u5f8b\uff0c\u5c31\u6210\u4e86\u53ef\u91cd\u73b0\u7684\u4e86\u3002<\/p><br><p>\u4e0d\u5e38\u51fa\u73b0\u7684bug\u6709\u4e24\u79cd\uff0c\u4e25\u91cd\u7684\uff0c\u548c\u4e0d\u4e25\u91cd\u7684\u3002<\/p><p>\u4e0d\u4e25\u91cd\u7684\u4e0d\u7528\u62c5\u5fc3\uff0c\u53ef\u4ee5\u770b\u505afeature\u3002\u4f5c\u4e3a\u6280\u672f\u4eba\u5458\uff0c\u4e0d\u53ea\u8981\u63d0\u9ad8\u6280\u672f\uff0c\u8fd8\u8981\u953b\u70bc\u8868\u8fbe\u80fd\u529b\uff0c\u5b66\u7740\u6362\u4e2a\u89d2\u5ea6\u770b\u95ee\u9898\u3002<\/p><br><p>\u4e25\u91cd\u7684bug\u6709\u4e24\u79cd\uff0c\u53ef\u76d1\u63a7\u7684\uff0c\u548c\u4e0d\u53ef\u76d1\u63a7\u7684\u3002<\/p><p>\u53ef\u76d1\u63a7\u7684\u4e0d\u7528\u62c5\u5fc3\uff0c\u5199\u76d1\u63a7\u4ee3\u7801\uff0c\u63a2\u6d4b\u5230bug\u53d1\u751f\uff0c\u6216\u8005\u91cd\u8bd5\uff0c\u6216\u8005\u62a5\u8b66\uff0c\u63a7\u5236\u98ce\u9669\uff0c\u628abug\u5305\u8d77\u6765\uff0c\u7cfb\u7edf\u7167\u8dd1\u3002<\/p><br><p>\u5bf9\u4e8e\u90a3\u4e9b\u53c8\u968f\u673a\uff0c\u53c8\u4e25\u91cd\uff0c\u8fd8\u4e0d\u53ef\u63a7\u7684bug\uff0c\u4e0d\u7528\u62c5\u5fc3\uff0c\u4f60\u53ef\u4ee5\u4ea4\u7ed9\u4e2d\u5e74\u7a0b\u5e8f\u5458\uff0c\u53ea\u8981\u5ffd\u60a0\u4ed6\u4eec\u4e0a\u624b\uff0c\u5269\u4e0b\u7684\u5c31\u4e0d\u7528\u7ba1\u4e86\u3002\u8fd9\u4e2a\u6280\u80fd\u7ec3\u7684\u597d\uff0c\u4ee5\u540e\u8fd8\u80fd\u5f53\u7ecf\u7406\u3002<\/p><br><p>\u5173\u706f\uff0c\u7761\u89c9\uff01<\/p>", "comment_count": 137, "extras": "", "reshipment_settings": "need_payment", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": false, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [{"avatar_url_template": "https://pic2.zhimg.com/v2-11995e16ce693fe49db06cb792a3655d_{size}.jpg", "type": "people", "name": "Ahonn", "url": "https://www.zhihu.com/api/v4/people/473da99bf6adda4cbad1155d01fc1c23", "gender": 1, "user_type": "people", "url_token": "ahonn", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-11995e16ce693fe49db06cb792a3655d_is.jpg", "is_org": false, "headline": "<a href=\"https://link.zhihu.com/?target=http%3A//ahonn.me\" class=\" external\" target=\"_blank\" rel=\"nofollow noreferrer\"><span class=\"invisible\">http://<\/span><span class=\"visible\">ahonn.me<\/span><span class=\"invisible\"><\/span><i class=\"icon-external\"><\/i><\/a>", "badge": [], "id": "473da99bf6adda4cbad1155d01fc1c23"}], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u201c\u81ea\u4ece\u548c\u4f60\u6210\u4e86\u5ba4\u53cb\uff0c\u6211\u62e9\u53cb\u7684\u6807\u51c6\u5c31\u964d\u4e86\u5f88\u591a\uff0c\u53ea\u60f3\u627e\u4e2a\u4e0d\u7f3a\u5fc3\u773c\u7684 :)\u201d", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1493474203, "id": 162557427, "voteup_count": 1680, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/162557427", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1446987148, "url": "https://www.zhihu.com/api/v4/questions/37305329", "title": "\u5ba4\u53cb\u5f53\u9762\u8bf4\u6211\u7537\u670b\u53cb\u4e11\u6211\u5f88\u5c34\u5c2c\uff0c\u6211\u8be5\u600e\u6837\u8ba9\u7537\u53cb\u4e0d\u4f24\u5fc3\uff1f", "type": "question", "id": 37305329, "updated_time": 1460006996}, "updated_time": 1493474204, "content": "\u201c\u81ea\u4ece\u548c\u4f60\u6210\u4e86\u5ba4\u53cb\uff0c\u6211\u62e9\u53cb\u7684\u6807\u51c6\u5c31\u964d\u4e86\u5f88\u591a\uff0c\u53ea\u60f3\u627e\u4e2a\u4e0d\u7f3a\u5fc3\u773c\u7684 :)\u201d", "comment_count": 79, "extras": "", "reshipment_settings": "allowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": true, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [{"avatar_url_template": "https://pic1.zhimg.com/530edf54277ae5d0581cbe761a2f2de8_{size}.jpg", "type": "people", "name": "origin", "url": "https://www.zhihu.com/api/v4/people/c8d22cca942a39ba1e554947a7361834", "gender": 1, "user_type": "people", "url_token": "origin-989", "is_advertiser": false, "avatar_url": "https://pic1.zhimg.com/530edf54277ae5d0581cbe761a2f2de8_is.jpg", "is_org": false, "headline": "Less is more", "badge": [], "id": "c8d22cca942a39ba1e554947a7361834"}], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u4ece\u6cf0\u56fd\u56de\u6765\uff0c\u548c\u8001\u5a46\u4e00\u8d77\u770b\u7167\u7247\u3002\u5927\u7687\u5bab\uff0c\u56db\u9762\u4f5b\uff0c\u82ad\u5824\u96c5\uff0c\u6e44\u5357\u6cb3\uff0c\u597d\u50cf\u53bb\u4e86\u4e0d\u5c11\u5730\u65b9\u3002\u7a81\u7136\uff0c\u6211\u610f\u8bc6\u5230\u4e00\u4e2a\u884c\u7a0b\u4e0a\u7684\u5931\u8bef\uff0c\u201c\u54ce\u5440\uff0c\u600e\u4e48\u5fd8\u4e86\u53bb\u770b\u6cf0\u59ec\u9675\uff1f\u201d\u201c\u662f\u5466\u201d\uff0c\u5979\u4e5f\u9677\u5165\u4e86\u6c89\u601d\u3002", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1493364222, "id": 162048921, "voteup_count": 777, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/162048921", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1492147832, "url": "https://www.zhihu.com/api/v4/questions/58481395", "title": "\u7f3a\u4e4f\u5730\u7406\u5e38\u8bc6\uff0c\u662f\u79cd\u600e\u6837\u7684\u4f53\u9a8c\uff1f\u51fa\u4e8e\u54ea\u4e9b\u539f\u56e0\uff1f", "type": "question", "id": 58481395, "updated_time": 1493896345}, "updated_time": 1493364222, "content": "<p>\u4ece\u6cf0\u56fd\u56de\u6765\uff0c\u548c\u8001\u5a46\u4e00\u8d77\u770b\u7167\u7247\u3002<\/p><p>\u5927\u7687\u5bab\uff0c\u56db\u9762\u4f5b\uff0c\u82ad\u5824\u96c5\uff0c\u6e44\u5357\u6cb3\uff0c\u597d\u50cf\u53bb\u4e86\u4e0d\u5c11\u5730\u65b9\u3002\u7a81\u7136\uff0c\u6211\u610f\u8bc6\u5230\u4e00\u4e2a\u884c\u7a0b\u4e0a\u7684\u5931\u8bef\uff0c<\/p><p>\u201c\u54ce\u5440\uff0c\u600e\u4e48\u5fd8\u4e86\u53bb\u770b\u6cf0\u59ec\u9675\uff1f\u201d<\/p><p>\u201c\u662f\u5466\u201d\uff0c\u5979\u4e5f\u9677\u5165\u4e86\u6c89\u601d\u3002<\/p>", "comment_count": 151, "extras": "", "reshipment_settings": "need_payment", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": false, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u75b2\u52b3\u53ef\u4ee5\u9ebb\u6728\u7126\u8651\u3002 \u665a\u7761\uff0c\u662f\u4e00\u4e2a\u7b49\u5f85\u75b2\u52b3\u63a9\u76d6\u7126\u8651\u7684\u8fc7\u7a0b\u3002", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1493044945, "id": 160405978, "voteup_count": 2199, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/160405978", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1484138609, "url": "https://www.zhihu.com/api/v4/questions/54660293", "title": "\u4e3a\u4ec0\u4e48\u538b\u529b\u8d8a\u5927\uff0c\u8d8a\u559c\u6b22\u665a\u7761\uff1f", "type": "question", "id": 54660293, "updated_time": 1484749080}, "updated_time": 1493044945, "content": "\u75b2\u52b3\u53ef\u4ee5\u9ebb\u6728\u7126\u8651\u3002<br><br>\u665a\u7761\uff0c\u662f\u4e00\u4e2a\u7b49\u5f85\u75b2\u52b3\u63a9\u76d6\u7126\u8651\u7684\u8fc7\u7a0b\u3002", "comment_count": 65, "extras": "", "reshipment_settings": "allowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": true, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u4f9d\u6b64\u9ad8\u8bba\uff0c\u7537\u4eba\u771f\u6b63\u7684\u4fee\u517b\uff0c\u53ea\u80fd\u4f53\u73b0\u5728\u88ab\u8e22\u777e\u4e38\u4e0a\u4e86\u3002 \u4e0d\u77e5\u9053\u8fd9\u4f4d\u5218\u4e3b\u4efb\u6709\u6ca1\u6709\u6d4b\u8fc7\u81ea\u5df1\u7684\u4fee\u517b\u3002", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1492655463, "id": 158428295, "voteup_count": 4557, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/158428295", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1492619988, "url": "https://www.zhihu.com/api/v4/questions/58740773", "title": "\u5982\u4f55\u770b\u5f85\u300c\u5973\u751f\u6709\u6ca1\u6709\u771f\u6b63\u7684\u4fee\u517b\uff0c\u5728\u751f\u5b69\u5b50\u8fd9\u4e2a\u65f6\u5019\u6700\u80fd\u4f53\u73b0\u300d\u8fd9\u79cd\u8a00\u8bba\uff1f", "type": "question", "id": 58740773, "updated_time": 1495621754}, "updated_time": 1492655463, "content": "\u4f9d\u6b64\u9ad8\u8bba\uff0c\u7537\u4eba\u771f\u6b63\u7684\u4fee\u517b\uff0c\u53ea\u80fd\u4f53\u73b0\u5728\u88ab\u8e22\u777e\u4e38\u4e0a\u4e86\u3002<br><br>\u4e0d\u77e5\u9053\u8fd9\u4f4d\u5218\u4e3b\u4efb\u6709\u6ca1\u6709\u6d4b\u8fc7\u81ea\u5df1\u7684\u4fee\u517b\u3002", "comment_count": 189, "extras": "", "reshipment_settings": "disallowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": false, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u5927\u5b66\u7684\u65f6\u5019\uff0c\u548c\u8001\u5a46\u5728QQ\u4e0a\u804a\u5929\uff0c\u5979\u53d1\u4e86\u9996\u6b4c\u7ed9\u6211\uff0c\u95ee\u6211\u6709\u6ca1\u6709\u542c\u8fc7\u3002 \u5f53\u65f6\u6bd5\u4e1a\u5728\u5373\uff0c\u8bf8\u4e8b\u672a\u5b9a\uff0c\u5927\u5bb6\u5404\u8d74\u524d\u7a0b\uff0c\u5fd9\u4e71\u53c8\u4f24\u611f\uff0c\u8fd8\u6709\u51e0\u5206\u5bf9\u672a\u6765\u7684\u4e0d\u5b89\u3002 \u591a\u5e74\u4ee5\u540e\uff0c\u518d\u89c1\u5230\u513f\u65f6\u7684\u73a9\u4f34\uff0c\u76f8\u9022\u4e00\u7b11\uff0c\u8bf4\u7740\u5404\u81ea\u8eab\u8fb9\u7684\u7410\u4e8b\uff0c\u4eff\u4f5b\u4ece\u672a\u79bb\u5f00\u8fc7\u3002 \u518d\u542c\u90a3\u9996\u6b4c\uff0c\u4e00\u66f2\u5531\u5c3d\u5fc3\u610f\u3002 \u2026", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1492491041, "id": 157883464, "voteup_count": 344, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/157883464", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1430139476, "url": "https://www.zhihu.com/api/v4/questions/29923789", "title": "\u6709\u54ea\u4e9b\u4ec5\u51ed\u4e00\u9996\u6b4c\u5c31\u8db3\u4ee5\u60ca\u8273\u5230\u4f60\u7684\u5c0f\u4f17\u7684\u6b4c\u624b\uff1f", "type": "question", "id": 29923789, "updated_time": 1498006028}, "updated_time": 1492491041, "content": "\u5927\u5b66\u7684\u65f6\u5019\uff0c\u548c\u8001\u5a46\u5728QQ\u4e0a\u804a\u5929\uff0c\u5979\u53d1\u4e86\u9996\u6b4c\u7ed9\u6211\uff0c\u95ee\u6211\u6709\u6ca1\u6709\u542c\u8fc7\u3002<br><br>\u5f53\u65f6\u6bd5\u4e1a\u5728\u5373\uff0c\u8bf8\u4e8b\u672a\u5b9a\uff0c\u5927\u5bb6\u5404\u8d74\u524d\u7a0b\uff0c\u5fd9\u4e71\u53c8\u4f24\u611f\uff0c\u8fd8\u6709\u51e0\u5206\u5bf9\u672a\u6765\u7684\u4e0d\u5b89\u3002<br><br>\u591a\u5e74\u4ee5\u540e\uff0c\u518d\u89c1\u5230\u513f\u65f6\u7684\u73a9\u4f34\uff0c\u76f8\u9022\u4e00\u7b11\uff0c\u8bf4\u7740\u5404\u81ea\u8eab\u8fb9\u7684\u7410\u4e8b\uff0c\u4eff\u4f5b\u4ece\u672a\u79bb\u5f00\u8fc7\u3002<br><br>\u518d\u542c\u90a3\u9996\u6b4c\uff0c\u4e00\u66f2\u5531\u5c3d\u5fc3\u610f\u3002<br><br>\u4eba\u751f\u7684\u9645\u9047\u5343\u767e\u79cd<br><br>\u4f46\u6709\u77e5\u5fc3\u5e38\u76f8\u91cd<br><br>\u4eba\u613f\u957f\u4e45\uff0c\u6c34\u613f\u957f\u6d41<br><br>\u5e74\u5c11\u65f6\u5019<br><br>\u300a\u7ec6\u6c34\u957f\u6d41\u300b\uff0c\u6881\u6587\u798f\u3002", "comment_count": 63, "extras": "", "reshipment_settings": "allowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": true, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "1\uff0c\u5237\u9762\u8bd5\u9898\u3002 2\uff0c\u901a\u900f\u7684\u7406\u89e3\u81ea\u5df1\u624b\u5934\u7684\u9879\u76ee\u3002\u522b\u4eba\u95ee\u8d77\u6765\u65f6\uff0c\u8981\u8a00\u4e4b\u6709\u7406\uff0c\u8a00\u4e4b\u6709\u7269\u3002 3\uff0c\u5bfb\u6c42\u540c\u5b66\u670b\u53cb\u7684\u5185\u63a8\u3002", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1492154017, "id": 157179186, "voteup_count": 358, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/157179186", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1492137961, "url": "https://www.zhihu.com/api/v4/questions/58474365", "title": "\u8fdb\u4e86\u5c0f\u516c\u53f8\u7684\u5e94\u5c4a\u7a0b\u5e8f\u5458\u5982\u4f55\u7ffb\u8eab\u8fdb\u5165\u5927\u516c\u53f8\uff1f", "type": "question", "id": 58474365, "updated_time": 1492304714}, "updated_time": 1492154018, "content": "1\uff0c\u5237\u9762\u8bd5\u9898\u3002<br><br>2\uff0c\u901a\u900f\u7684\u7406\u89e3\u81ea\u5df1\u624b\u5934\u7684\u9879\u76ee\u3002\u522b\u4eba\u95ee\u8d77\u6765\u65f6\uff0c\u8981\u8a00\u4e4b\u6709\u7406\uff0c\u8a00\u4e4b\u6709\u7269\u3002<br><br>3\uff0c\u5bfb\u6c42\u540c\u5b66\u670b\u53cb\u7684\u5185\u63a8\u3002", "comment_count": 28, "extras": "", "reshipment_settings": "allowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": true, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u201c\u5e76\u4e0d\u662f\u90a3\u6837\u7684\uff0c\u201d \u4f60\u6709\u70b9\u59d4\u5c48\uff0c \u54ac\u4e86\u54ac\u5634\u5507\uff0c \u6458\u4e0b\u773c\u955c\uff0c \u8131\u6389\u4e0a\u8863\uff0c \u6361\u8d77\u7816\u5934\uff0c \u201c\u6211\u5988\u8bf4\uff0c\u6211\u6700\u5927\u7684\u95ee\u9898\uff0c\u5c31\u662f\u592a\u66b4\u529b\u4e86...\u201d", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1492093390, "id": 157062065, "voteup_count": 592, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/157062065", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1486642927, "url": "https://www.zhihu.com/api/v4/questions/55619940", "title": "\u5982\u4f55\u53cd\u9a73\uff1a\u201c\u4f60\u4e0d\u627f\u8ba4\u4f60\u6709\u95ee\u9898\u5c31\u662f\u4f60\u6700\u5927\u7684\u95ee\u9898\u201d\uff1f", "type": "question", "id": 55619940, "updated_time": 1486642927}, "updated_time": 1492093391, "content": "\u201c\u5e76\u4e0d\u662f\u90a3\u6837\u7684\uff0c\u201d<br><br>\u4f60\u6709\u70b9\u59d4\u5c48\uff0c<br><br>\u54ac\u4e86\u54ac\u5634\u5507\uff0c<br><br>\u6458\u4e0b\u773c\u955c\uff0c<br><br>\u8131\u6389\u4e0a\u8863\uff0c<br><br>\u6361\u8d77\u7816\u5934\uff0c<br><br>\u201c\u6211\u5988\u8bf4\uff0c\u6211\u6700\u5927\u7684\u95ee\u9898\uff0c\u5c31\u662f\u592a\u66b4\u529b\u4e86...\u201d", "comment_count": 34, "extras": "", "reshipment_settings": "allowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": true, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u4ee5\u524d\u4e0d\u61c2\u4e8b\uff0c\u53bb\u70ed\u6d6a\u5c9b\u73a9\u3002\u5929\u84dd\uff0c\u6c99\u767d\uff0c\u6c34\u900f\u4eae\uff0c\u5927\u4e2d\u5348\u7684\uff0c\u6c99\u6ee9\u4e0a\u4e00\u4e2a\u4eba\u6ca1\u6709\uff0c\u90fd\u5728\u4e8c\u697cBBQ\u3002\u6211\u5403\u5b8c\u70e4\u8089\uff0c\u5c31\u60f3\u4e0b\u6d77\u6e38\u6cf3\uff0c\u72ec\u9738\u6574\u7247\u6d77\u57df\uff0c\u591a\u723d\uff01\u8001\u5a46\u8ba9\u6211\u6d82\u9632\u6652\u971c\uff0c\u4e5f\u6ca1\u542c\uff0c\u89c9\u5f97\u81ea\u5df1\u957f\u5f97\u767d\uff0c\u5929\u7136\u53cd\u5149\uff0c\u5c31\u4e0b\u53bb\u4e86\u3002\u6e38\u4e86\u4e00\u4e2a\u5c0f\u65f6\uff0c\u6d17\u4e2a\u70ed\u6c34\u6fa1\u3002\u4e0b\u5348\uff0c\u76ae\u80a4\u8d8a\u6765\u8d8a\u7ea2\u2026", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1492064823, "id": 156979250, "voteup_count": 204, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/156979250", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1307894084, "url": "https://www.zhihu.com/api/v4/questions/19710714", "title": "\u76ae\u80a4\u6652\u4f24\u540e\u600e\u6837\u52a0\u5feb\u6062\u590d\uff1f", "type": "question", "id": 19710714, "updated_time": 1464890522}, "updated_time": 1492064921, "content": "<p>\u4ee5\u524d\u4e0d\u61c2\u4e8b\uff0c\u53bb\u70ed\u6d6a\u5c9b\u73a9\u3002<\/p><p>\u5929\u84dd\uff0c\u6c99\u767d\uff0c\u6c34\u900f\u4eae\uff0c\u5927\u4e2d\u5348\u7684\uff0c\u6c99\u6ee9\u4e0a\u4e00\u4e2a\u4eba\u6ca1\u6709\uff0c\u90fd\u5728\u4e8c\u697cBBQ\u3002\u6211\u5403\u5b8c\u70e4\u8089\uff0c\u5c31\u60f3\u4e0b\u6d77\u6e38\u6cf3\uff0c\u72ec\u9738\u6574\u7247\u6d77\u57df\uff0c\u591a\u723d\uff01<\/p><p>\u8001\u5a46\u8ba9\u6211\u6d82\u9632\u6652\u971c\uff0c\u4e5f\u6ca1\u542c\uff0c\u89c9\u5f97\u81ea\u5df1\u957f\u5f97\u767d\uff0c\u5929\u7136\u53cd\u5149\uff0c\u5c31\u4e0b\u53bb\u4e86\u3002<\/p><p>\u6e38\u4e86\u4e00\u4e2a\u5c0f\u65f6\uff0c\u6d17\u4e2a\u70ed\u6c34\u6fa1\u3002<\/p><p>\u4e0b\u5348\uff0c\u76ae\u80a4\u8d8a\u6765\u8d8a\u7ea2\uff0c\u8d8a\u6765\u8d8a\u80bf\uff0c\u5230\u4e86\u534a\u591c\uff0c\u88ab\u75db\u9192\uff0c\u80a9\u8180\u597d\u50cf\u9165\u4e86\u4e00\u6837\uff0c\u76ae\u80a4\u88c2\u5f00\uff0c\u4e0d\u80fd\u78b0\uff0c\u4e0d\u80fd\u6cbe\u5e8a\uff0c\u89c9\u4e5f\u6ca1\u6cd5\u7761\u3002<\/p><p>\u6b64\u540e\u751f\u6d3b\u5728\u70ed\u5e26\uff0c\u7ecf\u5e38\u88ab\u6652\uff0c\u4e5f\u5c31\u6709\u4e86\u7ecf\u9a8c\u3002\u88ab\u6652\u4e86\u4e4b\u540e\uff0c<\/p><p>1\uff0c\u5343\u4e07\u5343\u4e07\u4e0d\u8981\u6d17\u70ed\u6c34\u6fa1\u3002<\/p><p>2\uff0c\u6d82\u82a6\u835f\u80f6\u3002<\/p><p>\u4e00\u65e6\u611f\u89c9\u76ae\u80a4\u53d1\u7ea2\uff0c\u7acb\u523b\u4e0a\u82a6\u835f\u80f6\uff0c\u6652\u4f24\u5904\u6d82\u6ee1\uff0c\u5e72\u4e86\u4e4b\u540e\u518d\u6d82\uff0c\u4e0d\u8981\u7701\uff0c\u76f4\u5230\u76ae\u80a4\u4e0d\u7ea2\u4e0d\u80bf\u3002\u6d82\u8d77\u6765\u6e05\u6e05\u51c9\u51c9\u7684\uff0c\u6bd4\u9632\u6652\u971c\u8212\u670d\u3002\u6d82\u7684\u65e9\uff0c\u4e00\u6b21\u4f24\u5bb3\u5c31\u53ef\u4ee5\u6d88\u5f2d\u4e8e\u65e0\u5f62\u3002<\/p><p>\u4e0d\u8fc7\u8fd9\u73a9\u610f\u4e0d\u9632\u6652\uff0c\u628a\u8138\u6d82\u7684\u4eae\u6676\u6676\u7684\uff0c\u51fa\u95e8\u4e5f\u6ca1\u7528\uff0c\u53ea\u80fd\u6652\u540e\u4fee\u8865\u3002<\/p>", "comment_count": 36, "extras": "", "reshipment_settings": "need_payment", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": false, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u8981\u6211\u8bf4\uff0c\u5c31\u4e0d\u8be5AA\u3002 \u5403\u5b8c\u996d\uff0c\u7b97\u6e05\u695a\u4e86\u51e0\u5206\u51e0\u6bdb\uff0c\u653e\u8fdb\u5404\u81ea\u94b1\u5305\uff0c\u518d\u5f00\u59cb\u82b1\u524d\u6708\u4e0b\uff0c\u5c71\u76df\u6d77\u8a93\uff0c\u603b\u89c9\u5f97\u6709\u4e9b\u522b\u626d\u3002 \u4e0d\u5982\u5f00\u4e2a\u6237\u5934\uff0c\u8d1f\u8d23\u7ea6\u4f1a\u5f00\u9500\uff0c\u4e24\u4eba\u6bcf\u6708\u6253\u94b1\u5165\u8d26\uff0c\u5403\u996d\u65c5\u6e38\u770b\u7535\u5f71\uff0c\u90fd\u4ece\u8fd9\u4e2a\u6237\u5934\u51fa\u3002 \u7ba1\u7406\u7684\u597d\uff0c\u662f\u5171\u540c\u7684\u6210\u7ee9\uff0c\u65e2\u89e3\u51b3\u4e86\u7ea6\u4f1a\u5f00\u9500\u7684\u5fc3\u7ed3\uff0c\u8fd8\u80fd\u4fc3\u8fdb\u2026", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1491923618, "id": 156680250, "voteup_count": 838, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/156680250", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1491353337, "url": "https://www.zhihu.com/api/v4/questions/58043628", "title": "\u5403\u996d AA \u516c\u5e73\u5417\uff1f\u5982\u4e00\u65b9\u7684\u996d\u91cf\u662f\u53e6\u4e00\u65b9\u7684\u4e24\u5230\u4e09\u500d\uff0c\u8fd9\u6837\u5bf9\u53e6\u4e00\u65b9\u6765\u8bf4\u4e0d\u5403\u4e8f\u5417\uff1f", "type": "question", "id": 58043628, "updated_time": 1492012476}, "updated_time": 1491923619, "content": "\u8981\u6211\u8bf4\uff0c\u5c31\u4e0d\u8be5AA\u3002<br><br>\u5403\u5b8c\u996d\uff0c\u7b97\u6e05\u695a\u4e86\u51e0\u5206\u51e0\u6bdb\uff0c\u653e\u8fdb\u5404\u81ea\u94b1\u5305\uff0c\u518d\u5f00\u59cb\u82b1\u524d\u6708\u4e0b\uff0c\u5c71\u76df\u6d77\u8a93\uff0c\u603b\u89c9\u5f97\u6709\u4e9b\u522b\u626d\u3002<br><br>\u4e0d\u5982\u5f00\u4e2a\u6237\u5934\uff0c\u8d1f\u8d23\u7ea6\u4f1a\u5f00\u9500\uff0c\u4e24\u4eba\u6bcf\u6708\u6253\u94b1\u5165\u8d26\uff0c\u5403\u996d\u65c5\u6e38\u770b\u7535\u5f71\uff0c\u90fd\u4ece\u8fd9\u4e2a\u6237\u5934\u51fa\u3002<br><br>\u7ba1\u7406\u7684\u597d\uff0c\u662f\u5171\u540c\u7684\u6210\u7ee9\uff0c\u65e2\u89e3\u51b3\u4e86\u7ea6\u4f1a\u5f00\u9500\u7684\u5fc3\u7ed3\uff0c\u8fd8\u80fd\u4fc3\u8fdb\u5f7c\u6b64\u7684\u4fe1\u4efb\uff0c\u589e\u8fdb\u611f\u60c5\u3002\u5982\u679c\u6709\u7ed3\u4f59\uff0c\u53ef\u4ee5\u4e70\u70b9\u4e66\u4e0a\u4e2a\u8bfe\uff0c\u5171\u540c\u8fdb\u6b65\u3002\u6216\u662f\u4e00\u8d77\u7814\u7a76\u5e02\u573a\uff0c\u4e70\u4e2a\u80a1\u7968\u3002\u6295\u8d44\u8fd9\u79cd\u4e8b\uff0c\u8d81\u94b1\u5c11\u7684\u65f6\u5019\u5165\u573a\uff0c\u4e8f\u5f97\u4e5f\u6bd4\u8f83\u5c11\u3002<br><br>\u7ba1\u7406\u7684\u4e0d\u597d\uff0c\u4e00\u809a\u5b50\u610f\u89c1\u3002\u51e0\u5343\u591a\u5757\u7684\u6237\u5934\u90fd\u6446\u4e0d\u5e73\uff0c\u4ee5\u540e\u771f\u5728\u4e00\u8d77\uff0c\u623f\u5b50\u8f66\u5b50\u5b69\u5b50\uff0c\u66f4\u591a\u95ee\u9898\uff0c\u66f4\u641e\u4e0d\u5b9a\u4e86\u3002\u8bf4\u660e\u4e24\u4eba\u6ca1\u672a\u6765\uff0c\u65e9\u5206\u65e9\u89e3\u8131\uff0c\u4e5f\u4e0d\u662f\u4ef6\u574f\u4e8b\u3002", "comment_count": 93, "extras": "", "reshipment_settings": "allowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": true, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u6076\u52a3\u3002 \u5b89\u6392\u5458\u5de5\u4e0a\u5c97\uff0c\u662f\u8c01\u7684\u8d23\u4efb\uff1f \u822a\u7a7a\u516c\u53f8\u7684\u3002 \u5b89\u5168\u9001\u8fbe\u4e58\u5ba2\uff0c\u662f\u8c01\u7684\u8d23\u4efb\uff1f \u822a\u7a7a\u516c\u53f8\u7684\u3002 \u5b89\u6392\u7684\u5458\u5de5\u4e0a\u4e0d\u4e86\u5c97\uff0c\u662f\u4f60\u516c\u53f8\u65e0\u80fd\u3002 \u6536\u4e86\u94b1\u5374\u4e0d\u9001\u8fbe\u4e58\u5ba2\uff0c\u662f\u4f60\u516c\u53f8\u65e0\u7528\u3002 \u4e3a\u4e86\u65b9\u4fbf\u81ea\u5df1\uff0c\u52a8\u7528\u6b66\u529b\uff0c\u628a\u4e58\u5ba2\u649e\u7684\u4e00\u8138\u8840\uff0c\u662f\u4f60\u516c\u53f8\u65e0\u803b\uff01 \u544a\u4ed6\uff01 \u4e0d\u8bba\u6700\u7ec8\u7ed3\u679c\u5982\u4f55\u2026", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1491874379, "id": 156512698, "voteup_count": 203, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/156512698", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1491843214, "url": "https://www.zhihu.com/api/v4/questions/58315783", "title": "\u5982\u4f55\u770b\u5f85\u7f8e\u8054\u822a UA3411 \u822a\u73ed\u66b4\u529b\u5f3a\u8feb\u4e58\u5ba2\u4e0b\u673a\u4e8b\u4ef6\uff1f", "type": "question", "id": 58315783, "updated_time": 1491886684}, "updated_time": 1491874379, "content": "\u6076\u52a3\u3002<br><br>\u5b89\u6392\u5458\u5de5\u4e0a\u5c97\uff0c\u662f\u8c01\u7684\u8d23\u4efb\uff1f<br><br>\u822a\u7a7a\u516c\u53f8\u7684\u3002<br><br>\u5b89\u5168\u9001\u8fbe\u4e58\u5ba2\uff0c\u662f\u8c01\u7684\u8d23\u4efb\uff1f<br><br>\u822a\u7a7a\u516c\u53f8\u7684\u3002<br><br>\u5b89\u6392\u7684\u5458\u5de5\u4e0a\u4e0d\u4e86\u5c97\uff0c\u662f\u4f60\u516c\u53f8\u65e0\u80fd\u3002<br><br>\u6536\u4e86\u94b1\u5374\u4e0d\u9001\u8fbe\u4e58\u5ba2\uff0c\u662f\u4f60\u516c\u53f8\u65e0\u7528\u3002<br><br>\u4e3a\u4e86\u65b9\u4fbf\u81ea\u5df1\uff0c\u52a8\u7528\u6b66\u529b\uff0c\u628a\u4e58\u5ba2\u649e\u7684\u4e00\u8138\u8840\uff0c\u662f\u4f60\u516c\u53f8\u65e0\u803b\uff01<br><br>\u544a\u4ed6\uff01<br><br>\u4e0d\u8bba\u6700\u7ec8\u7ed3\u679c\u5982\u4f55\uff0c\u9053\u6b49\u8d54\u94b1\uff0c\u8fd8\u662f\u4e0d\u4e86\u4e86\u4e4b\uff0c\u5927\u5bb6\u90fd\u4e0d\u8981\u505a\u8fd9\u5bb6\u516c\u53f8\u7684\u4e58\u5ba2\u4e86\u3002<br><br>\u94b1\uff0c\u4e0d\u8981\u7ed9\u4e0d\u5c0a\u91cd\u81ea\u5df1\u7684\u4eba\u8d5a\u3002", "comment_count": 9, "extras": "", "reshipment_settings": "allowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": true, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 1, "is_thanked": false}, "mark_infos": [], "excerpt": "\u7406\u5de5\u7537\u5c31\u662f\u4e00\u5e2e\u5b50\u4e8c\u8d27\u3002 \u5b66\u70b9\u7269\u7406\u5316\u5b66\uff0c\u5c31\u5929\u5929\u770b\u6210\u5206\u5217\u8868\uff1b\u88c5\u4e24\u53f0\u7535\u8111\uff0c\u5c31\u4e70\u5565\u90fd\u7b97\u6027\u4ef7\u6bd4\u3002\u6210\u5206\u4e00\u6837\uff0c\u4e1c\u897f\u5c31\u4e00\u6837\u5417\uff1f\u94bb\u77f3\u548c\u94c5\u7b14\u82af\u4e00\u6837\u5417\uff1f\u6dd8\u7c73\u6c34\u548cSK2\u4e00\u6837\u5417\uff1f \u6027\u4ef7\u6bd4\uff1f\u6027\u4ef7\u6bd4\u6709\u4e2a\u6bdb\u7528\uff01\u6027\u4ef7\u6bd4\u80fd\u5e26\u6765\u5475\u62a4\u611f\u5417\uff1f\u6027\u4ef7\u6bd4\u80fd\u5e26\u6765\u7cbe\u81f4\u4eba\u751f\u5417\uff1f180\u5c31\u5acc\u8d35\uff0c\u5478\uff0c250\u2026", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1491637161, "id": 156022198, "voteup_count": 8211, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/156022198", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1491477632, "url": "https://www.zhihu.com/api/v4/questions/58120246", "title": "\u5982\u4f55\u8bc4\u4ef7\u7537\u751f\u56e0\u4e3a\u8ba9\u59b9\u5b50\u300c\u7528\u519c\u592b\u77ff\u6cc9\u6c34\u52a0\u55b7\u58f6\u300d\u66ff\u4ee3\u96c5\u6f3e\u5927\u55b7\uff0c\u800c\u906d\u8bb8\u591a\u59b9\u5b50\u53cd\u9a73\u7684\u4e8b\uff1f", "type": "question", "id": 58120246, "updated_time": 1493893947}, "updated_time": 1491637162, "content": "\u7406\u5de5\u7537\u5c31\u662f\u4e00\u5e2e\u5b50\u4e8c\u8d27\u3002<br><br>\u5b66\u70b9\u7269\u7406\u5316\u5b66\uff0c\u5c31\u5929\u5929\u770b\u6210\u5206\u5217\u8868\uff1b\u88c5\u4e24\u53f0\u7535\u8111\uff0c\u5c31\u4e70\u5565\u90fd\u7b97\u6027\u4ef7\u6bd4\u3002\u6210\u5206\u4e00\u6837\uff0c\u4e1c\u897f\u5c31\u4e00\u6837\u5417\uff1f\u94bb\u77f3\u548c\u94c5\u7b14\u82af\u4e00\u6837\u5417\uff1f\u6dd8\u7c73\u6c34\u548cSK2\u4e00\u6837\u5417\uff1f<br><br>\u6027\u4ef7\u6bd4\uff1f\u6027\u4ef7\u6bd4\u6709\u4e2a\u6bdb\u7528\uff01\u6027\u4ef7\u6bd4\u80fd\u5e26\u6765\u5475\u62a4\u611f\u5417\uff1f\u6027\u4ef7\u6bd4\u80fd\u5e26\u6765\u7cbe\u81f4\u4eba\u751f\u5417\uff1f180\u5c31\u5acc\u8d35\uff0c\u5478\uff0c250\u4e5f\u7167\u4e70\uff01<br><br>\u667a\u5546\u7a0e\uff1f\u5c31\u4f60\u4eec\u667a\u5546\u9ad8\uff0c\u5c31\u4f60\u4eec\u4e0d\u4ea4\u7a0e\uff0c\u89e3\u51e0\u4e2a\u7834\u65b9\u7a0b\u5c31\u4e86\u4e0d\u5f97\u4e86\uff0c\u544a\u8bc9\u4f60\u4eec\uff0c\u80fd\u4ea4\u7a0e\u7684\u90fd\u662f\u6709\u94b1\u4eba\uff0c\u4f60\u4eec\u4e0d\u4ea4\u7a0e\uff0c\u90a3\u662f\u4f60\u4eec\u7a77\uff01<br><br>\u519c\u592b\u5c71\u6cc9\uff1f\u90a3\u662f\u5e72\u4ec0\u4e48\u7684\uff1f\u559d\u7684\uff01\u8c01\u8bf4\u80fd\u5916\u7528\u4e86\uff1f\u74f6\u5b50\u4e0a\u5199\u4e86\u5417\uff1f\u7f51\u7ad9\u4e0a\u8bf4\u4e86\u5417\uff1f\u62ff\u6765\u6d82\u8138\uff0c\u51fa\u4e86\u95ee\u9898\u8c01\u8d1f\u8d23\uff1f\u4ec0\u4e48\uff1f\u80fd\u559d\u7684\u5c31\u80fd\u6d82\uff1f\u653e\uff01\u4f60\u4e0d\u62ff\u86cb\u82b1\u6c64\u6d82\u8138\u7684\uff1f<br><br>\u59d1\u5a18\u4eec\uff0c\u7edd\u4e0d\u80fd\u7528\u77ff\u6cc9\u6c34\u55b7\u8138\uff0cLow\u5230\u7206\uff01\u5c31\u7b97\u6ca1\u96c5\u6f3e\uff0c\u4e5f\u4e0d\u80fd\u7528\u519c\u592b\uff01\u600e\u4e48\u529e\uff1f\u53ef\u4ee5\u8fd9\u6837\uff0c<br><br>\u4ef0\u9762\u671d\u5929\u6253\u55b7\u568f\uff01<br><br>\u5bcc\u542b\u5fae\u91cf\u5143\u7d20\u6d3b\u6027\u9176\u7684\u7eaf\u5929\u7136\u6db2\u4f53\uff0c\u5728\u5bcc\u6c27\uff0c\u5bcc\u6c2e\uff0c\u5bcc\u4e8c\u6c27\u5316\u78b3\u7684\u73af\u5883\u4e2d\uff0c\u4ee5180\u516c\u91cc\u6bcf\u5c0f\u65f6\u7684\u901f\u5ea6\u55b7\u5c04\u4e0a\u53bb\uff0c\u8fc5\u901f\u96fe\u5316\uff0c\u518d\u4ee5\u79d2\u901f\u4e94\u5398\u7c73\u7684\u59ff\u6001\uff0c\u5728\u9633\u5149\u4e2d\u7f13\u7f13\u4e0b\u5760\uff0c\u6577\u4e8e\u8138\u4e0a\uff0c\u67d4\u5ae9\u808c\u80a4\uff0c\u5929\u7136\u5475\u62a4\u3002<br><br>\u7eaf\u6709\u673a\uff0c\u4e0d\u6392\u5f02\uff0c\u654f\u611f\u76ae\u80a4\u4e5f\u4e0d\u7528\u62c5\u5fc3\u4e86\uff01\u5e72\u4e86\u4e4b\u540e\uff0c\u8fd8\u6709\u79cd\u91ba\u91ba\u7136\u7684\u6c14\u606f\uff0c\u8ba9\u4eba\u6c89\u9189\u3002", "comment_count": 1120, "extras": "", "reshipment_settings": "allowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": true, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u56e0\u4e3a\u6c89\u9ed8\u6210\u4e86\u5171\u8bc6\u3002 \u6c89\u9ed8\u7684\u8d8a\u4e45\uff0c\u5171\u8bc6\u5c31\u8d8a\u5f3a\u70c8\uff0c\u6253\u7834\u6c89\u9ed8\uff0c\u6240\u9700\u7684\u52c7\u6c14\u5c31\u8d8a\u591a\u3002\u8bb8\u4e45\u4e0d\u8054\u7cfb\u7684\u670b\u53cb\uff0c\u5f80\u5f80\u9700\u8981\u5bfb\u4e2a\u56e0\u7531\u624d\u8bf4\u4e0a\u8bdd\uff0c\u800c\u4e0d\u80fd\u53ea\u662f\u804a\u804a\u5bb6\u5e38\u3002\u8bf4\u5230\u5e95\uff0c\u4e5f\u4e0d\u8fc7\u662f\u4e3a\u4e86\u63a9\u9970\uff0c\u4f60\u90a3\u4e48\u4e45\u4e0d\u7406\u6211\uff0c\u6211\u5374\u6709\u70b9\u60f3\u4f60\u7684\u5c34\u5c2c\u3002 \u6709\u4e45\u672a\u8bf4\u8bdd\u7684\u670b\u53cb\u53d1\u6765\u6d88\u606f\uff0c\u4e0d\u8981\u803d\u6401\uff0c\u5c3d\u2026", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1491487386, "id": 155720558, "voteup_count": 1341, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/155720558", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1484360816, "url": "https://www.zhihu.com/api/v4/questions/54745381", "title": "\u4eba\u4e3a\u4ec0\u4e48\u4f1a\u9677\u5165\u300c\u5982\u679c\u4f60\u4e0d\u4e3b\u52a8\u627e\u6211\uff0c\u5c31\u7b97\u6211\u60f3\u8ddf\u4f60\u8bf4\u8bdd\u4e5f\u4e0d\u4e3b\u52a8\u627e\u4f60\u300d\u7684\u6a21\u5f0f\uff1f", "type": "question", "id": 54745381, "updated_time": 1491224823}, "updated_time": 1491487387, "content": "\u56e0\u4e3a\u6c89\u9ed8\u6210\u4e86\u5171\u8bc6\u3002<br><br>\u6c89\u9ed8\u7684\u8d8a\u4e45\uff0c\u5171\u8bc6\u5c31\u8d8a\u5f3a\u70c8\uff0c\u6253\u7834\u6c89\u9ed8\uff0c\u6240\u9700\u7684\u52c7\u6c14\u5c31\u8d8a\u591a\u3002\u8bb8\u4e45\u4e0d\u8054\u7cfb\u7684\u670b\u53cb\uff0c\u5f80\u5f80\u9700\u8981\u5bfb\u4e2a\u56e0\u7531\u624d\u8bf4\u4e0a\u8bdd\uff0c\u800c\u4e0d\u80fd\u53ea\u662f\u804a\u804a\u5bb6\u5e38\u3002\u8bf4\u5230\u5e95\uff0c\u4e5f\u4e0d\u8fc7\u662f\u4e3a\u4e86\u63a9\u9970\uff0c\u4f60\u90a3\u4e48\u4e45\u4e0d\u7406\u6211\uff0c\u6211\u5374\u6709\u70b9\u60f3\u4f60\u7684\u5c34\u5c2c\u3002<br><br>\u6709\u4e45\u672a\u8bf4\u8bdd\u7684\u670b\u53cb\u53d1\u6765\u6d88\u606f\uff0c\u4e0d\u8981\u803d\u6401\uff0c\u5c3d\u5feb\u56de\u8bdd\uff0c\u4f60\u4e0d\u77e5\u4ed6\u8e0c\u8e87\u4e86\u591a\u4e45\uff0c\u624d\u6572\u4e0b\u201c\u5728\u5417\uff1f\u201d", "comment_count": 111, "extras": "", "reshipment_settings": "allowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": true, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u9886\u5bfc\u53d1\u8a00\uff0c\u5c4f\u6c14\u51dd\u795e\u7684\u8046\u542c\uff1b \u9886\u5bfc\u63d0\u95ee\uff0c\u4e89\u5148\u6050\u540e\u7684\u56de\u7b54\u3002", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1491357883, "id": 155381773, "voteup_count": 598, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/155381773", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1390188807, "url": "https://www.zhihu.com/api/v4/questions/22562949", "title": "\u300c\u4e25\u8083\u6d3b\u6cfc\u300d\u662f\u4ec0\u4e48\u610f\u601d\uff1f\u600e\u6837\u624d\u80fd\u79f0\u4e3a\u4e25\u8083\u6d3b\u6cfc\uff1f", "type": "question", "id": 22562949, "updated_time": 1390188807}, "updated_time": 1491357884, "content": "\u9886\u5bfc\u53d1\u8a00\uff0c\u5c4f\u6c14\u51dd\u795e\u7684\u8046\u542c\uff1b<br>\u9886\u5bfc\u63d0\u95ee\uff0c\u4e89\u5148\u6050\u540e\u7684\u56de\u7b54\u3002", "comment_count": 29, "extras": "", "reshipment_settings": "allowed", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": true, "type": "answer", "thumbnail": "", "is_normal": true}, {"suggest_edit": {"status": false, "reason": "", "title": "", "url": "", "unnormal_details": {}, "tip": ""}, "relationship": {"upvoted_followees": [], "is_author": false, "is_nothelp": false, "is_authorized": false, "voting": 0, "is_thanked": false}, "mark_infos": [], "excerpt": "\u548c\u4f60\u4e00\u8d77\u957f\u5927\u7684\u597d\u670b\u53cb\uff0c\u4e0a\u5b66\u653e\u5b66\uff0c\u65e0\u8bdd\u4e0d\u8bf4\uff0c\u6253\u6253\u95f9\u95f9\uff0c\u52fe\u80a9\u642d\u80cc\u3002\u82e6\u8bfb\u5341\u4e8c\u5e74\uff0c\u4e00\u671d\u9ad8\u8003\uff0c\u4f60\u548c\u4ed6\u53bb\u4e86\u4e0d\u540c\u7684\u57ce\u5e02\u3002 \u5bd2\u5047\u89c1\u9762\uff0c\u8feb\u4e0d\u53ca\u5f85\u7684\u62c9\u7740\u4ed6\uff0c\u8981\u597d\u597d\u804a\u804a\u5b66\u6821\u7684\u89c1\u95fb... \u4ed6\u5374\u8bf4\u666e\u901a\u8bdd\u3002 \u4ece\u5c0f\u73a9\u5230\u5927\uff0c\u8bf4\u4e86\u5341\u51e0\u5e74\u7684\u5bb6\u4e61\u8bdd\uff0c\u4ed6\u53bb\u4e86\u8d9f\u57ce\u90ca\uff0c\u56de\u6765\u5c31\u53ea\u8bf4\u666e\u901a\u8bdd\u4e86\u2026", "annotation_action": [], "admin_closed_comment": false, "collapsed_by": "nobody", "created_time": 1490936756, "id": 154584837, "voteup_count": 293, "collapse_reason": "", "is_collapsed": false, "author": {"avatar_url_template": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_{size}.jpg", "type": "people", "name": "ze ran", "url": "https://www.zhihu.com/api/v4/people/13ba78a859eaf6b9a5b27c5c56ee8419", "gender": 1, "user_type": "people", "url_token": "ze.ran", "is_advertiser": false, "avatar_url": "https://pic2.zhimg.com/v2-2ef7f1bdfcf4fd26e7c7e715b7e6b8ad_is.jpg", "is_org": false, "headline": "less is more", "badge": [{"topics": [{"introduction": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00<b>\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801<\/b>\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "avatar_url": "https://pic3.zhimg.com/f030b9281d94edbdbe57009a94ffab12_is.jpg", "name": "\u7f16\u7a0b", "url": "https://www.zhihu.com/api/v4/topics/19554298", "type": "topic", "excerpt": "\u4eba\u4eec\u4e3a\u4e86\u8ba9\u8ba1\u7b97\u673a\u89e3\u51b3\u5404\u79cd\u68d8\u624b\u7684\u95ee\u9898\uff0c\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7a0b\u5e8f\u4ee3\u7801\u5e76\u901a\u8fc7\u8ba1\u7b97\u673a\u8fd0\u7b97\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u7684\u8fc7\u7a0b\u3002", "id": "19554298"}], "type": "best_answerer", "description": "\u4f18\u79c0\u56de\u7b54\u8005"}], "id": "13ba78a859eaf6b9a5b27c5c56ee8419"}, "url": "https://www.zhihu.com/api/v4/answers/154584837", "comment_permission": "all", "can_comment": {"status": true, "reason": ""}, "question": {"question_type": "normal", "created": 1467861229, "url": "https://www.zhihu.com/api/v4/questions/48235674", "title": "\u56de\u56fd\u540e\uff0c\u548c\u7236\u4eb2\u8bf4\u8bdd\u5e26\u82f1\u8bed\uff0c\u4ed6\u89c9\u5f97\u6211\u4e0d\u5c0a\u91cd\u4ed6\uff1f", "type": "question", "id": 48235674, "updated_time": 1491011308}, "updated_time": 1490936756, "content": "<p>\u548c\u4f60\u4e00\u8d77\u957f\u5927\u7684\u597d\u670b\u53cb\uff0c\u4e0a\u5b66\u653e\u5b66\uff0c\u65e0\u8bdd\u4e0d\u8bf4\uff0c\u6253\u6253\u95f9\u95f9\uff0c\u52fe\u80a9\u642d\u80cc\u3002\u82e6\u8bfb\u5341\u4e8c\u5e74\uff0c\u4e00\u671d\u9ad8\u8003\uff0c\u4f60\u548c\u4ed6\u53bb\u4e86\u4e0d\u540c\u7684\u57ce\u5e02\u3002<\/p><br><p>\u5bd2\u5047\u89c1\u9762\uff0c\u8feb\u4e0d\u53ca\u5f85\u7684\u62c9\u7740\u4ed6\uff0c\u8981\u597d\u597d\u804a\u804a\u5b66\u6821\u7684\u89c1\u95fb...<\/p><br><p>\u4ed6\u5374\u8bf4\u666e\u901a\u8bdd\u3002<\/p><br><p>\u4ece\u5c0f\u73a9\u5230\u5927\uff0c\u8bf4\u4e86\u5341\u51e0\u5e74\u7684\u5bb6\u4e61\u8bdd\uff0c\u4ed6\u53bb\u4e86\u8d9f\u57ce\u90ca\uff0c\u56de\u6765\u5c31\u53ea\u8bf4\u666e\u901a\u8bdd\u4e86\uff0c\u4f60\u662f\u7528\u666e\u901a\u8bdd\u56de\u5462\uff0c\u8fd8\u662f\u4ed6\u8bf4\u4ed6\u7684\u666e\u901a\u8bdd\uff0c\u4f60\u8bf4\u4f60\u7684\u5bb6\u4e61\u8bdd\uff0c\u600e\u4e48\u90fd\u662f\u522b\u626d\u3002\u95ee\u4ed6\u600e\u4e48\u4e0d\u4f1a\u5bb6\u4e61\u8bdd\u4e86\uff0c\u4ed6\u7b11\u800c\u4e0d\u8bed\uff0c\u9ad8\u6df1\u83ab\u6d4b\u3002<\/p><br><p>\u662f\u4e0d\u662f\u6709\u70b9\u8188\u5e94\uff1f<\/p><br><p>\u540c\u6837\u7684\u9053\u7406\uff0c\u4f60\u7238\u542c\u82f1\u6587\uff0c\u53ef\u80fd\u89c9\u5f97\u66f4\u8188\u5e94\u3002<\/p>", "comment_count": 50, "extras": "", "reshipment_settings": "need_payment", "reward_info": {"reward_member_count": 0, "is_rewardable": false, "reward_total_money": 0, "can_open_reward": false, "tagline": ""}, "is_copyable": false, "type": "answer", "thumbnail": "", "is_normal": true}]} "
6a6f7df26cb37b166a82c2a0b11ebe4621986391
d554b1aa8b70fddf81da8988b4aaa43788fede88
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/225/users/4009/codes/1590_1014.py
a4d00150034f869d011a6a04ebe840fb0ed78141
[]
no_license
JosephLevinthal/Research-projects
a3bc3ca3b09faad16f5cce5949a2279cf14742ba
60d5fd6eb864a5181f4321e7a992812f3c2139f9
refs/heads/master
2022-07-31T06:43:02.686109
2020-05-23T00:24:26
2020-05-23T00:24:26
266,199,309
1
0
null
null
null
null
UTF-8
Python
false
false
45
py
y=float(input("valor:" )) x=y*30/100 print(x)
c3771eaa61b07b3cd184d7bdca9ff13270cbd4b8
163bbb4e0920dedd5941e3edfb2d8706ba75627d
/Code/CodeRecords/2577/60660/296683.py
4283bd8bc19eca118b313934e87233f0cbfd48c0
[]
no_license
AdamZhouSE/pythonHomework
a25c120b03a158d60aaa9fdc5fb203b1bb377a19
ffc5606817a666aa6241cfab27364326f5c066ff
refs/heads/master
2022-11-24T08:05:22.122011
2020-07-28T16:21:24
2020-07-28T16:21:24
259,576,640
2
1
null
null
null
null
UTF-8
Python
false
false
668
py
def jobScheduling(startTime, endTime, profit): n = len(startTime) # 按结束时间排序 work = sorted(zip(startTime, endTime, profit)) # 计算OPT数组 dp = [0] * (n + 1) pos=0#记录与当前不重合的最大区间序号,减少循环量 s=0 for i in range(n): for j in range(pos, i+1): # 区间不重合 if work[i][0] >= work[j][1]: if j == pos: pos += 1 s = max(s, dp[j]) dp[i]=s+work[i][2] print(dp[n-1]) st=eval('['+input()+']') et=eval('['+input()+']') pf=eval('['+input()+']') jobScheduling(st,et,pf)
0569a5ee3ff6e13a8e55562b2dde689b330181d1
945b3c14b5a58f8d98955cdf27aef9469e21523c
/flod_matrikkel_address_restapi/matrikkel.py
370a48d6bcdd2bec075df00225106e533e8fb18f
[ "BSD-2-Clause-Views" ]
permissive
Trondheim-kommune/Bookingbasen
34e595e9c57ea6428406b2806559aab17e9a3031
58235a5a1fd6ad291cb237e6ec9a67bfe8c463c6
refs/heads/master
2022-11-29T00:20:18.681549
2017-05-29T19:33:43
2017-05-29T19:33:43
49,863,780
1
1
NOASSERTION
2022-11-22T00:27:34
2016-01-18T08:47:46
JavaScript
UTF-8
Python
false
false
6,031
py
#!/usr/bin/python # -*- coding: utf-8 -*- from suds.client import Client import suds import re import logging import httplib import ssl import urllib2 import socket import base64 logging.basicConfig(level=logging.INFO) class HTTPSConnectionV3(httplib.HTTPSConnection): def __init__(self, *args, **kwargs): httplib.HTTPSConnection.__init__(self, *args, **kwargs) def connect(self): sock = socket.create_connection((self.host, self.port), self.timeout) if self._tunnel_host: self.sock = sock self._tunnel() try: self.sock = ssl.wrap_socket( sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv3 ) except ssl.SSLError: print("Trying SSLv23.") self.sock = ssl.wrap_socket( sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv23 ) class HTTPSHandlerV3(urllib2.HTTPSHandler): def https_open(self, req): return self.do_open(HTTPSConnectionV3, req) class MatrikkelService(object): def __init__(self, url, wsdl_url, username, password): self.url = url self.wsdl_url = wsdl_url self.username = username self.password = password # install opener opener = urllib2.build_opener(HTTPSHandlerV3()) self.transport = suds.transport.https.HttpAuthenticated( username=username, password=password ) self.transport.urlopener = opener self.client = self.create_client() def create_client(self): base64string = base64.encodestring( '%s:%s' % (self.username, self.password) ).replace('\n', '') authentication_header = { "WWW-Authenticate": "https://www.test.matrikkel.no", "Authorization": "Basic %s" % base64string } client = Client( url=self.wsdl_url, location=self.url, transport=self.transport, username=self.username, password=self.password ) client.set_options(headers=authentication_header) return client def serialize_ident(ident): dict = { "kommunenr": str(ident.kommunenr), "gardsnr": ident.gardsnr, "bruksnr": ident.bruksnr } try: dict["festenr"] = ident.festenr except AttributeError: pass try: dict["seksjonsnr"] = ident.seksjonsnr except AttributeError: pass return dict def get_number_and_letter(query): #finds out if query ends in number or number + character match = re.search(r'\d+(\s+)?([A-Za-z]?)$', query) number = None letter = None if match: number_and_letter = match.group() query = query.replace(number_and_letter, "") number_match = re.search(r'\d+', number_and_letter) if number_match: number = number_match.group() letter_match = re.search(r'[A-Za-z]$', number_and_letter) if letter_match: letter = letter_match.group() return query, number, letter class MatrikkelAdressService(MatrikkelService): def search_address(self, query, municipality_number): matrikkel_context = self.client.factory.create('ns2:MatrikkelContext') query, search_number, search_letter = get_number_and_letter(query) try: adresses = self.client.service.findAdresserForVeg( query, municipality_number, matrikkel_context ) except Exception, e: print type(e) adresses = [] result = [] for address in adresses: address_ident = address.vegadresseIdent if search_number and int(search_number) != int(address_ident.nr): continue try: letter = address_ident.bokstav except AttributeError: letter = None if search_letter and letter.lower() != search_letter.lower(): continue address_response = { "name": "%s %s" % (address.adressenavn, address_ident.nr) } if letter: address_response["name"] += letter try: address_response["matrikkel_ident"] = serialize_ident( address.matrikkelenhetIdent ) result.append(address_response) except AttributeError: pass return result def create_point_dict(point): coord_string = point.point.coordinates.value.split(" ") return { "lon": float(coord_string[0]), "lat": float(coord_string[1]) } class MatrikkelBuildingService(MatrikkelService): def find_buildings(self, kommunenr, gardsnr, bruksnr, festenr=None, seksjonsnr=None): matrikkelenhetident = self.client.factory.create('ns5:MatrikkelenhetIdent') matrikkelenhetident.kommunenr = kommunenr matrikkelenhetident.gardsnr = gardsnr matrikkelenhetident.bruksnr = bruksnr matrikkelenhetident.festenr = festenr matrikkelenhetident.seksjonsnr = seksjonsnr matrikkel_context = self.client.factory.create('ns2:MatrikkelContext') #EPSG:4326 matrikkel_context.sosiKode = 84 buildings = self.client.service.findBygningerForMatrikkelenhet( matrikkelenhetident, matrikkel_context ) return [ { "position": create_point_dict(building.representasjonspunkt), "building_number": building.bygningIdent.bygningsnr } for building in buildings if str(building.__class__) == "suds.sudsobject.Bygning" ]
aa8b90ef142a6c6eab8212204d6d4306724706ae
19bc8a9343aa4120453abeff3deddda7d900f774
/ProgrammingInterviewQuestions/24_DynamicProgrammingFibonacci.py
da078e3a21ff91ec68517a6074e80e997e529813
[]
no_license
ArunkumarRamanan/CLRS-1
98643cde2f561d9960c26378ae29dd92b4c3fc89
f085db885bcee8d09c1e4f036517acdbd3a0918e
refs/heads/master
2020-06-28T08:30:44.029970
2016-11-19T15:27:55
2016-11-19T15:27:55
null
0
0
null
null
null
null
UTF-8
Python
false
false
721
py
# -*- coding: utf-8 -*- """ Created on Sun Sep 25 10:29:52 2016 @author: Rahul Patni """ # Dynamic Programming Fibonacci def recursiveApproach(n): if n == 0 or n == 1: return 1 return recursiveApproach(n - 1) + recursiveApproach(n - 2) def iterativeApproach(n): x1 = 0 x2 = 1 for i in range(1, n + 1): x3 = x1 + x2 x1 = x2 x2 = x3 return x2 def dynamicApproach(n): fib = dict() fib[0] = 1 fib[1] = 1 for i in range(2, n + 1): fib[i] = fib[i - 1] + fib[i - 2] # print fib return fib[n] def main(): x = 10 print recursiveApproach(x) print iterativeApproach(x) print dynamicApproach(x) main()
7bdbc7a11bdde9e5916deb7091b35bd212766c1d
08db28fa3836c36433aa105883a762396d4883c6
/spider/learning/day_01/01_url.py
1359c9c42a557bf47dfc6cf4ab93d3ca22994db6
[]
no_license
xieyipeng/FaceRecognition
1127aaff0dd121319a8652abcfe8a59a7beaaf43
dede5b181d6b70b87ccf00052df8056a912eff0f
refs/heads/master
2022-09-19T07:02:33.624410
2020-06-02T03:03:58
2020-06-02T03:03:58
246,464,586
2
0
null
null
null
null
UTF-8
Python
false
false
808
py
import urllib.request # 学习网址 https://www.bilibili.com/video/av68030937?p=26 def load_data(): url = "http://www.baidu.com/" # get请求 # http请求 # response:http相应对象 response = urllib.request.urlopen(url) print(response) # 读取内容 byte类型 data = response.read() print(data) # 将文件获取的内容转换成字符串 str_data = data.decode("utf-8") print(str_data) # 将数据写入文件 with open("01-baidu.html", "w", encoding="utf-8")as f: f.write(str_data) # 将字符串类型转换为bytes str_name="baidu" byte_name=str_name.encode("utf-8") print(byte_name) # 如果爬取bytes,类型,要写入str: decode # 如果爬取str,类型,要写入bytes: encode load_data()
0d3a0639593a2f61d15a0d586b1eec308bd1662b
933a4f98b3ab1df987bce525d20ca904b225140f
/scripts/slave/recipe_modules/chromium/tests/run_gn.py
1fa3b5362367efa0f9276e1b2c2d605e9d943b9e
[ "BSD-3-Clause" ]
permissive
mcgreevy/chromium-build
3881c489b4d9be2f113da755487808b3593f8156
f8e42c70146c1b668421ee6358dc550a955770a3
refs/heads/master
2020-12-30T12:32:15.685191
2017-05-17T06:58:18
2017-05-17T06:58:18
91,419,271
0
2
NOASSERTION
2020-07-22T09:27:35
2017-05-16T05:52:45
Python
UTF-8
Python
false
false
1,002
py
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. DEPS = [ 'chromium', 'recipe_engine/platform', 'recipe_engine/properties', ] def RunSteps(api): api.chromium.set_config( api.properties.get('chromium_config', 'chromium'), BUILD_CONFIG=api.properties.get('build_config', 'Release'), TARGET_PLATFORM=api.properties.get('target_platform', 'linux')) api.chromium.run_gn(use_goma=True, gn_path=api.properties.get('gn_path')) def GenTests(api): yield api.test('basic') yield ( api.test('custom_gn_path') + api.properties(gn_path='some/other/path/gn') ) yield ( api.test('mac') + api.platform('mac', 64) + api.properties(target_platform='mac') ) yield ( api.test('android') + api.properties(target_platform='android') ) yield ( api.test('debug') + api.properties(build_config='Debug') )
e146a9201f1636b25f025374ad8d9c41871ad505
f0581fa08ef790606ca019890a2233f91b1c42a7
/PythonSrc/Unused/Rotations/vector3d.py
23e7968dd55e8668927443f19b0b467adbd8ada3
[]
no_license
jaycoskey/IntroToPythonCourse
de758f0dd0a1b541edb2ef4dcc20950a8d8788bb
d1373ec6602584a6791fd48d37ae66ff5f104487
refs/heads/master
2023-02-22T16:32:50.533091
2021-01-27T08:22:14
2021-01-27T08:22:14
333,007,314
0
0
null
null
null
null
UTF-8
Python
false
false
1,986
py
package rotations import unittest class Vector3d: ZERO = Vector3d(0.0, 0.0, 0.0) XUNIT = Vector3d(1.0, 0.0, 0.0) YUNIT = Vector3d(0.0, 1.0, 0.0) ZUNIT = Vector3d(0.0, 0.0, 1.0) def __init__(self, *args): if len(args) == 0: self.x = self.y = self.z = 0.0 elif len(args) == 1: self.x = args[0].x self.y = args[0].y self.z = args[0].z elif len(args) == 3: self.x = args[0] self.y = args[1] self.z = args[2] else: raise ValueError('Vector3d() requires 0, 1, or 3 arguments') def __add__(other): return Vector3d(self.x + other.x, self.y + other.y, self.z + other.z) def __mul__(other): return Vector3d(other * v.x, other * v.y, other * v.z) def __rmul__(other): return Vector3d(other * v.x, other * v.y, other * v.z) def __str__(): return '({0:f}, {1:f}, {2:f})'.format(self.x, self.y, self.z) def __sub__(other): return Vector3d(self.x - other.x, self.y - other.y, self.z - other.z) def __truediv__(other): return Vector3d(self.x / other, self.y / other, self.z / other) def as_quaternion(): '''Identifies the imaginary subspace of quaternionic space with R^3.''' return quaternion(0.0, self.x, self.y, self.z) @staticmethod def cross(a, b): result = Vector3d( a.Y * b.Z - a.Z * b.Y, a.Z * b.X - a.X * b.Z, a.X * b.Y - a.Y * b.X ) return result def cross(self, b): return Vector3d.cross(self, b) @staticmethod def dot(a, b): return(a.x * b.x + a.y * b.y + a.z * b.z) def interpolate(a, b, t): return (1 - t) * a + t * b def norm(self): return math.sqrt(self.norm2()) def norm2(self): return self.x ** 2 + self.y ** 2 + self.z ** 2
7b8e5a0b99e1f8250761f4bebafb28c015e5515a
b47f2e3f3298388b1bcab3213bef42682985135e
/experiments/heat-3d/tmp_files/1618.py
79d9cc6c1db159c2a66cbdad061c4da75f285850
[ "BSD-2-Clause" ]
permissive
LoopTilingBenchmark/benchmark
29cc9f845d323431e3d40e878cbfc6d1aad1f260
52a3d2e70216552a498fd91de02a2fa9cb62122c
refs/heads/master
2020-09-25T09:45:31.299046
2019-12-04T23:25:06
2019-12-04T23:25:06
225,975,074
0
0
null
null
null
null
UTF-8
Python
false
false
375
py
from chill import * source('/uufs/chpc.utah.edu/common/home/u1142914/lib/ytopt_vinu/polybench/polybench-code/stencils/heat-3d/kernel.c') destination('/uufs/chpc.utah.edu/common/home/u1142914/lib/ytopt_vinu/experiments/heat-3d/tmp_files/1618.c') procedure('kernel_heat_3d') loop(0) tile(0,2,16,2) tile(0,4,16,4) tile(0,6,32,6) tile(1,2,16,2) tile(1,4,16,4) tile(1,6,32,6)
d929851f0eb039c525508cc703f4ebab44b783d8
b44960d60c4969b2f2014cfc978a9a8ba1e584fa
/122.py
789526cc3e7c00dc524292c8a662260111466325
[]
no_license
sushmithasushi/player
83650582689c9f5a9edc3aee3c46c40a051368c4
949672a23ee2dc31b4748fa221640fe6e85b5324
refs/heads/master
2020-06-17T12:43:39.010920
2019-07-22T01:28:19
2019-07-22T01:28:19
195,928,088
0
0
null
2019-07-09T03:45:57
2019-07-09T03:45:56
null
UTF-8
Python
false
false
70
py
n=int(input()) s=list(map(int,input().split()[:n])) print(n*(n+1)//2)
9395a2ed51c260190fff3c4e43d459356f20f233
ce9d22c3e0e06d5543b404d0c254a582231a0f4b
/tensorflow_federated/python/aggregators/measurements.py
fbf0d5aae3e8289aff9de732e98c67698bdac830
[ "Apache-2.0" ]
permissive
stjordanis/federated
d9da8c68072a4eb7871f8e293dafebd7584a00c4
6819c65eb823dcb7f3f5666051529b9e2346cb28
refs/heads/master
2021-09-08T21:41:56.552453
2021-09-02T23:45:17
2021-09-02T23:46:21
191,418,366
0
0
Apache-2.0
2019-06-11T17:25:27
2019-06-11T17:25:26
null
UTF-8
Python
false
false
7,531
py
# Copyright 2021, The TensorFlow Federated Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Aggregation factory for adding custom measurements.""" import inspect from typing import Any, Callable, Dict, Optional from tensorflow_federated.python.aggregators import factory from tensorflow_federated.python.common_libs import py_typecheck from tensorflow_federated.python.core.api import computations from tensorflow_federated.python.core.impl.federated_context import intrinsics from tensorflow_federated.python.core.impl.types import computation_types from tensorflow_federated.python.core.templates import aggregation_process from tensorflow_federated.python.core.templates import measured_process def add_measurements( inner_agg_factory: factory.AggregationFactory, *, client_measurement_fn: Optional[Callable[..., Dict[str, Any]]] = None, server_measurement_fn: Optional[Callable[..., Dict[str, Any]]] = None, ) -> factory.AggregationFactory: """Wraps `AggregationFactory` to report additional measurements. The function `client_measurement_fn` should be a Python callable that will be called as `client_measurement_fn(value)` or `client_measurement_fn(value, weight)` depending on whether `inner_agg_factory` is weighted or unweighted. It must be traceable by TFF and expect `tff.Value` objects placed at `CLIENTS` as inputs, and return a `collections.OrderedDict` mapping string names to tensor values placed at `SERVER`, which will be added to the measurement dict produced by the `inner_agg_factory`. Similarly, `server_measurement_fn` should be a Python callable that will be called as `server_measurement_fn(result)` where `result` is the result (on server) of the inner aggregation. One or both of `client_measurement_fn` and `server_measurement_fn` must be specified. Args: inner_agg_factory: The factory to wrap and add measurements. client_measurement_fn: A Python callable that will be called on `value` (and/or `weight`) provided to the `next` function to compute additional measurements of the client values/weights. server_measurement_fn: A Python callable that will be called on the `result` of aggregation at server to compute additional measurements of the result. Returns: An `AggregationFactory` that reports additional measurements. """ py_typecheck.check_type(inner_agg_factory, factory.AggregationFactory.__args__) if not (client_measurement_fn or server_measurement_fn): raise ValueError('Must specify one or both of `client_measurement_fn` or ' '`server_measurement_fn`.') if client_measurement_fn: py_typecheck.check_callable(client_measurement_fn) if isinstance(inner_agg_factory, factory.UnweightedAggregationFactory): if len(inspect.signature(client_measurement_fn).parameters) != 1: raise ValueError( '`client_measurement_fn` must take a single parameter if ' '`inner_agg_factory` is unweighted.') elif isinstance(inner_agg_factory, factory.WeightedAggregationFactory): if len(inspect.signature(client_measurement_fn).parameters) != 2: raise ValueError( '`client_measurement_fn` must take a two parameters if ' '`inner_agg_factory` is weighted.') if server_measurement_fn: py_typecheck.check_callable(server_measurement_fn) if len(inspect.signature(server_measurement_fn).parameters) != 1: raise ValueError('`server_measurement_fn` must take a single parameter.') @computations.tf_computation() def dict_update(orig_dict, new_values): if not orig_dict: return new_values orig_dict.update(new_values) return orig_dict if isinstance(inner_agg_factory, factory.WeightedAggregationFactory): class WeightedWrappedFactory(factory.WeightedAggregationFactory): """Wrapper for `WeightedAggregationFactory` that adds new measurements.""" def create( self, value_type: factory.ValueType, weight_type: factory.ValueType ) -> aggregation_process.AggregationProcess: py_typecheck.check_type(value_type, factory.ValueType.__args__) py_typecheck.check_type(weight_type, factory.ValueType.__args__) inner_agg_process = inner_agg_factory.create(value_type, weight_type) init_fn = inner_agg_process.initialize @computations.federated_computation( init_fn.type_signature.result, computation_types.at_clients(value_type), computation_types.at_clients(weight_type)) def next_fn(state, value, weight): inner_agg_output = inner_agg_process.next(state, value, weight) measurements = inner_agg_output.measurements if client_measurement_fn: client_measurements = client_measurement_fn(value, weight) measurements = intrinsics.federated_map( dict_update, (measurements, client_measurements)) if server_measurement_fn: server_measurements = server_measurement_fn(inner_agg_output.result) measurements = intrinsics.federated_map( dict_update, (measurements, server_measurements)) return measured_process.MeasuredProcessOutput( state=inner_agg_output.state, result=inner_agg_output.result, measurements=measurements) return aggregation_process.AggregationProcess(init_fn, next_fn) return WeightedWrappedFactory() else: class UnweightedWrappedFactory(factory.UnweightedAggregationFactory): """Wrapper for `UnweightedAggregationFactory` that adds new measurements.""" def create( self, value_type: factory.ValueType ) -> aggregation_process.AggregationProcess: py_typecheck.check_type(value_type, factory.ValueType.__args__) inner_agg_process = inner_agg_factory.create(value_type) init_fn = inner_agg_process.initialize @computations.federated_computation( init_fn.type_signature.result, computation_types.at_clients(value_type)) def next_fn(state, value): inner_agg_output = inner_agg_process.next(state, value) measurements = inner_agg_output.measurements if client_measurement_fn: client_measurements = client_measurement_fn(value) measurements = intrinsics.federated_map( dict_update, (measurements, client_measurements)) if server_measurement_fn: server_measurements = server_measurement_fn(inner_agg_output.result) measurements = intrinsics.federated_map( dict_update, (measurements, server_measurements)) return measured_process.MeasuredProcessOutput( state=inner_agg_output.state, result=inner_agg_output.result, measurements=measurements) return aggregation_process.AggregationProcess(init_fn, next_fn) return UnweightedWrappedFactory()
9b029ba1462be18dcc18bfc84ccc15d1ca07a792
0c2583011200a5bed73315fde7ef30678075fce7
/modules/db/entities/US_TOIMP.py
c7bdec4c93c6cdf081aa1872ccff8557411b87aa
[]
no_license
enzococca/pyarchinit_3
3d3b5784a3b2e4b753581f28064748043f8c47fe
00626ba5c24d447fc54c267071f0584a2962182c
refs/heads/master
2020-03-09T16:59:21.853411
2018-03-12T14:49:51
2018-03-12T14:49:51
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,869
py
''' Created on 19 feb 2018 @author: Serena Sensini ''' class US_TOIMP(object): #def __init__" def __init__(self, id_us, sito, area, us, d_stratigrafica, d_interpretativa, descrizione, interpretazione, periodo_iniziale, fase_iniziale, periodo_finale, fase_finale, scavato, attivita, anno_scavo, metodo_di_scavo, inclusi, campioni, rapporti, data_schedatura, schedatore, formazione, stato_di_conservazione, colore, consistenza, struttura ): self.id_us = id_us #0 self.sito = sito #1 self.area = area #2 self.us = us #3 self.d_stratigrafica = d_stratigrafica #4 self.d_interpretativa = d_interpretativa #5 self.descrizione = descrizione #6 self.interpretazione = interpretazione #7 self.periodo_iniziale = periodo_iniziale #8 self.fase_iniziale = fase_iniziale #9 self.periodo_finale = periodo_finale #10 self.fase_finale = fase_finale #11 self.scavato = scavato #12 self.attivita = attivita #13 self.anno_scavo = anno_scavo #14 self.metodo_di_scavo = metodo_di_scavo #15 self.inclusi = inclusi #16 self.campioni = campioni #17 self.rapporti = rapporti #18 self.data_schedatura = data_schedatura #19 self.schedatore = schedatore #20 self.formazione = formazione #21 self.stato_di_conservazione = stato_di_conservazione #22 self.colore = colore #23 self.consistenza = consistenza #24 self.struttura = struttura #25 #def __repr__" def __repr__(self): return "<US_TOIMP('%d', '%s', '%s', '%d','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')>" % ( self.id_us, self.sito, self.area, self.us, self.d_stratigrafica, self.d_interpretativa, self.descrizione, self.interpretazione, self.periodo_iniziale, self.fase_iniziale, self.periodo_finale, self.fase_finale, self.scavato, self.attivita, self.anno_scavo, self.metodo_di_scavo, self.inclusi, self.campioni, self.rapporti, self.data_schedatura, self.schedatore, self.formazione, self.stato_di_conservazione, self.colore, self.consistenza, self.struttura )
4dffd211b37de445ce2265d53a8f960213309ae9
fc2d1f44ec35577b0e291f403907ccc8c7859edf
/docs/conf.py
d59a6ebf0dd656cf813d7cab8dbcd6f4446c78ff
[ "MIT" ]
permissive
sobolevn/python-humanfriendly
35403b4e611f0f95ad474de8e8efd354f12b5369
03d1db48e8ab4539403a58d7dea7ef0bd6672ae3
refs/heads/master
2020-04-26T10:52:16.294536
2019-02-21T20:21:43
2019-02-21T20:21:43
173,498,753
0
0
MIT
2019-03-02T21:04:23
2019-03-02T21:04:23
null
UTF-8
Python
false
false
2,325
py
# -*- coding: utf-8 -*- """Documentation build configuration file for the `humanfriendly` package.""" import os import sys # Add the 'humanfriendly' source distribution's root directory to the module path. sys.path.insert(0, os.path.abspath('..')) # -- General configuration ----------------------------------------------------- # Sphinx extension module names. extensions = [ 'sphinx.ext.doctest', 'sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'humanfriendly.sphinx', ] # Configuration for the `autodoc' extension. autodoc_member_order = 'bysource' # Paths that contain templates, relative to this directory. templates_path = ['templates'] # The suffix of source filenames. source_suffix = '.rst' # The master toctree document. master_doc = 'index' # General information about the project. project = u'humanfriendly' copyright = u'2018, Peter Odding' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # Find the package version and make it the release. from humanfriendly import __version__ as humanfriendly_version # noqa # The short X.Y version. version = '.'.join(humanfriendly_version.split('.')[:2]) # The full version, including alpha/beta/rc tags. release = humanfriendly_version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. language = 'en' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['build'] # If true, '()' will be appended to :func: etc. cross-reference text. add_function_parentheses = True # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # Refer to the Python standard library. # From: http://twistedmatrix.com/trac/ticket/4582. intersphinx_mapping = dict( python2=('https://docs.python.org/2', None), python3=('https://docs.python.org/3', None), coloredlogs=('https://coloredlogs.readthedocs.io/en/latest/', None), ) # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'nature'
5ef4c9611c9a041497ebe1c6441f572a0ea7280a
feca498db2f7819320bdc177fe6f9368fbd83ab9
/loop_script_morph.py
e9bea5d9d9a3400aba9e49b6443b049e63d89e4a
[]
no_license
ModelDBRepository/241932
a98155010f46f068533f746d08061540ebaf9a84
ea9aabbbb29f086e924f837832b99cac1961e1cb
refs/heads/master
2020-03-19T10:07:19.457538
2018-06-06T19:32:32
2018-06-06T19:32:32
136,344,942
2
0
null
null
null
null
UTF-8
Python
false
false
46,194
py
# -*- coding: utf-8 -*- """ Created on Thu Jul 2 10:32:29 2015 @author: rennocosta This script is part of the publication Renno-Costa & Tort, 2017, JNeurosci This script relates to the data presented in the Figure 5, 6, 7 and 8 Will run a single experiment with specific parameters determined below Output data will be saved in file direction defined at support_filename.py script """ import sys, argparse import numpy as np from numpy import * import gzip import pickle import support_filename as rfn import copy # acessory functions def normalize_weight(www,www_mean): www /= np.tile(np.mean(www,axis=0),(www.shape[0],1)) return www def learn_weight(www,activity_pre,activity_pos,lrate): #www += lrate*(np.tile(activity_pre,(activity_pos.shape[0],1)).transpose()-www) * (np.tile(activity_pos,(activity_pre.shape[0],1))) www += lrate*(np.tile(activity_pre,(activity_pos.shape[0],1)).transpose()) * (np.tile(activity_pos,(activity_pre.shape[0],1))) return www def lec_whichone(lectype,change,ccc,sss): saida = np.zeros(lectype.shape) saida[np.logical_and(lectype==1,change<ccc)] = 2 saida[np.logical_and(lectype==1,change>=ccc)] = 1 saida[np.logical_and(lectype==0,change<sss)] = 2 saida[np.logical_and(lectype==0,change>=sss)] = 1 saida[lectype==2] = 1 return saida def main(argv): parser = argparse.ArgumentParser(description='Will run a simulation instance.') # seeds for the random number generator # seed for the input activity pattern parser.add_argument('seed_input', metavar='seed_input', type=int, nargs=1, help='seed_input number') # seed for the initial synaptic weights parser.add_argument('seed_www', metavar='seed_www', type=int, nargs=1, help='seed_www') # seed for the trajectories parser.add_argument('seed_path', metavar='seed_path', type=int, nargs=1, help='seed_path') # variables of the session # number of theta cycles simulated for each position parser.add_argument('theta_cycles', metavar='theta_cycles', type=int, nargs=1, help='theta_cycles') # number of times that the agent makes a full exploration of the arena for each session parser.add_argument('arena_runs', metavar='arena_runs', type=int, nargs=1, help='arena_runs') # number of sessions with plasticity run before collecting data parser.add_argument('pre_runs', metavar='pre_runs', type=int, nargs=1, help='pre_runs') # learning rates from place to grid cells, grid to place cells and from lec to place cells... parser.add_argument('lrate_hpc_mec', metavar='lrate_hpc_mec', type=int, nargs=1, help='lrate_hpc_mec') parser.add_argument('lrate_mec_hpc', metavar='lrate_mec_hpc', type=int, nargs=1, help='lrate_mec_hpc') parser.add_argument('lrate_lec_hpc', metavar='lrate_lec_hpc', type=int, nargs=1, help='lrate_lec_hpc') # ... relative number of place cells vs recurrent grid cells ... # sensibility of pattern completion algorithm # relative number of grid cells vs lec cells as place cell input (0 to 100) parser.add_argument('mec_ratio', metavar='mec_ratio', type=int, nargs=1, help='MEC ratio (x100)') # relative number of place cells vs recurrent grid cells as grid cell input (0 to 100) parser.add_argument('hpc_ratio', metavar='hpc_ratio', type=int, nargs=1, help='HPC ratio (x100)') # relative number of place cells vs recurrent grid cells as grid cell input (0 to 100) parser.add_argument('hpc_pcompl_th', metavar='hpc_pcompl_th', type=int, nargs=1, help='HPC pattern completion th (x100)') # sensibility of pattern completion algorithm parser.add_argument('morph_per', metavar='morph_per', type=int, nargs=1, help='morph_per') # flag to save the activity of cells... use with caution parser.add_argument('-a', '--activity',dest='actsave',action='store_const',default="no",const="yes") # flags to set the place to save the files # parser.add_argument('-w', '--windows',dest='envir',action='store_const',default="default",const="windows") # parser.add_argument('-u', '--ufrgs',dest='envir',action='store_const',default="default",const="UFRGS") parser.add_argument('-s', '--cluster',dest='envir',action='store_const',default="default",const="cluster") # flag to overwrite previous simulation parser.add_argument('-k', '--KILL',dest='tokill',action='store_const',default="no",const="yes") # for conencted environments, not implemented #parser.add_argument('-c', '--connected',dest='conntype',action='store_const',default="no",const="yes") # process the arguments args = parser.parse_args() envir = args.envir # conntype = args.conntype actsave = args.actsave tokill = args.tokill; ct = 0 conna = False # if(conntype=="yes"): # conna = True # ct = 1 # else: # ct = 0 # conna = False if(actsave=="yes"): acts = True else: acts = False seed_input = args.seed_input[0] seed_www = args.seed_www[0] seed_path = args.seed_path[0] mec_ratio = float(args.mec_ratio[0])/100 hpc_ratio = float(args.hpc_ratio[0])/100 hpc_pcompl_th = float(args.hpc_pcompl_th[0])/100 morphing_per = float(args.morph_per[0])/100 lrate_hpc_mec = float(args.lrate_hpc_mec[0])/1000 lrate_mec_hpc = float(args.lrate_mec_hpc[0])/1000 lrate_lec_hpc = float(args.lrate_lec_hpc[0])/1000 theta_cycles = args.theta_cycles[0] arena_runs = args.arena_runs[0] pre_runs = args.pre_runs[0] simulation_num = 69; listofvalues = [ct,args.seed_input[0],args.seed_www[0],args.seed_path[0],args.theta_cycles[0],args.arena_runs[0],args.pre_runs[0],args.lrate_hpc_mec[0],args.lrate_mec_hpc[0],args.lrate_lec_hpc[0],args.mec_ratio[0],args.hpc_ratio[0],args.hpc_pcompl_th[0],args.morph_per[0]] filenames = rfn.remappingFileNames(envir) filenames.prepareSimulation(listofvalues,simulation_num) if (tokill == "no"): try: tosee = 0; with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,0)+'z', 'rb') as ff: tosee = tosee + 1 with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,1)+'z', 'rb') as ff: tosee = tosee + 1 with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,2)+'z', 'rb') as ff: tosee = tosee + 1 with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,3)+'z', 'rb') as ff: tosee = tosee + 1 with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,4)+'z', 'rb') as ff: tosee = tosee + 1 with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,5)+'z', 'rb') as ff: tosee = tosee + 1 print("File exist. Will exit!") torun = 0; except: print("File does not existe. Will do!",flush=True) print("... %s" % (filenames.fileRunPickle(listofvalues,simulation_num,0))) torun = 1; else: print("Will do anyway!",flush=True) torun = 0; if(torun == 0): sys.exit(); # %% # # # MAKE ALL INITIALIZATIONS # # # #set the arena size arena_binsize = [4,4] context_per = 0 # set the patterns of input activity np.random.seed(seed_input) lec_numcells = 500 lec_activity = [] lec_activity.append(pow(np.random.uniform(0,1,(lec_numcells,arena_binsize[0],arena_binsize[1])),2)) lec_activity.append(pow(np.random.uniform(0,1,(lec_numcells,arena_binsize[0],arena_binsize[1])),2)) lec_type = np.random.uniform(0,1,(lec_numcells,arena_binsize[0],arena_binsize[1])) lec_type[lec_type>(1-context_per)] = 1 lec_type[lec_type<morphing_per] = 0 lec_type[np.logical_and(lec_type<=(1-context_per),lec_type>=morphing_per)]=2 lec_change = np.random.uniform(0,1,(lec_numcells,arena_binsize[0],arena_binsize[1])) # number of place cells cells hpc_numcells = 5000 hpc_memories = [] # set the grid cells topology mec_blocksize = [2,4,6,8,10,12,14,16] mec_blocks = len(mec_blocksize) mec_numcells = np.sum(np.power(mec_blocksize,2)) mec_indexlist = [] init_val = 0 for ii in arange(mec_blocks): mec_indexlist.append((init_val+arange(pow(mec_blocksize[ii],2))).reshape((mec_blocksize[ii],mec_blocksize[ii]))) init_val = np.max(mec_indexlist[ii])+1 del(init_val) random.uniform(0,1,(lec_numcells,arena_binsize[0],arena_binsize[1])) # set the different trajectories np.random.seed(seed_path) xxx,yyy = np.meshgrid(arange(arena_binsize[0]),arange(arena_binsize[1])) xxx = xxx.ravel() popo = [] for ii in arange(100): popo.append(np.random.permutation(len(xxx))) #set the initial synaptic weights np.random.seed(seed_www) lec_hpc_weights_mean = 1 lec_hpc_weights = np.random.lognormal(1.0,1.0,(lec_numcells,hpc_numcells)) lec_hpc_weights[lec_hpc_weights<0] = 0 lec_hpc_weights = normalize_weight(lec_hpc_weights,lec_hpc_weights_mean) mec_hpc_weights_mean = 1 mec_hpc_weights = np.random.lognormal(1.0,1.0,(mec_numcells,hpc_numcells)) mec_hpc_weights[mec_hpc_weights<0] = 0 mec_hpc_weights = normalize_weight(mec_hpc_weights,mec_hpc_weights_mean) hpc_mec_weights_mean = 1 hpc_mec_weights = np.random.lognormal(1.0,1.0,(hpc_numcells,mec_numcells)) hpc_mec_weights[hpc_mec_weights<0] = 0 hpc_mec_weights = normalize_weight(hpc_mec_weights,hpc_mec_weights_mean) # set the E%MAX current_emax = 0.90 current_emax_plast = 0 current_lrate_hpc_mec = lrate_hpc_mec current_lrate_mec_hpc = lrate_mec_hpc current_lrate_lec_hpc = lrate_lec_hpc lec_hpc_weights_mean = 1 mec_hpc_weights_mean = 1 hpc_mec_weights_mean = 1 lec_noise = 0 mec_noise = 0 hpc_noise = 0 # %% # # # PRE-LEARN - SIMULATIONS WITH LEARNING BEFORE SAVING THE DATA # - THIS PART SIMULATES THE HABITUATION OF THE ANIMAL PRIOR TO IMPLANT # # lllf = [1.0,1.0] mooo = [mec_ratio,mec_ratio] shape_vec = [0.0,1.0] context_vec = [0.0,0.0] pzzz = [0,0] for sessions in arange(pre_runs): print("session %d of %d" % (sessions,pre_runs),flush=True) hhhr = hpc_ratio * (sessions/(pre_runs-1)) lllf[0] = 1.0 lllf[1] = 1.0 pzzz[0] = sessions + 16 pzzz[1] = sessions + 16 + pre_runs lec_act_vect = [] mec_act_vect = [] hpc_act_vect = [] mec_inact_vect = np.zeros((len(shape_vec),mec_numcells,arena_binsize[0],arena_binsize[1])) hpc_inact_vect = np.zeros((len(shape_vec),hpc_numcells,arena_binsize[0],arena_binsize[1])) lec_inact_vect = np.zeros((len(shape_vec),lec_numcells,arena_binsize[0],arena_binsize[1])) for ii in arange(len(shape_vec),dtype=int): print("shape %d of %d" % (ii,len(shape_vec)),flush=True) mec_ratio = mooo[ii] lec_act = zeros((lec_numcells,arena_binsize[0],arena_binsize[1])) hpc_act = zeros((hpc_numcells,arena_binsize[0],arena_binsize[1])) mec_act = zeros((mec_numcells,arena_binsize[0],arena_binsize[1])) xxx,yyy = np.meshgrid(arange(arena_binsize[0]),arange(arena_binsize[0])) xxx = xxx.ravel() yyy = yyy.ravel() #ppp = np.random.permutation(len(xxx)) ppp = popo[pzzz[ii]] xxx = xxx[ppp].astype(int) yyy = yyy[ppp].astype(int) # # xxx = xxx + 4 if (lllf[ii]>0): xxxr = [] yyyr = [] for arena_runss in arange(arena_runs): xxxr = concatenate([xxx,xxxr]) yyyr = concatenate([yyy,yyyr]) xxx = xxxr yyy = yyyr if((conna == True) and (ii > 0)): current_pos = current_pos - array((4,0)) else: current_pos = array((xxx[0],yyy[0])).astype(int) current_hpc_activity = np.zeros(hpc_numcells) if ((ii<1) or (conna == False)): current_mec_activity = np.zeros(mec_numcells) current_context = context_vec[ii] current_shape = shape_vec[ii] current_vector = lec_whichone(lec_type,lec_change,current_context,current_shape) base_lec = np.zeros(current_vector.shape) base_lec = lec_activity[0].copy() base_lec[current_vector==2] = lec_activity[1][current_vector==2] for pp in arange(len(xxx),dtype=int): print("aaa %d of %d" % (pp,len(xxx)),flush=True) current_pos_old = current_pos current_pos = array((xxx[pp],yyy[pp])).astype(int) current_speed = current_pos - current_pos_old current_lec_activity = base_lec[:,current_pos[0],current_pos[1]] current_lec_noise = np.random.uniform(0.0,lec_noise,current_lec_activity.shape) current_mec_noise = np.random.uniform(0.0,mec_noise,current_mec_activity.shape) current_hpc_noise = np.random.uniform(0.0,hpc_noise,current_hpc_activity.shape) lec_inact_vect[ii.astype(int) ,:,xxx[pp].astype(int) ,yyy[pp].astype(int) ] = current_lec_activity for kk in arange(theta_cycles): if (kk>0): current_speed = array((0,0)) current_mec_input = (current_mec_activity+current_mec_noise) if (mec_ratio>0.0): for jj in arange(mec_blocks): gxx,gyy = meshgrid(arange(mec_blocksize[jj])+(-1)*current_speed[0],arange(mec_blocksize[jj])+(-1)*current_speed[1]) gyy[mod(divide(gxx-mod(gxx,mec_blocksize[jj]),mec_blocksize[jj]),2)>0] = gyy[mod(divide(gxx-mod(gxx,mec_blocksize[jj]),mec_blocksize[jj]),2)>0] + floor(mec_blocksize[jj]/2) gxx = int0(mod(gxx,mec_blocksize[jj])) gyy = int0(mod(gyy,mec_blocksize[jj])) current_mec_input[mec_indexlist[jj]] = current_mec_input[mec_indexlist[jj]][gyy,gxx] #mec_input_vect[ii,kk,mec_indexlist[jj],xxx[pp],yyy[pp]] = current_mec_input[mec_indexlist[jj]] h_h = np.dot(current_hpc_activity+current_hpc_noise,hpc_mec_weights) if(np.max(h_h)>0.0): h_h = h_h/np.max(h_h) h_h[isnan(h_h)] = 0.0 current_mec_input = (1-mec_ratio)*h_h + mec_ratio*current_mec_input current_lec_noise = np.random.uniform(0.0,lec_noise,current_lec_activity.shape) current_mec_noise = np.random.uniform(0.0,mec_noise,current_mec_activity.shape) current_hpc_noise = np.random.uniform(0.0,hpc_noise,current_hpc_activity.shape) for jj in arange(mec_blocks): current_mec_activity[mec_indexlist[jj]] = (current_mec_input[mec_indexlist[jj]] - current_emax*np.max(current_mec_input[mec_indexlist[jj]])) current_mec_activity[current_mec_activity<0] = 0.0 current_mec_activity[mec_indexlist[jj]] /= np.max(current_mec_activity[mec_indexlist[jj]]) current_mec_activity[isnan(current_mec_activity)] = 0.0 mec_inact_vect[ii.astype(int) ,mec_indexlist[jj.astype(int) ].astype(int) ,xxx[pp].astype(int) ,yyy[pp].astype(int) ] = current_mec_activity[mec_indexlist[jj.astype(int) ].astype(int) ] h_l = np.dot(current_lec_activity+current_lec_noise,lec_hpc_weights) h_l = h_l/np.max(h_l) h_l[isnan(h_l)] = 0.0 if(hhhr>0): h_m = np.dot(current_mec_activity+current_mec_noise,mec_hpc_weights) if(np.max(h_m)>0.0): h_m = h_m/np.max(h_m) h_m[isnan(h_m)] = 0.0 current_hpc_input = (1-hhhr)*h_l + hhhr*h_m else: current_hpc_input = h_l; if (kk>0): ddd = current_hpc_activity * 0 for mm in arange(len(hpc_memories)): ccc = corrcoef(hpc_memories[mm],current_hpc_activity+current_hpc_noise)[0][1] if ccc<hpc_pcompl_th: ccc=0 else: ddd += hpc_memories[mm] if (np.max(ddd) > 0): ddd = ddd/np.max(ddd) ddd[isnan(ddd)] = 0.0 current_hpc_input = (1-mec_ratio)*current_hpc_input + mec_ratio*ddd current_hpc_activity = (current_hpc_input - current_emax*np.max(current_hpc_input)) current_hpc_activity[current_hpc_activity<0] = 0.0 current_hpc_activity /= np.max(current_hpc_activity) current_hpc_activity[current_hpc_activity<current_emax_plast] = 0 hpc_inact_vect[ii.astype(int),:,xxx[pp].astype(int),yyy[pp].astype(int)] = current_hpc_activity if (lllf[ii]>0): lec_hpc_weights = normalize_weight(learn_weight(lec_hpc_weights,current_lec_activity+current_lec_noise,current_hpc_activity+current_hpc_noise,current_lrate_lec_hpc),lec_hpc_weights_mean) mec_hpc_weights = normalize_weight(learn_weight(mec_hpc_weights,current_mec_activity+current_mec_noise,current_hpc_activity+current_hpc_noise,current_lrate_mec_hpc),mec_hpc_weights_mean) hpc_mec_weights = normalize_weight(learn_weight(hpc_mec_weights,current_hpc_activity+current_hpc_noise,current_mec_activity+current_mec_noise,current_lrate_hpc_mec),hpc_mec_weights_mean) if ((lllf[ii]>0) and (hpc_pcompl_th<1.0)): hpc_memories.append(current_hpc_activity) lec_act[:,xxx[pp].astype(int),yyy[pp].astype(int)] = current_lec_activity mec_act[:,xxx[pp].astype(int),yyy[pp].astype(int)] = current_mec_activity hpc_act[:,xxx[pp].astype(int),yyy[pp].astype(int)] = current_hpc_activity mec_act_vect.append(mec_act) lec_act_vect.append(lec_act) hpc_act_vect.append(hpc_act) # %% # # # PREPARE THE SIMULATION... WILL SET THE ENVIRONMENTAL VARIABLES FOR EACH SESSION OF THE PROTOCOL # EMULATES THE MORPHING PROTOCOL # # mooo = 0.9999 * np.ones((108)) hooo = hpc_ratio * np.ones((108)) shape_vec = 0.0 * np.ones((108)) context_vec = 0.0 * np.ones((108)) lllf = 0.0 * np.ones((108)) pzzz = np.concatenate((arange(1),arange(1),arange(0,16),arange(0,16),arange(0,16),arange(0,16),arange(0,21),arange(0,21),arange(0,21),arange(0,21),arange(0,21),arange(0,21))) lllf[0] = 0.0 mooo[0] = mec_ratio mooo[18:34] = mec_ratio lllf[1] = 0.0 mooo[1] = mec_ratio mooo[50:67] = mec_ratio mooo[66:] = mec_ratio hooo[87:108] = 0.0 shape_vec[1] = 1.0 shape_vec[34:66] = 1.0 shape_vec[66:87]=np.linspace(0.0,1.0,21) shape_vec[87:108]=np.linspace(0.0,1.0,21) nono = 0.0 * np.ones((108)) # %% # # # RUN THE SIMULATION... # # # num_runsss = 1 corrVectMEC1 = -1* ones(num_runsss) corrVectHPC1 = -1* ones(num_runsss) corrVectMECGRID1 = -1* ones(num_runsss) corrVectHPCGRID1 = -1* ones(num_runsss) corrVectMECvsGRID1 = -1* ones(num_runsss) corrVectMEC2 = -1* ones(num_runsss) corrVectHPC2 = -1* ones(num_runsss) corrVectMECGRID2 = -1* ones(num_runsss) corrVectHPCGRID2 = -1* ones(num_runsss) corrVectMECvsGRID2 = -1* ones(num_runsss) corrVectMECx = -1* ones(num_runsss) corrVectHPCx = -1* ones(num_runsss) corrVectMECGRIDx = -1* ones(num_runsss) corrVectHPCGRIDx = -1* ones(num_runsss) dist_pf1 = -1*ones((num_runsss,16)) dist_pf2 = -1*ones((num_runsss,16)) pvCorrelationCurveHPC1 = -1*ones((num_runsss,21)) pvCorrelationCurveMEC1 = -1*ones((num_runsss,21)) pvCorrelationCurveHPC2 = -1*ones((num_runsss,21)) pvCorrelationCurveMEC2 = -1*ones((num_runsss,21)) pvCorrelationCurveHPC = -1*ones((num_runsss,21)) pvCorrelationCurveMEC = -1*ones((num_runsss,21)) pvCorrelationCurveHPC1Lesion = -1*ones((num_runsss,21)) pvCorrelationCurveMEC1Lesion = -1*ones((num_runsss,21)) pvCorrelationCurveHPC2Lesion = -1*ones((num_runsss,21)) pvCorrelationCurveMEC2Lesion = -1*ones((num_runsss,21)) pvCorrelationCurveHPCLesion = -1*ones((num_runsss,21)) pvCorrelationCurveMECLesion = -1*ones((num_runsss,21)) # LOOP FOR EACH PROTOCOL DEFINED EARLIER for sessions in arange(num_runsss): print("session %d of %d" % (sessions,num_runsss),flush=True) pzzz[0] = sessions + 16 + pre_runs pzzz[1] = sessions + 16 + pre_runs + num_runsss lec_act_vect = [] mec_act_vect = [] hpc_act_vect = [] mec_inact_vect = np.zeros((len(shape_vec),mec_numcells,arena_binsize[0],arena_binsize[1])) hpc_inact_vect = np.zeros((len(shape_vec),hpc_numcells,arena_binsize[0],arena_binsize[1])) lec_inact_vect = np.zeros((len(shape_vec),lec_numcells,arena_binsize[0],arena_binsize[1])) # RUN FOR EACH SESSION for ii in arange(len(shape_vec)): print("shape %d of %d" % (ii,len(shape_vec)),flush=True) mec_ratio = mooo[ii] hpc_ratio = hooo[ii] lec_act = zeros((lec_numcells,arena_binsize[0],arena_binsize[1])) mec_act = zeros((mec_numcells,arena_binsize[0],arena_binsize[1])) hpc_act = zeros((hpc_numcells,arena_binsize[0],arena_binsize[1])) # SET TRAJECTORY xxx,yyy = np.meshgrid(arange(arena_binsize[0]),arange(arena_binsize[0])) xxx = xxx.ravel() yyy = yyy.ravel() ppp = popo[pzzz[ii]] xxx = xxx[ppp] yyy = yyy[ppp] if((conna == True) and (ii == 1)): current_pos = current_pos - array((5,0)) else: current_pos = array((xxx[0],yyy[0])) current_hpc_activity = np.zeros(hpc_numcells) if ((ii!=1) or (conna == False)): current_mec_activity = np.zeros(mec_numcells) current_hpc_activity = np.zeros(hpc_numcells) current_mec_activity = np.zeros(mec_numcells) current_context = context_vec[ii] current_shape = shape_vec[ii] current_vector = lec_whichone(lec_type,lec_change,current_context,current_shape) base_lec = np.zeros(current_vector.shape) base_lec = lec_activity[0].copy() base_lec[current_vector==2] = lec_activity[1][current_vector==2] #set the random seed np.random.seed(seed_path+ii) if (nono[ii]>0.0): ttt = floor(lec_numcells*nono[ii]); base_lec[:ttt,:,:] = pow(np.random.uniform(0,1,(ttt,arena_binsize[0],arena_binsize[1])),2) # RUN FOR EACH POSITION OF THE TRAJECTORY for pp in arange(len(xxx)): print("aaa %d of %d" % (pp,len(xxx)),flush=True) # COMPUTE SPEED AND LEC ACTIVITY current_pos_old = current_pos current_pos = array((xxx[pp],yyy[pp])) current_speed = current_pos - current_pos_old current_lec_activity = base_lec[:,current_pos[0],current_pos[1]] current_lec_noise = np.random.uniform(0.0,lec_noise,current_lec_activity.shape) current_mec_noise = np.random.uniform(0.0,mec_noise,current_mec_activity.shape) current_hpc_noise = np.random.uniform(0.0,hpc_noise,current_hpc_activity.shape) lec_inact_vect[ii,:,xxx[pp],yyy[pp]] = current_lec_activity # RUN FOR EACH THETA CYCLE for kk in arange(theta_cycles): # SET SPEED ZERO FOR THE FIRST POSITION if (kk>0): current_speed = array((0,0)) # COMPUTE THE RECURRENT GRID CELL ACTIVITY - TWISTED TOURUS current_mec_input = (current_mec_activity+current_mec_noise) if(mec_ratio>0.0): for jj in arange(mec_blocks): gxx,gyy = meshgrid(arange(mec_blocksize[jj])+(-1)*current_speed[0],arange(mec_blocksize[jj])+(-1)*current_speed[1]) gyy[mod(divide(gxx-mod(gxx,mec_blocksize[jj]),mec_blocksize[jj]),2)>0] = gyy[mod(divide(gxx-mod(gxx,mec_blocksize[jj]),mec_blocksize[jj]),2)>0] + floor(mec_blocksize[jj]/2) gxx = int0(mod(gxx,mec_blocksize[jj])) gyy = int0(mod(gyy,mec_blocksize[jj])) current_mec_input[mec_indexlist[jj]] = current_mec_input[mec_indexlist[jj]][gyy,gxx] # COMPUTE INPUT TO GRID CELLS h_h = np.dot(current_hpc_activity+current_hpc_noise,hpc_mec_weights) h_h = h_h/np.max(h_h) h_h[isnan(h_h)] = 0.0 current_mec_input = (1-mec_ratio)*h_h + mec_ratio*current_mec_input current_lec_noise = np.random.uniform(0.0,lec_noise,current_lec_activity.shape) current_mec_noise = np.random.uniform(0.0,mec_noise,current_mec_activity.shape) current_hpc_noise = np.random.uniform(0.0,hpc_noise,current_hpc_activity.shape) # COMPUTE e% MAX OF GRID CELLS for jj in arange(mec_blocks): current_mec_activity[mec_indexlist[jj]] = (current_mec_input[mec_indexlist[jj]] - current_emax*np.max(current_mec_input[mec_indexlist[jj]])) current_mec_activity[current_mec_activity<0] = 0.0 current_mec_activity[mec_indexlist[jj]] /= np.max(current_mec_activity[mec_indexlist[jj]]) current_mec_activity[isnan(current_mec_activity)] = 0.0 mec_inact_vect[ii,mec_indexlist[jj],xxx[pp],yyy[pp]] = current_mec_activity[mec_indexlist[jj]] # COMPUTE THE PLACE CELLS INPUT h_l = np.dot(current_lec_activity+current_lec_noise,lec_hpc_weights) h_l = h_l/np.max(h_l) h_l[isnan(h_l)] = 0.0 h_m = np.dot(current_mec_activity+current_mec_noise,mec_hpc_weights) h_m = h_m/np.max(h_m) h_m[isnan(h_m)] = 0.0 current_hpc_input = (1-hpc_ratio)*h_l + hpc_ratio*h_m # THE PATTERN COMPLETION ALGORITHM if (kk>0): ddd = current_hpc_activity * 0 for mm in arange(len(hpc_memories)): ccc = corrcoef(hpc_memories[mm],current_hpc_activity+current_hpc_noise)[0][1] if ccc<hpc_pcompl_th: ccc=0 else: ddd += hpc_memories[mm] if (np.max(ddd) > 0): ddd = ddd/np.max(ddd) ddd[isnan(ddd)] = 0.0 current_hpc_input = (1-mec_ratio)*current_hpc_input + mec_ratio*ddd # COMPUTE THE e% MAX OF PLACE CELLS current_hpc_activity = (current_hpc_input - current_emax*np.max(current_hpc_input)) current_hpc_activity[current_hpc_activity<0] = 0.0 current_hpc_activity /= np.max(current_hpc_activity) current_hpc_activity[current_hpc_activity<current_emax_plast] = 0 hpc_inact_vect[ii,:,xxx[pp],yyy[pp]] = current_hpc_activity # IF LEARNING IS SET, UPDATE THE WEIGHTS if (lllf[ii]>0): lec_hpc_weights = normalize_weight(learn_weight(lec_hpc_weights,current_lec_activity+current_lec_noise,current_hpc_activity+current_hpc_noise,current_lrate_lec_hpc),lec_hpc_weights_mean) mec_hpc_weights = normalize_weight(learn_weight(mec_hpc_weights,current_mec_activity+current_mec_noise,current_hpc_activity+current_hpc_noise,current_lrate_mec_hpc),mec_hpc_weights_mean) hpc_mec_weights = normalize_weight(learn_weight(hpc_mec_weights,current_hpc_activity+current_hpc_noise,current_mec_activity+current_mec_noise,current_lrate_hpc_mec),hpc_mec_weights_mean) # SAVE PATTERN COMPLETION PATTERN if ((lllf[ii]>0) and (hpc_pcompl_th<1.0)): hpc_memories.append(current_hpc_activity) lec_act[:,xxx[pp],yyy[pp]] = current_lec_activity mec_act[:,xxx[pp],yyy[pp]] = current_mec_activity hpc_act[:,xxx[pp],yyy[pp]] = current_hpc_activity mec_act_vect.append(mec_act) lec_act_vect.append(lec_act) hpc_act_vect.append(hpc_act) # COLLECT THE STATISTICS AND SAVE ooo1a = np.zeros((16,16)) ooo2a = np.zeros((16,16)) ooo3a = np.zeros((16,16)) ooo4a = np.zeros((16,16)) ooo5a = np.zeros((16)) ooo1b = np.zeros((16,16)) ooo2b = np.zeros((16,16)) ooo3b = np.zeros((16,16)) ooo4b = np.zeros((16,16)) ooo5b = np.zeros((16)) ooo1c = np.zeros((16,16)) ooo2c = np.zeros((16,16)) ooo3c = np.zeros((16,16)) ooo4c = np.zeros((16,16)) pfdist1 = np.zeros((16)) pfdist2 = np.zeros((16)) for xx in arange(16): pfdist1 = pfdist1 + np.histogram(np.sum(np.sum(hpc_inact_vect[xx+18,:,:,:]>0,axis=1),axis=1),arange(17))[0] pfdist2 = pfdist2 + np.histogram(np.sum(np.sum(hpc_inact_vect[xx+50,:,:,:]>0,axis=1),axis=1),arange(17))[0] vvv5a = np.zeros((arena_binsize[0],arena_binsize[1])) vvv5b = np.zeros((arena_binsize[0],arena_binsize[1])) for ii in arange(arena_binsize[0]): for jj in arange(arena_binsize[1]): vvv5a[ii,jj] = np.corrcoef(mec_inact_vect[xx+2,:,ii,jj],mec_inact_vect[xx+18,:,ii,jj])[0,1] vvv5b[ii,jj] = np.corrcoef(mec_inact_vect[xx+34,:,ii,jj],mec_inact_vect[xx+50,:,ii,jj])[0,1] ooo5a[xx] = np.mean(vvv5a) ooo5b[xx] = np.mean(vvv5b) for yy in arange(xx,16): vvv1a = np.zeros((arena_binsize[0],arena_binsize[1])) vvv2a = np.zeros((arena_binsize[0],arena_binsize[1])) vvv3a = np.zeros((arena_binsize[0],arena_binsize[1])) vvv4a = np.zeros((arena_binsize[0],arena_binsize[1])) vvv1b = np.zeros((arena_binsize[0],arena_binsize[1])) vvv2b = np.zeros((arena_binsize[0],arena_binsize[1])) vvv3b = np.zeros((arena_binsize[0],arena_binsize[1])) vvv4b = np.zeros((arena_binsize[0],arena_binsize[1])) vvv1c = np.zeros((arena_binsize[0],arena_binsize[1])) vvv2c = np.zeros((arena_binsize[0],arena_binsize[1])) vvv3c = np.zeros((arena_binsize[0],arena_binsize[1])) vvv4c = np.zeros((arena_binsize[0],arena_binsize[1])) vvv1d = np.zeros((arena_binsize[0],arena_binsize[1])) vvv2d = np.zeros((arena_binsize[0],arena_binsize[1])) vvv3d = np.zeros((arena_binsize[0],arena_binsize[1])) vvv4d = np.zeros((arena_binsize[0],arena_binsize[1])) for ii in arange(arena_binsize[0]): for jj in arange(arena_binsize[1]): vvv1a[ii,jj] = np.corrcoef(mec_inact_vect[xx+2,:,ii,jj],mec_inact_vect[yy+2,:,ii,jj])[0,1] vvv2a[ii,jj] = np.corrcoef(hpc_inact_vect[xx+2,:,ii,jj],hpc_inact_vect[yy+2,:,ii,jj])[0,1] vvv3a[ii,jj] = np.corrcoef(mec_inact_vect[xx+18,:,ii,jj],mec_inact_vect[yy+18,:,ii,jj])[0,1] vvv4a[ii,jj] = np.corrcoef(hpc_inact_vect[xx+18,:,ii,jj],hpc_inact_vect[yy+18,:,ii,jj])[0,1] vvv1b[ii,jj] = np.corrcoef(mec_inact_vect[xx+34,:,ii,jj],mec_inact_vect[yy+34,:,ii,jj])[0,1] vvv2b[ii,jj] = np.corrcoef(hpc_inact_vect[xx+34,:,ii,jj],hpc_inact_vect[yy+34,:,ii,jj])[0,1] vvv3b[ii,jj] = np.corrcoef(mec_inact_vect[xx+50,:,ii,jj],mec_inact_vect[yy+50,:,ii,jj])[0,1] vvv4b[ii,jj] = np.corrcoef(hpc_inact_vect[xx+50,:,ii,jj],hpc_inact_vect[yy+50,:,ii,jj])[0,1] vvv1c[ii,jj] = np.corrcoef(mec_inact_vect[xx+2,:,ii,jj],mec_inact_vect[yy+34,:,ii,jj])[0,1] vvv2c[ii,jj] = np.corrcoef(hpc_inact_vect[xx+2,:,ii,jj],hpc_inact_vect[yy+34,:,ii,jj])[0,1] vvv3c[ii,jj] = np.corrcoef(mec_inact_vect[xx+18,:,ii,jj],mec_inact_vect[yy+50,:,ii,jj])[0,1] vvv4c[ii,jj] = np.corrcoef(hpc_inact_vect[xx+18,:,ii,jj],hpc_inact_vect[yy+50,:,ii,jj])[0,1] vvv1d[ii,jj] = np.corrcoef(mec_inact_vect[xx+34,:,ii,jj],mec_inact_vect[yy+2,:,ii,jj])[0,1] vvv2d[ii,jj] = np.corrcoef(hpc_inact_vect[xx+34,:,ii,jj],hpc_inact_vect[yy+2,:,ii,jj])[0,1] vvv3d[ii,jj] = np.corrcoef(mec_inact_vect[xx+50,:,ii,jj],mec_inact_vect[yy+18,:,ii,jj])[0,1] vvv4d[ii,jj] = np.corrcoef(hpc_inact_vect[xx+50,:,ii,jj],hpc_inact_vect[yy+18,:,ii,jj])[0,1] ooo1a[xx,yy] = np.mean(vvv1a) ooo1a[yy,xx] = np.mean(vvv1a) ooo2a[xx,yy] = np.mean(vvv2a) ooo2a[yy,xx] = np.mean(vvv2a) ooo3a[xx,yy] = np.mean(vvv3a) ooo3a[yy,xx] = np.mean(vvv3a) ooo4a[xx,yy] = np.mean(vvv4a) ooo4a[yy,xx] = np.mean(vvv4a) ooo1b[xx,yy] = np.mean(vvv1b) ooo1b[yy,xx] = np.mean(vvv1b) ooo2b[xx,yy] = np.mean(vvv2b) ooo2b[yy,xx] = np.mean(vvv2b) ooo3b[xx,yy] = np.mean(vvv3b) ooo3b[yy,xx] = np.mean(vvv3b) ooo4b[xx,yy] = np.mean(vvv4b) ooo4b[yy,xx] = np.mean(vvv4b) ooo1c[xx,yy] = np.mean(vvv1c) ooo1c[yy,xx] = np.mean(vvv1d) ooo2c[xx,yy] = np.mean(vvv2c) ooo2c[yy,xx] = np.mean(vvv2d) ooo3c[xx,yy] = np.mean(vvv3c) ooo3c[yy,xx] = np.mean(vvv3d) ooo4c[xx,yy] = np.mean(vvv4c) ooo4c[yy,xx] = np.mean(vvv4d) corrVectMECGRID1[sessions] = np.mean(ooo1a) corrVectHPCGRID1[sessions] = np.mean(ooo2a) corrVectMEC1[sessions] = np.mean(ooo3a) corrVectHPC1[sessions] = np.mean(ooo4a) corrVectMECvsGRID1[sessions] = np.mean(ooo5a) corrVectMECGRID2[sessions] = np.mean(ooo1b) corrVectHPCGRID2[sessions] = np.mean(ooo2b) corrVectMEC2[sessions] = np.mean(ooo3b) corrVectHPC2[sessions] = np.mean(ooo4b) corrVectMECvsGRID2[sessions] = np.mean(ooo5b) corrVectMECGRIDx[sessions] = np.mean(ooo1c) corrVectHPCGRIDx[sessions] = np.mean(ooo2c) corrVectMECx[sessions] = np.mean(ooo3c) corrVectHPCx[sessions] = np.mean(ooo4c) dist_pf1[sessions,:] = pfdist1 dist_pf2[sessions,:] = pfdist2 for xx in arange(21): ooo1a = np.zeros(arena_binsize) ooo2a = np.zeros(arena_binsize) ooo1b = np.zeros(arena_binsize) ooo2b = np.zeros(arena_binsize) ooo3a = np.zeros(arena_binsize) ooo3b = np.zeros(arena_binsize) for ii in arange(arena_binsize[0]): for jj in arange(arena_binsize[1]): ooo1a[ii,jj] = np.corrcoef(hpc_inact_vect[66,:,ii,jj],hpc_inact_vect[xx+66,:,ii,jj])[0,1] ooo1b[ii,jj] = np.corrcoef(mec_inact_vect[66,:,ii,jj],mec_inact_vect[xx+66,:,ii,jj])[0,1] ooo2a[ii,jj] = np.corrcoef(hpc_inact_vect[86,:,ii,jj],hpc_inact_vect[86-xx,:,ii,jj])[0,1] ooo2b[ii,jj] = np.corrcoef(mec_inact_vect[86,:,ii,jj],mec_inact_vect[86-xx,:,ii,jj])[0,1] ooo3a[ii,jj] = np.mean((ooo1a[ii,jj],ooo2a[ii,jj])) ooo3b[ii,jj] = np.mean((ooo1b[ii,jj],ooo2b[ii,jj])) pvCorrelationCurveHPC1[sessions,xx] = np.mean(ooo1a) pvCorrelationCurveMEC1[sessions,xx] = np.mean(ooo1b) pvCorrelationCurveHPC2[sessions,xx] = np.mean(ooo2a) pvCorrelationCurveMEC2[sessions,xx] = np.mean(ooo2b) pvCorrelationCurveHPC[sessions,xx] = np.mean(ooo3a) pvCorrelationCurveMEC[sessions,xx] = np.mean(ooo3b) if (acts==True): actvLec1 = lec_inact_vect[66,0:100,:,:] actvLec2 = lec_inact_vect[86,0:100,:,:] actvMec1 = mec_inact_vect[66,0:100,:,:] actvMec2 = mec_inact_vect[86,0:100,:,:] actvHpc1 = hpc_inact_vect[66,:,:,:] actvHpc2 = hpc_inact_vect[86,:,:,:] with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,9)+'z', 'wb') as ff: pickle.dump([actvLec1,actvLec2,actvMec1,actvMec2,actvHpc1,actvHpc2] , ff) for xx in arange(21): ooo1a = np.zeros(arena_binsize) ooo2a = np.zeros(arena_binsize) ooo1b = np.zeros(arena_binsize) ooo2b = np.zeros(arena_binsize) ooo3a = np.zeros(arena_binsize) ooo3b = np.zeros(arena_binsize) for ii in arange(arena_binsize[0]): for jj in arange(arena_binsize[1]): ooo1a[ii,jj] = np.corrcoef(hpc_inact_vect[87,:,ii,jj],hpc_inact_vect[xx+87,:,ii,jj])[0,1] ooo1b[ii,jj] = np.corrcoef(mec_inact_vect[87,:,ii,jj],mec_inact_vect[xx+87,:,ii,jj])[0,1] ooo2a[ii,jj] = np.corrcoef(hpc_inact_vect[107,:,ii,jj],hpc_inact_vect[107-xx,:,ii,jj])[0,1] ooo2b[ii,jj] = np.corrcoef(mec_inact_vect[107,:,ii,jj],mec_inact_vect[107-xx,:,ii,jj])[0,1] ooo3a[ii,jj] = np.mean((ooo1a[ii,jj],ooo2a[ii,jj])) ooo3b[ii,jj] = np.mean((ooo1b[ii,jj],ooo2b[ii,jj])) pvCorrelationCurveHPC1Lesion[sessions,xx] = np.mean(ooo1a) pvCorrelationCurveMEC1Lesion[sessions,xx] = np.mean(ooo1b) pvCorrelationCurveHPC2Lesion[sessions,xx] = np.mean(ooo2a) pvCorrelationCurveMEC2Lesion[sessions,xx] = np.mean(ooo2b) pvCorrelationCurveHPCLesion[sessions,xx] = np.mean(ooo3a) pvCorrelationCurveMECLesion[sessions,xx] = np.mean(ooo3b) with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,0)+'z', 'wb') as ff: pickle.dump([corrVectMECGRID1,corrVectHPCGRID1,corrVectMEC1,corrVectHPC1,corrVectMECvsGRID1] , ff) with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,1)+'z', 'wb') as ff: pickle.dump([corrVectMECGRID2,corrVectHPCGRID2,corrVectMEC2,corrVectHPC2,corrVectMECvsGRID2] , ff) with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,2)+'z', 'wb') as ff: pickle.dump([corrVectMECGRIDx,corrVectHPCGRIDx,corrVectMECx,corrVectHPCx] , ff) with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,3)+'z', 'wb') as ff: pickle.dump([dist_pf1,dist_pf2] , ff) with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,4)+'z', 'wb') as ff: pickle.dump([pvCorrelationCurveHPC,pvCorrelationCurveHPC1,pvCorrelationCurveHPC2,pvCorrelationCurveMEC,pvCorrelationCurveMEC1,pvCorrelationCurveMEC2] , ff) with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,5)+'z', 'wb') as ff: pickle.dump([pvCorrelationCurveHPCLesion,pvCorrelationCurveHPC1Lesion,pvCorrelationCurveHPC2Lesion,pvCorrelationCurveMECLesion,pvCorrelationCurveMEC1Lesion,pvCorrelationCurveMEC2Lesion] , ff) if(sessions>5): if(np.max(np.abs(np.diff(corrVectMECGRID1[(sessions)-3:sessions])))==0.0): if(np.max(np.abs(np.diff(corrVectMECGRID2[(sessions)-3:sessions])))==0.0): if(np.max(np.abs(np.diff(corrVectMECGRIDx[(sessions)-3:sessions])))==0.0): corrVectMECGRID1[(sessions+1):] = -2 corrVectHPCGRID1[(sessions+1):] = -2 corrVectMEC1[(sessions+1):] = -2 corrVectHPC1[(sessions+1):] = -2 corrVectMECvsGRID1[(sessions+1):] = -2 corrVectMECGRID2[(sessions+1):] = -2 corrVectHPCGRID2[(sessions+1):] = -2 corrVectMEC2[(sessions+1):] = -2 corrVectHPC2[(sessions+1):] = -2 corrVectMECvsGRID2[(sessions+1):] = -2 corrVectMECGRIDx[(sessions+1):] = -2 corrVectHPCGRIDx[(sessions+1):] = -2 corrVectMECx[(sessions+1):] = -2 corrVectHPCx[(sessions+1):] = -2 with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,0)+'z', 'wb') as ff: pickle.dump([corrVectMECGRID1,corrVectHPCGRID1,corrVectMEC1,corrVectHPC1,corrVectMECvsGRID1] , ff) with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,1)+'z', 'wb') as ff: pickle.dump([corrVectMECGRID2,corrVectHPCGRID2,corrVectMEC2,corrVectHPC2,corrVectMECvsGRID2] , ff) with gzip.open(filenames.fileRunPickle(listofvalues,simulation_num,2)+'z', 'wb') as ff: pickle.dump([corrVectMECGRIDx,corrVectHPCGRIDx,corrVectMECx,corrVectHPCx] , ff) return if __name__ == "__main__": main(sys.argv[1:])
cb7af099f940f5ba112e7f53d43e231bfca9550a
3b9b4049a8e7d38b49e07bb752780b2f1d792851
/src/third_party/catapult/tracing/bin/run_py_tests
d5cf781888af6fb4e715bae9e5e21c30164b2f3a
[ "BSD-3-Clause", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
permissive
webosce/chromium53
f8e745e91363586aee9620c609aacf15b3261540
9171447efcf0bb393d41d1dc877c7c13c46d8e38
refs/heads/webosce
2020-03-26T23:08:14.416858
2018-08-23T08:35:17
2018-09-20T14:25:18
145,513,343
0
2
Apache-2.0
2019-08-21T22:44:55
2018-08-21T05:52:31
null
UTF-8
Python
false
false
1,115
#!/usr/bin/env python # Copyright (c) 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import platform import sys _CATAPULT_PATH = os.path.abspath(os.path.join( os.path.dirname(__file__), os.path.pardir, os.path.pardir)) _TRACING_PATH = os.path.join(_CATAPULT_PATH, 'tracing') def _RunTestsOrDie(top_level_dir): exit_code = run_with_typ.Run(top_level_dir, path=[_TRACING_PATH]) if exit_code: sys.exit(exit_code) def _AddToPathIfNeeded(path): if path not in sys.path: sys.path.insert(0, path) if __name__ == '__main__': _AddToPathIfNeeded(_CATAPULT_PATH) from hooks import install if '--no-install-hooks' in sys.argv: sys.argv.remove('--no-install-hooks') else: install.InstallHooks() from catapult_build import run_with_typ # https://github.com/catapult-project/catapult/issues/2050 if platform.system() != 'Windows': _RunTestsOrDie(os.path.join(_TRACING_PATH, 'tracing')) _RunTestsOrDie(os.path.join(_TRACING_PATH, 'tracing_build')) sys.exit(0)
ad40c75916ec2d3d84483c9477a39ee50804f258
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p03089/s954098144.py
4781af4d76b7517d6d52dd675494067d64a378b7
[]
no_license
Aasthaengg/IBMdataset
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
refs/heads/main
2023-04-22T10:22:44.763102
2021-05-13T17:27:22
2021-05-13T17:27:22
367,112,348
0
0
null
null
null
null
UTF-8
Python
false
false
272
py
n = int(input()) B = [int(i) for i in input().split()] ans = [] while B: L = [] for i in range(len(B)): if B[i] == i+1: L.append(B[i]) if L: ans.append(L[-1]) B.pop(L[-1]-1) else: print(-1) exit() for i in ans[::-1]: print(i)
75ca957fcc6b0ca47831ce5f73d697ab54cb8436
1d0a4750e216f301ec49a247bf7bf07cd61fa29f
/app/views/commuter/company_commuter_plan_view.py
ec9cd4dcec20664a89e39d135f1290141e2b2699
[]
no_license
smoothbenefits/BenefitMY_Python
52745a11db2cc9ab394c8de7954974e6d5a05e13
b7e8474a728bc22778fd24fe88d1918945a8cfc8
refs/heads/master
2021-03-27T15:57:34.798289
2018-04-29T19:04:04
2018-04-29T19:04:04
24,351,568
0
1
null
null
null
null
UTF-8
Python
false
false
2,178
py
from rest_framework.views import APIView from django.http import Http404 from rest_framework.response import Response from rest_framework import status from app.models.commuter.company_commuter_plan import CompanyCommuterPlan from app.serializers.commuter.company_commuter_plan_serializer import ( CompanyCommuterPlanSerializer, CompanyCommuterPlanPostSerializer) class CompanyCommuterPlanView(APIView): def _get_object(self, pk): try: return CompanyCommuterPlan.objects.get(pk=pk) except CompanyCommuterPlan.DoesNotExist: raise Http404 def get(self, request, pk, format=None): plan = self._get_object(pk) serializer = CompanyCommuterPlanSerializer(plan) return Response(serializer.data) def delete(self, request, pk, format=None): plan = self._get_object(pk) plan.delete() return Response(status=status.HTTP_204_NO_CONTENT) def put(self, request, pk, format=None): plan = self._get_object(pk) serializer = CompanyCommuterPlanSerializer(plan, data=request.DATA) if serializer.is_valid(): serializer.save() return Response(serializer.data) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) def post(self, request, pk, format=None): serializer = CompanyCommuterPlanPostSerializer(data=request.DATA) if serializer.is_valid(): serializer.save() response_serializer = CompanyCommuterPlanSerializer(serializer.object) return Response(response_serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) class CompanyCommuterPlanByCompanyView(APIView): def _get_object(self, company_id): try: return CompanyCommuterPlan.objects.filter(company=company_id) except CompanyCommuterPlan.DoesNotExist: raise Http404 def get(self, request, company_id, format=None): plans = self._get_object(company_id) serializer = CompanyCommuterPlanSerializer(plans, many=True) return Response(serializer.data)
a4b03be3990b0a990a9b9b5921833e1949890b55
27b4d1b7723845812111a0c6c659ef87c8da2755
/PythonCookBook/1_数据结构和算法/查找最大或者最小的N个元素列表/03.py
de7b91bd9c47a32638d00d17ac4d93dab161ccb6
[]
no_license
NAMEs/Python_Note
59a6eff7b4287aaef04bd69fbd4af3faf56cccb4
f560e00af37c4f22546abc4c2756e7037adcc40c
refs/heads/master
2022-04-11T09:32:17.512962
2020-03-17T09:30:58
2020-03-17T09:30:58
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,882
py
''' 如果你想在一个集合中查找最小或最大的 N 个元素,并且 N 小于集合元素数量, 那么这些函数提供了很好的性能。因为在底层实现里面,首先会先将集合数据进行堆排 序后放入一个列表中 堆数据结构最重要的特征是 heap[0] 永远是最小的元素。并且剩余的元素可以很 容易的通过调用 heapq.heappop() 方法得到,该方法会先将第一个元素弹出来,然后 用下一个最小的元素来取代被弹出元素(这种操作时间复杂度仅仅是 O(log N),N 是 堆大小)。比如,如果想要查找最小的 3 个元素,你可以这样做: 当要查找的元素个数相对比较小的时候,函数 nlargest() 和 nsmallest() 是很 合适的。如果你仅仅想查找唯一的最小或最大(N=1)的元素的话,那么使用 min() 和 max() 函数会更快些。类似的,如果 N 的大小和集合大小接近的时候,通常先排序这个 集合然后再使用切片操作会更快点(sorted(items)[:N] 或者是 sorted(items)[-N:] )。需要在正确场合使用函数 nlargest() 和 nsmallest() 才能发挥它们的优势(如果 N 快接近集合大小了,那么使用排序操作会更好些)。 尽管你没有必要一定使用这里的方法,但是堆数据结构的实现是一个很有趣并且 值得你深入学习的东西。基本上只要是数据结构和算法书籍里面都会有提及到。heapq 模块的官方文档里面也详细的介绍了堆数据结构底层的实现细节。 ''' import heapq nums = [1, 8, 2, 23, 7, -4, 18, 23, 42, 37, 2] print("nums:",nums) heap = list(nums) print("heap:",heap) # 堆排序 heapq.heapify(heap) print("heap:",heap) for i in range(1,len(heap)+1): num = heapq.heappop(heap) print("{0} --- {1}".format(i,num)) print(heap)
c22b288eeec61c012ac1e9fb29b0cd92193615b1
1adc05008f0caa9a81cc4fc3a737fcbcebb68995
/hardhat/recipes/libsigc++.py
bd7663119f55fe29bf5236253c373c8e8888cf25
[ "MIT", "BSD-3-Clause" ]
permissive
stangelandcl/hardhat
4aa995518697d19b179c64751108963fa656cfca
1ad0c5dec16728c0243023acb9594f435ef18f9c
refs/heads/master
2021-01-11T17:19:41.988477
2019-03-22T22:18:44
2019-03-22T22:18:52
79,742,340
0
0
null
null
null
null
UTF-8
Python
false
false
541
py
from .base import GnuRecipe class LibSigCppRecipe(GnuRecipe): def __init__(self, *args, **kwargs): super(LibSigCppRecipe, self).__init__(*args, **kwargs) self.sha256 = '774980d027c52947cb9ee4fac6ffe2ca' \ '60cc2f753068a89dfd281c83dbff9651' self.name = 'libsigc++' self.version = '2.8.0' short_version = '.'.join(self.version.split('.')[:2]) self.url = 'http://ftp.gnome.org/pub/gnome/sources/$name/' \ '%s/$name-$version.tar.xz' % short_version
bdaca89a365a3445264646da386645b9b5fad002
03a2c1eb549a66cc0cff72857963eccb0a56031d
/acmicpc/14427.py
133779d5c5f1c126eba92eb72a510a05dea57127
[]
no_license
nobe0716/problem_solving
c56e24564dbe3a8b7093fb37cd60c9e0b25f8e59
cd43dc1eddb49d6b5965419e36db708c300dadf5
refs/heads/master
2023-01-21T14:05:54.170065
2023-01-15T16:36:30
2023-01-15T16:36:30
80,906,041
0
0
null
null
null
null
UTF-8
Python
false
false
1,103
py
import math import sys input = sys.stdin.readline _DEFAULT = (10 ** 9 + 1, 1) _GET = lambda x, y: min(x, y) _SET = lambda i, v: (v, i) n = int(input()) a = [int(x) for x in input().split()] a = [_SET(i, v) for i, v in enumerate(a, start=1)] m = int(input()) BASE = 2 ** math.ceil(math.log(n, 2)) st = [_DEFAULT] * BASE * 2 st[BASE:BASE + n] = a for i in range(BASE - 1, 0, -1): st[i] = _GET(st[i * 2], st[i * 2 + 1]) def get(lo: int, hi: int) -> int: lo += BASE - 1 hi += BASE - 1 v = _DEFAULT while lo < hi: if lo % 2 == 1: v = _GET(v, st[lo]) lo += 1 if hi % 2 == 0: v = _GET(v, st[hi]) hi -= 1 lo //= 2 hi //= 2 if lo == hi: v = _GET(v, st[lo]) return v def set(i: int, v: int): st[BASE + i - 1] = _SET(i, v) i = (i + BASE - 1) // 2 while i > 0: st[i] = _GET(st[i * 2], st[i * 2 + 1]) i //= 2 for _ in range(m): line = list(map(int, input().split())) if line[0] == 2: print(get(1, n)[1]) else: set(line[1], line[2])
3e0fc28c46e9bd40233e17d0b10f99cee105f0c6
b2ed893d04f04eeaf7209187133de7431c476a96
/icc/merge_data.py
7e76b3267853a20f5be07f2f3caa9dc3cd1a9150
[]
no_license
liruikaiyao/workshop
4b5221259f59ad504d87d73c31f5fa0e58d4a1f0
6dbde74e35ef02f5e92c76dcdd1909f1d0afb89e
refs/heads/master
2021-01-17T16:09:13.248109
2015-08-05T09:43:21
2015-08-05T09:43:21
23,420,887
0
0
null
null
null
null
UTF-8
Python
false
false
290
py
#coding:utf-8 from config.db import bda all_cluster=bda['all_cluster'] db_list=bda.collection_names() a=db_list db_list=[] for elem in a: if len(elem)==32: db_list.append(elem) for elem in db_list: db=bda[elem] for item in db.find(): all_cluster.insert(item)
aa63d3f03980b5759d81dab4f148f013d82a0cab
f62fd455e593a7ad203a5c268e23129473d968b6
/python-watcher-1.0.1/watcher/tests/decision_engine/model/faker_cluster_and_metrics.py
e0664158a07fed9442d6ba6ed109f10802e82eff
[ "Apache-2.0", "CC-BY-3.0" ]
permissive
MinbinGong/OpenStack-Ocata
5d17bcd47a46d48ff9e71e2055f667836174242f
8b7650128cfd2fdf5d6c8bc4613ac2e396fb2fb3
refs/heads/master
2021-06-23T05:24:37.799927
2017-08-14T04:33:05
2017-08-14T04:33:05
99,709,985
0
2
null
2020-07-22T22:06:22
2017-08-08T15:48:44
Python
UTF-8
Python
false
false
5,643
py
# -*- encoding: utf-8 -*- # # Authors: Vojtech CIMA <[email protected]> # Bruno GRAZIOLI <[email protected]> # Sean MURPHY <[email protected]> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import os import mock from watcher.decision_engine.model.collector import base from watcher.decision_engine.model import model_root as modelroot class FakerModelCollector(base.BaseClusterDataModelCollector): def __init__(self, config=None, osc=None): if config is None: config = mock.Mock() super(FakerModelCollector, self).__init__(config) @property def notification_endpoints(self): return [] def execute(self): return self.generate_scenario_1() def load_data(self, filename): cwd = os.path.abspath(os.path.dirname(__file__)) data_folder = os.path.join(cwd, "data") with open(os.path.join(data_folder, filename), 'rb') as xml_file: xml_data = xml_file.read() return xml_data def load_model(self, filename): return modelroot.ModelRoot.from_xml(self.load_data(filename)) def generate_scenario_1(self): """Simulates cluster with 2 nodes and 2 instances using 1:1 mapping""" return self.load_model('scenario_1_with_metrics.xml') def generate_scenario_2(self): """Simulates a cluster With 4 nodes and 6 instances all mapped to a single node """ return self.load_model('scenario_2_with_metrics.xml') def generate_scenario_3(self): """Simulates a cluster With 4 nodes and 6 instances all mapped to one node """ return self.load_model('scenario_3_with_metrics.xml') def generate_scenario_4(self): """Simulates a cluster With 4 nodes and 6 instances spread on all nodes """ return self.load_model('scenario_4_with_metrics.xml') class FakeCeilometerMetrics(object): def __init__(self, model): self.model = model def mock_get_statistics(self, resource_id, meter_name, period=3600, aggregate='avg'): if meter_name == "compute.node.cpu.percent": return self.get_node_cpu_util(resource_id) elif meter_name == "cpu_util": return self.get_instance_cpu_util(resource_id) elif meter_name == "memory.usage": return self.get_instance_ram_util(resource_id) elif meter_name == "disk.root.size": return self.get_instance_disk_root_size(resource_id) def get_node_cpu_util(self, r_id): """Calculates node utilization dynamicaly. node CPU utilization should consider and corelate with actual instance-node mappings provided within a cluster model. Returns relative node CPU utilization <0, 100>. :param r_id: resource id """ node_uuid = '%s_%s' % (r_id.split('_')[0], r_id.split('_')[1]) node = self.model.get_node_by_uuid(node_uuid) instances = self.model.get_node_instances(node) util_sum = 0.0 for instance_uuid in instances: instance = self.model.get_instance_by_uuid(instance_uuid) total_cpu_util = instance.vcpus * self.get_instance_cpu_util( instance.uuid) util_sum += total_cpu_util / 100.0 util_sum /= node.vcpus return util_sum * 100.0 @staticmethod def get_instance_cpu_util(r_id): instance_cpu_util = dict() instance_cpu_util['INSTANCE_0'] = 10 instance_cpu_util['INSTANCE_1'] = 30 instance_cpu_util['INSTANCE_2'] = 60 instance_cpu_util['INSTANCE_3'] = 20 instance_cpu_util['INSTANCE_4'] = 40 instance_cpu_util['INSTANCE_5'] = 50 instance_cpu_util['INSTANCE_6'] = 100 instance_cpu_util['INSTANCE_7'] = 100 instance_cpu_util['INSTANCE_8'] = 100 instance_cpu_util['INSTANCE_9'] = 100 return instance_cpu_util[str(r_id)] @staticmethod def get_instance_ram_util(r_id): instance_ram_util = dict() instance_ram_util['INSTANCE_0'] = 1 instance_ram_util['INSTANCE_1'] = 2 instance_ram_util['INSTANCE_2'] = 4 instance_ram_util['INSTANCE_3'] = 8 instance_ram_util['INSTANCE_4'] = 3 instance_ram_util['INSTANCE_5'] = 2 instance_ram_util['INSTANCE_6'] = 1 instance_ram_util['INSTANCE_7'] = 2 instance_ram_util['INSTANCE_8'] = 4 instance_ram_util['INSTANCE_9'] = 8 return instance_ram_util[str(r_id)] @staticmethod def get_instance_disk_root_size(r_id): instance_disk_util = dict() instance_disk_util['INSTANCE_0'] = 10 instance_disk_util['INSTANCE_1'] = 15 instance_disk_util['INSTANCE_2'] = 30 instance_disk_util['INSTANCE_3'] = 35 instance_disk_util['INSTANCE_4'] = 20 instance_disk_util['INSTANCE_5'] = 25 instance_disk_util['INSTANCE_6'] = 25 instance_disk_util['INSTANCE_7'] = 25 instance_disk_util['INSTANCE_8'] = 25 instance_disk_util['INSTANCE_9'] = 25 return instance_disk_util[str(r_id)]
75508448eb04949efc0a5950f4ce7749c1dfc7fe
2b16a66bfc186b52ed585081ae987e97cab8223b
/script/document_classification/import_lr_wiki_classification_result.py
d1509efa93e4dbe0e8ffc75c8f82eb869f157495
[]
no_license
OldPickles/SKnowledgeGraph
d334000c7a41dd5014fd59154bbe070fcc754e4c
6d131ad6bf3a09a5ce6461fa03690117d703c9e8
refs/heads/master
2022-01-09T11:27:00.043712
2019-06-06T07:57:06
2019-06-06T07:57:06
null
0
0
null
null
null
null
UTF-8
Python
false
false
259
py
from db_importer.wiki_classification_result import WikiClassificationResultDBImporter if __name__ == "__main__": importer = WikiClassificationResultDBImporter() importer.import_lr_wiki_classification_result(result_json_file_name="lr_result.v2.json")
7ec0f70abd775cb479257cc103252641eda0f42f
5b93930ce8280b3cbc7d6b955df0bfc5504ee99c
/nodes/Ramsundar18TensorFlow/D_Chapter3/A_MathematicalReview/B_LossFunctions/index.py
97543b4baacbc2c725c33517fa3f7795429b1173
[]
no_license
nimra/module_gen
8749c8d29beb700cac57132232861eba4eb82331
2e0a4452548af4fefd4cb30ab9d08d7662122cf4
refs/heads/master
2022-03-04T09:35:12.443651
2019-10-26T04:40:49
2019-10-26T04:40:49
213,980,247
0
1
null
null
null
null
UTF-8
Python
false
false
15,909
py
# Lawrence McAfee # ~~~~~~~~ import ~~~~~~~~ from modules.node.HierNode import HierNode from modules.node.LeafNode import LeafNode from modules.node.Stage import Stage from modules.node.block.CodeBlock import CodeBlock as cbk from modules.node.block.ImageBlock import ImageBlock as ibk from modules.node.block.MarkdownBlock import MarkdownBlock as mbk # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # The key advantage of differentiable functions is that we can use the slope of the func‐ # tion at a particular point as a guide to find places where the function is higher or # lower than our current position. This allows us to find the minima of the function. # The derivative of differentiable function f, denoted f ′, is another function that pro‐ # vides the slope of the original function at all points. The conceptual idea is that the # derivative of a function at a given point gives a signpost pointing to directions where # the function is higher or lower than its current value. An optimization algorithm can # follow this signpost to move closer to a minima of f. At the minima itself, the function # will have derivative zero. # The power of derivative-driven optimization isn’t apparent at first. Generations of # calculus students have suffered through stultifying exercises minimizing tiny func‐ # tions on paper. These exercises aren’t useful since finding the minima of a function # with only a small number of input parameters is a trivial exercise best done graphi‐ # cally. The power of derivative-driven optimization only becomes evident when there # are hundreds, thousands, millions, or billions of variables. At these scales, under‐ # standing the function analytically is nigh impossible, and all visualizations are fraught # exercises that may well miss the key attributes of the function. At these scales, the # gradient of the function ∇ f , a generalization of f ′ to multivariate functions, is likely # the most powerful mathematical tool to understand the function and its behavior. We # will dig into gradients in more depth later in this chapter. (Conceptually that is; we # won’t cover the technical details of gradients in this work.) # At a very high level, machine learning is simply the act of function minimization: # learning algorithms are nothing more than minima finders for suitably defined func‐ # tions. This definition has the advantage of mathematical simplicity. But, what are # these special differentiable functions that encode useful solutions in their minima and # how can we find them? # # Loss Functions # In order to solve a given machine learning problem, a data scientist must find a way # of constructing a function whose minima encode solutions to the real-world problem # at hand. Luckily for our hapless data scientist, the machine learning literature has # built up a rich history of loss functions that perform such encodings. Practical # machine learning boils down to understanding the different types of loss functions # available and knowing which loss function should be applied to which problems. Put # another way, the loss function is the mechanism by which a data science project is # transmuted into mathematics. All of machine learning, and much of artificial intelli‐ # gence, boils down to the creation of the right loss function to solve the problem at # hand. We will give you a whirlwind tour of some common families of loss functions. # We start by noting that a loss function ℒ must satisfy some mathematical properties # to be meaningful. First ℒ must use both datapoints x and labels y. We denote this by # # # Mathematical Review | 45 # # writing the loss function as ℒ x, y . Using our language from the previous chapter, # both x and y are tensors, and ℒ is a function from pairs of tensors to scalars. What # should the functional form of the loss function be? A common assumption that peo‐ # ple use is to make loss functions additive. Suppose that xi, yi are the data available # for example i and that there are N total examples. Then the loss function can be # decomposed as # # N # ℒ x, y = ∑ ℒ i xi, yi # i=1 # # # (In practice ℒ i is the same for every datapoint.) This additive decomposition allows # for many useful advantages. The first is that derivatives factor through addition, so # computing the gradient of the total loss simplifies as follows: # # N # ∇ℒ x, y = ∑ ∇ℒ i xi, yi # i=1 # # # This mathematical trick means that so long as the smaller functions ℒ i are differen‐ # tiable, so too will the total loss function be. It follows that the problem of designing # loss functions resolves into the problem of designing smaller functions ℒ i xi, yi . # Before we dive into designing the ℒ i, it will be convenient to take a small detour that # explains the difference between classification and regression problems. # # Classification and regression # Machine learning algorithms can be broadly categorized as supervised or unsuper‐ # vised problems. Supervised problems are those for which both datapoints x and labels # y are available, while unsupervised problems have only datapoints x without labels y. # In general, unsupervised machine learning is much harder and less well-defined # (what does it mean to “understand” datapoints x?). We won’t delve into unsupervised # loss functions at this point since, in practice, most unsupervised losses are cleverly # repurposed supervised losses. # Supervised machine learning can be broken up into the two subproblems of classifi‐ # cation and regression. A classification problem is one in which you seek to design a # machine learning system that assigns a discrete label, say 0/1 (or more generally # 0, ⋯, n) to a given datapoint. Regression is the problem of designing a machine learn‐ # ing system that attaches a real valued label (in ℝ) to a given datapoint. # At a high level, these problems may appear rather different. Discrete objects and con‐ # tinuous objects are typically treated differently by mathematics and common sense. # However, part of the trickery used in machine learning is to use continuous, differen‐ # # # # 46 | Chapter 3: Linear and Logistic Regression with TensorFlow # # tiable loss functions to encode both classification and regression problems. As we’ve # mentioned previously, much of machine learning is simply the art of turning compli‐ # cated real-world systems into suitably simple differentiable functions. # In the following sections, we will introduce you to a pair of mathematical functions # that will prove very useful for transforming classification and regression tasks into # suitable loss functions. # # L2 Loss # The L2 loss (pronounced ell-two loss) is commonly used for regression problems. The # L2 loss (or L2-norm as it’s commonly called elsewhere) provides for a measure of the # magnitude of a vector: # # # ∥ a ∥2 = ∑Ni = 1 a2i # # Here, a is assumed to be a vector of length N. The L2 norm is commonly used to # define the distance between two vectors: # # # ∥ a − b ∥2 = ∑Ni = 1 ai − bi 2 # # # # This idea of L2 as a distance measurement is very useful for solving regression prob‐ # lems in supervised machine learning. Suppose that x is a collection of data and y the # associated labels. Let f be some differentiable function that encodes our machine # learning model. Then to encourage f to predict y, we create the L2 loss function # # ℒ x, y = ∥ f x − y ∥2 # # As a quick note, it’s common in practice to not use the L2 loss directly, but rather its # square # # N # 2 # ∥ a − b ∥2 = ∑ # i=1 # ai − bi 2 # # # # in order to avoid dealing with terms of the form 1/ x in the gradient. We will use # the squared L2 loss repeatedly in the remainder of this chapter and book. # # # # # Mathematical Review | 47 # # Failure Modes of L2 Loss # The L2 sharply penalizes large-scale deviances from true labels, but doesn’t do a great # job of rewarding exact matches for real-valued labels. We can understand this dis‐ # crepancy mathematically, by studying the behavior of the functions x2 and x near the # origin (Figure 3-3). # # # # # Figure 3-3. A comparison of the square and identity functions near the origin. # # Notice how x2 dwindles rapidly to 0 for small values of x. As a result, small deviations # aren’t penalized heavily by the L2 loss. In low-dimensional regression, this isn’t a # major issue, but in high-dimensional regression, the L2 becomes a poor loss function # since there may be many small deviations that together make the regression output # poor. For example, in image prediction, L2 loss creates blurry images that are not vis‐ # ually appealing. Recent progress in machine learning has devised ways to learn loss # functions. These learned loss functions, commonly styled Generative Adversarial # Networks or GANs, are much more suitable for high-dimensional regression and are # capable of generating nonblurry images. # # # Probability distributions # Before introducing loss functions for classification problems, it will be useful to take a # quick aside to introduce probability distributions. To start, what is a probability dis‐ # tribution and why should we care about it for the purposes of machine learning? # Probability is a deep subject, so we will only delve far enough into it for you to gain # the required minimal understanding. At a high level, probability distributions pro‐ # vide a mathematical trick that allows you to relax a discrete set of choices into a con‐ # # # 48 | Chapter 3: Linear and Logistic Regression with TensorFlow # # tinuum. Suppose, for example, you need to design a machine learning system that # predicts whether a coin will fall heads up or heads down. It doesn’t seem like heads # up/down can be encoded as a continuous function, much less a differentiable one. # How can you then use the machinery of calculus or TensorFlow to solve problems # involving discrete choices? # Enter the probability distribution. Instead of hard choices, make the classifier predict # the chance of getting heads up or heads down. For example, the classifier may learn # to predict that heads has probability 0.75 and tails has probability 0.25. Note that # probabilities vary continuously! Consequently by working with the probabilities of # discrete events rather than with the events themselves, you can neatly sidestep the # issue that calculus doesn’t really work with discrete events. # A probability distribution p is simply a listing of the probabilities for the possible dis‐ # crete events at hand. In this case, p = (0.75, 0.25). Note, alternatively, you can view # p: 0, 1 ℝ as a function from the set of two elements to the real numbers. This # viewpoint will be useful notationally at times. # We briefly note that the technical definition of a probability distribution is more # involved. It is feasible to assign probability distributions to real-valued events. We will # discuss such distributions later in the chapter. # # Cross-entropy loss # Cross-entropy is a mathematical method for gauging the distance between two prob‐ # ability distributions: # # H p, q = − ∑ p x log q x # x # # # Here p and q are two probability distributions. The notation p(x) denotes the proba‐ # bility p accords to event x. This definition is worth discussing carefully. Like the L2 # norm, H provides a notion of distance. Note that in the case where p = q, # # H p, p = − ∑ p x log p x # x # # # This quantity is the entropy of p and is usually written simply H(p). It’s a measure of # how disordered the distribution is; the entropy is maximized when all events are # equally likely. H(p) is always less than or equal to H(p, q). In fact, the “further away” # distribution q is from p, the larger the cross-entropy gets. We won’t dig deeply into # the precise meanings of these statements, but the intuition of cross-entropy as a dis‐ # tance mechanism is worth remembering. # # # # # Mathematical Review | 49 # # As an aside, note that unlike L2 norm, H is asymmetric! That is, H p, q ≠ H q, p . # For this reason, reasoning with cross-entropy can be a little tricky and is best done # with some caution. # Returning to concrete matters, now suppose that p = y, 1 − y is the true data distri‐ # bution for a discrete system with two outcomes, and q = ypred, 1 − ypred is that pre‐ # dicted by a machine learning system. Then the cross-entropy loss is # # H p, q = y log ypred + 1 − y log 1 − ypred # # This form of the loss is used widely in machine learning systems to train classifiers. # Empirically, minimizing H(p, q) seems to construct classifiers that reproduce pro‐ # vided training labels well. # # Gradient Descent # So far in this chapter, you have learned about the notion of function minimization as # a proxy for machine learning. As a short recap, minimizing a suitable function is # often sufficient to learn to solve a desired task. In order to use this framework, you # need to use suitable loss functions, such as the L2 or H(p, q) cross-entropy in order to # transform classification and regression problems into suitable loss functions. # # Learnable Weights # So far in this chapter, we’ve explained that machine learning is the # act of minimizing suitably defined loss function ℒ x, y . That is, we # attempt to find arguments to the loss function ℒ that minimize it. # However, careful readers will recall that (x,y) are fixed quantities # that cannot be changed. What arguments to ℒ are we changing # during learning then? # Enter learnable weights W. Suppose f(x) is a differentiable function # we wish to fit with our machine learning model. We will dictate # that f be parameterized by choice of W. That is, our function # actually has two arguments f(W, x). Fixing the value of W results in # a function that depends solely on datapoints x. These learnable # weights are the quantities actually selected by minimization of the # loss function. We will see later in the chapter how TensorFlow can # be used to encode learnable weights using tf.Variable. # # # # # 50 | Chapter 3: Linear and Logistic Regression with TensorFlow # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class Content(LeafNode): def __init__(self): super().__init__( "Loss Functions", # Stage.CROP_TEXT, # Stage.CODE_BLOCKS, # Stage.MARKDOWN_BLOCKS, # Stage.FIGURES, # Stage.EXERCISES, # Stage.CUSTOMIZED, ) self.add(mbk("# Loss Functions")) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LossFunctions(HierNode): def __init__(self): super().__init__("Loss Functions") self.add(Content()) # eof
b311deac9287395ba96912fa77bba8b7069189ba
1e1c85d0d74bc1b111e77f082cd24c94219d7eb0
/VE-Tests/tests/KD/test_device_logout.py
4fcd4b6840117995b378d5aa39690bbfe93167a1
[]
no_license
anshsaikia/GSSDeliverables-YesProject
b6f5e4de8d853ce21dfe7401c4b9179c40f32a89
ed786ccfd7b8c344802c7ff6d0cfd4afbffe015e
refs/heads/master
2020-04-06T04:07:49.034461
2017-02-24T13:39:48
2017-02-24T13:39:48
83,044,504
1
0
null
null
null
null
UTF-8
Python
false
false
1,896
py
import pytest __author__ = 'srevg' from tests_framework.ve_tests.ve_test import VeTestApi from vgw_test_utils.IHmarks import IHmark @IHmark.LV_L2 @IHmark.O_iOS @IHmark.O_Android @IHmark.MF1530 @IHmark.MF1342 @pytest.mark.commit @pytest.mark.MF1530_LogOut @pytest.mark.MF1342_LogOut @pytest.mark.level2 def test_log_out(): ve_test = VeTestApi("log_out_feature") ve_test.begin() device_details_milestones = ve_test.milestones.getDeviceDetails() deviceId_1 = device_details_milestones['drm-device-id'] hh_id = ve_test.configuration["he"]["generated_household"] user_name = ve_test.configuration["he"]["generated_username"] ve_test.wait(7) ve_test.screens.settings.log_out() # Re Sign In with Same User Name and verify if the device id which is used is same: login_screen = ve_test.screens.login_screen login_screen.sign_in(hh_id,user_name) device_details_milestones = ve_test.milestones.getDeviceDetails() deviceId_2 = device_details_milestones['drm-device-id'] ve_test.log_assert(deviceId_1 == deviceId_2, "Device ids are different") ve_test.wait(7) ve_test.screens.settings.log_out() #Query from upm and see if the device id is still present in the household d = ve_test.he_utils.getDeviceIdFromDeviceAndHH(deviceId_2, hh_id) ve_test.log_assert(deviceId_2.upper() == d, "device id deleted in upm") #Re Sign In with different User Name and verify if the device id which is used is different: hhId, login = ve_test.he_utils.createTestHouseHold() ve_test.he_utils.setHHoffers(hhId) ve_test.screens.login_screen.sign_in(hhId, user_name=hhId, password='123') device_details_milestones = ve_test.milestones.getDeviceDetails() deviceId_3 = device_details_milestones['drm-device-id'] ve_test.log_assert(deviceId_3 is not deviceId_2,"Device ids are same") ve_test.wait(7) ve_test.end()
fd30b078e6d7cffb844e3d1190637df352e04368
ce76b3ef70b885d7c354b6ddb8447d111548e0f1
/able_hand_and_little_case/own_group.py
b3f4f5a358d913248b2a972a20c5acd10078ea22
[]
no_license
JingkaiTang/github-play
9bdca4115eee94a7b5e4ae9d3d6052514729ff21
51b550425a91a97480714fe9bc63cb5112f6f729
refs/heads/master
2021-01-20T20:18:21.249162
2016-08-19T07:20:12
2016-08-19T07:20:12
60,834,519
0
0
null
null
null
null
UTF-8
Python
false
false
201
py
#! /usr/bin/env python def be_point(str_arg): do_new_part(str_arg) print('right_case') def do_new_part(str_arg): print(str_arg) if __name__ == '__main__': be_point('eye_or_person')
e07a8919ecdfb3638a538d4e5a1d875b6b48b2b3
bf20548c143fdaecc1d8b5746dab142414b27786
/galaxy-tool-BLAST/utilities/bold/add_taxonomy_bold.py
1f03eabf49e5f4c97606b6edbf03d50fbf3cf580
[]
no_license
zeromtmu/galaxy-tool-temp-2019
e9f58956b014e2e4e9260b028c14549f90756f05
704c3b850e8ddf5420dc458a0282717ab2268c40
refs/heads/master
2021-10-25T05:02:55.328975
2019-04-01T11:40:41
2019-04-01T11:40:41
null
0
0
null
null
null
null
UTF-8
Python
false
false
3,294
py
""" """ from Bio import SeqIO import argparse parser = argparse.ArgumentParser(description='Add taxonomy to BOLD fasta file') parser.add_argument('-t', '--taxonomy', dest='taxonomy', type=str, required=True) parser.add_argument('-g', '--gbif_taxonomy', dest='gbif', type=str, required=True) parser.add_argument('-b', '--bold_fasta', dest='bold', type=str, required=True) parser.add_argument('-o', '--output', dest='output', type=str, required=True) args = parser.parse_args() def make_taxon_dict(): taxonDict = {} with open(args.taxonomy,"r") as taxonomy: for x in taxonomy: x = x.strip().split("\t") unknowns = ["unknown kingdom", "unknown phylum", "unknown class", "unknown order", "unknown family", "unknown genus", "unknown species"] for known in unknowns[len(x):]: x.append(known) valueCount = 0 for value in x: if not value: x[valueCount] = unknowns[valueCount] valueCount += 1 taxonDict[x[0]] = x return taxonDict def make_kingdom_dict(): kingdomDict = {} with open(args.gbif,"r") as gbif: for x in gbif: x = x.split("\t") if x[1] not in kingdomDict: kingdomDict[x[1]] = x[0] if x[2] not in kingdomDict: kingdomDict[x[2]] = x[0] if x[3] not in kingdomDict: kingdomDict[x[3]] = x[0] if x[4] not in kingdomDict: kingdomDict[x[4]] = x[0] if x[5] not in kingdomDict: kingdomDict[x[5]] = x[0] return kingdomDict def add_taxonomy(taxonDict, kingdomDict): with open(args.bold, "r") as bold, open(args.output,"a") as output: for record in SeqIO.parse(bold, "fasta"): accession = str(record.description).split("|")[0] if accession in taxonDict: if taxonDict[accession][1] in kingdomDict: kingdom = kingdomDict[taxonDict[accession][1]] elif taxonDict[accession][2] in kingdomDict: kingdom = kingdomDict[taxonDict[accession][2]] elif taxonDict[accession][3] in kingdomDict: kingdom = kingdomDict[taxonDict[accession][3]] elif taxonDict[accession][4] in kingdomDict: kingdom = kingdomDict[taxonDict[accession][4]] elif taxonDict[accession][5] in kingdomDict: kingdom = kingdomDict[taxonDict[accession][5]] else: #print accession+" no kingdom" kingdom = "unknown kingdom" output.write(">BOLD|"+accession+"|"+taxonDict[accession][-1]+"|"+kingdom+"|"+taxonDict[accession][1]+"|"+taxonDict[accession][2]+"|"+taxonDict[accession][3]+"|"+taxonDict[accession][4]+"|"+taxonDict[accession][5]+"|"+taxonDict[accession][-1]+"\n") output.write(str(record.seq)+"\n") else: print accession+" no taxonomy" def main(): taxonDict = make_taxon_dict() kingdomDict = make_kingdom_dict() add_taxonomy(taxonDict, kingdomDict) if __name__=="__main__": main()
a22cfb2be3ed7a20604c5c82392355d9e69ae696
008bc57ad937f0d76edbe29376220b33ff2fddc1
/CRC/crc_report_regression_testing.py
b48f74725a8653f7462fc73b88bfeed1032599aa
[]
no_license
chetandg123/cQubeTesting-2.0
f1b15d77401e677a6e4d2e9e497a364e3dd001b2
bd3ab2b6c8be65bfc1aef3a42585360d70483bd5
refs/heads/master
2023-07-12T22:10:51.705709
2021-08-11T11:20:51
2021-08-11T11:20:51
374,532,154
1
0
null
null
null
null
UTF-8
Python
false
false
5,482
py
import unittest from CRC.check_clusterwise_records import crc_schoolevel_records from CRC.check_crc_tabledata_by_selecting_districts import districtwise_tabledata from CRC.check_districtwise_records import test_crc_report_districtwise from CRC.check_homebtn import Homeicon from CRC.check_table_data_order import Check_order_of_tabledata from CRC.check_xaxis_and_yaxis_from_selectbox import plot_values from CRC.click_on_hyperlink import click_on_hyperlinks from CRC.download_blockwise_csv import donwload_blockwise_csv from CRC.download_clusterwise_csv import load_clusterwise_csv from CRC.download_districtwise_csv import Districtwise_donwload from CRC.download_schoolwise_csv import school_wise_download from CRC.navigate_to_crc_and_click_on_logout import Logout_function from CRC.navigate_to_crc_report import loading_crc from reuse_func import GetData class cQube_CRC_Report(unittest.TestCase): @classmethod def setUpClass(self): self.data = GetData() self.driver = self.data.get_driver() self.data.open_cqube_appln(self.driver) self.data.login_cqube(self.driver) self.data.navigate_to_crc_report() self.data.page_loading(self.driver) self.driver.implicitly_wait(100) def test_navigate_crc(self): b = loading_crc(self.driver) res = b.test_crc() if "crc-report" in self.driver.current_url: print("Navigated back to crc report") else: print("CRC report is not loaded ") self.data.page_loading(self.driver) def test_download_districtwise(self): b = Districtwise_donwload(self.driver) result = b.test_districtwise() self.assertEqual(0, result, msg="File is not downloaded") print("district wise csv file is downloaded ") self.data.page_loading(self.driver) def test_download_blockwise_csv(self): b = donwload_blockwise_csv(self.driver) result = b.test_blockwise() self.assertEqual(0,result, msg="File is not downloaded") print("blockwise csv file is downloaded ") self.data.page_loading(self.driver) def test_download_clusterwise_csv(self): b = load_clusterwise_csv(self.driver) result = b.test_clusterwise() self.assertEqual(0, result, msg="File is not downloaded") print("cluster wise csv file is downloaded ") self.data.page_loading(self.driver) def test_download_schoolwise(self): b = school_wise_download(self.driver) result = b.test_schoolwise() self.assertEqual(0, result, msg="File is not downloaded") print("district wise csv file is downloaded ") self.data.page_loading(self.driver) def test_crc_districtwise(self): b = test_crc_report_districtwise(self.driver) result = b.test_districtwise() self.assertEqual(0, result, msg="File is not downloaded") print('checked with districts records') self.data.page_loading(self.driver) def test_homeicon(self): b = Homeicon(self.driver) result = b.test_homeicon() self.assertTrue(result, msg="Home button not working ") print("checking with home icon and it is working ") self.data.page_loading(self.driver) def test_schools_per_cluster_csv_download1(self): school = crc_schoolevel_records(self.driver) result = school.check_csv_download() self.assertEqual(result,0,msg='csv file is not downloaded') self.data.page_loading(self.driver) def test_districtwise_tabledata(self): b = districtwise_tabledata(self.driver) result = b.test_table_data() if result != 0: raise self.failureException('Data not found on table') print("checked with districtwise table data") self.data.page_loading(self.driver) def test_logout(self): b = Logout_function(self.driver) res = b.test_logout() if "crc-report" in self.driver.current_url: print("Navigated back to crc report") else: print("CRC report is not loaded ") self.data.page_loading(self.driver) def test_crc_graph(self): b = plot_values(self.driver) res1, res2 = b.test_plots() self.assertNotEqual(0, res1, msg="Xaxis options are not present") self.assertNotEqual(0, res2, msg='Yaxis options are not present') self.data.page_loading(self.driver) print("checked graph x and y axis options") def test_orderwise_tabledata(self): b = Check_order_of_tabledata(self.driver) result = b.test_order() self.assertEqual(result, "menu", msg="Menu is not exist") print("check order of table records is working ") self.data.page_loading(self.driver) def test_on_clusterlevel_to_hyperlinks(self): b = click_on_hyperlinks(self.driver) result = b.test_hyperlink() print("checking hyperlink from cluster levels ") self.data.page_loading(self.driver) def test_homebutton(self): b = Homeicon(self.driver) result = b.test_homebutton() self.assertEqual(0,result,msg="Home button is not working ") print("checking with home icon and it is working ") self.data.page_loading(self.driver) @classmethod def tearDownClass(cls): cls.driver.close()
38ba24a26d1eec490788d33c922c28a26fe279e3
5dc0534f17d34562f5eb90061bd77844db3110d9
/misc/deep_learning_notes/Ch4_Recurrent_Networks/002_vanila_RNN_with_edf/edf.py
7f18aacd0cfd85d08e6a79111b1cccd0674a4fce
[ "MIT" ]
permissive
johnnymck/MoocX
202394d064e8a7ebd269876f473b1cef43104c1b
52c8450ff7ecc8450a8adc2457233d5777a3d5bb
refs/heads/master
2023-03-21T04:40:04.069791
2017-09-15T12:49:19
2017-09-15T12:49:19
null
0
0
null
null
null
null
UTF-8
Python
false
false
19,492
py
import numpy as np DT = np.float32 eps = 1e-12 # Globals components = [] params = [] # Global forward/backward def Forward(): for c in components: c.forward() def Backward(loss): for c in components: if c.grad is not None: c.grad = DT(0) loss.grad = np.ones_like(loss.value) for c in components[::-1]: c.backward() # Optimization functions def SGD(lr): for p in params: lrp = p.opts['lr'] * lr if 'lr' in p.opts.keys() else lr p.value = p.value - lrp * p.grad p.grad = DT(0) # Values class Value: def __init__(self, value=None): self.value = DT(value).copy() self.grad = None def set(self, value): self.value = DT(value).copy() # Parameters class Param: def __init__(self, value, opts={}): self.value = DT(value).copy() self.opts = {} params.append(self) self.grad = DT(0) # Xavier initializer def xavier(shape): sq = np.sqrt(3.0 / np.prod(shape[:-1])) return np.random.uniform(-sq, sq, shape) # Utility function for shape inference with broadcasting def bcast(x, y): xs = np.array(x.shape) ys = np.array(y.shape) pad = len(xs) - len(ys) if pad > 0: ys = np.pad(ys, [[pad, 0]], 'constant') elif pad < 0: xs = np.pad(xs, [[-pad, 0]], 'constant') os = np.maximum(xs, ys) xred = tuple([idx for idx in np.where(xs < os)][0]) yred = tuple([idx for idx in np.where(ys < os)][0]) return xred, yred #### Actual components class Add: # Add with broadcasting """ Class name: Add Class usage: add two matrices x, y with broadcasting supported by numpy "+" operation. Class function: forward: calculate x + y with possible broadcasting backward: calculate derivative w.r.t to x and y, when calculate the derivative w.r.t to y, we sum up all the axis over grad except the last dimension. """ def __init__(self, x, y): components.append(self) self.x = x self.y = y self.grad = None if x.grad is None and y.grad is None else DT(0) def forward(self): self.value = self.x.value + self.y.value def backward(self): xred, yred = bcast(self.x.value, self.y.value) if self.x.grad is not None: self.x.grad = self.x.grad + np.reshape( np.sum(self.grad, axis=xred, keepdims=True), self.x.value.shape) if self.y.grad is not None: self.y.grad = self.y.grad + np.reshape( np.sum(self.grad, axis=yred, keepdims=True), self.y.value.shape) class Mul: # Multiply with broadcasting """ Class Name: Mul Class Usage: elementwise multiplication with two matrix Class Functions: forward: compute the result x*y backward: compute the derivative w.r.t x and y """ def __init__(self, x, y): components.append(self) self.x = x self.y = y self.grad = None if x.grad is None and y.grad is None else DT(0) def forward(self): self.value = self.x.value * self.y.value def backward(self): xred, yred = bcast(self.x.value, self.y.value) if self.x.grad is not None: self.x.grad = self.x.grad + np.reshape( np.sum(self.grad * self.y.value, axis=xred, keepdims=True), self.x.value.shape) if self.y.grad is not None: self.y.grad = self.y.grad + np.reshape( np.sum(self.grad * self.x.value, axis=yred, keepdims=True), self.y.value.shape) class VDot: # Matrix multiply (fully-connected layer) """ Class Name: VDot Class Usage: matrix multiplication where x, y are matrices y is expected to be a parameter and there is a convention that parameters come last. Typical usage is x is batch feature vector with shape (batch_size, f_dim), y a parameter with shape (f_dim, f_dim2). Class Functions: forward: compute the vector matrix multplication result backward: compute the derivative w.r.t x and y, where derivative of x and y are both matrices """ def __init__(self, x, y): components.append(self) self.x = x self.y = y self.grad = None if x.grad is None and y.grad is None else DT(0) def forward(self): self.value = np.matmul(self.x.value, self.y.value) def backward(self): if self.x.grad is not None: if len(self.y.value.shape) == 1: nabla = np.matmul(self.y.value.reshape(list(self.y.value.shape) + [1]), self.grad.T).T else: nabla = np.matmul(self.y.value, self.grad.T).T self.x.grad = self.x.grad + nabla if self.y.grad is not None: if len(self.x.value.shape) == 1: nabla = np.matmul(self.x.value.T.reshape(list(self.x.value.shape) + [1]), self.grad.reshape([1] + list(self.grad.shape))) else: nabla = np.matmul(self.x.value.T, self.grad) self.y.grad = self.y.grad + nabla class Log: # Elementwise Log """ Class Name: Log Class Usage: compute the elementwise log(x) given x. Class Functions: forward: compute log(x) backward: compute the derivative w.r.t input vector x """ def __init__(self, x): components.append(self) self.x = x self.grad = None if x.grad is None else DT(0) def forward(self): self.value = np.log(self.x.value) def backward(self): if self.x.grad is not None: self.x.grad = self.x.grad + self.grad / self.x.value class Sigmoid: """ Class Name: Sigmoid Class Usage: compute the elementwise sigmoid activation. Input is vector or matrix. In case of vector, [x_{0}, x_{1}, ..., x_{n}], output is vector [y_{0}, y_{1}, ..., y_{n}] where y_{i} = 1/(1 + exp(-x_{i})) Class Functions: forward: compute activation y_{i} for all i. backward: compute the derivative w.r.t input vector/matrix x """ def __init__(self, x): components.append(self) self.x = x self.grad = None if x.grad is None else DT(0) def forward(self): self.value = 1. / (1. + np.exp(-self.x.value)) def backward(self): if self.x.grad is not None: self.x.grad = self.x.grad + self.grad * self.value * (1. - self.value) class Tanh: """ Class Name: Tanh Class Usage: compute the elementwise Tanh activation. Input is vector or matrix. In case of vector, [x_{0}, x_{1}, ..., x_{n}], output is vector [y_{0}, y_{1}, ..., y_{n}] where y_{i} = (exp(x_{i}) - exp(-x_{i}))/(exp(x_{i}) + exp(-x_{i})) Class Functions: forward: compute activation y_{i} for all i. backward: compute the derivative w.r.t input vector/matrix x """ def __init__(self, x): components.append(self) self.x = x self.grad = None if x.grad is None else DT(0) def forward(self): x_exp = np.exp(self.x.value) x_neg_exp = np.exp(-self.x.value) self.value = (x_exp - x_neg_exp) / (x_exp + x_neg_exp) def backward(self): if self.x.grad is not None: self.x.grad = self.x.grad + self.grad * (1 - self.value * self.value) class RELU: """ Class Name: RELU Class Usage: compute the elementwise RELU activation. Input is vector or matrix. In case of vector, [x_{0}, x_{1}, ..., x_{n}], output is vector [y_{0}, y_{1}, ..., y_{n}] where y_{i} = max(0, x_{i}) Class Functions: forward: compute activation y_{i} for all i. backward: compute the derivative w.r.t input vector/matrix x """ def __init__(self, x): components.append(self) self.x = x self.grad = None if x.grad is None else DT(0) def forward(self): self.value = np.maximum(self.x.value, 0) def backward(self): if self.x.grad is not None: self.x.grad = self.x.grad + self.grad * (self.value > 0) class LeakyRELU: """ Class Name: LeakyRELU Class Usage: compute the elementwise LeakyRELU activation. Input is vector or matrix. In case of vector, [x_{0}, x_{1}, ..., x_{n}], output is vector [y_{0}, y_{1}, ..., y_{n}] where y_{i} = 0.01*x_{i} for x_{i} < 0 and y_{i} = x_{i} for x_{i} > 0 Class Functions: forward: compute activation y_{i} for all i. backward: compute the derivative w.r.t input vector/matrix x """ def __init__(self, x): components.append(self) self.x = x self.grad = None if x.grad is None else DT(0) def forward(self): self.value = np.maximum(self.x.value, 0.01 * self.x.value) def backward(self): if self.x.grad is not None: self.x.grad = self.x.grad + self.grad * np.maximum(0.01, self.value > 0) class Softplus: """ Class Name: Softplus Class Usage: compute the elementwise Softplus activation. Class Functions: forward: compute activation y_{i} for all i. backward: compute the derivative w.r.t input vector/matrix x """ def __init__(self, x): components.append(self) self.x = x self.grad = None if x.grad is None else DT(0) def forward(self): self.value = np.log(1. + np.exp(self.x.value)) def backward(self): if self.x.grad is not None: self.x.grad = self.x.grad + self.grad * 1. / (1. + np.exp(-self.x.value)) class SoftMax: """ Class Name: SoftMax Class Usage: compute the softmax activation for each element in the matrix, normalization by each all elements in each batch (row). Specificaly, input is matrix [x_{00}, x_{01}, ..., x_{0n}, ..., x_{b0}, x_{b1}, ..., x_{bn}], output is a matrix [p_{00}, p_{01}, ..., p_{0n},...,p_{b0},,,p_{bn} ] where p_{bi} = exp(x_{bi})/(exp(x_{b0}) + ... + exp(x_{bn})) Class Functions: forward: compute probability p_{bi} for all b, i. backward: compute the derivative w.r.t input matrix x """ def __init__(self, x): components.append(self) self.x = x self.grad = None if x.grad is None else DT(0) def forward(self): lmax = np.max(self.x.value, axis=-1, keepdims=True) ex = np.exp(self.x.value - lmax) self.value = ex / np.sum(ex, axis=-1, keepdims=True) def backward(self): if self.x.grad is None: return gvdot = np.matmul(self.grad[..., np.newaxis, :], self.value[..., np.newaxis]).squeeze(-1) self.x.grad = self.x.grad + self.value * (self.grad - gvdot) class LogLoss: """ Class Name: LogLoss Class Usage: compute the elementwise -log(x) given matrix x. this is the loss function we use in most case. Class Functions: forward: compute -log(x) backward: compute the derivative w.r.t input matrix x """ def __init__(self, x): components.append(self) self.x = x self.grad = None if x.grad is None else DT(0) def forward(self): self.value = -np.log(np.maximum(eps, self.x.value)) def backward(self): if self.x.grad is not None: self.x.grad = self.x.grad + (-1) * self.grad / np.maximum(eps, self.x.value) class Mean: """ Class Name: Mean Class Usage: compute the mean given a vector x. Class Functions: forward: compute (x_{0} + ... + x_{n})/n backward: compute the derivative w.r.t input vector x """ def __init__(self, x): components.append(self) self.x = x self.grad = None if x.grad is None else DT(0) def forward(self): self.value = np.mean(self.x.value) def backward(self): if self.x.grad is not None: self.x.grad = self.x.grad + self.grad * np.ones_like(self.x.value) / self.x.value.shape[0] class Sum: """ Class Name: Sum Class Usage: compute the sum of a matrix. """ def __init__(self, x): components.append(self) self.x = x self.grad = None if x.grad is None else DT(0) def forward(self): self.value = np.sum(self.x.value) def backward(self): if self.x.grad is not None: self.x.grad = self.x.grad + self.grad * np.ones_like(self.x.value) class MeanwithMask: """ Class Name: MeanwithMask Class Usage: compute the mean given a vector x with mask. Class Functions: forward: compute x = x*mask and then sum over nonzeros in x/#(nozeros in x) backward: compute the derivative w.r.t input vector matrix """ def __init__(self, x, mask): components.append(self) self.x = x self.mask = mask self.grad = None if x.grad is None else DT(0) def forward(self): self.value = np.sum(self.x.value * self.mask.value) / np.sum(self.mask.value) def backward(self): if self.x.grad is not None: self.x.grad = self.x.grad + self.grad * np.ones_like(self.x.value) * self.mask.value / np.sum( self.mask.value) class Aref: # out = x[idx] """ Class Name: Aref Class Usage: get some specific entry in a matrix. x is the matrix with shape (batch_size, N) and idx is vector contains the entry index and x is differentiable. Class Functions: forward: compute x[b, idx(b)] backward: compute the derivative w.r.t input matrix x """ def __init__(self, x, idx): components.append(self) self.x = x self.idx = idx self.grad = None if x.grad is None else DT(0) def forward(self): xflat = self.x.value.reshape(-1) iflat = self.idx.value.reshape(-1) outer_dim = len(iflat) inner_dim = len(xflat) / outer_dim self.pick = np.int32(np.array(range(outer_dim)) * inner_dim + iflat) self.value = xflat[self.pick].reshape(self.idx.value.shape) def backward(self): if self.x.grad is not None: grad = np.zeros_like(self.x.value) gflat = grad.reshape(-1) gflat[self.pick] = self.grad.reshape(-1) self.x.grad = self.x.grad + grad class Accuracy: """ Class Name: Accuracy Class Usage: check the predicted label is correct or not. x is the probability vector where each probability is for each class. idx is ground truth label. Class Functions: forward: find the label that has maximum probability and compare it with the ground truth label. backward: None """ def __init__(self, x, idx): components.append(self) self.x = x self.idx = idx self.grad = None def forward(self): self.value = np.mean(np.argmax(self.x.value, axis=-1) == self.idx.value) def backward(self): pass class Reshape: """ Class name: Reshape Class usage: Reshape the tensor x to specific shape. Class function: forward: Reshape the tensor x to specific shape backward: calculate derivative w.r.t to x, which is simply reshape the income gradient to x's original shape """ def __init__(self, x, shape): components.append(self) self.x = x self.shape = shape self.grad = None if x.grad is None else DT(0) def forward(self): self.value = np.reshape(self.x.value, self.shape) def backward(self): if self.x.grad is not None: self.x.grad = self.x.grad + np.reshape(self.grad, self.x.value.shape) def Momentum(lr, mom): for p in params: if not hasattr(p, 'grad_hist'): p.grad_hist = DT(0) p.grad_hist = mom * p.grad_hist + p.grad p.grad = p.grad_hist SGD(lr) def AdaGrad(lr, ep=1e-8): for p in params: if not hasattr(p, 'grad_G'): p.grad_G = DT(0) p.grad_G = p.grad_G + p.grad * p.grad p.grad = p.grad / np.sqrt(p.grad_G + DT(ep)) SGD(lr) def RMSProp(lr, g=0.9, ep=1e-8): for p in params: if not hasattr(p, 'grad_hist'): p.grad_hist = DT(0) p.grad_hist = g * p.grad_hist + (1 - g) * p.grad * p.grad p.grad = p.grad / np.sqrt(p.grad_hist + DT(ep)) SGD(lr) def Adam(alpha=0.001, b1=0.9, b2=0.999, ep=1e-8): b1 = DT(b1) b2 = DT(b2) ep = DT(ep) _a_b1t = DT(1.0) * b1 _a_b2t = DT(1.0) * b2 for p in params: if not hasattr(p, 'grad_hist'): p.grad_hist = DT(0) p.grad_h2 = DT(0) p.grad_hist = b1 * p.grad_hist + (1. - b1) * p.grad p.grad_h2 = b2 * p.grad_h2 + (1. - b2) * p.grad * p.grad mhat = p.grad_hist / (1. - _a_b1t) vhat = p.grad_h2 / (1. - _a_b2t) p.grad = mhat / (np.sqrt(vhat) + ep) SGD(alpha) # clip the gradient if the norm of gradient is larger than some threshold, this is crucial for RNN. def GradClip(grad_clip): for p in params: l2 = np.sqrt(np.sum(p.grad * p.grad)) if l2 >= grad_clip: p.grad *= grad_clip / l2 ##################################################### Recurrent Components ############################################## class Embed: """ Class name: Embed Class usage: Embed layer. Class function: forward: given the embeeding matrix w2v and word idx, return its corresponding embedding vector. backward: calculate the derivative w.r.t to embedding matrix """ def __init__(self, idx, w2v): components.append(self) self.idx = idx self.w2v = w2v self.grad = None if w2v.grad is None else DT(0) def forward(self): self.value = self.w2v.value[np.int32(self.idx.value), :] def backward(self): if self.w2v.grad is not None: self.w2v.grad = np.zeros(self.w2v.value.shape) self.w2v.grad[np.int32(self.idx.value), :] = self.w2v.grad[np.int32(self.idx.value), :] + self.grad class ConCat: """ Class name: ConCat Class usage: ConCat layer. Class function: forward: concat two matrix along with the axis 1. backward: calculate the derivative w.r.t to matrix a and y. """ def __init__(self, x, y): components.append(self) self.x = x self.y = y self.grad = None if x.grad is None and y.grad is None else DT(0) def forward(self): self.value = np.concatenate((self.x.value, self.y.value), axis=-1) def backward(self): dim_x = self.x.value.shape[-1] dim_y = self.y.value.shape[-1] if self.x.grad is not None: if len(self.x.value.shape) == 2: self.x.grad = self.x.grad + self.grad[:, 0:dim_x] else: self.x.grad = self.x.grad + self.grad[0:dim_x] if self.y.grad is not None: if len(self.y.value.shape) == 2: self.y.grad = self.y.grad + self.grad[:, dim_x:dim_x + dim_y] else: self.y.grad = self.y.grad + self.grad[dim_x:dim_x + dim_y] class ArgMax: """ Class name: ArgMax Class usage: ArgMax layer. Class function: forward: given x, calculate the index which has the maximum value backward: None """ def __init__(self, x): components.append(self) self.x = x def forward(self): self.value = np.argmax(self.x.value) def backward(self): pass
1c6210564d19565b0fb0d19d5a16faa49512c900
f5c3841a08c3faa1818d3ee210c8b9921dc9499d
/parsing_JSON_1.py
e41a258c27dd0efb92e08a6fbfd4055cf60134e0
[]
no_license
villancikos/realpython-book2
a4e74b51fe1d3a8e5af206c2938ff4966ef00df6
6c9a2ef714531f1163f3c78c80fad335661dacf2
refs/heads/master
2016-09-06T10:06:49.227106
2014-09-22T18:56:58
2014-09-22T18:56:58
23,493,659
1
1
null
2014-09-19T23:35:40
2014-08-30T14:44:52
Python
UTF-8
Python
false
false
193
py
# JSON Parsing 1 import json # decodes the json file output = json.load(open('cars.json')) # display output screen print output print " " print json.dumps(output, indent=4, sort_keys=True)
354ea62ee68b6d87dc18276952c5f8d9254a2185
747f759311d404af31c0f80029e88098193f6269
/addons/crm_claim_refund/__openerp__.py
bdb21add0a4b5d9b880d8bff8907d124c775c8d9
[]
no_license
sgeerish/sirr_production
9b0d0f7804a928c0c582ddb4ccb7fcc084469a18
1081f3a5ff8864a31b2dcd89406fac076a908e78
refs/heads/master
2020-05-19T07:21:37.047958
2013-09-15T13:03:36
2013-09-15T13:03:36
9,648,444
0
1
null
null
null
null
UTF-8
Python
false
false
69
py
/home/openerp/production/extra-addons/crm_claim_refund/__openerp__.py
681a5376528ffab913b8a88d30fc3a66a36752f2
5456502f97627278cbd6e16d002d50f1de3da7bb
/chrome/test/mini_installer/verifier_runner.py
9f3f99f54ca5533d699a6f03c95fc058d6f53633
[ "BSD-3-Clause" ]
permissive
TrellixVulnTeam/Chromium_7C66
72d108a413909eb3bd36c73a6c2f98de1573b6e5
c8649ab2a0f5a747369ed50351209a42f59672ee
refs/heads/master
2023-03-16T12:51:40.231959
2017-12-20T10:38:26
2017-12-20T10:38:26
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,389
py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import file_verifier import process_verifier import registry_verifier class VerifierRunner: """Runs all Verifiers.""" def __init__(self): """Constructor.""" # TODO(sukolsak): Implement other verifiers self._verifiers = { 'Files': file_verifier.FileVerifier(), 'Processes': process_verifier.ProcessVerifier(), 'RegistryEntries': registry_verifier.RegistryVerifier(), } def VerifyAll(self, property, variable_expander): """Verifies that the current machine states match the property dictionary. A property dictionary is a dictionary where each key is a verifier's name and the associated value is the input to that verifier. For details about the input format for each verifier, take a look at http://goo.gl/1P85WL Args: property: A property dictionary. variable_expander: A VariableExpander object. """ for verifier_name, verifier_input in property.iteritems(): if verifier_name not in self._verifiers: raise KeyError('Unknown verifier %s' % verifier_name) self._verifiers[verifier_name].VerifyInput(verifier_input, variable_expander)
e5d1941ea66a0350ed8fe6c0a7e0f6f1275e4f81
061c36c4b33dd0c47d9d62c2057559d4c5973681
/hdfs_find_replication_factor_1.py
8745848be2d4daa4237a72ad514a994daa990440
[ "MIT" ]
permissive
ashkankamyab/DevOps-Python-tools
0847f9e1b74d7864d17b0a9833beeef1f149e5a5
dc4b1ce2b2fbee3797b66501ba3918a900a79769
refs/heads/master
2022-10-09T15:23:31.108086
2022-09-01T14:32:56
2022-09-01T14:32:56
189,855,037
1
0
NOASSERTION
2019-06-02T14:15:18
2019-06-02T14:15:18
null
UTF-8
Python
false
false
5,894
py
#!/usr/bin/env python # coding=utf-8 # vim:ts=4:sts=4:sw=4:et # # Author: Hari Sekhon # Date: 2018-11-28 16:37:00 +0000 (Wed, 28 Nov 2018) # # https://github.com/HariSekhon/DevOps-Python-tools # # License: see accompanying Hari Sekhon LICENSE file # # If you're using my code you're welcome to connect with me on LinkedIn # and optionally send me feedback to help steer this or other code I publish # # https://www.linkedin.com/in/HariSekhon # """ Tool to find HDFS file with replication factor 1 These cause problems because taking a single datanode offline may result in alerts for files with missing blocks Uses any arguments are directory tree paths to starting scanning down. If no argument paths are given, searches under top level directory / Uses Hadoop configuration files it expects to find in $HADOOP_HOME/conf to auto-detect NameNodes HA, Kerberos etc (just kinit first) Optionally resets such files back to replication factor 3 if specifying --set-replication-factor-3 Tested on Hadoop 2.7 on HDP 2.6 with Kerberos """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import sys import time import traceback import krbV import snakebite from snakebite.client import AutoConfigClient srcdir = os.path.abspath(os.path.dirname(__file__)) libdir = os.path.join(srcdir, 'pylib') sys.path.append(libdir) try: # pylint: disable=wrong-import-position from harisekhon.utils import log, log_option, validate_int from harisekhon import CLI except ImportError as _: print(traceback.format_exc(), end='') sys.exit(4) __author__ = 'Hari Sekhon' __version__ = '0.3' class HdfsFindReplicationFactor1(CLI): def __init__(self): # Python 2.x super(HdfsFindReplicationFactor1, self).__init__() # Python 3.x # super().__init__() self.path_list = None self.replication_factor = None def add_options(self): super(HdfsFindReplicationFactor1, self).add_options() self.add_opt('--hadoop-home', help='Sets $HADOOP_HOME, expects to find config in $HADOOP_HOME/conf, ' + \ 'otherwise inherits from environment or tries default paths') self.add_opt('--set-replication', metavar='N', type=int, help='Resets any files with replication factor 1 back to this replication factor (optional)') def process_options(self): super(HdfsFindReplicationFactor1, self).process_options() self.path_list = self.args if not self.path_list: self.path_list = ['/'] self.replication_factor = self.get_opt('set_replication') if self.replication_factor is not None: validate_int(self.replication_factor, 'set replication', 2, 5) hadoop_home = self.get_opt('hadoop_home') if hadoop_home is not None: os.environ['HADOOP_HOME'] = hadoop_home hadoop_home_env = os.getenv('HADOOP_HOME') log_option('HADOOP_HOME', hadoop_home_env) if hadoop_home_env: log.info('will search for Hadoop config in %s/conf', hadoop_home_env) def run(self): log.info('initiating snakebite hdfs client') try: client = AutoConfigClient() except krbV.Krb5Error as _: # pylint: disable=no-member if self.verbose: print('', file=sys.stderr) print(_, file=sys.stderr) start_time = time.time() dir_count = 0 file_count = 0 repl1_count = 0 for path in self.path_list: try: result_list = client.ls([path], recurse=True, include_toplevel=True, include_children=True) for result in result_list: if self.verbose and (dir_count + file_count) % 100 == 0: print('.', file=sys.stderr, end='') if result['block_replication'] == 0: dir_count += 1 continue file_count += 1 if result['block_replication'] == 1: file_path = result['path'] repl1_count += 1 if self.verbose: print('', file=sys.stderr) print(file_path) if self.replication_factor: log.info('setting replication factor to %s on %s', self.replication_factor, file_path) # returns a generator so must evaluate in order to actually execute # otherwise you find there is no effect on the replication factor for _ in client.setrep([file_path], self.replication_factor, recurse=False): if 'result' not in _: print('WARNING: result field not found in setrep result: {}'.format(_), file=sys.stderr) continue if not _['result']: print('WARNING: failed to setrep: {}'.format(_)) except (snakebite.errors.FileNotFoundException, snakebite.errors.RequestError) as _: if self.verbose: print('', file=sys.stderr) print(_, file=sys.stderr) if self.verbose: print('', file=sys.stderr) secs = int(time.time() - start_time) print('\nCompleted in {} secs\n'.format(secs), file=sys.stderr) print('{} files with replication factor 1 out of {} files in {} dirs'\ .format(repl1_count, file_count, dir_count), file=sys.stderr) if __name__ == '__main__': HdfsFindReplicationFactor1().main()
2602ad8b379a491de681ea75acdc8be364eec2e4
c6aea4804eae5a9390f1b49ab430292b3ddadb5b
/ipython/ipython_config.py
49f484b383369f26bfb8fe49ac6d72b9d21462c6
[]
no_license
dandavison/dotfiles
eceb48a2e831a9cf792a5d8ca5434610b20d0151
b3ee393ac9585ea22b3747d65f3674f7aeeac947
refs/heads/main
2023-08-28T16:34:25.815800
2023-08-13T23:16:59
2023-08-13T23:16:59
244,988,871
7
3
null
null
null
null
UTF-8
Python
false
false
123
py
# print('ipython_config.py') c = get_config() # (NoColor, Linux, LightBG) # c.TerminalInteractiveShell.colors = 'NoColor'
74bb10c845c3b32c868125b06e7cbd85e69d75f9
cf58c2c216f6c76c71b5a04f72d79fb1d58e4b64
/homeassistant/components/recorder/db_schema.py
c97f99b9e8cf0d8a57ef2aa630bbb5f7e8a09669
[ "Apache-2.0" ]
permissive
whtsky/home-assistant
c301a7a0c2f8e94806d411b705c8f7b5939355d2
2ea5811e3a34e228908802e18c29af1c2fc249c5
refs/heads/dev
2023-08-19T07:37:29.365289
2023-02-17T22:21:28
2023-02-17T22:21:28
204,410,639
1
0
Apache-2.0
2023-02-22T06:14:25
2019-08-26T06:30:12
Python
UTF-8
Python
false
false
26,470
py
"""Models for SQLAlchemy.""" from __future__ import annotations from collections.abc import Callable from datetime import datetime, timedelta import logging import time from typing import Any, cast import ciso8601 from fnvhash import fnv1a_32 from sqlalchemy import ( JSON, BigInteger, Boolean, ColumnElement, DateTime, Float, ForeignKey, Identity, Index, Integer, SmallInteger, String, Text, distinct, type_coerce, ) from sqlalchemy.dialects import mysql, oracle, postgresql, sqlite from sqlalchemy.engine.interfaces import Dialect from sqlalchemy.orm import DeclarativeBase, Mapped, aliased, mapped_column, relationship from sqlalchemy.orm.query import RowReturningQuery from sqlalchemy.orm.session import Session from typing_extensions import Self from homeassistant.const import ( MAX_LENGTH_EVENT_CONTEXT_ID, MAX_LENGTH_EVENT_EVENT_TYPE, MAX_LENGTH_EVENT_ORIGIN, MAX_LENGTH_STATE_ENTITY_ID, MAX_LENGTH_STATE_STATE, ) from homeassistant.core import Context, Event, EventOrigin, State, split_entity_id from homeassistant.helpers.json import JSON_DUMP, json_bytes, json_bytes_strip_null import homeassistant.util.dt as dt_util from homeassistant.util.json import ( JSON_DECODE_EXCEPTIONS, json_loads, json_loads_object, ) from .const import ALL_DOMAIN_EXCLUDE_ATTRS, SupportedDialect from .models import ( StatisticData, StatisticDataTimestamp, StatisticMetaData, datetime_to_timestamp_or_none, process_timestamp, ) # SQLAlchemy Schema # pylint: disable=invalid-name class Base(DeclarativeBase): """Base class for tables.""" SCHEMA_VERSION = 35 _LOGGER = logging.getLogger(__name__) TABLE_EVENTS = "events" TABLE_EVENT_DATA = "event_data" TABLE_STATES = "states" TABLE_STATE_ATTRIBUTES = "state_attributes" TABLE_RECORDER_RUNS = "recorder_runs" TABLE_SCHEMA_CHANGES = "schema_changes" TABLE_STATISTICS = "statistics" TABLE_STATISTICS_META = "statistics_meta" TABLE_STATISTICS_RUNS = "statistics_runs" TABLE_STATISTICS_SHORT_TERM = "statistics_short_term" STATISTICS_TABLES = ("statistics", "statistics_short_term") MAX_STATE_ATTRS_BYTES = 16384 PSQL_DIALECT = SupportedDialect.POSTGRESQL ALL_TABLES = [ TABLE_STATES, TABLE_STATE_ATTRIBUTES, TABLE_EVENTS, TABLE_EVENT_DATA, TABLE_RECORDER_RUNS, TABLE_SCHEMA_CHANGES, TABLE_STATISTICS, TABLE_STATISTICS_META, TABLE_STATISTICS_RUNS, TABLE_STATISTICS_SHORT_TERM, ] TABLES_TO_CHECK = [ TABLE_STATES, TABLE_EVENTS, TABLE_RECORDER_RUNS, TABLE_SCHEMA_CHANGES, ] LAST_UPDATED_INDEX_TS = "ix_states_last_updated_ts" ENTITY_ID_LAST_UPDATED_INDEX_TS = "ix_states_entity_id_last_updated_ts" EVENTS_CONTEXT_ID_INDEX = "ix_events_context_id" STATES_CONTEXT_ID_INDEX = "ix_states_context_id" class FAST_PYSQLITE_DATETIME(sqlite.DATETIME): """Use ciso8601 to parse datetimes instead of sqlalchemy built-in regex.""" def result_processor(self, dialect, coltype): # type: ignore[no-untyped-def] """Offload the datetime parsing to ciso8601.""" return lambda value: None if value is None else ciso8601.parse_datetime(value) JSON_VARIANT_CAST = Text().with_variant( postgresql.JSON(none_as_null=True), "postgresql" # type: ignore[no-untyped-call] ) JSONB_VARIANT_CAST = Text().with_variant( postgresql.JSONB(none_as_null=True), "postgresql" # type: ignore[no-untyped-call] ) DATETIME_TYPE = ( DateTime(timezone=True) .with_variant(mysql.DATETIME(timezone=True, fsp=6), "mysql") # type: ignore[no-untyped-call] .with_variant(FAST_PYSQLITE_DATETIME(), "sqlite") # type: ignore[no-untyped-call] ) DOUBLE_TYPE = ( Float() .with_variant(mysql.DOUBLE(asdecimal=False), "mysql") # type: ignore[no-untyped-call] .with_variant(oracle.DOUBLE_PRECISION(), "oracle") .with_variant(postgresql.DOUBLE_PRECISION(), "postgresql") ) TIMESTAMP_TYPE = DOUBLE_TYPE class JSONLiteral(JSON): """Teach SA how to literalize json.""" def literal_processor(self, dialect: Dialect) -> Callable[[Any], str]: """Processor to convert a value to JSON.""" def process(value: Any) -> str: """Dump json.""" return JSON_DUMP(value) return process EVENT_ORIGIN_ORDER = [EventOrigin.local, EventOrigin.remote] EVENT_ORIGIN_TO_IDX = {origin: idx for idx, origin in enumerate(EVENT_ORIGIN_ORDER)} class Events(Base): """Event history data.""" __table_args__ = ( # Used for fetching events at a specific time # see logbook Index("ix_events_event_type_time_fired_ts", "event_type", "time_fired_ts"), {"mysql_default_charset": "utf8mb4", "mysql_collate": "utf8mb4_unicode_ci"}, ) __tablename__ = TABLE_EVENTS event_id: Mapped[int] = mapped_column(Integer, Identity(), primary_key=True) event_type: Mapped[str | None] = mapped_column(String(MAX_LENGTH_EVENT_EVENT_TYPE)) event_data: Mapped[str | None] = mapped_column( Text().with_variant(mysql.LONGTEXT, "mysql") ) origin: Mapped[str | None] = mapped_column( String(MAX_LENGTH_EVENT_ORIGIN) ) # no longer used for new rows origin_idx: Mapped[int | None] = mapped_column(SmallInteger) time_fired: Mapped[datetime | None] = mapped_column( DATETIME_TYPE ) # no longer used for new rows time_fired_ts: Mapped[float | None] = mapped_column(TIMESTAMP_TYPE, index=True) context_id: Mapped[str | None] = mapped_column( String(MAX_LENGTH_EVENT_CONTEXT_ID), index=True ) context_user_id: Mapped[str | None] = mapped_column( String(MAX_LENGTH_EVENT_CONTEXT_ID) ) context_parent_id: Mapped[str | None] = mapped_column( String(MAX_LENGTH_EVENT_CONTEXT_ID) ) data_id: Mapped[int | None] = mapped_column( Integer, ForeignKey("event_data.data_id"), index=True ) event_data_rel: Mapped[EventData | None] = relationship("EventData") def __repr__(self) -> str: """Return string representation of instance for debugging.""" return ( "<recorder.Events(" f"id={self.event_id}, type='{self.event_type}', " f"origin_idx='{self.origin_idx}', time_fired='{self._time_fired_isotime}'" f", data_id={self.data_id})>" ) @property def _time_fired_isotime(self) -> str | None: """Return time_fired as an isotime string.""" date_time: datetime | None if self.time_fired_ts is not None: date_time = dt_util.utc_from_timestamp(self.time_fired_ts) else: date_time = process_timestamp(self.time_fired) if date_time is None: return None return date_time.isoformat(sep=" ", timespec="seconds") @staticmethod def from_event(event: Event) -> Events: """Create an event database object from a native event.""" return Events( event_type=event.event_type, event_data=None, origin_idx=EVENT_ORIGIN_TO_IDX.get(event.origin), time_fired=None, time_fired_ts=dt_util.utc_to_timestamp(event.time_fired), context_id=event.context.id, context_user_id=event.context.user_id, context_parent_id=event.context.parent_id, ) def to_native(self, validate_entity_id: bool = True) -> Event | None: """Convert to a native HA Event.""" context = Context( id=self.context_id, user_id=self.context_user_id, parent_id=self.context_parent_id, ) try: return Event( self.event_type or "", json_loads_object(self.event_data) if self.event_data else {}, EventOrigin(self.origin) if self.origin else EVENT_ORIGIN_ORDER[self.origin_idx or 0], dt_util.utc_from_timestamp(self.time_fired_ts or 0), context=context, ) except JSON_DECODE_EXCEPTIONS: # When json_loads fails _LOGGER.exception("Error converting to event: %s", self) return None class EventData(Base): """Event data history.""" __table_args__ = ( {"mysql_default_charset": "utf8mb4", "mysql_collate": "utf8mb4_unicode_ci"}, ) __tablename__ = TABLE_EVENT_DATA data_id: Mapped[int] = mapped_column(Integer, Identity(), primary_key=True) hash: Mapped[int | None] = mapped_column(BigInteger, index=True) # Note that this is not named attributes to avoid confusion with the states table shared_data: Mapped[str | None] = mapped_column( Text().with_variant(mysql.LONGTEXT, "mysql") ) def __repr__(self) -> str: """Return string representation of instance for debugging.""" return ( "<recorder.EventData(" f"id={self.data_id}, hash='{self.hash}', data='{self.shared_data}'" ")>" ) @staticmethod def shared_data_bytes_from_event( event: Event, dialect: SupportedDialect | None ) -> bytes: """Create shared_data from an event.""" if dialect == SupportedDialect.POSTGRESQL: return json_bytes_strip_null(event.data) return json_bytes(event.data) @staticmethod def hash_shared_data_bytes(shared_data_bytes: bytes) -> int: """Return the hash of json encoded shared data.""" return cast(int, fnv1a_32(shared_data_bytes)) def to_native(self) -> dict[str, Any]: """Convert to an event data dictionary.""" shared_data = self.shared_data if shared_data is None: return {} try: return cast(dict[str, Any], json_loads(shared_data)) except JSON_DECODE_EXCEPTIONS: _LOGGER.exception("Error converting row to event data: %s", self) return {} class States(Base): """State change history.""" __table_args__ = ( # Used for fetching the state of entities at a specific time # (get_states in history.py) Index(ENTITY_ID_LAST_UPDATED_INDEX_TS, "entity_id", "last_updated_ts"), {"mysql_default_charset": "utf8mb4", "mysql_collate": "utf8mb4_unicode_ci"}, ) __tablename__ = TABLE_STATES state_id: Mapped[int] = mapped_column(Integer, Identity(), primary_key=True) entity_id: Mapped[str | None] = mapped_column(String(MAX_LENGTH_STATE_ENTITY_ID)) state: Mapped[str | None] = mapped_column(String(MAX_LENGTH_STATE_STATE)) attributes: Mapped[str | None] = mapped_column( Text().with_variant(mysql.LONGTEXT, "mysql") ) # no longer used for new rows event_id: Mapped[int | None] = mapped_column( # no longer used for new rows Integer, ForeignKey("events.event_id", ondelete="CASCADE"), index=True ) last_changed: Mapped[datetime | None] = mapped_column( DATETIME_TYPE ) # no longer used for new rows last_changed_ts: Mapped[float | None] = mapped_column(TIMESTAMP_TYPE) last_updated: Mapped[datetime | None] = mapped_column( DATETIME_TYPE ) # no longer used for new rows last_updated_ts: Mapped[float | None] = mapped_column( TIMESTAMP_TYPE, default=time.time, index=True ) old_state_id: Mapped[int | None] = mapped_column( Integer, ForeignKey("states.state_id"), index=True ) attributes_id: Mapped[int | None] = mapped_column( Integer, ForeignKey("state_attributes.attributes_id"), index=True ) context_id: Mapped[str | None] = mapped_column( String(MAX_LENGTH_EVENT_CONTEXT_ID), index=True ) context_user_id: Mapped[str | None] = mapped_column( String(MAX_LENGTH_EVENT_CONTEXT_ID) ) context_parent_id: Mapped[str | None] = mapped_column( String(MAX_LENGTH_EVENT_CONTEXT_ID) ) origin_idx: Mapped[int | None] = mapped_column( SmallInteger ) # 0 is local, 1 is remote old_state: Mapped[States | None] = relationship("States", remote_side=[state_id]) state_attributes: Mapped[StateAttributes | None] = relationship("StateAttributes") def __repr__(self) -> str: """Return string representation of instance for debugging.""" return ( f"<recorder.States(id={self.state_id}, entity_id='{self.entity_id}'," f" state='{self.state}', event_id='{self.event_id}'," f" last_updated='{self._last_updated_isotime}'," f" old_state_id={self.old_state_id}, attributes_id={self.attributes_id})>" ) @property def _last_updated_isotime(self) -> str | None: """Return last_updated as an isotime string.""" date_time: datetime | None if self.last_updated_ts is not None: date_time = dt_util.utc_from_timestamp(self.last_updated_ts) else: date_time = process_timestamp(self.last_updated) if date_time is None: return None return date_time.isoformat(sep=" ", timespec="seconds") @staticmethod def from_event(event: Event) -> States: """Create object from a state_changed event.""" entity_id = event.data["entity_id"] state: State | None = event.data.get("new_state") dbstate = States( entity_id=entity_id, attributes=None, context_id=event.context.id, context_user_id=event.context.user_id, context_parent_id=event.context.parent_id, origin_idx=EVENT_ORIGIN_TO_IDX.get(event.origin), last_updated=None, last_changed=None, ) # None state means the state was removed from the state machine if state is None: dbstate.state = "" dbstate.last_updated_ts = dt_util.utc_to_timestamp(event.time_fired) dbstate.last_changed_ts = None return dbstate dbstate.state = state.state dbstate.last_updated_ts = dt_util.utc_to_timestamp(state.last_updated) if state.last_updated == state.last_changed: dbstate.last_changed_ts = None else: dbstate.last_changed_ts = dt_util.utc_to_timestamp(state.last_changed) return dbstate def to_native(self, validate_entity_id: bool = True) -> State | None: """Convert to an HA state object.""" context = Context( id=self.context_id, user_id=self.context_user_id, parent_id=self.context_parent_id, ) try: attrs = json_loads_object(self.attributes) if self.attributes else {} except JSON_DECODE_EXCEPTIONS: # When json_loads fails _LOGGER.exception("Error converting row to state: %s", self) return None if self.last_changed_ts is None or self.last_changed_ts == self.last_updated_ts: last_changed = last_updated = dt_util.utc_from_timestamp( self.last_updated_ts or 0 ) else: last_updated = dt_util.utc_from_timestamp(self.last_updated_ts or 0) last_changed = dt_util.utc_from_timestamp(self.last_changed_ts or 0) return State( self.entity_id or "", self.state, # type: ignore[arg-type] # Join the state_attributes table on attributes_id to get the attributes # for newer states attrs, last_changed, last_updated, context=context, validate_entity_id=validate_entity_id, ) class StateAttributes(Base): """State attribute change history.""" __table_args__ = ( {"mysql_default_charset": "utf8mb4", "mysql_collate": "utf8mb4_unicode_ci"}, ) __tablename__ = TABLE_STATE_ATTRIBUTES attributes_id: Mapped[int] = mapped_column(Integer, Identity(), primary_key=True) hash: Mapped[int | None] = mapped_column(BigInteger, index=True) # Note that this is not named attributes to avoid confusion with the states table shared_attrs: Mapped[str | None] = mapped_column( Text().with_variant(mysql.LONGTEXT, "mysql") ) def __repr__(self) -> str: """Return string representation of instance for debugging.""" return ( f"<recorder.StateAttributes(id={self.attributes_id}, hash='{self.hash}'," f" attributes='{self.shared_attrs}')>" ) @staticmethod def shared_attrs_bytes_from_event( event: Event, exclude_attrs_by_domain: dict[str, set[str]], dialect: SupportedDialect | None, ) -> bytes: """Create shared_attrs from a state_changed event.""" state: State | None = event.data.get("new_state") # None state means the state was removed from the state machine if state is None: return b"{}" domain = split_entity_id(state.entity_id)[0] exclude_attrs = ( exclude_attrs_by_domain.get(domain, set()) | ALL_DOMAIN_EXCLUDE_ATTRS ) encoder = json_bytes_strip_null if dialect == PSQL_DIALECT else json_bytes bytes_result = encoder( {k: v for k, v in state.attributes.items() if k not in exclude_attrs} ) if len(bytes_result) > MAX_STATE_ATTRS_BYTES: _LOGGER.warning( "State attributes for %s exceed maximum size of %s bytes. " "This can cause database performance issues; Attributes " "will not be stored", state.entity_id, MAX_STATE_ATTRS_BYTES, ) return b"{}" return bytes_result @staticmethod def hash_shared_attrs_bytes(shared_attrs_bytes: bytes) -> int: """Return the hash of json encoded shared attributes.""" return cast(int, fnv1a_32(shared_attrs_bytes)) def to_native(self) -> dict[str, Any]: """Convert to a state attributes dictionary.""" shared_attrs = self.shared_attrs if shared_attrs is None: return {} try: return cast(dict[str, Any], json_loads(shared_attrs)) except JSON_DECODE_EXCEPTIONS: # When json_loads fails _LOGGER.exception("Error converting row to state attributes: %s", self) return {} class StatisticsBase: """Statistics base class.""" id: Mapped[int] = mapped_column(Integer, Identity(), primary_key=True) created: Mapped[datetime] = mapped_column( DATETIME_TYPE, default=dt_util.utcnow ) # No longer used created_ts: Mapped[float] = mapped_column(TIMESTAMP_TYPE, default=time.time) metadata_id: Mapped[int | None] = mapped_column( Integer, ForeignKey(f"{TABLE_STATISTICS_META}.id", ondelete="CASCADE"), index=True, ) start: Mapped[datetime | None] = mapped_column( DATETIME_TYPE, index=True ) # No longer used start_ts: Mapped[float | None] = mapped_column(TIMESTAMP_TYPE, index=True) mean: Mapped[float | None] = mapped_column(DOUBLE_TYPE) min: Mapped[float | None] = mapped_column(DOUBLE_TYPE) max: Mapped[float | None] = mapped_column(DOUBLE_TYPE) last_reset: Mapped[datetime | None] = mapped_column(DATETIME_TYPE) last_reset_ts: Mapped[float | None] = mapped_column(TIMESTAMP_TYPE) state: Mapped[float | None] = mapped_column(DOUBLE_TYPE) sum: Mapped[float | None] = mapped_column(DOUBLE_TYPE) duration: timedelta @classmethod def from_stats(cls, metadata_id: int, stats: StatisticData) -> Self: """Create object from a statistics with datatime objects.""" return cls( # type: ignore[call-arg] metadata_id=metadata_id, created=None, created_ts=time.time(), start=None, start_ts=dt_util.utc_to_timestamp(stats["start"]), mean=stats.get("mean"), min=stats.get("min"), max=stats.get("max"), last_reset=None, last_reset_ts=datetime_to_timestamp_or_none(stats.get("last_reset")), state=stats.get("state"), sum=stats.get("sum"), ) @classmethod def from_stats_ts(cls, metadata_id: int, stats: StatisticDataTimestamp) -> Self: """Create object from a statistics with timestamps.""" return cls( # type: ignore[call-arg] metadata_id=metadata_id, created=None, created_ts=time.time(), start=None, start_ts=stats["start_ts"], mean=stats.get("mean"), min=stats.get("min"), max=stats.get("max"), last_reset=None, last_reset_ts=stats.get("last_reset_ts"), state=stats.get("state"), sum=stats.get("sum"), ) class Statistics(Base, StatisticsBase): """Long term statistics.""" duration = timedelta(hours=1) __table_args__ = ( # Used for fetching statistics for a certain entity at a specific time Index( "ix_statistics_statistic_id_start_ts", "metadata_id", "start_ts", unique=True, ), ) __tablename__ = TABLE_STATISTICS class StatisticsShortTerm(Base, StatisticsBase): """Short term statistics.""" duration = timedelta(minutes=5) __table_args__ = ( # Used for fetching statistics for a certain entity at a specific time Index( "ix_statistics_short_term_statistic_id_start_ts", "metadata_id", "start_ts", unique=True, ), ) __tablename__ = TABLE_STATISTICS_SHORT_TERM class StatisticsMeta(Base): """Statistics meta data.""" __table_args__ = ( {"mysql_default_charset": "utf8mb4", "mysql_collate": "utf8mb4_unicode_ci"}, ) __tablename__ = TABLE_STATISTICS_META id: Mapped[int] = mapped_column(Integer, Identity(), primary_key=True) statistic_id: Mapped[str | None] = mapped_column( String(255), index=True, unique=True ) source: Mapped[str | None] = mapped_column(String(32)) unit_of_measurement: Mapped[str | None] = mapped_column(String(255)) has_mean: Mapped[bool | None] = mapped_column(Boolean) has_sum: Mapped[bool | None] = mapped_column(Boolean) name: Mapped[str | None] = mapped_column(String(255)) @staticmethod def from_meta(meta: StatisticMetaData) -> StatisticsMeta: """Create object from meta data.""" return StatisticsMeta(**meta) class RecorderRuns(Base): """Representation of recorder run.""" __table_args__ = (Index("ix_recorder_runs_start_end", "start", "end"),) __tablename__ = TABLE_RECORDER_RUNS run_id: Mapped[int] = mapped_column(Integer, Identity(), primary_key=True) start: Mapped[datetime] = mapped_column(DATETIME_TYPE, default=dt_util.utcnow) end: Mapped[datetime | None] = mapped_column(DATETIME_TYPE) closed_incorrect: Mapped[bool] = mapped_column(Boolean, default=False) created: Mapped[datetime] = mapped_column(DATETIME_TYPE, default=dt_util.utcnow) def __repr__(self) -> str: """Return string representation of instance for debugging.""" end = ( f"'{self.end.isoformat(sep=' ', timespec='seconds')}'" if self.end else None ) return ( f"<recorder.RecorderRuns(id={self.run_id}," f" start='{self.start.isoformat(sep=' ', timespec='seconds')}', end={end}," f" closed_incorrect={self.closed_incorrect}," f" created='{self.created.isoformat(sep=' ', timespec='seconds')}')>" ) def entity_ids(self, point_in_time: datetime | None = None) -> list[str]: """Return the entity ids that existed in this run. Specify point_in_time if you want to know which existed at that point in time inside the run. """ session = Session.object_session(self) assert session is not None, "RecorderRuns need to be persisted" query: RowReturningQuery[tuple[str]] = session.query(distinct(States.entity_id)) query = query.filter(States.last_updated >= self.start) if point_in_time is not None: query = query.filter(States.last_updated < point_in_time) elif self.end is not None: query = query.filter(States.last_updated < self.end) return [row[0] for row in query] def to_native(self, validate_entity_id: bool = True) -> Self: """Return self, native format is this model.""" return self class SchemaChanges(Base): """Representation of schema version changes.""" __tablename__ = TABLE_SCHEMA_CHANGES change_id: Mapped[int] = mapped_column(Integer, Identity(), primary_key=True) schema_version: Mapped[int | None] = mapped_column(Integer) changed: Mapped[datetime] = mapped_column(DATETIME_TYPE, default=dt_util.utcnow) def __repr__(self) -> str: """Return string representation of instance for debugging.""" return ( "<recorder.SchemaChanges(" f"id={self.change_id}, schema_version={self.schema_version}, " f"changed='{self.changed.isoformat(sep=' ', timespec='seconds')}'" ")>" ) class StatisticsRuns(Base): """Representation of statistics run.""" __tablename__ = TABLE_STATISTICS_RUNS run_id: Mapped[int] = mapped_column(Integer, Identity(), primary_key=True) start: Mapped[datetime] = mapped_column(DATETIME_TYPE, index=True) def __repr__(self) -> str: """Return string representation of instance for debugging.""" return ( f"<recorder.StatisticsRuns(id={self.run_id}," f" start='{self.start.isoformat(sep=' ', timespec='seconds')}', )>" ) EVENT_DATA_JSON = type_coerce( EventData.shared_data.cast(JSONB_VARIANT_CAST), JSONLiteral(none_as_null=True) ) OLD_FORMAT_EVENT_DATA_JSON = type_coerce( Events.event_data.cast(JSONB_VARIANT_CAST), JSONLiteral(none_as_null=True) ) SHARED_ATTRS_JSON = type_coerce( StateAttributes.shared_attrs.cast(JSON_VARIANT_CAST), JSON(none_as_null=True) ) OLD_FORMAT_ATTRS_JSON = type_coerce( States.attributes.cast(JSON_VARIANT_CAST), JSON(none_as_null=True) ) ENTITY_ID_IN_EVENT: ColumnElement = EVENT_DATA_JSON["entity_id"] OLD_ENTITY_ID_IN_EVENT: ColumnElement = OLD_FORMAT_EVENT_DATA_JSON["entity_id"] DEVICE_ID_IN_EVENT: ColumnElement = EVENT_DATA_JSON["device_id"] OLD_STATE = aliased(States, name="old_state")
eae6bc8c7738ace5b044e7819c925a0627ad7571
8049911411405e9db412fe81a9ed8869f28907ba
/python test/5.py
2df3a5715cfd2ed1d779d03bff8bed2a4fe0e68f
[ "MIT" ]
permissive
merry-hyelyn/LIKE_LION
e55a7b10a7c3547cd051b1f1cbebee67f9db0649
26d6642a88d5c075447c60d43a70a7d0f082fb07
refs/heads/master
2020-05-04T09:12:35.787141
2019-07-25T14:36:07
2019-07-25T14:36:07
179,063,513
0
0
null
null
null
null
UTF-8
Python
false
false
77
py
list1 = ['a', 'c', 'd', 'b', 'e'] list1.sort() list1.reverse() print(list1)
9e6aaeb8d65495a48c801f2d753a356698b1c673
bffc8513026009bf6f8bda93b8cc779d9cfefea0
/parser_table.py
1e198324d636de7b192f5d330ad329eeff99193c
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
Stanford-PERTS/mindsetmeter
9e1a764271c9eedc0637eb5a8ab95dd863a65af3
74c0c9a3e908f54a9cae07e171b572225290492a
refs/heads/master
2022-10-25T14:22:37.916936
2020-06-14T17:37:10
2020-06-14T17:37:10
272,250,181
0
0
null
null
null
null
UTF-8
Python
false
false
215,305
py
# parser_table.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = b'\x14\xd0^\xea\x1d8\x17\x96\xba%\xf1\xb7P\xab\xe7\x0e' _lr_action_items = {'PASS':([0,2,10,19,22,23,24,25,45,46,53,68,69,75,79,80,91,95,109,113,115,131,151,154,156,157,158,161,162,163,352,374,396,435,453,505,535,536,537,540,552,576,577,591,592,605,628,629,630,632,633,634,635,636,638,641,642,643,645,656,657,663,664,665,681,682,683,684,685,687,688,689,699,706,707,716,721,],[4,4,-290,-289,-293,-288,-294,-318,-286,-292,-154,-200,-287,-151,-291,-153,-319,-320,-201,-152,-201,4,4,-169,-168,-166,-167,-303,-172,-311,-208,-321,4,4,4,-207,4,-492,-308,-119,-492,4,-299,4,-309,4,-202,4,-42,-492,-307,-41,-120,4,4,-36,-115,-297,-35,-431,-300,-310,4,-171,-322,-203,4,-306,-304,-305,-116,-298,-301,-296,4,-302,-295,]),'IN':([1,9,17,20,21,30,32,33,35,48,55,60,64,71,73,81,87,88,92,99,105,107,117,121,123,126,128,143,144,145,147,149,150,152,207,225,226,230,231,232,233,241,243,261,262,263,264,265,266,267,268,269,270,272,280,281,282,283,286,309,310,313,343,344,345,346,347,348,357,359,360,388,395,423,433,434,437,438,441,457,458,459,460,461,462,463,464,466,467,483,484,485,493,494,495,496,523,529,534,567,595,596,597,],[-383,-492,-492,-384,-394,-390,-372,-386,-373,-388,-382,-492,-349,-359,-387,-492,-492,-397,-395,-385,-389,303,-371,-121,-47,-363,-48,-70,-377,-141,-69,-405,-404,-396,-224,-348,-370,-77,-78,-352,-143,-350,-129,-360,-131,-492,-412,-492,465,-411,-83,-2,-1,-354,-56,-55,-135,-356,-369,303,497,-113,-364,-365,-368,-367,-366,-122,-391,-403,-142,-393,-374,-381,-353,-144,-130,-351,-392,-361,-362,-132,-378,-223,-492,-415,-93,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,303,653,-413,-414,-94,]),'EQUALS':([1,3,8,9,13,16,17,20,21,30,32,33,34,35,37,40,48,55,60,63,64,65,66,71,73,77,81,84,87,88,92,99,103,105,107,108,111,114,116,117,118,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,165,166,167,168,169,170,172,175,177,178,179,181,182,184,185,186,187,188,189,191,193,194,195,198,203,204,205,206,207,218,225,226,230,231,232,233,235,236,237,239,240,241,243,245,246,247,248,251,255,261,262,263,268,269,270,272,273,274,275,280,281,282,283,286,292,299,301,307,309,313,316,318,342,343,344,345,346,347,348,355,356,357,359,360,370,386,387,388,391,392,394,395,403,404,405,414,423,424,425,426,433,434,436,437,438,439,440,441,457,458,459,460,466,467,468,469,470,483,484,485,493,494,495,496,499,500,501,502,512,516,523,529,547,549,574,578,611,613,614,617,639,640,660,672,703,],[-383,-335,-60,-492,-492,-323,-492,-384,-394,-390,-372,-386,170,-373,-137,-492,-388,-382,-492,-492,-349,-492,170,-359,-387,-226,-492,-225,-492,-397,-395,-385,-325,-389,-492,314,314,-59,314,-371,-138,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-484,-490,-470,-477,-485,-480,-483,-472,-482,170,-478,170,-474,-479,-486,170,-491,-475,-489,-481,-487,-473,-488,-476,-105,-492,-223,-229,-224,-492,-348,-370,-77,-78,-352,-143,-80,-419,-79,-444,-446,-350,-129,-49,-50,-123,-330,444,-196,-360,-131,-492,-83,-2,-1,-354,-103,-418,-417,-56,-55,-135,-356,-369,-225,-334,-336,-31,-32,-113,-117,314,-222,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,532,-471,-491,-393,170,-447,170,-374,-106,-228,-227,-418,-381,-223,314,-492,-353,-144,-445,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-284,-104,-416,-136,-358,-357,-379,-380,-337,-114,-243,-245,-244,-118,-492,444,-402,-401,-448,-449,314,-328,-9,-184,-10,-324,-450,170,444,-183,444,]),'RSHIFTEQUAL':([1,3,9,13,16,17,20,21,30,32,33,35,40,48,55,60,64,65,71,73,77,81,84,87,88,92,99,103,105,107,108,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,203,204,205,206,207,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,292,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,403,404,405,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,578,617,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-492,-388,-382,-492,-349,-492,-359,-387,-226,-492,-225,-492,-397,-395,-385,-325,-389,-492,321,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-105,-492,-223,-229,-224,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,-106,-228,-227,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,-328,-324,]),'EXCEPT':([352,374,376,505,536,540,635,681,685,],[-208,-321,539,-207,539,-119,-120,-322,-304,]),'BREAK':([0,2,10,19,22,23,24,25,45,46,53,68,69,75,79,80,91,95,109,113,115,131,151,154,156,157,158,161,162,163,352,374,396,435,453,505,535,536,537,540,552,576,577,591,592,605,628,629,630,632,633,634,635,636,638,641,642,643,645,656,657,663,664,665,681,682,683,684,685,687,688,689,699,706,707,716,721,],[100,100,-290,-289,-293,-288,-294,-318,-286,-292,-154,-200,-287,-151,-291,-153,-319,-320,-201,-152,-201,100,100,-169,-168,-166,-167,-303,-172,-311,-208,-321,100,100,100,-207,100,-492,-308,-119,-492,100,-299,100,-309,100,-202,100,-42,-492,-307,-41,-120,100,100,-36,-115,-297,-35,-431,-300,-310,100,-171,-322,-203,100,-306,-304,-305,-116,-298,-301,-296,100,-302,-295,]),'$end':([0,1,2,3,9,10,13,16,17,19,20,21,22,23,24,25,30,32,33,35,45,46,48,53,54,55,60,64,65,68,69,71,73,75,79,80,81,83,84,85,87,88,91,92,93,95,99,103,105,107,109,111,112,113,115,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,154,156,157,158,161,162,163,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,273,274,275,280,281,282,283,286,299,301,307,309,313,333,337,338,339,340,343,344,345,346,347,348,352,355,356,357,359,360,374,388,395,423,433,434,437,438,439,440,441,457,458,459,460,466,467,468,469,470,483,484,485,493,494,495,496,504,505,523,529,536,537,540,552,577,578,592,617,630,632,633,634,635,641,642,643,645,656,657,663,665,681,684,685,687,688,689,699,706,716,721,],[-492,-383,-150,-335,-492,-290,-492,-323,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,-373,-286,-292,-388,-154,-146,-382,-492,-349,-492,-200,-287,-359,-387,-151,-291,-153,-492,0,-419,-148,-492,-397,-319,-395,-145,-320,-385,-325,-389,-492,-201,-492,-147,-152,-201,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-169,-168,-166,-167,-303,-172,-311,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-103,-418,-417,-56,-55,-135,-356,-369,-334,-336,-31,-32,-113,-149,-157,-45,-155,-46,-364,-365,-368,-367,-366,-122,-208,-86,-333,-391,-403,-142,-321,-393,-374,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-284,-104,-416,-136,-358,-357,-379,-380,-337,-114,-156,-207,-402,-401,-492,-308,-119,-492,-299,-328,-309,-324,-42,-492,-307,-41,-120,-36,-115,-297,-35,-431,-300,-310,-171,-322,-306,-304,-305,-116,-298,-301,-296,-302,-295,]),'TILDE':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,34,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,66,68,69,70,71,73,75,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,165,166,167,168,169,170,172,175,177,178,179,180,181,182,184,185,186,187,188,189,191,193,194,195,198,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,386,387,388,391,392,394,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,547,549,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,639,640,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[6,-383,6,6,6,-492,-290,6,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,194,-373,6,-137,6,-286,-292,-388,6,-154,-382,6,6,-492,6,6,-349,194,-200,-287,6,-359,-387,-151,6,-291,-153,-492,-492,-397,6,-319,-395,6,-320,6,6,6,-385,6,-389,-201,6,-152,-201,-371,-138,6,-121,6,-47,6,6,-363,6,-48,6,6,6,-70,-377,-141,6,-69,6,-405,-404,6,-396,-169,-168,-166,-167,-303,-172,-311,6,-484,-490,-470,-477,-485,-480,-483,-472,-482,194,-478,6,194,-474,-479,-486,194,-491,-475,-489,-481,-487,-473,-488,-476,6,6,-224,6,-492,-348,-370,6,-77,-78,-352,-143,6,-350,6,-129,6,6,6,-360,-131,-492,-83,-2,-1,6,-354,6,-56,-55,-135,-356,6,6,-369,-342,6,-344,-339,-343,-338,-341,-346,-340,6,-242,-238,-233,6,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,6,6,-321,-471,-491,-393,194,-447,194,-374,6,6,6,6,6,6,-381,6,6,6,-353,-144,6,-130,-351,-392,6,6,6,6,6,-361,-362,-132,-378,6,6,-84,-355,6,-136,-358,-357,6,-379,-380,-345,-347,-207,6,6,6,-402,6,6,-401,6,6,-492,-308,6,-119,-448,-449,-492,6,6,-299,6,-309,6,6,-202,6,-42,-492,-307,-41,-120,6,6,-450,194,-36,-115,-297,6,-35,6,6,6,-431,-300,-310,6,-171,6,-322,-203,6,-306,-304,-305,-116,-298,-301,-296,6,6,-302,-295,6,]),'XOR':([1,9,17,20,21,30,32,33,34,35,48,55,60,66,71,73,81,87,88,92,99,105,117,121,123,126,128,143,144,145,147,149,150,152,165,166,167,168,169,170,172,175,177,178,179,181,182,184,185,186,187,188,189,191,193,194,195,198,226,231,233,261,262,263,268,269,270,272,280,281,282,283,286,343,344,345,346,347,348,357,359,360,386,387,388,391,392,394,395,423,433,434,441,457,458,459,460,466,467,483,484,485,493,494,523,529,547,549,639,640,],[-383,-492,-492,-384,-394,-390,-372,-386,165,-373,-388,-382,229,165,-359,-387,-492,-492,-397,-395,-385,-389,-371,-121,-47,-363,-48,-70,-377,-141,-69,-405,-404,-396,-484,-490,-470,-477,-485,-480,-483,-472,-482,165,-478,165,-474,-479,-486,165,-491,-475,-489,-481,-487,-473,-488,-476,-370,229,-143,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-364,-365,-368,-367,-366,-122,-391,-403,-142,-471,-491,-393,165,-447,165,-374,-381,-353,-144,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-402,-401,-448,-449,-450,165,]),'DEF':([0,2,10,19,22,23,24,25,28,31,45,46,53,68,69,75,79,80,89,91,95,109,113,115,154,155,156,157,158,159,161,162,163,352,374,406,505,535,536,537,540,552,560,577,592,628,629,630,632,633,634,635,641,642,643,645,656,657,663,665,681,682,684,685,687,688,689,699,706,716,721,],[12,12,-290,-289,-293,-288,-294,-318,12,12,-286,-292,-154,-200,-287,-151,-291,-153,-164,-319,-320,-201,-152,-201,-169,-165,-168,-166,-167,12,-303,-172,-311,-208,-321,-162,-207,12,-492,-308,-119,-492,-163,-299,-309,-202,12,-42,-492,-307,-41,-120,-36,-115,-297,-35,-431,-300,-310,-171,-322,-203,-306,-304,-305,-116,-298,-301,-296,-302,-295,]),'EQ':([1,9,17,20,21,30,32,33,35,48,55,60,64,71,73,81,87,88,92,99,105,107,117,121,123,126,128,143,144,145,147,149,150,152,226,230,231,232,233,241,243,261,262,263,268,269,270,272,280,281,282,283,286,309,313,343,344,345,346,347,348,357,359,360,388,395,423,433,434,437,438,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,534,],[-383,-492,-492,-384,-394,-390,-372,-386,-373,-388,-382,-492,-349,-359,-387,-492,-492,-397,-395,-385,-389,312,-371,-121,-47,-363,-48,-70,-377,-141,-69,-405,-404,-396,-370,-77,-78,-352,-143,-350,-129,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,312,-113,-364,-365,-368,-367,-366,-122,-391,-403,-142,-393,-374,-381,-353,-144,-130,-351,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,312,]),'POWEQUAL':([1,3,9,13,16,17,20,21,30,32,33,35,40,48,55,60,64,65,71,73,77,81,84,87,88,92,99,103,105,107,108,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,203,204,205,206,207,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,292,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,403,404,405,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,578,617,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-492,-388,-382,-492,-349,-492,-359,-387,-226,-492,-225,-492,-397,-395,-385,-325,-389,-492,328,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-105,-492,-223,-229,-224,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,-106,-228,-227,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,-328,-324,]),'IS':([1,9,17,20,21,30,32,33,35,48,55,60,64,71,73,81,87,88,92,99,105,107,117,121,123,126,128,143,144,145,147,149,150,152,226,230,231,232,233,241,243,261,262,263,268,269,270,272,280,281,282,283,286,309,313,343,344,345,346,347,348,357,359,360,388,395,423,433,434,437,438,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,534,],[-383,-492,-492,-384,-394,-390,-372,-386,-373,-388,-382,-492,-349,-359,-387,-492,-492,-397,-395,-385,-389,311,-371,-121,-47,-363,-48,-70,-377,-141,-69,-405,-404,-396,-370,-77,-78,-352,-143,-350,-129,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,311,-113,-364,-365,-368,-367,-366,-122,-391,-403,-142,-393,-374,-381,-353,-144,-130,-351,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,311,]),'DOLLAR_LBRACE':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,34,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,66,68,69,70,71,73,75,76,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,178,180,186,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,388,391,392,394,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,547,549,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,639,640,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[15,-383,15,15,15,-492,-290,15,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,180,-373,15,-137,15,-286,-292,-388,15,-154,-382,15,15,-492,15,15,-349,180,-200,-287,15,-359,-387,-151,15,15,-291,-153,-492,-492,-397,15,-319,-395,15,-320,15,15,15,-385,15,-389,-201,15,-152,-201,-371,-138,15,-121,15,-47,15,15,-363,15,-48,15,15,15,-70,-377,-141,15,-69,15,-405,-404,15,-396,-169,-168,-166,-167,-303,-172,-311,15,180,15,180,15,15,-224,15,-492,-348,-370,15,-77,-78,-352,-143,15,-350,15,-129,15,15,15,-360,-131,-492,-83,-2,-1,15,-354,15,-56,-55,-135,-356,15,15,-369,-342,15,-344,-339,-343,-338,-341,-346,-340,15,-242,-238,-233,15,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,15,15,-321,-393,180,-447,180,-374,15,15,15,15,15,15,-381,15,15,15,-353,-144,15,-130,-351,-392,15,15,15,15,15,-361,-362,-132,-378,15,15,-84,-355,15,-136,-358,-357,15,-379,-380,-345,-347,-207,15,15,15,-402,15,15,-401,15,15,-492,-308,15,-119,-448,-449,-492,15,15,-299,15,-309,15,15,-202,15,-42,-492,-307,-41,-120,15,15,-450,180,-36,-115,-297,15,-35,15,15,15,-431,-300,-310,15,-171,15,-322,-203,15,-306,-304,-305,-116,-298,-301,-296,15,15,-302,-295,15,]),'AS':([1,3,9,13,16,17,20,21,30,32,33,35,48,55,60,64,65,71,73,81,87,88,92,99,103,105,107,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,226,230,231,232,233,241,243,245,246,247,248,258,261,262,263,268,269,270,272,277,279,280,281,282,283,286,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,402,423,433,434,437,438,439,440,441,457,458,459,460,466,467,471,472,483,484,485,493,494,495,496,523,529,578,599,600,617,637,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-388,-382,-492,-349,-492,-359,-387,-492,-492,-397,-395,-385,-325,-389,-492,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,455,-360,-131,-492,-83,-2,-1,-354,-279,479,-56,-55,-135,-356,-369,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,479,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-280,-125,-136,-358,-357,-379,-380,-337,-114,-402,-401,-328,-126,-278,-324,479,]),'TRY':([0,2,10,19,22,23,24,25,45,46,53,68,69,75,79,80,91,95,109,113,115,154,156,157,158,161,162,163,352,374,505,535,536,537,540,552,577,592,628,629,630,632,633,634,635,641,642,643,645,656,657,663,665,681,682,684,685,687,688,689,699,706,716,721,],[18,18,-290,-289,-293,-288,-294,-318,-286,-292,-154,-200,-287,-151,-291,-153,-319,-320,-201,-152,-201,-169,-168,-166,-167,-303,-172,-311,-208,-321,-207,18,-492,-308,-119,-492,-299,-309,-202,18,-42,-492,-307,-41,-120,-36,-115,-297,-35,-431,-300,-310,-171,-322,-203,-306,-304,-305,-116,-298,-301,-296,-302,-295,]),'LSHIFT':([1,9,17,20,21,30,32,33,35,48,55,71,73,87,88,92,99,105,117,121,123,126,128,143,144,145,147,149,150,152,226,261,262,263,280,282,286,343,344,345,346,347,348,357,359,360,388,395,423,441,457,458,459,460,483,484,485,493,494,523,529,],[-383,-492,-492,-384,-394,-390,-372,-386,-373,-388,-382,-359,-387,285,-397,-395,-385,-389,-371,-121,-47,-363,-48,-70,-377,-141,-69,-405,-404,-396,-370,-360,-131,-492,285,-135,-369,-364,-365,-368,-367,-366,-122,-391,-403,-142,-393,-374,-381,-392,-361,-362,-132,-378,-136,-358,-357,-379,-380,-402,-401,]),'STRING':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,34,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,66,68,69,70,71,73,75,76,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,165,166,167,168,169,170,172,175,177,178,179,180,181,182,184,185,186,187,188,189,191,193,194,195,198,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,386,387,388,391,392,394,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,547,549,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,639,640,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[21,-383,21,21,21,-492,-290,21,-492,-289,21,-394,-293,-288,-294,-318,-390,-372,-386,187,-373,21,-137,21,-286,-292,-388,21,-154,-382,21,21,-492,21,21,-349,187,-200,-287,21,-359,-387,-151,21,21,-291,-153,-492,-492,-397,21,-319,-395,21,-320,21,21,21,-385,21,-389,-201,21,-152,-201,-371,-138,21,-121,21,-47,21,21,-363,21,-48,21,21,21,-70,-377,-141,21,-69,21,-405,-404,21,-396,-169,-168,-166,-167,-303,-172,-311,21,-484,-490,-470,-477,-485,-480,-483,-472,-482,187,-478,21,387,-474,-479,-486,187,-491,-475,-489,-481,-487,-473,-488,-476,21,21,-224,21,-492,-348,-370,21,-77,-78,-352,-143,21,-350,21,-129,21,21,21,-360,-131,-492,-83,-2,-1,21,-354,21,-56,-55,-135,-356,21,21,-369,-342,21,-344,-339,-343,-338,-341,-346,-340,21,-242,-238,-233,21,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,21,21,-321,-471,-491,-393,187,-447,187,-374,21,21,21,21,21,21,-381,21,21,21,-353,-144,21,-130,-351,-392,21,21,21,21,21,-361,-362,-132,-378,21,21,-84,-355,21,-136,-358,-357,21,-379,-380,-345,-347,-207,21,21,21,-402,21,21,-401,21,21,-492,-308,21,-119,-448,-449,-492,21,21,-299,21,-309,21,21,-202,21,-42,-492,-307,-41,-120,21,21,-450,187,-36,-115,-297,21,-35,21,21,21,-431,-300,-310,21,-171,21,-322,-203,21,-306,-304,-305,-116,-298,-301,-296,21,21,-302,-295,21,]),'RETURN':([0,2,10,19,22,23,24,25,45,46,53,68,69,75,79,80,91,95,109,113,115,131,151,154,156,157,158,161,162,163,352,374,396,435,453,505,535,536,537,540,552,576,577,591,592,605,628,629,630,632,633,634,635,636,638,641,642,643,645,656,657,663,664,665,681,682,683,684,685,687,688,689,699,706,707,716,721,],[110,110,-290,-289,-293,-288,-294,-318,-286,-292,-154,-200,-287,-151,-291,-153,-319,-320,-201,-152,-201,110,110,-169,-168,-166,-167,-303,-172,-311,-208,-321,110,110,110,-207,110,-492,-308,-119,-492,110,-299,110,-309,110,-202,110,-42,-492,-307,-41,-120,110,110,-36,-115,-297,-35,-431,-300,-310,110,-171,-322,-203,110,-306,-304,-305,-116,-298,-301,-296,110,-302,-295,]),'PIPEEQUAL':([1,3,9,13,16,17,20,21,30,32,33,35,40,48,55,60,64,65,71,73,77,81,84,87,88,92,99,103,105,107,108,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,203,204,205,206,207,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,292,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,403,404,405,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,578,617,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-492,-388,-382,-492,-349,-492,-359,-387,-226,-492,-225,-492,-397,-395,-385,-325,-389,-492,323,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-105,-492,-223,-229,-224,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,-106,-228,-227,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,-328,-324,]),'DOLLAR_LPAREN':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,34,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,66,68,69,70,71,73,75,76,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,178,180,186,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,388,391,392,394,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,547,549,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,639,640,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[66,-383,66,66,66,-492,-290,66,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,186,-373,66,-137,66,-286,-292,-388,66,-154,-382,66,66,-492,66,66,-349,186,-200,-287,66,-359,-387,-151,66,66,-291,-153,-492,-492,-397,66,-319,-395,66,-320,66,66,66,-385,66,-389,-201,66,-152,-201,-371,-138,66,-121,66,-47,66,66,-363,66,-48,66,66,66,-70,-377,-141,66,-69,66,-405,-404,66,-396,-169,-168,-166,-167,-303,-172,-311,66,186,66,186,66,66,-224,66,-492,-348,-370,66,-77,-78,-352,-143,66,-350,66,-129,66,66,66,-360,-131,-492,-83,-2,-1,66,-354,66,-56,-55,-135,-356,66,66,-369,-342,66,-344,-339,-343,-338,-341,-346,-340,66,-242,-238,-233,66,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,66,66,-321,-393,186,-447,186,-374,66,66,66,66,66,66,-381,66,66,66,-353,-144,66,-130,-351,-392,66,66,66,66,66,-361,-362,-132,-378,66,66,-84,-355,66,-136,-358,-357,66,-379,-380,-345,-347,-207,66,66,66,-402,66,66,-401,66,66,-492,-308,66,-119,-448,-449,-492,66,66,-299,66,-309,66,66,-202,66,-42,-492,-307,-41,-120,66,66,-450,186,-36,-115,-297,66,-35,66,66,66,-431,-300,-310,66,-171,66,-322,-203,66,-306,-304,-305,-116,-298,-301,-296,66,66,-302,-295,66,]),'DIVEQUAL':([1,3,9,13,16,17,20,21,30,32,33,35,40,48,55,60,64,65,71,73,77,81,84,87,88,92,99,103,105,107,108,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,203,204,205,206,207,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,292,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,403,404,405,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,578,617,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-492,-388,-382,-492,-349,-492,-359,-387,-226,-492,-225,-492,-397,-395,-385,-325,-389,-492,326,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-105,-492,-223,-229,-224,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,-106,-228,-227,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,-328,-324,]),'YIELD':([0,2,10,19,22,23,24,25,45,46,53,68,69,75,79,80,91,95,96,109,113,115,131,151,154,156,157,158,161,162,163,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,352,374,396,435,453,505,535,536,537,540,552,576,577,591,592,605,628,629,630,632,633,634,635,636,638,641,642,643,645,656,657,663,664,665,681,682,683,684,685,687,688,689,699,706,707,716,721,],[63,63,-290,-289,-293,-288,-294,-318,-286,-292,-154,-200,-287,-151,-291,-153,-319,-320,63,-201,-152,-201,63,63,-169,-168,-166,-167,-303,-172,-311,63,-242,-238,-233,63,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-208,-321,63,63,63,-207,63,-492,-308,-119,-492,63,-299,63,-309,63,-202,63,-42,-492,-307,-41,-120,63,63,-36,-115,-297,-35,-431,-300,-310,63,-171,-322,-203,63,-306,-304,-305,-116,-298,-301,-296,63,-302,-295,]),'WS':([165,166,167,168,169,170,171,172,173,174,175,176,177,179,181,182,183,184,185,187,188,189,190,191,192,193,194,195,196,197,198,199,249,384,386,387,389,392,393,394,544,545,546,547,548,550,551,640,],[-484,-490,-470,-477,-485,-480,-462,-483,-456,-459,-472,-465,-482,-478,-458,-474,390,-479,-486,-394,-475,-489,-463,-481,-460,-487,-473,-488,-461,-464,-476,394,390,390,-471,-491,-453,549,390,-452,-466,-469,-467,639,640,-468,-457,-455,]),'GLOBAL':([0,2,10,19,22,23,24,25,45,46,53,68,69,75,79,80,91,95,109,113,115,131,151,154,156,157,158,161,162,163,352,374,396,435,453,505,535,536,537,540,552,576,577,591,592,605,628,629,630,632,633,634,635,636,638,641,642,643,645,656,657,663,664,665,681,682,683,684,685,687,688,689,699,706,707,716,721,],[29,29,-290,-289,-293,-288,-294,-318,-286,-292,-154,-200,-287,-151,-291,-153,-319,-320,-201,-152,-201,29,29,-169,-168,-166,-167,-303,-172,-311,-208,-321,29,29,29,-207,29,-492,-308,-119,-492,29,-299,29,-309,29,-202,29,-42,-492,-307,-41,-120,29,29,-36,-115,-297,-35,-431,-300,-310,29,-171,-322,-203,29,-306,-304,-305,-116,-298,-301,-296,29,-302,-295,]),'DOLLAR_NAME':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,34,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,66,68,69,70,71,73,75,76,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,178,180,186,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,388,391,392,394,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,547,549,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,639,640,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[30,-383,30,30,30,-492,-290,30,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,196,-373,30,-137,30,-286,-292,-388,30,-154,-382,30,30,-492,30,30,-349,196,-200,-287,30,-359,-387,-151,30,30,-291,-153,-492,-492,-397,30,-319,-395,30,-320,30,30,30,-385,30,-389,-201,30,-152,-201,-371,-138,30,-121,30,-47,30,30,-363,30,-48,30,30,30,-70,-377,-141,30,-69,30,-405,-404,30,-396,-169,-168,-166,-167,-303,-172,-311,30,196,30,196,30,30,-224,30,-492,-348,-370,30,-77,-78,-352,-143,30,-350,30,-129,30,30,30,-360,-131,-492,-83,-2,-1,30,-354,30,-56,-55,-135,-356,30,30,-369,-342,30,-344,-339,-343,-338,-341,-346,-340,30,-242,-238,-233,30,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,30,30,-321,-393,196,-447,196,-374,30,30,30,30,30,30,-381,30,30,30,-353,-144,30,-130,-351,-392,30,30,30,30,30,-361,-362,-132,-378,30,30,-84,-355,30,-136,-358,-357,30,-379,-380,-345,-347,-207,30,30,30,-402,30,30,-401,30,30,-492,-308,30,-119,-448,-449,-492,30,30,-299,30,-309,30,30,-202,30,-42,-492,-307,-41,-120,30,30,-450,196,-36,-115,-297,30,-35,30,30,30,-431,-300,-310,30,-171,30,-322,-203,30,-306,-304,-305,-116,-298,-301,-296,30,30,-302,-295,30,]),'ASYNC':([0,2,10,19,22,23,24,25,28,45,46,53,68,69,75,79,80,89,91,95,109,113,115,154,155,156,157,158,161,162,163,352,374,406,505,535,536,537,540,552,560,577,592,628,629,630,632,633,634,635,641,642,643,645,656,657,663,665,681,682,684,685,687,688,689,699,706,716,721,],[31,31,-290,-289,-293,-288,-294,-318,159,-286,-292,-154,-200,-287,-151,-291,-153,-164,-319,-320,-201,-152,-201,-169,-165,-168,-166,-167,-303,-172,-311,-208,-321,-162,-207,31,-492,-308,-119,-492,-163,-299,-309,-202,31,-42,-492,-307,-41,-120,-36,-115,-297,-35,-431,-300,-310,-171,-322,-203,-306,-304,-305,-116,-298,-301,-296,-302,-295,]),'QUESTION':([1,17,20,21,30,33,48,55,73,88,92,99,105,143,145,149,150,152,263,357,359,360,388,423,441,493,494,523,529,],[-383,149,-384,-394,-390,-386,-388,-382,-387,-397,-395,-385,-389,149,-141,-405,-404,-396,149,-391,-403,-142,-393,-381,-392,-379,-380,-402,-401,]),'IF':([0,1,2,3,9,10,13,16,17,19,20,21,22,23,24,25,30,32,33,35,45,46,48,53,55,60,64,65,68,69,71,73,75,79,80,81,87,88,91,92,95,99,105,107,109,113,115,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,154,156,157,158,161,162,163,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,299,301,307,309,313,343,344,345,346,347,348,352,355,356,357,359,360,374,388,395,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,505,523,529,534,535,536,537,540,552,577,592,628,629,630,632,633,634,635,641,642,643,645,656,657,663,665,681,682,684,685,687,688,689,693,699,706,716,721,722,724,725,743,],[36,-383,36,-335,-492,-290,-492,141,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,-373,-286,-292,-388,-154,-382,-492,-349,-492,-200,-287,-359,-387,-151,-291,-153,-492,-492,-397,-319,-395,-320,-385,-389,-492,-201,-152,-201,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-169,-168,-166,-167,-303,-172,-311,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-208,-86,-333,-391,-403,-142,-321,-393,-374,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-207,-402,-401,-492,36,-492,-308,-119,-492,-299,-309,-202,36,-42,-492,-307,-41,-120,-36,-115,-297,-35,-431,-300,-310,-171,-322,-203,-306,-304,-305,-116,-298,711,-301,-296,-302,-295,-327,-326,711,-329,]),'GT':([1,9,17,20,21,30,32,33,34,35,48,55,60,64,66,71,73,81,87,88,92,99,105,107,117,121,123,126,128,143,144,145,147,149,150,152,178,186,226,230,231,232,233,241,243,261,262,263,268,269,270,272,280,281,282,283,286,309,313,343,344,345,346,347,348,357,359,360,388,391,392,394,395,423,433,434,437,438,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,534,547,549,639,640,],[-383,-492,-492,-384,-394,-390,-372,-386,171,-373,-388,-382,-492,-349,171,-359,-387,-492,-492,-397,-395,-385,-389,304,-371,-121,-47,-363,-48,-70,-377,-141,-69,-405,-404,-396,171,171,-370,-77,-78,-352,-143,-350,-129,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,304,-113,-364,-365,-368,-367,-366,-122,-391,-403,-142,-393,171,-447,171,-374,-381,-353,-144,-130,-351,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,304,-448,-449,-450,171,]),'LBRACKET':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,68,69,70,71,73,75,76,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,180,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,388,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[98,-383,98,98,98,-492,-290,98,146,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,-373,98,-137,98,-286,-292,-388,98,-154,-382,98,98,-492,98,98,-349,-200,-287,98,-359,-387,-151,98,98,-291,-153,-492,-492,-397,98,-319,-395,98,-320,98,98,98,-385,98,-389,-201,98,-152,-201,-371,-138,98,-121,98,-47,98,98,-363,98,-48,98,98,98,146,-377,-141,98,-69,98,-405,-404,98,-396,-169,-168,-166,-167,-303,-172,-311,98,98,98,98,-224,98,-492,-348,-370,98,-77,-78,-352,-143,98,-350,98,-129,98,98,98,-360,-131,146,-83,-2,-1,98,-354,98,-56,-55,-135,-356,98,98,-369,-342,98,-344,-339,-343,-338,-341,-346,-340,98,-242,-238,-233,98,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,98,98,-321,-393,-374,98,98,98,98,98,98,-381,98,98,98,-353,-144,98,-130,-351,-392,98,98,98,98,98,-361,-362,-132,-378,98,98,-84,-355,98,-136,-358,-357,98,-379,-380,-345,-347,-207,98,98,98,-402,98,98,-401,98,98,-492,-308,98,-119,-492,98,98,-299,98,-309,98,98,-202,98,-42,-492,-307,-41,-120,98,98,-36,-115,-297,98,-35,98,98,98,-431,-300,-310,98,-171,98,-322,-203,98,-306,-304,-305,-116,-298,-301,-296,98,98,-302,-295,98,]),'AWAIT':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,68,69,70,71,73,75,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,180,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,388,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[76,-383,76,76,76,-492,-290,76,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,-373,76,-137,76,-286,-292,-388,76,-154,-382,76,76,-492,76,76,-349,-200,-287,76,-359,-387,-151,76,-291,-153,-492,-492,-397,76,-319,-395,76,-320,76,76,76,-385,76,-389,-201,76,-152,-201,-371,-138,76,-121,76,-47,76,76,-363,76,-48,76,76,76,-70,-377,-141,76,-69,76,-405,-404,76,-396,-169,-168,-166,-167,-303,-172,-311,76,76,76,76,-224,76,-492,-348,-370,76,-77,-78,-352,-143,76,-350,76,-129,76,76,76,-360,-131,-492,-83,-2,-1,76,-354,76,-56,-55,-135,-356,76,76,-369,-342,76,-344,-339,-343,-338,-341,-346,-340,76,-242,-238,-233,76,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,76,76,-321,-393,-374,76,76,76,76,76,76,-381,76,76,76,-353,-144,76,-130,-351,-392,76,76,76,76,76,-361,-362,-132,-378,76,76,-84,-355,76,-136,-358,-357,76,-379,-380,-345,-347,-207,76,76,76,-402,76,76,-401,76,76,-492,-308,76,-119,-492,76,76,-299,76,-309,76,76,-202,76,-42,-492,-307,-41,-120,76,76,-36,-115,-297,76,-35,76,76,76,-431,-300,-310,76,-171,76,-322,-203,76,-306,-304,-305,-116,-298,-301,-296,76,76,-302,-295,76,]),'RBRACKET':([1,3,9,13,16,17,20,21,30,32,33,35,48,55,60,64,65,71,73,77,81,87,88,92,98,99,103,105,107,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,165,166,167,168,169,170,171,172,173,174,175,176,177,179,181,182,183,184,185,187,188,189,190,191,192,193,194,195,196,197,198,199,203,205,207,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,289,292,296,297,298,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,361,362,363,365,384,386,387,388,389,394,395,403,405,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,490,491,492,493,494,495,496,518,519,520,521,523,524,529,544,545,546,548,550,551,578,604,617,618,619,620,621,622,623,640,677,678,679,680,693,705,708,709,710,712,713,722,724,725,732,743,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-388,-382,-492,-349,-492,-359,-387,-226,-492,-492,-397,-395,-492,-385,-325,-389,-492,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-484,-490,-470,-477,-485,-480,-462,-483,-456,-459,-472,-465,-482,-478,-458,-474,388,-479,-486,-394,-475,-489,-463,-481,-460,-487,-473,-488,-461,-464,-476,-451,-105,-223,-224,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-492,-225,-64,494,-63,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-492,-408,523,-61,545,-471,-491,-393,-453,-452,-374,-106,-227,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-398,-492,-399,-379,-380,-337,-114,-492,-101,-21,-22,-402,-492,-401,-466,-469,-467,-454,-468,-457,-328,-400,-324,-406,-223,-102,-407,-62,-492,-455,-492,-57,-409,-58,-492,-410,-440,-29,-441,-442,-30,-327,-326,-492,-443,-329,]),'MODEQUAL':([1,3,9,13,16,17,20,21,30,32,33,35,40,48,55,60,64,65,71,73,77,81,84,87,88,92,99,103,105,107,108,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,203,204,205,206,207,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,292,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,403,404,405,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,578,617,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-492,-388,-382,-492,-349,-492,-359,-387,-226,-492,-225,-492,-397,-395,-385,-325,-389,-492,325,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-105,-492,-223,-229,-224,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,-106,-228,-227,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,-328,-324,]),'COMMA':([1,3,9,13,16,17,20,21,30,32,33,35,40,48,55,60,64,65,71,73,77,81,84,87,88,92,99,103,105,107,117,119,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,153,160,203,204,212,213,214,218,225,226,230,231,232,233,236,241,243,245,246,247,248,251,253,255,257,258,261,262,263,264,265,267,268,269,270,272,273,275,277,278,279,280,281,282,283,286,287,289,292,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,361,362,365,366,368,370,377,379,388,395,400,402,403,405,412,416,420,422,423,425,433,434,437,438,439,440,441,443,445,446,447,448,449,451,452,456,457,458,459,460,462,464,466,467,468,469,471,472,476,478,480,481,482,483,484,485,491,493,494,495,496,510,512,516,518,519,520,521,523,524,526,527,529,530,531,533,534,542,543,553,554,555,557,559,564,568,572,578,579,580,581,582,583,584,587,589,590,593,594,595,597,599,600,601,602,603,607,608,609,611,613,614,616,617,620,621,622,623,625,626,627,647,648,651,659,660,666,668,670,672,673,674,675,676,677,678,679,680,692,693,694,695,697,701,703,705,708,709,710,712,713,714,718,719,722,724,725,727,728,729,732,733,735,737,741,743,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,205,-388,-382,-492,-349,-492,-359,-387,-226,-492,274,-492,-397,-395,-385,-325,-389,-492,-371,342,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,380,380,-105,205,414,205,421,424,-348,-370,-77,-78,-352,-143,414,-350,-129,-49,-50,-123,-330,-492,-492,-196,454,-313,-360,-131,-492,-412,461,-411,-83,-2,-1,-354,-103,470,-279,477,-492,-56,-55,-135,-356,-369,489,205,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,522,-408,-61,528,-435,-225,380,-99,-393,-374,556,-492,-106,-227,-421,205,570,-97,-381,489,-353,-144,-130,-351,-331,-124,-392,-38,584,-37,-75,589,-76,454,-111,-314,-361,-362,-132,-378,461,-93,-84,-355,-284,-104,-280,-125,-91,477,-7,-274,-8,-136,-358,-357,205,-379,-380,-337,-114,-492,-492,-492,619,-101,-21,522,-402,-492,528,-89,-401,-438,-436,-439,-348,-100,-281,-95,-13,619,556,-272,652,-98,-422,-328,-174,-109,-27,619,584,-197,589,-197,-112,-315,-312,-413,-94,-126,-278,-275,-92,-271,670,-68,-67,-9,-184,-10,676,-324,-102,-407,-62,-492,-90,-434,-437,-273,-96,570,-110,-492,670,-107,-185,-183,676,-25,619,-185,-492,-57,-409,-58,-284,-492,-420,-492,-198,-108,-492,-410,-440,-29,-441,-442,-30,728,-186,-492,-327,-326,-492,733,-197,737,-443,-197,741,-185,-185,-329,]),'PIPE':([1,9,17,20,21,30,32,33,35,48,55,60,64,71,73,81,87,88,92,99,105,117,121,123,126,128,143,144,145,147,149,150,152,165,166,167,168,169,170,171,172,173,174,175,176,177,179,181,182,183,184,185,187,188,189,190,191,192,193,194,195,196,197,198,199,226,230,231,232,233,241,243,249,261,262,263,268,269,270,272,280,281,282,283,286,343,344,345,346,347,348,357,359,360,384,386,387,388,389,390,393,394,395,423,433,434,437,438,441,457,458,459,460,466,467,483,484,485,493,494,523,529,544,545,546,548,550,551,640,],[-383,-492,-492,-384,-394,-390,-372,-386,-373,-388,-382,-492,242,-359,-387,-492,-492,-397,-395,-385,-389,-371,-121,-47,-363,-48,-70,-377,-141,-69,-405,-404,-396,-484,-490,-470,-477,-485,-480,-462,-483,-456,-459,-472,-465,-482,-478,-458,-474,392,-479,-486,-394,-475,-489,-463,-481,-460,-487,-473,-488,-461,-464,-476,-451,-370,-77,-78,-352,-143,242,-129,392,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-364,-365,-368,-367,-366,-122,-391,-403,-142,392,-471,-491,-393,-453,547,392,-452,-374,-381,-353,-144,-130,-351,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-402,-401,-466,-469,-467,-454,-468,-457,-455,]),'POW':([1,3,9,13,16,17,20,21,30,32,33,34,35,43,48,55,60,64,65,66,67,71,73,81,87,88,92,99,103,105,107,117,121,123,126,128,135,136,138,139,143,144,145,147,148,149,150,152,165,166,167,168,169,170,172,175,177,178,179,181,182,184,185,186,187,188,189,191,193,194,195,198,207,226,230,231,232,233,241,243,245,246,247,248,251,255,261,262,263,268,269,270,272,280,281,282,283,286,299,301,307,309,313,343,344,345,346,347,348,354,355,356,357,359,360,386,387,388,391,392,394,395,408,421,423,433,434,437,438,439,440,441,443,445,446,457,458,459,460,466,467,483,484,485,493,494,495,496,512,516,523,528,529,547,549,570,578,579,580,581,582,583,584,589,611,613,614,616,617,619,639,640,652,658,659,660,668,670,672,673,674,675,676,697,701,703,704,718,723,728,733,737,741,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,177,200,210,-388,-382,-492,-349,-492,177,254,-359,-387,-492,-492,-397,-395,-385,-325,-389,-492,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,369,-405,-404,-396,-484,-490,-470,-477,-485,-480,-483,-472,-482,177,-478,177,-474,-479,-486,177,-491,-475,-489,-481,-487,-473,-488,-476,-224,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-492,-196,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,514,-86,-333,-391,-403,-142,-471,-491,-393,177,-447,177,-374,369,210,-381,-353,-144,-130,-351,-331,-124,-392,-38,-492,-37,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-492,-492,-402,369,-401,-448,-449,210,-328,-174,-109,-27,-492,-28,-197,662,-9,-184,-10,-492,-324,-223,-450,177,210,696,-110,-492,-107,702,-183,-26,-25,-492,-185,-198,-108,-492,720,-186,254,734,739,742,745,]),'AT':([0,1,2,9,10,17,19,20,21,22,23,24,25,28,30,32,33,34,35,45,46,48,53,55,66,68,69,73,75,79,80,88,89,91,92,95,99,105,109,113,115,117,121,128,143,144,145,147,149,150,152,154,155,156,157,158,161,162,163,165,166,167,168,169,170,172,175,177,178,179,181,182,184,185,186,187,188,189,191,193,194,195,198,226,263,286,343,344,345,346,347,348,352,357,359,360,374,386,387,388,391,392,394,395,406,423,441,460,493,494,505,523,529,535,536,537,540,547,549,552,560,577,592,628,629,630,632,633,634,635,639,640,641,642,643,645,656,657,663,665,681,682,684,685,687,688,689,699,706,716,721,],[41,-383,41,122,-290,-492,-289,-384,-394,-293,-288,-294,-318,41,-390,-372,-386,184,-373,-286,-292,-388,-154,-382,184,-200,-287,-387,-151,-291,-153,-397,-164,-319,-395,-320,-385,-389,-201,-152,-201,-371,-121,122,-70,-377,-141,-69,-405,-404,-396,-169,-165,-168,-166,-167,-303,-172,-311,-484,-490,-470,-477,-485,-480,-483,-472,-482,184,-478,184,-474,-479,-486,184,-491,-475,-489,-481,-487,-473,-488,-476,-370,-492,-369,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,-321,-471,-491,-393,184,-447,184,-374,-162,-381,-392,-378,-379,-380,-207,-402,-401,41,-492,-308,-119,-448,-449,-492,-163,-299,-309,-202,41,-42,-492,-307,-41,-120,-450,184,-36,-115,-297,-35,-431,-300,-310,-171,-322,-203,-306,-304,-305,-116,-298,-301,-296,-302,-295,]),'LE':([1,9,17,20,21,30,32,33,35,48,55,60,64,71,73,81,87,88,92,99,105,107,117,121,123,126,128,143,144,145,147,149,150,152,226,230,231,232,233,241,243,261,262,263,268,269,270,272,280,281,282,283,286,309,313,343,344,345,346,347,348,357,359,360,388,395,423,433,434,437,438,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,534,],[-383,-492,-492,-384,-394,-390,-372,-386,-373,-388,-382,-492,-349,-359,-387,-492,-492,-397,-395,-385,-389,300,-371,-121,-47,-363,-48,-70,-377,-141,-69,-405,-404,-396,-370,-77,-78,-352,-143,-350,-129,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,300,-113,-364,-365,-368,-367,-366,-122,-391,-403,-142,-393,-374,-381,-353,-144,-130,-351,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,300,]),'MOD':([1,9,17,20,21,30,32,33,34,35,48,55,66,73,88,92,99,105,117,121,128,143,144,145,147,149,150,152,165,166,167,168,169,170,172,175,177,178,179,181,182,184,185,186,187,188,189,191,193,194,195,198,226,263,286,343,344,345,346,347,348,357,359,360,386,387,388,391,392,394,395,423,441,460,493,494,523,529,547,549,639,640,],[-383,125,-492,-384,-394,-390,-372,-386,172,-373,-388,-382,172,-387,-397,-395,-385,-389,-371,-121,125,-70,-377,-141,-69,-405,-404,-396,-484,-490,-470,-477,-485,-480,-483,-472,-482,172,-478,172,-474,-479,-486,172,-491,-475,-489,-481,-487,-473,-488,-476,-370,-492,-369,-364,-365,-368,-367,-366,-122,-391,-403,-142,-471,-491,-393,172,-447,172,-374,-381,-392,-378,-379,-380,-402,-401,-448,-449,-450,172,]),'NONE':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,34,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,66,68,69,70,71,73,75,76,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,165,166,167,168,169,170,172,175,177,178,179,180,181,182,184,185,186,187,188,189,191,193,194,195,198,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,386,387,388,391,392,394,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,547,549,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,639,640,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[33,-383,33,33,33,-492,-290,33,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,193,-373,33,-137,33,-286,-292,-388,33,-154,-382,33,33,-492,33,33,-349,193,-200,-287,33,-359,-387,-151,33,33,-291,-153,-492,-492,-397,33,-319,-395,33,-320,33,33,33,-385,33,-389,-201,33,-152,-201,-371,-138,33,-121,33,-47,33,33,-363,33,-48,33,33,33,-70,-377,-141,33,-69,33,-405,-404,33,-396,-169,-168,-166,-167,-303,-172,-311,33,-484,-490,-470,-477,-485,-480,-483,-472,-482,193,-478,33,193,-474,-479,-486,193,-491,-475,-489,-481,-487,-473,-488,-476,33,33,-224,33,-492,-348,-370,33,-77,-78,-352,-143,33,-350,33,-129,33,33,33,-360,-131,-492,-83,-2,-1,33,-354,33,-56,-55,-135,-356,33,33,-369,-342,33,-344,-339,-343,-338,-341,-346,-340,33,-242,-238,-233,33,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,33,33,-321,-471,-491,-393,193,-447,193,-374,33,33,33,33,33,33,-381,33,33,33,-353,-144,33,-130,-351,-392,33,33,33,33,33,-361,-362,-132,-378,33,33,-84,-355,33,-136,-358,-357,33,-379,-380,-345,-347,-207,33,33,33,-402,33,33,-401,33,33,-492,-308,33,-119,-448,-449,-492,33,33,-299,33,-309,33,33,-202,33,-42,-492,-307,-41,-120,33,33,-450,193,-36,-115,-297,33,-35,33,33,33,-431,-300,-310,33,-171,33,-322,-203,33,-306,-304,-305,-116,-298,-301,-296,33,33,-302,-295,33,]),'FALSE':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,34,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,66,68,69,70,71,73,75,76,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,165,166,167,168,169,170,172,175,177,178,179,180,181,182,184,185,186,187,188,189,191,193,194,195,198,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,386,387,388,391,392,394,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,547,549,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,639,640,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[48,-383,48,48,48,-492,-290,48,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,189,-373,48,-137,48,-286,-292,-388,48,-154,-382,48,48,-492,48,48,-349,189,-200,-287,48,-359,-387,-151,48,48,-291,-153,-492,-492,-397,48,-319,-395,48,-320,48,48,48,-385,48,-389,-201,48,-152,-201,-371,-138,48,-121,48,-47,48,48,-363,48,-48,48,48,48,-70,-377,-141,48,-69,48,-405,-404,48,-396,-169,-168,-166,-167,-303,-172,-311,48,-484,-490,-470,-477,-485,-480,-483,-472,-482,189,-478,48,189,-474,-479,-486,189,-491,-475,-489,-481,-487,-473,-488,-476,48,48,-224,48,-492,-348,-370,48,-77,-78,-352,-143,48,-350,48,-129,48,48,48,-360,-131,-492,-83,-2,-1,48,-354,48,-56,-55,-135,-356,48,48,-369,-342,48,-344,-339,-343,-338,-341,-346,-340,48,-242,-238,-233,48,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,48,48,-321,-471,-491,-393,189,-447,189,-374,48,48,48,48,48,48,-381,48,48,48,-353,-144,48,-130,-351,-392,48,48,48,48,48,-361,-362,-132,-378,48,48,-84,-355,48,-136,-358,-357,48,-379,-380,-345,-347,-207,48,48,48,-402,48,48,-401,48,48,-492,-308,48,-119,-448,-449,-492,48,48,-299,48,-309,48,48,-202,48,-42,-492,-307,-41,-120,48,48,-450,189,-36,-115,-297,48,-35,48,48,48,-431,-300,-310,48,-171,48,-322,-203,48,-306,-304,-305,-116,-298,-301,-296,48,48,-302,-295,48,]),'FROM':([0,1,2,3,9,10,13,16,17,19,20,21,22,23,24,25,30,32,33,35,45,46,48,53,55,60,63,64,65,68,69,71,73,75,79,80,81,87,88,91,92,95,99,103,105,107,109,113,115,117,121,123,126,128,131,135,136,138,139,143,144,145,147,149,150,151,152,154,156,157,158,161,162,163,226,227,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,299,301,307,309,313,343,344,345,346,347,348,352,355,356,357,359,360,374,388,395,396,423,433,434,435,437,438,439,440,441,453,457,458,459,460,466,467,483,484,485,493,494,495,496,505,523,529,535,536,537,540,552,576,577,578,591,592,605,617,628,629,630,632,633,634,635,636,638,641,642,643,645,656,657,663,664,665,681,682,683,684,685,687,688,689,699,706,707,716,721,],[49,-383,49,-335,-492,-290,-492,-323,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,-373,-286,-292,-388,-154,-382,-492,238,-349,-492,-200,-287,-359,-387,-151,-291,-153,-492,-492,-397,-319,-395,-320,-385,-325,-389,-492,-201,-152,-201,-371,-121,-47,-363,-48,49,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,49,-396,-169,-168,-166,-167,-303,-172,-311,-370,429,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-208,-86,-333,-391,-403,-142,-321,-393,-374,49,-381,-353,-144,49,-130,-351,-331,-124,-392,49,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-207,-402,-401,49,-492,-308,-119,-492,49,-299,-328,49,-309,49,-324,-202,49,-42,-492,-307,-41,-120,49,49,-36,-115,-297,-35,-431,-300,-310,49,-171,-322,-203,49,-306,-304,-305,-116,-298,-301,-296,49,-302,-295,]),'TIMES':([0,1,2,3,8,9,10,13,16,17,19,20,21,22,23,24,25,30,32,33,34,35,37,43,45,46,47,48,53,55,60,64,65,66,67,68,69,71,73,75,78,79,80,81,85,87,88,91,92,95,96,97,98,99,103,105,107,109,113,114,115,117,118,121,123,126,128,131,135,136,138,139,143,144,145,147,148,149,150,151,152,154,156,157,158,161,162,163,165,166,167,168,169,170,172,175,177,178,179,181,182,184,185,186,187,188,189,191,193,194,195,198,202,205,207,226,230,231,232,233,241,243,245,246,247,248,251,255,261,262,263,268,269,270,272,274,280,281,282,283,286,299,301,307,309,313,342,343,344,345,346,347,348,352,354,355,356,357,359,360,374,386,387,388,391,392,394,395,396,408,417,423,433,434,435,437,438,439,440,441,443,445,446,453,457,458,459,460,461,466,467,483,484,485,493,494,495,496,505,512,516,523,528,529,535,536,537,540,547,549,552,576,577,578,579,580,581,582,583,584,591,592,605,611,613,614,616,617,619,628,629,630,632,633,634,635,636,638,639,640,641,642,643,645,656,657,658,659,660,663,664,665,668,672,673,674,675,676,681,682,683,684,685,687,688,689,697,699,701,703,704,706,707,716,718,721,723,],[50,-383,50,-335,-60,120,-290,-492,-323,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,191,-373,-137,50,-286,-292,50,-388,-154,-382,-492,-349,-492,191,253,-200,-287,-359,-387,-151,50,-291,-153,-492,-59,-492,-397,-319,-395,-320,50,50,50,-385,-325,-389,-492,-201,-152,-59,-201,-371,-138,-121,-47,-363,120,50,-3,-4,-332,-85,-70,-377,-141,-69,372,-405,-404,50,-396,-169,-168,-166,-167,-303,-172,-311,-484,-490,-470,-477,-485,-480,-483,-472,-482,191,-478,191,-474,-479,-486,191,-491,-475,-489,-481,-487,-473,-488,-476,398,50,-224,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-492,-196,-360,-131,-492,-83,-2,-1,-354,-222,-56,-55,-135,-356,-369,-334,-336,-31,-32,-113,-222,-364,-365,-368,-367,-366,-122,-208,510,-86,-333,-391,-403,-142,-321,-471,-491,-393,191,-447,191,-374,50,372,50,-381,-353,-144,50,-130,-351,-331,-124,-392,-38,-492,-37,50,-361,-362,-132,-378,50,-84,-355,-136,-358,-357,-379,-380,-337,-114,-207,-492,-492,-402,372,-401,50,-492,-308,-119,-448,-449,-492,50,-299,-328,-174,-109,-27,-492,-28,-197,50,-309,50,-9,-184,-10,-492,-324,-223,-202,50,-42,-492,-307,-41,-120,50,50,-450,191,-36,-115,-297,-35,-431,-300,695,-110,-492,-310,50,-171,-107,-183,-26,-25,-492,-185,-322,-203,50,-306,-304,-305,-116,-298,-198,-301,-108,-492,719,-296,50,-302,-186,-295,253,]),'FINALLY':([352,374,376,505,536,540,632,635,681,685,706,],[-208,-321,541,-207,541,-119,541,-120,-322,-304,-296,]),'RSHIFT':([1,9,17,20,21,30,32,33,34,35,48,55,66,71,73,87,88,92,99,105,117,121,123,126,128,143,144,145,147,149,150,152,178,186,226,261,262,263,280,282,286,343,344,345,346,347,348,357,359,360,388,391,392,394,395,423,441,457,458,459,460,483,484,485,493,494,523,529,547,549,639,640,],[-383,-492,-492,-384,-394,-390,-372,-386,197,-373,-388,-382,197,-359,-387,284,-397,-395,-385,-389,-371,-121,-47,-363,-48,-70,-377,-141,-69,-405,-404,-396,197,197,-370,-360,-131,-492,284,-135,-369,-364,-365,-368,-367,-366,-122,-391,-403,-142,-393,197,-447,197,-374,-381,-392,-361,-362,-132,-378,-136,-358,-357,-379,-380,-402,-401,-448,-449,-450,197,]),'CONTINUE':([0,2,10,19,22,23,24,25,45,46,53,68,69,75,79,80,91,95,109,113,115,131,151,154,156,157,158,161,162,163,352,374,396,435,453,505,535,536,537,540,552,576,577,591,592,605,628,629,630,632,633,634,635,636,638,641,642,643,645,656,657,663,664,665,681,682,683,684,685,687,688,689,699,706,707,716,721,],[27,27,-290,-289,-293,-288,-294,-318,-286,-292,-154,-200,-287,-151,-291,-153,-319,-320,-201,-152,-201,27,27,-169,-168,-166,-167,-303,-172,-311,-208,-321,27,27,27,-207,27,-492,-308,-119,-492,27,-299,27,-309,27,-202,27,-42,-492,-307,-41,-120,27,27,-36,-115,-297,-35,-431,-300,-310,27,-171,-322,-203,27,-306,-304,-305,-116,-298,-301,-296,27,-302,-295,]),'MINUS':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,34,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,66,68,69,70,71,73,75,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,165,166,167,168,169,170,172,175,177,178,179,180,181,182,184,185,186,187,188,189,191,193,194,195,198,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,386,387,388,391,392,394,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,547,549,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,639,640,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[56,-383,56,56,56,-492,-290,56,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,198,-373,56,-137,56,-286,-292,-388,56,-154,-382,56,56,-492,56,56,-349,198,-200,-287,56,260,-387,-151,56,-291,-153,-492,-492,-397,56,-319,-395,56,-320,56,56,56,-385,56,-389,-201,56,-152,-201,-371,-138,56,-121,56,-47,56,56,-363,56,-48,56,56,56,-70,-377,-141,56,-69,56,-405,-404,56,-396,-169,-168,-166,-167,-303,-172,-311,56,-484,-490,-470,-477,-485,-480,-483,-472,-482,198,-478,56,198,-474,-479,-486,198,-491,-475,-489,-481,-487,-473,-488,-476,56,56,-224,56,-492,-348,-370,56,-77,-78,-352,-143,56,-350,56,-129,56,56,56,260,-131,-492,-83,-2,-1,56,-354,56,-56,-55,-135,-356,56,56,-369,-342,56,-344,-339,-343,-338,-341,-346,-340,56,-242,-238,-233,56,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,56,56,-321,-471,-491,-393,198,-447,198,-374,56,56,56,56,56,56,-381,56,56,56,-353,-144,56,-130,-351,-392,56,56,56,56,56,-361,-362,-132,-378,56,56,-84,-355,56,-136,-358,-357,56,-379,-380,-345,-347,-207,56,56,56,-402,56,56,-401,56,56,-492,-308,56,-119,-448,-449,-492,56,56,-299,56,-309,56,56,-202,56,-42,-492,-307,-41,-120,56,56,-450,198,-36,-115,-297,56,-35,56,56,56,-431,-300,-310,56,-171,56,-322,-203,56,-306,-304,-305,-116,-298,-301,-296,56,56,-302,-295,56,]),'RAISE':([0,2,10,19,22,23,24,25,45,46,53,68,69,75,79,80,91,95,109,113,115,131,151,154,156,157,158,161,162,163,352,374,396,435,453,505,535,536,537,540,552,576,577,591,592,605,628,629,630,632,633,634,635,636,638,641,642,643,645,656,657,663,664,665,681,682,683,684,685,687,688,689,699,706,707,716,721,],[57,57,-290,-289,-293,-288,-294,-318,-286,-292,-154,-200,-287,-151,-291,-153,-319,-320,-201,-152,-201,57,57,-169,-168,-166,-167,-303,-172,-311,-208,-321,57,57,57,-207,57,-492,-308,-119,-492,57,-299,57,-309,57,-202,57,-42,-492,-307,-41,-120,57,57,-36,-115,-297,-35,-431,-300,-310,57,-171,-322,-203,57,-306,-304,-305,-116,-298,-301,-296,57,-302,-295,]),'DOUBLEDIVEQUAL':([1,3,9,13,16,17,20,21,30,32,33,35,40,48,55,60,64,65,71,73,77,81,84,87,88,92,99,103,105,107,108,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,203,204,205,206,207,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,292,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,403,404,405,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,578,617,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-492,-388,-382,-492,-349,-492,-359,-387,-226,-492,-225,-492,-397,-395,-385,-325,-389,-492,315,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-105,-492,-223,-229,-224,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,-106,-228,-227,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,-328,-324,]),'AT_LPAREN':([34,66,178,186,391,392,394,547,549,639,640,],[164,164,164,164,164,-447,164,-448,-449,-450,164,]),'RBRACE':([1,3,9,13,16,17,20,21,30,32,33,35,43,48,55,60,64,65,71,73,77,81,87,88,92,99,103,105,107,117,121,123,126,128,135,136,138,139,140,143,144,145,147,149,150,152,203,205,207,211,212,213,215,216,217,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,273,275,280,281,282,283,286,292,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,385,388,395,403,405,412,414,415,416,418,419,420,422,423,433,434,437,438,439,440,441,457,458,459,460,466,467,468,469,470,483,484,485,493,494,495,496,523,529,564,565,566,568,569,570,572,578,617,651,652,691,692,693,694,708,709,710,712,713,722,724,725,732,743,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-492,-388,-382,-492,-349,-492,-359,-387,-226,-492,-492,-397,-395,-385,-325,-389,-492,-371,-121,-47,-363,-48,-3,-4,-332,-85,357,-70,-377,-141,-69,-405,-404,-396,-105,-223,-224,-34,-225,-492,-33,423,-425,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-103,-417,-56,-55,-135,-356,-369,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,546,-393,-374,-106,-227,-421,-418,-424,-492,-426,-423,-492,-97,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-284,-104,-416,-136,-358,-357,-379,-380,-337,-114,-402,-401,-419,-428,-427,-98,-429,-223,-422,-328,-324,-492,-418,-430,-284,-492,-420,-440,-29,-441,-442,-30,-327,-326,-492,-443,-329,]),'CLASS':([0,2,10,19,22,23,24,25,28,45,46,53,68,69,75,79,80,89,91,95,109,113,115,154,155,156,157,158,161,162,163,352,374,406,505,535,536,537,540,552,560,577,592,628,629,630,632,633,634,635,641,642,643,645,656,657,663,665,681,682,684,685,687,688,689,699,706,716,721,],[59,59,-290,-289,-293,-288,-294,-318,59,-286,-292,-154,-200,-287,-151,-291,-153,-164,-319,-320,-201,-152,-201,-169,-165,-168,-166,-167,-303,-172,-311,-208,-321,-162,-207,59,-492,-308,-119,-492,-163,-299,-309,-202,59,-42,-492,-307,-41,-120,-36,-115,-297,-35,-431,-300,-310,-171,-322,-203,-306,-304,-305,-116,-298,-301,-296,-302,-295,]),'IOREDIRECT':([34,66,178,186,391,392,394,547,549,639,640,],[176,176,176,176,176,-447,176,-448,-449,-450,176,]),'AMPERSAND':([1,9,17,20,21,30,32,33,35,48,55,71,73,81,87,88,92,99,105,117,121,123,126,128,143,144,145,147,149,150,152,165,166,167,168,169,170,171,172,173,174,175,176,177,179,181,182,183,184,185,187,188,189,190,191,192,193,194,195,196,197,198,199,226,249,261,262,263,268,269,280,281,282,283,286,343,344,345,346,347,348,357,359,360,384,386,387,388,389,393,394,395,423,441,457,458,459,460,466,467,483,484,485,493,494,523,529,544,545,546,548,550,551,640,],[-383,-492,-492,-384,-394,-390,-372,-386,-373,-388,-382,-359,-387,271,-492,-397,-395,-385,-389,-371,-121,-47,-363,-48,-70,-377,-141,-69,-405,-404,-396,-484,-490,-470,-477,-485,-480,-462,-483,-456,-459,-472,-465,-482,-478,-458,-474,389,-479,-486,-394,-475,-489,-463,-481,-460,-487,-473,-488,-461,-464,-476,-451,-370,389,-360,-131,-492,-83,271,-56,-55,-135,-356,-369,-364,-365,-368,-367,-366,-122,-391,-403,-142,389,-471,-491,-393,-453,389,-452,-374,-381,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-402,-401,-466,-469,-467,-454,-468,-457,-455,]),'WHILE':([0,2,10,19,22,23,24,25,45,46,53,68,69,75,79,80,91,95,109,113,115,154,156,157,158,161,162,163,352,374,505,535,536,537,540,552,577,592,628,629,630,632,633,634,635,641,642,643,645,656,657,663,665,681,682,684,685,687,688,689,699,706,716,721,],[61,61,-290,-289,-293,-288,-294,-318,-286,-292,-154,-200,-287,-151,-291,-153,-319,-320,-201,-152,-201,-169,-168,-166,-167,-303,-172,-311,-208,-321,-207,61,-492,-308,-119,-492,-299,-309,-202,61,-42,-492,-307,-41,-120,-36,-115,-297,-35,-431,-300,-310,-171,-322,-203,-306,-304,-305,-116,-298,-301,-296,-302,-295,]),'LAMBDA':([0,1,2,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,35,36,37,43,45,46,48,53,55,57,60,61,63,64,68,69,70,71,73,75,79,80,81,87,88,91,92,94,95,96,98,99,105,109,110,113,115,117,118,121,123,126,128,131,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,180,205,207,218,225,226,230,231,232,233,238,241,243,261,262,263,268,269,270,272,274,280,281,282,283,286,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,388,395,396,408,413,414,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,457,458,459,460,465,466,467,470,483,484,485,489,493,494,505,508,517,522,523,524,528,529,532,535,536,537,539,540,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,641,642,643,644,645,652,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[67,-383,67,67,-492,-290,67,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,-373,67,-137,67,-286,-292,-388,-154,-382,67,-492,67,67,-349,-200,-287,67,-359,-387,-151,-291,-153,-492,-492,-397,-319,-395,67,-320,67,67,-385,-389,-201,67,-152,-201,-371,-138,-121,-47,-363,-48,67,-70,-377,-141,67,-69,67,-405,-404,67,-396,-169,-168,-166,-167,-303,-172,-311,67,67,67,-224,-492,-348,-370,-77,-78,-352,-143,67,-350,-129,-360,-131,-492,-83,-2,-1,-354,67,-56,-55,-135,-356,-369,67,-242,-238,-233,67,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,67,67,-321,-393,-374,67,67,67,67,67,-381,67,67,67,-353,-144,67,-130,-351,-392,67,67,67,67,-361,-362,-132,-378,67,-84,-355,67,-136,-358,-357,67,-379,-380,-207,67,67,67,-402,67,67,-401,67,67,-492,-308,67,-119,-492,67,67,-299,67,-309,67,67,-202,67,-42,-492,-307,-41,-120,67,67,-36,-115,-297,67,-35,67,67,-431,-300,-310,67,-171,67,-322,-203,67,-306,-304,-305,-116,-298,-301,-296,67,723,-302,-295,723,]),'COLON':([1,3,9,13,16,17,18,20,21,30,32,33,34,35,48,55,60,64,65,66,67,71,73,81,87,88,92,99,103,105,107,117,121,123,126,128,135,136,138,139,143,144,145,146,147,149,150,152,165,166,167,168,169,170,172,175,177,178,179,181,182,184,185,186,187,188,189,191,193,194,195,198,201,207,212,226,228,230,231,232,233,234,236,241,243,245,246,247,248,250,251,252,253,255,256,257,258,261,262,263,268,269,270,272,273,275,280,281,282,283,286,299,301,307,309,313,343,344,345,346,347,348,353,355,356,357,359,360,362,364,365,386,387,388,391,392,394,395,414,423,430,431,432,433,434,437,438,439,440,441,443,445,446,447,448,449,450,451,452,456,457,458,459,460,466,467,468,469,470,480,482,483,484,485,493,494,495,496,506,507,509,512,522,523,524,529,538,539,541,547,549,571,578,579,580,581,582,583,584,585,586,587,588,589,590,593,594,598,603,606,610,617,619,622,623,631,637,639,640,650,658,659,660,661,686,690,692,695,697,698,714,715,723,726,727,728,731,733,740,744,],[-383,-335,-492,-492,-323,-492,151,-384,-394,-390,-372,-386,179,-373,-388,-382,-492,-349,-492,179,-492,-359,-387,-492,-492,-397,-395,-385,-325,-389,-492,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-492,-69,-405,-404,-396,-484,-490,-470,-477,-485,-480,-483,-472,-482,179,-478,179,-474,-479,-486,179,-491,-475,-489,-481,-487,-473,-488,-476,396,-224,413,-370,-492,-77,-78,-352,-143,435,-419,-350,-129,-49,-50,-123,-330,442,-492,-74,-492,-196,-73,453,-313,-360,-131,-492,-83,-2,-1,-354,-103,-417,-56,-55,-135,-356,-369,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-492,-86,-333,-391,-403,-142,-62,524,-61,-471,-491,-393,179,-447,179,-374,-418,-381,576,-44,-43,-353,-144,-130,-351,-331,-124,-392,-38,-492,-37,-75,-492,-76,-195,591,-111,-314,-361,-362,-132,-378,-84,-355,-284,-104,-416,-7,-8,-136,-358,-357,-379,-380,-337,-114,-54,605,-53,612,-492,-402,-492,-401,636,-316,638,-448,-449,654,-328,-174,-109,-27,-492,-28,-197,-19,-194,-492,-20,-197,-112,-315,-312,664,-271,-170,-173,-324,-223,-62,677,683,-492,-450,179,-158,-188,-110,-492,-193,-317,707,654,-492,-198,-199,-492,-192,-492,-190,-28,-197,738,-197,-189,-191,]),'NUMBER':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,34,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,66,68,69,70,71,73,75,76,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,165,166,167,168,169,170,172,175,177,178,179,180,181,182,184,185,186,187,188,189,191,193,194,195,198,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,386,387,388,391,392,394,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,547,549,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,639,640,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[88,-383,88,88,88,-492,-290,88,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,166,-373,88,-137,88,-286,-292,-388,88,-154,-382,88,88,-492,88,88,-349,166,-200,-287,88,-359,-387,-151,88,88,-291,-153,-492,-492,-397,88,-319,-395,88,-320,88,88,88,-385,88,-389,-201,88,-152,-201,-371,-138,88,-121,88,-47,88,88,-363,88,-48,88,88,88,-70,-377,-141,88,-69,88,-405,-404,88,-396,-169,-168,-166,-167,-303,-172,-311,88,-484,-490,-470,-477,-485,-480,-483,-472,-482,166,-478,88,166,-474,-479,-486,166,-491,-475,-489,-481,-487,-473,-488,-476,88,88,-224,88,-492,-348,-370,88,-77,-78,-352,-143,88,-350,88,-129,88,88,88,-360,-131,-492,-83,-2,-1,88,-354,88,-56,-55,-135,-356,88,88,-369,-342,88,-344,-339,-343,-338,-341,-346,-340,88,-242,-238,-233,88,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,88,88,-321,-471,-491,-393,166,-447,166,-374,88,88,88,88,88,88,-381,88,88,88,-353,-144,88,-130,-351,-392,88,88,88,88,88,-361,-362,-132,-378,88,88,-84,-355,88,-136,-358,-357,88,-379,-380,-345,-347,-207,88,88,88,-402,88,88,-401,88,88,-492,-308,88,-119,-448,-449,-492,88,88,-299,88,-309,88,88,-202,88,-42,-492,-307,-41,-120,88,88,-450,166,-36,-115,-297,88,-35,88,88,88,-431,-300,-310,88,-171,88,-322,-203,88,-306,-304,-305,-116,-298,-301,-296,88,88,-302,-295,88,]),'NAME':([0,1,2,6,8,9,10,12,15,17,19,20,21,22,23,24,25,26,29,30,32,33,34,35,36,37,41,43,45,46,48,49,50,53,55,56,57,59,60,61,63,64,66,67,68,69,70,71,73,75,76,78,79,80,81,86,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,142,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,165,166,167,168,169,170,172,175,177,178,179,180,181,182,184,185,186,187,188,189,191,193,194,195,198,200,202,205,207,210,218,219,220,221,222,223,224,225,226,229,230,231,232,233,238,241,242,243,244,253,254,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,354,357,359,360,369,372,374,380,386,387,388,391,392,394,395,396,401,408,410,413,414,417,421,423,424,426,428,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,473,477,479,483,484,485,489,493,494,497,498,505,508,510,514,517,522,523,524,528,529,532,535,536,537,539,540,547,549,552,556,570,576,577,584,589,591,592,605,612,628,629,630,632,633,634,635,636,638,639,640,641,642,643,644,645,652,653,654,656,657,662,663,664,665,670,676,677,681,682,683,684,685,687,688,689,695,696,699,702,706,707,711,716,719,720,721,723,728,733,734,737,738,739,741,742,745,],[55,-383,55,55,55,-492,-290,134,55,-492,-289,-384,-394,-293,-288,-294,-318,153,160,-390,-372,-386,175,-373,55,-137,209,55,-286,-292,-388,-492,55,-154,-382,55,55,228,-492,55,55,-349,175,255,-200,-287,55,-359,-387,-151,55,55,-291,-153,-492,277,-492,-397,55,-319,-395,55,-320,55,55,55,-385,55,-389,-201,55,-152,-201,-371,-138,55,-121,55,-47,55,55,-363,55,-48,55,55,55,359,-70,-377,-141,55,-69,55,-405,-404,55,-396,-169,-168,-166,-167,-303,-172,-311,55,-484,-490,-470,-477,-485,-480,-483,-472,-482,175,-478,55,175,-474,-479,-486,175,-491,-475,-489,-481,-487,-473,-488,-476,55,402,55,-224,55,-492,-269,-51,277,-127,-270,-52,-348,-370,55,-77,-78,-352,-143,55,-350,55,-129,55,255,255,55,55,-360,-131,-492,-83,-2,-1,55,-354,55,-56,-55,-135,-356,55,55,-369,-342,55,-344,-339,-343,-338,-341,-346,-340,55,-242,-238,-233,55,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,512,-391,-403,-142,55,55,-321,543,-471,-491,-393,175,-447,175,-374,55,402,55,563,55,55,55,55,-381,55,55,-128,55,-353,-144,55,-130,-351,-392,55,55,55,55,55,-361,-362,-132,-378,55,55,-84,-355,55,600,277,603,-136,-358,-357,55,-379,-380,-345,-347,-207,55,512,512,55,55,-402,55,55,-401,55,55,-492,-308,55,-119,-448,-449,-492,402,55,55,-299,255,255,55,-309,55,55,-202,55,-42,-492,-307,-41,-120,55,55,-450,175,-36,-115,-297,55,-35,55,55,55,-431,-300,255,-310,55,-171,512,512,55,-322,-203,55,-306,-304,-305,-116,-298,255,255,-301,512,-296,55,55,-302,512,512,-295,255,255,255,255,512,55,255,512,255,512,]),'AND':([1,3,9,13,17,20,21,30,32,33,35,48,55,60,64,71,73,81,87,88,92,99,105,107,117,121,123,126,128,136,139,143,144,145,147,149,150,152,226,230,231,232,233,241,243,261,262,263,268,269,270,272,280,281,282,283,286,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,423,433,434,437,438,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,534,],[-383,-335,-492,137,-492,-384,-394,-390,-372,-386,-373,-388,-382,-492,-349,-359,-387,-492,-492,-397,-395,-385,-389,-492,-371,-121,-47,-363,-48,137,-85,-70,-377,-141,-69,-405,-404,-396,-370,-77,-78,-352,-143,-350,-129,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,-381,-353,-144,-130,-351,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,-492,]),'DOLLAR_LBRACKET':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,34,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,66,68,69,70,71,73,75,76,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,178,180,186,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,388,391,392,394,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,547,549,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,639,640,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[34,-383,34,34,34,-492,-290,34,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,178,-373,34,-137,34,-286,-292,-388,34,-154,-382,34,34,-492,34,34,-349,178,-200,-287,34,-359,-387,-151,34,34,-291,-153,-492,-492,-397,34,-319,-395,34,-320,34,34,34,-385,34,-389,-201,34,-152,-201,-371,-138,34,-121,34,-47,34,34,-363,34,-48,34,34,34,-70,-377,-141,34,-69,34,-405,-404,34,-396,-169,-168,-166,-167,-303,-172,-311,34,178,34,178,34,34,-224,34,-492,-348,-370,34,-77,-78,-352,-143,34,-350,34,-129,34,34,34,-360,-131,-492,-83,-2,-1,34,-354,34,-56,-55,-135,-356,34,34,-369,-342,34,-344,-339,-343,-338,-341,-346,-340,34,-242,-238,-233,34,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,34,34,-321,-393,178,-447,178,-374,34,34,34,34,34,34,-381,34,34,34,-353,-144,34,-130,-351,-392,34,34,34,34,34,-361,-362,-132,-378,34,34,-84,-355,34,-136,-358,-357,34,-379,-380,-345,-347,-207,34,34,34,-402,34,34,-401,34,34,-492,-308,34,-119,-448,-449,-492,34,34,-299,34,-309,34,34,-202,34,-42,-492,-307,-41,-120,34,34,-450,178,-36,-115,-297,34,-35,34,34,34,-431,-300,-310,34,-171,34,-322,-203,34,-306,-304,-305,-116,-298,-301,-296,34,34,-302,-295,34,]),'DOUBLE_QUESTION':([1,17,20,21,30,33,48,55,73,88,92,99,105,143,145,149,150,152,263,357,359,360,388,423,441,493,494,523,529,],[-383,150,-384,-394,-390,-386,-388,-382,-387,-397,-395,-385,-389,150,-141,-405,-404,-396,150,-391,-403,-142,-393,-381,-392,-379,-380,-402,-401,]),'ATEQUAL':([1,3,9,13,16,17,20,21,30,32,33,35,40,48,55,60,64,65,71,73,77,81,84,87,88,92,99,103,105,107,108,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,203,204,205,206,207,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,292,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,403,404,405,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,578,617,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-492,-388,-382,-492,-349,-492,-359,-387,-226,-492,-225,-492,-397,-395,-385,-325,-389,-492,319,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-105,-492,-223,-229,-224,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,-106,-228,-227,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,-328,-324,]),'FOR':([0,1,2,3,9,10,13,16,17,19,20,21,22,23,24,25,30,31,32,33,35,45,46,48,53,55,60,64,65,68,69,71,73,75,77,79,80,81,87,88,91,92,95,99,103,105,107,109,113,115,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,154,156,157,158,161,162,163,212,213,214,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,289,292,299,301,307,309,313,343,344,345,346,347,348,352,355,356,357,359,360,370,374,388,395,412,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,505,523,529,535,536,537,540,552,564,577,578,592,617,628,629,630,632,633,634,635,641,642,643,645,656,657,663,665,681,682,684,685,687,688,689,693,699,706,716,721,722,724,725,743,],[78,-383,78,-335,-492,-290,-492,-323,-492,-289,-384,-394,-293,-288,-294,-318,-390,78,-372,-386,-373,-286,-292,-388,-154,-382,-492,-349,-492,-200,-287,-359,-387,-151,-226,-291,-153,-492,-492,-397,-319,-395,-320,-385,-325,-389,-492,-201,-152,-201,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-169,-168,-166,-167,-303,-172,-311,-225,417,417,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,417,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-208,-86,-333,-391,-403,-142,417,-321,-393,-374,-421,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-207,-402,-401,78,-492,-308,-119,-492,-420,-299,-328,-309,-324,-202,78,-42,-492,-307,-41,-120,-36,-115,-297,-35,-431,-300,-310,-171,-322,-203,-306,-304,-305,-116,-298,417,-301,-296,-302,-295,-327,-326,417,-329,]),'DEDENT':([10,19,22,23,24,25,45,46,68,69,79,91,95,115,154,156,157,158,161,162,163,352,374,505,536,537,540,552,577,592,628,629,630,632,633,634,635,641,642,643,645,656,657,663,665,681,682,684,685,687,688,689,699,706,716,721,],[-290,-289,-293,-288,-294,-318,-286,-292,-200,-287,-291,-319,-320,-201,-169,-168,-166,-167,-303,-172,-311,-208,-321,-207,-492,-308,-119,-492,-299,-309,-202,681,-42,-492,-307,-41,-120,-36,-115,-297,-35,-431,-300,-310,-171,-322,-203,-306,-304,-305,-116,-298,-301,-296,-302,-295,]),'NEWLINE':([0,1,2,3,4,5,7,9,10,11,13,14,16,17,19,20,21,22,23,24,25,27,30,32,33,35,39,40,42,44,45,46,48,51,52,53,55,57,58,60,62,63,64,65,68,69,71,72,73,74,75,77,79,80,81,82,84,87,88,91,92,95,99,100,102,103,104,105,106,107,108,109,110,111,113,115,116,117,121,123,126,128,129,130,131,132,133,135,136,138,139,143,144,145,147,149,150,151,152,153,154,156,157,158,160,161,162,163,203,204,205,206,207,208,209,225,226,227,230,231,232,233,235,236,237,239,240,241,243,245,246,247,248,261,262,263,264,265,267,268,269,270,272,273,274,275,276,277,278,279,280,281,282,283,286,287,292,295,299,301,307,309,313,316,318,322,332,334,335,336,338,339,340,341,343,344,345,346,347,348,349,350,351,352,355,356,357,359,360,374,377,378,379,381,382,388,395,396,397,398,399,400,402,403,404,405,407,409,411,414,423,433,434,435,436,437,438,439,440,441,453,457,458,459,460,461,462,463,464,466,467,468,469,470,471,472,474,475,476,478,480,481,482,483,484,485,486,487,488,493,494,495,496,499,500,501,502,503,504,505,523,529,536,537,540,542,543,552,553,554,555,557,559,562,563,573,575,576,577,578,591,592,595,596,597,599,600,601,602,603,605,617,619,630,632,633,634,635,636,638,641,642,643,645,646,647,648,649,650,655,656,657,663,664,665,681,683,684,685,687,688,689,699,706,707,716,721,],[80,-383,80,-335,-247,-216,-210,-492,-290,-492,-492,-213,-323,-492,-289,-384,-394,-293,-288,-294,-318,-254,-390,-372,-386,-373,-209,-492,-249,-251,-286,-292,-388,-214,-212,-154,-382,-257,-252,-492,-215,-492,-349,-492,-200,-287,-359,-248,-387,-211,-151,-226,-291,-153,-492,-260,-225,-492,-397,-319,-395,-320,-385,-253,-261,-325,-250,-389,-256,-492,-492,333,-492,339,-152,-201,-492,-371,-121,-47,-363,-48,-133,-205,-204,-492,352,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,375,-396,-492,-169,-168,-166,-167,-492,-303,-172,-311,-105,-492,-223,-229,-224,406,-160,-348,-370,-258,-77,-78,-352,-143,-80,-419,-79,-444,-446,-350,-129,-49,-50,-123,-330,-360,-131,-492,-412,-492,-411,-83,-2,-1,-354,-103,-418,-417,-262,-279,-492,-492,-56,-55,-135,-356,-369,-492,-225,-246,-334,-336,-31,-32,-113,-117,-40,-218,-39,-255,-65,-66,-39,-155,504,-219,-364,-365,-368,-367,-366,-122,-206,-134,505,-208,-86,-333,-391,-403,-142,-321,-16,-283,-99,-15,-282,-393,-374,375,-268,-265,-267,-492,-492,-106,-228,-227,560,-161,-87,-418,-381,-353,-144,375,-445,-130,-351,-331,-124,-392,375,-361,-362,-132,-378,-223,-492,-415,-93,-84,-355,-284,-104,-416,-280,-125,-277,-11,-91,-12,-7,-274,-8,-136,-358,-357,-23,-285,-24,-379,-380,-337,-114,-243,-245,-244,-118,-217,-156,-207,-402,-401,-492,-308,-119,-100,-281,-492,-95,-13,-492,-14,-272,-88,-159,-220,-259,375,-299,-328,375,-309,-413,-414,-94,-126,-278,-275,-92,-271,375,-324,-223,-42,-492,-307,-41,-120,375,375,-36,-115,-297,-35,-276,-273,-96,-266,-158,-221,-431,-300,-310,375,-171,-322,375,-306,-304,-305,-116,-298,-301,-296,375,-302,-295,]),'LT':([1,9,17,20,21,30,32,33,34,35,48,55,60,64,66,71,73,81,87,88,92,99,105,107,117,121,123,126,128,143,144,145,147,149,150,152,178,186,226,230,231,232,233,241,243,261,262,263,268,269,270,272,280,281,282,283,286,309,313,343,344,345,346,347,348,357,359,360,388,391,392,394,395,423,433,434,437,438,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,534,547,549,639,640,],[-383,-492,-492,-384,-394,-390,-372,-386,190,-373,-388,-382,-492,-349,190,-359,-387,-492,-492,-397,-395,-385,-389,306,-371,-121,-47,-363,-48,-70,-377,-141,-69,-405,-404,-396,190,190,-370,-77,-78,-352,-143,-350,-129,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,306,-113,-364,-365,-368,-367,-366,-122,-391,-403,-142,-393,190,-447,190,-374,-381,-353,-144,-130,-351,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,306,-448,-449,-450,190,]),'PLUSEQUAL':([1,3,9,13,16,17,20,21,30,32,33,35,40,48,55,60,64,65,71,73,77,81,84,87,88,92,99,103,105,107,108,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,203,204,205,206,207,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,292,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,403,404,405,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,578,617,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-492,-388,-382,-492,-349,-492,-359,-387,-226,-492,-225,-492,-397,-395,-385,-325,-389,-492,324,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-105,-492,-223,-229,-224,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,-106,-228,-227,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,-328,-324,]),'INDENT':([375,],[535,]),'RPAREN':([1,3,9,13,16,17,20,21,30,32,33,35,48,55,60,63,64,65,71,73,77,81,87,88,92,96,99,103,105,107,117,121,123,126,128,135,136,138,139,143,144,145,147,148,149,150,152,165,166,167,168,169,170,171,172,173,174,175,176,177,179,181,182,184,185,187,188,189,190,191,192,193,194,195,196,197,198,199,203,205,207,225,226,230,231,232,233,235,236,237,239,240,241,243,245,246,247,248,249,255,261,262,263,268,269,270,272,273,275,280,281,282,283,286,288,289,290,291,292,293,294,299,301,307,309,313,343,344,345,346,347,348,354,355,356,357,359,360,366,367,368,370,371,373,383,386,387,388,389,393,394,395,400,402,403,405,408,414,423,433,434,436,437,438,439,440,441,443,446,457,458,459,460,466,467,468,469,470,480,482,483,484,485,490,491,492,493,494,495,496,510,511,512,513,515,516,523,525,526,527,528,529,530,531,533,534,544,545,546,548,550,551,553,554,555,557,558,559,561,578,579,603,604,607,608,609,611,613,614,615,616,617,619,624,625,626,627,640,646,647,648,666,667,668,669,670,671,672,673,674,675,676,693,700,701,703,704,708,709,710,712,713,717,718,719,722,724,725,729,730,732,735,736,737,741,743,746,747,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-388,-382,-492,-492,-349,-492,-359,-387,-226,-492,-492,-397,-395,-492,-385,-325,-389,-492,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-492,-405,-404,-396,-484,-490,-470,-477,-485,-480,-462,-483,-456,-459,-472,-465,-482,-478,-458,-474,-479,-486,-394,-475,-489,-463,-481,-460,-487,-473,-488,-461,-464,-476,-451,-105,-223,-224,-348,-370,-77,-78,-352,-143,-80,-419,-79,-444,-446,-350,-129,-49,-50,-123,-330,441,-196,-360,-131,-492,-83,-2,-1,-354,-103,-417,-56,-55,-135,-356,-369,-375,-492,-82,-376,-225,-81,493,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-492,-86,-333,-391,-403,-142,-492,529,-435,-225,-6,-5,544,-471,-491,-393,-453,550,-452,-374,-492,-492,-106,-227,-492,-418,-381,-353,-144,-445,-130,-351,-331,-124,-392,-38,-37,-361,-362,-132,-378,-84,-355,-284,-104,-416,-7,-8,-136,-358,-357,-398,-492,-399,-379,-380,-337,-114,-492,610,-492,-71,-72,-492,-402,-432,-492,-89,-223,-401,-438,-436,-439,-348,-466,-469,-467,-454,-468,-457,-95,-13,-492,-14,649,-272,650,-328,-174,-271,-400,-492,-68,-67,-9,-184,-10,-182,-492,-324,-223,-433,-90,-434,-437,-455,-276,-273,-96,-492,-181,-107,-18,-185,-17,-183,-26,-25,-492,-185,-492,-180,-108,-492,-175,-440,-29,-441,-442,-30,-187,-186,-492,-327,-326,-492,-492,-179,-443,-26,-177,-185,-185,-329,-176,-178,]),'IMPORT':([0,2,10,19,22,23,24,25,38,45,46,53,68,69,75,79,80,91,95,109,113,115,131,151,154,156,157,158,161,162,163,219,222,223,224,277,352,374,396,427,428,435,453,471,472,505,535,536,537,540,552,576,577,591,592,599,600,605,628,629,630,632,633,634,635,636,638,641,642,643,645,656,657,663,664,665,681,682,683,684,685,687,688,689,699,706,707,716,721,],[86,86,-290,-289,-293,-288,-294,-318,202,-286,-292,-154,-200,-287,-151,-291,-153,-319,-320,-201,-152,-201,86,86,-169,-168,-166,-167,-303,-172,-311,-269,-127,-270,-264,-279,-208,-321,86,-263,-128,86,86,-280,-125,-207,86,-492,-308,-119,-492,86,-299,86,-309,-126,-278,86,-202,86,-42,-492,-307,-41,-120,86,86,-36,-115,-297,-35,-431,-300,-310,86,-171,-322,-203,86,-306,-304,-305,-116,-298,-301,-296,86,-302,-295,]),'OR':([1,3,9,13,17,20,21,30,32,33,35,48,55,60,64,65,71,73,81,87,88,92,99,105,107,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,226,230,231,232,233,241,243,246,247,261,262,263,268,269,270,272,280,281,282,283,286,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,534,],[-383,-335,-492,-492,-492,-384,-394,-390,-372,-386,-373,-388,-382,-492,-349,244,-359,-387,-492,-492,-397,-395,-385,-389,-492,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-370,-77,-78,-352,-143,-350,-129,244,-123,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,-492,]),'ELIF':([352,374,505,552,641,642,681,688,721,],[-208,-321,-207,644,644,-115,-322,-116,-295,]),'DIVIDE':([1,9,17,20,21,30,32,33,34,35,48,55,66,73,88,92,99,105,117,121,128,143,144,145,147,149,150,152,165,166,167,168,169,170,172,175,177,178,179,181,182,184,185,186,187,188,189,191,193,194,195,198,226,263,286,343,344,345,346,347,348,357,359,360,386,387,388,391,392,394,395,423,441,460,493,494,523,529,547,549,639,640,],[-383,127,-492,-384,-394,-390,-372,-386,188,-373,-388,-382,188,-387,-397,-395,-385,-389,-371,-121,127,-70,-377,-141,-69,-405,-404,-396,-484,-490,-470,-477,-485,-480,-483,-472,-482,188,-478,188,-474,-479,-486,188,-491,-475,-489,-481,-487,-473,-488,-476,-370,-492,-369,-364,-365,-368,-367,-366,-122,-391,-403,-142,-471,-491,-393,188,-447,188,-374,-381,-392,-378,-379,-380,-402,-401,-448,-449,-450,188,]),'ELSE':([1,3,9,13,17,20,21,30,32,33,35,48,55,60,64,65,71,73,81,87,88,92,99,105,107,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,299,301,307,309,313,343,344,345,346,347,348,352,355,356,357,358,359,360,374,388,395,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,505,523,529,536,540,552,577,635,641,642,643,645,681,685,688,699,721,],[-383,-335,-492,-492,-492,-384,-394,-390,-372,-386,-373,-388,-382,-492,-349,-492,-359,-387,-492,-492,-397,-395,-385,-389,-492,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-208,-86,-333,-391,517,-403,-142,-321,-393,-374,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-207,-402,-401,631,-119,-492,631,-120,-36,-115,631,-35,-322,-304,-116,631,-295,]),'PLUS':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,34,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,66,68,69,70,71,73,75,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,165,166,167,168,169,170,172,175,177,178,179,180,181,182,184,185,186,187,188,189,191,193,194,195,198,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,386,387,388,391,392,394,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,547,549,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,639,640,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[90,-383,90,90,90,-492,-290,90,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,168,-373,90,-137,90,-286,-292,-388,90,-154,-382,90,90,-492,90,90,-349,168,-200,-287,90,259,-387,-151,90,-291,-153,-492,-492,-397,90,-319,-395,90,-320,90,90,90,-385,90,-389,-201,90,-152,-201,-371,-138,90,-121,90,-47,90,90,-363,90,-48,90,90,90,-70,-377,-141,90,-69,90,-405,-404,90,-396,-169,-168,-166,-167,-303,-172,-311,90,-484,-490,-470,-477,-485,-480,-483,-472,-482,168,-478,90,168,-474,-479,-486,168,-491,-475,-489,-481,-487,-473,-488,-476,90,90,-224,90,-492,-348,-370,90,-77,-78,-352,-143,90,-350,90,-129,90,90,90,259,-131,-492,-83,-2,-1,90,-354,90,-56,-55,-135,-356,90,90,-369,-342,90,-344,-339,-343,-338,-341,-346,-340,90,-242,-238,-233,90,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,90,90,-321,-471,-491,-393,168,-447,168,-374,90,90,90,90,90,90,-381,90,90,90,-353,-144,90,-130,-351,-392,90,90,90,90,90,-361,-362,-132,-378,90,90,-84,-355,90,-136,-358,-357,90,-379,-380,-345,-347,-207,90,90,90,-402,90,90,-401,90,90,-492,-308,90,-119,-448,-449,-492,90,90,-299,90,-309,90,90,-202,90,-42,-492,-307,-41,-120,90,90,-450,168,-36,-115,-297,90,-35,90,90,90,-431,-300,-310,90,-171,90,-322,-203,90,-306,-304,-305,-116,-298,-301,-296,90,90,-302,-295,90,]),'DEL':([0,2,10,19,22,23,24,25,45,46,53,68,69,75,79,80,91,95,109,113,115,131,151,154,156,157,158,161,162,163,352,374,396,435,453,505,535,536,537,540,552,576,577,591,592,605,628,629,630,632,633,634,635,636,638,641,642,643,645,656,657,663,664,665,681,682,683,684,685,687,688,689,699,706,707,716,721,],[97,97,-290,-289,-293,-288,-294,-318,-286,-292,-154,-200,-287,-151,-291,-153,-319,-320,-201,-152,-201,97,97,-169,-168,-166,-167,-303,-172,-311,-208,-321,97,97,97,-207,97,-492,-308,-119,-492,97,-299,97,-309,97,-202,97,-42,-492,-307,-41,-120,97,97,-36,-115,-297,-35,-431,-300,-310,97,-171,-322,-203,97,-306,-304,-305,-116,-298,-301,-296,97,-302,-295,]),'SEMI':([1,3,4,5,7,9,11,13,14,16,17,20,21,27,30,32,33,35,39,40,42,44,48,51,52,55,57,58,60,62,63,64,65,71,72,73,74,77,81,82,84,87,88,92,99,100,102,103,104,105,106,107,108,110,111,116,117,121,123,126,128,129,132,135,136,138,139,143,144,145,147,149,150,152,153,160,203,204,205,206,207,225,226,227,230,231,232,233,235,236,237,239,240,241,243,245,246,247,248,261,262,263,264,265,267,268,269,270,272,273,274,275,276,277,278,279,280,281,282,283,286,287,292,295,299,301,307,309,313,316,318,322,332,334,335,336,338,341,343,344,345,346,347,348,349,350,355,356,357,359,360,377,378,379,381,382,388,395,397,398,399,400,402,403,404,405,414,423,433,434,436,437,438,439,440,441,457,458,459,460,461,462,463,464,466,467,468,469,470,471,472,474,475,476,478,480,481,482,483,484,485,486,487,488,493,494,495,496,499,500,501,502,503,523,529,542,543,553,554,555,557,559,573,575,578,595,596,597,599,600,601,602,603,617,619,646,647,648,649,655,],[-383,-335,-247,-216,-210,-492,131,-492,-213,-323,-492,-384,-394,-254,-390,-372,-386,-373,-209,-492,-249,-251,-388,-214,-212,-382,-257,-252,-492,-215,-492,-349,-492,-359,-248,-387,-211,-226,-492,-260,-225,-492,-397,-395,-385,-253,-261,-325,-250,-389,-256,-492,-492,-492,-492,-492,-371,-121,-47,-363,-48,-133,131,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-492,-492,-105,-492,-223,-229,-224,-348,-370,-258,-77,-78,-352,-143,-80,-419,-79,-444,-446,-350,-129,-49,-50,-123,-330,-360,-131,-492,-412,-492,-411,-83,-2,-1,-354,-103,-418,-417,-262,-279,-492,-492,-56,-55,-135,-356,-369,-492,-225,-246,-334,-336,-31,-32,-113,-117,-40,-218,-39,-255,-65,-66,-39,-219,-364,-365,-368,-367,-366,-122,-206,-134,-86,-333,-391,-403,-142,-16,-283,-99,-15,-282,-393,-374,-268,-265,-267,-492,-492,-106,-228,-227,-418,-381,-353,-144,-445,-130,-351,-331,-124,-392,-361,-362,-132,-378,-223,-492,-415,-93,-84,-355,-284,-104,-416,-280,-125,-277,-11,-91,-12,-7,-274,-8,-136,-358,-357,-23,-285,-24,-379,-380,-337,-114,-243,-245,-244,-118,-217,-402,-401,-100,-281,-95,-13,-492,-14,-272,-220,-259,-328,-413,-414,-94,-126,-278,-275,-92,-271,-324,-223,-276,-273,-96,-266,-221,]),'ASSERT':([0,2,10,19,22,23,24,25,45,46,53,68,69,75,79,80,91,95,109,113,115,131,151,154,156,157,158,161,162,163,352,374,396,435,453,505,535,536,537,540,552,576,577,591,592,605,628,629,630,632,633,634,635,636,638,641,642,643,645,656,657,663,664,665,681,682,683,684,685,687,688,689,699,706,707,716,721,],[94,94,-290,-289,-293,-288,-294,-318,-286,-292,-154,-200,-287,-151,-291,-153,-319,-320,-201,-152,-201,94,94,-169,-168,-166,-167,-303,-172,-311,-208,-321,94,94,94,-207,94,-492,-308,-119,-492,94,-299,94,-309,94,-202,94,-42,-492,-307,-41,-120,94,94,-36,-115,-297,-35,-431,-300,-310,94,-171,-322,-203,94,-306,-304,-305,-116,-298,-301,-296,94,-302,-295,]),'AMPERSANDEQUAL':([1,3,9,13,16,17,20,21,30,32,33,35,40,48,55,60,64,65,71,73,77,81,84,87,88,92,99,103,105,107,108,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,203,204,205,206,207,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,292,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,403,404,405,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,578,617,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-492,-388,-382,-492,-349,-492,-359,-387,-226,-492,-225,-492,-397,-395,-385,-325,-389,-492,329,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-105,-492,-223,-229,-224,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,-106,-228,-227,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,-328,-324,]),'TIMESEQUAL':([1,3,9,13,16,17,20,21,30,32,33,35,40,48,55,60,64,65,71,73,77,81,84,87,88,92,99,103,105,107,108,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,203,204,205,206,207,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,292,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,403,404,405,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,578,617,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-492,-388,-382,-492,-349,-492,-359,-387,-226,-492,-225,-492,-397,-395,-385,-325,-389,-492,330,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-105,-492,-223,-229,-224,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,-106,-228,-227,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,-328,-324,]),'LSHIFTEQUAL':([1,3,9,13,16,17,20,21,30,32,33,35,40,48,55,60,64,65,71,73,77,81,84,87,88,92,99,103,105,107,108,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,203,204,205,206,207,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,292,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,403,404,405,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,578,617,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-492,-388,-382,-492,-349,-492,-359,-387,-226,-492,-225,-492,-397,-395,-385,-325,-389,-492,331,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-105,-492,-223,-229,-224,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,-106,-228,-227,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,-328,-324,]),'PERIOD':([1,17,20,21,30,33,34,48,49,55,66,73,88,92,99,105,143,145,149,150,152,165,166,167,168,169,170,172,175,177,178,179,181,182,184,185,186,187,188,189,191,193,194,195,198,209,219,222,223,224,263,277,357,359,360,386,387,388,391,392,394,409,411,423,428,441,471,472,493,494,523,529,547,549,562,563,599,600,639,640,],[-383,142,-384,-394,-390,-386,182,-388,219,-382,182,-387,-397,-395,-385,-389,142,-141,-405,-404,-396,-484,-490,-470,-477,-485,-480,-483,-472,-482,182,-478,182,-474,-479,-486,182,-491,-475,-489,-481,-487,-473,-488,-476,410,-269,-127,-270,219,142,473,-391,-403,-142,-471,-491,-393,182,-447,182,410,-87,-381,-128,-392,473,-125,-379,-380,-402,-401,-448,-449,-88,-159,-126,-278,-450,182,]),'XOREQUAL':([1,3,9,13,16,17,20,21,30,32,33,35,40,48,55,60,64,65,71,73,77,81,84,87,88,92,99,103,105,107,108,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,203,204,205,206,207,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,292,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,403,404,405,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,578,617,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-492,-388,-382,-492,-349,-492,-359,-387,-226,-492,-225,-492,-397,-395,-385,-325,-389,-492,317,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-105,-492,-223,-229,-224,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,-106,-228,-227,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,-328,-324,]),'ELLIPSIS':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,34,35,36,37,43,45,46,48,49,50,53,55,56,57,60,61,63,64,66,68,69,70,71,73,75,76,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,165,166,167,168,169,170,172,175,177,178,179,180,181,182,184,185,186,187,188,189,191,193,194,195,198,200,205,207,210,218,219,222,223,224,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,386,387,388,391,392,394,395,396,408,413,414,417,421,423,424,426,428,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,547,549,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,639,640,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[99,-383,99,99,99,-492,-290,99,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,185,-373,99,-137,99,-286,-292,-388,223,99,-154,-382,99,99,-492,99,99,-349,185,-200,-287,99,-359,-387,-151,99,99,-291,-153,-492,-492,-397,99,-319,-395,99,-320,99,99,99,-385,99,-389,-201,99,-152,-201,-371,-138,99,-121,99,-47,99,99,-363,99,-48,99,99,99,-70,-377,-141,99,-69,99,-405,-404,99,-396,-169,-168,-166,-167,-303,-172,-311,99,-484,-490,-470,-477,-485,-480,-483,-472,-482,185,-478,99,185,-474,-479,-486,185,-491,-475,-489,-481,-487,-473,-488,-476,99,99,-224,99,-492,-269,-127,-270,223,-348,-370,99,-77,-78,-352,-143,99,-350,99,-129,99,99,99,-360,-131,-492,-83,-2,-1,99,-354,99,-56,-55,-135,-356,99,99,-369,-342,99,-344,-339,-343,-338,-341,-346,-340,99,-242,-238,-233,99,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,99,99,-321,-471,-491,-393,185,-447,185,-374,99,99,99,99,99,99,-381,99,99,-128,99,-353,-144,99,-130,-351,-392,99,99,99,99,99,-361,-362,-132,-378,99,99,-84,-355,99,-136,-358,-357,99,-379,-380,-345,-347,-207,99,99,99,-402,99,99,-401,99,99,-492,-308,99,-119,-448,-449,-492,99,99,-299,99,-309,99,99,-202,99,-42,-492,-307,-41,-120,99,99,-450,185,-36,-115,-297,99,-35,99,99,99,-431,-300,-310,99,-171,99,-322,-203,99,-306,-304,-305,-116,-298,-301,-296,99,99,-302,-295,99,]),'GE':([1,9,17,20,21,30,32,33,35,48,55,60,64,71,73,81,87,88,92,99,105,107,117,121,123,126,128,143,144,145,147,149,150,152,226,230,231,232,233,241,243,261,262,263,268,269,270,272,280,281,282,283,286,309,313,343,344,345,346,347,348,357,359,360,388,395,423,433,434,437,438,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,534,],[-383,-492,-492,-384,-394,-390,-372,-386,-373,-388,-382,-492,-349,-359,-387,-492,-492,-397,-395,-385,-389,308,-371,-121,-47,-363,-48,-70,-377,-141,-69,-405,-404,-396,-370,-77,-78,-352,-143,-350,-129,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,308,-113,-364,-365,-368,-367,-366,-122,-391,-403,-142,-393,-374,-381,-353,-144,-130,-351,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,308,]),'NOT':([0,1,2,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,35,36,37,43,45,46,48,53,55,57,60,61,63,64,68,69,70,71,73,75,79,80,81,87,88,91,92,94,95,96,98,99,101,105,107,109,110,113,115,117,118,121,123,126,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,180,205,207,218,225,226,230,231,232,233,238,241,243,244,261,262,263,268,269,270,272,274,280,281,282,283,286,309,311,313,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,388,395,396,408,413,414,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,457,458,459,460,465,466,467,470,483,484,485,489,493,494,495,496,505,508,517,522,523,524,528,529,532,534,535,536,537,539,540,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[101,-383,101,101,-492,-290,101,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,-373,101,-137,101,-286,-292,-388,-154,-382,101,-492,101,101,-349,-200,-287,101,-359,-387,-151,-291,-153,-492,-492,-397,-319,-395,101,-320,101,101,-385,101,-389,310,-201,101,-152,-201,-371,-138,-121,-47,-363,-48,101,101,101,-70,-377,-141,101,-69,101,-405,-404,101,-396,-169,-168,-166,-167,-303,-172,-311,101,101,101,-224,-492,-348,-370,-77,-78,-352,-143,101,-350,-129,101,-360,-131,-492,-83,-2,-1,-354,101,-56,-55,-135,-356,-369,310,498,-113,101,-242,-238,-233,101,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,101,101,-321,-393,-374,101,101,101,101,101,-381,101,101,101,-353,-144,101,-130,-351,-392,101,101,101,101,-361,-362,-132,-378,101,-84,-355,101,-136,-358,-357,101,-379,-380,-337,-114,-207,101,101,101,-402,101,101,-401,101,310,101,-492,-308,101,-119,-492,101,101,-299,101,-309,101,101,-202,101,-42,-492,-307,-41,-120,101,101,-36,-115,-297,101,-35,101,101,101,-431,-300,-310,101,-171,101,-322,-203,101,-306,-304,-305,-116,-298,-301,-296,101,101,-302,-295,101,]),'RARROW':([353,610,],[508,-173,]),'REGEXPATH':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,34,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,66,68,69,70,71,73,75,76,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,178,180,186,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,388,391,392,394,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,547,549,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,639,640,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[105,-383,105,105,105,-492,-290,105,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,192,-373,105,-137,105,-286,-292,-388,105,-154,-382,105,105,-492,105,105,-349,192,-200,-287,105,-359,-387,-151,105,105,-291,-153,-492,-492,-397,105,-319,-395,105,-320,105,105,105,-385,105,-389,-201,105,-152,-201,-371,-138,105,-121,105,-47,105,105,-363,105,-48,105,105,105,-70,-377,-141,105,-69,105,-405,-404,105,-396,-169,-168,-166,-167,-303,-172,-311,105,192,105,192,105,105,-224,105,-492,-348,-370,105,-77,-78,-352,-143,105,-350,105,-129,105,105,105,-360,-131,-492,-83,-2,-1,105,-354,105,-56,-55,-135,-356,105,105,-369,-342,105,-344,-339,-343,-338,-341,-346,-340,105,-242,-238,-233,105,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,105,105,-321,-393,192,-447,192,-374,105,105,105,105,105,105,-381,105,105,105,-353,-144,105,-130,-351,-392,105,105,105,105,105,-361,-362,-132,-378,105,105,-84,-355,105,-136,-358,-357,105,-379,-380,-345,-347,-207,105,105,105,-402,105,105,-401,105,105,-492,-308,105,-119,-448,-449,-492,105,105,-299,105,-309,105,105,-202,105,-42,-492,-307,-41,-120,105,105,-450,192,-36,-115,-297,105,-35,105,105,105,-431,-300,-310,105,-171,105,-322,-203,105,-306,-304,-305,-116,-298,-301,-296,105,105,-302,-295,105,]),'TRUE':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,34,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,66,68,69,70,71,73,75,76,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,165,166,167,168,169,170,172,175,177,178,179,180,181,182,184,185,186,187,188,189,191,193,194,195,198,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,386,387,388,391,392,394,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,547,549,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,639,640,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[73,-383,73,73,73,-492,-290,73,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,195,-373,73,-137,73,-286,-292,-388,73,-154,-382,73,73,-492,73,73,-349,195,-200,-287,73,-359,-387,-151,73,73,-291,-153,-492,-492,-397,73,-319,-395,73,-320,73,73,73,-385,73,-389,-201,73,-152,-201,-371,-138,73,-121,73,-47,73,73,-363,73,-48,73,73,73,-70,-377,-141,73,-69,73,-405,-404,73,-396,-169,-168,-166,-167,-303,-172,-311,73,-484,-490,-470,-477,-485,-480,-483,-472,-482,195,-478,73,195,-474,-479,-486,195,-491,-475,-489,-481,-487,-473,-488,-476,73,73,-224,73,-492,-348,-370,73,-77,-78,-352,-143,73,-350,73,-129,73,73,73,-360,-131,-492,-83,-2,-1,73,-354,73,-56,-55,-135,-356,73,73,-369,-342,73,-344,-339,-343,-338,-341,-346,-340,73,-242,-238,-233,73,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,73,73,-321,-471,-491,-393,195,-447,195,-374,73,73,73,73,73,73,-381,73,73,73,-353,-144,73,-130,-351,-392,73,73,73,73,73,-361,-362,-132,-378,73,73,-84,-355,73,-136,-358,-357,73,-379,-380,-345,-347,-207,73,73,73,-402,73,73,-401,73,73,-492,-308,73,-119,-448,-449,-492,73,73,-299,73,-309,73,73,-202,73,-42,-492,-307,-41,-120,73,73,-450,195,-36,-115,-297,73,-35,73,73,73,-431,-300,-310,73,-171,73,-322,-203,73,-306,-304,-305,-116,-298,-301,-296,73,73,-302,-295,73,]),'WITH':([0,2,10,19,22,23,24,25,31,45,46,53,68,69,75,79,80,91,95,109,113,115,154,156,157,158,161,162,163,352,374,505,535,536,537,540,552,577,592,628,629,630,632,633,634,635,641,642,643,645,656,657,663,665,681,682,684,685,687,688,689,699,706,716,721,],[70,70,-290,-289,-293,-288,-294,-318,70,-286,-292,-154,-200,-287,-151,-291,-153,-319,-320,-201,-152,-201,-169,-168,-166,-167,-303,-172,-311,-208,-321,-207,70,-492,-308,-119,-492,-299,-309,-202,70,-42,-492,-307,-41,-120,-36,-115,-297,-35,-431,-300,-310,-171,-322,-203,-306,-304,-305,-116,-298,-301,-296,-302,-295,]),'NE':([1,9,17,20,21,30,32,33,35,48,55,60,64,71,73,81,87,88,92,99,105,107,117,121,123,126,128,143,144,145,147,149,150,152,226,230,231,232,233,241,243,261,262,263,268,269,270,272,280,281,282,283,286,309,313,343,344,345,346,347,348,357,359,360,388,395,423,433,434,437,438,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,534,],[-383,-492,-492,-384,-394,-390,-372,-386,-373,-388,-382,-492,-349,-359,-387,-492,-492,-397,-395,-385,-389,305,-371,-121,-47,-363,-48,-70,-377,-141,-69,-405,-404,-396,-370,-77,-78,-352,-143,-350,-129,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,305,-113,-364,-365,-368,-367,-366,-122,-391,-403,-142,-393,-374,-381,-353,-144,-130,-351,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,305,]),'LPAREN':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,68,69,70,71,73,75,76,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,134,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,180,200,202,205,207,208,209,210,218,225,226,228,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,388,395,396,408,409,411,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,552,562,563,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[96,-383,96,96,96,-492,-290,96,148,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,-373,96,-137,96,-286,-292,-388,96,-154,-382,96,96,-492,96,96,-349,-200,-287,96,-359,-387,-151,96,96,-291,-153,-492,-492,-397,96,-319,-395,96,-320,96,96,96,-385,96,-389,-201,96,-152,-201,-371,-138,96,-121,96,-47,96,96,-363,96,-48,96,354,96,96,148,-377,-141,96,-69,96,-405,-404,96,-396,-169,-168,-166,-167,-303,-172,-311,96,96,96,401,96,-224,408,-160,96,-492,-348,-370,408,96,-77,-78,-352,-143,96,-350,96,-129,96,96,96,-360,-131,148,-83,-2,-1,96,-354,96,-56,-55,-135,-356,96,96,-369,-342,96,-344,-339,-343,-338,-341,-346,-340,96,-242,-238,-233,96,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,96,96,-321,-393,-374,96,96,-161,-87,96,96,96,96,-381,96,96,96,-353,-144,96,-130,-351,-392,96,96,96,96,96,-361,-362,-132,-378,96,96,-84,-355,96,-136,-358,-357,96,-379,-380,-345,-347,-207,96,96,96,-402,96,96,-401,96,96,-492,-308,96,-119,-492,-88,-159,96,96,-299,96,-309,96,96,-202,96,-42,-492,-307,-41,-120,96,96,-36,-115,-297,96,-35,96,96,96,-431,-300,-310,96,-171,96,-322,-203,96,-306,-304,-305,-116,-298,-301,-296,96,96,-302,-295,96,]),'MINUSEQUAL':([1,3,9,13,16,17,20,21,30,32,33,35,40,48,55,60,64,65,71,73,77,81,84,87,88,92,99,103,105,107,108,117,121,123,126,128,135,136,138,139,143,144,145,147,149,150,152,203,204,205,206,207,225,226,230,231,232,233,241,243,245,246,247,248,261,262,263,268,269,270,272,280,281,282,283,286,292,299,301,307,309,313,343,344,345,346,347,348,355,356,357,359,360,388,395,403,404,405,423,433,434,437,438,439,440,441,457,458,459,460,466,467,483,484,485,493,494,495,496,523,529,578,617,],[-383,-335,-492,-492,-323,-492,-384,-394,-390,-372,-386,-373,-492,-388,-382,-492,-349,-492,-359,-387,-226,-492,-225,-492,-397,-395,-385,-325,-389,-492,327,-371,-121,-47,-363,-48,-3,-4,-332,-85,-70,-377,-141,-69,-405,-404,-396,-105,-492,-223,-229,-224,-348,-370,-77,-78,-352,-143,-350,-129,-49,-50,-123,-330,-360,-131,-492,-83,-2,-1,-354,-56,-55,-135,-356,-369,-225,-334,-336,-31,-32,-113,-364,-365,-368,-367,-366,-122,-86,-333,-391,-403,-142,-393,-374,-106,-228,-227,-381,-353,-144,-130,-351,-331,-124,-392,-361,-362,-132,-378,-84,-355,-136,-358,-357,-379,-380,-337,-114,-402,-401,-328,-324,]),'DOUBLEDIV':([1,9,17,20,21,30,32,33,34,35,48,55,66,73,88,92,99,105,117,121,128,143,144,145,147,149,150,152,165,166,167,168,169,170,172,175,177,178,179,181,182,184,185,186,187,188,189,191,193,194,195,198,226,263,286,343,344,345,346,347,348,357,359,360,386,387,388,391,392,394,395,423,441,460,493,494,523,529,547,549,639,640,],[-383,124,-492,-384,-394,-390,-372,-386,169,-373,-388,-382,169,-387,-397,-395,-385,-389,-371,-121,124,-70,-377,-141,-69,-405,-404,-396,-484,-490,-470,-477,-485,-480,-483,-472,-482,169,-478,169,-474,-479,-486,169,-491,-475,-489,-481,-487,-473,-488,-476,-370,-492,-369,-364,-365,-368,-367,-366,-122,-391,-403,-142,-471,-491,-393,169,-447,169,-374,-381,-392,-378,-379,-380,-402,-401,-448,-449,-450,169,]),'LBRACE':([0,1,2,6,8,9,10,15,17,19,20,21,22,23,24,25,30,32,33,35,36,37,43,45,46,48,50,53,55,56,57,60,61,63,64,68,69,70,71,73,75,76,78,79,80,81,87,88,90,91,92,94,95,96,97,98,99,101,105,109,110,113,115,117,118,120,121,122,123,124,125,126,127,128,131,137,141,143,144,145,146,147,148,149,150,151,152,154,156,157,158,161,162,163,164,180,200,205,207,210,218,225,226,229,230,231,232,233,238,241,242,243,244,259,260,261,262,263,268,269,270,271,272,274,280,281,282,283,284,285,286,300,302,303,304,305,306,308,311,312,314,315,317,319,320,321,323,324,325,326,327,328,329,330,331,342,343,344,345,346,347,348,352,357,359,360,369,372,374,388,395,396,408,413,414,417,421,423,424,426,429,433,434,435,437,438,441,442,444,453,454,455,457,458,459,460,461,465,466,467,470,483,484,485,489,493,494,497,498,505,508,517,522,523,524,528,529,532,535,536,537,539,540,552,570,576,577,591,592,605,612,628,629,630,632,633,634,635,636,638,641,642,643,644,645,652,653,654,656,657,663,664,665,677,681,682,683,684,685,687,688,689,699,706,707,711,716,721,738,],[43,-383,43,43,43,-492,-290,43,-492,-289,-384,-394,-293,-288,-294,-318,-390,-372,-386,-373,43,-137,43,-286,-292,-388,43,-154,-382,43,43,-492,43,43,-349,-200,-287,43,-359,-387,-151,43,43,-291,-153,-492,-492,-397,43,-319,-395,43,-320,43,43,43,-385,43,-389,-201,43,-152,-201,-371,-138,43,-121,43,-47,43,43,-363,43,-48,43,43,43,-70,-377,-141,43,-69,43,-405,-404,43,-396,-169,-168,-166,-167,-303,-172,-311,43,43,43,43,-224,43,-492,-348,-370,43,-77,-78,-352,-143,43,-350,43,-129,43,43,43,-360,-131,-492,-83,-2,-1,43,-354,43,-56,-55,-135,-356,43,43,-369,-342,43,-344,-339,-343,-338,-341,-346,-340,43,-242,-238,-233,43,-240,-237,-230,-235,-234,-231,-241,-236,-232,-239,-222,-364,-365,-368,-367,-366,-122,-208,-391,-403,-142,43,43,-321,-393,-374,43,43,43,43,43,43,-381,43,43,43,-353,-144,43,-130,-351,-392,43,43,43,43,43,-361,-362,-132,-378,43,43,-84,-355,43,-136,-358,-357,43,-379,-380,-345,-347,-207,43,43,43,-402,43,43,-401,43,43,-492,-308,43,-119,-492,43,43,-299,43,-309,43,43,-202,43,-42,-492,-307,-41,-120,43,43,-36,-115,-297,43,-35,43,43,43,-431,-300,-310,43,-171,43,-322,-203,43,-306,-304,-305,-116,-298,-301,-296,43,43,-302,-295,43,]),'NONLOCAL':([0,2,10,19,22,23,24,25,45,46,53,68,69,75,79,80,91,95,109,113,115,131,151,154,156,157,158,161,162,163,352,374,396,435,453,505,535,536,537,540,552,576,577,591,592,605,628,629,630,632,633,634,635,636,638,641,642,643,645,656,657,663,664,665,681,682,683,684,685,687,688,689,699,706,707,716,721,],[26,26,-290,-289,-293,-288,-294,-318,-286,-292,-154,-200,-287,-151,-291,-153,-319,-320,-201,-152,-201,26,26,-169,-168,-166,-167,-303,-172,-311,-208,-321,26,26,26,-207,26,-492,-308,-119,-492,26,-299,26,-309,26,-202,26,-42,-492,-307,-41,-120,26,26,-36,-115,-297,-35,-431,-300,-310,26,-171,-322,-203,26,-306,-304,-305,-116,-298,-301,-296,26,-302,-295,]),} _lr_action = { } for _k, _v in _lr_action_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_action: _lr_action[_x] = { } _lr_action[_x][_k] = _y del _lr_action_items _lr_goto_items = {'comma_import_as_name':([400,557,],[553,648,]),'comma_name_list':([153,160,],[377,377,]),'factor':([0,2,6,8,15,36,43,50,56,57,61,63,70,78,90,94,96,97,98,101,110,120,122,124,125,127,131,137,141,146,148,151,164,180,200,205,210,229,238,242,244,259,260,271,274,284,285,302,314,320,369,372,396,408,413,414,417,421,424,426,429,435,442,444,453,454,455,461,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[9,9,117,9,9,9,9,9,226,9,9,9,9,9,286,9,9,9,9,9,9,343,344,345,346,347,9,9,9,9,9,9,9,9,395,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,]),'elif_part':([552,641,],[642,688,]),'equals_yield_expr_or_testlist_list':([108,111,116,],[318,318,318,]),'file_stmts':([0,],[2,]),'del_stmt':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'test_comma_list':([0,2,131,151,396,426,435,453,535,576,591,605,629,636,638,664,683,707,],[8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,]),'comma_subscript':([361,521,],[519,620,]),'import_as_name':([202,401,556,],[400,400,647,]),'small_stmt':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[11,11,349,11,11,11,11,11,11,11,11,11,11,11,11,11,11,]),'period_name':([277,471,],[472,599,]),'comma_vfpdef_list':([445,448,714,],[583,587,727,]),'period_or_ellipsis_list':([49,],[224,]),'atom':([0,2,6,8,15,36,43,50,56,57,61,63,70,76,78,90,94,96,97,98,101,110,120,122,124,125,127,131,137,141,146,148,151,164,180,200,205,210,229,238,242,244,259,260,271,274,284,285,302,314,320,369,372,396,408,413,414,417,421,424,426,429,435,442,444,453,454,455,461,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[17,17,17,17,17,17,17,17,17,17,17,17,17,263,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,]),'comma_item_list':([214,564,],[420,651,]),'trailer_list':([17,263,],[143,143,]),'tfpdef':([354,510,514,670,676,702,719,720,737,741,745,],[516,608,615,703,703,717,608,730,703,703,747,]),'sliceop_opt':([623,],[679,]),'async_funcdef':([0,2,28,535,629,],[25,25,156,25,25,]),'subproc_arg':([34,66,178,186,391,394,640,],[181,181,181,181,181,181,181,]),'and_not_test_list':([13,],[136,]),'with_item':([70,454,],[257,593,]),'comma_subscript_list_opt':([361,],[518,]),'pipe_xor_expr_list':([64,],[241,]),'comma_tfpdef_list':([607,616,729,],[666,673,735,]),'dotted_as_name':([86,477,],[278,601,]),'classdef_or_funcdef':([28,],[154,]),'equals_test_opt':([251,516,660,703,],[445,616,697,718,]),'trailer':([17,143,263,],[145,360,145,]),'equals_yield_expr_or_testlist_list_opt':([108,111,116,],[322,341,341,]),'comma_vfpdef':([445,448,583,587,714,727,],[580,580,659,659,580,659,]),'expr_stmt':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,]),'comma_tfpdef_list_opt':([616,729,],[675,736,]),'comma_name':([153,160,377,],[379,379,542,]),'yield_arg_opt':([63,],[239,]),'comp_op_expr_list':([107,534,],[309,309,]),'comp_op_expr':([107,309,534,],[313,496,313,]),'continue_stmt':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,]),'comma_item':([214,420,564,651,],[422,568,422,568,]),'raise_stmt':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'subproc':([34,66,178,186,],[183,249,384,393,]),'vfpdef':([67,253,254,584,589,662,695,696,723,728,733,734,739,742,],[251,449,450,660,660,698,449,715,251,660,660,740,744,746,]),'else_part':([536,577,643,699,],[632,657,689,716,]),'subproc_atoms':([34,66,178,186,391,],[199,199,199,199,548,]),'classdef':([0,2,28,535,629,],[46,46,157,46,46,]),'item':([43,421,570,652,],[214,572,572,572,]),'stmt':([0,2,535,629,],[53,53,628,682,]),'comma_test_list':([84,212,218,236,564,],[275,275,425,275,275,]),'comp_iter':([693,725,],[713,713,]),'comma_argument_list':([366,],[526,]),'func_call_opt':([228,],[430,]),'attr_name':([41,],[208,]),'pm_term':([71,261,],[262,459,]),'and_expr':([0,2,8,15,36,43,50,57,61,63,70,78,94,96,97,98,101,110,131,137,141,146,148,151,164,180,205,210,229,238,242,244,274,302,314,320,369,372,396,408,413,414,417,421,424,426,429,435,442,444,453,454,455,461,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,433,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,]),'arglist_opt':([148,408,],[367,561,]),'atom_expr':([0,2,6,8,15,36,43,50,56,57,61,63,70,78,90,94,96,97,98,101,110,120,122,124,125,127,131,137,141,146,148,151,164,180,200,205,210,229,238,242,244,259,260,271,274,284,285,302,314,320,369,372,396,408,413,414,417,421,424,426,429,435,442,444,453,454,455,461,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,]),'trailer_list_opt':([17,263,],[144,460,]),'test_nocond':([711,738,],[725,743,]),'colon_test_opt':([512,],[613,]),'finally_part_opt':([536,632,],[633,684,]),'test_or_star_expr':([0,2,43,96,98,131,148,151,205,396,408,435,453,528,535,576,591,605,629,636,638,664,683,707,],[40,40,213,289,289,40,368,40,405,40,368,40,40,368,40,40,40,40,40,40,40,40,40,40,]),'subscript':([146,522,],[361,621,]),'attr_period_name':([209,409,],[411,562,]),'dotted_as_names':([86,],[276,]),'comma_dotted_as_name':([278,478,],[476,602,]),'break_stmt':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,]),'and_not_test':([13,136,],[139,355,]),'stmt_list':([535,],[629,]),'pass_stmt':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,]),'except_part_list':([376,],[536,]),'shift_arith_expr_list_opt':([87,],[283,]),'newline_or_stmt':([0,2,],[75,113,]),'comma_with_item':([257,451,],[452,590,]),'comp_op_expr_list_opt':([107,534,],[301,301,]),'comma_pow_vfpdef_opt':([448,587,],[586,661,]),'augassign':([108,],[320,]),'typedargslist':([354,],[515,]),'funcdef':([0,2,28,31,159,535,629,],[79,79,158,162,162,79,79,]),'comma_dotted_as_name_list_opt':([278,],[474,]),'comma_subscript_list':([361,],[521,]),'return_stmt':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,]),'except_clause':([376,536,],[538,538,]),'pipe':([183,249,384,393,],[391,391,391,391,]),'comma_dotted_as_name_list':([278,],[478,]),'period_or_ellipsis':([49,224,],[222,428,]),'varargslist':([67,723,],[252,252,]),'as_expr':([258,],[456,]),'op_factor_list':([9,],[128,]),'colon_test':([512,],[614,]),'yield_expr_or_testlist_comp_opt':([96,],[294,]),'string_literal':([0,2,6,8,15,20,34,36,43,50,56,57,61,63,66,70,76,78,90,94,96,97,98,101,110,120,122,124,125,127,131,137,141,146,148,151,164,178,180,186,200,205,210,229,238,242,244,259,260,271,274,284,285,302,314,320,369,372,391,394,396,408,413,414,417,421,424,426,429,435,442,444,453,454,455,461,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,640,644,652,653,654,664,677,683,707,711,738,],[92,92,92,92,92,152,174,92,92,92,92,92,92,92,174,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,174,92,174,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,174,174,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,174,92,92,92,92,92,92,92,92,92,92,]),'rarrow_test_opt':([353,],[507,]),'string_literal_list':([0,2,6,8,15,36,43,50,56,57,61,63,70,76,78,90,94,96,97,98,101,110,120,122,124,125,127,131,137,141,146,148,151,164,180,200,205,210,229,238,242,244,259,260,271,274,284,285,302,314,320,369,372,396,408,413,414,417,421,424,426,429,435,442,444,453,454,455,461,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,]),'comma_expr_or_star_expr_list':([265,],[462,]),'single_input':([0,],[93,]),'star_expr':([0,2,43,47,78,96,97,98,131,148,151,205,396,408,417,435,453,461,528,535,576,591,605,629,636,638,664,683,707,],[77,77,77,218,264,77,264,77,77,77,77,77,77,77,264,77,77,264,77,77,77,77,77,77,77,77,77,77,77,]),'semi_small_stmt':([11,132,],[129,350,]),'subscriptlist':([146,],[363,]),'suite':([151,396,435,453,576,591,605,636,638,664,683,707,],[376,552,577,592,656,663,665,685,687,699,706,721,]),'import_from_post':([202,],[397,]),'semi_small_stmt_list':([11,],[132,]),'comma_expr_or_star_expr':([265,462,],[464,597,]),'pipe_xor_expr':([64,241,],[243,437,]),'elif_part_list_opt':([552,],[643,]),'newlines':([111,],[340,]),'async_with_stmt':([0,2,535,629,],[91,91,91,91,]),'lambdef':([0,2,8,15,36,43,57,61,63,70,94,96,98,110,131,146,148,151,164,180,205,238,274,314,320,369,372,396,408,413,414,421,424,426,429,435,442,444,453,454,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,654,664,677,683,707,],[103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,]),'empty':([0,2,9,11,13,17,40,43,49,60,63,65,67,81,87,96,98,107,108,110,111,116,131,132,146,148,151,153,160,204,213,218,228,251,253,263,265,278,279,287,289,353,354,361,366,396,400,402,408,416,420,426,435,445,448,453,462,491,510,512,516,518,522,524,526,534,535,536,552,555,576,582,587,591,605,607,616,623,629,632,636,637,638,651,660,664,666,675,677,683,693,695,703,707,714,719,723,725,729,],[85,114,123,130,135,147,207,215,220,230,237,245,256,270,281,293,298,307,332,335,338,332,114,130,365,373,114,381,381,207,207,207,432,446,447,147,207,475,480,486,207,509,513,520,207,114,554,480,373,207,207,114,114,581,585,114,207,207,609,611,446,207,365,365,207,307,114,634,645,207,114,207,585,114,114,671,674,678,114,634,114,480,114,207,446,114,671,207,365,114,709,447,446,114,581,609,256,709,674,]),'compound_stmt':([0,2,535,629,],[109,115,115,115,]),'comma_pow_vfpdef':([448,587,],[588,588,]),'eval_input':([0,],[112,]),'argument':([148,408,528,],[366,366,626,]),'assert_stmt':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'comparison':([0,2,8,15,36,43,57,61,63,70,94,96,98,101,110,131,137,141,146,148,151,164,180,205,238,244,274,314,320,369,372,396,408,413,414,421,424,426,429,435,442,444,453,454,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,]),'newlines_opt':([111,],[337,]),'comma_test_opt':([287,],[487,]),'lambdef_nocond':([711,738,],[722,722,]),'xor_and_expr_list_opt':([60,],[232,]),'comp_iter_opt':([693,725,],[712,732,]),'ampersand_shift_expr_list':([81,],[269,]),'with_stmt':([0,2,31,535,629,],[10,10,163,10,10,]),'elif_part_list':([552,],[641,]),'and_test':([0,2,8,15,36,43,57,61,63,70,94,96,98,110,131,141,146,148,151,164,180,205,238,244,274,314,320,369,372,396,408,413,414,421,424,426,429,435,442,444,453,454,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,439,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,]),'yield_expr':([0,2,96,131,151,314,320,396,435,453,535,576,591,605,629,636,638,664,683,707,],[106,106,288,106,106,499,499,106,106,106,106,106,106,106,106,106,106,106,106,106,]),'not_test':([0,2,8,15,36,43,57,61,63,70,94,96,98,101,110,131,137,141,146,148,151,164,180,205,238,244,274,314,320,369,372,396,408,413,414,421,424,426,429,435,442,444,453,454,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[13,13,13,13,13,13,13,13,13,13,13,13,13,299,13,13,356,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,]),'import_stmt':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,]),'expr_or_star_expr':([78,97,417,461,],[265,265,265,595,]),'comma_argument':([366,526,],[527,625,]),'or_test':([0,2,8,15,36,43,57,61,63,70,94,96,98,110,131,141,146,148,151,164,180,205,238,274,314,320,369,372,396,408,413,414,421,424,426,429,435,442,444,453,454,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,358,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,693,16,16,16,16,16,724,724,]),'power':([0,2,6,8,15,36,43,50,56,57,61,63,70,78,90,94,96,97,98,101,110,120,122,124,125,127,131,137,141,146,148,151,164,180,200,205,210,229,238,242,244,259,260,271,274,284,285,302,314,320,369,372,396,408,413,414,417,421,424,426,429,435,442,444,453,454,455,461,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,]),'try_stmt':([0,2,535,629,],[19,19,19,19,]),'tfpdef_opt':([510,719,],[607,729,]),'shift_arith_expr':([87,280,],[282,483,]),'async_stmt':([0,2,535,629,],[24,24,24,24,]),'comma_pow_tfpdef':([607,666,],[669,669,]),'dictorsetmaker':([43,],[211,]),'for_stmt':([0,2,31,535,629,],[23,23,161,23,23,]),'nonlocal_stmt':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,]),'subproc_atom':([34,66,178,186,391,394,640,],[173,173,173,173,173,551,551,]),'shift_expr':([0,2,8,15,36,43,50,57,61,63,70,78,94,96,97,98,101,110,131,137,141,146,148,151,164,180,205,210,229,238,242,244,271,274,302,314,320,369,372,396,408,413,414,417,421,424,426,429,435,442,444,453,454,455,461,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,467,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,]),'comma_vfpdef_list_opt':([445,714,],[582,726,]),'testlist_comp_opt':([98,],[297,]),'arglist':([148,408,],[371,371,]),'period_or_ellipsis_list_opt':([49,],[221,]),'or_and_test':([65,246,],[247,440,]),'import_as_names':([202,401,],[399,558,]),'import_from_pre':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,]),'test_opt':([146,522,524,677,],[364,364,623,705,]),'decorated':([0,2,535,629,],[22,22,22,22,]),'comma_import_as_name_list':([400,],[557,]),'comma_test_or_star_expr':([40,204,213,289,416,491,],[203,403,203,203,403,403,]),'equals_yield_expr_or_testlist':([108,111,116,318,425,574,],[316,316,316,502,573,655,]),'varargslist_opt':([67,723,],[250,731,]),'ampersand_shift_expr_list_opt':([81,],[272,]),'yield_expr_or_testlist':([314,320,],[500,503,]),'comma_with_item_list':([257,],[451,]),'if_stmt':([0,2,535,629,],[45,45,45,45,]),'comma_tfpdef':([607,616,666,673,729,735,],[668,668,701,701,668,701,]),'test_comma_list_opt':([0,2,131,151,396,426,435,453,535,576,591,605,629,636,638,664,683,707,],[47,47,47,47,47,574,47,47,47,47,47,47,47,47,47,47,47,47,]),'xor_and_expr_list':([60,],[231,]),'global_stmt':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,]),'op_factor':([9,128,],[121,348,]),'or_and_test_list_opt':([65,],[248,]),'exprlist':([78,97,417,],[266,295,567,]),'file_input':([0,],[54,]),'comma_test':([84,212,218,236,275,287,425,564,],[273,273,273,273,469,488,469,273,]),'yield_stmt':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,]),'flow_stmt':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,]),'dotted_name':([86,221,477,],[279,427,279,]),'test_comma':([0,2,8,131,151,396,426,435,453,535,576,591,605,629,636,638,664,683,707,],[37,37,118,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,]),'testlist_opt':([110,],[334,]),'ampersand_shift_expr':([81,269,],[268,466,]),'period_name_list':([277,],[471,]),'while_stmt':([0,2,535,629,],[69,69,69,69,]),'term':([0,2,8,15,36,43,50,57,61,63,70,78,94,96,97,98,101,110,131,137,141,146,148,151,164,180,205,210,229,238,242,244,259,260,271,274,284,285,302,314,320,369,372,396,408,413,414,417,421,424,426,429,435,442,444,453,454,455,461,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,457,458,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,]),'comma_pow_tfpdef_opt':([607,666,],[667,700,]),'as_name_opt':([279,402,637,],[481,559,686,]),'equals_test':([251,516,660,703,],[443,443,443,443,]),'pm_term_list':([71,],[261,]),'testlist_comp':([96,98,],[291,296,]),'rarrow_test':([353,],[506,]),'parameters':([134,],[353,]),'sliceop':([623,],[680,]),'decorators':([0,2,535,629,],[28,28,28,28,]),'xor_and_expr':([60,231,],[233,434,]),'yield_arg':([63,],[235,]),'import_name':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,]),'comma_name_list_opt':([153,160,],[378,382,]),'start_symbols':([0,],[83,]),'test':([0,2,8,15,36,43,57,61,63,70,94,96,98,110,131,146,148,151,164,180,205,238,274,314,320,369,372,396,408,413,414,421,424,426,429,435,442,444,453,454,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,654,664,677,683,707,],[84,84,119,140,201,212,227,234,236,258,287,292,292,236,84,362,370,84,383,385,292,436,468,236,236,530,533,84,370,564,468,571,468,119,575,84,578,579,84,258,236,468,468,606,617,362,622,370,627,84,637,571,84,84,84,672,84,84,84,690,692,694,84,622,84,84,]),'testlist_star_expr':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,]),'comp_for':([213,214,289,370,693,725,],[415,419,490,531,708,708,]),'arith_expr':([0,2,8,15,36,43,50,57,61,63,70,78,94,96,97,98,101,110,131,137,141,146,148,151,164,180,205,210,229,238,242,244,271,274,284,285,302,314,320,369,372,396,408,413,414,417,421,424,426,429,435,442,444,453,454,455,461,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,484,485,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,]),'comma_test_or_star_expr_list':([40,213,289,],[204,416,491,]),'finally_part':([376,536,632,],[537,630,630,]),'subproc_arg_part':([34,66,178,181,186,391,394,640,],[167,167,167,386,167,167,167,167,]),'comma_import_as_name_list_opt':([400,],[555,]),'comma_opt':([40,204,213,218,265,289,366,416,420,462,491,518,526,555,582,651,675,],[206,404,418,426,463,492,525,566,569,596,604,618,624,646,658,691,704,]),'dictorsetmaker_opt':([43,],[216,]),'decorator':([0,2,28,535,629,],[89,89,155,89,89,]),'shift_arith_expr_list':([87,],[280,]),'op_factor_list_opt':([9,],[126,]),'xor_expr':([0,2,8,15,36,43,50,57,61,63,70,78,94,96,97,98,101,110,131,137,141,146,148,151,164,180,205,210,238,242,244,274,302,314,320,369,372,396,408,413,414,417,421,424,426,429,435,442,444,453,454,455,461,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,438,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,]),'expr':([0,2,8,15,36,43,50,57,61,63,70,78,94,96,97,98,101,110,131,137,141,146,148,151,164,180,205,210,238,244,274,302,314,320,369,372,396,408,413,414,417,421,424,426,429,435,442,444,453,454,455,461,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[107,107,107,107,107,107,225,107,107,107,107,267,107,107,267,107,107,107,107,107,107,107,107,107,107,107,107,412,107,107,107,495,107,107,107,534,107,107,107,107,267,107,107,107,107,107,107,107,107,107,594,267,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,]),'async_for_stmt':([0,2,535,629,],[95,95,95,95,]),'yield_expr_or_testlist_comp':([96,],[290,]),'as_name':([279,402,637,],[482,482,482,]),'semi_opt':([11,132,],[133,351,]),'except_part':([376,536,],[540,635,]),'or_and_test_list':([65,],[246,]),'func_call':([208,228,],[407,431,]),'comp_if':([693,725,],[710,710,]),'comp_op':([107,309,534,],[302,302,302,]),'simple_stmt':([0,2,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[68,68,374,374,374,374,68,374,374,374,68,374,374,374,374,374,]),'import_from':([0,2,131,151,396,435,453,535,576,591,605,629,636,638,664,683,707,],[102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,]),'typedargslist_opt':([354,],[511,]),'vfpdef_opt':([253,695,],[448,714,]),'attr_period_name_list':([209,],[409,]),'number':([0,2,6,8,15,36,43,50,56,57,61,63,70,76,78,90,94,96,97,98,101,110,120,122,124,125,127,131,137,141,146,148,151,164,180,200,205,210,229,238,242,244,259,260,271,274,284,285,302,314,320,369,372,396,408,413,414,417,421,424,426,429,435,442,444,453,454,455,461,465,470,489,508,517,522,524,528,532,535,539,570,576,591,605,612,629,636,638,644,652,653,654,664,677,683,707,711,738,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'and_not_test_list_opt':([13,],[138,]),'testlist':([0,2,43,63,110,131,151,314,320,396,413,435,453,465,535,576,591,605,629,636,638,664,683,707,],[111,116,217,240,336,116,116,501,501,116,565,116,116,598,116,116,116,116,116,116,116,116,116,116,]),} _lr_goto = { } for _k, _v in _lr_goto_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_goto: _lr_goto[_x] = { } _lr_goto[_x][_k] = _y del _lr_goto_items _lr_productions = [ ("S' -> start_symbols","S'",1,None,None,None), ('ampersand_shift_expr_list_opt -> empty','ampersand_shift_expr_list_opt',1,'p_ampersand_shift_expr_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('ampersand_shift_expr_list_opt -> ampersand_shift_expr_list','ampersand_shift_expr_list_opt',1,'p_ampersand_shift_expr_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('and_not_test_list_opt -> empty','and_not_test_list_opt',1,'p_and_not_test_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('and_not_test_list_opt -> and_not_test_list','and_not_test_list_opt',1,'p_and_not_test_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('arglist_opt -> empty','arglist_opt',1,'p_arglist_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('arglist_opt -> arglist','arglist_opt',1,'p_arglist_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('as_name_opt -> empty','as_name_opt',1,'p_as_name_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('as_name_opt -> as_name','as_name_opt',1,'p_as_name_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('colon_test_opt -> empty','colon_test_opt',1,'p_colon_test_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('colon_test_opt -> colon_test','colon_test_opt',1,'p_colon_test_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('comma_dotted_as_name_list_opt -> empty','comma_dotted_as_name_list_opt',1,'p_comma_dotted_as_name_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('comma_dotted_as_name_list_opt -> comma_dotted_as_name_list','comma_dotted_as_name_list_opt',1,'p_comma_dotted_as_name_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('comma_import_as_name_list_opt -> empty','comma_import_as_name_list_opt',1,'p_comma_import_as_name_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('comma_import_as_name_list_opt -> comma_import_as_name_list','comma_import_as_name_list_opt',1,'p_comma_import_as_name_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('comma_name_list_opt -> empty','comma_name_list_opt',1,'p_comma_name_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('comma_name_list_opt -> comma_name_list','comma_name_list_opt',1,'p_comma_name_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('comma_pow_tfpdef_opt -> empty','comma_pow_tfpdef_opt',1,'p_comma_pow_tfpdef_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('comma_pow_tfpdef_opt -> comma_pow_tfpdef','comma_pow_tfpdef_opt',1,'p_comma_pow_tfpdef_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('comma_pow_vfpdef_opt -> empty','comma_pow_vfpdef_opt',1,'p_comma_pow_vfpdef_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('comma_pow_vfpdef_opt -> comma_pow_vfpdef','comma_pow_vfpdef_opt',1,'p_comma_pow_vfpdef_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('comma_subscript_list_opt -> empty','comma_subscript_list_opt',1,'p_comma_subscript_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('comma_subscript_list_opt -> comma_subscript_list','comma_subscript_list_opt',1,'p_comma_subscript_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('comma_test_opt -> empty','comma_test_opt',1,'p_comma_test_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('comma_test_opt -> comma_test','comma_test_opt',1,'p_comma_test_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('comma_tfpdef_list_opt -> empty','comma_tfpdef_list_opt',1,'p_comma_tfpdef_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('comma_tfpdef_list_opt -> comma_tfpdef_list','comma_tfpdef_list_opt',1,'p_comma_tfpdef_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('comma_vfpdef_list_opt -> empty','comma_vfpdef_list_opt',1,'p_comma_vfpdef_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('comma_vfpdef_list_opt -> comma_vfpdef_list','comma_vfpdef_list_opt',1,'p_comma_vfpdef_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('comp_iter_opt -> empty','comp_iter_opt',1,'p_comp_iter_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('comp_iter_opt -> comp_iter','comp_iter_opt',1,'p_comp_iter_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('comp_op_expr_list_opt -> empty','comp_op_expr_list_opt',1,'p_comp_op_expr_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('comp_op_expr_list_opt -> comp_op_expr_list','comp_op_expr_list_opt',1,'p_comp_op_expr_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('dictorsetmaker_opt -> empty','dictorsetmaker_opt',1,'p_dictorsetmaker_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('dictorsetmaker_opt -> dictorsetmaker','dictorsetmaker_opt',1,'p_dictorsetmaker_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('elif_part_list_opt -> empty','elif_part_list_opt',1,'p_elif_part_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('elif_part_list_opt -> elif_part_list','elif_part_list_opt',1,'p_elif_part_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('equals_test_opt -> empty','equals_test_opt',1,'p_equals_test_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('equals_test_opt -> equals_test','equals_test_opt',1,'p_equals_test_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('equals_yield_expr_or_testlist_list_opt -> empty','equals_yield_expr_or_testlist_list_opt',1,'p_equals_yield_expr_or_testlist_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('equals_yield_expr_or_testlist_list_opt -> equals_yield_expr_or_testlist_list','equals_yield_expr_or_testlist_list_opt',1,'p_equals_yield_expr_or_testlist_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('finally_part_opt -> empty','finally_part_opt',1,'p_finally_part_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('finally_part_opt -> finally_part','finally_part_opt',1,'p_finally_part_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('func_call_opt -> empty','func_call_opt',1,'p_func_call_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('func_call_opt -> func_call','func_call_opt',1,'p_func_call_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('newlines_opt -> empty','newlines_opt',1,'p_newlines_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('newlines_opt -> newlines','newlines_opt',1,'p_newlines_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('op_factor_list_opt -> empty','op_factor_list_opt',1,'p_op_factor_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('op_factor_list_opt -> op_factor_list','op_factor_list_opt',1,'p_op_factor_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('or_and_test_list_opt -> empty','or_and_test_list_opt',1,'p_or_and_test_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('or_and_test_list_opt -> or_and_test_list','or_and_test_list_opt',1,'p_or_and_test_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('period_or_ellipsis_list_opt -> empty','period_or_ellipsis_list_opt',1,'p_period_or_ellipsis_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('period_or_ellipsis_list_opt -> period_or_ellipsis_list','period_or_ellipsis_list_opt',1,'p_period_or_ellipsis_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('rarrow_test_opt -> empty','rarrow_test_opt',1,'p_rarrow_test_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('rarrow_test_opt -> rarrow_test','rarrow_test_opt',1,'p_rarrow_test_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('shift_arith_expr_list_opt -> empty','shift_arith_expr_list_opt',1,'p_shift_arith_expr_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('shift_arith_expr_list_opt -> shift_arith_expr_list','shift_arith_expr_list_opt',1,'p_shift_arith_expr_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('sliceop_opt -> empty','sliceop_opt',1,'p_sliceop_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('sliceop_opt -> sliceop','sliceop_opt',1,'p_sliceop_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('test_comma_list_opt -> empty','test_comma_list_opt',1,'p_test_comma_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('test_comma_list_opt -> test_comma_list','test_comma_list_opt',1,'p_test_comma_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('test_opt -> empty','test_opt',1,'p_test_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('test_opt -> test','test_opt',1,'p_test_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('testlist_comp_opt -> empty','testlist_comp_opt',1,'p_testlist_comp_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('testlist_comp_opt -> testlist_comp','testlist_comp_opt',1,'p_testlist_comp_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('testlist_opt -> empty','testlist_opt',1,'p_testlist_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('testlist_opt -> testlist','testlist_opt',1,'p_testlist_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('tfpdef_opt -> empty','tfpdef_opt',1,'p_tfpdef_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('tfpdef_opt -> tfpdef','tfpdef_opt',1,'p_tfpdef_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('trailer_list_opt -> empty','trailer_list_opt',1,'p_trailer_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('trailer_list_opt -> trailer_list','trailer_list_opt',1,'p_trailer_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('typedargslist_opt -> empty','typedargslist_opt',1,'p_typedargslist_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('typedargslist_opt -> typedargslist','typedargslist_opt',1,'p_typedargslist_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('varargslist_opt -> empty','varargslist_opt',1,'p_varargslist_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('varargslist_opt -> varargslist','varargslist_opt',1,'p_varargslist_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('vfpdef_opt -> empty','vfpdef_opt',1,'p_vfpdef_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('vfpdef_opt -> vfpdef','vfpdef_opt',1,'p_vfpdef_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('xor_and_expr_list_opt -> empty','xor_and_expr_list_opt',1,'p_xor_and_expr_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('xor_and_expr_list_opt -> xor_and_expr_list','xor_and_expr_list_opt',1,'p_xor_and_expr_list_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('yield_arg_opt -> empty','yield_arg_opt',1,'p_yield_arg_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('yield_arg_opt -> yield_arg','yield_arg_opt',1,'p_yield_arg_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('yield_expr_or_testlist_comp_opt -> empty','yield_expr_or_testlist_comp_opt',1,'p_yield_expr_or_testlist_comp_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',285), ('yield_expr_or_testlist_comp_opt -> yield_expr_or_testlist_comp','yield_expr_or_testlist_comp_opt',1,'p_yield_expr_or_testlist_comp_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',286), ('ampersand_shift_expr_list -> ampersand_shift_expr','ampersand_shift_expr_list',1,'p_ampersand_shift_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('ampersand_shift_expr_list -> ampersand_shift_expr_list ampersand_shift_expr','ampersand_shift_expr_list',2,'p_ampersand_shift_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('and_not_test_list -> and_not_test','and_not_test_list',1,'p_and_not_test_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('and_not_test_list -> and_not_test_list and_not_test','and_not_test_list',2,'p_and_not_test_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('attr_period_name_list -> attr_period_name','attr_period_name_list',1,'p_attr_period_name_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('attr_period_name_list -> attr_period_name_list attr_period_name','attr_period_name_list',2,'p_attr_period_name_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('comma_argument_list -> comma_argument','comma_argument_list',1,'p_comma_argument_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('comma_argument_list -> comma_argument_list comma_argument','comma_argument_list',2,'p_comma_argument_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('comma_dotted_as_name_list -> comma_dotted_as_name','comma_dotted_as_name_list',1,'p_comma_dotted_as_name_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('comma_dotted_as_name_list -> comma_dotted_as_name_list comma_dotted_as_name','comma_dotted_as_name_list',2,'p_comma_dotted_as_name_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('comma_expr_or_star_expr_list -> comma_expr_or_star_expr','comma_expr_or_star_expr_list',1,'p_comma_expr_or_star_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('comma_expr_or_star_expr_list -> comma_expr_or_star_expr_list comma_expr_or_star_expr','comma_expr_or_star_expr_list',2,'p_comma_expr_or_star_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('comma_import_as_name_list -> comma_import_as_name','comma_import_as_name_list',1,'p_comma_import_as_name_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('comma_import_as_name_list -> comma_import_as_name_list comma_import_as_name','comma_import_as_name_list',2,'p_comma_import_as_name_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('comma_item_list -> comma_item','comma_item_list',1,'p_comma_item_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('comma_item_list -> comma_item_list comma_item','comma_item_list',2,'p_comma_item_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('comma_name_list -> comma_name','comma_name_list',1,'p_comma_name_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('comma_name_list -> comma_name_list comma_name','comma_name_list',2,'p_comma_name_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('comma_subscript_list -> comma_subscript','comma_subscript_list',1,'p_comma_subscript_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('comma_subscript_list -> comma_subscript_list comma_subscript','comma_subscript_list',2,'p_comma_subscript_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('comma_test_list -> comma_test','comma_test_list',1,'p_comma_test_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('comma_test_list -> comma_test_list comma_test','comma_test_list',2,'p_comma_test_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('comma_test_or_star_expr_list -> comma_test_or_star_expr','comma_test_or_star_expr_list',1,'p_comma_test_or_star_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('comma_test_or_star_expr_list -> comma_test_or_star_expr_list comma_test_or_star_expr','comma_test_or_star_expr_list',2,'p_comma_test_or_star_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('comma_tfpdef_list -> comma_tfpdef','comma_tfpdef_list',1,'p_comma_tfpdef_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('comma_tfpdef_list -> comma_tfpdef_list comma_tfpdef','comma_tfpdef_list',2,'p_comma_tfpdef_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('comma_vfpdef_list -> comma_vfpdef','comma_vfpdef_list',1,'p_comma_vfpdef_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('comma_vfpdef_list -> comma_vfpdef_list comma_vfpdef','comma_vfpdef_list',2,'p_comma_vfpdef_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('comma_with_item_list -> comma_with_item','comma_with_item_list',1,'p_comma_with_item_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('comma_with_item_list -> comma_with_item_list comma_with_item','comma_with_item_list',2,'p_comma_with_item_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('comp_op_expr_list -> comp_op_expr','comp_op_expr_list',1,'p_comp_op_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('comp_op_expr_list -> comp_op_expr_list comp_op_expr','comp_op_expr_list',2,'p_comp_op_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('elif_part_list -> elif_part','elif_part_list',1,'p_elif_part_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('elif_part_list -> elif_part_list elif_part','elif_part_list',2,'p_elif_part_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('equals_yield_expr_or_testlist_list -> equals_yield_expr_or_testlist','equals_yield_expr_or_testlist_list',1,'p_equals_yield_expr_or_testlist_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('equals_yield_expr_or_testlist_list -> equals_yield_expr_or_testlist_list equals_yield_expr_or_testlist','equals_yield_expr_or_testlist_list',2,'p_equals_yield_expr_or_testlist_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('except_part_list -> except_part','except_part_list',1,'p_except_part_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('except_part_list -> except_part_list except_part','except_part_list',2,'p_except_part_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('op_factor_list -> op_factor','op_factor_list',1,'p_op_factor_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('op_factor_list -> op_factor_list op_factor','op_factor_list',2,'p_op_factor_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('or_and_test_list -> or_and_test','or_and_test_list',1,'p_or_and_test_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('or_and_test_list -> or_and_test_list or_and_test','or_and_test_list',2,'p_or_and_test_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('period_name_list -> period_name','period_name_list',1,'p_period_name_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('period_name_list -> period_name_list period_name','period_name_list',2,'p_period_name_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('period_or_ellipsis_list -> period_or_ellipsis','period_or_ellipsis_list',1,'p_period_or_ellipsis_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('period_or_ellipsis_list -> period_or_ellipsis_list period_or_ellipsis','period_or_ellipsis_list',2,'p_period_or_ellipsis_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('pipe_xor_expr_list -> pipe_xor_expr','pipe_xor_expr_list',1,'p_pipe_xor_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('pipe_xor_expr_list -> pipe_xor_expr_list pipe_xor_expr','pipe_xor_expr_list',2,'p_pipe_xor_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('pm_term_list -> pm_term','pm_term_list',1,'p_pm_term_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('pm_term_list -> pm_term_list pm_term','pm_term_list',2,'p_pm_term_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('semi_small_stmt_list -> semi_small_stmt','semi_small_stmt_list',1,'p_semi_small_stmt_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('semi_small_stmt_list -> semi_small_stmt_list semi_small_stmt','semi_small_stmt_list',2,'p_semi_small_stmt_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('shift_arith_expr_list -> shift_arith_expr','shift_arith_expr_list',1,'p_shift_arith_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('shift_arith_expr_list -> shift_arith_expr_list shift_arith_expr','shift_arith_expr_list',2,'p_shift_arith_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('test_comma_list -> test_comma','test_comma_list',1,'p_test_comma_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('test_comma_list -> test_comma_list test_comma','test_comma_list',2,'p_test_comma_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('test_or_star_expr_list -> test_or_star_expr','test_or_star_expr_list',1,'p_test_or_star_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('test_or_star_expr_list -> test_or_star_expr_list test_or_star_expr','test_or_star_expr_list',2,'p_test_or_star_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('trailer_list -> trailer','trailer_list',1,'p_trailer_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('trailer_list -> trailer_list trailer','trailer_list',2,'p_trailer_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('xor_and_expr_list -> xor_and_expr','xor_and_expr_list',1,'p_xor_and_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',298), ('xor_and_expr_list -> xor_and_expr_list xor_and_expr','xor_and_expr_list',2,'p_xor_and_expr_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',299), ('start_symbols -> single_input','start_symbols',1,'p_start_symbols','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',350), ('start_symbols -> file_input','start_symbols',1,'p_start_symbols','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',351), ('start_symbols -> eval_input','start_symbols',1,'p_start_symbols','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',352), ('start_symbols -> empty','start_symbols',1,'p_start_symbols','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',353), ('single_input -> compound_stmt NEWLINE','single_input',2,'p_single_input','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',358), ('file_input -> file_stmts','file_input',1,'p_file_input','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',365), ('file_stmts -> newline_or_stmt','file_stmts',1,'p_file_stmts','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',369), ('file_stmts -> file_stmts newline_or_stmt','file_stmts',2,'p_file_stmts','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',370), ('newline_or_stmt -> NEWLINE','newline_or_stmt',1,'p_newline_or_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',382), ('newline_or_stmt -> stmt','newline_or_stmt',1,'p_newline_or_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',383), ('newlines -> NEWLINE','newlines',1,'p_newlines','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',388), ('newlines -> newlines NEWLINE','newlines',2,'p_newlines','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',389), ('eval_input -> testlist newlines_opt','eval_input',2,'p_eval_input','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',394), ('func_call -> LPAREN arglist_opt RPAREN','func_call',3,'p_func_call','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',399), ('attr_period_name -> PERIOD NAME','attr_period_name',2,'p_attr_period_name','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',403), ('attr_name -> NAME','attr_name',1,'p_attr_name','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',407), ('attr_name -> NAME attr_period_name_list','attr_name',2,'p_attr_name','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',408), ('decorator -> AT attr_name NEWLINE','decorator',3,'p_decorator','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',433), ('decorator -> AT attr_name func_call NEWLINE','decorator',4,'p_decorator','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',434), ('decorators -> decorator','decorators',1,'p_decorators','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',456), ('decorators -> decorators decorator','decorators',2,'p_decorators','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',457), ('classdef_or_funcdef -> classdef','classdef_or_funcdef',1,'p_classdef_or_funcdef','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',462), ('classdef_or_funcdef -> funcdef','classdef_or_funcdef',1,'p_classdef_or_funcdef','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',463), ('classdef_or_funcdef -> async_funcdef','classdef_or_funcdef',1,'p_classdef_or_funcdef','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',464), ('decorated -> decorators classdef_or_funcdef','decorated',2,'p_decorated','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',476), ('rarrow_test -> RARROW test','rarrow_test',2,'p_rarrow_test','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',482), ('funcdef -> DEF NAME parameters rarrow_test_opt COLON suite','funcdef',6,'p_funcdef','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',486), ('async_funcdef -> ASYNC funcdef','async_funcdef',2,'p_async_funcdef','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',497), ('parameters -> LPAREN typedargslist_opt RPAREN','parameters',3,'p_parameters','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',502), ('equals_test -> EQUALS test','equals_test',2,'p_equals_test','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',514), ('typedargslist -> tfpdef equals_test_opt comma_tfpdef_list_opt comma_opt','typedargslist',4,'p_typedargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',518), ('typedargslist -> tfpdef equals_test_opt comma_tfpdef_list_opt comma_opt TIMES tfpdef_opt COMMA POW vfpdef','typedargslist',9,'p_typedargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',519), ('typedargslist -> tfpdef equals_test_opt comma_tfpdef_list_opt comma_opt TIMES tfpdef_opt comma_tfpdef_list_opt','typedargslist',7,'p_typedargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',520), ('typedargslist -> tfpdef equals_test_opt comma_tfpdef_list_opt comma_opt TIMES tfpdef_opt comma_tfpdef_list COMMA POW tfpdef','typedargslist',10,'p_typedargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',521), ('typedargslist -> tfpdef equals_test_opt comma_tfpdef_list_opt comma_opt POW tfpdef','typedargslist',6,'p_typedargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',522), ('typedargslist -> TIMES tfpdef_opt comma_tfpdef_list comma_pow_tfpdef_opt','typedargslist',4,'p_typedargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',523), ('typedargslist -> TIMES tfpdef_opt comma_pow_tfpdef_opt','typedargslist',3,'p_typedargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',524), ('typedargslist -> POW tfpdef','typedargslist',2,'p_typedargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',525), ('colon_test -> COLON test','colon_test',2,'p_colon_test','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',579), ('tfpdef -> NAME colon_test_opt','tfpdef',2,'p_tfpdef','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',583), ('comma_tfpdef -> COMMA','comma_tfpdef',1,'p_comma_tfpdef','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',587), ('comma_tfpdef -> COMMA tfpdef equals_test_opt','comma_tfpdef',3,'p_comma_tfpdef','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',588), ('comma_pow_tfpdef -> COMMA POW tfpdef','comma_pow_tfpdef',3,'p_comma_pow_tfpdef','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',596), ('varargslist -> vfpdef equals_test_opt comma_vfpdef_list_opt comma_opt','varargslist',4,'p_varargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',641), ('varargslist -> vfpdef equals_test_opt comma_vfpdef_list_opt comma_opt TIMES vfpdef_opt COMMA POW vfpdef','varargslist',9,'p_varargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',642), ('varargslist -> vfpdef equals_test_opt comma_vfpdef_list_opt comma_opt TIMES vfpdef_opt comma_vfpdef_list_opt','varargslist',7,'p_varargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',643), ('varargslist -> vfpdef equals_test_opt comma_vfpdef_list_opt comma_opt TIMES vfpdef_opt comma_vfpdef_list COMMA POW vfpdef','varargslist',10,'p_varargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',644), ('varargslist -> vfpdef equals_test_opt comma_vfpdef_list_opt comma_opt POW vfpdef','varargslist',6,'p_varargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',645), ('varargslist -> TIMES vfpdef_opt comma_vfpdef_list comma_pow_vfpdef_opt','varargslist',4,'p_varargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',646), ('varargslist -> TIMES vfpdef_opt comma_pow_vfpdef_opt','varargslist',3,'p_varargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',647), ('varargslist -> POW vfpdef','varargslist',2,'p_varargslist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',648), ('vfpdef -> NAME','vfpdef',1,'p_vfpdef','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',702), ('comma_vfpdef -> COMMA','comma_vfpdef',1,'p_comma_vfpdef','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',706), ('comma_vfpdef -> COMMA vfpdef equals_test_opt','comma_vfpdef',3,'p_comma_vfpdef','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',707), ('comma_pow_vfpdef -> COMMA POW vfpdef','comma_pow_vfpdef',3,'p_comma_pow_vfpdef','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',715), ('stmt -> simple_stmt','stmt',1,'p_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',719), ('stmt -> compound_stmt','stmt',1,'p_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',720), ('stmt_list -> stmt','stmt_list',1,'p_stmt_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',725), ('stmt_list -> stmt_list stmt','stmt_list',2,'p_stmt_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',726), ('semi_opt -> SEMI','semi_opt',1,'p_semi_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',733), ('semi_opt -> empty','semi_opt',1,'p_semi_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',734), ('semi_small_stmt -> SEMI small_stmt','semi_small_stmt',2,'p_semi_small_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',740), ('simple_stmt -> small_stmt semi_small_stmt_list semi_opt NEWLINE','simple_stmt',4,'p_simple_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',744), ('simple_stmt -> small_stmt semi_opt NEWLINE','simple_stmt',3,'p_simple_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',745), ('small_stmt -> expr_stmt','small_stmt',1,'p_small_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',754), ('small_stmt -> del_stmt','small_stmt',1,'p_small_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',755), ('small_stmt -> pass_stmt','small_stmt',1,'p_small_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',756), ('small_stmt -> flow_stmt','small_stmt',1,'p_small_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',757), ('small_stmt -> import_stmt','small_stmt',1,'p_small_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',758), ('small_stmt -> global_stmt','small_stmt',1,'p_small_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',759), ('small_stmt -> nonlocal_stmt','small_stmt',1,'p_small_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',760), ('small_stmt -> assert_stmt','small_stmt',1,'p_small_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',761), ('expr_stmt -> testlist_star_expr augassign yield_expr_or_testlist','expr_stmt',3,'p_expr_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',782), ('expr_stmt -> testlist_star_expr equals_yield_expr_or_testlist_list_opt','expr_stmt',2,'p_expr_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',783), ('expr_stmt -> testlist equals_yield_expr_or_testlist_list_opt','expr_stmt',2,'p_expr_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',784), ('expr_stmt -> test_comma_list_opt star_expr comma_test_list equals_yield_expr_or_testlist','expr_stmt',4,'p_expr_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',785), ('expr_stmt -> test_comma_list_opt star_expr comma_opt test_comma_list_opt equals_yield_expr_or_testlist','expr_stmt',5,'p_expr_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',786), ('test_comma -> test COMMA','test_comma',2,'p_test_comma','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',837), ('comma_opt -> COMMA','comma_opt',1,'p_comma_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',841), ('comma_opt -> empty','comma_opt',1,'p_comma_opt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',842), ('test_or_star_expr -> test','test_or_star_expr',1,'p_test_or_star_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',848), ('test_or_star_expr -> star_expr','test_or_star_expr',1,'p_test_or_star_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',849), ('comma_test_or_star_expr -> COMMA test_or_star_expr','comma_test_or_star_expr',2,'p_comma_test_or_star_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',854), ('testlist_star_expr -> test_or_star_expr comma_test_or_star_expr_list comma_opt','testlist_star_expr',3,'p_testlist_star_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',858), ('testlist_star_expr -> test_or_star_expr comma_opt','testlist_star_expr',2,'p_testlist_star_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',859), ('augassign -> PLUSEQUAL','augassign',1,'p_augassign','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',877), ('augassign -> MINUSEQUAL','augassign',1,'p_augassign','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',878), ('augassign -> TIMESEQUAL','augassign',1,'p_augassign','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',879), ('augassign -> ATEQUAL','augassign',1,'p_augassign','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',880), ('augassign -> DIVEQUAL','augassign',1,'p_augassign','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',881), ('augassign -> MODEQUAL','augassign',1,'p_augassign','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',882), ('augassign -> AMPERSANDEQUAL','augassign',1,'p_augassign','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',883), ('augassign -> PIPEEQUAL','augassign',1,'p_augassign','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',884), ('augassign -> XOREQUAL','augassign',1,'p_augassign','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',885), ('augassign -> LSHIFTEQUAL','augassign',1,'p_augassign','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',886), ('augassign -> RSHIFTEQUAL','augassign',1,'p_augassign','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',887), ('augassign -> POWEQUAL','augassign',1,'p_augassign','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',888), ('augassign -> DOUBLEDIVEQUAL','augassign',1,'p_augassign','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',889), ('yield_expr_or_testlist -> yield_expr','yield_expr_or_testlist',1,'p_yield_expr_or_testlist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',894), ('yield_expr_or_testlist -> testlist','yield_expr_or_testlist',1,'p_yield_expr_or_testlist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',895), ('equals_yield_expr_or_testlist -> EQUALS yield_expr_or_testlist','equals_yield_expr_or_testlist',2,'p_equals_yield_expr_or_testlist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',900), ('del_stmt -> DEL exprlist','del_stmt',2,'p_del_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',908), ('pass_stmt -> PASS','pass_stmt',1,'p_pass_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',916), ('flow_stmt -> break_stmt','flow_stmt',1,'p_flow_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',920), ('flow_stmt -> continue_stmt','flow_stmt',1,'p_flow_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',921), ('flow_stmt -> return_stmt','flow_stmt',1,'p_flow_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',922), ('flow_stmt -> raise_stmt','flow_stmt',1,'p_flow_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',923), ('flow_stmt -> yield_stmt','flow_stmt',1,'p_flow_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',924), ('break_stmt -> BREAK','break_stmt',1,'p_break_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',929), ('continue_stmt -> CONTINUE','continue_stmt',1,'p_continue_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',933), ('return_stmt -> RETURN testlist_opt','return_stmt',2,'p_return_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',937), ('yield_stmt -> yield_expr','yield_stmt',1,'p_yield_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',941), ('raise_stmt -> RAISE','raise_stmt',1,'p_raise_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',945), ('raise_stmt -> RAISE test','raise_stmt',2,'p_raise_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',946), ('raise_stmt -> RAISE test FROM test','raise_stmt',4,'p_raise_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',947), ('import_stmt -> import_name','import_stmt',1,'p_import_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',967), ('import_stmt -> import_from','import_stmt',1,'p_import_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',968), ('import_name -> IMPORT dotted_as_names','import_name',2,'p_import_name','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',973), ('import_from_pre -> FROM period_or_ellipsis_list_opt dotted_name','import_from_pre',3,'p_import_from_pre','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',978), ('import_from_pre -> FROM period_or_ellipsis_list','import_from_pre',2,'p_import_from_pre','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',979), ('import_from_post -> TIMES','import_from_post',1,'p_import_from_post','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',991), ('import_from_post -> LPAREN import_as_names RPAREN','import_from_post',3,'p_import_from_post','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',992), ('import_from_post -> import_as_names','import_from_post',1,'p_import_from_post','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',993), ('import_from -> import_from_pre IMPORT import_from_post','import_from',3,'p_import_from','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1006), ('period_or_ellipsis -> PERIOD','period_or_ellipsis',1,'p_period_or_ellipsis','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1021), ('period_or_ellipsis -> ELLIPSIS','period_or_ellipsis',1,'p_period_or_ellipsis','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1022), ('as_name -> AS NAME','as_name',2,'p_as_name','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1027), ('import_as_name -> NAME as_name_opt','import_as_name',2,'p_import_as_name','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1031), ('comma_import_as_name -> COMMA import_as_name','comma_import_as_name',2,'p_comma_import_as_name','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1035), ('dotted_as_name -> dotted_name as_name_opt','dotted_as_name',2,'p_dotted_as_name','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1040), ('comma_dotted_as_name -> COMMA dotted_as_name','comma_dotted_as_name',2,'p_comma_dotted_as_name','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1045), ('import_as_names -> import_as_name comma_import_as_name_list_opt comma_opt','import_as_names',3,'p_import_as_names','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1049), ('dotted_as_names -> dotted_as_name comma_dotted_as_name_list_opt','dotted_as_names',2,'p_dotted_as_names','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1058), ('period_name -> PERIOD NAME','period_name',2,'p_period_name','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1066), ('dotted_name -> NAME','dotted_name',1,'p_dotted_name','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1070), ('dotted_name -> NAME period_name_list','dotted_name',2,'p_dotted_name','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1071), ('comma_name -> COMMA NAME','comma_name',2,'p_comma_name','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1076), ('global_stmt -> GLOBAL NAME comma_name_list_opt','global_stmt',3,'p_global_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1080), ('nonlocal_stmt -> NONLOCAL NAME comma_name_list_opt','nonlocal_stmt',3,'p_nonlocal_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1088), ('comma_test -> COMMA test','comma_test',2,'p_comma_test','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1098), ('assert_stmt -> ASSERT test comma_test_opt','assert_stmt',3,'p_assert_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1102), ('compound_stmt -> if_stmt','compound_stmt',1,'p_compound_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1115), ('compound_stmt -> while_stmt','compound_stmt',1,'p_compound_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1116), ('compound_stmt -> for_stmt','compound_stmt',1,'p_compound_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1117), ('compound_stmt -> try_stmt','compound_stmt',1,'p_compound_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1118), ('compound_stmt -> with_stmt','compound_stmt',1,'p_compound_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1119), ('compound_stmt -> funcdef','compound_stmt',1,'p_compound_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1120), ('compound_stmt -> classdef','compound_stmt',1,'p_compound_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1121), ('compound_stmt -> decorated','compound_stmt',1,'p_compound_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1122), ('compound_stmt -> async_stmt','compound_stmt',1,'p_compound_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1123), ('elif_part -> ELIF test COLON suite','elif_part',4,'p_elif_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1128), ('else_part -> ELSE COLON suite','else_part',3,'p_else_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1136), ('if_stmt -> IF test COLON suite elif_part_list_opt','if_stmt',5,'p_if_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1140), ('if_stmt -> IF test COLON suite elif_part_list_opt else_part','if_stmt',6,'p_if_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1141), ('while_stmt -> WHILE test COLON suite','while_stmt',4,'p_while_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1159), ('while_stmt -> WHILE test COLON suite else_part','while_stmt',5,'p_while_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1160), ('for_stmt -> FOR exprlist IN testlist COLON suite','for_stmt',6,'p_for_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1170), ('for_stmt -> FOR exprlist IN testlist COLON suite else_part','for_stmt',7,'p_for_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1171), ('async_for_stmt -> ASYNC for_stmt','async_for_stmt',2,'p_async_for_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1193), ('except_part -> except_clause COLON suite','except_part',3,'p_except_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1198), ('finally_part -> FINALLY COLON suite','finally_part',3,'p_finally_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1204), ('try_stmt -> TRY COLON suite except_part_list else_part finally_part_opt','try_stmt',6,'p_try_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1208), ('try_stmt -> TRY COLON suite except_part_list finally_part_opt','try_stmt',5,'p_try_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1209), ('try_stmt -> TRY COLON suite finally_part','try_stmt',4,'p_try_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1210), ('with_stmt -> WITH with_item COLON suite','with_stmt',4,'p_with_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1231), ('with_stmt -> WITH with_item comma_with_item_list COLON suite','with_stmt',5,'p_with_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1232), ('async_with_stmt -> ASYNC with_stmt','async_with_stmt',2,'p_async_with_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1246), ('as_expr -> AS expr','as_expr',2,'p_as_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1251), ('with_item -> test','with_item',1,'p_with_item','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1257), ('with_item -> test as_expr','with_item',2,'p_with_item','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1258), ('comma_with_item -> COMMA with_item','comma_with_item',2,'p_comma_with_item','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1264), ('except_clause -> EXCEPT','except_clause',1,'p_except_clause','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1268), ('except_clause -> EXCEPT test as_name_opt','except_clause',3,'p_except_clause','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1269), ('async_stmt -> async_funcdef','async_stmt',1,'p_async_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1284), ('async_stmt -> async_with_stmt','async_stmt',1,'p_async_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1285), ('async_stmt -> async_for_stmt','async_stmt',1,'p_async_stmt','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1286), ('suite -> simple_stmt','suite',1,'p_suite','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1291), ('suite -> NEWLINE INDENT stmt_list DEDENT','suite',4,'p_suite','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1292), ('test -> or_test','test',1,'p_test','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1297), ('test -> or_test IF or_test ELSE test','test',5,'p_test','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1298), ('test -> lambdef','test',1,'p_test','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1299), ('test_nocond -> or_test','test_nocond',1,'p_test_nocond','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1312), ('test_nocond -> lambdef_nocond','test_nocond',1,'p_test_nocond','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1313), ('lambdef -> LAMBDA varargslist_opt COLON test','lambdef',4,'p_lambdef','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1318), ('lambdef_nocond -> LAMBDA varargslist_opt COLON test_nocond','lambdef_nocond',4,'p_lambdef_nocond','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1336), ('or_test -> and_test or_and_test_list_opt','or_test',2,'p_or_test','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1340), ('or_and_test -> OR and_test','or_and_test',2,'p_or_and_test','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1357), ('and_test -> not_test and_not_test_list_opt','and_test',2,'p_and_test','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1361), ('and_not_test -> AND not_test','and_not_test',2,'p_and_not_test','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1378), ('not_test -> NOT not_test','not_test',2,'p_not_test','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1382), ('not_test -> comparison','not_test',1,'p_not_test','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1383), ('comparison -> expr comp_op_expr_list_opt','comparison',2,'p_comparison','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1395), ('comp_op_expr -> comp_op expr','comp_op_expr',2,'p_comp_op_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1408), ('comp_op -> LT','comp_op',1,'p_comp_op','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1425), ('comp_op -> GT','comp_op',1,'p_comp_op','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1426), ('comp_op -> EQ','comp_op',1,'p_comp_op','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1427), ('comp_op -> GE','comp_op',1,'p_comp_op','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1428), ('comp_op -> LE','comp_op',1,'p_comp_op','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1429), ('comp_op -> NE','comp_op',1,'p_comp_op','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1430), ('comp_op -> IN','comp_op',1,'p_comp_op','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1431), ('comp_op -> NOT IN','comp_op',2,'p_comp_op','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1432), ('comp_op -> IS','comp_op',1,'p_comp_op','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1433), ('comp_op -> IS NOT','comp_op',2,'p_comp_op','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1434), ('star_expr -> TIMES expr','star_expr',2,'p_star_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1440), ('expr -> xor_expr','expr',1,'p_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1464), ('expr -> xor_expr pipe_xor_expr_list','expr',2,'p_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1465), ('pipe_xor_expr -> PIPE xor_expr','pipe_xor_expr',2,'p_pipe_xor_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1470), ('xor_expr -> and_expr xor_and_expr_list_opt','xor_expr',2,'p_xor_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1478), ('xor_and_expr -> XOR and_expr','xor_and_expr',2,'p_xor_and_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1482), ('and_expr -> shift_expr ampersand_shift_expr_list_opt','and_expr',2,'p_and_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1490), ('ampersand_shift_expr -> AMPERSAND shift_expr','ampersand_shift_expr',2,'p_ampersand_shift_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1494), ('shift_expr -> arith_expr shift_arith_expr_list_opt','shift_expr',2,'p_shift_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1502), ('shift_arith_expr -> LSHIFT arith_expr','shift_arith_expr',2,'p_shift_arith_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1506), ('shift_arith_expr -> RSHIFT arith_expr','shift_arith_expr',2,'p_shift_arith_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1507), ('arith_expr -> term','arith_expr',1,'p_arith_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1517), ('arith_expr -> term pm_term_list','arith_expr',2,'p_arith_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1518), ('pm_term -> PLUS term','pm_term',2,'p_pm_term','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1551), ('pm_term -> MINUS term','pm_term',2,'p_pm_term','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1552), ('term -> factor op_factor_list_opt','term',2,'p_term','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1558), ('op_factor -> TIMES factor','op_factor',2,'p_op_factor','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1580), ('op_factor -> AT factor','op_factor',2,'p_op_factor','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1581), ('op_factor -> DIVIDE factor','op_factor',2,'p_op_factor','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1582), ('op_factor -> MOD factor','op_factor',2,'p_op_factor','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1583), ('op_factor -> DOUBLEDIV factor','op_factor',2,'p_op_factor','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1584), ('factor -> PLUS factor','factor',2,'p_factor','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1595), ('factor -> MINUS factor','factor',2,'p_factor','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1596), ('factor -> TILDE factor','factor',2,'p_factor','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1597), ('factor -> power','factor',1,'p_factor','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1598), ('power -> atom_expr','power',1,'p_power','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1611), ('power -> atom_expr POW factor','power',3,'p_power','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1612), ('yield_expr_or_testlist_comp -> yield_expr','yield_expr_or_testlist_comp',1,'p_yield_expr_or_testlist_comp','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1628), ('yield_expr_or_testlist_comp -> testlist_comp','yield_expr_or_testlist_comp',1,'p_yield_expr_or_testlist_comp','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1629), ('atom_expr -> atom trailer_list_opt','atom_expr',2,'p_atom_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1642), ('atom_expr -> AWAIT atom trailer_list_opt','atom_expr',3,'p_atom_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1643), ('atom -> LPAREN yield_expr_or_testlist_comp_opt RPAREN','atom',3,'p_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1692), ('atom -> LBRACKET testlist_comp_opt RBRACKET','atom',3,'p_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1693), ('atom -> LBRACE dictorsetmaker_opt RBRACE','atom',3,'p_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1694), ('atom -> NAME','atom',1,'p_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1695), ('atom -> number','atom',1,'p_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1696), ('atom -> string_literal_list','atom',1,'p_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1697), ('atom -> ELLIPSIS','atom',1,'p_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1698), ('atom -> NONE','atom',1,'p_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1699), ('atom -> TRUE','atom',1,'p_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1700), ('atom -> FALSE','atom',1,'p_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1701), ('atom -> REGEXPATH','atom',1,'p_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1702), ('atom -> DOLLAR_NAME','atom',1,'p_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1703), ('atom -> DOLLAR_LBRACE test RBRACE','atom',3,'p_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1704), ('atom -> DOLLAR_LPAREN subproc RPAREN','atom',3,'p_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1705), ('atom -> DOLLAR_LBRACKET subproc RBRACKET','atom',3,'p_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1706), ('string_literal -> STRING','string_literal',1,'p_string_literal','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1801), ('string_literal_list -> string_literal','string_literal_list',1,'p_string_literal_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1807), ('string_literal_list -> string_literal_list string_literal','string_literal_list',2,'p_string_literal_list','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1808), ('number -> NUMBER','number',1,'p_number','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1815), ('testlist_comp -> test_or_star_expr comp_for','testlist_comp',2,'p_testlist_comp','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1819), ('testlist_comp -> test_or_star_expr comma_opt','testlist_comp',2,'p_testlist_comp','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1820), ('testlist_comp -> test_or_star_expr comma_test_or_star_expr_list comma_opt','testlist_comp',3,'p_testlist_comp','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1821), ('trailer -> LPAREN arglist_opt RPAREN','trailer',3,'p_trailer','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1854), ('trailer -> LBRACKET subscriptlist RBRACKET','trailer',3,'p_trailer','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1855), ('trailer -> PERIOD NAME','trailer',2,'p_trailer','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1856), ('trailer -> DOUBLE_QUESTION','trailer',1,'p_trailer','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1857), ('trailer -> QUESTION','trailer',1,'p_trailer','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1858), ('subscriptlist -> subscript comma_subscript_list_opt comma_opt','subscriptlist',3,'p_subscriptlist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1875), ('comma_subscript -> COMMA subscript','comma_subscript',2,'p_comma_subscript','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1885), ('subscript -> test','subscript',1,'p_subscript','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1889), ('subscript -> test_opt COLON test_opt sliceop_opt','subscript',4,'p_subscript','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1890), ('sliceop -> COLON test_opt','sliceop',2,'p_sliceop','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1899), ('expr_or_star_expr -> expr','expr_or_star_expr',1,'p_expr_or_star_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1903), ('expr_or_star_expr -> star_expr','expr_or_star_expr',1,'p_expr_or_star_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1904), ('comma_expr_or_star_expr -> COMMA expr_or_star_expr','comma_expr_or_star_expr',2,'p_comma_expr_or_star_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1909), ('exprlist -> expr_or_star_expr comma_expr_or_star_expr_list comma_opt','exprlist',3,'p_exprlist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1913), ('exprlist -> expr_or_star_expr comma_opt','exprlist',2,'p_exprlist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1914), ('testlist -> test comma_test_list COMMA','testlist',3,'p_testlist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1930), ('testlist -> test comma_test_list','testlist',2,'p_testlist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1931), ('testlist -> test COMMA','testlist',2,'p_testlist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1932), ('testlist -> test','testlist',1,'p_testlist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1933), ('item -> test COLON test','item',3,'p_item','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1954), ('item -> POW expr','item',2,'p_item','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1955), ('comma_item -> COMMA item','comma_item',2,'p_comma_item','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1971), ('dictorsetmaker -> item comp_for','dictorsetmaker',2,'p_dictorsetmaker','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1975), ('dictorsetmaker -> test_or_star_expr comp_for','dictorsetmaker',2,'p_dictorsetmaker','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1976), ('dictorsetmaker -> testlist','dictorsetmaker',1,'p_dictorsetmaker','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1977), ('dictorsetmaker -> test_or_star_expr comma_opt','dictorsetmaker',2,'p_dictorsetmaker','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1978), ('dictorsetmaker -> test_or_star_expr comma_test_or_star_expr_list comma_opt','dictorsetmaker',3,'p_dictorsetmaker','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1979), ('dictorsetmaker -> test COLON testlist','dictorsetmaker',3,'p_dictorsetmaker','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1980), ('dictorsetmaker -> item comma_item_list comma_opt','dictorsetmaker',3,'p_dictorsetmaker','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1981), ('dictorsetmaker -> test COLON test comma_item_list comma_opt','dictorsetmaker',5,'p_dictorsetmaker','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',1982), ('classdef -> CLASS NAME func_call_opt COLON suite','classdef',5,'p_classdef','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2040), ('arglist -> argument comma_opt','arglist',2,'p_arglist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2070), ('arglist -> argument comma_argument_list comma_opt','arglist',3,'p_arglist','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2071), ('comma_argument -> COMMA argument','comma_argument',2,'p_comma_argument','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2137), ('argument -> test_or_star_expr','argument',1,'p_argument','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2141), ('argument -> test comp_for','argument',2,'p_argument','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2142), ('argument -> test EQUALS test','argument',3,'p_argument','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2143), ('argument -> POW test','argument',2,'p_argument','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2144), ('argument -> TIMES test','argument',2,'p_argument','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2145), ('comp_iter -> comp_for','comp_iter',1,'p_comp_iter','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2187), ('comp_iter -> comp_if','comp_iter',1,'p_comp_iter','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2188), ('comp_for -> FOR exprlist IN or_test comp_iter_opt','comp_for',5,'p_comp_for','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2193), ('comp_if -> IF test_nocond comp_iter_opt','comp_if',3,'p_comp_if','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2210), ('yield_expr -> YIELD yield_arg_opt','yield_expr',2,'p_yield_expr','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2218), ('yield_arg -> FROM test','yield_arg',2,'p_yield_arg','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2233), ('yield_arg -> testlist','yield_arg',1,'p_yield_arg','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2234), ('pipe -> PIPE','pipe',1,'p_pipe','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2324), ('pipe -> WS PIPE','pipe',2,'p_pipe','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2325), ('pipe -> PIPE WS','pipe',2,'p_pipe','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2326), ('pipe -> WS PIPE WS','pipe',3,'p_pipe','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2327), ('subproc -> subproc_atoms','subproc',1,'p_subproc','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2335), ('subproc -> subproc_atoms WS','subproc',2,'p_subproc','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2336), ('subproc -> subproc AMPERSAND','subproc',2,'p_subproc','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2337), ('subproc -> subproc pipe subproc_atoms','subproc',3,'p_subproc','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2338), ('subproc -> subproc pipe subproc_atoms WS','subproc',4,'p_subproc','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2339), ('subproc_atoms -> subproc_atom','subproc_atoms',1,'p_subproc_atoms','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2361), ('subproc_atoms -> subproc_atoms WS subproc_atom','subproc_atoms',3,'p_subproc_atoms','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2362), ('subproc_atom -> subproc_arg','subproc_atom',1,'p_subproc_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2372), ('subproc_atom -> string_literal','subproc_atom',1,'p_subproc_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2373), ('subproc_atom -> REGEXPATH','subproc_atom',1,'p_subproc_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2374), ('subproc_atom -> DOLLAR_NAME','subproc_atom',1,'p_subproc_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2375), ('subproc_atom -> GT','subproc_atom',1,'p_subproc_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2376), ('subproc_atom -> LT','subproc_atom',1,'p_subproc_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2377), ('subproc_atom -> RSHIFT','subproc_atom',1,'p_subproc_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2378), ('subproc_atom -> IOREDIRECT','subproc_atom',1,'p_subproc_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2379), ('subproc_atom -> AT_LPAREN test RPAREN','subproc_atom',3,'p_subproc_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2380), ('subproc_atom -> DOLLAR_LBRACE test RBRACE','subproc_atom',3,'p_subproc_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2381), ('subproc_atom -> DOLLAR_LPAREN subproc RPAREN','subproc_atom',3,'p_subproc_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2382), ('subproc_atom -> DOLLAR_LBRACKET subproc RBRACKET','subproc_atom',3,'p_subproc_atom','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2383), ('subproc_arg -> subproc_arg_part','subproc_arg',1,'p_subproc_arg','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2448), ('subproc_arg -> subproc_arg subproc_arg_part','subproc_arg',2,'p_subproc_arg','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2449), ('subproc_arg_part -> NAME','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2460), ('subproc_arg_part -> TILDE','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2461), ('subproc_arg_part -> PERIOD','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2462), ('subproc_arg_part -> DIVIDE','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2463), ('subproc_arg_part -> MINUS','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2464), ('subproc_arg_part -> PLUS','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2465), ('subproc_arg_part -> COLON','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2466), ('subproc_arg_part -> AT','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2467), ('subproc_arg_part -> EQUALS','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2468), ('subproc_arg_part -> TIMES','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2469), ('subproc_arg_part -> POW','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2470), ('subproc_arg_part -> MOD','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2471), ('subproc_arg_part -> XOR','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2472), ('subproc_arg_part -> DOUBLEDIV','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2473), ('subproc_arg_part -> ELLIPSIS','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2474), ('subproc_arg_part -> NONE','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2475), ('subproc_arg_part -> TRUE','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2476), ('subproc_arg_part -> FALSE','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2477), ('subproc_arg_part -> NUMBER','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2478), ('subproc_arg_part -> STRING','subproc_arg_part',1,'p_subproc_arg_part','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2479), ('empty -> <empty>','empty',0,'p_empty','/usr/local/lib/python3.5/site-packages/xonsh/parser.py',2490), ]
d7b27284fcf8e687c0ce5cdc8fc1586f625817db
26aeec7c6571012e85cd6bdd42560988664dc845
/0x04-python-more_data_structures/1-search_replace.py
bf02407fb835033abc2ea61c84569a868d1e5c89
[]
no_license
KoeusIss/holbertonschool-higher_level_programming
3d6ac70d9630c516fa95fcd2d6209d8591bf4169
446ca491156ac93134e5c15f3568cb684079d67e
refs/heads/master
2022-12-11T15:22:58.164551
2020-09-24T09:51:45
2020-09-24T09:51:45
259,189,990
1
4
null
null
null
null
UTF-8
Python
false
false
210
py
#!/usr/bin/python3 def search_replace(my_list, search, replace): """ Replaces all occurences of an element by another in a new list """ return [(replace if x == search else x) for x in my_list]
ca1da8e85b269c0081f63c09d3201e66d15324ae
131921d5ed69ac5d470520a3fbb651d1374a668d
/accounts/models.py
e04dcc920bc257ac68ee4d62006da384f97c2532
[]
no_license
SyedMaazHassan/temporary-one
07fc31673b3eb8368014878a22c747d39b259cb3
cc67107cabcb2a092b79fbc7d8b5369592a15241
refs/heads/master
2023-03-02T11:28:08.813659
2021-02-10T10:02:52
2021-02-10T10:02:52
337,535,351
0
0
null
null
null
null
UTF-8
Python
false
false
2,924
py
import uuid from django.dispatch import receiver from django.db import models from django.contrib.auth.models import ( BaseUserManager, AbstractBaseUser ) from django.db.models.signals import post_save from saidatech_admin.models import saidatech_admin_profile class MyUserManager(BaseUserManager): def create_user(self, email, date_of_birth, password=None): """ Creates and saves a User with the given email, date of birth and password. """ if not email: raise ValueError('Users must have an email address') user = self.model( email=self.normalize_email(email), date_of_birth=date_of_birth, ) user.set_password(password) user.save(using=self._db) return user def create_superuser(self, email, date_of_birth, password): """ Creates and saves a superuser with the given email, date of birth and password. """ user = self.create_user( email, password=password, date_of_birth=date_of_birth, ) user.is_admin = True user.save(using=self._db) return user class MyUser(AbstractBaseUser): id=models.UUIDField( primary_key = True, editable = False,default=uuid.uuid4()) role=models.CharField(max_length=10,choices=[('Instructor', 'Instructor'), ('Student', 'Student')]) email = models.EmailField( verbose_name='email address', max_length=255, unique=True, ) date_of_birth = models.DateField(null =True) is_active = models.BooleanField(default=True) is_admin = models.BooleanField(default=False) objects = MyUserManager() REQUIRED_FIELDS = ['date_of_birth'] USERNAME_FIELD = 'email' is_active=models.BooleanField(default=True) def get_full_name(self): # The user is identified by their email address return self.email def get_short_name(self): # The user is identified by their email address return self.email def __str__(self): # __unicode__ on Python 2 return self.email def has_perm(self, perm, obj=None): "Does the user have a specific permission?" # Simplest possible answer: Yes, always return True def has_module_perms(self, app_label): "Does the user have permissions to view the app `app_label`?" # Simplest possible answer: Yes, always return True @property def is_staff(self): "Is the user a member of staff?" # Simplest possible answer: All admins are staff return self.is_admin @receiver(post_save, sender=MyUser) def create_admin_profile(sender, instance, created, **kwargs): if created: if sender.is_admin: print("Na me b IID", MyUser.id) #saidatech_admin_profile.objects.create(saidatech_admin_id=instance)
aacf5dba2a25fe59933c529c454fa74f4d0e7abb
666c1b8a36d85e33cae95c5b13f5212098492586
/openpyxl/worksheet/filters.py
e8242d6b2cd517b0b591745dc333e6780dcbf38e
[ "MIT" ]
permissive
nickpell/openpyxl
1e5f2d0757bd254271e9eb9fdec1d8423984afc4
160c730c419f3796d2208b05c3b26a2b2fc10eb1
refs/heads/master
2020-04-10T01:46:45.896392
2018-12-06T20:15:17
2018-12-06T20:15:17
160,725,268
0
0
null
null
null
null
UTF-8
Python
false
false
10,946
py
from __future__ import absolute_import # Copyright (c) 2010-2018 openpyxl from openpyxl.compat import unicode from openpyxl.descriptors.serialisable import Serialisable from openpyxl.descriptors import ( Alias, Typed, Set, Float, DateTime, NoneSet, Bool, Integer, String, Sequence, MinMax, ) from openpyxl.descriptors.excel import ExtensionList, CellRange from openpyxl.descriptors.sequence import ValueSequence class SortCondition(Serialisable): tagname = "sortCondition" descending = Bool(allow_none=True) sortBy = NoneSet(values=(['value', 'cellColor', 'fontColor', 'icon'])) ref = CellRange() customList = String(allow_none=True) dxfId = Integer(allow_none=True) iconSet = NoneSet(values=(['3Arrows', '3ArrowsGray', '3Flags', '3TrafficLights1', '3TrafficLights2', '3Signs', '3Symbols', '3Symbols2', '4Arrows', '4ArrowsGray', '4RedToBlack', '4Rating', '4TrafficLights', '5Arrows', '5ArrowsGray', '5Rating', '5Quarters'])) iconId = Integer(allow_none=True) def __init__(self, ref=None, descending=None, sortBy=None, customList=None, dxfId=None, iconSet=None, iconId=None, ): self.descending = descending self.sortBy = sortBy self.ref = ref self.customList = customList self.dxfId = dxfId self.iconSet = iconSet self.iconId = iconId class SortState(Serialisable): tagname = "sortState" columnSort = Bool(allow_none=True) caseSensitive = Bool(allow_none=True) sortMethod = NoneSet(values=(['stroke', 'pinYin'])) ref = CellRange() sortCondition = Sequence(expected_type=SortCondition, allow_none=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ('sortCondition',) def __init__(self, columnSort=None, caseSensitive=None, sortMethod=None, ref=None, sortCondition=(), extLst=None, ): self.columnSort = columnSort self.caseSensitive = caseSensitive self.sortMethod = sortMethod self.ref = ref self.sortCondition = sortCondition def __bool__(self): return self.ref is not None __nonzero__ = __bool__ class IconFilter(Serialisable): tagname = "iconFilter" iconSet = Set(values=(['3Arrows', '3ArrowsGray', '3Flags', '3TrafficLights1', '3TrafficLights2', '3Signs', '3Symbols', '3Symbols2', '4Arrows', '4ArrowsGray', '4RedToBlack', '4Rating', '4TrafficLights', '5Arrows', '5ArrowsGray', '5Rating', '5Quarters'])) iconId = Integer(allow_none=True) def __init__(self, iconSet=None, iconId=None, ): self.iconSet = iconSet self.iconId = iconId class ColorFilter(Serialisable): tagname = "colorFilter" dxfId = Integer(allow_none=True) cellColor = Bool(allow_none=True) def __init__(self, dxfId=None, cellColor=None, ): self.dxfId = dxfId self.cellColor = cellColor class DynamicFilter(Serialisable): tagname = "dynamicFilter" type = Set(values=(['null', 'aboveAverage', 'belowAverage', 'tomorrow', 'today', 'yesterday', 'nextWeek', 'thisWeek', 'lastWeek', 'nextMonth', 'thisMonth', 'lastMonth', 'nextQuarter', 'thisQuarter', 'lastQuarter', 'nextYear', 'thisYear', 'lastYear', 'yearToDate', 'Q1', 'Q2', 'Q3', 'Q4', 'M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', 'M8', 'M9', 'M10', 'M11', 'M12'])) val = Float(allow_none=True) valIso = DateTime(allow_none=True) maxVal = Float(allow_none=True) maxValIso = DateTime(allow_none=True) def __init__(self, type=None, val=None, valIso=None, maxVal=None, maxValIso=None, ): self.type = type self.val = val self.valIso = valIso self.maxVal = maxVal self.maxValIso = maxValIso class CustomFilter(Serialisable): tagname = "customFilter" operator = NoneSet(values=(['equal', 'lessThan', 'lessThanOrEqual', 'notEqual', 'greaterThanOrEqual', 'greaterThan'])) val = String() def __init__(self, operator=None, val=None, ): self.operator = operator self.val = val class CustomFilters(Serialisable): tagname = "customFilters" _and = Bool(allow_none=True) customFilter = Sequence(expected_type=CustomFilter) # min 1, max 2 __elements__ = ('customFilter',) def __init__(self, _and=None, customFilter=(), ): self._and = _and self.customFilter = customFilter class Top10(Serialisable): tagname = "top10" top = Bool(allow_none=True) percent = Bool(allow_none=True) val = Float() filterVal = Float(allow_none=True) def __init__(self, top=None, percent=None, val=None, filterVal=None, ): self.top = top self.percent = percent self.val = val self.filterVal = filterVal class DateGroupItem(Serialisable): tagname = "dateGroupItem" year = Integer() month = MinMax(min=1, max=12, allow_none=True) day = MinMax(min=1, max=31, allow_none=True) hour = MinMax(min=0, max=23, allow_none=True) minute = MinMax(min=0, max=59, allow_none=True) second = Integer(min=0, max=59, allow_none=True) dateTimeGrouping = Set(values=(['year', 'month', 'day', 'hour', 'minute', 'second'])) def __init__(self, year=None, month=None, day=None, hour=None, minute=None, second=None, dateTimeGrouping=None, ): self.year = year self.month = month self.day = day self.hour = hour self.minute = minute self.second = second self.dateTimeGrouping = dateTimeGrouping class Filters(Serialisable): tagname = "filters" blank = Bool(allow_none=True) calendarType = NoneSet(values=["gregorian","gregorianUs", "gregorianMeFrench","gregorianArabic", "hijri","hebrew", "taiwan","japan", "thai","korea", "saka","gregorianXlitEnglish","gregorianXlitFrench"]) filter = ValueSequence(expected_type=unicode) dateGroupItem = Sequence(expected_type=DateGroupItem, allow_none=True) __elements__ = ('filter', 'dateGroupItem') def __init__(self, blank=None, calendarType=None, filter=(), dateGroupItem=(), ): self.blank = blank self.calendarType = calendarType self.filter = filter self.dateGroupItem = dateGroupItem class FilterColumn(Serialisable): tagname = "filterColumn" colId = Integer() col_id = Alias('colId') hiddenButton = Bool(allow_none=True) showButton = Bool(allow_none=True) # some elements are choice filters = Typed(expected_type=Filters, allow_none=True) top10 = Typed(expected_type=Top10, allow_none=True) customFilters = Typed(expected_type=CustomFilters, allow_none=True) dynamicFilter = Typed(expected_type=DynamicFilter, allow_none=True) colorFilter = Typed(expected_type=ColorFilter, allow_none=True) iconFilter = Typed(expected_type=IconFilter, allow_none=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ('filters', 'top10', 'customFilters', 'dynamicFilter', 'colorFilter', 'iconFilter') def __init__(self, colId=None, hiddenButton=None, showButton=None, filters=None, top10=None, customFilters=None, dynamicFilter=None, colorFilter=None, iconFilter=None, extLst=None, blank=None, vals=None, ): self.colId = colId self.hiddenButton = hiddenButton self.showButton = showButton self.filters = filters self.top10 = top10 self.customFilters = customFilters self.dynamicFilter = dynamicFilter self.colorFilter = colorFilter self.iconFilter = iconFilter if blank is not None and self.filters: self.filters.blank = blank if vals is not None and self.filters: self.filters.filter = vals class AutoFilter(Serialisable): tagname = "autoFilter" ref = CellRange() filterColumn = Sequence(expected_type=FilterColumn, allow_none=True) sortState = Typed(expected_type=SortState, allow_none=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ('filterColumn', 'sortState') def __init__(self, ref=None, filterColumn=(), sortState=None, extLst=None, ): self.ref = ref self.filterColumn = filterColumn self.sortState = sortState def __bool__(self): return self.ref is not None __nonzero__ = __bool__ def add_filter_column(self, col_id, vals, blank=False): """ Add row filter for specified column. :param col_id: Zero-origin column id. 0 means first column. :type col_id: int :param vals: Value list to show. :type vals: str[] :param blank: Show rows that have blank cell if True (default=``False``) :type blank: bool """ self.filterColumn.append(FilterColumn(colId=col_id, filters=Filters(blank=blank, filter=vals))) def add_sort_condition(self, ref, descending=False): """ Add sort condition for cpecified range of cells. :param ref: range of the cells (e.g. 'A2:A150') :type ref: string :param descending: Descending sort order (default=``False``) :type descending: bool """ cond = SortCondition(ref, descending) if self.sortState is None: self.sortState = SortState(ref=ref) self.sortState.sortCondition.append(cond)
6ca67602d21d354937356280ae7d8a91c75c5990
26be9ea17640d29d6a8a576cbf306f71675bdfb1
/pyroprint/optedredger.py
c46bc80acf83ea548a2c338e430e1a6e746c1c47
[]
no_license
meredithhitchcock/wabio
076a69efa0e38da0cbba348114408e2354fdde76
f3de4b8ca6f98d6ec2fa3989214871c2a3781c37
refs/heads/master
2021-01-18T14:50:52.630167
2014-10-04T04:28:58
2014-10-04T04:28:58
null
0
0
null
null
null
null
UTF-8
Python
false
false
3,812
py
import pymysql import string import sys primer = "CGTGAGGCTTAACCTT" revcomprimer = "AAGGTTAAGCCTCACG" seqFile1 = "" ratioSeq1 = "" seqFile2 = "" ratioSeq2 = "" fileDir = "./Genome Sequences/rDNA plasmid sequences/23-5" outfile = "" # A quick tool to dredge the opterons from .seq files # Takes in three params: # - the ratio of sequences # - the two sequence files def main(): global seqFile1 global ratioSeq1 global seqFile2 global ratioSeq2 global fileDir global outfile if len(sys.argv) < 5 or sys.argv[1] == "help": printUsage() return # Parse input params i = 1 while i < len(sys.argv): if sys.argv[i] == "-r": try: (r1, split, r2) = sys.argv[i + 1].partition(":") ratioSeq1 = int(r1) ratioSeq2 = int(r2) i += 2 except ValueError: print "exception" printUsage() return elif sys.argv[i] == "-s": (seqFile1, split, seqFile2) = sys.argv[i + 1].partition(":") outfile = seqFile1 + "-" + seqFile2 + ".opts" i += 2 elif sys.argv[i] == "-d": fileDir = argv[i + 1] i += 2 elif sys.argv[i] == "-o": outfile = argv[i + 1] i += 2 else: printUsage() return seq1 = findSeq(seqFile1) seq2 = findSeq(seqFile2) # Print the found sequences to an output file using the ratios fd = open(outfile, "w") for i in range(ratioSeq1): fd.write("# " + str(i + 1) + " - " + seqFile1 + "\n") fd.write(seq1 + "\n") for i in range(ratioSeq2): fd.write("# " + str(i + 1) + " - " + seqFile2 + "\n") fd.write(seq2 + "\n") fd.close() return def findSeq(seqFile): try: fd = open(fileDir + "/23-5 " + seqFile + ".seq", "r") except: print ("File Not Found: " + fileDir + "/23-5 " + seqFile + ".seq") sys.exit() seq = "" for line in fd: seq += line.strip() # FIRST try to find the sequence after the original primer (pre, p, end) = seq.partition(primer) # IF didn't find using the original primer try the reverse compliment if len(p) == 0 or len(end) == 0: (pre, p, end) = seq.partition(revcomprimer) if len(p) == 0 or len(end) == 0: print ("Runtime Error: Could not find the primer or the reverse " + " compliment of the primer") sys.exit() # REVERSE the string pre pre = pre[::-1] # Compliment the string pre = compliment(pre) return pre else: return end def compliment(seg): # Compliment the string slen = len(seg) for i in range(slen): if seg[i] == "A": seg = seg[0:i] + "T" + seg[i + 1:slen] elif seg[i] == "T": seg = seg[0:i] + "A" + seg[i + 1:slen] elif seg[i] == "C": seg = seg[0:i] + "G" + seg[i + 1:slen] elif seg[i] == "G": seg = seg[0:i] + "C" + seg[i + 1:slen] return seg def printUsage(): print ("Usage: " + sys.argv[0] + " -r <X:Y> -s " + "<sequence 1 name>:<sequence 2 name> [-d <sequence file directory>] [-o <outfile>]") print (" -r : The ratio of sequence 1 to sequence 2 in the final result") print (" -s : A \"ratio\" of sequence names to be used.\n" + " Example: Dg03-5:Hu01-3\n" + " NOTE: \'23-5 \' and \'.seq\' are automatically added") print (" -d : An optional parameter to change the default location to search " + "for the sequence files.\n" + " The default location is: " + fileDir) print (" -o : Optional parameter to change the default output file.\n" + " The default output file name is \"<seq 1 name>-<seq 2 name>.opts\"") if __name__ == "__main__": main()
e3bb6cda196d50d9aa9a0366a7e535e4d6cbe821
9fb7bc79fc3e9224de8a63189515044812a1ff41
/scripts/general_utils.py
d490031b36efe0659d6834af14b5d1905f111691
[ "MIT" ]
permissive
dciborow/amlsdummy
2fb4c0ddb39ec40140d4811d23d832c009dee139
91d2732dd485002b16c28353263b62c674a69399
refs/heads/master
2022-06-19T11:28:46.961813
2020-02-09T20:51:15
2020-02-09T20:51:15
239,918,986
0
0
MIT
2020-02-12T03:30:20
2020-02-12T03:30:19
null
UTF-8
Python
false
false
3,210
py
import pickle import os from enum import Enum from datetime import datetime, timedelta class JobType(Enum): real_time_scoring = "RealTimeScoring" batch_scoring = "BatchScoring" class JobLog: step_start = "start" step_end = "end" logs_directory = "Logs" general_stats = "Overview.csv" def __init__(self, jobtype): self.job_type = jobtype self.job_directory = jobtype.value + JobLog.logs_directory self.job_steps = {} self.job_info = [] self.total_start = None def startStep(self, step_name): if len(self.job_steps) == 0: self.total_start = datetime.now() self.job_steps[step_name] = {} self.job_steps[step_name][JobLog.step_start] = datetime.now() def endStep(self, step_name): if step_name in self.job_steps.keys(): self.job_steps[step_name][JobLog.step_end] = datetime.now() def addInfo(self, info): self.job_info.append(info) def _dumpGeneral(self, log_path, total_time): if os.path.exists(JobLog.logs_directory) == False: os.makedirs(JobLog.logs_directory) stats_file = os.path.join(JobLog.logs_directory, JobLog.general_stats) log_entry = [] log_entry.append(self.job_type.value) log_entry.append(log_path) log_entry.append(str(total_time)) with open(stats_file, "a+") as general_stats: general_stats.writelines("{}\n".format(",".join(log_entry))) def dumpLog(self): total_run_time = datetime.now() - self.total_start log_path = os.path.join(JobLog.logs_directory, self.job_directory) if os.path.exists(log_path) == False: os.makedirs(log_path) file_name = datetime.now().isoformat() file_name = file_name.replace(":","-") file_name = file_name.replace(".","-") file_name += ".log" file_path = os.path.join(log_path, file_name) with open(file_path, "w") as log_output: log_output.writelines("Job Type: {}\n".format(self.job_type.value)) log_output.writelines("Total Run Time: {} seconds\n".format(total_run_time.total_seconds())) log_output.writelines("Job Info: \n") for info in self.job_info: log_output.writelines(" " + info + "\n") log_output.writelines("Job Steps: \n") for step in self.job_steps.keys(): if JobLog.step_start in self.job_steps[step].keys() and JobLog.step_end in self.job_steps[step].keys(): time_delt = self.job_steps[step][JobLog.step_end] - self.job_steps[step][JobLog.step_start] log_output.writelines(" {} - {} seconds \n".format(step, time_delt.total_seconds())) else: log_output.writelines(" {} - {} \n".format(step, self.job_steps[step])) self._dumpGeneral(file_path, total_run_time.total_seconds()) def createPickle(file_name): ''' Create a dummy pickle file ''' my_data = {"nothing" : "to see here"} with open(file_name, 'wb') as model_file: pickle.dump(my_data, model_file)
b8e53160b6e640f632a827ac6a40be6f7edb9e58
16450d59c820298f8803fd40a1ffa2dd5887e103
/SWEA/2027_대각선출력.py
33b1e9b766ac8201bf9d5378fb3649f247886e87
[]
no_license
egyeasy/TIL_public
f78c11f81d159eedb420f5fa177c05d310c4a039
e2f40eda09cb0a65cc064d9ba9b0e2fa7cbbcb38
refs/heads/master
2021-06-21T01:22:16.516777
2021-02-02T13:16:21
2021-02-02T13:16:21
167,803,551
0
0
null
null
null
null
UTF-8
Python
false
false
253
py
""" 주어진 텍스트를 그대로 출력하세요. > 입력 > 출력 #++++ +#+++ ++#++ +++#+ ++++# """ print("""#++++ +#+++ ++#++ +++#+ ++++#""") # 반성 # 1. multiline comment를 활용하는 방법 # 2. print()를 여러 방법으로 쓰는 법
c4f9837ca141aa95d0af984632f977212fccf8c7
ab0315bcded75c10c591076b22ed8ff664ee76af
/fig4/config_scf_10mods_200213.py
5a3c6829ca9d92207ab9ba95c94ca871a795916d
[]
no_license
mukamel-lab/BICCN-Mouse-MOp
389f62492986a2ffe4278ed16f59fc17dc75b767
8058ab8ae827c6e019fff719903b0ba5b400931d
refs/heads/master
2021-07-06T11:14:25.401628
2020-09-30T04:54:27
2020-09-30T04:54:27
189,758,115
1
0
null
null
null
null
UTF-8
Python
false
false
1,734
py
#!/usr/bin/env python3 """An example configuration file """ import sys import os # # Configs name = 'mop_10mods_200213' outdir = '/cndd/fangming/CEMBA/data/MOp_all/results' output_pcX_all = outdir + '/pcX_all_{}.npy'.format(name) output_cells_all = outdir + '/cells_all_{}.npy'.format(name) output_imputed_data_format = outdir + '/imputed_data_{}_{{}}.npy'.format(name) output_clst_and_umap = outdir + '/intg_summary_{}.tsv'.format(name) output_figures = outdir + '/figures/{}_{{}}.{{}}'.format(name) output_cluster_centroids = outdir + '/centroids_{}.pkl'.format(name) DATA_DIR = '/cndd/fangming/CEMBA/data/MOp_all/data_freeze_l5pt' # fixed dataset configs sys.path.insert(0, DATA_DIR) from __init__datasets import * meta_f = os.path.join(DATA_DIR, '{0}_metadata.tsv') hvftrs_f = os.path.join(DATA_DIR, '{0}_hvfeatures.{1}') hvftrs_gene = os.path.join(DATA_DIR, '{0}_hvfeatures.gene') hvftrs_cell = os.path.join(DATA_DIR, '{0}_hvfeatures.cell') mods_selected = [ 'snmcseq_gene', 'snatac_gene', 'smarter_cells', 'smarter_nuclei', '10x_cells_v2', '10x_cells_v3', '10x_nuclei_v3', '10x_nuclei_v3_macosko', 'merfish', 'epi_retro', ] features_selected = ['epi_retro'] # check features for features_modality in features_selected: assert (features_modality in mods_selected) # within modality ps = {'mc': 0.9, 'atac': 0.1, 'rna': 0.7, 'merfish': 1, } drop_npcs = { 'mc': 0, 'atac': 0, 'rna': 0, 'merfish': 0, } # across modality cross_mod_distance_measure = 'correlation' # cca knn = 20 relaxation = 3 n_cca = 30 # PCA npc = 50 # clustering k = 30 resolutions = [0.1, 0.2, 0.4, 0.8] # umap umap_neighbors = 60 min_dist = 0.5
23be186718ed310752b58249fce51092af45e1c1
85f5dff291acf1fe7ab59ca574ea9f4f45c33e3b
/api/tacticalrmm/agents/migrations/0054_alter_agent_goarch.py
d2f26e1c4156e7ec3053a815a89ca418cf2919a9
[ "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-unknown-license-reference" ]
permissive
sadnub/tacticalrmm
a4ecaf994abe39244a6d75ed2166222abb00d4f4
0af95aa9b1084973642da80e9b01a18dcacec74a
refs/heads/develop
2023-08-30T16:48:33.504137
2023-04-10T22:57:44
2023-04-10T22:57:44
243,405,684
0
2
MIT
2020-09-08T13:03:30
2020-02-27T01:43:56
Python
UTF-8
Python
false
false
498
py
# Generated by Django 4.0.4 on 2022-06-06 04:03 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('agents', '0053_remove_agenthistory_status'), ] operations = [ migrations.AlterField( model_name='agent', name='goarch', field=models.CharField(blank=True, choices=[('amd64', 'amd64'), ('386', '386'), ('arm64', 'arm64'), ('arm', 'arm')], max_length=255, null=True), ), ]
5ea614fee71884c24f32e860daef852091238e03
5da5473ff3026165a47f98744bac82903cf008e0
/packages/google-cloud-securitycenter/samples/generated_samples/securitycenter_v1beta1_generated_security_center_update_source_sync.py
b5e8b229d69c9ca234a50e7b49e7d975e67ed7f9
[ "Apache-2.0" ]
permissive
googleapis/google-cloud-python
ed61a5f03a476ab6053870f4da7bc5534e25558b
93c4e63408c65129422f65217325f4e7d41f7edf
refs/heads/main
2023-09-04T09:09:07.852632
2023-08-31T22:49:26
2023-08-31T22:49:26
16,316,451
2,792
917
Apache-2.0
2023-09-14T21:45:18
2014-01-28T15:51:47
Python
UTF-8
Python
false
false
1,863
py
# -*- coding: utf-8 -*- # Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Generated code. DO NOT EDIT! # # Snippet for UpdateSource # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-securitycenter # [START securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_sync] # This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import securitycenter_v1beta1 def sample_update_source(): # Create a client client = securitycenter_v1beta1.SecurityCenterClient() # Initialize request argument(s) request = securitycenter_v1beta1.UpdateSourceRequest( ) # Make the request response = client.update_source(request=request) # Handle the response print(response) # [END securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_sync]
bf9079fb3d60a76e417d01ad38efd6a8b18c6bd4
10ddfb2d43a8ec5d47ce35dc0b8acf4fd58dea94
/Python/count-number-of-distinct-integers-after-reverse-operations.py
24dbdf067e7e0c6f952bd0ae88007568b737487c
[ "MIT" ]
permissive
kamyu104/LeetCode-Solutions
f54822059405ef4df737d2e9898b024f051fd525
4dc4e6642dc92f1983c13564cc0fd99917cab358
refs/heads/master
2023-09-02T13:48:26.830566
2023-08-28T10:11:12
2023-08-28T10:11:12
152,631,182
4,549
1,651
MIT
2023-05-31T06:10:33
2018-10-11T17:38:35
C++
UTF-8
Python
false
false
707
py
# Time: O(nlogr), r = max(nums) # Space: O(n) # hash table class Solution(object): def countDistinctIntegers(self, nums): """ :type nums: List[int] :rtype: int """ def reverse(n): result = 0 while n: result = result*10 + n%10 n //= 10 return result return len({y for x in nums for y in (x, reverse(x))}) # Time: O(nlogr), r = max(nums) # Space: O(n) # hash table class Solution2(object): def countDistinctIntegers(self, nums): """ :type nums: List[int] :rtype: int """ return len({y for x in nums for y in (x, int(str(x)[::-1]))})
cb51b6fcc0d3bf4a8423b790d3e33d50c46cfa76
80907e3f9e998abc375afcc6e6546c88ee023252
/badgepad/cmdline.py
4fb20087f1865f5d46be5d1143852f084c2adcdb
[]
no_license
toolness/badgepad
5ac1eb21bf426335e81cb9400f5180b6542dea43
2c1e221efca12054b843aef066798dd03f6f2533
refs/heads/master
2021-01-10T20:03:45.630275
2013-04-08T19:46:43
2013-04-08T19:46:43
9,220,546
1
0
null
null
null
null
UTF-8
Python
false
false
4,051
py
import os import sys import shutil import argparse from . import pkg_path from .project import Project from .build import build_website from .server import start_auto_rebuild_server def nice_dir(path, cwd=None): if cwd is None: cwd = os.getcwd() path = os.path.realpath(path) cwd = os.path.realpath(cwd) rel = os.path.relpath(path, cwd) if rel.startswith('..'): return path return rel def fail(text): log(text) sys.exit(1) def log(text): sys.stdout.write(text + '\n') def cmd_serve(project, args): """ Serve website. """ start_auto_rebuild_server(project.ROOT, ip=args.ip, port=args.port) def cmd_build(project, args): """ Build website. """ if args.base_url: project.set_base_url(args.base_url) if not args.output_dir: args.output_dir = project.path('dist') build_website(project, dest_dir=args.output_dir) log("Done. Static website is in '%s'." % nice_dir(args.output_dir)) def cmd_init(project, args): """ Initialize new project directory. """ if project.exists('config.yml'): fail("Directory already contains a project.") log("Generating config.yml.") shutil.copy(pkg_path('samples', 'config.yml'), project.ROOT) log("Creating empty directories.") os.mkdir(project.path('assertions')) os.mkdir(project.path('badges')) os.mkdir(project.path('static')) log("Creating default templates.") shutil.copytree(pkg_path('samples', 'templates'), project.TEMPLATES_DIR) log("Done.") def cmd_newbadge(project, args): """ Create a new badge type. """ filename = project.path('badges', '%s.yml' % args.name) if os.path.exists(filename): fail("That badge already exists.") shutil.copy(pkg_path('samples', 'badge.yml'), filename) log("Created %s." % project.relpath(filename)) pngfile = project.relpath('badges', '%s.png' % args.name) log("To give the badge an image, copy a PNG file to %s." % pngfile) def cmd_issue(project, args): """ Issue a badge to a recipient. """ basename = '%s.%s' % (args.recipient, args.badge) filename = project.path('assertions', '%s.yml' % basename) if not args.badge in project.badges: fail("Badge '%s' does not exist." % args.badge) if args.recipient not in project.recipients: fail("Recipient '%s' does not exist." % args.recipient) if os.path.exists(filename): fail("Badge already issued.") shutil.copy(pkg_path('samples', 'assertion.yml'), filename) log("Created %s." % project.relpath(filename)) def main(arglist=None): parser = argparse.ArgumentParser() parser.add_argument('-r', '--root-dir', help='root project directory', default='.') subparsers = parser.add_subparsers() serve = subparsers.add_parser('serve', help=cmd_serve.__doc__) serve.add_argument('-i', '--ip', help='ip address', default='127.0.0.1') serve.add_argument('-p', '--port', help='port', type=int, default=8000) serve.set_defaults(func=cmd_serve) build = subparsers.add_parser('build', help=cmd_build.__doc__) build.add_argument('-u', '--base-url', help='alternate base URL') build.add_argument('-o', '--output-dir', help='output directory') build.set_defaults(func=cmd_build) init = subparsers.add_parser('init', help=cmd_init.__doc__) init.set_defaults(func=cmd_init) newbadge = subparsers.add_parser('newbadge', help=cmd_newbadge.__doc__) newbadge.add_argument('name') newbadge.set_defaults(func=cmd_newbadge) issue = subparsers.add_parser('issue', help=cmd_issue.__doc__) issue.add_argument('recipient') issue.add_argument('badge') issue.set_defaults(func=cmd_issue) args = parser.parse_args(arglist) project = Project(args.root_dir) if args.func is not cmd_init: if not project.exists('config.yml'): fail('Directory does not contain a project.') args.func(project, args)
e2ee762af542c4e17ef39d01c46d47c5bbc7d2ab
3af9425f048876de388d2a5dc4f361132d03a387
/algorithms/source/최단경로/1.Shortest path(1753_Dijkstra).py
d4b5deea16f72a032b83b6eec204466c755aa8db
[]
no_license
hwanginbeom/TIL
6fab0d06db9cb9d78c03e3b3392dedcdaf799df6
933348f08e5bd58527dcb3732c092a83581e471b
refs/heads/master
2021-08-15T06:15:21.452951
2021-08-13T14:56:09
2021-08-13T14:56:09
146,391,739
0
0
null
null
null
null
UTF-8
Python
false
false
2,284
py
''' 문제 방향그래프가 주어지면 주어진 시작점에서 다른 모든 정점으로의 최단 경로를 구하는 프로그램을 작성하시오. 단, 모든 간선의 가중치는 10 이하의 자연수이다. 입력 첫째 줄에 정점의 개수 V와 간선의 개수 E가 주어진다. (1≤V≤20,000, 1≤E≤300,000) 모든 정점에는 1부터 V까지 번호가 매겨져 있다고 가정한다. 둘째 줄에는 시작 정점의 번호 K(1≤K≤V)가 주어진다. 셋째 줄부터 E개의 줄에 걸쳐 각 간선을 나타내는 세 개의 정수 (u, v, w)가 순서대로 주어진다. 이는 u에서 v로 가는 가중치 w인 간선이 존재한다는 뜻이다. u와 v는 서로 다르며 w는 10 이하의 자연수이다. 서로 다른 두 정점 사이에 여러 개의 간선이 존재할 수도 있음에 유의한다. 출력 첫째 줄부터 V개의 줄에 걸쳐, i번째 줄에 i번 정점으로의 최단 경로의 경로값을 출력한다. 시작점 자신은 0으로 출력하고, 경로가 존재하지 않는 경우에는 INF를 출력하면 된다. ''' import sys import heapq input = sys.stdin.readline # 노드의 개수, 간선의 개수를 입력받기 node, route = map(int, input().split()) # node, route = 5, 6 INF = int(1e9) # 무한을 의미하는 값으로 10억을 설정 distance = [int(1e9)] * (node + 1) start = int(input()) # 각 노드에 연결되어 있는 노드에 대한 정보를 담는 리스트를 만들기 graph = [[]for i in range(node + 1)] # 모든 간선 정보를 입력 받기 for _ in range(route): a, b, c = map(int, input().split()) # a번 노드에서 b번 노드로 가는 비용이 c라는 의미 graph[a].append((b, c)) def dijkstra(start): q = [] # 시작 노드에 대해서 초기화 heapq.heappush(q,(0,start)) distance[start] = 0 while q: dist, now = heapq.heappop(q) if distance[now] < dist: continue for i in graph[now]: cost = dist + i[1] if cost < distance[i[0]]: distance[i[0]] = cost heapq.heappush(q, (cost, i[0])) dijkstra(start) for i in range(1,node+1): if distance[i] ==1000000000: print('INF') continue print(distance[i])
f3bbe6e34b15c175b28daa543e9a87e025c79843
b647129cb448b4991059dcfb44d8279b4c8f18dd
/pyEX/commodities/commodities.py
cfcfbb6c68aaaf35f81c2bbf3438af9571a42525
[ "Apache-2.0" ]
permissive
jmailloux/pyEX
433a9aeab3429edb5af1c2f18dc533011ab15c92
2101e8c53a9080ea8b00b28a758be441095d5048
refs/heads/main
2023-03-24T06:36:43.544611
2021-03-17T03:30:40
2021-03-17T03:30:40
345,503,430
0
0
Apache-2.0
2021-03-08T02:06:50
2021-03-08T02:06:49
null
UTF-8
Python
false
false
2,944
py
# ***************************************************************************** # # Copyright (c) 2020, the pyEX authors. # # This file is part of the pyEX library, distributed under the terms of # the Apache License 2.0. The full license can be found in the LICENSE file. # from enum import Enum from functools import lru_cache from ..points import points class CommoditiesPoints(Enum): """Commodities data points https://iexcloud.io/docs/api/#commodities Attributes: WTI; Crude oil West Texas Intermediate - in dollars per barrel, not seasonally adjusted BRENT; Crude oil Brent Europe - in dollars per barrel, not seasonally adjusted NATGAS; Henry Hub Natural Gas Spot Price - in dollars per million BTU, not seasonally adjusted HEATOIL; No. 2 Heating Oil New York Harbor - in dollars per gallon, not seasonally adjusted JET; Kerosense Type Jet Fuel US Gulf Coast - in dollars per gallon, not seasonally adjusted DIESEL; US Diesel Sales Price - in dollars per gallon, not seasonally adjusted GASREG; US Regular Conventional Gas Price - in dollars per gallon, not seasonally adjusted GASMID; US Midgrade Conventional Gas Price - in dollars per gallon, not seasonally adjusted GASPRM; US Premium Conventional Gas Price - in dollars per gallon, not seasonally adjusted PROPANE; Propane Prices Mont Belvieu Texas - in dollars per gallon, not seasonally adjusted """ WTI = "DCOILWTICO" BRENT = "DCOILBRENTEU" NATGAS = "DHHNGSP" HEATOIL = "DHOILNYH" JET = "DJFUELUSGULF" DIESEL = "GASDESW" GASREG = "GASREGCOVW" GASMID = "GASMIDCOVW" GASPRM = "GASPRMCOVW" PROPANE = "DPROPANEMBTX" @staticmethod @lru_cache(1) def options(): """Return a list of the available commodities points options""" return list(map(lambda c: c.value, CommoditiesPoints)) def wti(token="", version="stable"): return points("DCOILWTICO", token=token, version=version) def brent(token="", version="stable"): return points("DCOILBRENTEU", token=token, version=version) def natgas(token="", version="stable"): return points("DHHNGSP", token=token, version=version) def heatoil(token="", version="stable"): return points("DHOILNYH", token=token, version=version) def jet(token="", version="stable"): return points("DJFUELUSGULF", token=token, version=version) def diesel(token="", version="stable"): return points("GASDESW", token=token, version=version) def gasreg(token="", version="stable"): return points("GASREGCOVW", token=token, version=version) def gasmid(token="", version="stable"): return points("GASMIDCOVW", token=token, version=version) def gasprm(token="", version="stable"): return points("GASPRMCOVW", token=token, version=version) def propane(token="", version="stable"): return points("DPROPANEMBTX", token=token, version=version)
f1034afe44a9c9c5e8a0e96135c0e964deace10b
44b636e56d088c98949bf8341b8edb4df7af0f68
/l10n_br_nfe_import/wizard/__init__.py
debf07d977e3ca124c545a641dcf6b15bf41ada1
[ "MIT" ]
permissive
deborapoh/odoo-brasil
e579d54dd86e7e45cee2b1892193d8b9aa3a11d1
603aae00dfeef8087036dbcd2f8c9a5150576916
refs/heads/13.0
2022-12-01T07:28:11.423607
2020-08-07T13:36:23
2020-08-07T13:36:23
286,156,023
0
1
MIT
2020-08-09T22:05:06
2020-08-09T02:54:03
null
UTF-8
Python
false
false
25
py
from . import import_nfe
19b3d339d591f72252203b511ed7e437a59647f3
5955ea34fd72c719f3cb78fbb3c7e802a2d9109a
/ITERATOR_GENERATOR/ITERATOR/Sample/factorial_iterated.py
cbbabe042f1a81d9ed66d5bdd9dd2ac8668ab5d6
[]
no_license
AndreySperansky/TUITION
3c90ac45f11c70dce04008adc1e9f9faad840b90
583d3a760d1f622689f6f4f482c905b065d6c732
refs/heads/master
2022-12-21T21:48:21.936988
2020-09-28T23:18:40
2020-09-28T23:18:40
299,452,924
0
0
null
null
null
null
UTF-8
Python
false
false
467
py
"""Итеральное исчисление факториала работает быстрее рекурсивного""" def iterative_factorial(n): if n == 0 or n==1: res = 1 return res else: res = 1 for i in range(2, n+1): res = res * i return res num = abs(int(input("Введите целое число: "))) print("Факториал числа %d равен: " % num, iterative_factorial(num))
3edd594c112f2a201b8ec695395ac0a413286f35
b8e3ceb93c08f9a8af776a78a9479b1dadb498b5
/wcsinteractive/wcsinteractive/starmapper/__init__.py
fd47b586f41019548e3af4cca7173081afa447a0
[]
no_license
sholmbo/photometry
fcb3e153059129cef6e91bcca30d74703035b7b9
be2e20d93ca6ca3a2b20f3ba99b0e166a4687758
refs/heads/master
2023-09-04T04:22:09.547708
2021-10-26T12:53:30
2021-10-26T12:54:49
307,145,536
0
1
null
null
null
null
UTF-8
Python
false
false
35
py
from .starmapper import StarMapper
917574d4ba87f4c467e7867dc9e6650e93fc9a21
163bbb4e0920dedd5941e3edfb2d8706ba75627d
/Code/CodeRecords/2164/60606/306710.py
97804c69d658036e62e5f0f4c83a491771e81aae
[]
no_license
AdamZhouSE/pythonHomework
a25c120b03a158d60aaa9fdc5fb203b1bb377a19
ffc5606817a666aa6241cfab27364326f5c066ff
refs/heads/master
2022-11-24T08:05:22.122011
2020-07-28T16:21:24
2020-07-28T16:21:24
259,576,640
2
1
null
null
null
null
UTF-8
Python
false
false
147
py
test_num = int(input()) s = input() if s=="aaaab": print(3) print(7) elif test_num==3 and s=="aab": print(1) print(8) print(0)
32a2ca42eaf13c97db25cff13c3c05b9250f601f
3854452cb10bc4c8dbadaf2328d0f4706300d596
/pypet/tests/integration/environment_multiproc_test.py
0b4698d87a66e3c3d4d6d945904694321a686ae5
[ "BSD-3-Clause" ]
permissive
henribunting/pypet
852e9905957a298bf1035f1b10f45e4d053dcc95
bcbdffe1dc6c55ff7ac4a9746b990d2060be55f0
refs/heads/develop
2021-01-13T15:36:09.249761
2015-06-04T09:07:36
2015-06-04T09:07:36
36,863,306
0
0
null
2015-06-04T10:14:36
2015-06-04T10:14:34
Python
UTF-8
Python
false
false
10,503
py
__author__ = 'Robert Meyer' import logging import random import os from pypet import pypetconstants from pypet.environment import Environment from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest,\ TestOtherHDF5Settings2, multiply from pypet.tests.testutils.ioutils import run_suite,make_temp_dir, make_trajectory_name, \ parse_args, get_log_config, unittest from pypet.tests.testutils.data import create_param_dict, add_params import pypet.compat as compat import sys try: import psutil except ImportError: psutil = None class MultiprocPoolQueueTest(TestOtherHDF5Settings2): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'queue', 'pool' def set_mode(self): super(MultiprocPoolQueueTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_QUEUE self.multiproc = True self.ncores = 4 self.use_pool=True class MultiprocPoolLockTest(EnvironmentTest): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'lock', 'pool', # def test_run(self): # super(MultiprocLockTest, self).test_run() def set_mode(self): super(MultiprocPoolLockTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_LOCK self.multiproc = True self.ncores = 4 self.use_pool=True # class MultiprocPoolPipeTest(EnvironmentTest): # # tags = 'integration', 'hdf5', 'environment', 'multiproc', 'pipe', 'pool', # # # def test_run(self): # # super(MultiprocLockTest, self).test_run() # # def set_mode(self): # super(MultiprocPoolPipeTest, self).set_mode() # self.mode = pypetconstants.WRAP_MODE_PIPE # self.multiproc = True # self.ncores = 4 # self.use_pool=True class MultiprocPoolSortQueueTest(ResultSortTest): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'queue', 'pool', def set_mode(self): super(MultiprocPoolSortQueueTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_QUEUE self.multiproc = True self.ncores = 3 self.use_pool=True class MultiprocPoolSortLockTest(ResultSortTest): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'lock', 'pool', def set_mode(self): super(MultiprocPoolSortLockTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_LOCK self.multiproc = True self.ncores = 4 self.use_pool=True class MultiprocPoolSortPipeTest(ResultSortTest): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'pipe', 'pool', def set_mode(self): super(MultiprocPoolSortPipeTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_PIPE self.multiproc = True self.ncores = 4 self.use_pool=True class MultiprocNoPoolQueueTest(EnvironmentTest): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'queue', 'nopool', def set_mode(self): super(MultiprocNoPoolQueueTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_QUEUE self.multiproc = True self.ncores = 3 self.use_pool=False class MultiprocNoPoolLockTest(EnvironmentTest): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'lock', 'nopool', def set_mode(self): super(MultiprocNoPoolLockTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_LOCK self.multiproc = True self.ncores = 2 self.use_pool=False # class MultiprocNoPoolPipeTest(EnvironmentTest): # # tags = 'integration', 'hdf5', 'environment', 'multiproc', 'pipe', 'nopool', # # def set_mode(self): # super(MultiprocNoPoolPipeTest, self).set_mode() # self.mode = pypetconstants.WRAP_MODE_PIPE # self.multiproc = True # self.ncores = 2 # self.use_pool=False class MultiprocNoPoolSortQueueTest(ResultSortTest): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'queue', 'nopool', def set_mode(self): super(MultiprocNoPoolSortQueueTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_QUEUE self.multiproc = True self.ncores = 3 self.use_pool=False class MultiprocNoPoolSortLockTest(ResultSortTest): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'lock', 'nopool', def set_mode(self): super(MultiprocNoPoolSortLockTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_LOCK self.multiproc = True self.ncores = 3 self.use_pool=False class MultiprocNoPoolSortPipeTest(ResultSortTest): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'lock', 'nopool', def set_mode(self): super(MultiprocNoPoolSortPipeTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_PIPE self.multiproc = True self.ncores = 3 self.use_pool=False class MultiprocFrozenPoolQueueTest(TestOtherHDF5Settings2): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'queue', 'pool', 'freeze_input' def set_mode(self): super(MultiprocFrozenPoolQueueTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_QUEUE self.multiproc = True self.freeze_pool_input = True self.ncores = 4 self.use_pool=True class MultiprocFrozenPoolLockTest(EnvironmentTest): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'lock', 'pool', 'freeze_input' # def test_run(self): # super(MultiprocLockTest, self).test_run() def set_mode(self): super(MultiprocFrozenPoolLockTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_LOCK self.multiproc = True self.freeze_pool_input = True self.ncores = 4 self.use_pool=True def new_multiply(traj): if traj.v_full_copy: raise RuntimeError('Full copy should be FALSE!') return multiply(traj) class MultiprocFrozenPoolSortQueueTest(ResultSortTest): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'queue', 'pool', 'freeze_input' def set_mode(self): super(MultiprocFrozenPoolSortQueueTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_QUEUE self.multiproc = True self.freeze_pool_input = True self.ncores = 3 self.use_pool=True def test_if_full_copy_is_old_value(self): ###Explore self.explore(self.traj) self.traj.v_full_copy = False self.env.f_run(new_multiply) traj = self.traj self.assertTrue(len(traj) == len(compat.listvalues(self.explore_dict)[0])) self.traj.f_load_skeleton() self.traj.f_load_items(self.traj.f_to_dict().keys(), only_empties=True) self.check_if_z_is_correct(traj) newtraj = self.load_trajectory(trajectory_name=self.traj.v_name,as_new=False) self.traj.f_load_skeleton() self.traj.f_load_items(self.traj.f_to_dict().keys(), only_empties=True) self.compare_trajectories(self.traj,newtraj) class MultiprocFrozenPoolPipeTest(EnvironmentTest): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'pipe', 'pool', 'freeze_input' # def test_run(self): # super(MultiprocLockTest, self).test_run() def set_mode(self): super(MultiprocFrozenPoolPipeTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_PIPE self.multiproc = True self.freeze_pool_input = True self.ncores = 4 self.use_pool=True class MultiprocFrozenPoolSortLockTest(ResultSortTest): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'lock', 'pool', 'freeze_input' def set_mode(self): super(MultiprocFrozenPoolSortLockTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_LOCK self.freeze_pool_input = True self.multiproc = True self.ncores = 4 self.use_pool=True class MultiprocFrozenPoolSortPipeTest(ResultSortTest): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'pipe', 'pool', 'freeze_input' def set_mode(self): super(MultiprocFrozenPoolSortPipeTest, self).set_mode() self.mode = pypetconstants.WRAP_MODE_PIPE self.freeze_pool_input = True self.multiproc = True self.ncores = 4 self.use_pool=True @unittest.skipIf(psutil is None, 'Only makes sense if psutil is installed') class CapTest(EnvironmentTest): tags = 'integration', 'hdf5', 'environment', 'multiproc', 'lock', 'nopool', 'cap' cap_count = 0 def setUp(self): self.multiproc = True self.mode = 'LOCK' self.trajname = make_trajectory_name(self) self.filename = make_temp_dir(os.path.join('experiments', 'tests', 'HDF5', '%s.hdf5' % self.trajname)) self.logfolder = make_temp_dir(os.path.join('experiments','tests','Log')) random.seed() cap_dicts = (dict(cpu_cap=0.000001), # Ensure that these are triggered dict(memory_cap=(0.000001, 150.0)), dict(swap_cap=0.000001,)) cap_dict = cap_dicts[CapTest.cap_count] env = Environment(trajectory=self.trajname,filename=self.filename, file_title=self.trajname, log_folder=self.logfolder, logger_names=('pypet', 'test'), log_levels='ERROR', log_stdout=False, results_per_run=5, derived_parameters_per_run=5, multiproc=True, ncores=4, use_pool=False, **cap_dict) logging.getLogger('test').error('Using Cap: %s' % str(cap_dict)) # Loop through all possible cap configurations # and test one at a time CapTest.cap_count += 1 CapTest.cap_count = CapTest.cap_count % len(cap_dicts) traj = env.v_trajectory ## Create some parameters self.param_dict={} create_param_dict(self.param_dict) ### Add some parameter: add_params(traj,self.param_dict) #remember the trajectory and the environment self.traj = traj self.env = env if __name__ == '__main__': opt_args = parse_args() run_suite(**opt_args)
caf2fecb194e07ce6842ae03cc70ae308b64a77b
6444622ad4a150993955a0c8fe260bae1af7f8ce
/djangoenv/lib/python2.7/site-packages/django/contrib/redirects/middleware.py
88bdfe488ab088fde0477ae06a0433d5a7196195
[]
no_license
jeremyrich/Lesson_RestAPI_jeremy
ca965ef017c53f919c0bf97a4a23841818e246f9
a44263e45b1cc1ba812059f6984c0f5be25cd234
refs/heads/master
2020-04-25T23:13:47.237188
2019-03-22T09:26:58
2019-03-22T09:26:58
173,138,073
0
0
null
2019-03-22T09:26:59
2019-02-28T15:34:19
Python
UTF-8
Python
false
false
1,961
py
from __future__ import unicode_literals from django import http from django.apps import apps from django.conf import settings from django.contrib.redirects.models import Redirect from django.contrib.sites.shortcuts import get_current_site from django.core.exceptions import ImproperlyConfigured from django.utils.deprecation import MiddlewareMixin class RedirectFallbackMiddleware(MiddlewareMixin): # Defined as class-level attributes to be subclassing-friendly. response_gone_class = http.HttpResponseGone response_redirect_class = http.HttpResponsePermanentRedirect def __init__(self, get_response=None): if not apps.is_installed("django.contrib.sites"): raise ImproperlyConfigured( "You cannot use RedirectFallbackMiddleware when " "django.contrib.sites is not installed." ) super(RedirectFallbackMiddleware, self).__init__(get_response) def process_response(self, request, response): # No need to check for a redirect for non-404 responses. if response.status_code != 404: return response full_path = request.get_full_path() current_site = get_current_site(request) r = None try: r = Redirect.objects.get(site=current_site, old_path=full_path) except Redirect.DoesNotExist: pass if r is None and settings.APPEND_SLASH and not request.path.endswith("/"): try: r = Redirect.objects.get( site=current_site, old_path=request.get_full_path(force_append_slash=True), ) except Redirect.DoesNotExist: pass if r is not None: if r.new_path == "": return self.response_gone_class() return self.response_redirect_class(r.new_path) # No redirect was found. Return the response. return response
27a01cd8a0085e4c72daeb98b6450a52198af332
85a9ffeccb64f6159adbd164ff98edf4ac315e33
/pysnmp/CISCO-LWAPP-DHCP-MIB.py
8a0c218950d0431114ff485c5d7543889a404acf
[ "Apache-2.0" ]
permissive
agustinhenze/mibs.snmplabs.com
5d7d5d4da84424c5f5a1ed2752f5043ae00019fb
1fc5c07860542b89212f4c8ab807057d9a9206c7
refs/heads/master
2020-12-26T12:41:41.132395
2019-08-16T15:51:41
2019-08-16T15:53:57
237,512,469
0
0
Apache-2.0
2020-01-31T20:41:36
2020-01-31T20:41:35
null
UTF-8
Python
false
false
16,226
py
# # PySNMP MIB module CISCO-LWAPP-DHCP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LWAPP-DHCP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:47:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion") ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt") CiscoURLString, = mibBuilder.importSymbols("CISCO-TC", "CiscoURLString") InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") ModuleIdentity, Counter64, iso, Bits, IpAddress, Integer32, NotificationType, Unsigned32, MibIdentifier, TimeTicks, Counter32, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "Counter64", "iso", "Bits", "IpAddress", "Integer32", "NotificationType", "Unsigned32", "MibIdentifier", "TimeTicks", "Counter32", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity") TextualConvention, DisplayString, TruthValue, TimeStamp = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "TruthValue", "TimeStamp") ciscoLwappDhcpMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 792)) ciscoLwappDhcpMIB.setRevisions(('2012-01-31 00:00',)) if mibBuilder.loadTexts: ciscoLwappDhcpMIB.setLastUpdated('201204050000Z') if mibBuilder.loadTexts: ciscoLwappDhcpMIB.setOrganization('Cisco Systems Inc.') ciscoLwappDhcpMIBNotif = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 792, 0)) ciscoLwappDhcpMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 792, 1)) ciscoLwappDhcpMIBConform = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 792, 2)) ciscoLwappDhcpGlobalConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 1)) ciscoLwappDhcpStatsConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 2)) ciscoLwappDhcpStats = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3)) ciscoLwappDhcpScopeStats = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 4)) ciscoLwappDhcpMIBNotifObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 5)) cLDhcpClearAllStats = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cLDhcpClearAllStats.setStatus('current') cLDhcpOpt82RemoteIdFormat = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=NamedValues(("apMac", 1), ("apMacSsid", 2), ("apEthMac", 3), ("apNameSsid", 4), ("apGroupName", 5), ("flexGroupName", 6), ("apLocation", 7), ("apMacVlanId", 8), ("apNameVlanId", 9), ("apEthMacSsid", 10))).clone('apMac')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cLDhcpOpt82RemoteIdFormat.setStatus('current') cLDhcpClearAllDiscontinuityTime = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 1, 3), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpClearAllDiscontinuityTime.setStatus('current') cLDhcpTimeout = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 1, 4), Unsigned32()).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: cLDhcpTimeout.setStatus('current') cLDhcpOpt37RemoteIdFormat = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=NamedValues(("apMac", 1), ("apMacSsid", 2), ("apEthMac", 3), ("apNameSsid", 4), ("apGroupName", 5), ("flexGroupName", 6), ("apLocation", 7), ("apMacVlanId", 8), ("apNameVlanId", 9), ("apEthMacSsid", 10))).clone('apMac')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cLDhcpOpt37RemoteIdFormat.setStatus('current') cLDhcpStatsConfigTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 2, 1), ) if mibBuilder.loadTexts: cLDhcpStatsConfigTable.setStatus('current') cLDhcpStatsConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 2, 1, 1), ).setIndexNames((0, "CISCO-LWAPP-DHCP-MIB", "cLDhcpServerInetAddressType"), (0, "CISCO-LWAPP-DHCP-MIB", "cLDhcpServerInetAddress")) if mibBuilder.loadTexts: cLDhcpStatsConfigEntry.setStatus('current') cLDhcpServerInetAddressType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 2, 1, 1, 1), InetAddressType()) if mibBuilder.loadTexts: cLDhcpServerInetAddressType.setStatus('current') cLDhcpServerInetAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 2, 1, 1, 2), InetAddress()) if mibBuilder.loadTexts: cLDhcpServerInetAddress.setStatus('current') cLDhcpClearStats = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 2, 1, 1, 3), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cLDhcpClearStats.setStatus('current') cLDhcpClearDiscontinuityTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 2, 1, 1, 4), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpClearDiscontinuityTime.setStatus('current') cLDhcpStatsShowTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1), ) if mibBuilder.loadTexts: cLDhcpStatsShowTable.setStatus('current') cLDhcpStatsShowEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1, 1), ).setIndexNames((0, "CISCO-LWAPP-DHCP-MIB", "cLDhcpServerInetAddressType"), (0, "CISCO-LWAPP-DHCP-MIB", "cLDhcpServerInetAddress")) if mibBuilder.loadTexts: cLDhcpStatsShowEntry.setStatus('current') cLDhcpProxy = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1, 1, 1), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cLDhcpProxy.setStatus('current') cLDhcpDiscoverPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1, 1, 2), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpDiscoverPackets.setStatus('current') cLDhcpRequestPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1, 1, 3), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpRequestPackets.setStatus('current') cLDhcpDeclinePackets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1, 1, 4), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpDeclinePackets.setStatus('current') cLDhcpInformPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1, 1, 5), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpInformPackets.setStatus('current') cLDhcpReleasePackets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1, 1, 6), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpReleasePackets.setStatus('current') cLDhcpReplyPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1, 1, 7), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpReplyPackets.setStatus('current') cLDhcpOfferPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1, 1, 8), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpOfferPackets.setStatus('current') cLDhcpAckPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1, 1, 9), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpAckPackets.setStatus('current') cLDhcpNakPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1, 1, 10), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpNakPackets.setStatus('current') cLDhcpTxFailures = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpTxFailures.setStatus('current') cLDhcpLastResponseTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1, 1, 12), TimeStamp()).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpLastResponseTime.setStatus('current') cLDhcpLastRequestTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1, 1, 13), TimeStamp()).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpLastRequestTime.setStatus('current') cLDhcpRxDiscoverPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 3, 1, 1, 14), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpRxDiscoverPackets.setStatus('current') cLDhcpScopeStatsTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 4, 1), ) if mibBuilder.loadTexts: cLDhcpScopeStatsTable.setStatus('current') cLDhcpScopeStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 4, 1, 1), ).setIndexNames((0, "CISCO-LWAPP-DHCP-MIB", "cLDhcpScopeIndex")) if mibBuilder.loadTexts: cLDhcpScopeStatsEntry.setStatus('current') cLDhcpScopeIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 4, 1, 1, 1), Unsigned32()) if mibBuilder.loadTexts: cLDhcpScopeIndex.setStatus('current') cLDhcpScopeAddressPoolUsage = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 4, 1, 1, 2), Unsigned32()).setUnits('Percent').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpScopeAddressPoolUsage.setStatus('current') cLDhcpScopeName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 4, 1, 1, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpScopeName.setStatus('current') cLDhcpScopeAllocatedIP = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 4, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpScopeAllocatedIP.setStatus('current') cLDhcpScopeAvailableIP = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 4, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpScopeAvailableIP.setStatus('current') cLDhcpScopeDiscoverPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 4, 1, 1, 6), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpScopeDiscoverPkts.setStatus('current') cLDhcpScopeAckPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 4, 1, 1, 7), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpScopeAckPkts.setStatus('current') cLDhcpScopeOfferPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 4, 1, 1, 8), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpScopeOfferPkts.setStatus('current') cLDhcpScopeTotalAckPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 4, 1, 1, 9), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpScopeTotalAckPkts.setStatus('current') cLDhcpScopeRequestPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 4, 1, 1, 10), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpScopeRequestPkts.setStatus('current') cLDhcpScopeRequestGoodPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 4, 1, 1, 11), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpScopeRequestGoodPkts.setStatus('current') cLDhcpTrapSet = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 792, 1, 5, 1), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cLDhcpTrapSet.setStatus('current') ciscoLwappDhcpScopeAddressExhaust = NotificationType((1, 3, 6, 1, 4, 1, 9, 9, 792, 0, 1)).setObjects(("CISCO-LWAPP-DHCP-MIB", "cLDhcpScopeName"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpTrapSet")) if mibBuilder.loadTexts: ciscoLwappDhcpScopeAddressExhaust.setStatus('current') ciscoLwappDhcpMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 792, 2, 1)) ciscoLwappDhcpMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 792, 2, 2)) ciscoLwappDhcpMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 792, 2, 1, 1)).setObjects(("CISCO-LWAPP-DHCP-MIB", "ciscoLwappDhcpMIBConfigGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoLwappDhcpMIBCompliance = ciscoLwappDhcpMIBCompliance.setStatus('current') ciscoLwappDhcpMIBConfigGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 792, 2, 2, 1)).setObjects(("CISCO-LWAPP-DHCP-MIB", "cLDhcpClearAllStats"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpOpt82RemoteIdFormat"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpClearAllDiscontinuityTime"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpTimeout"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpOpt37RemoteIdFormat"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpClearStats"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpClearDiscontinuityTime"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpProxy"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpDiscoverPackets"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpRequestPackets"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpDeclinePackets"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpInformPackets"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpReleasePackets"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpReplyPackets"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpOfferPackets"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpAckPackets"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpNakPackets"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpTxFailures"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpLastResponseTime"), ("CISCO-LWAPP-DHCP-MIB", "cLDhcpLastRequestTime")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoLwappDhcpMIBConfigGroup = ciscoLwappDhcpMIBConfigGroup.setStatus('current') mibBuilder.exportSymbols("CISCO-LWAPP-DHCP-MIB", ciscoLwappDhcpStatsConfig=ciscoLwappDhcpStatsConfig, cLDhcpStatsShowTable=cLDhcpStatsShowTable, cLDhcpOpt82RemoteIdFormat=cLDhcpOpt82RemoteIdFormat, cLDhcpScopeIndex=cLDhcpScopeIndex, ciscoLwappDhcpMIBCompliances=ciscoLwappDhcpMIBCompliances, ciscoLwappDhcpMIBNotifObjects=ciscoLwappDhcpMIBNotifObjects, cLDhcpScopeRequestPkts=cLDhcpScopeRequestPkts, cLDhcpLastResponseTime=cLDhcpLastResponseTime, ciscoLwappDhcpGlobalConfig=ciscoLwappDhcpGlobalConfig, cLDhcpInformPackets=cLDhcpInformPackets, cLDhcpReplyPackets=cLDhcpReplyPackets, cLDhcpStatsConfigEntry=cLDhcpStatsConfigEntry, cLDhcpServerInetAddressType=cLDhcpServerInetAddressType, cLDhcpScopeAllocatedIP=cLDhcpScopeAllocatedIP, cLDhcpScopeAckPkts=cLDhcpScopeAckPkts, cLDhcpScopeTotalAckPkts=cLDhcpScopeTotalAckPkts, cLDhcpClearDiscontinuityTime=cLDhcpClearDiscontinuityTime, cLDhcpStatsConfigTable=cLDhcpStatsConfigTable, cLDhcpStatsShowEntry=cLDhcpStatsShowEntry, cLDhcpOfferPackets=cLDhcpOfferPackets, cLDhcpRxDiscoverPackets=cLDhcpRxDiscoverPackets, cLDhcpScopeStatsTable=cLDhcpScopeStatsTable, cLDhcpScopeRequestGoodPkts=cLDhcpScopeRequestGoodPkts, cLDhcpAckPackets=cLDhcpAckPackets, ciscoLwappDhcpMIBCompliance=ciscoLwappDhcpMIBCompliance, ciscoLwappDhcpScopeStats=ciscoLwappDhcpScopeStats, cLDhcpScopeOfferPkts=cLDhcpScopeOfferPkts, ciscoLwappDhcpMIBNotif=ciscoLwappDhcpMIBNotif, ciscoLwappDhcpMIBConform=ciscoLwappDhcpMIBConform, cLDhcpDiscoverPackets=cLDhcpDiscoverPackets, cLDhcpScopeName=cLDhcpScopeName, cLDhcpTimeout=cLDhcpTimeout, cLDhcpLastRequestTime=cLDhcpLastRequestTime, cLDhcpTxFailures=cLDhcpTxFailures, cLDhcpScopeAddressPoolUsage=cLDhcpScopeAddressPoolUsage, cLDhcpTrapSet=cLDhcpTrapSet, PYSNMP_MODULE_ID=ciscoLwappDhcpMIB, ciscoLwappDhcpMIBGroups=ciscoLwappDhcpMIBGroups, cLDhcpDeclinePackets=cLDhcpDeclinePackets, cLDhcpScopeDiscoverPkts=cLDhcpScopeDiscoverPkts, ciscoLwappDhcpMIBConfigGroup=ciscoLwappDhcpMIBConfigGroup, cLDhcpClearAllDiscontinuityTime=cLDhcpClearAllDiscontinuityTime, cLDhcpOpt37RemoteIdFormat=cLDhcpOpt37RemoteIdFormat, cLDhcpScopeStatsEntry=cLDhcpScopeStatsEntry, ciscoLwappDhcpStats=ciscoLwappDhcpStats, cLDhcpProxy=cLDhcpProxy, cLDhcpClearStats=cLDhcpClearStats, ciscoLwappDhcpScopeAddressExhaust=ciscoLwappDhcpScopeAddressExhaust, ciscoLwappDhcpMIB=ciscoLwappDhcpMIB, cLDhcpClearAllStats=cLDhcpClearAllStats, cLDhcpNakPackets=cLDhcpNakPackets, cLDhcpScopeAvailableIP=cLDhcpScopeAvailableIP, ciscoLwappDhcpMIBObjects=ciscoLwappDhcpMIBObjects, cLDhcpReleasePackets=cLDhcpReleasePackets, cLDhcpRequestPackets=cLDhcpRequestPackets, cLDhcpServerInetAddress=cLDhcpServerInetAddress)
35d4b0512b4879f6c8ead169c23166a092997977
97be865468706b5776993024d55d3229995ab2cd
/StreamGeneration/GenerateHQD.py
78f096bb6a4391ef693d244c1e388e674e20bdb7
[]
no_license
ZhuJiahui/ECTH
b7dd369b958b21a6e9c2e8ad97126022aa03247c
8a8dbf9713e220f74dfcaf893b36d110c0555f46
refs/heads/master
2021-01-02T22:44:13.479021
2015-06-06T06:59:53
2015-06-06T06:59:53
29,050,682
0
0
null
null
null
null
UTF-8
Python
false
false
3,470
py
# -*- coding: utf-8 -*- ''' Created on 2014年12月27日 @author: ZhuJiahui506 ''' import os import time from TextToolkit import quick_write_list_to_text ''' Step 3 Compute EM weight of each Weibo and ordered by its EM weights to generate the high quality data. So the original data was changed. ''' def generate_high_quality_data(read_directory, write_directory): ''' Linear fusion :param read_directory: :param write_directory: ''' #K = 3000 file_number = sum([len(files) for root, dirs, files in os.walk(read_directory)]) for i in range(file_number): this_weibo = [] f = open(read_directory + '/' + str(i + 1) + '.txt', 'r') line = f.readline() while line: each_line = line.strip() this_text_length = " " try: this_text_length = each_line.split('\t')[6] except: this_text_length = " " if len(this_text_length) >= 150: this_weibo.append(each_line) line = f.readline() f.close() quick_write_list_to_text(this_weibo, write_directory + '/' + str(i + 1) + '.txt') if __name__ == '__main__': start = time.clock() now_directory = os.getcwd() root_directory = os.path.dirname(now_directory) + '/' read_directory = root_directory + u'dataset/segment' write_directory = root_directory + u'dataset/high_quality_data' if (not(os.path.exists(write_directory))): os.mkdir(write_directory) generate_high_quality_data(read_directory, write_directory) print 'Total time %f seconds' % (time.clock() - start) print 'Complete !!!'
2575fcfda27f77fbd034558e815ed42659a70e22
9e988c0dfbea15cd23a3de860cb0c88c3dcdbd97
/sdBs/AllRun/pg_1711+564/sdB_pg_1711+564_coadd.py
a317f3971b126e1513af2c8cbe3cd9d5030ee583
[]
no_license
tboudreaux/SummerSTScICode
73b2e5839b10c0bf733808f4316d34be91c5a3bd
4dd1ffbb09e0a599257d21872f9d62b5420028b0
refs/heads/master
2021-01-20T18:07:44.723496
2016-08-08T16:49:53
2016-08-08T16:49:53
65,221,159
0
0
null
null
null
null
UTF-8
Python
false
false
430
py
from gPhoton.gMap import gMap def main(): gMap(band="NUV", skypos=[258.155417,56.418942], skyrange=[0.0333333333333,0.0333333333333], stepsz = 30., cntfile="/data2/fleming/GPHOTON_OUTPUT/LIGHTCURVES/sdBs/sdB_pg_1711+564/sdB_pg_1711+564_movie_count.fits", cntcoaddfile="/data2/fleming/GPHOTON_OUTPUT/LIGHTCURVES/sdB/sdB_pg_1711+564/sdB_pg_1711+564_count_coadd.fits", overwrite=True, verbose=3) if __name__ == "__main__": main()
c94c7df584c83a447b8988023b95bfe4f1d4c8fb
ae87b11560c543cb678c52a28916ea2252d7aa52
/plaso/parsers/winreg_plugins/appcompatcache.py
b289c8f42fc8d33291badb2471c08f744e4129e0
[ "Apache-2.0" ]
permissive
CNR-ITTIG/plasodfaxp
19ccf77d0be62cfa8a9b246eb6797cf64a480d80
923797fc00664fa9e3277781b0334d6eed5664fd
refs/heads/master
2016-09-13T11:14:08.877399
2016-04-11T15:01:42
2016-04-11T15:01:42
55,975,921
1
0
null
null
null
null
UTF-8
Python
false
false
23,748
py
# -*- coding: utf-8 -*- """Windows Registry plugin to parse the Application Compatibility Cache key.""" import construct import logging from plaso.events import time_events from plaso.lib import binary from plaso.lib import eventdata from plaso.parsers import winreg from plaso.parsers.winreg_plugins import interface class AppCompatCacheEvent(time_events.FiletimeEvent): """Class that contains the event object for AppCompatCache entries.""" DATA_TYPE = u'windows:registry:appcompatcache' def __init__( self, filetime, usage, key_name, entry_index, path, offset): """Initializes a Windows Registry event. Args: filetime: The FILETIME timestamp value. usage: The description of the usage of the time value. key_name: The name of the corresponding Windows Registry key. entry_index: The cache entry index number for the record. path: The full path to the executable. offset: The (data) offset of the Windows Registry key or value. """ super(AppCompatCacheEvent, self).__init__(filetime, usage) self.entry_index = entry_index self.keyname = key_name self.offset = offset self.path = path class AppCompatCacheHeader(object): """Class that contains the Application Compatibility Cache header.""" def __init__(self): """Initializes the header object.""" super(AppCompatCacheHeader, self).__init__() self.number_of_cached_entries = 0 self.header_size = 0 class AppCompatCacheCachedEntry(object): """Class that contains the Application Compatibility Cache cached entry.""" def __init__(self): """Initializes the cached entry object.""" super(AppCompatCacheCachedEntry, self).__init__() self.cached_entry_size = 0 self.data = None self.file_size = None self.insertion_flags = None self.last_modification_time = None self.last_update_time = None self.shim_flags = None self.path = None class AppCompatCachePlugin(interface.WindowsRegistryPlugin): """Class that parses the Application Compatibility Cache Registry data.""" NAME = u'appcompatcache' DESCRIPTION = u'Parser for Application Compatibility Cache Registry data.' FILTERS = frozenset([ interface.WindowsRegistryKeyPathFilter( u'HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\' u'Session Manager\\AppCompatibility'), interface.WindowsRegistryKeyPathFilter( u'HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\' u'Session Manager\\AppCompatCache')]) URLS = [ (u'https://github.com/libyal/winreg-kb/blob/master/documentation/' u'Application%20Compatibility%20Cache%20key.asciidoc')] _FORMAT_TYPE_2000 = 1 _FORMAT_TYPE_XP = 2 _FORMAT_TYPE_2003 = 3 _FORMAT_TYPE_VISTA = 4 _FORMAT_TYPE_7 = 5 _FORMAT_TYPE_8 = 6 _FORMAT_TYPE_10 = 7 # AppCompatCache format signature used in Windows XP. _HEADER_SIGNATURE_XP = 0xdeadbeef # AppCompatCache format used in Windows XP. _HEADER_XP_32BIT_STRUCT = construct.Struct( u'appcompatcache_header_xp', construct.ULInt32(u'signature'), construct.ULInt32(u'number_of_cached_entries'), construct.ULInt32(u'unknown1'), construct.ULInt32(u'unknown2'), construct.Padding(384)) _CACHED_ENTRY_XP_32BIT_STRUCT = construct.Struct( u'appcompatcache_cached_entry_xp_32bit', construct.Array(528, construct.Byte(u'path')), construct.ULInt64(u'last_modification_time'), construct.ULInt64(u'file_size'), construct.ULInt64(u'last_update_time')) # AppCompatCache format signature used in Windows 2003, Vista and 2008. _HEADER_SIGNATURE_2003 = 0xbadc0ffe # AppCompatCache format used in Windows 2003. _HEADER_2003_STRUCT = construct.Struct( u'appcompatcache_header_2003', construct.ULInt32(u'signature'), construct.ULInt32(u'number_of_cached_entries')) _CACHED_ENTRY_2003_32BIT_STRUCT = construct.Struct( u'appcompatcache_cached_entry_2003_32bit', construct.ULInt16(u'path_size'), construct.ULInt16(u'maximum_path_size'), construct.ULInt32(u'path_offset'), construct.ULInt64(u'last_modification_time'), construct.ULInt64(u'file_size')) _CACHED_ENTRY_2003_64BIT_STRUCT = construct.Struct( u'appcompatcache_cached_entry_2003_64bit', construct.ULInt16(u'path_size'), construct.ULInt16(u'maximum_path_size'), construct.ULInt32(u'unknown1'), construct.ULInt64(u'path_offset'), construct.ULInt64(u'last_modification_time'), construct.ULInt64(u'file_size')) # AppCompatCache format used in Windows Vista and 2008. _CACHED_ENTRY_VISTA_32BIT_STRUCT = construct.Struct( u'appcompatcache_cached_entry_vista_32bit', construct.ULInt16(u'path_size'), construct.ULInt16(u'maximum_path_size'), construct.ULInt32(u'path_offset'), construct.ULInt64(u'last_modification_time'), construct.ULInt32(u'insertion_flags'), construct.ULInt32(u'shim_flags')) _CACHED_ENTRY_VISTA_64BIT_STRUCT = construct.Struct( u'appcompatcache_cached_entry_vista_64bit', construct.ULInt16(u'path_size'), construct.ULInt16(u'maximum_path_size'), construct.ULInt32(u'unknown1'), construct.ULInt64(u'path_offset'), construct.ULInt64(u'last_modification_time'), construct.ULInt32(u'insertion_flags'), construct.ULInt32(u'shim_flags')) # AppCompatCache format signature used in Windows 7 and 2008 R2. _HEADER_SIGNATURE_7 = 0xbadc0fee # AppCompatCache format used in Windows 7 and 2008 R2. _HEADER_7_STRUCT = construct.Struct( u'appcompatcache_header_7', construct.ULInt32(u'signature'), construct.ULInt32(u'number_of_cached_entries'), construct.Padding(120)) _CACHED_ENTRY_7_32BIT_STRUCT = construct.Struct( u'appcompatcache_cached_entry_7_32bit', construct.ULInt16(u'path_size'), construct.ULInt16(u'maximum_path_size'), construct.ULInt32(u'path_offset'), construct.ULInt64(u'last_modification_time'), construct.ULInt32(u'insertion_flags'), construct.ULInt32(u'shim_flags'), construct.ULInt32(u'data_size'), construct.ULInt32(u'data_offset')) _CACHED_ENTRY_7_64BIT_STRUCT = construct.Struct( u'appcompatcache_cached_entry_7_64bit', construct.ULInt16(u'path_size'), construct.ULInt16(u'maximum_path_size'), construct.ULInt32(u'unknown1'), construct.ULInt64(u'path_offset'), construct.ULInt64(u'last_modification_time'), construct.ULInt32(u'insertion_flags'), construct.ULInt32(u'shim_flags'), construct.ULInt64(u'data_size'), construct.ULInt64(u'data_offset')) # AppCompatCache format used in Windows 8.0 and 8.1. _HEADER_SIGNATURE_8 = 0x00000080 _HEADER_8_STRUCT = construct.Struct( u'appcompatcache_header_8', construct.ULInt32(u'signature'), construct.Padding(124)) _CACHED_ENTRY_HEADER_8_STRUCT = construct.Struct( u'appcompatcache_cached_entry_header_8', construct.ULInt32(u'signature'), construct.ULInt32(u'unknown1'), construct.ULInt32(u'cached_entry_data_size'), construct.ULInt16(u'path_size')) # AppCompatCache format used in Windows 8.0. _CACHED_ENTRY_SIGNATURE_8_0 = b'00ts' # AppCompatCache format used in Windows 8.1. _CACHED_ENTRY_SIGNATURE_8_1 = b'10ts' # AppCompatCache format used in Windows 10 _HEADER_SIGNATURE_10 = 0x00000030 _HEADER_10_STRUCT = construct.Struct( u'appcompatcache_header_8', construct.ULInt32(u'signature'), construct.ULInt32(u'unknown1'), construct.Padding(28), construct.ULInt32(u'number_of_cached_entries'), construct.Padding(8)) def _CheckSignature(self, value_data): """Parses and validates the signature. Args: value_data: a binary string containing the value data. Returns: The format type if successful or None otherwise. """ signature = construct.ULInt32(u'signature').parse(value_data) if signature == self._HEADER_SIGNATURE_XP: return self._FORMAT_TYPE_XP elif signature == self._HEADER_SIGNATURE_2003: # TODO: determine which format version is used (2003 or Vista). return self._FORMAT_TYPE_2003 elif signature == self._HEADER_SIGNATURE_7: return self._FORMAT_TYPE_7 elif signature == self._HEADER_SIGNATURE_8: if value_data[signature:signature + 4] in [ self._CACHED_ENTRY_SIGNATURE_8_0, self._CACHED_ENTRY_SIGNATURE_8_1]: return self._FORMAT_TYPE_8 elif signature == self._HEADER_SIGNATURE_10: # Windows 10 uses the same cache entry signature as Windows 8.1 if value_data[signature:signature + 4] in [ self._CACHED_ENTRY_SIGNATURE_8_1]: return self._FORMAT_TYPE_10 def _DetermineCacheEntrySize( self, format_type, value_data, cached_entry_offset): """Determines the size of a cached entry. Args: format_type: integer value that contains the format type. value_data: a binary string containing the value data. cached_entry_offset: integer value that contains the offset of the first cached entry data relative to the start of the value data. Returns: The cached entry size if successful or None otherwise. Raises: RuntimeError: if the format type is not supported. """ if format_type not in [ self._FORMAT_TYPE_XP, self._FORMAT_TYPE_2003, self._FORMAT_TYPE_VISTA, self._FORMAT_TYPE_7, self._FORMAT_TYPE_8, self._FORMAT_TYPE_10]: raise RuntimeError( u'[{0:s}] Unsupported format type: {1:d}'.format( self.NAME, format_type)) cached_entry_data = value_data[cached_entry_offset:] cached_entry_size = 0 if format_type == self._FORMAT_TYPE_XP: cached_entry_size = self._CACHED_ENTRY_XP_32BIT_STRUCT.sizeof() elif format_type in [ self._FORMAT_TYPE_2003, self._FORMAT_TYPE_VISTA, self._FORMAT_TYPE_7]: path_size = construct.ULInt16(u'path_size').parse(cached_entry_data[0:2]) maximum_path_size = construct.ULInt16(u'maximum_path_size').parse( cached_entry_data[2:4]) path_offset_32bit = construct.ULInt32(u'path_offset').parse( cached_entry_data[4:8]) path_offset_64bit = construct.ULInt32(u'path_offset').parse( cached_entry_data[8:16]) if maximum_path_size < path_size: logging.error( u'[{0:s}] Path size value out of bounds.'.format(self.NAME)) return path_end_of_string_size = maximum_path_size - path_size if path_size == 0 or path_end_of_string_size != 2: logging.error( u'[{0:s}] Unsupported path size values.'.format(self.NAME)) return # Assume the entry is 64-bit if the 32-bit path offset is 0 and # the 64-bit path offset is set. if path_offset_32bit == 0 and path_offset_64bit != 0: if format_type == self._FORMAT_TYPE_2003: cached_entry_size = self._CACHED_ENTRY_2003_64BIT_STRUCT.sizeof() elif format_type == self._FORMAT_TYPE_VISTA: cached_entry_size = self._CACHED_ENTRY_VISTA_64BIT_STRUCT.sizeof() elif format_type == self._FORMAT_TYPE_7: cached_entry_size = self._CACHED_ENTRY_7_64BIT_STRUCT.sizeof() else: if format_type == self._FORMAT_TYPE_2003: cached_entry_size = self._CACHED_ENTRY_2003_32BIT_STRUCT.sizeof() elif format_type == self._FORMAT_TYPE_VISTA: cached_entry_size = self._CACHED_ENTRY_VISTA_32BIT_STRUCT.sizeof() elif format_type == self._FORMAT_TYPE_7: cached_entry_size = self._CACHED_ENTRY_7_32BIT_STRUCT.sizeof() elif format_type in [self._FORMAT_TYPE_8, self._FORMAT_TYPE_10]: cached_entry_size = self._CACHED_ENTRY_HEADER_8_STRUCT.sizeof() return cached_entry_size def _ParseHeader(self, format_type, value_data): """Parses the header. Args: format_type: integer value that contains the format type. value_data: a binary string containing the value data. Returns: A header object (instance of AppCompatCacheHeader). Raises: RuntimeError: if the format type is not supported. """ if format_type not in [ self._FORMAT_TYPE_XP, self._FORMAT_TYPE_2003, self._FORMAT_TYPE_VISTA, self._FORMAT_TYPE_7, self._FORMAT_TYPE_8, self._FORMAT_TYPE_10]: raise RuntimeError( u'[{0:s}] Unsupported format type: {1:d}'.format( self.NAME, format_type)) # TODO: change to collections.namedtuple or use __slots__ if the overhead # of a regular object becomes a problem. header_object = AppCompatCacheHeader() if format_type == self._FORMAT_TYPE_XP: header_object.header_size = self._HEADER_XP_32BIT_STRUCT.sizeof() header_struct = self._HEADER_XP_32BIT_STRUCT.parse(value_data) elif format_type == self._FORMAT_TYPE_2003: header_object.header_size = self._HEADER_2003_STRUCT.sizeof() header_struct = self._HEADER_2003_STRUCT.parse(value_data) elif format_type == self._FORMAT_TYPE_VISTA: header_object.header_size = self._HEADER_VISTA_STRUCT.sizeof() header_struct = self._HEADER_VISTA_STRUCT.parse(value_data) elif format_type == self._FORMAT_TYPE_7: header_object.header_size = self._HEADER_7_STRUCT.sizeof() header_struct = self._HEADER_7_STRUCT.parse(value_data) elif format_type == self._FORMAT_TYPE_8: header_object.header_size = self._HEADER_8_STRUCT.sizeof() header_struct = self._HEADER_8_STRUCT.parse(value_data) elif format_type == self._FORMAT_TYPE_10: header_object.header_size = self._HEADER_10_STRUCT.sizeof() header_struct = self._HEADER_10_STRUCT.parse(value_data) if format_type in [ self._FORMAT_TYPE_XP, self._FORMAT_TYPE_2003, self._FORMAT_TYPE_VISTA, self._FORMAT_TYPE_7, self._FORMAT_TYPE_10]: header_object.number_of_cached_entries = header_struct.get( u'number_of_cached_entries') return header_object def _ParseCachedEntry( self, format_type, value_data, cached_entry_offset, cached_entry_size): """Parses a cached entry. Args: format_type: integer value that contains the format type. value_data: a binary string containing the value data. cached_entry_offset: integer value that contains the offset of the cached entry data relative to the start of the value data. cached_entry_size: integer value that contains the cached entry data size. Returns: A cached entry object (instance of AppCompatCacheCachedEntry). Raises: RuntimeError: if the format type is not supported. """ if format_type not in [ self._FORMAT_TYPE_XP, self._FORMAT_TYPE_2003, self._FORMAT_TYPE_VISTA, self._FORMAT_TYPE_7, self._FORMAT_TYPE_8, self._FORMAT_TYPE_10]: raise RuntimeError( u'[{0:s}] Unsupported format type: {1:d}'.format( self.NAME, format_type)) cached_entry_data = value_data[ cached_entry_offset:cached_entry_offset + cached_entry_size] cached_entry_struct = None if format_type == self._FORMAT_TYPE_XP: if cached_entry_size == self._CACHED_ENTRY_XP_32BIT_STRUCT.sizeof(): cached_entry_struct = self._CACHED_ENTRY_XP_32BIT_STRUCT.parse( cached_entry_data) elif format_type == self._FORMAT_TYPE_2003: if cached_entry_size == self._CACHED_ENTRY_2003_32BIT_STRUCT.sizeof(): cached_entry_struct = self._CACHED_ENTRY_2003_32BIT_STRUCT.parse( cached_entry_data) elif cached_entry_size == self._CACHED_ENTRY_2003_64BIT_STRUCT.sizeof(): cached_entry_struct = self._CACHED_ENTRY_2003_64BIT_STRUCT.parse( cached_entry_data) elif format_type == self._FORMAT_TYPE_VISTA: if cached_entry_size == self._CACHED_ENTRY_VISTA_32BIT_STRUCT.sizeof(): cached_entry_struct = self._CACHED_ENTRY_VISTA_32BIT_STRUCT.parse( cached_entry_data) elif cached_entry_size == self._CACHED_ENTRY_VISTA_64BIT_STRUCT.sizeof(): cached_entry_struct = self._CACHED_ENTRY_VISTA_64BIT_STRUCT.parse( cached_entry_data) elif format_type == self._FORMAT_TYPE_7: if cached_entry_size == self._CACHED_ENTRY_7_32BIT_STRUCT.sizeof(): cached_entry_struct = self._CACHED_ENTRY_7_32BIT_STRUCT.parse( cached_entry_data) elif cached_entry_size == self._CACHED_ENTRY_7_64BIT_STRUCT.sizeof(): cached_entry_struct = self._CACHED_ENTRY_7_64BIT_STRUCT.parse( cached_entry_data) elif format_type in [self._FORMAT_TYPE_8, self._FORMAT_TYPE_10]: if cached_entry_data[0:4] not in [ self._CACHED_ENTRY_SIGNATURE_8_0, self._CACHED_ENTRY_SIGNATURE_8_1]: raise RuntimeError( u'[{0:s}] Unsupported cache entry signature'.format(self.NAME)) if cached_entry_size == self._CACHED_ENTRY_HEADER_8_STRUCT.sizeof(): cached_entry_struct = self._CACHED_ENTRY_HEADER_8_STRUCT.parse( cached_entry_data) cached_entry_data_size = cached_entry_struct.get( u'cached_entry_data_size') cached_entry_size = 12 + cached_entry_data_size cached_entry_data = value_data[ cached_entry_offset:cached_entry_offset + cached_entry_size] if not cached_entry_struct: raise RuntimeError( u'[{0:s}] Unsupported cache entry size: {1:d}'.format( self.NAME, cached_entry_size)) cached_entry_object = AppCompatCacheCachedEntry() cached_entry_object.cached_entry_size = cached_entry_size path_offset = 0 data_size = 0 if format_type == self._FORMAT_TYPE_XP: string_size = 0 for string_index in xrange(0, 528, 2): if (ord(cached_entry_data[string_index]) == 0 and ord(cached_entry_data[string_index + 1]) == 0): break string_size += 2 cached_entry_object.path = binary.UTF16StreamCopyToString( cached_entry_data[0:string_size]) elif format_type in [ self._FORMAT_TYPE_2003, self._FORMAT_TYPE_VISTA, self._FORMAT_TYPE_7]: path_size = cached_entry_struct.get(u'path_size') path_offset = cached_entry_struct.get(u'path_offset') elif format_type in [self._FORMAT_TYPE_8, self._FORMAT_TYPE_10]: path_size = cached_entry_struct.get(u'path_size') cached_entry_data_offset = 14 + path_size cached_entry_object.path = binary.UTF16StreamCopyToString( cached_entry_data[14:cached_entry_data_offset]) if format_type == self._FORMAT_TYPE_8: remaining_data = cached_entry_data[cached_entry_data_offset:] cached_entry_object.insertion_flags = construct.ULInt32( u'insertion_flags').parse(remaining_data[0:4]) cached_entry_object.shim_flags = construct.ULInt32( u'shim_flags').parse(remaining_data[4:8]) if cached_entry_data[0:4] == self._CACHED_ENTRY_SIGNATURE_8_0: cached_entry_data_offset += 8 elif cached_entry_data[0:4] == self._CACHED_ENTRY_SIGNATURE_8_1: cached_entry_data_offset += 10 remaining_data = cached_entry_data[cached_entry_data_offset:] if format_type in [ self._FORMAT_TYPE_XP, self._FORMAT_TYPE_2003, self._FORMAT_TYPE_VISTA, self._FORMAT_TYPE_7]: cached_entry_object.last_modification_time = cached_entry_struct.get( u'last_modification_time') elif format_type in [self._FORMAT_TYPE_8, self._FORMAT_TYPE_10]: cached_entry_object.last_modification_time = construct.ULInt64( u'last_modification_time').parse(remaining_data[0:8]) if format_type in [self._FORMAT_TYPE_XP, self._FORMAT_TYPE_2003]: cached_entry_object.file_size = cached_entry_struct.get(u'file_size') elif format_type in [self._FORMAT_TYPE_VISTA, self._FORMAT_TYPE_7]: cached_entry_object.insertion_flags = cached_entry_struct.get( u'insertion_flags') cached_entry_object.shim_flags = cached_entry_struct.get(u'shim_flags') if format_type == self._FORMAT_TYPE_XP: cached_entry_object.last_update_time = cached_entry_struct.get( u'last_update_time') if format_type == self._FORMAT_TYPE_7: data_offset = cached_entry_struct.get(u'data_offset') data_size = cached_entry_struct.get(u'data_size') elif format_type in [self._FORMAT_TYPE_8, self._FORMAT_TYPE_10]: data_offset = cached_entry_offset + cached_entry_data_offset + 12 data_size = construct.ULInt32(u'data_size').parse(remaining_data[8:12]) if path_offset > 0 and path_size > 0: path_size += path_offset cached_entry_object.path = binary.UTF16StreamCopyToString( value_data[path_offset:path_size]) if data_size > 0: data_size += data_offset cached_entry_object.data = value_data[data_offset:data_size] return cached_entry_object def GetEntries(self, parser_mediator, registry_key, **kwargs): """Extracts event objects from a Application Compatibility Cache key. Args: parser_mediator: A parser mediator object (instance of ParserMediator). registry_key: A Windows Registry key (instance of dfwinreg.WinRegistryKey). """ value = registry_key.GetValueByName(u'AppCompatCache') if not value: return value_data = value.data value_data_size = len(value.data) format_type = self._CheckSignature(value_data) if not format_type: parser_mediator.ProduceParseError( u'Unsupported signature in AppCompatCache key: {0:s}'.format( registry_key.path)) return header_object = self._ParseHeader(format_type, value_data) # On Windows Vista and 2008 when the cache is empty it will # only consist of the header. if value_data_size <= header_object.header_size: return cached_entry_offset = header_object.header_size cached_entry_size = self._DetermineCacheEntrySize( format_type, value_data, cached_entry_offset) if not cached_entry_size: parser_mediator.ProduceParseError(( u'Unsupported cached entry size at offset {0:d} in AppCompatCache ' u'key: {1:s}').format(cached_entry_offset, registry_key.path)) return cached_entry_index = 0 while cached_entry_offset < value_data_size: cached_entry_object = self._ParseCachedEntry( format_type, value_data, cached_entry_offset, cached_entry_size) if cached_entry_object.last_modification_time is not None: # TODO: refactor to file modification event. event_object = AppCompatCacheEvent( cached_entry_object.last_modification_time, u'File Last Modification Time', registry_key.path, cached_entry_index + 1, cached_entry_object.path, cached_entry_offset) parser_mediator.ProduceEvent(event_object) if cached_entry_object.last_update_time is not None: # TODO: refactor to process run event. event_object = AppCompatCacheEvent( cached_entry_object.last_update_time, eventdata.EventTimestamp.LAST_RUNTIME, registry_key.path, cached_entry_index + 1, cached_entry_object.path, cached_entry_offset) parser_mediator.ProduceEvent(event_object) cached_entry_offset += cached_entry_object.cached_entry_size cached_entry_index += 1 if (header_object.number_of_cached_entries != 0 and cached_entry_index >= header_object.number_of_cached_entries): break winreg.WinRegistryParser.RegisterPlugin(AppCompatCachePlugin)
b5653a6f9699da39d8c2d60fdac5941697f1abbc
afb2bdf8044e4c9ff09b1b8379efbc17867d8cc0
/2parts/challenge/challenge2.py
cf8359ef6d86b17dfe0a1b0bb22f142f4a785437
[]
no_license
ChenFu0420/leranpython
b2e364ff8d6730a3eb768b76f0369faa3367dfa2
52d0aa614d7fab19e17bbb696330a0330d3862b6
refs/heads/master
2020-05-29T19:46:24.020046
2019-09-25T09:17:10
2019-09-25T09:17:10
189,339,151
0
0
null
null
null
null
UTF-8
Python
false
false
244
py
num1 = int(input("输入一个数")) num2 = int(input("再输一个数")) #两数之和 print("两个数的和是:", num1 + num2) #两数之差 print("两个数的差是:", num1 - num2) #两数乘积 print("两数乘积是:", num1 * num2)
f6799deed3adf5955c953244b8e21ad2a510e6ff
48b67d5a7149376b5949f12641fa14cb8404a359
/accounts/migrations/0005_auto_20181018_1754.py
b8183ba6fad46552feeae9eae696552ad9b89ceb
[]
no_license
mishaukr7/simple_blog
7f962dce438b9bab03b0ddabfc1ce47d57e9cb5b
c00aba56afe4caad77dfa5f058e3ab8e1e8919b1
refs/heads/master
2020-04-01T23:21:28.176890
2018-10-19T08:58:14
2018-10-19T08:58:14
153,754,245
0
0
null
null
null
null
UTF-8
Python
false
false
596
py
# Generated by Django 2.1.2 on 2018-10-18 17:54 from django.db import migrations import django.db.models.deletion import smart_selects.db_fields class Migration(migrations.Migration): dependencies = [ ('accounts', '0004_auto_20181018_1712'), ] operations = [ migrations.AlterField( model_name='profile', name='city', field=smart_selects.db_fields.ChainedForeignKey(blank=True, chained_field='country', chained_model_field='country', null=True, on_delete=django.db.models.deletion.CASCADE, to='accounts.City'), ), ]
629c520da224ca08d1b463ba82b88210faa9c090
7248b86a0a882badb20f83be57748fae89311c7d
/case01/migrations/0001_initial.py
b1c221b705f2a710eea22d9f679f6ea50702fa6f
[]
no_license
daiyeyue/daiyeDRF
2164ae4e6d611f577d1fac9e84dd8fcd83b3f909
884f0dcf4bbedf2c17842d7dc05dc3603cc95877
refs/heads/master
2020-12-03T12:48:02.551331
2020-01-02T06:38:12
2020-01-02T06:38:12
231,322,648
0
0
null
null
null
null
UTF-8
Python
false
false
1,263
py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='ClassRoom', fields=[ ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)), ('roomName', models.CharField(max_length=20)), ('loc', models.CharField(max_length=20)), ], ), migrations.CreateModel( name='Student', fields=[ ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)), ('name', models.CharField(max_length=5)), ('age', models.IntegerField()), ], ), migrations.CreateModel( name='Teacher', fields=[ ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)), ('course', models.CharField(max_length=20)), ('name', models.CharField(max_length=5)), ('age', models.IntegerField()), ], ), ]
187cb4166766dd206e5197b34e86bd8da22e166b
a560269290749e10466b1a29584f06a2b8385a47
/Notebooks/py/hyzhak/titanic-for-beginners/titanic-for-beginners.py
7cbd2fb9d328cf687072a6f9cfbb5913b2a286e8
[]
no_license
nischalshrestha/automatic_wat_discovery
c71befad1aa358ae876d5494a67b0f4aa1266f23
982e700d8e4698a501afffd6c3a2f35346c34f95
refs/heads/master
2022-04-07T12:40:24.376871
2020-03-15T22:27:39
2020-03-15T22:27:39
208,379,586
2
1
null
null
null
null
UTF-8
Python
false
false
16,438
py
#!/usr/bin/env python # coding: utf-8 # # Titanic for beginners # it is basic introduction to Kaggle. # # ## Workflow # 1. Import Necessary Libraries # 2. Acquire training and testing data. # 3. Analyze, Visualize data # 1. Outlets (errors or possibly innacurate values) ? # 2. Create new feature? # 4. Clearning data # 5. Choosing the Best Model # 6. Creating Submission File # ## 1. Import Necessary Libraries # In[ ]: import matplotlib.pyplot as plt import numpy as np import pandas as pd from pprint import pprint import seaborn as sns import sklearn from sklearn import ensemble, linear_model, naive_bayes, neighbors, svm, tree import subprocess get_ipython().magic(u'matplotlib inline') # ## 2. Acquire training and testing data # In[ ]: train_df = pd.read_csv('../input/train.csv') test_df = pd.read_csv('../input/test.csv') combine = [train_df, test_df] # ## 3. Analyze, Visualize data # ### Take a look on data # In[ ]: train_df.head() # In[ ]: train_df.tail() # ### Analyze features # - **Which features are categorical?** - Survived, Sex, and Embarked. Ordinal: Pclass. # - **Which features are numerical?** - Age, Fare. Discrete: SibSp, Parch. # - **Which features are mixed data types?** - Ticket is a mix of numeric and alphanumeric data types. Cabin is alphanumeric. # - **Which features may contain errors or typos?** - Name feature may contain errors or typos as there are several ways used to describe a name including titles, round brackets, and quotes used for alternative or short names. # - **Which features contain blank, null or empty values?** - Cabin > Age > Embarked features contain a number of null values in that order for the training dataset. Cabin > Age are incomplete in case of test dataset. # - **What are the data types for various features?** - Seven features are integer or floats. Six in case of test dataset. Five features are strings (object). # - **What is the distribution of numerical feature values across the samples?** # - Total samples are 891 or 40\% of the actual number of passengers on board the Titanic (2,224). # - Survived is a categorical feature with 0 or 1 values. # - Around 38\% samples survived representative of the actual survival rate at 32%. # - Most passengers `(> 75\%)` did not travel with parents or children. # - Nearly 30\% of the passengers had siblings and/or spouse aboard. # - Fares varied significantly with few passengers `(<1\%)` paying as high as $512. # - Few elderly passengers (<1\%) within age range 65-80. # - TODO: *distribution of age and distribution survived index by age* # - TODO: *what is survived index of single persons (without children, parents, siblings or spouse)?* # - TODO: *what is distribution of age of single persons?* # - TODO: *what is survived index of not single persons which has more stronger relative (wife and husband, child vs parent and etc)* # - **What is the distribution of categorical features?** # - Names are unique across the dataset (count=unique=891) # - Sex variable as two possible values with `65\%` male (top=male, freq=577/count=891). # - Cabin values have several dupicates across samples. Alternatively several passengers shared a cabin. # - Embarked takes three possible values. S port used by most passengers (top=S) # - Ticket feature has high ratio (22\%) of duplicate values (unique=681). # # In[ ]: print('# features:') print(train_df.columns.values) print('_'*40) print('# data types:') train_df.info() print('_'*40) test_df.info() # In[ ]: # numberical features train_df.describe() # In[ ]: # categorical features train_df.describe(include=['O']) # ### Assumtions based on data analysis # - **Correlating** - check correlaction of each feature with survive index # - **Completing** - try to complete significant feature (**Age**, **Embarked**) # - **Correcting** # - **Ticket** feature may be dropped from our analysis as it contains high ratio of duplicates (22%) and there may not be a correlation between Ticket and survival. # - **Cabin** feature may be dropped as it is highly incomplete or contains many null values both in training and test dataset. # - **PassengerId** may be dropped from training dataset as it does not contribute to survival. # - **Name** feature is relatively non-standard, may not contribute directly to survival, so maybe dropped. # - **Creating** # - We may want to create a new feature called **Family** based on Parch and SibSp to get total count of family members on board. # - We may want to engineer the **Name** feature to extract Title as a new feature. *ME: does it really influent on survive index?* # - We may want to create new feature for **Age bands**. This turns a continous numerical feature into an ordinal categorical feature. # - We may also want to create a **Fare range** feature if it helps our analysis. # - **Classifying** # - Women (**Sex**=female) were more likely to have survived # - Children (**Age**<?) were more likely to have survived # - The upper-class passengers (**Pclass**=1) were more likely to have survived # ### Analyze by pivoting features # - **Pclass** We observe significant correlation (>0.5) among Pclass=1 and Survived (classifying #3). We decide to include this feature in our model. # - **Sex** We confirm the observation during problem definition that Sex=female had very high survival rate at 74% (classifying #1). # - **SibSp** and **Parch** These features have zero correlation for certain values. It may be best to derive a feature or a set of features from these individual features (creating #1). # In[ ]: def chance_to_survive_by_feature(feature_name): return train_df[[feature_name, 'Survived']] .groupby([feature_name]) .mean() .sort_values(by='Survived', ascending=False) chance_to_survive_by_feature('Pclass') # In[ ]: chance_to_survive_by_feature('Sex') # In[ ]: chance_to_survive_by_feature('SibSp') # In[ ]: chance_to_survive_by_feature('Parch') # ## Visualization # - Infants (Age <=4) had high survival rate. # - Oldest passengers (Age = 80) survived. # - Large number of 15-25 year olds did not survive. # - Most passengers are in 15-35 age range. # In[ ]: g = sns.FacetGrid(train_df, col='Survived') g.map(plt.hist, 'Age', bins=20); # - Pclass=3 had most passengers, however most did not survive. Confirms our classifying assumption #2. # - Infant passengers in Pclass=2 and Pclass=3 mostly survived. Further qualifies our classifying assumption #2. # - Most passengers in Pclass=1 survived. Confirms our classifying assumption #3. # - Pclass varies in terms of Age distribution of passengers. # In[ ]: grid = sns.FacetGrid(train_df, col='Survived', row='Pclass', size=2.2, aspect=1.6) grid.map(plt.hist, 'Age', alpha=.5, bins=20) grid.add_legend(); # In[ ]: ordered_embarked = train_df.Embarked.value_counts().index grid = sns.FacetGrid(train_df, row='Embarked', size=2.2, aspect=1.6) grid.map(sns.pointplot, 'Pclass', 'Survived', 'Sex', palette='deep') grid.add_legend(); # In[ ]: grid = sns.FacetGrid(train_df, row='Embarked', col='Survived', size=2.2, aspect=1.6) grid.map(sns.barplot, 'Sex', 'Fare', alpha=.5, ci=None) grid.add_legend(); # - Higher fare paying passengers had better survival. Confirms our assumption for creating (#4) fare ranges. # - Port of embarkation correlates with survival rates. Confirms correlating (#1) and completing (#2). # # Clearning data # ## Drop features # In[ ]: print("Before", train_df.shape, test_df.shape, combine[0].shape, combine[1].shape) train_df = train_df.drop(['Ticket', 'Cabin', 'PassengerId'], axis=1) test_df = test_df.drop(['Ticket', 'Cabin'], axis=1) combine = [train_df, test_df] print("After ", train_df.shape, test_df.shape, combine[0].shape, combine[1].shape) # ## Create new feature # ### Create 'Title' and drop 'Name' # In[ ]: for dataset in combine: dataset['Title'] = dataset.Name.str.extract(' ([A-Za-z]+)\.', expand=False) pd.crosstab(train_df['Title'], train_df['Sex']) # In[ ]: for dataset in combine: dataset['Title'] = dataset['Title'].replace(['Lady', 'Countess','Capt', 'Col', 'Don', 'Dr', 'Major', 'Rev', 'Sir', 'Jonkheer', 'Dona'], 'Rare') dataset['Title'] = dataset['Title'].replace('Mlle', 'Miss') dataset['Title'] = dataset['Title'].replace('Ms', 'Miss') dataset['Title'] = dataset['Title'].replace('Mme', 'Mrs') train_df[['Title', 'Survived']].groupby(['Title'], as_index=False).mean() # In[ ]: title_mapping = {"Mr": 1, "Miss": 2, "Mrs": 3, "Master": 4, "Rare": 5} for dataset in combine: dataset['Title'] = dataset['Title'].map(title_mapping) dataset['Title'] = dataset['Title'].fillna(0) train_df.head() # In[ ]: train_df = train_df.drop(['Name'], axis=1) test_df = test_df.drop(['Name'], axis=1) combine = [train_df, test_df] train_df.shape, test_df.shape # ## Convert Sex type to number # In[ ]: for dataset in combine: dataset['Sex'] = dataset['Sex'].map( {'female': 1, 'male': 0} ).astype(int) train_df.head() # ## Completing a numerical continuous feature # Methods # - A simple way is to generate random numbers between mean and standard deviation. # - More accurate way of guessing missing values is to use other correlated features. In our case we note correlation among Age, Gender, and Pclass. Guess Age values using median values for Age across sets of Pclass and Gender feature combinations. So, median Age for Pclass=1 and Gender=0, Pclass=1 and Gender=1, and so on... # - Combine methods 1 and 2. So instead of guessing age values based on median, use random numbers between mean and standard deviation, based on sets of Pclass and Gender combinations. # # # ### Age # # In[ ]: grid = sns.FacetGrid(train_df, row='Pclass', col='Sex', size=2.2, aspect=1.6) grid.map(plt.hist, 'Age', alpha=.5, bins=20) grid.add_legend(); # In[ ]: guess_ages = np.zeros((2,3)) for dataset in combine: for i in range(0, 2): for j in range(0, 3): guess_df = dataset[(dataset['Sex'] == i) & (dataset['Pclass'] == j+1)]['Age'].dropna() # age_mean = guess_df.mean() # age_std = guess_df.std() # age_guess = rnd.uniform(age_mean - age_std, age_mean + age_std) age_guess = guess_df.median() # Convert random age float to nearest .5 age guess_ages[i,j] = int( age_guess/0.5 + 0.5 ) * 0.5 for i in range(0, 2): for j in range(0, 3): dataset.loc[ (dataset.Age.isnull()) & (dataset.Sex == i) & (dataset.Pclass == j+1), 'Age'] = guess_ages[i,j] dataset['Age'] = dataset['Age'].astype(int) train_df['AgeBand'] = pd.cut(train_df['Age'], 5) train_df[['AgeBand', 'Survived']].groupby(['AgeBand'], as_index=False).mean().sort_values(by='AgeBand', ascending=True) # In[ ]: for dataset in combine: dataset.loc[ dataset['Age'] <= 16, 'Age'] = 0 dataset.loc[(dataset['Age'] > 16) & (dataset['Age'] <= 32), 'Age'] = 1 dataset.loc[(dataset['Age'] > 32) & (dataset['Age'] <= 48), 'Age'] = 2 dataset.loc[(dataset['Age'] > 48) & (dataset['Age'] <= 64), 'Age'] = 3 dataset.loc[ dataset['Age'] > 64, 'Age'] train_df.head() # In[ ]: train_df = train_df.drop(['AgeBand'], axis=1) combine = [train_df, test_df] train_df.head() # ## Create feature "FamilySize" # In[ ]: for dataset in combine: dataset['FamilySize'] = dataset['SibSp'] + dataset['Parch'] + 1 train_df[[ 'FamilySize', 'Survived', ]].groupby([ 'FamilySize' ], as_index=False)\ .mean()\ .sort_values(by='Survived', ascending=False) # ## Create feature "IsAlone" # In[ ]: for dataset in combine: dataset['IsAlone'] = 0 dataset.loc[dataset['FamilySize'] == 1, 'IsAlone'] = 1 train_df[[ 'IsAlone', 'Survived', ]]\ .groupby(['IsAlone'], as_index=False)\ .mean() # In[ ]: train_df = train_df.drop(['Parch', 'SibSp', 'FamilySize'], axis=1) test_df = test_df.drop(['Parch', 'SibSp', 'FamilySize'], axis=1) combine = [train_df, test_df] train_df.head() # ## Create artificial feature combining "Pclass and Age." # In[ ]: for dataset in combine: dataset['Age*Class'] = dataset.Age * dataset.Pclass train_df.loc[:, ['Age*Class', 'Age', 'Pclass']].head(10) # ## Complete missed values of feature "Embarked" # In[ ]: freq_port = train_df.Embarked.dropna().mode()[0] for dataset in combine: dataset['Embarked'] = dataset['Embarked'].fillna(freq_port) train_df[[ 'Embarked', 'Survived', ]]\ .groupby(['Embarked'], as_index=False)\ .mean()\ .sort_values(by='Survived', ascending=False) # ## Convert feature "Embarked" to numeric # In[ ]: for dataset in combine: dataset['Embarked'] = dataset['Embarked'].map( {'S': 0, 'C': 1, 'Q': 2} ).astype(int) train_df.head() # ## Complete one missed value for feature "Fare" # In[ ]: test_df['Fare'].fillna(test_df['Fare'].dropna().median(), inplace=True) test_df.head() # In[ ]: train_df['FareBand'] = pd.qcut(train_df['Fare'], 4) train_df[[ 'FareBand', 'Survived', ]]\ .groupby(['FareBand'], as_index=False)\ .mean()\ .sort_values(by='FareBand', ascending=True) # In[ ]: for dataset in combine: dataset.loc[ dataset['Fare'] <= 7.91, 'Fare'] = 0 dataset.loc[(dataset['Fare'] > 7.91) & (dataset['Fare'] <= 14.454), 'Fare'] = 1 dataset.loc[(dataset['Fare'] > 14.454) & (dataset['Fare'] <= 31), 'Fare'] = 2 dataset.loc[ dataset['Fare'] > 31, 'Fare'] = 3 dataset['Fare'] = dataset['Fare'].astype(int) train_df = train_df.drop(['FareBand'], axis=1) combine = [train_df, test_df] train_df.head(10) # # Model, predict and solve # Binary classification # In[ ]: X_train = train_df.drop("Survived", axis=1) Y_train = train_df["Survived"] X_test = test_df.drop("PassengerId", axis=1).copy() X_train.shape, Y_train.shape, X_test.shape # ## Logistic regression # logit regression, maximum-entropy classification (MaxEnt) or the log-linear classifier # In[ ]: models = [] models.append({ 'classifier': linear_model.LogisticRegression, 'name': 'Logistic Regression', }) models.append({ 'classifier': svm.SVC, 'name': 'Support Vector Machines', }) models.append({ 'classifier': neighbors.KNeighborsClassifier, 'name': 'k-Nearest Neighbors', 'args': { 'n_neighbors': 3, }, }) models.append({ 'classifier': naive_bayes.GaussianNB, 'name': 'Gaussian Naive Bayes', }) models.append({ 'classifier': linear_model.Perceptron, 'name': 'Perceptron', 'args': { 'max_iter': 5, 'tol': None, }, }) models.append({ 'classifier': svm.LinearSVC, 'name': 'Linear SVC', }) models.append({ 'classifier': linear_model.SGDClassifier, 'name': 'Stochastic Gradient Descent', 'args': { 'max_iter': 5, 'tol': None, }, }) models.append({ 'classifier': tree.DecisionTreeClassifier, 'name': 'Decision Tree', }) models.append({ 'classifier': ensemble.RandomForestClassifier, 'name': 'Random Forest', 'args': { 'n_estimators': 100, }, }) #acc_log # ## All Models # In[ ]: def process_model(model_desc): Model = model_desc['classifier'] model = Model(**model_desc.get('args', {})) model.fit(X_train, Y_train) Y_pred = model.predict(X_test) accuracy = round(model.score(X_train, Y_train) * 100, 2) return { 'name': model_desc['name'], 'accuracy': accuracy, 'model': model, } models_result = list(map(process_model, models)) models_result = sorted(models_result, key=lambda res: res['accuracy'], reverse=True) #print(models_result) # plot bars models_result_df = pd.DataFrame(models_result, columns=['accuracy', 'name']) ax = sns.barplot(data=models_result_df, x='accuracy', y='name') ax.set(xlim=(0, 100)) # show table models_result_df # In[ ]: # use keras (tensorflow) for full-convolutional deep NN # # Submit result # get the best model and submit the result # In[ ]: # submission.to_csv('../output/submission.csv', index=False) the_best_result = models_result[0] Y_pred = the_best_result['model'].predict(X_test) submission = pd.DataFrame({ 'PassengerId': test_df['PassengerId'], 'Survived': Y_pred, }) submission.to_csv('submission.csv', index=False)
51605ef74b4cba3582dbd4a581b09e1dbf06ec52
d491c11dc87a955c95a4e14a2feea19fe1fa859e
/python/Arcade/Python/P32WordPower.py
8e59958099ab4e818bb696c758d23213474a33a7
[]
no_license
Vagacoder/Codesignal
0f6ea791b25716cad7c46ab7df73679fb18a9882
87eaf44555603dd5b8cf221fbcbae5421ae20727
refs/heads/master
2023-07-16T04:18:44.780821
2021-08-15T18:41:16
2021-08-15T18:41:16
294,745,195
1
0
null
null
null
null
UTF-8
Python
false
false
1,148
py
# # * Python 32, Word Power # * Easy # * You've heard somewhere that a word is more powerful than an action. You decided # * to put this statement at a test by assigning a power value to each action and # * each word. To begin somewhere, you defined a power of a word as the sum of # * powers of its characters, where power of a character is equal to its 1-based # * index in the plaintext alphabet. # * Given a word, calculate its power. # * Example # For word = "hello", the output should be # wordPower(word) = 52. # Letters 'h', 'e', 'l' and 'o' have powers 8, 5, 12 and 15, respectively. Thus, the total power of the word is 8 + 5 + 12 + 12 + 15 = 52. # * Input/Output # [execution time limit] 4 seconds (py3) # [input] string word # A string consisting of lowercase English letters. # Guaranteed constraints: # 1 ≤ word.length ≤ 25. # [output] integer # Power of the given word. #%% # * Solution 1 import string def wordPower(word): num = {v:(i+1) for i, v in enumerate(string.ascii_lowercase)} return sum([num[ch] for ch in word]) a1 = 'hello' r1 = wordPower(a1) print(r1) # %%
6bf9fe564297c104e2d4a8e7f00109a5ee57bd30
14ff5ca733ce92c14dd347e32c7ad262026c48cf
/typeshed/rdflib/exceptions.pyi
4066f6854d2ffd93b18fa4bd16a05f92764610bd
[ "Apache-2.0" ]
permissive
common-workflow-language/cwlprov-py
6040bd1ea18fb58909bba9874f65e4edcc4ecd92
9b719c687484d3f888eb5f807ec3270e9081078a
refs/heads/main
2023-08-17T06:03:39.274209
2022-07-19T18:09:15
2022-07-19T18:21:13
148,144,870
1
2
Apache-2.0
2023-08-02T18:35:35
2018-09-10T11:27:31
Python
UTF-8
Python
false
false
761
pyi
from typing import Any class Error(Exception): msg: Any def __init__(self, msg: Any | None = ...) -> None: ... class TypeCheckError(Error): type: Any node: Any def __init__(self, node) -> None: ... class SubjectTypeError(TypeCheckError): msg: Any def __init__(self, node) -> None: ... class PredicateTypeError(TypeCheckError): msg: Any def __init__(self, node) -> None: ... class ObjectTypeError(TypeCheckError): msg: Any def __init__(self, node) -> None: ... class ContextTypeError(TypeCheckError): msg: Any def __init__(self, node) -> None: ... class ParserError(Error): msg: Any def __init__(self, msg) -> None: ... class UniquenessError(Error): def __init__(self, values) -> None: ...
f3abfbb514fdc985c0c51949272f13c43a7c3730
b799c3e1fe5a50b2babcfb2960af210dec434f49
/354.russian-doll-envelopes.py
facf0e6c6903adc2cda1b3f18cbef9f6574cf968
[]
no_license
Joecth/leetcode_3rd_vscode
4619ef80632dec83cbcbcd090f74e043f436cc75
3c0943ee9b373e4297aa43a4813f0033c284a5b2
refs/heads/master
2022-12-02T19:30:34.572339
2020-08-18T15:21:15
2020-08-18T15:21:15
255,601,035
0
0
null
null
null
null
UTF-8
Python
false
false
3,605
py
# # @lc app=leetcode id=354 lang=python3 # # [354] Russian Doll Envelopes # # https://leetcode.com/problems/russian-doll-envelopes/description/ # # algorithms # Hard (34.98%) # Likes: 981 # Dislikes: 37 # Total Accepted: 62.8K # Total Submissions: 178.5K # Testcase Example: '[[5,4],[6,4],[6,7],[2,3]]' # # You have a number of envelopes with widths and heights given as a pair of # integers (w, h). One envelope can fit into another if and only if both the # width and height of one envelope is greater than the width and height of the # other envelope. # # What is the maximum number of envelopes can you Russian doll? (put one inside # other) # # Note: # Rotation is not allowed. # # Example: # # # # Input: [[5,4],[6,4],[6,7],[2,3]] # Output: 3 # Explanation: The maximum number of envelopes you can Russian doll is 3 ([2,3] # => [5,4] => [6,7]). # # # # # @lc code=start class Solution: def maxEnvelopes(self, envelopes: List[List[int]]) -> int: if not envelopes: return 0 elif len(envelopes) == 1: return 1 arr = sorted(envelopes, key=lambda envelope: (envelope[0], -envelope[1])) # return self.helper_FAILED(arr) # return self.O_NxN(arr) return self.O_NxlogN(arr) def O_NxlogN(self, envelopes): dp = [] for i in range(len(envelopes)): if not dp: dp.append(envelopes[i][1]) continue # if envelopes[i][0] > dp[-1] and envelopes[i][1] > dp[-1][1]: if envelopes[i][1] > dp[-1]: dp.append(envelopes[i][1]) else: target = envelopes[i][1] start, end = 0, len(dp) # To find elem >= envelopes[i][1] while start + 1 < end: mid = start + (end-start)//2 if dp[mid] >= target: end = mid else: start = mid if dp[start] >= target: dp[start] = target elif dp[end] >= target: dp[end] = target # print(dp) return len(dp) def O_NxN(self, envelopes): dp = [] for i in range(len(envelopes)): if not dp: dp.append(envelopes[i][1]) continue # if envelopes[i][0] > dp[-1] and envelopes[i][1] > dp[-1][1]: if envelopes[i][1] > dp[-1]: dp.append(envelopes[i][1]) else: for j in range(len(dp)): if envelopes[i][1] <= dp[j]: dp[j] = envelopes[i][1] break # print(dp) return len(dp) def helper_FAILED(self, envelopes): dp = [] for envelope in envelopes: if not dp: dp.append(envelope) continue if envelope[0] > dp[-1][0] and envelope[1] > dp[-1][1] : dp.append(envelope) else: for j in range(len(dp)): # NO USE # if envelope[0] <= dp[j][0] and envelope[1] > dp[j][1]: # break # elif envelope[0] > dp[j][0] and envelope[1] <= dp[j][1]: # break if envelope[0] <= dp[j][0] and envelope[1] <= dp[j][1]: dp[j] = envelope break print(dp) return len(dp) # @lc code=end
9a042505df211682de5afa3eb04441642762d7ba
e402a0fbde47acb8903304a0fef11ec1de83b01f
/SecretColors/data/palettes/__init__.py
0424d070c31874e136fbe0f9ba306d437a31b594
[ "MIT" ]
permissive
Robinsondssantos/SecretColors
ad254a872d7bcc4ef1ac1914355d2f5c7ec73357
eb19b8a1805eba812032b450d644aa8fc5c257e5
refs/heads/master
2023-01-25T00:34:25.849346
2020-12-06T11:35:45
2020-12-06T11:35:45
null
0
0
null
null
null
null
UTF-8
Python
false
false
702
py
# Copyright (c) SecretBiology 2020. # # Library Name: SecretColors # Author: Rohit Suratekar # Website: https://github.com/secretBiology/SecretColors # # Most of these palettes are derived from various design systems. Few # examples of such design systems can be found on following URL # https://designsystemsrepo.com/design-systems from SecretColors.data.palettes.parent import ParentPalette from SecretColors.data.palettes.ibm import IBMPalette from SecretColors.data.palettes.material import MaterialPalette from SecretColors.data.palettes.clarity import ClarityPalette from SecretColors.data.palettes.brewer import ColorBrewer from SecretColors.data.palettes.tableau import TableauPalette
4973daa5f7033237dd93efc217a2a9c1532a74b5
90914b7d84d69a86652e69d1ad72888af363367b
/production_work_timesheet/timesheet.py
a4ebbc6d37d4d6bfb0c7cae074624939a479354c
[]
no_license
emperadorxp1/TrytonModules
754a3ca92c0ac7b2db9165208b1bc5fda5fe4a73
33ef61752e1c5f490e7ed4ee8a3f0cff63a8fc89
refs/heads/master
2020-12-19T18:41:05.260174
2020-01-23T15:32:57
2020-01-23T15:32:57
235,815,084
0
0
null
null
null
null
UTF-8
Python
false
false
714
py
# This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. from trytond.pool import PoolMeta, Pool __all__ = ['TimesheetWork'] class TimesheetWork(metaclass=PoolMeta): __name__ = 'timesheet.work' @classmethod def _get_origin(cls): return super(TimesheetWork, cls)._get_origin() + ['production.work'] def _validate_company(self): pool = Pool() ProductionWork = pool.get('production.work') result = super(TimesheetWork, self)._validate_company() if isinstance(self.origin, ProductionWork): result &= self.company == self.origin.company return result
310690032b5db321ddc9107fa0c8fb962ffa3a9a
232fc2c14942d3e7e28877b502841e6f88696c1a
/dizoo/smac/envs/smac_action.py
aaceb32e9777eaf73ed542d6ae037d894d0fc412
[ "Apache-2.0" ]
permissive
shengxuesun/DI-engine
ebf84221b115b38b4b3fdf3079c66fe81d42d0f7
eb483fa6e46602d58c8e7d2ca1e566adca28e703
refs/heads/main
2023-06-14T23:27:06.606334
2021-07-12T12:36:18
2021-07-12T12:36:18
385,454,483
1
0
Apache-2.0
2021-07-13T02:56:27
2021-07-13T02:56:27
null
UTF-8
Python
false
false
16,272
py
import enum import math import numpy as np from collections import namedtuple from s2clientprotocol import common_pb2 as sc_common, sc2api_pb2 as sc_pb, raw_pb2 as r_pb ORIGINAL_AGENT = "me" OPPONENT_AGENT = "opponent" MOVE_EAST = 4 MOVE_WEST = 5 actions = { "move": 16, # target: PointOrUnit "attack": 23, # target: PointOrUnit "stop": 4, # target: None "heal": 386, # Unit "parasitic_bomb": 2542, # target: Unit 'fungal_growth': 74, # target: PointOrUnit } class Direction(enum.IntEnum): NORTH = 0 SOUTH = 1 EAST = 2 WEST = 3 def distance(x1, y1, x2, y2): """Distance between two points.""" return math.hypot(x2 - x1, y2 - y1) class SMACAction: info_template = namedtuple('EnvElementInfo', ['shape', 'value', 'to_agent_processor', 'from_agent_processor']) def __init__(self, n_agents, n_enemies, two_player=False, mirror_opponent=True): self.obs_pathing_grid = False self.obs_terrain_height = False self.state_last_action = True self.state_timestep_number = False self.n_obs_pathing = 8 self.n_obs_height = 9 self._move_amount = 2 self.n_actions_no_attack = 6 self.n_actions_move = 4 self.n_actions = self.n_actions_no_attack + n_enemies self.map_x = 0 self.map_y = 0 # Status tracker self.last_action = np.zeros((n_agents, self.n_actions)) self.last_action_opponent = np.zeros((n_enemies, self.n_actions)) self.n_agents = n_agents self.n_enemies = n_enemies self.two_player = two_player self.mirror_opponent = mirror_opponent def reset(self): self.last_action.fill(0) self.last_action_opponent.fill(0) def update(self, map_info, map_x, map_y): if map_info.pathing_grid.bits_per_pixel == 1: vals = np.array(list(map_info.pathing_grid.data)).reshape(map_x, int(map_y / 8)) self.pathing_grid = np.transpose( np.array([[(b >> i) & 1 for b in row for i in range(7, -1, -1)] for row in vals], dtype=np.bool) ) else: self.pathing_grid = np.invert( np.flip( np.transpose(np.array(list(map_info.pathing_grid.data), dtype=np.bool).reshape(map_x, map_y)), axis=1 ) ) self.terrain_height = np.flip( np.transpose(np.array(list(map_info.terrain_height.data)).reshape(map_x, map_y)), 1 ) / 255 self.map_x = map_x self.map_y = map_y def _parse_single(self, actions, engine, is_opponent=False): actions = np.asarray(actions, dtype=np.int) assert len(actions) == (self.n_enemies if is_opponent else self.n_agents) actions_int = [int(a) for a in actions] # Make them one-hot if is_opponent: self.last_action_opponent = np.eye(self.n_actions)[np.array(actions_int)] else: self.last_action = np.eye(self.n_actions)[np.array(actions_int)] sc_actions = [] for a_id, action in enumerate(actions_int): sc_action = self.get_agent_action(a_id, action, engine, is_opponent) if sc_action: sc_actions.append(sc_action) return sc_actions def get_action(self, actions, engine): if self.two_player: # ========= Two player mode ========== assert self.two_player assert isinstance(actions, dict) assert ORIGINAL_AGENT in actions assert OPPONENT_AGENT in actions if self.mirror_opponent: actions[OPPONENT_AGENT] = [self._transform_action(a) for a in actions[OPPONENT_AGENT]] sc_actions_me = self._parse_single(actions[ORIGINAL_AGENT], engine, is_opponent=False) sc_actions_opponent = self._parse_single(actions[OPPONENT_AGENT], engine, is_opponent=True) return {ORIGINAL_AGENT: sc_actions_me, OPPONENT_AGENT: sc_actions_opponent} else: assert not isinstance(actions, dict) sc_actions = self._parse_single(actions, engine, is_opponent=False) return sc_actions def get_unit_by_id(self, a_id, engine, is_opponent=False): """Get unit by ID.""" if is_opponent: return engine.enemies[a_id] return engine.agents[a_id] def get_agent_action(self, a_id, action, engine, is_opponent=False): """Construct the action for agent a_id. The input action here is *absolute* and is not mirrored! We use skip_mirror=True in get_avail_agent_actions to avoid error. """ avail_actions = self.get_avail_agent_actions(a_id, engine, is_opponent=is_opponent, skip_mirror=True) try: assert avail_actions[action] == 1, \ "Agent {} cannot perform action {} in ava {}".format(a_id, action, avail_actions) except Exception as e: if action == 0: action = 1 else: action = 1 # TODO # raise e unit = self.get_unit_by_id(a_id, engine, is_opponent=is_opponent) # if is_opponent: # action = avail_actions[0] if avail_actions[0] else avail_actions[1] # ===== The follows is intact to the original ===== tag = unit.tag type_id = unit.unit_type x = unit.pos.x y = unit.pos.y # if is_opponent: # print(f"The given unit tag {tag}, x {x}, y {y} and action {action}") if action == 0: # no-op (valid only when dead) assert unit.health == 0, "No-op only available for dead agents." return None elif action == 1: # stop cmd = r_pb.ActionRawUnitCommand(ability_id=actions["stop"], unit_tags=[tag], queue_command=False) elif action == 2: # move north cmd = r_pb.ActionRawUnitCommand( ability_id=actions["move"], target_world_space_pos=sc_common.Point2D(x=x, y=y + self._move_amount), unit_tags=[tag], queue_command=False ) elif action == 3: # move south cmd = r_pb.ActionRawUnitCommand( ability_id=actions["move"], target_world_space_pos=sc_common.Point2D(x=x, y=y - self._move_amount), unit_tags=[tag], queue_command=False ) elif action == 4: # move east cmd = r_pb.ActionRawUnitCommand( ability_id=actions["move"], target_world_space_pos=sc_common.Point2D(x=x + self._move_amount, y=y), unit_tags=[tag], queue_command=False ) elif action == 5: # move west cmd = r_pb.ActionRawUnitCommand( ability_id=actions["move"], target_world_space_pos=sc_common.Point2D(x=x - self._move_amount, y=y), unit_tags=[tag], queue_command=False ) else: # attack/heal units that are in range target_id = action - self.n_actions_no_attack if engine.map_type == "MMM" and unit.unit_type == (engine.medivac_id_opponent if is_opponent else engine.medivac_id): target_unit = (engine.enemies[target_id] if is_opponent else engine.agents[target_id]) action_name = "heal" elif engine.map_type == 'infestor_viper': # viper if type_id == 499: target_unit = engine.enemies[target_id] action_name = "parasitic_bomb" # infestor else: target_unit = engine.enemies[target_id] target_loc = (target_unit.pos.x, target_unit.pos.y) action_name = "fungal_growth" target_loc = sc_common.Point2D(x=target_loc[0], y=target_loc[1]) cmd = r_pb.ActionRawUnitCommand( ability_id=actions[action_name], target_world_space_pos=target_loc, unit_tags=[tag], queue_command=False ) return sc_pb.Action(action_raw=r_pb.ActionRaw(unit_command=cmd)) else: target_unit = (engine.agents[target_id] if is_opponent else engine.enemies[target_id]) action_name = "attack" action_id = actions[action_name] target_tag = target_unit.tag cmd = r_pb.ActionRawUnitCommand( ability_id=action_id, target_unit_tag=target_tag, unit_tags=[tag], queue_command=False ) sc_action = sc_pb.Action(action_raw=r_pb.ActionRaw(unit_command=cmd)) return sc_action def get_avail_agent_actions(self, agent_id, engine, is_opponent=False, skip_mirror=False): """Returns the available actions for agent_id.""" medivac_id = engine.medivac_id_opponent if is_opponent else engine.medivac_id unit = self.get_unit_by_id(agent_id, engine, is_opponent) if unit.health > 0: # cannot choose no-op when alive avail_actions = [0] * self.n_actions # stop should be allowed avail_actions[1] = 1 # see if we can move if self.can_move(unit, Direction.NORTH): avail_actions[2] = 1 if self.can_move(unit, Direction.SOUTH): avail_actions[3] = 1 if self.can_move(unit, Direction.EAST): avail_actions[4] = 1 if self.can_move(unit, Direction.WEST): avail_actions[5] = 1 # Can attack only alive units that are alive in the shooting range shoot_range = self.unit_shoot_range(unit) target_items = engine.enemies.items() if not is_opponent else engine.agents.items() self_items = engine.agents.items() if not is_opponent else engine.enemies.items() if engine.map_type == "MMM" and unit.unit_type == medivac_id: # Medivacs cannot heal themselves or other flying units target_items = [(t_id, t_unit) for (t_id, t_unit) in self_items if t_unit.unit_type != medivac_id] for t_id, t_unit in target_items: if t_unit.health > 0: dist = distance(unit.pos.x, unit.pos.y, t_unit.pos.x, t_unit.pos.y) if dist <= shoot_range: if engine.map_type == "infestor_viper": value = 0 # viper if unit.unit_type == 499: if unit.energy >= 125: value = 1 # infestor else: if unit.energy >= 50: value = 1 avail_actions[t_id + self.n_actions_no_attack] = value else: avail_actions[t_id + self.n_actions_no_attack] = 1 else: # only no-op allowed avail_actions = [1] + [0] * (self.n_actions - 1) if (not skip_mirror) and self.mirror_opponent and is_opponent: avail_actions[MOVE_EAST], avail_actions[MOVE_WEST] = \ avail_actions[MOVE_WEST], avail_actions[MOVE_EAST] return avail_actions def can_move(self, unit, direction): """Whether a unit can move in a given direction.""" m = self._move_amount / 2 if direction == Direction.NORTH: x, y = int(unit.pos.x), int(unit.pos.y + m) elif direction == Direction.SOUTH: x, y = int(unit.pos.x), int(unit.pos.y - m) elif direction == Direction.EAST: x, y = int(unit.pos.x + m), int(unit.pos.y) else: x, y = int(unit.pos.x - m), int(unit.pos.y) if self.check_bounds(x, y) and self.pathing_grid[x, y]: return True return False def check_bounds(self, x, y): """Whether a point is within the map bounds.""" return 0 <= x < self.map_x and 0 <= y < self.map_y def get_surrounding_pathing(self, unit): """Returns pathing values of the grid surrounding the given unit.""" points = self.get_surrounding_points(unit, include_self=False) vals = [self.pathing_grid[x, y] if self.check_bounds(x, y) else 1 for x, y in points] return vals def get_surrounding_height(self, unit): """Returns height values of the grid surrounding the given unit.""" points = self.get_surrounding_points(unit, include_self=True) vals = [self.terrain_height[x, y] if self.check_bounds(x, y) else 1 for x, y in points] return vals def unit_shoot_range(self, unit): """Returns the shooting range for an agent.""" type_id = unit.unit_type if type_id == 499: return 8 elif type_id == 111: return 10 else: return 6 def get_surrounding_points(self, unit, include_self=False): """Returns the surrounding points of the unit in 8 directions.""" x = int(unit.pos.x) y = int(unit.pos.y) ma = self._move_amount points = [ (x, y + 2 * ma), (x, y - 2 * ma), (x + 2 * ma, y), (x - 2 * ma, y), (x + ma, y + ma), (x - ma, y - ma), (x + ma, y - ma), (x - ma, y + ma), ] if include_self: points.append((x, y)) return points def get_movement_features(self, agent_id, engine, is_opponent=False): unit = self.get_unit_by_id(agent_id, engine, is_opponent=is_opponent) move_feats_dim = self.get_obs_move_feats_size() move_feats = np.zeros(move_feats_dim, dtype=np.float32) if unit.health > 0: # otherwise dead, return all zeros # Movement features avail_actions = self.get_avail_agent_actions(agent_id, engine, is_opponent=is_opponent) for m in range(self.n_actions_move): move_feats[m] = avail_actions[m + 2] ind = self.n_actions_move if self.obs_pathing_grid: move_feats[ind:ind + self.n_obs_pathing # TODO self.n_obs_pathing ? ] = self.get_surrounding_pathing(unit) ind += self.n_obs_pathing if self.obs_terrain_height: move_feats[ind:] = self.get_surrounding_height(unit) return move_feats def get_obs_move_feats_size(self): """Returns the size of the vector containing the agents's movement-related features.""" move_feats = self.n_actions_move if self.obs_pathing_grid: move_feats += self.n_obs_pathing if self.obs_terrain_height: move_feats += self.n_obs_height return move_feats def get_last_action(self, is_opponent=False): if is_opponent: ret = self.last_action_opponent if self.mirror_opponent: ret[:, MOVE_EAST], ret[:, MOVE_WEST] = \ ret[:, MOVE_WEST].copy(), ret[:, MOVE_EAST].copy() else: ret = self.last_action return ret def get_avail_actions(self, engine, is_opponent=False): return [ self.get_avail_agent_actions(agent_id, engine, is_opponent=is_opponent) for agent_id in range(self.n_agents if not is_opponent else self.n_enemies) ] @staticmethod def _transform_action(a): if a == MOVE_EAST: # intend to move east a = MOVE_WEST elif a == MOVE_WEST: # intend to move west a = MOVE_EAST return a def info(self): shape = (self.n_actions, ) value = {'min': 0, 'max': 1} return SMACAction.info_template(shape, value, None, None)
34c193b5f47a90df0b6bd16d59075d1761ee4192
499f5402baed77d000c65f243b457c69dc3d2fe4
/pycatia/system_interfaces/setting_repository.py
5ce1233ac76c360aa18a27c0e231a219e723079a
[ "MIT" ]
permissive
evereux/pycatia
416189b34f3c60effea8a76258e36ffc5ae86e22
5f5726d5dc66265b3eba8a01910c4aeae424365d
refs/heads/master
2023-08-21T10:03:41.660445
2023-08-09T16:21:10
2023-08-09T16:21:10
159,069,580
141
42
MIT
2023-08-09T11:15:27
2018-11-25T20:04:31
Python
UTF-8
Python
false
false
13,294
py
#! usr/bin/python3.9 """ Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-06-09 09:53:18.676780 .. warning:: The notes denoted "CAA V5 Visual Basic Help" are to be used as reference only. They are there as a guide as to how the visual basic / catscript functions work and thus help debugging in pycatia. """ from pycatia.system_interfaces.setting_controller import SettingController class SettingRepository(SettingController): """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-09 09:53:18.676780) | System.IUnknown | System.IDispatch | System.CATBaseUnknown | System.CATBaseDispatch | System.AnyObject | System.SettingController | SettingRepository | | Represents the base object to handle the parameters of a | setting """ def __init__(self, com_object): super().__init__(com_object) self.setting_repository = com_object def get_attr(self, i_attr_name): """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-09 09:53:18.676780)) | o Func GetAttr(CATBSTR iAttrName) As CATVariant | | Retieves a attribute. | | Parameters: | | iAttrName | the attribute name | oAttr | a CATVariant | | Returns: | Legal values: | S_OK : on Success | E_FAIL: on failure :param str i_attr_name: :return: CATVariant """ return self.setting_repository.GetAttr(i_attr_name) def get_attr_array(self, i_attr_name): """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-09 09:53:18.676780)) | o Func GetAttrArray(CATBSTR iAttrName) As | CATSafeArrayVariant | | Retieves a attribute of type array | | Parameters: | | iAttrName | the attribute name | oArray | a CATSafeArrayVariant | | Returns: | Legal values: | S_OK : on Success | E_FAIL: on failure :param str i_attr_name: :return: tuple """ return tuple(self.setting_repository.GetAttrArray(i_attr_name)) def get_attr_info(self, i_attr_name, admin_level, locked, o_modified): """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-09 09:53:18.676780)) | o Sub GetAttrInfo(CATBSTR iAttrName, | CATBSTR AdminLevel, | CATBSTR Locked, | boolean oModified) | | Retrieves environment informations for the given | attribute. | Role: This information defines the state of the setting parameter and is | made up of: | | The administration level that sets the current value or the value used | to reset it | The administration level that has locked the setting | parameter. | A flag to indicate whether the setting parameter was | modified. | | Parameters: | | iAttrName | [in] the attribute name. | ioAdminLevel | [inout] The administration level that defines the value used when | resetting the setting parameter. | | Legal values: | | Default value if the setting parameter has never been | explicitly set in the administration | concatenation. | Set at Admin Level n if the setting parameter has been | administered, | where n is an integer starting from 0 representing the rank of | the administration level. | | ioLocked | [inout] A character string to indicate whether the parameter is | locked and the level of administration where the locking has been | proceeded. | Legal values: | | Locked at Admin Level n if the setting parameter is locked by | then administration level n, | where n is an integer starting from 0. The setting parameter | can not be modified at the current level. | Locked if the setting parameter is locked by the current | administration level. Only an admistrator can get this | value. | Unlocked if the setting parameter is not | locked | | oModified | [out] True to indicate that the setting parameter value has been | explicitely modified at the current administrator or user level. This is only | possible with unlocked parameters. False means that it inherits the | administered value. | | Returns: | Legal values: | S_OK : on Success | E_FAIL: on failure :param str i_attr_name: :param str admin_level: :param str locked: :param bool o_modified: :return: None """ return self.setting_repository.GetAttrInfo(i_attr_name, admin_level, locked, o_modified) # # # # Autogenerated comment: # # some methods require a system service call as the methods expects a vb array object # # passed to it and there is no way to do this directly with python. In those cases the following code # # should be uncommented and edited accordingly. Otherwise completely remove all this. # # vba_function_name = 'get_attr_info' # # vba_code = """ # # Public Function get_attr_info(setting_repository) # # Dim iAttrName (2) # # setting_repository.GetAttrInfo iAttrName # # get_attr_info = iAttrName # # End Function # # """ # # system_service = self.application.system_service # # return system_service.evaluate(vba_code, 0, vba_function_name, [self.com_object]) def put_attr(self, i_attr_name, i_attr): """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-09 09:53:18.676780)) | o Sub PutAttr(CATBSTR iAttrName, | CATVariant iAttr) | | Sets an attribute of type array. | | Parameters: | | iAttrName | the attribute name | iArray | a CATSafeArrayVariant. | | Returns: | Legal values: | S_OK : on Success | E_FAIL: on failure :param str i_attr_name: :param CATVariant i_attr: :return: None """ return self.setting_repository.PutAttr(i_attr_name, i_attr) # # # # Autogenerated comment: # # some methods require a system service call as the methods expects a vb array object # # passed to it and there is no way to do this directly with python. In those cases the following code # # should be uncommented and edited accordingly. Otherwise completely remove all this. # # vba_function_name = 'put_attr' # # vba_code = """ # # Public Function put_attr(setting_repository) # # Dim iAttrName (2) # # setting_repository.PutAttr iAttrName # # put_attr = iAttrName # # End Function # # """ # # system_service = self.application.system_service # # return system_service.evaluate(vba_code, 0, vba_function_name, [self.com_object]) def put_attr_array(self, i_attr_name, i_array): """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-09 09:53:18.676780)) | o Sub PutAttrArray(CATBSTR iAttrName, | CATSafeArrayVariant iArray) | | Sets an attribute of type array. | | Parameters: | | iAttrName | the attribute name | iArray | a CATSafeArrayVariant. | | Returns: | Legal values: | S_OK : on Success | E_FAIL: on failure :param str i_attr_name: :param tuple i_array: :return: None """ return self.setting_repository.PutAttrArray(i_attr_name, i_array) # # # # Autogenerated comment: # # some methods require a system service call as the methods expects a vb array object # # passed to it and there is no way to do this directly with python. In those cases the following code # # should be uncommented and edited accordingly. Otherwise completely remove all this. # # vba_function_name = 'put_attr_array' # # vba_code = """ # # Public Function put_attr_array(setting_repository) # # Dim iAttrName (2) # # setting_repository.PutAttrArray iAttrName # # put_attr_array = iAttrName # # End Function # # """ # # system_service = self.application.system_service # # return system_service.evaluate(vba_code, 0, vba_function_name, [self.com_object]) def set_attr_lock(self, i_attr_name, i_locked): """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-09 09:53:18.676780)) | o Sub SetAttrLock(CATBSTR iAttrName, | boolean iLocked) | | Locks or unlocks an attribute. | Role: Locking a setting attribute prevents the end user, or the | administrators below the current one, from changing the setting parameter | value. Locking or unlocking the attribute setting parameter is an administrator | task and is possible when running a session in the administration mode | only. | | Parameters: | | iAttrName | [in] the attribute name. | iLocked | [in] A flag to indicate whether the attribute setting parameter | should be locked. | Legal values: True to lock, and False to unlock. :param str i_attr_name: :param bool i_locked: :return: None """ return self.setting_repository.SetAttrLock(i_attr_name, i_locked) # # # # Autogenerated comment: # # some methods require a system service call as the methods expects a vb array object # # passed to it and there is no way to do this directly with python. In those cases the following code # # should be uncommented and edited accordingly. Otherwise completely remove all this. # # vba_function_name = 'set_attr_lock' # # vba_code = """ # # Public Function set_attr_lock(setting_repository) # # Dim iAttrName (2) # # setting_repository.SetAttrLock iAttrName # # set_attr_lock = iAttrName # # End Function # # """ # # system_service = self.application.system_service # # return system_service.evaluate(vba_code, 0, vba_function_name, [self.com_object]) def __repr__(self): return f'SettingRepository(name="{self.name}")'
6954ecfa3c9a5a56759adcad12af34bb1cefe713
03520fd9d037e22e8c34f61369268b01769c0ae9
/server/server_generic.py
9601a66e4380b10b3052e25118e3a85b75e70715
[ "MIT" ]
permissive
kevinkk525/micropython_iot_generic
d93f4a51d8f89da221f4b30af4afa866231df909
f58730ff387a09077b8bb73b0b0f57a1c8c72485
refs/heads/master
2020-04-10T21:59:39.888144
2019-11-11T07:51:59
2019-11-11T07:51:59
161,312,146
0
0
null
null
null
null
UTF-8
Python
false
false
8,310
py
# Author: Kevin Köck # Copyright Kevin Köck 2019 Released under the MIT license # Created on 2018-12-15 __updated__ = "2018-12-15" __version__ = "0.0" import asyncio import logging import math import time from server.apphandler.apphandler import AppHandler # server tested with 800 concurrent (dis)connects at a time, sending one message, # causing ~70% cpu usage on one 2GHz arm core with ~40MB RAM usage. # Running this for several hours did not show any RAM leak. # TODO: initiated connections to the server without sending a message stay open # TODO: keepalive should only send if no new message within timeframe log = logging.getLogger("") _network = None def getNetwork(): if _network is not None: return _network raise TypeError("Network not initialized") class Network: def __init__(self, hostname=None, port=None, timeout_connection=1500, timeout_client_object=3600, cb_new_client=None, client_class=None): """ :param hostname: hostname to listen to, defaults to 0.0.0.0 :param port: port is actually needed, but defaults to 8888 :param timeout_connection: timeout in ms of the connection object. If no keepalive was possible during that time, connection will be closed :param timeout_client_object: timeout in s of the client object that survives a connection loss. The client object containing any apps and not yet sent messages will be deleted """ if timeout_client_object is None: timeout_client_object = math.inf if hostname is not None: self.hostname = hostname else: self.hostname = "0.0.0.0" if port is not None: self.port = port else: self.port = 9999 self.timeout_connection = timeout_connection self.timeout_client = timeout_client_object self.loop = None self.server = None self.server_task = None self.clients = {} self.shutdown_requested = asyncio.Event() self.new_client = asyncio.Event() self.cb_new_client = cb_new_client global _network _network = self if client_class is None: from server.generic_clients.client import Client self.Client = Client else: self.Client = client_class async def shutdown(self): log.info("Shutting down network") self.shutdown_requested.set() AppHandler.stop_event.set() await asyncio.sleep(5) # time for clients to shut down self.server.close() async def init(self, loop): self.server = await loop.create_server(lambda: ClientConnection(self), self.hostname, self.port) log.info("Server created") self.loop = loop asyncio.ensure_future(self._resetNewClientEvent()) async def _resetNewClientEvent(self): while not self.shutdown_requested.is_set(): try: await asyncio.wait_for(self.new_client.wait(), 1) self.new_client.clear() except asyncio.TimeoutError: # makes it react to shutdown_requested in time without canceling externally pass class ClientConnection(asyncio.Protocol): def __init__(self, network: Network): self.input_buffer = b"" self.network = network self.transport = None self.loop = network.loop self.ip = None self.client_id = None self.client = None def connection_made(self, transport): peername = transport.get_extra_info('peername') log.info('Connection from {}, {!s}'.format(peername, transport)) self.ip = peername self.transport = transport sock = transport.get_extra_info("socket") import socket sock.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) # sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) # sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 5) # sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 1) # sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 1) def connection_lost(self, exc): log.info("Connection to client {!r}, {!s} lost, exception {!s}".format(self.client_id, self.ip, exc)) if self.client is not None: asyncio.ensure_future(self.client.stop()) def data_received(self, data): # log.debug("Got data: {!s}, len {!s}".format(data, len(data))) message = self.input_buffer + data self.input_buffer = b"" if message.find(b"\n") == -1: self.input_buffer = message return tmp = message.split(b"\n") if message.endswith(b"\n") is False: self.input_buffer = tmp.pop(-1) for i in range(0, tmp.count(b"")): tmp.remove(b"") # sometimes keepalives are read too but as nothing is done with these, just remove them message = tmp.pop(0) if len(tmp) > 0 else b"" # as keepalive has been removed if self.client_id is None: if message == b"": return # new connection does not start with keepalive try: client_id = getNetwork().Client.readID(message) except TypeError as e: log.error(e) self.close() return log.debug("Logged in as {!s}".format(client_id)) self.client_id = client_id if self.client_id in self.network.clients: cl = self.network.clients[self.client_id] if cl.transport is not None: cl.transport.client = None # otherwise transport will stop client on connection loss. try: cl.transport.close() except: pass del cl.transport cl.transport = self cl.lines_received += tmp while len(cl.lines_received) > cl.len_rx_buffer: cl.lines_received.pop(0) cl.start(message) self.client = cl return client = _network.Client(self.client_id, timeout_connection=self.network.timeout_connection, timeout_client_object=self.network.timeout_client) client.transport = self self.network.clients[self.client_id] = client self.client = client # log.debug("Client list on creation: {!s}".format(self.network.clients)) if self.network.cb_new_client is not None: self.network.cb_new_client(client) client.start(message) if len(tmp) > 0: self.client.lines_received += tmp while len(self.client.lines_received) > self.client.len_rx_buffer: self.client.lines_received.pop(0) self.client.new_message_rx.set() return if self.client is None: log.warn("Connection {!s} does not have client object {!r} anymore but received data".format(self.ip, self.client_id)) self.close() return if self.client.closing.is_set(): return # Not accepting new messages if server is being shut down self.client.last_rx_time = time.time() self.client.log.debug("Got data: {!s}, len {!s}".format(data, len(data))) if message != b"": self.client.lines_received.append(message) if len(tmp) > 0: self.client.lines_received += tmp while len(self.client.lines_received) > self.client.len_rx_buffer: self.client.lines_received.pop(0) self.client.new_message_rx.set() def __del__(self): log.debug("Removing transport object to client {!r}, ip {!s}".format(self.client_id, self.ip)) def close(self): log.debug("Closing transport {!s} to client {!r}".format(self.ip, self.client_id)) try: self.transport.close() except Exception as e: log.debug("Exception closing transport socket: {!s}".format(e))
0c8f151455b44f75723bef94d18ab3bf6b15805f
97bf1824e9b299ae0c9b99dc1bcf83db321b20a5
/secondProject/blog/models.py
59f871477b1d2416ee8921cee812eabb7f5807ae
[]
no_license
shinhaeran/likelion_class
f2ed68f245e25a89313834876f001c4b35f5ffaa
72c2d53cfedccde0062f46816449415131b2c332
refs/heads/master
2020-04-25T21:59:56.891042
2019-05-26T08:56:48
2019-05-26T08:56:48
173,097,515
0
0
null
null
null
null
UTF-8
Python
false
false
348
py
from django.db import models # Create your models here. class Blog(models.Model): title = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') body = models.TextField() def __str__(self): return self.title def summary(self): return self.body[:100] #100글자 까지만 보여조
a61ae1c4f2160c0682d89a2535a5d98f3c78e607
a07fd8aca2d69ade2e388054dd2c1c9991232185
/tests/test_tutorial/test_extra_data_types/test_tutorial001_py310.py
0b71d9177332979a661b3a344e8e023d92e4cb4e
[ "MIT" ]
permissive
vitalik/fastapi
76b71bbbade19f12484c73dcbdca426197cc2db6
0276f5fd3aafb38dcbb430177a4685aeb58e5c69
refs/heads/master
2023-08-01T06:56:06.053824
2023-07-25T20:46:02
2023-07-25T20:46:02
315,668,229
1
0
MIT
2020-11-24T15:07:16
2020-11-24T15:07:15
null
UTF-8
Python
false
false
8,219
py
import pytest from dirty_equals import IsDict from fastapi.testclient import TestClient from ...utils import needs_py310 @pytest.fixture(name="client") def get_client(): from docs_src.extra_data_types.tutorial001_py310 import app client = TestClient(app) return client @needs_py310 def test_extra_types(client: TestClient): item_id = "ff97dd87-a4a5-4a12-b412-cde99f33e00e" data = { "start_datetime": "2018-12-22T14:00:00+00:00", "end_datetime": "2018-12-24T15:00:00+00:00", "repeat_at": "15:30:00", "process_after": 300, } expected_response = data.copy() expected_response.update( { "start_process": "2018-12-22T14:05:00+00:00", "duration": 176_100, "item_id": item_id, } ) response = client.put(f"/items/{item_id}", json=data) assert response.status_code == 200, response.text assert response.json() == expected_response @needs_py310 def test_openapi_schema(client: TestClient): response = client.get("/openapi.json") assert response.status_code == 200, response.text assert response.json() == { "openapi": "3.1.0", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/items/{item_id}": { "put": { "responses": { "200": { "description": "Successful Response", "content": {"application/json": {"schema": {}}}, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, "summary": "Read Items", "operationId": "read_items_items__item_id__put", "parameters": [ { "required": True, "schema": { "title": "Item Id", "type": "string", "format": "uuid", }, "name": "item_id", "in": "path", } ], "requestBody": { "content": { "application/json": { "schema": IsDict( { "allOf": [ { "$ref": "#/components/schemas/Body_read_items_items__item_id__put" } ], "title": "Body", } ) | IsDict( # TODO: remove when deprecating Pydantic v1 { "$ref": "#/components/schemas/Body_read_items_items__item_id__put" } ) } } }, } } }, "components": { "schemas": { "Body_read_items_items__item_id__put": { "title": "Body_read_items_items__item_id__put", "type": "object", "properties": { "start_datetime": IsDict( { "title": "Start Datetime", "anyOf": [ {"type": "string", "format": "date-time"}, {"type": "null"}, ], } ) | IsDict( # TODO: remove when deprecating Pydantic v1 { "title": "Start Datetime", "type": "string", "format": "date-time", } ), "end_datetime": IsDict( { "title": "End Datetime", "anyOf": [ {"type": "string", "format": "date-time"}, {"type": "null"}, ], } ) | IsDict( # TODO: remove when deprecating Pydantic v1 { "title": "End Datetime", "type": "string", "format": "date-time", } ), "repeat_at": IsDict( { "title": "Repeat At", "anyOf": [ {"type": "string", "format": "time"}, {"type": "null"}, ], } ) | IsDict( # TODO: remove when deprecating Pydantic v1 { "title": "Repeat At", "type": "string", "format": "time", } ), "process_after": IsDict( { "title": "Process After", "anyOf": [ {"type": "string", "format": "duration"}, {"type": "null"}, ], } ) | IsDict( # TODO: remove when deprecating Pydantic v1 { "title": "Process After", "type": "number", "format": "time-delta", } ), }, }, "ValidationError": { "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", "properties": { "loc": { "title": "Location", "type": "array", "items": { "anyOf": [{"type": "string"}, {"type": "integer"}] }, }, "msg": {"title": "Message", "type": "string"}, "type": {"title": "Error Type", "type": "string"}, }, }, "HTTPValidationError": { "title": "HTTPValidationError", "type": "object", "properties": { "detail": { "title": "Detail", "type": "array", "items": {"$ref": "#/components/schemas/ValidationError"}, } }, }, } }, }
f52b1ef6a6b56db0523211d934578ec0ef2a07e4
0377a4135f9e8940809a62186b229295bed9e9bc
/剑指offer/new2/判断一棵树是否为另一棵树的子结构.py
c14465c97106d88afb892a94b084094c2611b4b3
[]
no_license
neko-niko/leetcode
80f54a8ffa799cb026a7f60296de26d59a0826b0
311f19641d890772cc78d5aad9d4162dedfc20a0
refs/heads/master
2021-07-10T10:24:57.284226
2020-09-13T11:28:45
2020-09-13T11:28:45
198,792,951
0
0
null
null
null
null
UTF-8
Python
false
false
954
py
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def HasSubtree(self, pRoot1, pRoot2): # write code here if pRoot1 == None or pRoot2 == None: return False else: return self.panduan(pRoot1, pRoot2) or self.HasSubtree(pRoot1.left, pRoot2) or self.HasSubtree(pRoot1.right, pRoot2) def panduan(self, p1, p2): if not p2: return True else: if not p1 or p1.val != p2.val: return False return self.panduan(p1.right, p2.right) and self.panduan(p1.left, p2.left) if __name__ == '__main__': node1 = TreeNode(1) node2 = TreeNode(2) node1.left = node2 test1 = node1 test2 = node2 test1 = test1.left print(test1 == test2)
321182ac1c784cfc94356d065684340d14c0b1a1
3073677476a918720fb24a13961d6e9f5143627b
/console.py
dcd93ec5ed4ac74a56b3bf6c3dc042853d32cbe2
[]
no_license
nemec/audibleMPD
960fe2c358ac875936ceb23c1c7b19d74940012a
d214ac44e2411583db3f6cab835138747b6df6b1
refs/heads/master
2021-01-01T05:40:25.894785
2011-01-24T23:48:52
2011-01-24T23:48:52
983,120
0
0
null
null
null
null
UTF-8
Python
false
false
3,193
py
from os import getuid import gobject from input_header import input_header if getuid() != 0: raise ImportError, "Must be root to get keypresses." from struct import unpack # Code 0 = Mouse x axis, val = mouse accel (with +/-) # Code 1 = Mouse y axis, val = mouse accel (with +/-) KEY_PRESS = 1 KEY_RELEASE = 2 class keyevent(object): def __init__(self, t_sec, t_usec, typ, code, val): self.ih = input_header() self.seconds = t_sec self.microseconds = t_usec self.type = typ self.code = code self.value = val def __str__(self): return "[%s.%s] type %s, code %s, value %s" % (self.seconds, self.microseconds, self.type, self.code, self.value) class reader(gobject.GObject): DEFAULT_EVENT_PATH = "/dev/input/event4" __gsignals__ = { "mouse_abs": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, )), "mouse_rel": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, )), "key_down": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, )), "key_up": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, )), "all": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, )), } def __init__(self, eventpath = DEFAULT_EVENT_PATH, keywatches = None): gobject.GObject.__init__(self) self.eventpath = eventpath self.trap_repeats = False self.port = open(self.eventpath,"rb") def trap_repeat(self, on): self.trap_repeats = on def emit_events(self, ev): if ev.type == ih.EV_ABS: if ev.code == ih.ABS_X: self.emit("mouse_abs", (ev.value, 0)) elif ev.code == ih.ABS_Y: self.emit("mouse_abs", (0, ev.value)) elif ev.type == ih.EV_REL: if ev.code == ih.REL_X: self.emit("mouse_rel", (ev.value, 0)) elif ev.code == ih.REL_Y: self.emit("mouse_rel", (0, ev.value)) elif ev.type == ih.EV_KEY: if ev.value == 0: self.emit("key_up", ev) elif ev.value == 1: self.emit("key_down", ev) elif ev.value == 2 and self.trap_repeats: self.emit("key_down", ev) self.emit("all", ev) def readkeyevent(self, emit = False): ev = keyevent(*unpack("2I2Hi",self.port.read(16))) if emit: self.emit_events(ev) return ev def readkey(self): while True: code, val = self.readkeyevent() if val > 0: #lockcode = code #while True: # code, val = self.readkeyevent() # if code == lockcode and val != 1: # returns on key-release or key-hold # return code # 0 is generated by a repeat keypress if code == 0: return self.last_key else: self.last_key = code return code def run(self): while 1: self.readkeyevent(True) if __name__ == "__main__": gobject.threads_init() from input_header import input_header ih = input_header() r = reader("/dev/input/event9") def print_event(obj, ev): print ev r.connect("key_down", print_event) r.trap_repeat(True) r.run()
e700a24a2a79345362880d9c61b0b979299289a8
086ff58e13978ef5fa771ffc44c3b002cfcf18cb
/froide/publicbody/widgets.py
0e89162ad29d102f0a13c6e53207916a598ada39
[ "MIT" ]
permissive
jdieg0/froide
70b0de85eff09886919a838fe46b776467824dfb
44a5d7e65b1678e0031e2cf01687c8834b2517e2
refs/heads/master
2020-04-27T22:51:45.343233
2019-03-09T16:46:34
2019-03-09T16:46:34
174,752,276
0
0
null
2019-03-09T22:19:20
2019-03-09T22:19:20
null
UTF-8
Python
false
false
2,348
py
import json from django import forms from django.urls import reverse from django.utils.translation import ugettext as _ from django.templatetags.static import static from froide.helper.content_urls import get_content_url from .models import PublicBody def get_widget_context(): return { 'url': { 'searchPublicBody': reverse('api:publicbody-search'), 'listLaws': reverse('api:law-list'), 'getPublicBody': reverse('api:publicbody-detail', kwargs={'pk': '0'}), 'helpAbout': get_content_url('about') }, 'i18n': { 'missingPublicBody': _('Are we missing a public body?'), 'publicBodySearchPlaceholder': _('Ministry of...'), 'search': _('Search'), 'examples': _('Examples:'), 'environment': _('Environment'), 'ministryOfLabour': _('Ministry of Labour'), 'or': _('or'), 'noPublicBodiesFound': _('No Public Bodies found for this query.'), 'letUsKnow': _('Please let us know!'), }, 'resources': { 'spinner': static('img/spinner.gif') } } class PublicBodySelect(forms.Widget): input_type = "text" template_name = 'publicbody/_chooser.html' initial_search = None class Media: extend = False js = ('js/publicbody.js',) def set_initial_search(self, search): self.initial_search = search def get_context(self, name, value=None, attrs=None): pb, pb_desc = None, None if value is not None: try: pb = PublicBody.objects.get(pk=int(value)) pb_desc = pb.get_label() except (ValueError, PublicBody.DoesNotExist): pass context = super(PublicBodySelect, self).get_context(name, value, attrs) context['widget'].update({ 'value_label': pb_desc, 'search': self.initial_search, 'publicbody': pb, 'json': json.dumps({ 'fields': { name: { 'value': value, 'objects': [pb.as_data()] if pb is not None else None } } }) }) context['config'] = json.dumps(get_widget_context()) return context
fdb1438c63169f6ae42534f8c356819b6ced8614
3358f6fbfa39d4429f2a9fa3ba5416285fab5793
/第3章 Django/第3章 Django/3、Django中的视图/kaige/project/myApp/models.py
7128dbac959f269df33a0dddfa674349e6780c90
[]
no_license
kmxz2016/PycharmProjects
8ab79cd5ef87bba2a1af0fe9f035f87a18621407
631a792eb9b5f4121dc08849dded10c290ac2401
refs/heads/master
2020-03-13T18:21:11.364219
2018-05-16T10:06:42
2018-05-16T10:06:42
131,234,054
1
0
null
null
null
null
UTF-8
Python
false
false
735
py
from django.db import models # Create your models here. class Grades(models.Model): gname = models.CharField(max_length=20) gdate = models.DateTimeField() ggirlnum = models.IntegerField() gboynum = models.IntegerField() isDelete = models.BooleanField(default=False) def __str__(self): return self.gname class Students(models.Model): sname = models.CharField(max_length=20) sgender = models.BooleanField(default=True) sage = models.IntegerField() scontend = models.CharField(max_length=20) isDelete = models.BooleanField(default=False) # 关联外键 sgrade = models.ForeignKey("Grades") def __str__(self): return self.sname