blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
616
content_id
stringlengths
40
40
detected_licenses
sequencelengths
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
sequencelengths
1
1
author_id
stringlengths
1
132
7fbf97b1503386b6939f46cfda12993249f306aa
3a93a50bf80668a6ede701534f1567c3653729b0
/Sept_challenge/arithemetic_slice_II.py
5d4391eb891b132eaff46dae5987441400c9534b
[]
no_license
Tadele01/Competitive-Programming
c16778298b6c1b4c0b579aedd1b5f0d4106aceeb
125de2b4e23f78d2e9f0a8fde90463bed0aed70f
refs/heads/master
2023-09-01T06:00:09.068940
2021-09-13T18:04:30
2021-09-13T18:04:30
325,728,258
0
0
null
null
null
null
UTF-8
Python
false
false
464
py
from typing import List from collections import defaultdict class Solution: def numberOfArithmeticSlices(self, nums: List[int]) -> int: subsequence = 0 cache = [defaultdict(int) for _ in nums] for i in range(len(nums)): for j in range(i): diff = nums[i] - nums[j] cache[i][diff] += cache[j][diff] + 1 subsequence += cache[j][diff] return subsequence
8dbeb21e45db293b1eed3a4d259d0a7190aadd1e
46e6b58d52aad982ac49e8b4b1e72cc19d5855e7
/venv/Lib/encodings/gb2312.py
9e002e015138f7d2e656d95a22e0deba0a85c73b
[]
no_license
Josquin95/Triqui
76584d2801d49546c79422b4635bff5d251b77c9
82e3ac1b0e053993d76e3d7aea88204799540e05
refs/heads/master
2023-07-21T09:38:49.037207
2023-07-17T21:42:29
2023-07-17T21:42:29
113,802,751
0
1
null
2022-10-07T04:32:38
2017-12-11T02:27:58
Python
UTF-8
Python
false
false
1,039
py
# # gb2312.py: Python Unicode Codec for GB2312 # # Written by Hye-Shik Chang <[email protected]> # import _codecs_cn import _multibytecodec as mbc import codecs codec = _codecs_cn.getcodec('gb2312') class Codec(codecs.Codec): encode = codec.encode decode = codec.decode class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): codec = codec class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec = codec class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): codec = codec class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): codec = codec def getregentry(): return codecs.CodecInfo( name='gb2312', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter, )
677da4b419273dd5a0c14a32c94015dd6bb3ad6b
10c6f6801ff50e7456ef7dacc57e6c019cbe5311
/vendor/pipstrip
67cd04941aefc0845693decab4a56cce0f59c29f
[ "MIT" ]
permissive
2pax-hq/heroku-buildpack-python
6d66f9cc48e80276e65c00bf95d486ff24f5be48
4669a838e7a56a369f97c4ba1c65426774d93d96
refs/heads/master
2021-06-15T18:33:20.806751
2017-03-14T12:52:01
2017-03-14T12:52:01
null
0
0
null
null
null
null
UTF-8
Python
false
false
245
#!/usr/bin/env python import sys req_file = sys.argv[1] lines = [] with open(req_file, 'r') as f: r = f.readlines() for l in r: lines.append(l.split('--hash')[0]) with open(req_file, 'w') as f: f.write('\n'.join(lines))
3a6dca8992ab5cc806956e4513c10943419020d0
d45cbb9aa98871851efeebf5f39498534c9125a5
/supar/models/constituency.py
38f92d4cceb2d8d625432379412c00c47351464b
[ "MIT" ]
permissive
ashim95/parser
c307e7178128031deb8fbaa08db6410a94e30bf4
61e9cd6bf16dcf1aa2b9d51b3a6c04ed048b3199
refs/heads/main
2023-02-06T02:36:48.404534
2021-01-01T20:05:49
2021-01-01T20:05:49
324,896,816
0
0
MIT
2020-12-28T02:53:43
2020-12-28T02:53:42
null
UTF-8
Python
false
false
10,859
py
# -*- coding: utf-8 -*- import torch import torch.nn as nn from supar.modules import LSTM, MLP, BertEmbedding, Biaffine, CharLSTM from supar.modules.dropout import IndependentDropout, SharedDropout from supar.modules.treecrf import CRFConstituency from supar.utils import Config from supar.utils.alg import cky from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence class CRFConstituencyModel(nn.Module): r""" The implementation of CRF Constituency Parser, also called FANCY (abbr. of Fast and Accurate Neural Crf constituencY) Parser. References: - Yu Zhang, Houquan Zhou and Zhenghua Li. 2020. `Fast and Accurate Neural CRF Constituency Parsing`_. Args: n_words (int): The size of the word vocabulary. n_feats (int): The size of the feat vocabulary. n_labels (int): The number of labels. feat (str): Specifies which type of additional feature to use: ``'char'`` | ``'bert'`` | ``'tag'``. ``'char'``: Character-level representations extracted by CharLSTM. ``'bert'``: BERT representations, other pretrained langugae models like XLNet are also feasible. ``'tag'``: POS tag embeddings. Default: 'char'. n_embed (int): The size of word embeddings. Default: 100. n_feat_embed (int): The size of feature representations. Default: 100. n_char_embed (int): The size of character embeddings serving as inputs of CharLSTM, required if ``feat='char'``. Default: 50. bert (str): Specifies which kind of language model to use, e.g., ``'bert-base-cased'`` and ``'xlnet-base-cased'``. This is required if ``feat='bert'``. The full list can be found in `transformers`. Default: ``None``. n_bert_layers (int): Specifies how many last layers to use. Required if ``feat='bert'``. The final outputs would be the weight sum of the hidden states of these layers. Default: 4. mix_dropout (float): The dropout ratio of BERT layers. Required if ``feat='bert'``. Default: .0. embed_dropout (float): The dropout ratio of input embeddings. Default: .33. n_lstm_hidden (int): The size of LSTM hidden states. Default: 400. n_lstm_layers (int): The number of LSTM layers. Default: 3. lstm_dropout (float): The dropout ratio of LSTM. Default: .33. n_mlp_span (int): Span MLP size. Default: 500. n_mlp_label (int): Label MLP size. Default: 100. mlp_dropout (float): The dropout ratio of MLP layers. Default: .33. feat_pad_index (int): The index of the padding token in the feat vocabulary. Default: 0. pad_index (int): The index of the padding token in the word vocabulary. Default: 0. unk_index (int): The index of the unknown token in the word vocabulary. Default: 1. .. _Fast and Accurate Neural CRF Constituency Parsing: https://www.ijcai.org/Proceedings/2020/560/ .. _transformers: https://github.com/huggingface/transformers """ def __init__(self, n_words, n_feats, n_labels, feat='char', n_embed=100, n_feat_embed=100, n_char_embed=50, bert=None, n_bert_layers=4, mix_dropout=.0, embed_dropout=.33, n_lstm_hidden=400, n_lstm_layers=3, lstm_dropout=.33, n_mlp_span=500, n_mlp_label=100, mlp_dropout=.33, feat_pad_index=0, pad_index=0, unk_index=1, **kwargs): super().__init__() self.args = Config().update(locals()) # the embedding layer self.word_embed = nn.Embedding(num_embeddings=n_words, embedding_dim=n_embed) if feat == 'char': self.feat_embed = CharLSTM(n_chars=n_feats, n_embed=n_char_embed, n_out=n_feat_embed, pad_index=feat_pad_index) elif feat == 'bert': self.feat_embed = BertEmbedding(model=bert, n_layers=n_bert_layers, n_out=n_feat_embed, pad_index=feat_pad_index, dropout=mix_dropout) self.n_feat_embed = self.feat_embed.n_out elif feat == 'tag': self.feat_embed = nn.Embedding(num_embeddings=n_feats, embedding_dim=n_feat_embed) else: raise RuntimeError("The feat type should be in ['char', 'bert', 'tag'].") self.embed_dropout = IndependentDropout(p=embed_dropout) # the lstm layer self.lstm = LSTM(input_size=n_embed+n_feat_embed, hidden_size=n_lstm_hidden, num_layers=n_lstm_layers, bidirectional=True, dropout=lstm_dropout) self.lstm_dropout = SharedDropout(p=lstm_dropout) # the MLP layers self.mlp_span_l = MLP(n_in=n_lstm_hidden*2, n_out=n_mlp_span, dropout=mlp_dropout) self.mlp_span_r = MLP(n_in=n_lstm_hidden*2, n_out=n_mlp_span, dropout=mlp_dropout) self.mlp_label_l = MLP(n_in=n_lstm_hidden*2, n_out=n_mlp_label, dropout=mlp_dropout) self.mlp_label_r = MLP(n_in=n_lstm_hidden*2, n_out=n_mlp_label, dropout=mlp_dropout) # the Biaffine layers self.span_attn = Biaffine(n_in=n_mlp_span, bias_x=True, bias_y=False) self.label_attn = Biaffine(n_in=n_mlp_label, n_out=n_labels, bias_x=True, bias_y=True) self.crf = CRFConstituency() self.criterion = nn.CrossEntropyLoss() self.pad_index = pad_index self.unk_index = unk_index def load_pretrained(self, embed=None): if embed is not None: self.pretrained = nn.Embedding.from_pretrained(embed) nn.init.zeros_(self.word_embed.weight) return self def forward(self, words, feats): r""" Args: words (~torch.LongTensor): ``[batch_size, seq_len]``. Word indices. feats (~torch.LongTensor): Feat indices. If feat is ``'char'`` or ``'bert'``, the size of feats should be ``[batch_size, seq_len, fix_len]`` if ``'tag'``, the size is ``[batch_size, seq_len]``. Returns: ~torch.Tensor, ~torch.Tensor: The first tensor of shape ``[batch_size, seq_len, seq_len]`` holds scores of all possible spans. The second of shape ``[batch_size, seq_len, seq_len, n_labels]`` holds scores of all possible labels on each span. """ batch_size, seq_len = words.shape # get the mask and lengths of given batch mask = words.ne(self.pad_index) ext_words = words # set the indices larger than num_embeddings to unk_index if hasattr(self, 'pretrained'): ext_mask = words.ge(self.word_embed.num_embeddings) ext_words = words.masked_fill(ext_mask, self.unk_index) # get outputs from embedding layers word_embed = self.word_embed(ext_words) if hasattr(self, 'pretrained'): word_embed += self.pretrained(words) feat_embed = self.feat_embed(feats) word_embed, feat_embed = self.embed_dropout(word_embed, feat_embed) # concatenate the word and feat representations embed = torch.cat((word_embed, feat_embed), -1) x = pack_padded_sequence(embed, mask.sum(1), True, False) x, _ = self.lstm(x) x, _ = pad_packed_sequence(x, True, total_length=seq_len) x = self.lstm_dropout(x) x_f, x_b = x.chunk(2, -1) x = torch.cat((x_f[:, :-1], x_b[:, 1:]), -1) # apply MLPs to the BiLSTM output states span_l = self.mlp_span_l(x) span_r = self.mlp_span_r(x) label_l = self.mlp_label_l(x) label_r = self.mlp_label_r(x) # [batch_size, seq_len, seq_len] s_span = self.span_attn(span_l, span_r) # [batch_size, seq_len, seq_len, n_labels] s_label = self.label_attn(label_l, label_r).permute(0, 2, 3, 1) return s_span, s_label def loss(self, s_span, s_label, charts, mask, mbr=True): r""" Args: s_span (~torch.Tensor): ``[batch_size, seq_len, seq_len]``. Scores of all spans s_label (~torch.Tensor): ``[batch_size, seq_len, seq_len, n_labels]``. Scores of all labels on each span. charts (~torch.LongTensor): ``[batch_size, seq_len, seq_len]``. The tensor of gold-standard labels, in which positions without labels are filled with -1. mask (~torch.BoolTensor): ``[batch_size, seq_len, seq_len]``. The mask for covering the unpadded tokens in each chart. mbr (bool): If ``True``, returns marginals for MBR decoding. Default: ``True``. Returns: ~torch.Tensor, ~torch.Tensor: The training loss and original span scores of shape ``[batch_size, seq_len, seq_len]`` if ``mbr=False``, or marginals otherwise. """ span_mask = charts.ge(0) & mask span_loss, span_probs = self.crf(s_span, mask, span_mask, mbr) label_loss = self.criterion(s_label[span_mask], charts[span_mask]) loss = span_loss + label_loss return loss, span_probs def decode(self, s_span, s_label, mask): r""" Args: s_span (~torch.Tensor): ``[batch_size, seq_len, seq_len]``. Scores of all spans. s_label (~torch.Tensor): ``[batch_size, seq_len, seq_len, n_labels]``. Scores of all labels on each span. mask (~torch.BoolTensor): ``[batch_size, seq_len, seq_len]``. The mask for covering the unpadded tokens in each chart. Returns: list[list[tuple]]: Sequences of factorized labeled trees traversed in pre-order. """ span_preds = cky(s_span, mask) label_preds = s_label.argmax(-1).tolist() return [[(i, j, labels[i][j]) for i, j in spans] for spans, labels in zip(span_preds, label_preds)]
c4b87867633ef1590bf86b17328f7c49e7240a27
74d54aef5bc3fc3aeb01a16c4738d59215085790
/sm/main.py
b92b99e9edc36d8b9194d92c4b5212e3a1a1fb2b
[]
no_license
sarthak77/super-mario
a051cd96bef178a86f1c1f1f46d9f3574e55c7df
1dc97213c735d20f265a9e9e5a1ac51de963b7cf
refs/heads/master
2022-07-10T11:16:41.276036
2019-07-07T06:06:59
2019-07-07T06:06:59
148,191,715
2
2
null
2022-06-21T22:16:09
2018-09-10T17:17:22
Python
UTF-8
Python
false
false
32,053
py
#main code of the game from start import * from mainscene import * from func import * import time import sys import select import tty import termios #GLABAL VARIABLES quit=1 i=0 mariopresent=[33,7] marioprev=["-","-","-","-","-","-","-","-"]# 8 elements life=3 score=0#coins a=time.time() cjump=10#for surprise coin bullet=0 x=[] y=[] #to control enemy loop loop=0 loop2=0 #9 enemies enemy1=np.chararray((5,4)) enemy1[:]="-" enemy2=np.chararray((4,5)) enemy2[:]="-" old_settings = termios.tcgetattr(sys.stdin) def isData(): return select.select([sys.stdin], [], [], 0) == ([sys.stdin], [],[]) #--------------take input without pressing enter----------------------------- class _Getch: """Gets a single character from standard input. Does not echo to the screen.""" def __init__(self): try: self.impl = _GetchWindows() except ImportError: self.impl = _GetchUnix() def __call__(self): return self.impl() class _GetchUnix: def __init__(self): import tty, sys def __call__(self): import sys, tty, termios fd = sys.stdin.fileno() old_settings = termios.tcgetattr(fd) try: tty.setraw(sys.stdin.fileno()) ch = sys.stdin.read(1) finally: termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) return ch class _GetchWindows: def __init__(self): import msvcrt def __call__(self): import msvcrt return msvcrt.getch() getch = _Getch() #------------------------------------------------------------------------------ #--------------------------start screen--------------------------------------- class start(object): def __init__(self): #making object self.__board=start_board() #main function def run(self): self.__board.printboard() while(1): print() print(" --------------------------------------------------------") print(" |PRESS s TO GO DOWN---PRESS w TO GO UP---PRESS f TO ENTER|") print(" --------------------------------------------------------") print() inp=getch() if inp=="s": self.__board.update(23,41,'-') self.__board.update(25,41,'>') if inp=="f": if self.__board.getgrid(23,41)==">": os.system('clear') print(" STARTING GAME IN 3s") #time.sleep(3) global quit quit=0 break if inp=="w": self.__board.update(25,41,'-') self.__board.update(23,41,'>') #self.__board.printboard() self.__board.printboard() #--------------------------------------------------------------------------------- #------------------------------game scene class----------------------------------- class screen(object): def __init__(self): #creating object self.__board=mainscene_board() def reset(self): global mariopresent,marioprev,i,life,score,bullet self.__board.clean(mariopresent,marioprev) marioprev=["-","-","-","-","-","-","-","-"] os.system('clear') print("START AGAIN") time.sleep(1) mariopresent=[33,7] i=0 bullet=0 os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) #main function def run(self): #initial values self.__board.printboard(0,7,3,0,0) speed=2#do not change previnp="s"#for jumping try: tty.setcbreak(sys.stdin.fileno()) while(1): global mariopresent,marioprev,life,score,a,cjump,bullet,x,y,i,loop,loop2 #if won if mariopresent==[33,609]: os.system('aplay ./sounds/smb_stage_clear.wav') #spawn fireworks for f in range(580,650,10): self.__board.addfireworks(10,f) os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) #print(f) os.system('aplay ./sounds/smb_fireworks.wav') #time.sleep(.5) time.sleep(2) os.system('clear') print("SCORE->",score) time.sleep(1) print("LIFE_SCORE->",life*100) time.sleep(1) timescore=0 if (time.time()-a)<=100: timescore=100 if (time.time()-a)<=150: timescore=50 print("TIME_SCORE->",timescore) time.sleep(1) print("TOTAL SCORE->",score+life*100+timescore) time.sleep(1) print("YOU WON") time.sleep(1) break #game ends #check on jump low=1 #------------------------------keystroke dependent---------------------------------- if isData(): # read input keystroke from user keyStroke = sys.stdin.read(1) #for bullets if keyStroke=="f" and bullet==1: os.system('aplay ./sounds/smb_fireball.wav') #checking directions direction=1#if no previnp if previnp=="d": direction=1 elif previnp=="a": direction=-1 #range of bullet for b in range(0,11*direction,direction): g=self.__board.getgrid(mariopresent[0]+1,mariopresent[1]+3*direction+b)#storing next cell self.__board.fire1(mariopresent[0]+1,mariopresent[1]+3*direction+b) os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) self.__board.fire2(mariopresent[0]+1,mariopresent[1]+3*direction+b,g) time.sleep(.03) os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) #check if enemy dead or not if self.__board.getgrid(mariopresent[0]+1,mariopresent[1]+3*direction+b+direction)=="Q": if self.__board.getgrid(mariopresent[0]+1,mariopresent[1]+3*direction+b+2*direction)!="Q":#enemy2 cannot be killed self.__board.cleane1a(mariopresent[1]+3*direction+b+direction,enemy1[x.index(mariopresent[1]+3*direction+b+direction),:])#vanish #x[x.index(mariopresent[1]+3*direction+b+direction)]=-1#send back x.remove(mariopresent[1]+3*direction+b+direction)#send back score+=10 #check if bullet can move forward if checkj(self.__board.getgrid(mariopresent[0]+1,mariopresent[1]+3*direction+b+direction),self.__board.getgrid(mariopresent[0]+1,mariopresent[1]+3*direction+b+direction))==-1: break #moving forward if keyStroke=="d" and mariopresent[1]<(i+100-6): #check obstacle c1=checkmv(self.__board.getgrid(mariopresent[0]+1,mariopresent[1]+4)) if c1: self.__board.updateboardf(mariopresent,marioprev) #updating prev array (writing forward bacause early depends on late) marioprev[0]=self.__board.getgrid(mariopresent[0],mariopresent[1]+2) marioprev[1]=marioprev[3] marioprev[2]=marioprev[4] marioprev[3]=marioprev[5] marioprev[4]=self.__board.getgrid(mariopresent[0]+1,mariopresent[1]+3) marioprev[5]=self.__board.getgrid(mariopresent[0]+1,mariopresent[1]+4) marioprev[6]=marioprev[7] marioprev[7]=self.__board.getgrid(mariopresent[0]+2,mariopresent[1]+3) #updating mario mariopresent=[mariopresent[0],mariopresent[1]+speed] #check river c2=checkrv(self.__board.getgrid(mariopresent[0]+3,mariopresent[1]-1),self.__board.getgrid(mariopresent[0]+3,mariopresent[1]+1)) life+=c2 self.__board.updatemario(mariopresent[0],mariopresent[1]) previnp="d" os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) #if falls in river if c2==-1: os.system('aplay ./sounds/smb_mariodie.wav') screen.reset(self) #moving backward if keyStroke=="a" and mariopresent[1]>i+6: #checking obstacles c1=checkmv(self.__board.getgrid(mariopresent[0]+1,mariopresent[1]-4)) if c1: self.__board.updateboardb(mariopresent,marioprev) #updating prev array (writing backward because later depends on early) marioprev[7]=marioprev[6] marioprev[6]=self.__board.getgrid(mariopresent[0]+2,mariopresent[1]-3) marioprev[5]=marioprev[3] marioprev[4]=marioprev[2] marioprev[3]=marioprev[1] marioprev[2]=self.__board.getgrid(mariopresent[0]+1,mariopresent[1]-3) marioprev[1]=self.__board.getgrid(mariopresent[0]+1,mariopresent[1]-4) marioprev[0]=self.__board.getgrid(mariopresent[0],mariopresent[1]-2) #updating mario mariopresent=[mariopresent[0],mariopresent[1]-speed] #river check c2=checkrv(self.__board.getgrid(mariopresent[0]+3,mariopresent[1]-1),self.__board.getgrid(mariopresent[0]+3,mariopresent[1]+1)) life+=c2 self.__board.updatemario(mariopresent[0],mariopresent[1]) previnp="a" os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) #if dead if c2==-1: os.system('aplay ./sounds/smb_mariodie.wav') screen.reset(self) #jumps to height +10 if keyStroke=="w": #moving up timer=5 while(timer!=0): time.sleep(.01) #checks if can move up c3=checkj(self.__board.getgrid(mariopresent[0]-2,mariopresent[1]+1),self.__board.getgrid(mariopresent[0]-2,mariopresent[1]-1)) if c3==-1: djump=0 break else: djump=1 self.__board.updateboardbup(mariopresent,marioprev) #updating prev array marioprev[0]=self.__board.getgrid(mariopresent[0]-2,mariopresent[1]) marioprev[1]=self.__board.getgrid(mariopresent[0]-1,mariopresent[1]-2) marioprev[2]=self.__board.getgrid(mariopresent[0]-1,mariopresent[1]-1) marioprev[3]=self.__board.getgrid(mariopresent[0]-1,mariopresent[1]) marioprev[4]=self.__board.getgrid(mariopresent[0]-1,mariopresent[1]+1) marioprev[5]=self.__board.getgrid(mariopresent[0]-1,mariopresent[1]+2) marioprev[6]=self.__board.getgrid(mariopresent[0],mariopresent[1]-1) marioprev[7]=self.__board.getgrid(mariopresent[0],mariopresent[1]+1) mariopresent=[mariopresent[0]-speed,mariopresent[1]] self.__board.updatemario(mariopresent[0],mariopresent[1]) timer-=1 os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) #moving right if previnp=="d" and (mariopresent[1]+14)<(i+100): #16 units to right timer=8 while(timer!=0): time.sleep(.01) self.__board.updateboardf(mariopresent,marioprev) #updating prev array (writing forward bacause early depends on late) marioprev[0]=self.__board.getgrid(mariopresent[0],mariopresent[1]+2) marioprev[1]=marioprev[3] marioprev[2]=marioprev[4] marioprev[3]=marioprev[5] marioprev[4]=self.__board.getgrid(mariopresent[0]+1,mariopresent[1]+3) marioprev[5]=self.__board.getgrid(mariopresent[0]+1,mariopresent[1]+4) marioprev[6]=marioprev[7] marioprev[7]=self.__board.getgrid(mariopresent[0]+2,mariopresent[1]+3) mariopresent=[mariopresent[0],mariopresent[1]+speed] self.__board.updatemario(mariopresent[0],mariopresent[1]) timer-=1 os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) #moving left if previnp=="a" and (mariopresent[1]-14)>(i+6): #16 units to left timer=8 while(timer!=0): time.sleep(.01) self.__board.updateboardb(mariopresent,marioprev) #updating prev array (writing backward because later depends on early) marioprev[7]=marioprev[6] marioprev[6]=self.__board.getgrid(mariopresent[0]+2,mariopresent[1]-3) marioprev[5]=marioprev[3] marioprev[4]=marioprev[2] marioprev[3]=marioprev[1] marioprev[2]=self.__board.getgrid(mariopresent[0]+1,mariopresent[1]-3) marioprev[1]=self.__board.getgrid(mariopresent[0]+1,mariopresent[1]-4) marioprev[0]=self.__board.getgrid(mariopresent[0],mariopresent[1]-2) mariopresent=[mariopresent[0],mariopresent[1]-speed] self.__board.updatemario(mariopresent[0],mariopresent[1]) timer-=1 os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) #moving down timer=4 while(timer!=0 and djump==1): #check if it can move down c3=checkj(self.__board.getgrid(mariopresent[0]+3,mariopresent[1]+1),self.__board.getgrid(mariopresent[0]+3,mariopresent[1]-1)) if c3==-1: break #surprise coins if mariopresent[1]==75 and mariopresent[0]==23 and cjump>0: cjump-=1 self.__board.jumpupc(24,75) os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) time.sleep(.2) self.__board.updatecell(21,75,"-") self.__board.updatecell(22,75,"O") score+=1 time.sleep(.06) self.__board.updateboardbdown(mariopresent,marioprev) #updating pre array marioprev[0]=self.__board.getgrid(mariopresent[0]+2,mariopresent[1]) marioprev[1]=self.__board.getgrid(mariopresent[0]+3,mariopresent[1]-2) marioprev[2]=self.__board.getgrid(mariopresent[0]+3,mariopresent[1]-1) marioprev[3]=self.__board.getgrid(mariopresent[0]+3,mariopresent[1]) marioprev[4]=self.__board.getgrid(mariopresent[0]+3,mariopresent[1]+1) marioprev[5]=self.__board.getgrid(mariopresent[0]+3,mariopresent[1]+2) marioprev[6]=self.__board.getgrid(mariopresent[0]+4,mariopresent[1]-1) marioprev[7]=self.__board.getgrid(mariopresent[0]+4,mariopresent[1]+1) mariopresent=[mariopresent[0]+speed,mariopresent[1]] self.__board.updatemario(mariopresent[0],mariopresent[1]) timer-=1 os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) previnp="w" if keyStroke=="q": break #for straight jump if keyStroke not in ["a","w","d","q","f"]: previnp="s" #-------------------------------------------------------------------------------------- #---------------------------keystroke independent process------------------------------ #if already climbed an object check to move it down #whenever normal jump not there this code will be executed while low: #check for end flag if self.__board.getgrid(mariopresent[0]+3,mariopresent[1]-1)=="M" and self.__board.getgrid(mariopresent[0]+3,mariopresent[1]+1)=="M" and mariopresent[0]<25: os.system('aplay ./sounds/smb_flagpole.wav') fi=20 while(fi!=33): self.__board.moveflag(fi) fi+=1 time.sleep(.03) os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) #to move down temp=["-","/"] if self.__board.getgrid(mariopresent[0]+3,mariopresent[1]-1) in temp and self.__board.getgrid(mariopresent[0]+3,mariopresent[1]+1) in temp and self.__board.getgrid(mariopresent[0]+3,mariopresent[1]) in temp: #check for bullet power up if mariopresent[0]==29 and mariopresent[1] in [51,215,216,217,218,219]: self.__board.addflower(25,mariopresent[1]) #coins if self.__board.getgrid(mariopresent[0]-1,mariopresent[1])=="O": ts=score score+=self.__board.jumpupc(mariopresent[0]-1,mariopresent[1]) #powerup check p=0 if score-ts==11: p=1 #time.sleep(0.1) os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) time.sleep(0.1) self.__board.jumpdownc(mariopresent[0]-1,mariopresent[1]) if p==1: self.__board.powerup(mariopresent[0]-1,mariopresent[1]) #time.sleep(0.1) os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) """ c3=checkj(self.__board.getgrid(mariopresent[0]+3,mariopresent[1]+1),self.__board.getgrid(mariopresent[0]+3,mariopresent[1]-1)) if c3==-1: break """ low=1 time.sleep(.06) self.__board.updateboardbdown(mariopresent,marioprev) #updating pre array marioprev[0]=self.__board.getgrid(mariopresent[0]+2,mariopresent[1]) marioprev[1]=self.__board.getgrid(mariopresent[0]+3,mariopresent[1]-2) marioprev[2]=self.__board.getgrid(mariopresent[0]+3,mariopresent[1]-1) marioprev[3]=self.__board.getgrid(mariopresent[0]+3,mariopresent[1]) marioprev[4]=self.__board.getgrid(mariopresent[0]+3,mariopresent[1]+1) marioprev[5]=self.__board.getgrid(mariopresent[0]+3,mariopresent[1]+2) marioprev[6]=self.__board.getgrid(mariopresent[0]+4,mariopresent[1]-1) marioprev[7]=self.__board.getgrid(mariopresent[0]+4,mariopresent[1]+1) mariopresent=[mariopresent[0]+speed,mariopresent[1]] self.__board.updatemario(mariopresent[0],mariopresent[1]) self.__board.printboard(i,mariopresent[1],life,score,bullet) #kill enemy by jumping elif self.__board.getgrid(mariopresent[0]+3,mariopresent[1]-1)=="Q" or self.__board.getgrid(mariopresent[0]+3,mariopresent[1]+1)=="Q" or self.__board.getgrid(mariopresent[0]+3,mariopresent[1])=="Q": low=1 print("EFEFEF") score+=20 if self.__board.getgrid(mariopresent[0]+3,mariopresent[1]-1)=="Q": if self.__board.getgrid(mariopresent[0]+3,mariopresent[1]-2)!="Q" and self.__board.getgrid(mariopresent[0]+3,mariopresent[1])!="Q":#enemy2 check os.system('aplay ./sounds/smb_stomp.wav') self.__board.cleane1a(mariopresent[1]-1,enemy1[x.index(mariopresent[1]-1),:]) #x[x.index(mariopresent[1]-1)]=-1#send back x.remove(mariopresent[1]-1)#send back #if enemy2 then dead else: life-=1 os.system('aplay ./sounds/smb_mariodie.wav') screen.reset(self) elif self.__board.getgrid(mariopresent[0]+3,mariopresent[1]+1)=="Q": if self.__board.getgrid(mariopresent[0]+3,mariopresent[1]+2)!="Q" and self.__board.getgrid(mariopresent[0]+3,mariopresent[1])!="Q": os.system('aplay ./sounds/smb_stomp.wav') self.__board.cleane1a(mariopresent[1]+1,enemy1[x.index(mariopresent[1]+1),:]) #x[x.index(mariopresent[1]+1)]=-1#send back x.remove(mariopresent[1]+1)#send back #if enemy2 then dead else: life-=1 os.system('aplay ./sounds/smb_mariodie.wav') screen.reset(self) else: if self.__board.getgrid(mariopresent[0]+3,mariopresent[1]+1)!="Q" and self.__board.getgrid(mariopresent[0]+3,mariopresent[1]-1)!="Q": os.system('aplay ./sounds/smb_stomp.wav') self.__board.cleane1a(mariopresent[1],enemy1[x.index(mariopresent[1]),:]) #x[x.index(mariopresent[1])]=-1#send back x.remove(mariopresent[1])#send back #if enemy2 then dead else: life-=1 os.system('aplay ./sounds/smb_mariodie.wav') screen.reset(self) else: low=0 c2=checkrv(self.__board.getgrid(mariopresent[0]+3,mariopresent[1]-1),self.__board.getgrid(mariopresent[0]+3,mariopresent[1]+1)) life+=c2 if c2==-1: os.system('aplay ./sounds/smb_mariodie.wav') screen.reset(self) if 1: #FOR SCREEN if mariopresent[1]>(i+50):#position of mario at which screen moves i+=20 #time.sleep(0.03) os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) #array of enemies #enemies completely governed by these arrays x,y=self.__board.searchenemy(i) #check for powerups if self.__board.getgrid(mariopresent[0]+2,mariopresent[1])=="P": os.system('aplay ./sounds/smb_1-up.wav') life+=1 self.__board.updatecell(mariopresent[0]+2,mariopresent[1],"-") #check for flower if marioprev[3]=='I': os.system('aplay ./sounds/smb_powerup.wav') marioprev[3]="-" bullet=1 #speed increase as mario progresses if mariopresent[1]>350: check=.7 else: check=1 if time.time()-loop>check: loop=time.time() #FOR ENEMY1 if len(x)!=0 and i+100>x[len(x)-1]>i: for count in range(len(x)): if mariopresent[1]<x[count]: c1=checkmv(self.__board.getgrid(35,x[count]-3)) if c1: self.__board.updateenemy1b(x[count],enemy1[count,:].decode()) #updating prev array enemy1[count,3]=enemy1[count,1] enemy1[count,2]=self.__board.getgrid(35,x[count]-2) enemy1[count,1]=self.__board.getgrid(35,x[count]-3) enemy1[count,0]=self.__board.getgrid(34,x[count]-2) x[count]-=2 self.__board.updateenemy1(34,x[count]) else: c1=checkmv(self.__board.getgrid(35,x[count]+3)) if c1: self.__board.updateenemy1f(x[count],enemy1[count,:].decode()) #updating prev array enemy1[count,0]=self.__board.getgrid(34,x[count]+2) enemy1[count,1]=enemy1[count,3] enemy1[count,2]=self.__board.getgrid(35,x[count]+2) enemy1[count,3]=self.__board.getgrid(35,x[count]+3) x[count]+=2 self.__board.updateenemy1(34,x[count]) time.sleep(0.03) os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) if time.time()-loop2>check-0.5: loop2=time.time() #FOR ENEMY2 if len(y)!=0 and i+100>y[len(y)-1]>i: for count in range(len(y)): c1=checkmv(self.__board.getgrid(35,y[count]-2)) if c1: self.__board.updateenemy2b(y[count],enemy2[count,:].decode()) #updating prev array enemy2[count,4]=enemy2[count,2] enemy2[count,3]=self.__board.getgrid(35,y[count]) enemy2[count,2]=self.__board.getgrid(35,y[count]-1) enemy2[count,1]=self.__board.getgrid(34,y[count]-1) enemy2[count,0]=self.__board.getgrid(34,y[count]-2) y[count]-=2 self.__board.updateenemy2(34,y[count]) #faster time.sleep(0.01) os.system('clear') self.__board.printboard(i,mariopresent[1],life,score,bullet) #dead if in contact with enemy if marioprev[6]=="x" or marioprev[7]=="x" or self.__board.getgrid(mariopresent[0]+1,mariopresent[1])=="Q" : #not updating enemy prev so it shows dead location life-=1 os.system('aplay ./sounds/smb_mariodie.wav') screen.reset(self) #if all lives used up if life<=0: os.system('clear') os.system('aplay ./sounds/smb_gameover.wav') print("GAME OVER ALL LIVES USED") break #---------------------------------------------------------------------------------------- finally: termios.tcsetattr(sys.stdin, termios.TCSADRAIN, old_settings) #running program if __name__=="__main__": x=start() x.run() if quit==0: x=screen() x.run()
b1a3c8cc07fae71c627558f8887507229a139da5
1add595fa4a4b2ebd42e4447310a1b389f88d9fe
/aiohttp_cache/setup.py
1e9a3bcf79880be8bf5bf2d1b016be470047d511
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
baldur/aiohttp-cache
95a57fd71feddb3fa0423c88318ed7c2a828b3a3
dc20cb7fb291e2eb755de1e70f356631cc0b16ac
refs/heads/master
2020-06-18T19:18:12.889982
2019-07-11T15:00:24
2019-07-11T15:00:24
196,415,749
0
0
NOASSERTION
2019-07-11T14:59:01
2019-07-11T14:59:00
null
UTF-8
Python
false
false
1,033
py
import logging from aiohttp import web from .backends import * from .middleware import * from .exceptions import * log = logging.getLogger("aiohttp") def setup_cache(app: web.Application, cache_type: str = "memory", backend_config=None): app.middlewares.append(cache_middleware) _cache_backend = None if cache_type.lower() == "memory": _cache_backend = MemoryCache() log.debug("Selected cache: {}".format(cache_type.upper())) elif cache_type.lower() == "redis": _redis_config = backend_config or RedisConfig() assert isinstance(_redis_config, RedisConfig), \ "Config must be a RedisConfig object. Got: '{}'".format(type(_redis_config)) _cache_backend = RedisCache(config=_redis_config) log.debug("Selected cache: {}".format(cache_type.upper())) else: raise HTTPCache("Invalid cache type selected") app["cache"] = _cache_backend __all__ = ("setup_cache", )
7e1d3f98f9918b8c57609a3abdbe11d5430f69ca
7f8ae468840f175a4744896986d4ec66895f08c2
/src/logcollection/loggers.py
7f85bc7dc7dc0ceaae168959543cf8019ea29f5d
[]
no_license
TakesxiSximada/logcollection
1ed54554c12d12e10149d1c473cd0eab00bd1cb2
19028f249fe7526227f3fe11607b24812a000b5c
refs/heads/master
2016-09-11T01:19:13.810367
2015-08-30T13:54:24
2015-08-30T13:54:24
29,011,707
0
0
null
null
null
null
UTF-8
Python
false
false
438
py
# -*- coding: utf-8 -*- import logging from functools import lru_cache from lazr.delegates import delegate_to from .interfaces import ILogger @delegate_to(ILogger, context='_context') class LazyLogger(object): def __init__(self, name): self._name = name @property @lru_cache() def _context(self): return logging.getLogger(self._name) def getLogger(*args, **kwds): return LazyLogger(*args, **kwds)
8e8bf11e41d2a9d112c996c91aedda605b92f21a
f1a7f108df5b6aef8672844bffa9e938b72089be
/networks/pretrained_net/__init__.py
7f64fa2a15c76b6f62f2786c1f5307871e439b73
[]
no_license
qianqian397/Dogs_vs_Cats_TensorFlow_Keras
1a2325793cb91cc0c0e7f4aaeb7d5e028d3f3332
0e40018efc5ddc9379f840978470834e472f2de0
refs/heads/master
2020-11-26T22:58:20.037355
2019-12-12T10:19:20
2019-12-12T10:19:20
null
0
0
null
null
null
null
UTF-8
Python
false
false
117
py
from networks.pretrained_net.VGG16.VGG16 import VGG16 from networks.pretrained_net.RESNET50.ResNet50 import ResNet50
deaf0d68b75d76daf2148049eed3e2be5d5008b9
60aa3bcf5ace0282210685e74ee8ed31debe1769
/core/sims4/repr_utils.py
8fe89c74f5e505a9815ce9efad0af05baaee8694
[]
no_license
TheBreadGuy/sims4-ai-engine
42afc79b8c02527353cc084117a4b8da900ebdb4
865212e841c716dc4364e0dba286f02af8d716e8
refs/heads/master
2023-03-16T00:57:45.672706
2016-05-01T17:26:01
2016-05-01T17:26:01
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,243
py
from types import FrameType import functools import sys def _strip_source_path(path): for f in sys.path: while path.startswith(f): return path[len(f):].lstrip('\\/') return path class suppress_quotes(str): __qualname__ = 'suppress_quotes' def __str__(self): return self def __repr__(self): return self def callable_repr(func): if isinstance(func, FrameType): code = func.f_code else: if isinstance(func, functools.partial): return 'partial({}, ...)'.format(callable_repr(func.func)) code = func.__code__ return '<{} at {}:{}>'.format(code.co_name, _strip_source_path(code.co_filename), code.co_firstlineno) def standard_repr(obj, *args, **kwargs): type_str = type(obj).__name__ if not isinstance(obj, str) else obj args_str = None if args: args_str = [str(i) for i in args] args_str = ', '.join(args_str) kwargs_str = None if kwargs: kwargs_str = ['{}={}'.format(k, v) for (k, v) in kwargs.items()] kwargs_str = ', '.join(sorted(kwargs_str)) if args_str and kwargs_str: return '{}({}, {})'.format(type_str, args_str, kwargs_str) if args_str or kwargs_str: return '{}({})'.format(type_str, args_str or kwargs_str) return '{}()'.format(type_str) def standard_auto_repr(obj, missing_value_marker='?', omit_missing_attributes=True): return object.__repr__(obj) def standard_angle_repr(obj, *args, **kwargs): type_str = type(obj).__name__ args_str = None if args: args_str = [str(i) for i in args] args_str = ' '.join(args_str) kwargs_str = None if kwargs: kwargs_str = ['{}={}'.format(k, v) for (k, v) in kwargs.items()] kwargs_str = ' '.join(sorted(kwargs_str)) if args_str and kwargs_str: return '<{}: {} {}>'.format(type_str, args_str, kwargs_str) if args_str or kwargs_str: return '<{}: {}>'.format(type_str, args_str or kwargs_str) return '<{} at {:#010x}>'.format(type_str, id(obj)) def standard_float_tuple_repr(*floats): return '(' + ', '.join('{:0.3f}'.format(i) for i in floats) + ')' def standard_brief_id_repr(guid): return '{:#018x}'.format(guid)
129ec1929c1af7937079abce7452c92eea96f8e4
2443f23d928a6b3516f810e3dfdf6f4b72aa0325
/st01.Python기초/py08반복문/py08_16_보초값.py
75f7ddc86a9165bb9ee575c350e7cb0af877175b
[]
no_license
syuri7/Python20200209
48653898f0ce94b8852a6a43e4e806adcf8cd233
5f0184d9b235ce366e228b84c663a376a9957962
refs/heads/master
2021-01-01T10:37:59.077170
2020-03-15T09:15:50
2020-03-15T09:15:50
239,241,118
0
0
null
null
null
null
UTF-8
Python
false
false
802
py
# while문을 사용하여 합계를 구하시오. # 무한 반복과 반목문(루프) 탈출을 결합한 예정 # 페이지 134 참고 # 무한 반복문은 조건식을 True로 하면 된다. # 루프 탈출은 break를 사용하면 된다. sum = 0 count = 0 print("종료하려면 음수를 입력하시오.") while True: # 무한 루프 입력값 = input("성적을 입력하시오.") # 정수로 변환 입력값 = int(입력값) # 입력값이 음수이면 반복문을 종료 if 입력값 < 0: break # 반복문을 종료 count = count+1 # 입력횟수 # 합계를 구한다. sum = sum+입력값 # 평균값을 계산한다. 평균값 = sum/count # 평균값을 출력한다. str = "성적의 평규는 %s입니다." % (평균값) print(str)
[ "d@d" ]
d@d
53882dc73e368f6c749d7838a985265351315fb0
f64d8201c2e55d7631d0a03a7a51d146c7d5c761
/00Python代码/flask_learn/10extends_block/extends_block.py
e882945721804bf0cdb4dafcb648896e538e10a1
[]
no_license
wh-orange/CodeRecord
cd14b5ccc1760a3d71762fef596ba9ab8dac8b8c
0e67d1dafcb2feaf90ffb55964af7a9be050e0ee
refs/heads/master
2022-01-18T10:26:27.993210
2019-08-04T17:38:35
2019-08-04T17:38:35
null
0
0
null
null
null
null
UTF-8
Python
false
false
283
py
#encoding: utf-8 from flask import Flask,render_template app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') @app.route('/login/') def login(): return render_template('login.html') if __name__ == '__main__': app.run(debug=True)
c0e4444f72f861346f349b0d3e17248c24e001e7
6f05f7d5a67b6bb87956a22b988067ec772ba966
/data/test/python/b12493130ac5924d0181574c0779561a13d48541admin.py
b12493130ac5924d0181574c0779561a13d48541
[ "MIT" ]
permissive
harshp8l/deep-learning-lang-detection
93b6d24a38081597c610ecf9b1f3b92c7d669be5
2a54293181c1c2b1a2b840ddee4d4d80177efb33
refs/heads/master
2020-04-07T18:07:00.697994
2018-11-29T23:21:23
2018-11-29T23:21:23
158,597,498
0
0
MIT
2018-11-21T19:36:42
2018-11-21T19:36:41
null
UTF-8
Python
false
false
559
py
from django.contrib import admin from repositories.models import Repository, Credential from repositories.forms import RepositoryForm, CredentialForm class RepositoryAdmin(admin.ModelAdmin): form = RepositoryForm list_display = ('name', 'manager', 'endpoint') class CredentialAdmin(admin.ModelAdmin): form = CredentialForm list_display = ('repository_name', 'public_key') def repository_name(sef, obj): return obj.repository.name admin.site.register(Repository, RepositoryAdmin) admin.site.register(Credential, CredentialAdmin)
fbefe5ee53df4789d1f34bd68a4a528e2a05ab55
a3785b6ff7734d98af1417000cd619a59bd5a268
/part_2_mmntv/regression/mpg/master_process.py
5cb1a476caa23132c8799010886daa0520f3c007
[]
no_license
SuryodayBasak/mst-final-run
bd9800744ab4fb6f0947c258ebc1be1151bc9ff2
2cde94af03d63f66cc3753843e4e60c92c313466
refs/heads/master
2022-07-01T22:40:39.003096
2020-05-09T04:25:18
2020-05-09T04:25:18
260,341,230
0
0
null
null
null
null
UTF-8
Python
false
false
4,352
py
import numpy as np import data_api as da import multiprocessing import time from knn import KNNRegressor, DwKNNRegressor from sklearn.model_selection import train_test_split from ga import GeneticAlgorithm from sklearn.metrics import mean_squared_error as skmse from ga_run import ga_run from pso_run import gbest_pso_run, lbest_pso_run from sklearn.decomposition import PCA # Load data. data = da.Mpg() X, y = data.Data() _, nFeats = np.shape(X) # Values of parameter k to iterate over. K_VALS = [3, 5, 7, 9, 11, 13, 15] starttime = time.time() # Repeat each trial 10 times. for i in range (0, 10): x_train, x_test, y_train, y_test = train_test_split(X, y,\ test_size=0.2) """ Try non-optimized methods. """ # Vanilla KNN. for k in K_VALS: reg = KNNRegressor(x_train, y_train, k) y_pred = reg.predict(x_test) mse_iter = skmse(y_test, y_pred) print("xx,knn,", k,",", mse_iter) # Distance-weighted KNN. for k in K_VALS: reg = DwKNNRegressor(x_train, y_train, k) y_pred = reg.predict(x_test) mse_iter = skmse(y_test, y_pred) print("xx,dknn,", k,",", mse_iter) """ PCA with KNN. """ pca = PCA(n_components = 4) pca.fit(x_train.copy()) x_train_pca = pca.transform(x_train.copy()) x_test_pca = pca.transform(x_test.copy()) # PCA + Vanilla KNN. for k in K_VALS: reg = KNNRegressor(x_train_pca, y_train, k) y_pred = reg.predict(x_test_pca) mse_iter = skmse(y_test, y_pred) print("pca,knn,", k,",", mse_iter) # PCA + Distance-weighted KNN. for k in K_VALS: reg = DwKNNRegressor(x_train_pca, y_train, k) y_pred = reg.predict(x_test_pca) mse_iter = skmse(y_test, y_pred) print("pca,dknn,", k,",", mse_iter) x_train, x_verif, y_train, y_verif = train_test_split(x_train,\ y_train,\ test_size=0.33) """ GA-driven methods. """ processes = [] # Use different values of k. for k in K_VALS: # Run the GA based optimization. p = multiprocessing.Process(target = ga_run,\ args = (x_train.copy(),\ y_train.copy(),\ x_test.copy(),\ y_test.copy(),\ x_verif.copy(),\ y_verif.copy(),\ k,)) processes.append(p) p.start() for process in processes: process.join() """ GBest_PSO-driven methods. """ processes = [] # Use different values of k. for k in K_VALS: # Run the GA based optimization. p = multiprocessing.Process(target = gbest_pso_run,\ args = (x_train.copy(),\ y_train.copy(),\ x_test.copy(),\ y_test.copy(),\ x_verif.copy(),\ y_verif.copy(),\ k,)) processes.append(p) p.start() for process in processes: process.join() """ LBest_PSO-driven methods. """ processes = [] # Use different values of k. for k in K_VALS: # Run the GA based optimization. p = multiprocessing.Process(target = lbest_pso_run,\ args = (x_train.copy(),\ y_train.copy(),\ x_test.copy(),\ y_test.copy(),\ x_verif.copy(),\ y_verif.copy(),\ k,)) processes.append(p) p.start() for process in processes: process.join() print('That took {} seconds'.format(time.time() - starttime))
1f1134dae9bc171e4e36131aac07200d449c4ee7
16303a3f6bc8fd1f2116bc3cdd22db8f5e56ae40
/tests/common_tests/formats_tests/newick_tests.py
60dbf5d547dd262269722ddcd8964b3dd46514f3
[]
no_license
jelber2/paleomix
eb3ed410e925437321168710808b67cf8c029bbf
dfb7f8f9410e1e985992e7ed95adc36de7bc0353
refs/heads/master
2020-08-23T01:36:50.778627
2019-10-15T20:17:42
2019-10-15T20:18:00
null
0
0
null
null
null
null
UTF-8
Python
false
false
24,722
py
#!/usr/bin/python # # Copyright (c) 2012 Mikkel Schubert <[email protected]> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # from nose.tools import \ assert_equal, \ assert_not_equal, \ assert_raises from paleomix.common.formats.newick import \ Newick, \ GraphError, \ NewickError, \ NewickParseError from paleomix.common.testing import \ assert_list_equal ############################################################################### ############################################################################### # Constructor def test_newick__constructor__name(): node = Newick(name="AbC") assert_equal(node.name, "AbC") def test_newick__constructor__children_set_in_internal_nodes(): node = Newick(name="Leaf") top_node = Newick(children=[node]) assert_equal(top_node.children, (node,)) def test_newick__constructor__children_not_set_in_leaf_nodes(): node = Newick(name="Leaf") assert_equal(node.children, ()) def test_newick__constructor__is_leaf_true_for_leaf_nodes(): node = Newick(name="Another Leaf") assert node.is_leaf def test_newick__constructor__is_leaf_false_for_internal_nodes(): node = Newick(name="Leaf") top_node = Newick(children=[node]) assert not top_node.is_leaf def test_newick__constuctor__leaf_nodes_must_have_name_or_length(): assert_raises(NewickError, Newick, children=None) def test_newick__constructor__internal_nodes_must_have_children(): assert_raises(NewickError, Newick, children=[]) def test_newick__constructor__children_must_be_newick(): assert_raises(TypeError, Newick, children=["A", "B"]) ############################################################################### ############################################################################### # get_leaf_nodes def test_newick__get_leaf_nodes__leaf_returns_self(): node = Newick(name="Leaf") assert_list_equal(node.get_leaf_nodes(), [node]) def test_newick__get_leaf_nodes__internal_node_returns_leaf_nodes(): node_a = Newick(name="Leaf A") node_b = Newick(name="Leaf B") top_node = Newick(children=[node_a, node_b]) assert_list_equal(top_node.get_leaf_nodes(), [node_a, node_b]) def test_newick__get_leaf_nodes__complex_case(): node_a = Newick(name="Leaf A") node_b = Newick(name="Leaf B") node_c = Newick(name="Leaf C") sub_a = Newick(children=[node_b, node_c]) top_node = Newick(children=[node_a, sub_a]) assert_list_equal(top_node.get_leaf_nodes(), [node_a, node_b, node_c]) ############################################################################### ############################################################################### # get_leaf_nodes def test_newick__get_leaf_names__leaf_returns_self(): node = Newick(name="Leaf") assert_list_equal(node.get_leaf_names(), ["Leaf"]) def test_newick__get_leaf_names__internal_node_returns_leaf_nodes(): node_a = Newick(name="Leaf A") node_b = Newick(name="Leaf B") top_node = Newick(children=[node_a, node_b]) assert_list_equal(top_node.get_leaf_names(), ["Leaf A", "Leaf B"]) def test_newick__get_leaf_names__complex_case(): node_a = Newick(name="Leaf A") node_b = Newick(name="Leaf B") node_c = Newick(name="Leaf C") sub_a = Newick(children=[node_b, node_c]) top_node = Newick(children=[node_a, sub_a]) assert_list_equal(top_node.get_leaf_names(), ["Leaf A", "Leaf B", "Leaf C"]) ############################################################################### ############################################################################### # reroot_on_taxa def test_newick__reroot_on_taxa__single_taxa(): source = Newick.from_string("((A,B),C);") expected = Newick.from_string("((B,C),A);") assert_equal(expected, source.reroot_on_taxa("A")) def test_newick__reroot_on_taxa__single_taxa_with_branch_lengths(): source = Newick.from_string("((A:4,B:3):2,C:1);") expected = Newick.from_string("((B:3,C:3.0):2.0,A:2.0);") assert_equal(expected, source.reroot_on_taxa("A")) def test_newick__reroot_on_taxa__multiple_taxa__clade(): source = Newick.from_string("((A,(B,C)),(D,E));") expected = Newick.from_string("(((D,E),A),(B,C));") assert_equal(expected, source.reroot_on_taxa(("B", "C"))) def test_newick__reroot_on_taxa__multiple_taxa__paraphylogeny(): source = Newick.from_string("((B,C),((D,E),A));") expected = Newick.from_string("(((B,C),A),(D,E));") assert_equal(expected, source.reroot_on_taxa(("A", "C"))) def test_newick__reroot_on_taxa__no_taxa(): source = Newick.from_string("((B,C),((D,E),A));") assert_raises(ValueError, source.reroot_on_taxa, ()) def test_newick__reroot_on_taxa__unknown_taxa(): source = Newick.from_string("((B,C),((D,E),A));") assert_raises(ValueError, source.reroot_on_taxa, ("A", "Z")) def test_newick__reroot_on_taxa__no_non_root_taxa(): source = Newick.from_string("((B,C),((D,E),A));") assert_raises(ValueError, source.reroot_on_taxa, ("A", "B", "C", "D", "E")) ############################################################################### ############################################################################### # reroot_on_midpoint def test_newick__reroot_on_midpoint__single_node(): source = Newick.from_string("(A:3.0);") expected = Newick.from_string("(A:3.0);") assert_equal(expected, source.reroot_on_midpoint()) def test_newick__reroot_on_midpoint__two_nodes(): source = Newick.from_string("(A:3.0,B:8.0);") rerooted = source.reroot_on_midpoint() expected = Newick.from_string("(A:5.5,B:5.5);") assert_equal(expected, rerooted) def test_newick__reroot_on_midpoint__two_clades(): source = Newick.from_string("((A:7,B:2):1,(C:1,D:0.5):2);") rerooted = source.reroot_on_midpoint() expected = Newick.from_string("(((C:1,D:0.5):3.0,B:2):1.5,A:5.5);") assert_equal(expected, rerooted) def test_newick__reroot_on_midpoint__nested_clades(): source = Newick.from_string("((A:2,(B:2,C:3):4):1,(D:1,E:0.5):2);") rerooted = source.reroot_on_midpoint() expected = Newick.from_string("(((D:1,E:0.5):3.0,A:2):1.5,(B:2,C:3):2.5);") assert_equal(expected, rerooted) def test_newick__reroot_on_midpoint__reroot_on_internal_node(): source = Newick.from_string("((A:5.0,B:1.0)C:2.0,D:3.0);") rerooted = source.reroot_on_midpoint() expected = Newick.from_string("(A:5.0,B:1.0,D:5.0)C;") assert_equal(expected, rerooted) def test_newick__reroot_on_midpoint__invalid_branch_lengths(): def _test_invalid_branch_lengths(newick): source = Newick.from_string(newick) assert_raises(GraphError, source.reroot_on_midpoint) yield _test_invalid_branch_lengths, "(A,B);" # No branch lengths yield _test_invalid_branch_lengths, "(A:7,B);" # Length missing for leaf node yield _test_invalid_branch_lengths, "(A:7,(B:3));" # Length missing for internal node yield _test_invalid_branch_lengths, "(A:7,(B:3):-1);" # Negative branch length yield _test_invalid_branch_lengths, "(A:7,B:-1);" # Negative leaf length ############################################################################### ############################################################################### # add_support def test_newick__add_support__no_trees(): main_tree = Newick.from_string("(((A,B),C),D);") expected = Newick.from_string("(((A,B)0,C)0,D);") result = main_tree.add_support([]) assert_equal(expected, result) def test_newick__add_support__single_identical_tree(): main_tree = Newick.from_string("(((A,B),C),D);") bootstraps = [Newick.from_string("(((A,B),C),D);")] expected = Newick.from_string("(((A,B)1,C)1,D);") result = main_tree.add_support(bootstraps) assert_equal(expected, result) def test_newick__add_support__single_identical_tree__different_rooting(): main_tree = Newick.from_string("(((A,B),C),D);") bootstraps = [Newick.from_string("(((C,D),B),A);")] expected = Newick.from_string("(((A,B)1,C)1,D);") result = main_tree.add_support(bootstraps) assert_equal(expected, result) def test_newick__add_support__multiple_trees__different_topologies(): main_tree = Newick.from_string("(((A,B),C),D);") bootstraps = [Newick.from_string("(((C,B),D),A);"), Newick.from_string("(((A,D),B),C);")] expected = Newick.from_string("(((A,B)0,C)2,D);") result = main_tree.add_support(bootstraps) assert_equal(expected, result) def test_newick__add_support__multiple_trees__partially_different_topologies(): main_tree = Newick.from_string("(((A,B),C),D);") bootstraps = [Newick.from_string("(((C,D),A),B);"), Newick.from_string("(((A,D),B),C);")] expected = Newick.from_string("(((A,B)1,C)2,D);") result = main_tree.add_support(bootstraps) assert_equal(expected, result) def test_newick__add_support__multiple_trees__two_cladees(): main_tree = Newick.from_string("((A,B),(C,(D,E)));") bootstraps = [Newick.from_string("((((C,E),D),A),B);"), Newick.from_string("(((A,(C,D)),B),E);")] expected = Newick.from_string("((A,B)1,(C,(D,E)0)1);") result = main_tree.add_support(bootstraps) assert_equal(expected, result) def test_newick__add_support__differing_leaf_names(): main_tree = Newick.from_string("(((A,B),C),D);") bootstraps = [Newick.from_string("(((C,E),B),A);")] assert_raises(NewickError, main_tree.add_support, bootstraps) def test_newick__add_support__formatting(): def _do_test_formatting(fmt, expected): main_tree = Newick.from_string("(((A,B),C),D);") bootstraps = [Newick.from_string("(((C,D),A),B);"), Newick.from_string("(((C,B),A),D);"), Newick.from_string("(((A,D),B),C);")] expected = Newick.from_string(expected) result = main_tree.add_support(bootstraps, fmt) assert_equal(expected, result) yield _do_test_formatting, "{Support}", "(((A,B)1,C)3,D);" yield _do_test_formatting, "{Percentage:.0f}", "(((A,B)33,C)100,D);" yield _do_test_formatting, "{Fraction:.2f}", "(((A,B)0.33,C)1.00,D);" def test_newick__add_support__unique_names_required(): main_tree = Newick.from_string("(((A,B),C),A);") bootstraps = [Newick.from_string("(((A,B),C),A);")] assert_raises(NewickError, main_tree.add_support, bootstraps) ############################################################################### ############################################################################### # from_string def test_newick__parse__minimal_newick__name_only(): top_node = Newick(name="A") assert_equal(Newick.from_string("A;"), top_node) def test_newick__parse__single_taxa(): child_node = Newick(name="Ab") top_node = Newick(children=[child_node]) assert_equal(Newick.from_string("(Ab);"), top_node) def test_newick__parse__two_taxa(): child_node_1 = Newick(name="A") child_node_2 = Newick(name="Bc") top_node = Newick(children=[child_node_1, child_node_2]) assert_equal(Newick.from_string("(A,Bc);"), top_node) def test_newick__parse__three_taxa(): child_node_1 = Newick(name="A") child_node_2 = Newick(name="Bc") child_node_3 = Newick(name="DeF") top_node = Newick(children=[child_node_1, child_node_2, child_node_3]) assert_equal(Newick.from_string("(A,Bc,DeF);"), top_node) def test_newick__parse__ignore_whitespace(): assert_equal(Newick.from_string("(A,B);"), Newick.from_string("(A, B);")) def test_newick__parse__missing_semicolon(): assert_raises(NewickParseError, Newick.from_string, "()") def test_newick__parse__subnode__single_taxa(): child_node_1 = Newick(name="A") child_node_2a = Newick(name="B") child_node_2 = Newick(children=[child_node_2a]) top_node = Newick(children=[child_node_1, child_node_2]) assert_equal(Newick.from_string("(A,(B));"), top_node) def test_newick__parse__subnode__two_taxa(): child_node_1 = Newick(name="A") child_node_2a = Newick(name="B") child_node_2b = Newick(name="C") child_node_2 = Newick(children=[child_node_2a, child_node_2b]) top_node = Newick(children=[child_node_1, child_node_2]) assert_equal(Newick.from_string("(A,(B,C));"), top_node) ########################################################################### ########################################################################### # cmp - white-box, just make sure all properties are compared def test_newick__cmp__identical(): node_a = Newick(name="A", length=13, children=[Newick(name="B")]) node_b = Newick(name="A", length=13, children=[Newick(name="B")]) assert_equal(node_a, node_b) def test_newick__cmp__identical_for_empty_string_length(): node_a = Newick(name="A", length="", children=[Newick(name="B")]) node_b = Newick(name="A", length=None, children=[Newick(name="B")]) assert_equal(node_a, node_b) def test_newick__cmp__identical_for_empty_string_name(): node_a = Newick(name="", length=13, children=[Newick(name="B")]) node_b = Newick(name=None, length=13, children=[Newick(name="B")]) assert_equal(node_a, node_b) def test_newick__cmp__not_identical(): def _not_identical(node_b): node_a = Newick(name="A", length=13, children=[Newick(name="B")]) assert_not_equal(node_a, node_b) yield _not_identical, Newick(name="B", length=13, children=[Newick(name="B")]) yield _not_identical, Newick(name="A", length=14, children=[Newick(name="B")]) yield _not_identical, Newick(name="A", length=13, children=[]) yield _not_identical, Newick(name="A", length=13, children=[Newick(name="C")]) yield _not_identical, Newick(name="B", length=14, children=[Newick(name="C")]) ############################################################################### ############################################################################### # hash - white-box, just make sure all properties are used def test_newick__hash__identical(): node_a = Newick(name="A", length=13, children=[Newick(name="B")]) node_b = Newick(name="A", length=13, children=[Newick(name="B")]) assert_equal(hash(node_a), hash(node_b)) def test_newick__hash__not_identical(): def _not_identical(node_b): node_a = Newick(name="A", length=13, children=[Newick(name="B")]) assert_not_equal(hash(node_a), hash(node_b)) yield _not_identical, Newick(name="B", length=13, children=[Newick(name="B")]) yield _not_identical, Newick(name="A", length=14, children=[Newick(name="B")]) yield _not_identical, Newick(name="A", length=13, children=[]) yield _not_identical, Newick(name="A", length=13, children=[Newick(name="C")]) yield _not_identical, Newick(name="B", length=14, children=[Newick(name="C")]) def test_newick__hash__hashable(): key_a = Newick(name="A", length=13.7, children=[Newick(name="F")]) key_b = Newick(name="A", length=13.7, children=[Newick(name="F")]) assert key_b in {key_a: True} ############################################################################### ############################################################################### # Malformed newick strings def test_newick__malformed__unbalanced_parantheses(): assert_raises(NewickParseError, Newick.from_string, "(A,(B,C);") def test_newick__malformed__mismatched_parantheses(): assert_raises(NewickParseError, Newick.from_string, "(A,(B,C();") def test_newick__malformed__missing_parantheses(): assert_raises(NewickParseError, Newick.from_string, "(A,(B,C))") def test_newick__malformed__missing_length(): assert_raises(NewickParseError, Newick.from_string, "(A:,(B,C));") assert_raises(NewickParseError, Newick.from_string, "(A,(B:,C));") assert_raises(NewickParseError, Newick.from_string, "(A,(B,C:));") assert_raises(NewickParseError, Newick.from_string, "(A,(B,C):);") assert_raises(NewickParseError, Newick.from_string, "(A,(B,C)):;") def test_newick__malformed__multiple_lengths(): assert_raises(NewickParseError, Newick.from_string, "(A:1:2);") ############################################################################### ############################################################################### # Implicit leafs are not supported (due to problems with ambiguiety) def test_newick__parse__first_taxa_unnamed(): assert_raises(NewickError, Newick.from_string, "(,A);") def test_newick__parse__second_taxa_unnamed(): assert_raises(NewickError, Newick.from_string, "(A,);") def test_newick__parse__two_taxa_unnamed(): assert_raises(NewickError, Newick.from_string, "(,);") def test_newick__parse__three_taxa_unnamed(): assert_raises(NewickError, Newick.from_string, "(,,);") ############################################################################### ############################################################################### # Empty non-leaf nodes are not allowed, as their interpretation is unclear def test_newick__parse__minimal_newick__implicit_nodes(): assert_raises(NewickParseError, Newick.from_string, "();") def test_newick__parse__subnode__empty(): assert_raises(NewickParseError, Newick.from_string, "(A,());") ############################################################################### ############################################################################### # The following tests are derived from the wikipedia description of the # newick format: http://en.wikipedia.org/wiki/Newick_format#Examples def test_newick__wikipedia_example_1(): # no nodes are named, this format is not supported here! assert_raises(NewickError, Newick.from_string, "(,,(,));") def test_newick__wikipedia_example_2(): # leaf nodes are named taxa_d = Newick(name="D") taxa_c = Newick(name="C") taxa_sub = Newick(children=[taxa_c, taxa_d]) taxa_b = Newick(name="B") taxa_a = Newick(name="A") top_node = Newick(children=[taxa_a, taxa_b, taxa_sub]) assert_equal(Newick.from_string("(A,B,(C,D));"), top_node) def test_newick__wikipedia_example_3(): # all nodes are named taxa_d = Newick(name="D") taxa_c = Newick(name="C") taxa_sub = Newick(children=[taxa_c, taxa_d], name="E") taxa_b = Newick(name="B") taxa_a = Newick(name="A") top_node = Newick(children=[taxa_a, taxa_b, taxa_sub], name="F") assert_equal(Newick.from_string("(A,B,(C,D)E)F;"), top_node) def test_newick__wikipedia_example_4(): # all but root node have a distance to parent taxa_d = Newick(length="0.4") taxa_c = Newick(length="0.3") taxa_sub = Newick(children=[taxa_c, taxa_d], length="0.5") taxa_b = Newick(length="0.2") taxa_a = Newick(length="0.1") top_node = Newick(children=[taxa_a, taxa_b, taxa_sub]) assert_equal(Newick.from_string("(:0.1,:0.2,(:0.3,:0.4):0.5);"), top_node) def test_newick__wikipedia_example_5(): # all have a distance to parent taxa_d = Newick(length="0.4") taxa_c = Newick(length="0.3") taxa_sub = Newick(children=[taxa_c, taxa_d], length="0.5") taxa_b = Newick(length="0.2") taxa_a = Newick(length="0.1") top_node = Newick(children=[taxa_a, taxa_b, taxa_sub], length="0.0") assert_equal(Newick.from_string("(:0.1,:0.2,(:0.3,:0.4):0.5):0.0;"), top_node) def test_newick__wikipedia_example_6(): # distances and leaf names (popular) taxa_d = Newick(length="0.4", name="D") taxa_c = Newick(length="0.3", name="C") taxa_sub = Newick(children=[taxa_c, taxa_d], length="0.5") taxa_b = Newick(length="0.2", name="B") taxa_a = Newick(length="0.1", name="A") top_node = Newick(children=[taxa_a, taxa_b, taxa_sub]) assert_equal(Newick.from_string("(A:0.1,B:0.2,(C:0.3,D:0.4):0.5);"), top_node) def test_newick__wikipedia_example_7(): # distances and all names taxa_d = Newick(length="0.4", name="D") taxa_c = Newick(length="0.3", name="C") taxa_sub = Newick(children=[taxa_c, taxa_d], length="0.5", name="E") taxa_b = Newick(length="0.2", name="B") taxa_a = Newick(length="0.1", name="A") top_node = Newick(children=[taxa_a, taxa_b, taxa_sub], name="F") assert_equal(Newick.from_string("(A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5)F;"), top_node) def test_newick__wikipedia_example_8(): # a tree rooted on a leaf node (rare) taxa_b = Newick(length="0.2", name="B") taxa_c = Newick(length="0.3", name="C") taxa_d = Newick(length="0.4", name="D") node_e = Newick(length="0.5", name="E", children=[taxa_c, taxa_d]) node_f = Newick(length="0.1", name="F", children=[taxa_b, node_e]) node_a = Newick(name="A", children=[node_f]) assert_equal(Newick.from_string("((B:0.2,(C:0.3,D:0.4)E:0.5)F:0.1)A;"), node_a) ############################################################################### ############################################################################### # str / repr def test_newick__str__non_string_name(): node = Newick(children=[Newick(name=17, length="1.3")]) assert_equal(str(node), "(17:1.3);") def test_newick__str__non_string_length(): node = Newick(children=[Newick(name="Foo", length=1.3)]) assert_equal(str(node), "(Foo:1.3);") def test_newick__str__repr_equal_to_str(): node_a = Newick(name="A", length="123") node_b = Newick(name="B", length="4567") top_node = Newick(children=[node_a, node_b]) assert_equal(str(top_node), "(A:123,B:4567);") def test_newick__str__single_leaf_should_not_be_followed_by_comma(): node = Newick(name="A") top_node = Newick(children=[node]) assert_equal(str(top_node), "(A);") def test_newick__wikipedia_examples__str_equality(): def _newick_str_input_equals_output(nwk_str): nodes = Newick.from_string(nwk_str) result = str(nodes) assert_equal(result, nwk_str) # 2. leaf nodes are named yield _newick_str_input_equals_output, "(A,B,(C,D));" # 3. all nodes are named yield _newick_str_input_equals_output, "(A,B,(C,D)E)F;" # 4. all but root node have a distance to parent yield _newick_str_input_equals_output, "(:0.1,:0.2,(:0.3,:0.4):0.5);" # 5. all have a distance to parent yield _newick_str_input_equals_output, "(:0.1,:0.2,(:0.3,:0.4):0.5):0.0;" # 6. distances and leaf names (popular) yield _newick_str_input_equals_output, "(A:0.1,B:0.2,(C:0.3,D:0.4):0.5);" # 7. distances and all names yield _newick_str_input_equals_output, "(A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5)F;" ############################################################################### ############################################################################### # Immutability def test_newick__properties_are_immutable(): def _test_newick__properties_are_immutable(name, value): node = Newick(name="A", length=3, children=[Newick(name="B")]) assert_raises(NotImplementedError, setattr, node, name, value) yield _test_newick__properties_are_immutable, "name", "foo" yield _test_newick__properties_are_immutable, "length", "13" yield _test_newick__properties_are_immutable, "children", [] yield _test_newick__properties_are_immutable, "foobar", True def test_newick__properties_cannot_be_deleted(): def _test_newick__properties_cannot_be_deleted(name): node = Newick(name="A", length=3, children=[Newick(name="B")]) assert_raises(NotImplementedError, delattr, node, name) yield _test_newick__properties_cannot_be_deleted, "name" yield _test_newick__properties_cannot_be_deleted, "length" yield _test_newick__properties_cannot_be_deleted, "children" yield _test_newick__properties_cannot_be_deleted, "foobar"
2c6c4264cb594c4bc7ecaa40e5d99619f2ca30cf
eee6dd18897d3118f41cb5e6f93f830e06fbfe2f
/venv/lib/python3.6/site-packages/pip/_vendor/distlib/metadata.py
69ef29eb16fc38a48ed43e07359abac03efebd73
[]
no_license
georgeosodo/ml
2148ecd192ce3d9750951715c9f2bfe041df056a
48fba92263e9295e9e14697ec00dca35c94d0af0
refs/heads/master
2020-03-14T11:39:58.475364
2018-04-30T13:13:01
2018-04-30T13:13:01
131,595,044
0
0
null
null
null
null
UTF-8
Python
false
false
40,001
py
# -*- coding: utf-8 -*- # # Copyright (C) 2012 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # """Implementation of the Metadata for Python packages PEPs. Supports all metadata formats (1.0, 1.1, 1.2, and 2.0 experimental). """ import codecs from email import message_from_file import json import logging import re from . import DistlibException, __version__ from .compat import StringIO, string_types, text_type from .markers import interpret from .util import extract_by_key, get_extras from .version import get_scheme, PEP440_VERSION_RE logger = logging.getLogger(__name__) class MetadataMissingError(DistlibException): """A required metadata is missing""" class MetadataConflictError(DistlibException): """Attempt to read or write metadata fields that are conflictual.""" class MetadataUnrecognizedVersionError(DistlibException): """Unknown metadata version number.""" class MetadataInvalidError(DistlibException): """A metadata value is invalid""" # public API of this module __all__ = ['Metadata', 'PKG_INFO_ENCODING', 'PKG_INFO_PREFERRED_VERSION'] # Encoding used for the PKG-INFO files PKG_INFO_ENCODING = 'utf-8' # preferred version. Hopefully will be changed # to 1.2 once PEP 345 is supported everywhere PKG_INFO_PREFERRED_VERSION = '1.1' _LINE_PREFIX_1_2 = re.compile('\n \\|') _LINE_PREFIX_PRE_1_2 = re.compile('\n ') _241_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', 'Summary', 'Description', 'Keywords', 'Home-page', 'Author', 'Author-email', 'License') _314_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', 'Supported-Platform', 'Summary', 'Description', 'Keywords', 'Home-page', 'Author', 'Author-email', 'License', 'Classifier', 'Download-URL', 'Obsoletes', 'Provides', 'Requires') _314_MARKERS = ('Obsoletes', 'Provides', 'Requires', 'Classifier', 'Download-URL') _345_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', 'Supported-Platform', 'Summary', 'Description', 'Keywords', 'Home-page', 'Author', 'Author-email', 'Maintainer', 'Maintainer-email', 'License', 'Classifier', 'Download-URL', 'Obsoletes-Dist', 'Project-URL', 'Provides-Dist', 'Requires-Dist', 'Requires-Python', 'Requires-External') _345_MARKERS = ('Provides-Dist', 'Requires-Dist', 'Requires-Python', 'Obsoletes-Dist', 'Requires-External', 'Maintainer', 'Maintainer-email', 'Project-URL') _426_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', 'Supported-Platform', 'Summary', 'Description', 'Keywords', 'Home-page', 'Author', 'Author-email', 'Maintainer', 'Maintainer-email', 'License', 'Classifier', 'Download-URL', 'Obsoletes-Dist', 'Project-URL', 'Provides-Dist', 'Requires-Dist', 'Requires-Python', 'Requires-External', 'Private-Version', 'Obsoleted-By', 'Setup-Requires-Dist', 'Extension', 'Provides-Extra') _426_MARKERS = ('Private-Version', 'Provides-Extra', 'Obsoleted-By', 'Setup-Requires-Dist', 'Extension') _566_FIELDS = _426_FIELDS + ('Description-Content-Type',) _566_MARKERS = ('Description-Content-Type',) _ALL_FIELDS = set() _ALL_FIELDS.update(_241_FIELDS) _ALL_FIELDS.update(_314_FIELDS) _ALL_FIELDS.update(_345_FIELDS) _ALL_FIELDS.update(_426_FIELDS) _ALL_FIELDS.update(_566_FIELDS) EXTRA_RE = re.compile(r'''extra\s*==\s*("([^"]+)"|'([^']+)')''') def _version2fieldlist(version): if version == '1.0': return _241_FIELDS elif version == '1.1': return _314_FIELDS elif version == '1.2': return _345_FIELDS elif version in ('1.3', '2.1'): return _345_FIELDS + _566_FIELDS elif version == '2.0': return _426_FIELDS raise MetadataUnrecognizedVersionError(version) def _best_version(fields): """Detect the best version depending on the fields used.""" def _has_marker(keys, markers): for marker in markers: if marker in keys: return True return False keys = [] for key, value in list(fields.items()): if value in ([], 'UNKNOWN', None): continue keys.append(key) possible_versions = ['1.0', '1.1', '1.2', '1.3', '2.0', '2.1'] # first let's try to see if a field is not part of one of the version for key in keys: if key not in _241_FIELDS and '1.0' in possible_versions: possible_versions.remove('1.0') logger.debug('Removed 1.0 due to %s', key) if key not in _314_FIELDS and '1.1' in possible_versions: possible_versions.remove('1.1') logger.debug('Removed 1.1 due to %s', key) if key not in _345_FIELDS and '1.2' in possible_versions: possible_versions.remove('1.2') logger.debug('Removed 1.2 due to %s', key) if key not in _566_FIELDS and '1.3' in possible_versions: possible_versions.remove('1.3') logger.debug('Removed 1.3 due to %s', key) if key not in _566_FIELDS and '2.1' in possible_versions: if key != 'Description': # In 2.1, description allowed after headers possible_versions.remove('2.1') logger.debug('Removed 2.1 due to %s', key) if key not in _426_FIELDS and '2.0' in possible_versions: possible_versions.remove('2.0') logger.debug('Removed 2.0 due to %s', key) # possible_version contains qualified versions if len(possible_versions) == 1: return possible_versions[0] # found ! elif len(possible_versions) == 0: logger.debug('Out of options - unknown metadata set: %s', fields) raise MetadataConflictError('Unknown metadata set') # let's see if one unique marker is found is_1_1 = '1.1' in possible_versions and _has_marker(keys, _314_MARKERS) is_1_2 = '1.2' in possible_versions and _has_marker(keys, _345_MARKERS) is_2_1 = '2.1' in possible_versions and _has_marker(keys, _566_MARKERS) is_2_0 = '2.0' in possible_versions and _has_marker(keys, _426_MARKERS) if int(is_1_1) + int(is_1_2) + int(is_2_1) + int(is_2_0) > 1: raise MetadataConflictError('You used incompatible 1.1/1.2/2.0/2.1 fields') # we have the choice, 1.0, or 1.2, or 2.0 # - 1.0 has a broken Summary field but works with all tools # - 1.1 is to avoid # - 1.2 fixes Summary but has little adoption # - 2.0 adds more features and is very new if not is_1_1 and not is_1_2 and not is_2_1 and not is_2_0: # we couldn't find any specific marker if PKG_INFO_PREFERRED_VERSION in possible_versions: return PKG_INFO_PREFERRED_VERSION if is_1_1: return '1.1' if is_1_2: return '1.2' if is_2_1: return '2.1' return '2.0' _ATTR2FIELD = { 'metadata_version': 'Metadata-Version', 'name': 'Name', 'version': 'Version', 'platform': 'Platform', 'supported_platform': 'Supported-Platform', 'summary': 'Summary', 'description': 'Description', 'keywords': 'Keywords', 'home_page': 'Home-page', 'author': 'Author', 'author_email': 'Author-email', 'maintainer': 'Maintainer', 'maintainer_email': 'Maintainer-email', 'license': 'License', 'classifier': 'Classifier', 'download_url': 'Download-URL', 'obsoletes_dist': 'Obsoletes-Dist', 'provides_dist': 'Provides-Dist', 'requires_dist': 'Requires-Dist', 'setup_requires_dist': 'Setup-Requires-Dist', 'requires_python': 'Requires-Python', 'requires_external': 'Requires-External', 'requires': 'Requires', 'provides': 'Provides', 'obsoletes': 'Obsoletes', 'project_url': 'Project-URL', 'private_version': 'Private-Version', 'obsoleted_by': 'Obsoleted-By', 'extension': 'Extension', 'provides_extra': 'Provides-Extra', } _PREDICATE_FIELDS = ('Requires-Dist', 'Obsoletes-Dist', 'Provides-Dist') _VERSIONS_FIELDS = ('Requires-Python',) _VERSION_FIELDS = ('Version',) _LISTFIELDS = ('Platform', 'Classifier', 'Obsoletes', 'Requires', 'Provides', 'Obsoletes-Dist', 'Provides-Dist', 'Requires-Dist', 'Requires-External', 'Project-URL', 'Supported-Platform', 'Setup-Requires-Dist', 'Provides-Extra', 'Extension') _LISTTUPLEFIELDS = ('Project-URL',) _ELEMENTSFIELD = ('Keywords',) _UNICODEFIELDS = ('Author', 'Maintainer', 'Summary', 'Description') _MISSING = object() _FILESAFE = re.compile('[^A-Za-z0-9.]+') def _get_name_and_version(name, version, for_filename=False): """Return the distribution name with version. If for_filename is true, return a filename-escaped form.""" if for_filename: # For both name and version any runs of non-alphanumeric or '.' # characters are replaced with a single '-'. Additionally any # spaces in the version string become '.' name = _FILESAFE.sub('-', name) version = _FILESAFE.sub('-', version.replace(' ', '.')) return '%s-%s' % (name, version) class LegacyMetadata(object): """The legacy metadata of a release. Supports versions 1.0, 1.1 and 1.2 (auto-detected). You can instantiate the class with one of these arguments (or none): - *path*, the path to a metadata file - *fileobj* give a file-like object with metadata as content - *mapping* is a dict-like object - *scheme* is a version scheme name """ # TODO document the mapping API and UNKNOWN default key def __init__(self, path=None, fileobj=None, mapping=None, scheme='default'): if [path, fileobj, mapping].count(None) < 2: raise TypeError('path, fileobj and mapping are exclusive') self._fields = {} self.requires_files = [] self._dependencies = None self.scheme = scheme if path is not None: self.read(path) elif fileobj is not None: self.read_file(fileobj) elif mapping is not None: self.update(mapping) self.set_metadata_version() def set_metadata_version(self): self._fields['Metadata-Version'] = _best_version(self._fields) def _write_field(self, fileobj, name, value): fileobj.write('%s: %s\n' % (name, value)) def __getitem__(self, name): return self.get(name) def __setitem__(self, name, value): return self.set(name, value) def __delitem__(self, name): field_name = self._convert_name(name) try: del self._fields[field_name] except KeyError: raise KeyError(name) def __contains__(self, name): return (name in self._fields or self._convert_name(name) in self._fields) def _convert_name(self, name): if name in _ALL_FIELDS: return name name = name.replace('-', '_').lower() return _ATTR2FIELD.get(name, name) def _default_value(self, name): if name in _LISTFIELDS or name in _ELEMENTSFIELD: return [] return 'UNKNOWN' def _remove_line_prefix(self, value): if self.metadata_version in ('1.0', '1.1'): return _LINE_PREFIX_PRE_1_2.sub('\n', value) else: return _LINE_PREFIX_1_2.sub('\n', value) def __getattr__(self, name): if name in _ATTR2FIELD: return self[name] raise AttributeError(name) # # Public API # # dependencies = property(_get_dependencies, _set_dependencies) def get_fullname(self, filesafe=False): """Return the distribution name with version. If filesafe is true, return a filename-escaped form.""" return _get_name_and_version(self['Name'], self['Version'], filesafe) def is_field(self, name): """return True if name is a valid metadata key""" name = self._convert_name(name) return name in _ALL_FIELDS def is_multi_field(self, name): name = self._convert_name(name) return name in _LISTFIELDS def read(self, filepath): """Read the metadata values from a file path.""" fp = codecs.open(filepath, 'r', encoding='utf-8') try: self.read_file(fp) finally: fp.close() def read_file(self, fileob): """Read the metadata values from a file object.""" msg = message_from_file(fileob) self._fields['Metadata-Version'] = msg['metadata-version'] # When reading, get all the fields we can for field in _ALL_FIELDS: if field not in msg: continue if field in _LISTFIELDS: # we can have multiple lines values = msg.get_all(field) if field in _LISTTUPLEFIELDS and values is not None: values = [tuple(value.split(',')) for value in values] self.set(field, values) else: # single line value = msg[field] if value is not None and value != 'UNKNOWN': self.set(field, value) logger.debug('Attempting to set metadata for %s', self) self.set_metadata_version() def write(self, filepath, skip_unknown=False): """Write the metadata fields to filepath.""" fp = codecs.open(filepath, 'w', encoding='utf-8') try: self.write_file(fp, skip_unknown) finally: fp.close() def write_file(self, fileobject, skip_unknown=False): """Write the PKG-INFO format data to a file object.""" self.set_metadata_version() for field in _version2fieldlist(self['Metadata-Version']): values = self.get(field) if skip_unknown and values in ('UNKNOWN', [], ['UNKNOWN']): continue if field in _ELEMENTSFIELD: self._write_field(fileobject, field, ','.join(values)) continue if field not in _LISTFIELDS: if field == 'Description': if self.metadata_version in ('1.0', '1.1'): values = values.replace('\n', '\n ') else: values = values.replace('\n', '\n |') values = [values] if field in _LISTTUPLEFIELDS: values = [','.join(value) for value in values] for value in values: self._write_field(fileobject, field, value) def update(self, other=None, **kwargs): """Set metadata values from the given iterable `other` and kwargs. Behavior is like `dict.update`: If `other` has a ``keys`` method, they are looped over and ``self[key]`` is assigned ``other[key]``. Else, ``other`` is an iterable of ``(key, value)`` iterables. Keys that don't match a metadata field or that have an empty value are dropped. """ def _set(key, value): if key in _ATTR2FIELD and value: self.set(self._convert_name(key), value) if not other: # other is None or empty container pass elif hasattr(other, 'keys'): for k in list(other.keys()): _set(k, other[k]) else: for k, v in other: _set(k, v) if kwargs: for k, v in list(kwargs.items()): _set(k, v) def set(self, name, value): """Control then set a metadata field.""" name = self._convert_name(name) if ((name in _ELEMENTSFIELD or name == 'Platform') and not isinstance(value, (list, tuple))): if isinstance(value, string_types): value = [v.strip() for v in value.split(',')] else: value = [] elif (name in _LISTFIELDS and not isinstance(value, (list, tuple))): if isinstance(value, string_types): value = [value] else: value = [] if logger.isEnabledFor(logging.WARNING): project_name = self['Name'] scheme = get_scheme(self.scheme) if name in _PREDICATE_FIELDS and value is not None: for v in value: # check that the values are valid if not scheme.is_valid_matcher(v.split(';')[0]): logger.warning( "'%s': '%s' is not valid (field '%s')", project_name, v, name) # FIXME this rejects UNKNOWN, is that right? elif name in _VERSIONS_FIELDS and value is not None: if not scheme.is_valid_constraint_list(value): logger.warning("'%s': '%s' is not a valid version (field '%s')", project_name, value, name) elif name in _VERSION_FIELDS and value is not None: if not scheme.is_valid_version(value): logger.warning("'%s': '%s' is not a valid version (field '%s')", project_name, value, name) if name in _UNICODEFIELDS: if name == 'Description': value = self._remove_line_prefix(value) self._fields[name] = value def get(self, name, default=_MISSING): """Get a metadata field.""" name = self._convert_name(name) if name not in self._fields: if default is _MISSING: default = self._default_value(name) return default if name in _UNICODEFIELDS: value = self._fields[name] return value elif name in _LISTFIELDS: value = self._fields[name] if value is None: return [] res = [] for val in value: if name not in _LISTTUPLEFIELDS: res.append(val) else: # That's for Project-URL res.append((val[0], val[1])) return res elif name in _ELEMENTSFIELD: value = self._fields[name] if isinstance(value, string_types): return value.split(',') return self._fields[name] def check(self, strict=False): """Check if the metadata is compliant. If strict is True then raise if no Name or Version are provided""" self.set_metadata_version() # XXX should check the versions (if the file was loaded) missing, warnings = [], [] for attr in ('Name', 'Version'): # required by PEP 345 if attr not in self: missing.append(attr) if strict and missing != []: msg = 'missing required metadata: %s' % ', '.join(missing) raise MetadataMissingError(msg) for attr in ('Home-page', 'Author'): if attr not in self: missing.append(attr) # checking metadata 1.2 (XXX needs to check 1.1, 1.0) if self['Metadata-Version'] != '1.2': return missing, warnings scheme = get_scheme(self.scheme) def are_valid_constraints(value): for v in value: if not scheme.is_valid_matcher(v.split(';')[0]): return False return True for fields, controller in ((_PREDICATE_FIELDS, are_valid_constraints), (_VERSIONS_FIELDS, scheme.is_valid_constraint_list), (_VERSION_FIELDS, scheme.is_valid_version)): for field in fields: value = self.get(field, None) if value is not None and not controller(value): warnings.append("Wrong value for '%s': %s" % (field, value)) return missing, warnings def todict(self, skip_missing=False): """Return fields as a dict. Field names will be converted to use the underscore-lowercase style instead of hyphen-mixed case (i.e. home_page instead of Home-page). """ self.set_metadata_version() mapping_1_0 = ( ('metadata_version', 'Metadata-Version'), ('name', 'Name'), ('version', 'Version'), ('summary', 'Summary'), ('home_page', 'Home-page'), ('author', 'Author'), ('author_email', 'Author-email'), ('license', 'License'), ('description', 'Description'), ('keywords', 'Keywords'), ('platform', 'Platform'), ('classifiers', 'Classifier'), ('download_url', 'Download-URL'), ) data = {} for key, field_name in mapping_1_0: if not skip_missing or field_name in self._fields: data[key] = self[field_name] if self['Metadata-Version'] == '1.2': mapping_1_2 = ( ('requires_dist', 'Requires-Dist'), ('requires_python', 'Requires-Python'), ('requires_external', 'Requires-External'), ('provides_dist', 'Provides-Dist'), ('obsoletes_dist', 'Obsoletes-Dist'), ('project_url', 'Project-URL'), ('maintainer', 'Maintainer'), ('maintainer_email', 'Maintainer-email'), ) for key, field_name in mapping_1_2: if not skip_missing or field_name in self._fields: if key != 'project_url': data[key] = self[field_name] else: data[key] = [','.join(u) for u in self[field_name]] elif self['Metadata-Version'] == '1.1': mapping_1_1 = ( ('provides', 'Provides'), ('requires', 'Requires'), ('obsoletes', 'Obsoletes'), ) for key, field_name in mapping_1_1: if not skip_missing or field_name in self._fields: data[key] = self[field_name] return data def add_requirements(self, requirements): if self['Metadata-Version'] == '1.1': # we can't have 1.1 metadata *and* Setuptools requires for field in ('Obsoletes', 'Requires', 'Provides'): if field in self: del self[field] self['Requires-Dist'] += requirements # Mapping API # TODO could add iter* variants def keys(self): return list(_version2fieldlist(self['Metadata-Version'])) def __iter__(self): for key in list(self.keys()): yield key def values(self): return [self[key] for key in list(self.keys())] def items(self): return [(key, self[key]) for key in list(self.keys())] def __repr__(self): return '<%s %s %s>' % (self.__class__.__name__, self.name, self.version) METADATA_FILENAME = 'pydist.json' WHEEL_METADATA_FILENAME = 'metadata.json' class Metadata(object): """ The metadata of a release. This implementation uses 2.0 (JSON) metadata where possible. If not possible, it wraps a LegacyMetadata instance which handles the key-value metadata format. """ METADATA_VERSION_MATCHER = re.compile(r'^\d+(\.\d+)*$') NAME_MATCHER = re.compile('^[0-9A-Z]([0-9A-Z_.-]*[0-9A-Z])?$', re.I) VERSION_MATCHER = PEP440_VERSION_RE SUMMARY_MATCHER = re.compile('.{1,2047}') METADATA_VERSION = '2.0' GENERATOR = 'distlib (%s)' % __version__ MANDATORY_KEYS = { 'name': (), 'version': (), 'summary': ('legacy',), } INDEX_KEYS = ('name version license summary description author ' 'author_email keywords platform home_page classifiers ' 'download_url') DEPENDENCY_KEYS = ('extras run_requires test_requires build_requires ' 'dev_requires provides meta_requires obsoleted_by ' 'supports_environments') SYNTAX_VALIDATORS = { 'metadata_version': (METADATA_VERSION_MATCHER, ()), 'name': (NAME_MATCHER, ('legacy',)), 'version': (VERSION_MATCHER, ('legacy',)), 'summary': (SUMMARY_MATCHER, ('legacy',)), } __slots__ = ('_legacy', '_data', 'scheme') def __init__(self, path=None, fileobj=None, mapping=None, scheme='default'): if [path, fileobj, mapping].count(None) < 2: raise TypeError('path, fileobj and mapping are exclusive') self._legacy = None self._data = None self.scheme = scheme #import pdb; pdb.set_trace() if mapping is not None: try: self._validate_mapping(mapping, scheme) self._data = mapping except MetadataUnrecognizedVersionError: self._legacy = LegacyMetadata(mapping=mapping, scheme=scheme) self.validate() else: data = None if path: with open(path, 'rb') as f: data = f.read() elif fileobj: data = fileobj.read() if data is None: # Initialised with no args - to be added self._data = { 'metadata_version': self.METADATA_VERSION, 'generator': self.GENERATOR, } else: if not isinstance(data, text_type): data = data.decode('utf-8') try: self._data = json.loads(data) self._validate_mapping(self._data, scheme) except ValueError: # Note: MetadataUnrecognizedVersionError does not # inherit from ValueError (it's a DistlibException, # which should not inherit from ValueError). # The ValueError comes from the json.load - if that # succeeds and we get a validation error, we want # that to propagate self._legacy = LegacyMetadata(fileobj=StringIO(data), scheme=scheme) self.validate() common_keys = set(('name', 'version', 'license', 'keywords', 'summary')) none_list = (None, list) none_dict = (None, dict) mapped_keys = { 'run_requires': ('Requires-Dist', list), 'build_requires': ('Setup-Requires-Dist', list), 'dev_requires': none_list, 'test_requires': none_list, 'meta_requires': none_list, 'extras': ('Provides-Extra', list), 'modules': none_list, 'namespaces': none_list, 'exports': none_dict, 'commands': none_dict, 'classifiers': ('Classifier', list), 'source_url': ('Download-URL', None), 'metadata_version': ('Metadata-Version', None), } del none_list, none_dict def __getattribute__(self, key): common = object.__getattribute__(self, 'common_keys') mapped = object.__getattribute__(self, 'mapped_keys') if key in mapped: lk, maker = mapped[key] if self._legacy: if lk is None: result = None if maker is None else maker() else: result = self._legacy.get(lk) else: value = None if maker is None else maker() if key not in ('commands', 'exports', 'modules', 'namespaces', 'classifiers'): result = self._data.get(key, value) else: # special cases for PEP 459 sentinel = object() result = sentinel d = self._data.get('extensions') if d: if key == 'commands': result = d.get('python.commands', value) elif key == 'classifiers': d = d.get('python.details') if d: result = d.get(key, value) else: d = d.get('python.exports') if not d: d = self._data.get('python.exports') if d: result = d.get(key, value) if result is sentinel: result = value elif key not in common: result = object.__getattribute__(self, key) elif self._legacy: result = self._legacy.get(key) else: result = self._data.get(key) return result def _validate_value(self, key, value, scheme=None): if key in self.SYNTAX_VALIDATORS: pattern, exclusions = self.SYNTAX_VALIDATORS[key] if (scheme or self.scheme) not in exclusions: m = pattern.match(value) if not m: raise MetadataInvalidError("'%s' is an invalid value for " "the '%s' property" % (value, key)) def __setattr__(self, key, value): self._validate_value(key, value) common = object.__getattribute__(self, 'common_keys') mapped = object.__getattribute__(self, 'mapped_keys') if key in mapped: lk, _ = mapped[key] if self._legacy: if lk is None: raise NotImplementedError self._legacy[lk] = value elif key not in ('commands', 'exports', 'modules', 'namespaces', 'classifiers'): self._data[key] = value else: # special cases for PEP 459 d = self._data.setdefault('extensions', {}) if key == 'commands': d['python.commands'] = value elif key == 'classifiers': d = d.setdefault('python.details', {}) d[key] = value else: d = d.setdefault('python.exports', {}) d[key] = value elif key not in common: object.__setattr__(self, key, value) else: if key == 'keywords': if isinstance(value, string_types): value = value.strip() if value: value = value.split() else: value = [] if self._legacy: self._legacy[key] = value else: self._data[key] = value @property def name_and_version(self): return _get_name_and_version(self.name, self.version, True) @property def provides(self): if self._legacy: result = self._legacy['Provides-Dist'] else: result = self._data.setdefault('provides', []) s = '%s (%s)' % (self.name, self.version) if s not in result: result.append(s) return result @provides.setter def provides(self, value): if self._legacy: self._legacy['Provides-Dist'] = value else: self._data['provides'] = value def get_requirements(self, reqts, extras=None, env=None): """ Base method to get dependencies, given a set of extras to satisfy and an optional environment context. :param reqts: A list of sometimes-wanted dependencies, perhaps dependent on extras and environment. :param extras: A list of optional components being requested. :param env: An optional environment for marker evaluation. """ if self._legacy: result = reqts else: result = [] extras = get_extras(extras or [], self.extras) for d in reqts: if 'extra' not in d and 'environment' not in d: # unconditional include = True else: if 'extra' not in d: # Not extra-dependent - only environment-dependent include = True else: include = d.get('extra') in extras if include: # Not excluded because of extras, check environment marker = d.get('environment') if marker: include = interpret(marker, env) if include: result.extend(d['requires']) for key in ('build', 'dev', 'test'): e = ':%s:' % key if e in extras: extras.remove(e) # A recursive call, but it should terminate since 'test' # has been removed from the extras reqts = self._data.get('%s_requires' % key, []) result.extend(self.get_requirements(reqts, extras=extras, env=env)) return result @property def dictionary(self): if self._legacy: return self._from_legacy() return self._data @property def dependencies(self): if self._legacy: raise NotImplementedError else: return extract_by_key(self._data, self.DEPENDENCY_KEYS) @dependencies.setter def dependencies(self, value): if self._legacy: raise NotImplementedError else: self._data.update(value) def _validate_mapping(self, mapping, scheme): if mapping.get('metadata_version') != self.METADATA_VERSION: raise MetadataUnrecognizedVersionError() missing = [] for key, exclusions in list(self.MANDATORY_KEYS.items()): if key not in mapping: if scheme not in exclusions: missing.append(key) if missing: msg = 'Missing metadata items: %s' % ', '.join(missing) raise MetadataMissingError(msg) for k, v in list(mapping.items()): self._validate_value(k, v, scheme) def validate(self): if self._legacy: missing, warnings = self._legacy.check(True) if missing or warnings: logger.warning('Metadata: missing: %s, warnings: %s', missing, warnings) else: self._validate_mapping(self._data, self.scheme) def todict(self): if self._legacy: return self._legacy.todict(True) else: result = extract_by_key(self._data, self.INDEX_KEYS) return result def _from_legacy(self): assert self._legacy and not self._data result = { 'metadata_version': self.METADATA_VERSION, 'generator': self.GENERATOR, } lmd = self._legacy.todict(True) # skip missing ones for k in ('name', 'version', 'license', 'summary', 'description', 'classifier'): if k in lmd: if k == 'classifier': nk = 'classifiers' else: nk = k result[nk] = lmd[k] kw = lmd.get('Keywords', []) if kw == ['']: kw = [] result['keywords'] = kw keys = (('requires_dist', 'run_requires'), ('setup_requires_dist', 'build_requires')) for ok, nk in keys: if ok in lmd and lmd[ok]: result[nk] = [{'requires': lmd[ok]}] result['provides'] = self.provides author = {} maintainer = {} return result LEGACY_MAPPING = { 'name': 'Name', 'version': 'Version', 'license': 'License', 'summary': 'Summary', 'description': 'Description', 'classifiers': 'Classifier', } def _to_legacy(self): def process_entries(entries): reqts = set() for e in entries: extra = e.get('extra') env = e.get('environment') rlist = e['requires'] for r in rlist: if not env and not extra: reqts.add(r) else: marker = '' if extra: marker = 'extra == "%s"' % extra if env: if marker: marker = '(%s) and %s' % (env, marker) else: marker = env reqts.add(';'.join((r, marker))) return reqts assert self._data and not self._legacy result = LegacyMetadata() nmd = self._data for nk, ok in list(self.LEGACY_MAPPING.items()): if nk in nmd: result[ok] = nmd[nk] r1 = process_entries(self.run_requires + self.meta_requires) r2 = process_entries(self.build_requires + self.dev_requires) if self.extras: result['Provides-Extra'] = sorted(self.extras) result['Requires-Dist'] = sorted(r1) result['Setup-Requires-Dist'] = sorted(r2) # TODO: other fields such as contacts return result def write(self, path=None, fileobj=None, legacy=False, skip_unknown=True): if [path, fileobj].count(None) != 1: raise ValueError('Exactly one of path and fileobj is needed') self.validate() if legacy: if self._legacy: legacy_md = self._legacy else: legacy_md = self._to_legacy() if path: legacy_md.write(path, skip_unknown=skip_unknown) else: legacy_md.write_file(fileobj, skip_unknown=skip_unknown) else: if self._legacy: d = self._from_legacy() else: d = self._data if fileobj: json.dump(d, fileobj, ensure_ascii=True, indent=2, sort_keys=True) else: with codecs.open(path, 'w', 'utf-8') as f: json.dump(d, f, ensure_ascii=True, indent=2, sort_keys=True) def add_requirements(self, requirements): if self._legacy: self._legacy.add_requirements(requirements) else: run_requires = self._data.setdefault('run_requires', []) always = None for entry in run_requires: if 'environment' not in entry and 'extra' not in entry: always = entry break if always is None: always = { 'requires': requirements } run_requires.insert(0, always) else: rset = set(always['requires']) | set(requirements) always['requires'] = sorted(rset) def __repr__(self): name = self.name or '(no name)' version = self.version or 'no version' return '<%s %s %s (%s)>' % (self.__class__.__name__, self.metadata_version, name, version)
6ca259815af0d360b758e2b3500b632cac6ef117
301a6d0e527c0740faa9d07f3e75ef719c51f858
/gantcal/cal/migrations/0006_auto_20160210_1233.py
e1243e4b17e588761e3b64e02d5c4d74b5ef563c
[]
no_license
akmiller01/gantcal
249eafa2de1d261ba7e54d59a8275e980caaf408
da99526f3a353bcc83fb2900044a4c8e8db0e6b5
refs/heads/master
2021-01-17T15:24:23.206363
2017-02-22T14:21:04
2017-02-22T14:21:04
51,007,120
0
0
null
null
null
null
UTF-8
Python
false
false
956
py
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-02-10 12:33 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('cal', '0005_auto_20160208_2037'), ] operations = [ migrations.AddField( model_name='event', name='attendee', field=models.ManyToManyField(blank=True, related_name='events', related_query_name='event', to=settings.AUTH_USER_MODEL), ), migrations.AddField( model_name='event', name='estimated_cost', field=models.IntegerField(blank=True, null=True), ), migrations.AddField( model_name='event', name='purpose', field=models.TextField(blank=True, null=True), ), ]
a8b262d5222cd6bfb53827635cddb4926379e537
a93cb5d670ab3b11f75f1afbd925fea2fac3aa92
/backend/maze_game_19808/settings.py
edb194014f1bab70390523539427a56c2ea70179
[]
no_license
crowdbotics-apps/maze-game-19808
156f1d011f8da29906ebde97688885207a1ce0b7
4abba9ca9b5adbb9a6c16005beae1c7946963182
refs/heads/master
2022-12-05T16:41:49.030137
2020-08-27T00:27:17
2020-08-27T00:27:17
290,634,346
0
0
null
null
null
null
UTF-8
Python
false
false
5,901
py
""" Django settings for maze_game_19808 project. Generated by 'django-admin startproject' using Django 2.2.2. For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.2/ref/settings/ """ import os import environ env = environ.Env() # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env.bool("DEBUG", default=False) # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = env.str("SECRET_KEY") ALLOWED_HOSTS = env.list("HOST", default=["*"]) SITE_ID = 1 SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") SECURE_SSL_REDIRECT = env.bool("SECURE_REDIRECT", default=False) # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites' ] LOCAL_APPS = [ 'home', 'users.apps.UsersConfig', ] THIRD_PARTY_APPS = [ 'rest_framework', 'rest_framework.authtoken', 'rest_auth', 'rest_auth.registration', 'bootstrap4', 'allauth', 'allauth.account', 'allauth.socialaccount', 'allauth.socialaccount.providers.google', 'django_extensions', 'drf_yasg', # start fcm_django push notifications 'fcm_django', # end fcm_django push notifications ] INSTALLED_APPS += LOCAL_APPS + THIRD_PARTY_APPS MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'maze_game_19808.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'maze_game_19808.wsgi.application' # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } if env.str("DATABASE_URL", default=None): DATABASES = { 'default': env.db() } # Password validation # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/2.2/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.2/howto/static-files/ STATIC_URL = '/static/' MIDDLEWARE += ['whitenoise.middleware.WhiteNoiseMiddleware'] AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', 'allauth.account.auth_backends.AuthenticationBackend' ) STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static') ] STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' # allauth / users ACCOUNT_EMAIL_REQUIRED = True ACCOUNT_AUTHENTICATION_METHOD = 'email' ACCOUNT_USERNAME_REQUIRED = False ACCOUNT_EMAIL_VERIFICATION = "mandatory" ACCOUNT_CONFIRM_EMAIL_ON_GET = True ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = True ACCOUNT_UNIQUE_EMAIL = True LOGIN_REDIRECT_URL = "users:redirect" ACCOUNT_ADAPTER = "users.adapters.AccountAdapter" SOCIALACCOUNT_ADAPTER = "users.adapters.SocialAccountAdapter" ACCOUNT_ALLOW_REGISTRATION = env.bool("ACCOUNT_ALLOW_REGISTRATION", True) SOCIALACCOUNT_ALLOW_REGISTRATION = env.bool("SOCIALACCOUNT_ALLOW_REGISTRATION", True) REST_AUTH_SERIALIZERS = { # Replace password reset serializer to fix 500 error "PASSWORD_RESET_SERIALIZER": "home.api.v1.serializers.PasswordSerializer", } REST_AUTH_REGISTER_SERIALIZERS = { # Use custom serializer that has no username and matches web signup "REGISTER_SERIALIZER": "home.api.v1.serializers.SignupSerializer", } # Custom user model AUTH_USER_MODEL = "users.User" EMAIL_HOST = env.str("EMAIL_HOST", "smtp.sendgrid.net") EMAIL_HOST_USER = env.str("SENDGRID_USERNAME", "") EMAIL_HOST_PASSWORD = env.str("SENDGRID_PASSWORD", "") EMAIL_PORT = 587 EMAIL_USE_TLS = True # start fcm_django push notifications FCM_DJANGO_SETTINGS = { "FCM_SERVER_KEY": env.str("FCM_SERVER_KEY", "") } # end fcm_django push notifications # Swagger settings for api docs SWAGGER_SETTINGS = { "DEFAULT_INFO": f"{ROOT_URLCONF}.api_info", } if DEBUG: # output email to console instead of sending EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
24450b29d23b2b7f0f99a3b2bb2811bd670bf89a
babc3e26d66a8084c9f84a0431338bafabae6ffd
/TaeJuneJoung/ACM/brute_force/p1182.부분수열의 합.py
57966b23796f176632ebfe67ed031fd3ce6133ab
[]
no_license
hoteldelluna/AlgoStudy
5c23a1bfb07dbfbabc5bedd541d61784d58d3edc
49ec098cecf2b775727d5648161f773e5488089b
refs/heads/dev
2022-10-09T14:29:00.580834
2020-01-25T14:40:55
2020-01-25T14:40:55
201,632,052
5
0
null
2020-01-25T14:40:57
2019-08-10T13:11:41
Python
UTF-8
Python
false
false
407
py
""" [완전탐색:Brute-force Search] 집합의 모든 원소의 집합을 꺼내서 합한 후, 해당 값과 같은지 비교하여 같으면 cnt++ """ N, R = map(int, input().split()) arr = list(map(int, input().split())) cnt = 0 for i in range(1, 1 << N): sum_num = 0 for j in range(N): if i & 1 << j != 0: sum_num += arr[j] if sum_num == R: cnt += 1 print(cnt)
fceb973003007ef5405eb8febf5ac8a41ce33ad7
b8cc6d34ad44bf5c28fcca9e0df01d9ebe0ee339
/requests模块/5.5、高级用法-异常处理.py
42990463ecb480ba842a6fdf377487716d805e8c
[]
no_license
python-yc/pycharm_script
ae0e72898ef44a9de47e7548170a030c0a752eb5
c8947849090c71e131df5dc32173ebe9754df951
refs/heads/master
2023-01-05T06:16:33.857668
2020-10-31T08:09:53
2020-10-31T08:09:53
296,778,670
0
0
null
null
null
null
UTF-8
Python
false
false
387
py
# -*- coding: utf-8 -*- #异常处理 import requests from requests.exceptions import * #可以查看requests.exceptions获取异常类型 try: r = requests.get('http://www.baidu.com', timeout=0.001) except ReadTimeout: print('=======:') except ConnectionError: # 网络不通 print('------') except Timeout: print('aaaaaa') except RequestException: print('Error')
[ "15655982512.com" ]
15655982512.com
7a4e323cd0bfbc8996619f0391c5f023deeeeaa8
6c866622c26e36da473d411d8f61252da12ecf4c
/demo/mongodb/runserver.py
dc77eacbd1d8ad03bc3c1518ca54d2e2fa08562e
[]
no_license
mrpadan/resource
d3d5e018ae927871af8f463293ccb762eab3aaa9
fe9cdfc7553c7748c3eb2b7e50ce1dc6167b9e8d
refs/heads/master
2021-01-20T17:33:35.828883
2014-10-13T15:02:25
2014-10-13T15:19:33
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,736
py
#!/usr/bin/env python # -*- coding: utf-8 -*- from datetime import datetime from jsonform import JsonForm from pymongo import MongoClient from flask import Flask from resource import Resource, Filter from resource.index import Index from resource.db.mongo import Collection, MongoSerializer from resource.contrib.framework.flask import add_resource, make_index DB = MongoClient().test class UserForm(JsonForm): def validate_datetime(value): if not isinstance(value, datetime): return 'value must be an instance of `datetime`' schema = { 'type': 'object', 'properties': { 'name': {'type': 'string'}, 'password': {'type': 'string'}, 'date_joined': {'custom': validate_datetime} } } class UserFilter(Filter): def query_date_range(self, query_params): date_joined_gt = query_params.pop('date_joined_gt', None) date_joined_lt = query_params.pop('date_joined_lt', None) conditions = {} if date_joined_gt: conditions.update({'$gt': date_joined_gt}) if date_joined_lt: conditions.update({'$lt': date_joined_lt}) if conditions: return {'date_joined': conditions} else: return {} resources = [ Resource('users', Collection, form_cls=UserForm, serializer_cls=MongoSerializer, filter_cls=UserFilter, kwargs={'db': DB, 'table_name': 'user'}) ] app = Flask(__name__) if __name__ == '__main__': for r in resources: add_resource(app, r) index = Resource('index', Index, uri='/', kwargs={'resources': resources}) make_index(app, index) app.run(debug=True)
f3ef463a068a6d88ed0913e877237474d96845e8
0f887bc316d8c665899258406b67f6e25838f9cf
/kangaroo.py
18362f5f21c7f43b649fe0f2a3dec1f8224f2523
[]
no_license
bawejakunal/hackerrank
f38489be488f76e782b7f8e8c5fdc2ba1a024c30
999008a19c3196c9706a9165923f5683ea887127
refs/heads/master
2021-01-12T04:31:50.984640
2017-09-08T02:28:44
2017-09-08T02:28:44
77,662,863
1
0
null
null
null
null
UTF-8
Python
false
false
631
py
#!/bin/python """ https://www.hackerrank.com/challenges/kangaroo x1 + v1.n = x2 + v2.n n = float(x2 - x1)/(v1 - v2) if n > 0 and whole integer then possible because the kangaroo starting at lesser position will be able to catch up AND land at exactly same position as the kangaroo with a head start """ import sys x1, v1, x2, v2 = raw_input().strip().split(' ') x1, v1, x2 ,v2 = [int(x1),int(v1),int(x2),int(v2)] #avoid division by zero if v1 == v2: print 'NO' else: n = float(x2 - x1)/(v1 - v2) # given x1 < x2, so n can not be 0 if n > 0 and n.is_integer(): print 'YES' else: print 'NO'
1cf467b58fc95dc223aba6b2fc94d92dce2949cd
fa3bf02fdcd6dfa48de8b9345c0131ac61abe0ab
/alphastarmini/core/arch/spatial_encoder.py
7f235287a5f1b98cbaf021d49e8a010734380604
[ "Apache-2.0" ]
permissive
jkchromy/mini-AlphaStar
d56423e2e86cb69ea100518e3d16f59eb6851c5e
9c9f7a4cc53a969da9d53d7dd46122178d83085e
refs/heads/main
2023-09-05T20:54:27.279230
2021-11-15T02:06:23
2021-11-15T02:06:23
null
0
0
null
null
null
null
UTF-8
Python
false
false
14,155
py
#!/usr/bin/env python # -*- coding: utf-8 -*- " Spatial Encoder." import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from alphastarmini.core.arch.entity_encoder import EntityEncoder from alphastarmini.core.arch.entity_encoder import Entity from alphastarmini.lib import utils as L from alphastarmini.lib.hyper_parameters import Arch_Hyper_Parameters as AHP from alphastarmini.lib.hyper_parameters import MiniStar_Arch_Hyper_Parameters as MAHP __author__ = "Ruo-Ze Liu" debug = False class SpatialEncoder(nn.Module): ''' Inputs: map, entity_embeddings Outputs: embedded_spatial - A 1D tensor of the embedded map map_skip - Tensors of the outputs of intermediate computations ''' def __init__(self, n_resblocks=4, original_32=AHP.original_32, original_64=AHP.original_64, original_128=AHP.original_128, original_256=AHP.original_256, original_512=AHP.original_512): super().__init__() self.project_inplanes = AHP.map_channels # + AHP.scatter_channels self.project = nn.Conv2d(self.project_inplanes, original_32, kernel_size=1, stride=1, padding=0, bias=True) # ds means downsampling self.ds_1 = nn.Conv2d(original_32, original_64, kernel_size=4, stride=2, padding=1, bias=True) self.ds_2 = nn.Conv2d(original_64, original_128, kernel_size=4, stride=2, padding=1, bias=True) self.ds_3 = nn.Conv2d(original_128, original_128, kernel_size=4, stride=2, padding=1, bias=True) self.resblock_stack = nn.ModuleList([ ResBlock(inplanes=original_128, planes=original_128, stride=1, downsample=None) for _ in range(n_resblocks)]) if AHP == MAHP: # note: in mAS, we replace 128x128 to 64x64, and the result 16x16 also to 8x8 self.fc = nn.Linear(8 * 8 * original_128, original_256) else: self.fc = nn.Linear(16 * 16 * original_128, original_256) # position-wise self.conv1 = nn.Conv1d(original_256, original_32, kernel_size=1, stride=1, padding=0, bias=False) self.map_width = AHP.minimap_size @classmethod def preprocess(cls, obs): map_data = cls.get_map_data(obs) return map_data def scatter(self, entity_embeddings, entity_x_y): # `entity_embeddings` are embedded through a size 32 1D convolution, followed by a ReLU, print("entity_embeddings.shape:", entity_embeddings.shape) if debug else None reduced_entity_embeddings = F.relu(self.conv1(entity_embeddings.transpose(1, 2))).transpose(1, 2) print("reduced_entity_embeddings.shape:", reduced_entity_embeddings.shape) if debug else None # then scattered into a map layer so that the size 32 vector at a specific # location corresponds to the units placed there. def bits2value(bits): # change from the bits to dec values. l = len(bits) v = 0 g = 1 for i in range(l - 1, -1, -1): v += bits[i] * g g *= 2 return v # shape [batch_size x entity_size x embedding_size] batch_size = reduced_entity_embeddings.shape[0] entity_size = reduced_entity_embeddings.shape[1] device = next(self.parameters()).device scatter_map = torch.zeros(batch_size, AHP.original_32, self.map_width, self.map_width, device=device) print("scatter_map.shape:", scatter_map.shape) if debug else None for i in range(batch_size): for j in range(entity_size): # can not be masked entity if entity_x_y[i, j, 0] != -1e9: x = entity_x_y[i, j, :8] y = entity_x_y[i, j, 8:] x = bits2value(x) y = bits2value(y) print('x', x) if debug else None print('y', y) if debug else None # note, we reduce 128 to 64, so the x and y should also be # 128 is half of 256, 64 is half of 128, so we divide by 4 x = int(x / 4) y = int(y / 4) scatter_map[i, :, y, x] += reduced_entity_embeddings[i, j, :] #print("scatter_map:", scatter_map[0, :, 23, 19]) if 1 else None return scatter_map def forward(self, x, entity_embeddings=None, entity_x_y=None): # # scatter_map may cause a NaN bug in SL training, now we don't use it if entity_embeddings is not None and entity_x_y is not None: scatter_map = self.scatter(entity_embeddings, entity_x_y) x = torch.cat([scatter_map, x], dim=1) # After preprocessing, the planes are concatenated, projected to 32 channels # by a 2D convolution with kernel size 1, passed through a ReLU x = F.relu(self.project(x)) # then downsampled from 128x128 to 16x16 through 3 2D convolutions and ReLUs # with channel size 64, 128, and 128 respectively. # The kernel size for those 3 downsampling convolutions is 4, and the stride is 2. # note: in mAS, we replace 128x128 to 64x64, and the result 16x16 also to 8x8 # note: here we should add a relu after each conv2d x = F.relu(self.ds_1(x)) x = F.relu(self.ds_2(x)) x = F.relu(self.ds_3(x)) # 4 ResBlocks with 128 channels and kernel size 3 and applied to the downsampled map, # with the skip connections placed into `map_skip`. map_skip = x for resblock in self.resblock_stack: x = resblock(x) # note if we add the follow line, it will output "can not comput gradient error" # map_skip += x # so we try to change to the follow line, which will not make a in-place operation map_skip = map_skip + x x = x.reshape(x.shape[0], -1) # The ResBlock output is embedded into a 1D tensor of size 256 by a linear layer # and a ReLU, which becomes `embedded_spatial`. x = self.fc(x) embedded_spatial = F.relu(x) return map_skip, embedded_spatial @classmethod def get_map_data(cls, obs, map_width=AHP.minimap_size, verbose=False): ''' TODO: camera: One-hot with maximum 2 of whether a location is within the camera, this refers to mimimap TODO: scattered_entities: 32 float values from entity embeddings default map_width is 128 ''' if "feature_minimap" in obs: feature_minimap = obs["feature_minimap"] else: feature_minimap = obs save_type = np.float32 # A: height_map: Float of (height_map / 255.0) height_map = np.expand_dims(feature_minimap["height_map"].reshape(-1, map_width, map_width) / 255.0, -1).astype(save_type) print('height_map:', height_map) if verbose else None print('height_map.shape:', height_map.shape) if verbose else None # A: visibility: One-hot with maximum 4 visibility = L.np_one_hot(feature_minimap["visibility_map"].reshape(-1, map_width, map_width), 4).astype(save_type) print('visibility:', visibility) if verbose else None print('visibility.shape:', visibility.shape) if verbose else None # A: creep: One-hot with maximum 2 creep = L.np_one_hot(feature_minimap["creep"].reshape(-1, map_width, map_width), 2).astype(save_type) print('creep:', creep) if verbose else None # A: entity_owners: One-hot with maximum 5 entity_owners = L.np_one_hot(feature_minimap["player_relative"].reshape(-1, map_width, map_width), 5).astype(save_type) print('entity_owners:', entity_owners) if verbose else None # the bottom 3 maps are missed in pysc1.2 and pysc2.0 # however, the 3 maps can be found on s2clientprotocol/spatial.proto # actually, the 3 maps can be found on pysc3.0 # A: alerts: One-hot with maximum 2 alerts = L.np_one_hot(feature_minimap["alerts"].reshape(-1, map_width, map_width), 2).astype(save_type) print('alerts:', alerts) if verbose else None # A: pathable: One-hot with maximum 2 pathable = L.np_one_hot(feature_minimap["pathable"].reshape(-1, map_width, map_width), 2).astype(save_type) print('pathable:', pathable) if verbose else None # A: buildable: One-hot with maximum 2 buildable = L.np_one_hot(feature_minimap["buildable"].reshape(-1, map_width, map_width), 2).astype(save_type) print('buildable:', buildable) if verbose else None out_channels = 1 + 4 + 2 + 5 + 2 + 2 + 2 map_data = np.concatenate([height_map, visibility, creep, entity_owners, alerts, pathable, buildable], axis=3) map_data = np.transpose(map_data, [0, 3, 1, 2]) print('map_data.shape:', map_data.shape) if verbose else None map_data = torch.tensor(map_data) print('torch map_data.shape:', map_data.shape) if verbose else None return map_data class ResBlock(nn.Module): def __init__(self, inplanes=128, planes=128, stride=1, downsample=None): super(ResBlock, self).__init__() self.conv1 = nn.Conv2d(inplanes, planes, kernel_size=3, stride=stride, padding=1, bias=False) self.bn1 = nn.BatchNorm2d(planes) self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, stride=stride, padding=1, bias=False) self.bn2 = nn.BatchNorm2d(planes) self.relu = nn.ReLU() self.downsample = downsample def forward(self, x): identity = x out = self.conv1(x) out = self.bn1(out) out = self.relu(out) out = self.conv2(out) out = self.bn2(out) if self.downsample is not None: identity = self.downsample(x) out = out + identity out = self.relu(out) return out class GatedResBlock(nn.Module): def __init__(self, inplanes=128, planes=128, stride=1, downsample=None): super(ResBlock, self).__init__() self.sigmoid = nn.Sigmoid() self.conv1 = nn.Conv2d(inplanes, planes, kernel_size=3, stride=stride, padding=1, bias=False) self.conv1_mask = nn.Conv2d(inplanes, planes, kernel_size=3, stride=stride, padding=1, bias=False) self.bn1 = nn.BatchNorm2d(planes) self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, stride=stride, padding=1, bias=False) self.conv2_mask = nn.Conv2d(inplanes, planes, kernel_size=3, stride=stride, padding=1, bias=False) self.bn2 = nn.BatchNorm2d(planes) def forward(self, x): residual = x x = F.relu(self.bn1(self.conv1(x) * self.sigmoid(self.conv1_mask(x)))) x = self.bn2(self.conv2(x) * self.sigmoid(self.conv2_mask(x))) x += residual x = F.relu(x) return x class ResBlockImproved(nn.Module): def __init__(self, inplanes=128, planes=128, stride=1, downsample=None): super(ResBlockImproved, self).__init__() self.conv1 = nn.Conv2d(inplanes, planes, kernel_size=3, stride=stride, padding=1, bias=False) self.bn1 = nn.BatchNorm2d(planes) self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, stride=stride, padding=1, bias=False) self.bn2 = nn.BatchNorm2d(planes) '''From paper Identity Mappings in Deep Residual Networks''' def forward(self, x): residual = x x = F.relu(self.bn1(x)) x = self.conv1(x) x = F.relu(self.bn2(x)) x = self.conv2(x) x = x + residual return x class ResBlock1D(nn.Module): def __init__(self, inplanes, planes, seq_len, stride=1, downsample=None): super(ResBlock1D, self).__init__() self.conv1 = nn.Conv1d(inplanes, planes, kernel_size=3, stride=stride, padding=1, bias=False) self.ln1 = nn.LayerNorm([planes, seq_len]) self.conv2 = nn.Conv1d(planes, planes, kernel_size=3, stride=stride, padding=1, bias=False) self.ln2 = nn.LayerNorm([planes, seq_len]) def forward(self, x): residual = x x = F.relu(self.ln1(x)) x = self.conv1(x) x = F.relu(self.ln2(x)) x = self.conv2(x) x = x + residual return x def test(): spatial_encoder = SpatialEncoder() batch_size = 2 # dummy map list map_list = [] map_data_1 = torch.zeros(batch_size, 1, AHP.minimap_size, AHP.minimap_size) map_data_1_one_hot = L.to_one_hot(map_data_1, 2) print('map_data_1_one_hot.shape:', map_data_1_one_hot.shape) if debug else None map_list.append(map_data_1) map_data_2 = torch.zeros(batch_size, 17, AHP.minimap_size, AHP.minimap_size) map_list.append(map_data_2) map_data = torch.cat(map_list, dim=1) map_skip, embedded_spatial = spatial_encoder.forward(map_data) print('map_skip:', map_skip) if debug else None print('embedded_spatial:', embedded_spatial) if debug else None print('map_skip.shape:', map_skip.shape) if debug else None print('embedded_spatial.shape:', embedded_spatial.shape) if debug else None if debug: print("This is a test!") if __name__ == '__main__': test()
8d665a2fac160226625f5ff47170916d67a561a7
494c191e87ae52470b9eb5d38d4851db168ed7cc
/system_design/designing_twitter_search.py
04d1bfbcb67768989e277cd8f694365b364a79b3
[]
no_license
Jeetendranani/yaamnotes
db67e5df1e2818cf6761ab56cf2778cf1860f75e
1f859fb1d26ffeccdb847abebb0f77e9842d2ca9
refs/heads/master
2020-03-19T01:12:45.826232
2018-05-30T20:14:11
2018-05-30T20:14:11
null
0
0
null
null
null
null
UTF-8
Python
false
false
10,921
py
""" Design twitter search Twitter is one of the largest social networking service where users can share photos, news, and text-based messages. In this chapter, we will design an service that can store and search user tweets. Similar Problems: Tweet search. Difficulty Level: Medium 1. What is twitter search? Twitter user can update their status whenever they like. Each status consists of plain text, and our goal is to design a system that allows searching over all the user statues. 2. Requirements and goals of the system - let's assume twitter has 1.5 billion total user with 800 million daily active users. - On the average twitter gets 400 million status updates every day. - Average size of a status is 300 bytes. - Let's assume there will be 500M searches every day. - The search query will consist of multiple words combined with AND/OR. We need to design a system that can efficiently store and query user status. 3. Capacity Estimation and Constraints Storage capacity: Since we have 400 million new statuses every day and each status on average is 300 bytes, therefore total storage we need, will be: 400M * 300 => 112GB/day Total storage per second: 112GB/86400 sec ~= 1.3MB/second 4. System APIs We can have soap or rest apis to expose functionality of our service; following could be teh definition of search API: search(api_dev_key, search_terms, maximum_results_to_return, sort, page_token) parameters: api_dev_key(string): the api developer key of a registered account. this will be used to, among other things, throttle users based on their allocated quota. search_terms(string): a string containing the search terms. maximum_results_to_return(number): number of status message to return. sort(number): optional sort mode: latest first (0 - default), best matched (1), most liked (2). page_token(string): this token will specify a page in the result set that should be returned. returns: (json) A json containing information about a list of status messages matching the search query, each result entry can have the user id & name, status text, status id, creation time, number of likes, etc. 5. High level design At the high level, we need to store all the status in a database, and also build an index that can keep track of which word appears in which status. This index will help us quickly find statuses that suers are trying to search. index server todo 6. Detailed components design 1. Storage: We need to store 112GB of new data every day. Given this huge amount of data, we need to come up with a data partitioning scheme that will be efficiently distributing it onto multiple servers. If we plan for next five years, we will need following storage: 112GB * 365 days * 5 => 200 TB if we never want to be more than 80% full, we would need 240TB. Let's assume that we want to keep an extra copy of all teh statues for fault tolerance, then our total storage requirement will be 480TB. If we assume a modern server can store up to 4TB of data, then we would need 120 such servers to hold all of the required data for next five years. Let's start with a simplistic design where we store our statuses in a mysql database. We can assume to store our statuses in a table having two columns, statusids are system-wide unique, we can define a hash function that can map a statusid to a storage server, where we can store that status object. how can we create system wide unique statusids? If we are getting 400m new statuses each day, then how many status objects we can expect in five years? 400M * 365 days * 5 years => 730 billion This means we would need a five bytes number to identify statusids uniquely. let's assueme we have a service that can generate a unique statusid whenever we need to store an object (we will discuss this in detail later). We can feed the statusid to our hash function to find the storage server and store our status object there. 2. index: what should our index look like? Since our status queries will consist of words, therefore, let's build our index that can tell us which word comes in which status object. Let's first estimate how big our index will be. If we want to build an index for all the english words and some famous nouns like people names, city names, etc. and if we assume that we have around 300k english words and 200k nouns, then we wil hav 500k total words in our index. let's assume that the average length of a word is five characters. If we are keeping our index in memory, we would need 2.5 BM of memory to store all the words: 500k * 5 => 2.5MB Let's assume that we want to keep the index in memory for all the statues objects for only past two years. Since we will be getting 730B status objects in 5 years, this will give us 292B status messages in two years. Given that, each statusid will be 5 bytes, how much memory will we need to store all teh statusids? 292B * 5 => 1460 GB So our index would be like a big distributed hash table, where 'key' would be the word, and 'value' will be a list of status_ids of all those status objects which contains that word. Assuming on teh average we have 40 words in each status and since we will not be indexing prepositions and other small words like 'the', 'an', 'and' etc., let's assume we will have around 15 words in each status that need to be indexed. This means each statusId will stored 15 times in our index. So total memory will need to store our index: (1460 * 15) + 2.5MB ~= 21 TB Assuming a high-end server has 144GB of memory, we would need 152 such servers to hold our index. We can shard our data based on two criteria: sharding based on words: While building our index, we will iterate through all the words of a status and calculate the hash of each word to find the server where it would be indexed. To find all statuses containing a specific word we ahve to query only that server which contains this word. we have a couple of issues with this approach: 1. What if a word becomes hot? There would be a lot of queries on the server holding that word. This high load will affect the performance of our server. 2. Over time some words can end up storing a lot of statusid compared to others, therefore, maintaining a uniform distribution of words while statues are growing is quite difficult. To recover from this situations either we have to repartition our data with use consistent hashing. Sharding based on the status on the status object: while string, we will pass the statusid to our hash function to find the server and index all the words of teh status on that server. While querying for a particular word, we have to query all teh servers, and each server will return a set of statusids. A centralized server will aggregate these results to return them to the user. 7. Fault tolerance Wht will happen when an index server dies? We can have a secondary replica of each server, and if the primary server dies it can take control after the failover. Both primary and secondary servers will have the same copy of the index. What if both primary and secondary server die at the same time? We have to allocate a new server and rebuild the same index on it. How can we do that? We dont' know what word / statues were kept on this server. if we were using 'Sharding based on teh status objects', the brute-foce solution would be to iterate through the whole database and filter statusids using our hash function to figure out all the required status that will be stored on this server. This would be inefficient and also during the time when the server is being rebuilt we will not be able to serve any query from it. thus missing some statuses that should have been seen by the user. How can we efficiently retrieve a mapping between statuses and index server? We have to build a reverse index that will map all the statusid to there index server. our index-builder server can hold this information. We will need to build a hash table, where the 'key' would be the index server number and the value would be a hashset containing all the statusids being kept at that index server. notice that we are keeping all the statusids in a hashset, this will enable us to add /remove statuses from our index quickly, so now whenever an index server has to rebuild itself, it can simply ask the index-builder server for all the statues it needs to store, and then fetch those statuses to build the index. This approach will surely be quite fast. We should also have a replica of index-builder server for fault tolerance. 8. Cache To deal with hot status objects, we can introduce a cache in front of our database. We can use memcache, which can store all such hot status objects in memory. Application servers before hitting backend database can quickly check if the cache has that status object. Based on clients usage pattern we can adjust how many cache servers we need. For cache eviction policy, Least Recently Used (LRU) seems suitable for our system. 9. Load Balancing We can add load balancing layer at two places in our system: 1. Between Clients and applications server 2. Between application server and backend server Initially, a simple round robin approach can be adopted; that distributes incoming requests equally among backend servers. This LB is simple to implement and does not introduce any overhead. Another benefit of this approach is if server is dead, LB will take it out of the rotation and will stop sending any traffic to it. A problem with Round Robin LB is, it wont' take server laod into consideration. If a server is overloaded or slow, the LB will not stop sending new requests to that server. To handle this, a more intelligent LB solution can be placed that periodically queries backend server about their load and adjust traffic based on that. 10. Ranking How about if we want to rank the search results by social graph distance, popularity, relevance, etc? Let's assue we want to rank statuses on popularity, like, how many likes or comments a status is getting, etc. In such a case our ranking algorithm can calculate a 'popularity number' (based on teh number of likes etc), and store it with the index. Each partition can sort the results based on this popularity number before returning results to the aggregator server. The aggregator server combines all these results, sort them based on the popularity number and sends the top results to the user. """
302dc8251d11ce221c0e3dafc58c003f18e54076
88a856c080080dfd15c6c50e81a82ae4f230b65a
/tests/selenium.py
3b31f912fb83b134f4b47383aa4226e9edd67bb3
[]
no_license
ephremworkeye/nov_ecommerce
682c0776bf86f8656ee968ee13cb95deb73f4a7a
f847bfd1f0fff29f321113d200f7c653ae4c7214
refs/heads/master
2023-09-04T01:32:32.191459
2021-10-28T08:17:02
2021-10-28T08:17:02
null
0
0
null
null
null
null
UTF-8
Python
false
false
367
py
import pytest from selenium import webdriver from selenium.webdriver.chrome.options import Options @pytest.fixture(scope="module") def chrome_browser_instance(request): """ provide a selenium webdriver instance """ options = Options() options.headless = False browser = webdriver.Chrome(options=options) yield browser browser.close()
28fdc6ab07daa339e7c05ac8e9fdcee819a5441a
05109979de89fbd5f69d6cc85ac794497dc441d1
/apps/destination/adminx.py
c00a4a4636d2b3fc21bcc9fbe9a56db2b356ce7d
[]
no_license
bbright3493/douxing
c70bdb11d3f0e253d8545ab4bdf89d330b0e0d6f
0607aee7c59aa4845d6bc86940d7885cd83466a6
refs/heads/master
2021-05-06T10:11:22.815128
2017-12-15T09:40:34
2017-12-15T09:40:34
114,102,089
0
0
null
null
null
null
UTF-8
Python
false
false
2,041
py
# -*- coding: utf-8 -*- __author__ = 'bb' __date__ = '2017/12/15 23:34' import xadmin from .models import * from xadmin import views class GlobalSettings(object): site_title="都行后台管理系统" site_footer="都行" menu_style="accordion" xadmin.site.register(views.CommAdminView, GlobalSettings) class DestinationAdmin(object): list_display = ['name', 'publish_user', 'desc', 'lat', 'lng', 'custom', 'festival', 'religion', 'address','publish_time'] search_fields = ['name', 'publish_user', 'desc', 'lat', 'lng', 'custom', 'festival', 'religion', 'address','publish_time'] list_filter = ['name', 'publish_user', 'desc', 'lat', 'lng', 'custom', 'festival', 'religion', 'address','publish_time'] xadmin.site.register(Destination, DestinationAdmin) class TagInfoAdmin(object): list_display = ['name', 'type', 'desc', 'second_tag'] search_fields = ['name', 'type', 'desc', 'second_tag'] list_filter = ['name', 'type', 'desc', 'second_tag'] xadmin.site.register(TagInfo, TagInfoAdmin) class SecondTagInfoAdmin(object): list_display = ['name', 'type', 'desc', 'third_tag'] search_fields = ['name', 'type', 'desc', 'third_tag'] list_filter = ['name', 'type', 'desc', 'third_tag'] xadmin.site.register(SecondTagInfo, SecondTagInfoAdmin) class ThirdTagInfoAdmin(object): list_display = ['name', 'type', 'desc'] search_fields = ['name', 'type', 'desc'] list_filter = ['name', 'type', 'desc'] xadmin.site.register(ThirdTagInfo, ThirdTagInfoAdmin) class TagDestinationAdmin(object): list_display = ['tag', 'destination', 'add_time'] search_fields = ['tag', 'destination'] list_filter = ['tag', 'destination'] xadmin.site.register(TagDestination, TagDestinationAdmin) class DestinationImageAdmin(object): list_display = ['image', 'destination', 'add_id'] search_fields = ['image', 'destination', 'add_id'] list_filter = ['image', 'destination', 'add_id'] model_icon = 'fa fa-film' xadmin.site.register(ImageInfo, DestinationImageAdmin)
0814cd6f81ee06c0ee5732b9574cd914859e16c9
4610d0284416361643095ca9c3f404ad82ca63c2
/src/sploitego/metasploit/utils.py
1f796affd48ec6853417a13b33a928b7f53ed032
[]
no_license
mshelton/sploitego
165a32874d955621c857552fb9692ecf79e77b7e
3944451a110f851a626459767d114569d80a158c
refs/heads/master
2020-12-25T03:11:58.071280
2012-08-16T22:33:10
2012-08-16T22:33:10
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,100
py
#!/usr/bin/env python from optparse import OptionParser __author__ = 'Nadeem Douba' __copyright__ = 'Copyright 2012, Sploitego Project' __credits__ = ['Nadeem Douba'] __license__ = 'GPL' __version__ = '0.1' __maintainer__ = 'Nadeem Douba' __email__ = '[email protected]' __status__ = 'Development' __all__ = [ 'parseargs' ] def parseargs(): p = OptionParser() p.add_option("-P", dest="password", help="Specify the password to access msfrpcd", metavar="opt") p.add_option("-S", dest="ssl", help="Disable SSL on the RPC socket", action="store_false", default=True) p.add_option("-U", dest="username", help="Specify the username to access msfrpcd", metavar="opt", default="msf") p.add_option("-a", dest="server", help="Connect to this IP address", metavar="host", default="127.0.0.1") p.add_option("-p", dest="port", help="Connect to the specified port instead of 55553", metavar="opt", default=55553) o, a = p.parse_args() if o.password is None: print '[-] Error: a password must be specified (-P)\n' p.print_help() exit(-1) return o
5f4e5af81bbc911e9ebdba871a0cb2867f9c8915
07c75f8717683b9c84864c446a460681150fb6a9
/1.Django_cursor/days05_总结/mysite/mytemp/urls.py
a5dd5fde3d50dc66c0aebff2c502336f406cf684
[]
no_license
laomu/py_1709
987d9307d9025001bd4386381899eb3778f9ccd6
80630e6ac3ed348a2a6445e90754bb6198cfe65a
refs/heads/master
2021-05-11T09:56:45.382526
2018-01-19T07:08:00
2018-01-19T07:08:00
118,088,974
0
0
null
null
null
null
UTF-8
Python
false
false
117
py
from django.conf.urls import url from . import views urlpatterns = [ url(r'^.*$', views.index, name="index"), ]
ac77fbc3989b6f85e192007025647230f9038e70
f3b233e5053e28fa95c549017bd75a30456eb50c
/ptp1b_input/L77/77-bs_wat_20Abox/set_1ns_equi.py
55249588767ba5d4a982ae8d8e78310b01454d53
[]
no_license
AnguseZhang/Input_TI
ddf2ed40ff1c0aa24eea3275b83d4d405b50b820
50ada0833890be9e261c967d00948f998313cb60
refs/heads/master
2021-05-25T15:02:38.858785
2020-02-18T16:57:04
2020-02-18T16:57:04
null
0
0
null
null
null
null
UTF-8
Python
false
false
916
py
import os dir = '/mnt/scratch/songlin3/run/ptp1b/L77/wat_20Abox/ti_one-step/77_bs/' filesdir = dir + 'files/' temp_equiin = filesdir + 'temp_equi.in' temp_pbs = filesdir + 'temp_1ns_equi.pbs' lambd = [ 0.00922, 0.04794, 0.11505, 0.20634, 0.31608, 0.43738, 0.56262, 0.68392, 0.79366, 0.88495, 0.95206, 0.99078] for j in lambd: os.system("rm -r %6.5f" %(j)) os.system("mkdir %6.5f" %(j)) os.chdir("%6.5f" %(j)) os.system("rm *") workdir = dir + "%6.5f" %(j) + '/' #equiin eqin = workdir + "%6.5f_equi.in" %(j) os.system("cp %s %s" %(temp_equiin, eqin)) os.system("sed -i 's/XXX/%6.5f/g' %s" %(j, eqin)) #PBS pbs = workdir + "%6.5f_1ns_equi.pbs" %(j) os.system("cp %s %s" %(temp_pbs, pbs)) os.system("sed -i 's/XXX/%6.5f/g' %s" %(j, pbs)) #top os.system("cp ../77-bs_merged.prmtop .") os.system("cp ../0.5_equi_0.rst .") #submit pbs os.system("qsub %s" %(pbs)) os.chdir(dir)
28c70b3e1130f8b502b3c9c2c40227b8a0097822
155bf47fa1b33a31576f6b8b90aaa74cd41e352a
/04PythonScraping/chap07提升爬虫的速度/demo08-mutilprocess3.py
16dc3b5e6f88d6f3427e90b4e4c02db36751cbe7
[]
no_license
ares5221/Python-Crawler-Projects
af4ec40a26f4f69ef285a0edf0428192a594d4cd
45b496000631f0f3b887501d9d67f3e24f5e6186
refs/heads/master
2021-07-03T07:11:25.474055
2020-09-08T08:17:17
2020-09-08T08:17:17
145,980,513
3
1
null
null
null
null
UTF-8
Python
false
false
1,105
py
from multiprocessing import Pool, Manager import time import requests link_list = [] with open('alexa.txt', 'r') as file: file_list = file.readlines() for eachone in file_list: link = eachone.split('\t')[1] link = link.replace('\n','') link_list.append(link) start = time.time() def crawler(q, index): Process_id = 'Process-' + str(index) while not q.empty(): url = q.get(timeout=2) try: r = requests.get(url, timeout=20) print (Process_id, q.qsize(), r.status_code, url) except Exception as e: print (Process_id, q.qsize(), url, 'Error: ', e) if __name__ == '__main__': manager = Manager() workQueue = manager.Queue(1000) # 填充队列 for url in link_list: workQueue.put(url) pool = Pool(processes=3) for i in range(4): pool.apply(crawler, args=(workQueue, i)) print ("Started processes") pool.close() pool.join() end = time.time() print ('Pool + Queue多进程爬虫的总时间为:', end-start) print ('Main process Ended!')
6f8cd243866fffe00749263f072c8cf6efdb7d38
d62f1c0bd9c35cd8ae681d7465e749d63bb59d4e
/Week1/Informatics/Cycles/While/E.py
eeb7f7f63613891fe718d408bf44c2de1f7951e6
[]
no_license
Yeldan/BFDjango
0134a57ec523b08e4ca139ec11c384eeefec6caa
a390e08b8711613040a972e30a25b4035ff58e37
refs/heads/master
2020-03-27T15:49:53.859506
2018-11-25T22:33:38
2018-11-25T22:33:38
146,742,341
0
0
null
null
null
null
UTF-8
Python
false
false
87
py
n = int(input()) pow2 = 1 k = 0 while pow2 < n: pow2 *= 2 k += 1 print(k)
aada138df4c56627acf62eaa60266b52a077bae2
de24f83a5e3768a2638ebcf13cbe717e75740168
/moodledata/vpl_data/429/usersdata/321/107494/submittedfiles/jogoDaVelha_BIB.py
ae59cd865960f39bb8cd8d243bc082c289f59efd
[]
no_license
rafaelperazzo/programacao-web
95643423a35c44613b0f64bed05bd34780fe2436
170dd5440afb9ee68a973f3de13a99aa4c735d79
refs/heads/master
2021-01-12T14:06:25.773146
2017-12-22T16:05:45
2017-12-22T16:05:45
69,566,344
0
0
null
null
null
null
UTF-8
Python
false
false
7,715
py
# -*- coding: utf-8 -*- # COLOQUE SUA BIBLIOTECA A PARTIR DAQUI import random tabuleiro = [ [' ',' ',' '], [' ',' ',' '], [' ',' ',' ']] def nome(): nome = str(input('Qual seu nome? \n')) return nome def solicitaSimboloDoHumano(): s = str(input('Qual símbolo você deseja utilizar no jogo? (X ou O) \n')) while s != 'X' and s != 'O': print('Insira um símbolo válido.') s = str(input('Qual símbolo você deseja utilizar no jogo? (X ou O) ')) return s def sorteioPrimeiraJogada(nome): j1 = nome j2 = 'Computador' sort = random.randint(0,1) if sort == 1: print ('Vencedor do sorteio para início do jogo: %s' % j1) if sort == 0: print ('Vencedor do sorteio para início do jogo: %s' % j2) return sort def JogadaHumana(nome,b): while True: c= int(input('Qual a sua jogada, %s? ' % nome)) x = c // 10 y = c % 10 if validaJogada(nome,tabuleiro,x,y,b): tabuleiro[x][y]= ' '+b+' ' return True #else: #return False def jogadaComputador(computador): while True: linha= random.randint(0,2) coluna= random.randint(0,2) if tabuleiro[linha][coluna]==' ': tabuleiro[linha][coluna] = computador mostraTabuleiro() return True def mostrarTabuleiro() : print(' ') print(tabuleiro[0][0]+'|'+tabuleiro[0][1]+'|'+tabuleiro[0][2]) print(' ') print(tabuleiro[1][0]+'|'+tabuleiro[1][1]+'|'+tabuleiro[1][2]) print(' ') print(tabuleiro[2][0]+'|'+tabuleiro[2][1]+'|'+tabuleiro[2][2]) print(' ') def validaJogada(nome,tabuleiro,l,c,s) : jogadapossivel = False if not tabuleiro[l][c]==' ': if nome!='': print('OPS!!! Essa jogada não está disponível. Tente novamente!') return False else: return True ''' def verificaVencedor(s,tabuleiro,nome): if (tabuleiro[0][0] == tabuleiro[0][1] == tabuleiro[0][2] == s or tabuleiro[1][0] == tabuleiro[1][1] == tabuleiro[1][2] == s or tabuleiro[2][0] == tabuleiro[2][1] == tabuleiro[2][2] == s or tabuleiro[0][0] == tabuleiro[1][0] == tabuleiro[2][0] == s or tabuleiro[0][1] == tabuleiro[1][1] == tabuleiro[2][1] == s or tabuleiro[0][2] == tabuleiro[1][2] == tabuleiro[2][2] == s or tabuleiro[0][0] == tabuleiro[1][1] == tabuleiro[2][2] == s or tabuleiro[0][2] == tabuleiro[1][1] == tabuleiro[2][0] == s ): w= tabuleiro [0][0] if w==s: print('Vencedor: %s' %nome) return True else: print('Vencedor: Computador') return True else: cont=0 for i in range(0,len(tabuleiro)): for j in range(0,len(tabuleiro)): if tabuleiro[i][j]!=' ': cont += 1 if cont==9: print ('Deu Velha') return True else: return False ''' def verificaVencedor(s,tabuleiro,nome): if (tabuleiro[0][0] == tabuleiro[0][1] == tabuleiro[0][2]) and tabuleiro[0][0]!=' ' : w= tabuleiro[0][0] if w==s: print('Vencedor: %s' %nome) return True else: print('Vencedor: Computador') return True elif (tabuleiro[1][0] == tabuleiro[1][1] == tabuleiro[1][2]) and tabuleiro[1][0]!=' ' : w= tabuleiro[1][0] if w==s: print('Vencedor: %s' %nome) return True else: print('Vencedor: Computador') return True elif (tabuleiro[2][0] == tabuleiro[2][1] == tabuleiro[2][2]) and tabuleiro[2][0]!=' ' : w= tabuleiro[2][0] if w==s: print('Vencedor: %s' %nome) return True else: print('Vencedor: Computador') return True elif (tabuleiro[0][0] == tabuleiro[1][0] == tabuleiro[2][0]) and tabuleiro[0][0]!=' ' : w= tabuleiro[0][0] if w==s: print('Vencedor: %s' %nome) return True else: print('Vencedor: Computador') return True elif (tabuleiro[0][1] == tabuleiro[1][1] == tabuleiro[2][1]) and tabuleiro[0][1]!=' ' : w= tabuleiro[0][1] if w==s: print('Vencedor: %s' %nome) return True else: print('Vencedor: Computador') return True elif (tabuleiro[0][2] == tabuleiro[1][2] == tabuleiro[2][2]) and tabuleiro[0][2]!=' ' : w= tabuleiro[0][2] if w==s: print('Vencedor: %s' %nome) return True else: print('Vencedor: Computador') return True elif (tabuleiro[0][0] == tabuleiro[1][1] == tabuleiro[2][2]) and tabuleiro[0][0]!=' ' : w= tabuleiro[0][0] if w==s: print('Vencedor: %s' %nome) return True else: print('Vencedor: Computador') return True elif (tabuleiro[0][2] == tabuleiro[1][1] == tabuleiro[2][0]) and tabuleiro[0][2]!=' ' : w= tabuleiro[0][2] if w==s: print('Vencedor: %s' %nome) return True else: print('Vencedor: Computador') return True else: cont=0 for i in range(0,3,1): for j in range(0,3,1): if tabuleiro[i][j]!=' ': cont += 1 if cont==9: print ('Deu Velha') return True else: return False def jogueNovamente(): print('Você quer jogar de novo? (sim ou não)') return input().lower().startswith('y') #Olhar o erro ''' def verifica(m,situacao): flag=False if (m[0][0]==m[0][1]==m[0][2]=='X'): print 'Jogador 1 ganhou' situacao=True elif (m[1][0]==m[1][1]==m[1][2]=='X'): print 'Jogador 1 ganhou' situacao=True elif (m[2][0]==m[2][1]==m[2][2]=='X'): print 'Jogador 1 ganhou' situacao=True elif (m[0][0]==m[1][0]==m[2][0]=='X'): print 'Jogador 1 ganhou' situacao=True elif (m[0][1]==m[1][1]==m[2][1]=='X'): print 'Jogador 1 ganhou' situacao=True elif (m[0][2]==m[1][2]==m[2][2]=='X'): print 'Jogador 1 ganhou' situacao=True elif (m[0][0]==m[1][1]==m[2][2]=='X'): print 'Jogador 1 ganhou' situacao=True elif (m[0][2]==m[1][1]==m[2][0]=='X'): print 'Jogador 1 ganhou' situacao=True elif (m[0][0]==m[0][1]==m[0][2]=='0'): print 'Jogador 1 ganhou' situacao=True elif (m[1][0]==m[1][1]==m[1][2]=='0'): print 'Jogador 1 ganhou' situacao=True elif (m[2][0]==m[2][1]==m[2][2]=='0'): print 'Jogador 1 ganhou' situacao=True elif (m[0][0]==m[1][0]==m[2][0]=='0'): print 'Jogador 1 ganhou' situacao=True elif (m[0][1]==m[1][1]==m[2][1]=='0'): print 'Jogador 1 ganhou' situacao=True elif (m[0][2]==m[1][2]==m[2][2]=='0'): print 'Jogador 1 ganhou' situacao=True elif (m[0][0]==m[1][1]==m[2][2]=='0'): print 'Jogador 1 ganhou' situacao=True elif (m[0][2]==m[1][1]==m[2][0]=='0'): print ('Jogador 1 ganhou') situacao=True else: for i in matriz: for j in i: if j==' ': flag=True if flag==False: print ('Deu Velha') situacao=True return situacao '''
a4a0b8f3a09ca5ad949545f6df5b75f196e58b74
7b01421591dd7f83b719be4df90b4590904263f9
/bev/__init__.py
e0e4ef5a43398ff89aae02c5b92d8f23e1efde1e
[]
no_license
samokhinv/bev
d54624566d315f3ddf4a71e584bf2c00200a11b6
c3b1bdcdbcdb7be5e65c4cc8d04a40615f4f65b1
refs/heads/master
2023-05-31T15:38:39.816757
2021-06-23T17:37:45
2021-06-23T17:37:45
null
0
0
null
null
null
null
UTF-8
Python
false
false
84
py
from .interface import Repository, UNCOMMITTED from .__version__ import __version__
bdf5c1a2838f3284de099196371fc88742604fc6
f73e0439f953f968f2021e54866a367617debff8
/blog/views.py
e4b976339b39b8067c110e831249a1e9e5319cde
[ "MIT" ]
permissive
kkampardi/DjangoTesting
d86542beae8a7cc16fc2fc2774c1c3348142345b
1092c41d9d4930f0512fac79b4d95836c70e5f3a
refs/heads/master
2020-06-16T12:13:17.240496
2017-05-09T07:26:30
2017-05-09T07:26:30
75,104,263
0
0
null
null
null
null
UTF-8
Python
false
false
235
py
from django.shortcuts import render from django.views.generic.base import TemplateView from .models import Entry class HomeView(TemplateView): template_name = 'index.html' queryset = Entry.objects.order_by('-created_at')
a8fe0988ccaba26dd6c06fdb0050af81e79fc56b
bebec878576db20eb38f7e981ab42a7dee20d431
/src/publisher.py
1ee23b019c6b41a01d5afcf236fd07f02ba0045a
[]
no_license
rorymcstay/algo
890809d03c68b3e09ee3e48b3cf71d74ac867215
499e39511b2ad495a6559790c8c7d84bdaa0a32e
refs/heads/master
2021-06-28T06:34:26.410025
2021-03-28T19:39:16
2021-03-28T19:39:16
224,317,279
0
0
null
null
null
null
UTF-8
Python
false
false
3,401
py
import csv import logging import threading from threading import Thread from multiprocessing import Process from event_config import subscribers from src.engine import ThreadPool class EventConfig: def __init__(self, dataClass, mapping, complex=False): """ The configuration class for an event to be published :param dataClass: the type of the data published :param complex: whether or not the mapping is complex TODO check the type of the result of the mapping instead :param mapping: the mapping to use. Either complex and returns the object or a tuple order mapping """ self.dataClass = dataClass self.dataClass.mapping = mapping self.dataClass = dataClass self.complex = complex class Engine: engine = None def __init__(self, connectionString): """ Base class of Engines to provide to publisher :param connectionString: A single connection string to the feed """ self.connectionString = connectionString pass def __iter__(self): pass class FileEngine: def __init__(self, connectionString): """ Stream over a file :param connectionString: path to file """ self.engine = csv.reader(open(connectionString, 'r')) def __iter__(self): """ The cursor to the data feed :return: """ for line in self.engine: logging.debug(line) yield line class Publisher(Process): def __init__(self, connectionString, engine, eventConfig): """ Publish event to all subscribers in the global subscriber :param engine: the class of engine to use :param connectionString: parameter to engine :param eventConfig: the event config object """ self.pause_cond = threading.Condition(threading.Lock()) self.engine = engine(connectionString) self.data_type = eventConfig.dataClass self.complex = eventConfig.complex self.threadPool = ThreadPool(2) self.connectionString = connectionString def notifySubscribers(self, data): """ Call back to global subscriber list :param data: :return: """ global subscribers for sub in subscribers: self.threadPool.add_task(sub.onPublishedEvent, data) self.threadPool.wait_completion() def factory(self, *fields): """ Construct events to publish :param fields: :return: """ if self.complex: return self.data_type.mapping(*fields) else: return self.data_type(*self.data_type.mapping(*fields)) def run(self) -> None: """ Run method for the publisher :return: """ logging.info(f'starting publisher {self.__class__} on {self.connectionString}') for i in self.engine: with self.pause_cond: logging.info(f'received {self.data_type.__name__} event: {i} ') self.notifySubscribers(self.factory(*i)) self.pause_cond.wait(0.1) def init(self) -> None: """ start the publisher in a new thread """ Process.__init__(self, target=self.run, args=()) self.name = self.connectionString self.start()
f300ce2eff2dcc46b9a46377c2b2bbee80217dc6
906171cc2ff7a669149d807c0e6d6db3fbea5f91
/algorithm-books/程序员面试指南/python/递归和动态规划/龙与地下城游戏问题.py
204b196a1cb2565b9aed86764b5bca945d6e2cbb
[]
no_license
Deanhz/normal_works
a2942e9eab9b51d190039b659b6924fe2fba7ae9
7ae3d5b121bb7af38e3c7e6330ce8ff78ceaadb1
refs/heads/master
2020-03-25T20:51:02.835663
2019-02-18T16:34:44
2019-02-18T16:34:44
144,149,031
0
0
null
null
null
null
UTF-8
Python
false
false
2,165
py
# -*- coding: utf-8 -*- """ Created on Tue Jun 12 20:44:57 2018 @author: Dean 本题的更新需要从下到上,从右到左 p223 """ def minHP1(m):#时间复杂度O(M*N),空间复杂度O(M*N) if not m: return 1 row = len(m) col = len(m[0]) #dp[i][j]表示如果骑士走上位置(i,j)前,从该位置能够走到右下角,最少具备的血量 dp = [[0 for j in range(col)] for i in range(row)] #初始化dp[row-1][col-1] #重要 if m[row-1][col-1] > 0: dp[row-1][col-1] = 1 else: dp[row-1][col-1] = 1 - m[row-1][col-1] #从右向左更新最后一行 for j in range(col - 1)[::-1]: #dp不能小于1,因为血量随时都不能小于1 dp[row-1][j] = max(dp[row-1][j+1] - m[row-1][j], 1) #从下到上,更新剩余行 for i in range(row-1)[::-1]: #更新每行的最右端 dp[i][col-1] = max(dp[i+1][col-1] - m[i][col-1], 1) for j in range(col-1)[::-1]: #水平方向 dp_row = max(dp[i][j+1] - m[i][j], 1) #垂直方向 dp_col = max(dp[i+1][j] - m[i][j], 1) #取最小值 dp[i][j] = min(dp_col,dp_row) return dp[0][0] def minHP2(m):#使用空间压缩,空间复杂度O(M*N) if not m: return 1 row = len(m) col = len(m[0]) dp = [0 for j in range(col)] #初始化dp[col-1] if m[row-1][col-1] > 0: dp[col-1] = 1 else: dp[col-1] = 1 - m[row-1][col-1] #更新最后一行 for j in range(col-1)[::-1]: dp[j] = max(dp[j+1] - m[row-1][j], 1) #更新剩余所有行 for i in range(row-1)[::-1]: #更新每行的最右端 dp[col-1] = max(dp[col-1] - m[i][col-1], 1) for j in range(col-1)[::-1]: #水平方向 dp_row = max(dp[j+1] - m[i][j], 1) #垂直方向 dp_col = max(dp[j] - m[i][j], 1) #取最小值 dp[j] = min(dp_row, dp_col) return dp[0] if __name__ == "__main__": m = [[-2, -3, 3],[-5, -10, 1], [0, 30, -5]] print(minHP1(m)) print(minHP2(m))
10f7ef7944bbc118a972447b591a865681e469ee
502da37d15b473edd9ac56f10871a2e74a774920
/misc/deb-package/spairo-deb-d/usr/lib/python3/dist-packages/spairo/parse/obj.py
003719aee7bc156b13109532cf1d43d4f12fab2a
[]
no_license
adhuliya/sparcv8-ajit
5cf7c8fc1e89dc97b3160c010ba9c95cd993eee6
c121c33f5b1eaabf040cf929678229a21f8283de
refs/heads/master
2022-08-22T08:20:09.423969
2022-07-24T04:10:11
2022-07-24T04:10:11
97,362,905
2
0
null
null
null
null
UTF-8
Python
false
false
1,041
py
#!/usr/bin/env python3 import re import sys extractInstruction = re.compile( r"(?P<addr>[a-fA-F0-9]+):\s*([a-fA-F0-9][a-fA-F0-9]\s){4}\s*(?P<instr>[^!]*)") labelSuffix = re.compile(r"<[.$_a-zA-Z][.$_a-zA-Z0-9]*>$") # Parse obj file def parse(filename): instr = dict() with open(filename, "r") as f: for line in f: line = line.strip() match = extractInstruction.search(line) if match: line = labelSuffix.sub("", line) match = extractInstruction.search(line) addr = int(match.group("addr"), 16) instr[addr] = match.group("instr").strip() instr = None if not instr else instr return instr def printInstr(instr): for key in sorted(instr): print("{0:4X}".format(key), ":", instr[key]) print("Total Instr:", len(instr)) if __name__ == "__main__": filename = "testfiles/test.obj.save" if len(sys.argv) == 2: filename = sys.argv[1] instr = parse(filename) printInstr(instr)
069df0b91770278c18cb69fae6abb68bfff5b37e
e76f883f7f93b2d2e735fe1c8a72ddfb146a6ffb
/tests/test_vpx.py
22da24b31ccc3eeca8fe128cd833d5932f3ec619
[ "BSD-3-Clause" ]
permissive
turbographics2000/aiortc
4da92a85b5b3b3ec3286bad46265158f04d7b373
f3275012f59312a4f7a73c932bbf52f6f69f1a1a
refs/heads/master
2021-04-03T07:07:52.485523
2018-03-07T10:49:56
2018-03-07T10:49:56
null
0
0
null
null
null
null
UTF-8
Python
false
false
5,467
py
from unittest import TestCase from aiortc.codecs import get_decoder, get_encoder from aiortc.codecs.vpx import (VpxDecoder, VpxEncoder, VpxPayloadDescriptor, _vpx_assert) from aiortc.mediastreams import VideoFrame from aiortc.rtp import Codec VP8_CODEC = Codec(kind='video', name='VP8', clockrate=90000) class VpxPayloadDescriptorTest(TestCase): def test_no_picture_id(self): descr, rest = VpxPayloadDescriptor.parse(b'\x10') self.assertEqual(descr.partition_start, 1) self.assertEqual(descr.partition_id, 0) self.assertEqual(descr.picture_id, None) self.assertEqual(descr.tl0picidx, None) self.assertEqual(descr.tid, None) self.assertEqual(descr.keyidx, None) self.assertEqual(bytes(descr), b'\x10') self.assertEqual(repr(descr), 'VpxPayloadDescriptor(S=1, PID=0, pic_id=None)') self.assertEqual(rest, b'') def test_short_picture_id_17(self): """ From RFC 7741 - 4.6.3 """ descr, rest = VpxPayloadDescriptor.parse(b'\x90\x80\x11') self.assertEqual(descr.partition_start, 1) self.assertEqual(descr.partition_id, 0) self.assertEqual(descr.picture_id, 17) self.assertEqual(descr.tl0picidx, None) self.assertEqual(descr.tid, None) self.assertEqual(descr.keyidx, None) self.assertEqual(bytes(descr), b'\x90\x80\x11') self.assertEqual(repr(descr), 'VpxPayloadDescriptor(S=1, PID=0, pic_id=17)') self.assertEqual(rest, b'') def test_short_picture_id_127(self): descr, rest = VpxPayloadDescriptor.parse(b'\x90\x80\x7f') self.assertEqual(descr.partition_start, 1) self.assertEqual(descr.partition_id, 0) self.assertEqual(descr.picture_id, 127) self.assertEqual(descr.tl0picidx, None) self.assertEqual(descr.tid, None) self.assertEqual(descr.keyidx, None) self.assertEqual(bytes(descr), b'\x90\x80\x7f') self.assertEqual(rest, b'') def test_long_picture_id_128(self): descr, rest = VpxPayloadDescriptor.parse(b'\x90\x80\x80\x80') self.assertEqual(descr.partition_start, 1) self.assertEqual(descr.partition_id, 0) self.assertEqual(descr.picture_id, 128) self.assertEqual(descr.tl0picidx, None) self.assertEqual(descr.tid, None) self.assertEqual(descr.keyidx, None) self.assertEqual(bytes(descr), b'\x90\x80\x80\x80') self.assertEqual(rest, b'') def test_long_picture_id_4711(self): """ From RFC 7741 - 4.6.5 """ descr, rest = VpxPayloadDescriptor.parse(b'\x90\x80\x92\x67') self.assertEqual(descr.partition_start, 1) self.assertEqual(descr.partition_id, 0) self.assertEqual(descr.picture_id, 4711) self.assertEqual(descr.tl0picidx, None) self.assertEqual(descr.tid, None) self.assertEqual(descr.keyidx, None) self.assertEqual(bytes(descr), b'\x90\x80\x92\x67') self.assertEqual(rest, b'') def test_tl0picidx(self): descr, rest = VpxPayloadDescriptor.parse(b'\x90\xc0\x92\x67\x81') self.assertEqual(descr.partition_start, 1) self.assertEqual(descr.partition_id, 0) self.assertEqual(descr.picture_id, 4711) self.assertEqual(descr.tl0picidx, 129) self.assertEqual(descr.tid, None) self.assertEqual(descr.keyidx, None) self.assertEqual(bytes(descr), b'\x90\xc0\x92\x67\x81') self.assertEqual(rest, b'') def test_tid(self): descr, rest = VpxPayloadDescriptor.parse(b'\x90\x20\xe0') self.assertEqual(descr.partition_start, 1) self.assertEqual(descr.partition_id, 0) self.assertEqual(descr.picture_id, None) self.assertEqual(descr.tl0picidx, None) self.assertEqual(descr.tid, (3, 1)) self.assertEqual(descr.keyidx, None) self.assertEqual(bytes(descr), b'\x90\x20\xe0') self.assertEqual(rest, b'') def test_keyidx(self): descr, rest = VpxPayloadDescriptor.parse(b'\x90\x10\x1f') self.assertEqual(descr.partition_start, 1) self.assertEqual(descr.partition_id, 0) self.assertEqual(descr.picture_id, None) self.assertEqual(descr.tl0picidx, None) self.assertEqual(descr.tid, None) self.assertEqual(descr.keyidx, 31) self.assertEqual(bytes(descr), b'\x90\x10\x1f') self.assertEqual(rest, b'') class Vp8Test(TestCase): def test_assert(self): with self.assertRaises(Exception) as cm: _vpx_assert(1) self.assertEqual(str(cm.exception), 'libvpx error: Unspecified internal error') def test_decoder(self): decoder = get_decoder(VP8_CODEC) self.assertTrue(isinstance(decoder, VpxDecoder)) def test_encoder(self): encoder = get_encoder(VP8_CODEC) self.assertTrue(isinstance(encoder, VpxEncoder)) frame = VideoFrame(width=320, height=240) payloads = encoder.encode(frame) self.assertEqual(len(payloads), 1) self.assertTrue(len(payloads[0]) < 1300) def test_encoder_large(self): encoder = get_encoder(VP8_CODEC) self.assertTrue(isinstance(encoder, VpxEncoder)) frame = VideoFrame(width=2560, height=1920) payloads = encoder.encode(frame) self.assertEqual(len(payloads), 7) self.assertEqual(len(payloads[0]), 1300)
b4d624563bfde2acc7337c773ee6135ca29b3bc1
6af81c1e3853255f064ce58e848b34211decdd23
/test/top/api/rest/SubuserDutyDeleteRequest.py
4915d8f74cdf40234090e02dd520a45fee58387f
[]
no_license
dacy413/TBAutoTool
d472445f54f0841f2cd461d48ec6181ae2182d92
ca7da4638d38dd58e38c680ee03aaccf575bce7b
refs/heads/master
2016-09-06T16:13:01.633177
2015-02-01T00:04:50
2015-02-01T00:04:50
29,625,228
0
0
null
null
null
null
UTF-8
Python
false
false
339
py
''' Created by auto_sdk on 2015-01-20 12:36:26 ''' from top.api.base import RestApi class SubuserDutyDeleteRequest(RestApi): def __init__(self,domain='gw.api.taobao.com',port=80): RestApi.__init__(self,domain, port) self.duty_id = None self.user_nick = None def getapiname(self): return 'taobao.subuser.duty.delete'
adae908424c30f9d4e86f3532d053d8c5c4642a4
10f746943f2b6399bddf1fc79e16b2eec8b1bb0b
/gateway/dummy_secrets.py
26986ea41ef76635f3cf6205f617a66f5da5ab9b
[]
no_license
edgecollective/belfast-harbor
1fa5977a46222f9178a5912ece72beb17891f5e1
5149eca44e95bf0525601249116ab23e59c15c0f
refs/heads/master
2020-09-20T14:16:00.411551
2019-11-29T13:02:49
2019-11-29T13:02:49
224,507,873
1
0
null
null
null
null
UTF-8
Python
false
false
169
py
secrets = { 'ssid' : b'Your WiFi SSID', 'password' : b'Your WiFi Password', 'farmos_pubkey' : 'farmos_pubkey', 'farmos_privkey' : 'farmos_privkey' }
22232bd5654c414b046f470cef574422936a962c
de1b2cfca42e495257a0f50bed026d42d35ecc97
/flaskr/__init__.py
60787156af6e1f0acfafab34d4efb49016cb91eb
[]
no_license
miniyk2012/miniyk2012-flask_tutorial
ad971a000b78b0267f33b40924f03154b0b84173
760d59b8c3ec534cdeb7c198d1adb61493b1bfff
refs/heads/master
2023-01-11T14:57:38.931170
2019-06-04T22:39:09
2019-06-04T22:39:09
189,253,167
0
0
null
2022-12-26T20:56:11
2019-05-29T15:34:03
Python
UTF-8
Python
false
false
1,465
py
import os from flask import ( Flask, current_app ) def create_app(test_config=None): """ create_app是默认的名称, flask run的时候会自动来运行这个函数 :param test_config: :return: """ # create and configure the app app: Flask = Flask(__name__, instance_relative_config=True) # print(app.instance_path) # /Users/thomas_young/Documents/code/flask_project/instance app.config.from_mapping( SECRET_KEY='dev', DATABASE=os.path.join(app.instance_path, 'flaskr.sqlite'), ) if test_config is None: # load the instance config, if it exists, when not testing ret = app.config.from_pyfile('config.py', silent=True) print('load the config.py ' + ('success' if ret else 'fail')) else: # load the test config if passed in app.config.from_mapping(test_config) # ensure the instance folder exists try: print('make instance_path', app.instance_path) os.makedirs(app.instance_path) except OSError as e: pass # a simple page that says hello def hello(): print(f'current app url map is {current_app.url_map}') return 'Hello, World!' app.add_url_rule('/hello', view_func=hello) from . import db db.init_app(app) from . import auth app.register_blueprint(auth.bp) from . import blog app.register_blueprint(blog.bp) app.add_url_rule('/', 'index') return app
b7405fe0659fd9354d9865949d27d48e40c6325b
c4c159a21d2f1ea0d7dfaa965aeff01c8ef70dce
/flask/flaskenv/Lib/site-packages/tensorflow/python/ops/gen_sdca_ops.py
b1922e0314101ad623bed622fb34e7b337445bdc
[]
no_license
AhsonAslam/webapi
54cf7466aac4685da1105f9fb84c686e38f92121
1b2bfa4614e7afdc57c9210b0674506ea70b20b5
refs/heads/master
2020-07-27T06:05:36.057953
2019-09-17T06:35:33
2019-09-17T06:35:33
208,895,450
0
0
null
null
null
null
UTF-8
Python
false
false
130
py
version https://git-lfs.github.com/spec/v1 oid sha256:167888a5bf0cec33f73cc87d5babc3869f495c2487658426b093ec2660b669c6 size 52962
[ "github@cuba12345" ]
github@cuba12345
8d4ca6034e19b706a0458c0d23b1c7812275cd6a
c9ddbdb5678ba6e1c5c7e64adf2802ca16df778c
/cases/synthetic/tree-big-5322.py
e6c1b10aae1c9db3342d47a6709c5908090674fb
[]
no_license
Virtlink/ccbench-chocopy
c3f7f6af6349aff6503196f727ef89f210a1eac8
c7efae43bf32696ee2b2ee781bdfe4f7730dec3f
refs/heads/main
2023-04-07T15:07:12.464038
2022-02-03T15:42:39
2022-02-03T15:42:39
451,969,776
0
0
null
null
null
null
UTF-8
Python
false
false
23,287
py
# Binary-search trees class TreeNode(object): value:int = 0 left:"TreeNode" = None right:"TreeNode" = None def insert(self:"TreeNode", x:int) -> bool: if x < self.value: if self.left is None: self.left = makeNode(x) return True else: return self.left.insert(x) elif x > self.value: if self.right is None: self.right = makeNode(x) return True else: return self.right.insert(x) return False def contains(self:"TreeNode", x:int) -> bool: if x < self.value: if self.left is None: return False else: return self.left.contains(x) elif x > self.value: if self.right is None: return False else: return self.right.contains(x) else: return True class TreeNode2(object): value:int = 0 value2:int = 0 left:"TreeNode2" = None left2:"TreeNode2" = None right:"TreeNode2" = None right2:"TreeNode2" = None def insert(self:"TreeNode2", x:int) -> bool: if x < self.value: if self.left is None: self.left = makeNode2(x, x) return True else: return self.left.insert(x) elif x > self.value: if self.right is None: self.right = makeNode2(x, x) return True else: return self.right.insert(x) return False def insert2(self:"TreeNode2", x:int, x2:int) -> bool: if x < self.value: if self.left is None: self.left = makeNode2(x, x) return True else: return self.left.insert(x) elif x > self.value: if self.right is None: self.right = makeNode2(x, x) return True else: return self.right.insert(x) return False def contains(self:"TreeNode2", x:int) -> bool: if x < self.value: if self.left is None: return False else: return self.left.contains(x) elif x > self.value: if self.right is None: return False else: return self.right.contains(x) else: return True def contains2(self:"TreeNode2", x:int, x2:int) -> bool: if x < self.value: if self.left is None: return False else: return self.left.contains(x) elif x > self.value: if self.right is None: return False else: return self.right.contains(x) else: return True class TreeNode3(object): value:int = 0 value2:int = 0 value3:int = 0 left:"TreeNode3" = None left2:"TreeNode3" = None left3:"TreeNode3" = None right:"TreeNode3" = None right2:"TreeNode3" = None right3:"TreeNode3" = None def insert(self:"TreeNode3", x:int) -> bool: if x < self.value: if self.left is None: self.left = makeNode3(x, x, x) return True else: return self.left.insert(x) elif x > self.value: if self.right is None: self.right = makeNode3(x, x, x) return True else: return self.right.insert(x) return False def insert2(self:"TreeNode3", x:int, x2:int) -> bool: if x < self.value: if self.left is None: self.left = makeNode3(x, x, x) return True else: return self.left.insert(x) elif x > self.value: if self.right is None: self.right = makeNode3(x, x, x) return True else: return self.right.insert(x) return False def insert3(self:"TreeNode3", x:int, x2:int, x3:int) -> bool: if x < self.value: if self.left is None: self.left = makeNode3(x, x, x) return True else: return self.left.insert(x) elif x > self.value: if self.right is None: self.right = makeNode3(x, x, x) return True else: return self.right.insert(x) return False def contains(self:"TreeNode3", x:int) -> bool: if x < self.value: if self.left is None: return False else: return self.left.contains(x) elif x > self.value: if self.right is None: return False else: return self.right.contains(x) else: return True def contains2(self:"TreeNode3", x:int, x2:int) -> bool: if x < self.value: if self.left is None: return False else: return self.left.contains(x) elif x > self.value: if self.right is None: return False else: return self.right.contains(x) else: return True def contains3(self:"TreeNode3", x:int, x2:int, x3:int) -> bool: if x < self.value: if self.left is None: return False else: return self.left.contains(x) elif x > self.value: if self.right is None: return False else: return self.right.contains(x) else: return True class TreeNode4(object): value:int = 0 value2:int = 0 value3:int = 0 value4:int = 0 left:"TreeNode4" = None left2:"TreeNode4" = None left3:"TreeNode4" = None left4:"TreeNode4" = None right:"TreeNode4" = None right2:"TreeNode4" = None right3:"TreeNode4" = None right4:"TreeNode4" = None def insert(self:"TreeNode4", x:int) -> bool: if x < self.value: if self.left is None: self.left = makeNode4(x, x, x, x) return True else: return self.left.insert(x) elif x > self.value: if self.right is None: self.right = makeNode4(x, x, x, x) return True else: return self.right.insert(x) return False def insert2(self:"TreeNode4", x:int, x2:int) -> bool: if x < self.value: if self.left is None: self.left = makeNode4(x, x, x, x) return True else: return self.left.insert(x) elif x > self.value: if self.right is None: self.right = makeNode4(x, x, x, x) return True else: return self.right.insert(x) return False def insert3(self:"TreeNode4", x:int, x2:int, x3:int) -> bool: if x < self.value: if self.left is None: self.left = makeNode4(x, x, x, x) return True else: return self.left.insert(x) elif x > self.value: if self.right is None: self.right = makeNode4(x, x, x, x) return True else: return self.right.insert(x) return False def insert4(self:"TreeNode4", x:int, x2:int, x3:int, x4:int) -> bool: if x < self.value: if self.left is None: self.left = makeNode4(x, x, x, x) return True else: return self.left.insert(x) elif x > self.value: if self.right is None: self.right = makeNode4(x, x, x, x) return True else: return self.right.insert(x) return False def contains(self:"TreeNode4", x:int) -> bool: if x < self.value: if self.left is None: return False else: return self.left.contains(x) elif x > self.value: if self.right is None: return False else: return self.right.contains(x) else: return True def contains2(self:"TreeNode4", x:int, x2:int) -> bool: if x < self.value: if self.left is None: return False else: return self.left.contains(x) elif x > self.value: if self.right is None: return False else: return self.right.contains(x) else: return True def contains3(self:"TreeNode4", x:int, x2:int, x3:int) -> bool: if x < self.value: if self.left is None: return False else: return self.left.contains(x) elif x > self.value: if self.right is None: return False else: return self.right.contains(x) else: return True def contains4(self:"TreeNode4", x:int, x2:int, x3:int, x4:int) -> bool: if x < self.value: if self.left is None: return False else: return self.left.contains(x) elif x > self.value: if self.right is None: return False else: return self.right.contains(x) else: return True class TreeNode5(object): value:int = 0 value2:int = 0 value3:int = 0 value4:int = 0 value5:int = 0 left:"TreeNode5" = None left2:"TreeNode5" = None left3:"TreeNode5" = None left4:"TreeNode5" = None left5:"TreeNode5" = None right:"TreeNode5" = None right2:"TreeNode5" = None right3:"TreeNode5" = None right4:"TreeNode5" = None right5:"TreeNode5" = None def insert(self:"TreeNode5", x:int) -> bool: if x < self.value: if self.left is None: self.left = makeNode5(x, x, x, x, x) return True else: return self.left.insert(x) elif x > self.value: if self.right is None: self.right = makeNode5(x, x, x, x, x) return True else: return self.right.insert(x) return False def insert2(self:"TreeNode5", x:int, x2:int) -> bool: if x < self.value: if self.left is None: self.left = makeNode5(x, x, x, x, x) return True else: return self.left.insert(x) elif x > self.value: if self.right is None: self.right = makeNode5(x, x, x, x, x) return True else: return self.right.insert(x) return False def insert3(self:"TreeNode5", x:int, x2:int, x3:int) -> bool: if x < self.value: if self.left is None: self.left = makeNode5(x, x, x, x, x) return True else: return self.left.insert(x) elif x > self.value: if self.right is None: self.right = makeNode5(x, x, x, x, x) return True else: return self.right.insert(x) return False def insert4(self:"TreeNode5", x:int, x2:int, x3:int, x4:int) -> bool: if x < self.value: if self.left is None: self.left = makeNode5(x, x, x, x, x) return True else: return self.left.insert(x) elif x > self.value: if self.right is None: self.right = makeNode5(x, x, x, x, x) return True else: return self.right.insert(x) return False def insert5(self:"TreeNode5", x:int, x2:int, x3:int, x4:int, x5:int) -> bool: if x < self.value: if self.left is None: self.left = makeNode5(x, x, x, x, x) return True else: return self.left.insert(x) elif x > self.value: if self.right is None: self.right = makeNode5(x, x, x, x, x) return True else: return self.right.insert(x) return False def contains(self:"TreeNode5", x:int) -> bool: if x < self.value: if self.left is None: return False else: return self.left.contains(x) elif x > self.value: if self.right is None: return False else: return self.right.contains(x) else: return True def contains2(self:"TreeNode5", x:int, x2:int) -> bool: if x < self.value: if self.left is None: return False else: return self.left.contains(x) elif x > self.value: if self.right is None: return False else: return self.right.contains(x) else: return True def contains3(self:"TreeNode5", x:int, x2:int, x3:int) -> bool: if x < self.value: if self.left is None: return False else: return self.left.contains(x) elif x > self.value: if self.right is None: return False else: return self.right.contains(x) else: return True def contains4(self:"TreeNode5", x:int, x2:int, x3:int, x4:int) -> bool: if x < self.value: if self.left is None: return False else: return self.left.contains(x) elif x > self.value: if self.right is None: return False else: return self.right.contains(x) else: return True def contains5(self:"TreeNode5", x:int, x2:int, x3:int, x4:int, x5:int) -> bool: if x < self.value: if self.left is None: return False else: return self.left.contains(x) elif x > self.value: if self.right is None: return False else: return self.right.contains(x) else: return True class Tree(object): root:TreeNode = None size:int = 0 def insert(self:"Tree", x:int) -> object: if self.root is None: self.root = makeNode(x) self.size = 1 else: if self.root.insert(x): self.size = self.size + 1 def contains(self:"Tree", x:int) -> bool: if self.root is None: return False else: return self.root.contains(x) class Tree2(object): root:TreeNode2 = None root2:TreeNode2 = None size:int = 0 size2:int = 0 def insert(self:"Tree2", x:int) -> object: if self.root is None: self.root = makeNode2(x, x) self.size = 1 else: if self.root.insert(x): self.size = self.size + 1 def insert2(self:"Tree2", x:int, x2:int) -> object: if self.root is None: self.root = makeNode2(x, x) self.size = 1 else: if self.root.insert(x): self.size = self.size + 1 def contains(self:"Tree2", x:int) -> bool: if self.root is None: return False else: return $Member.contains(x) def contains2(self:"Tree2", x:int, x2:int) -> bool: if self.root is None: return False else: return self.root.contains(x) class Tree3(object): root:TreeNode3 = None root2:TreeNode3 = None root3:TreeNode3 = None size:int = 0 size2:int = 0 size3:int = 0 def insert(self:"Tree3", x:int) -> object: if self.root is None: self.root = makeNode3(x, x, x) self.size = 1 else: if self.root.insert(x): self.size = self.size + 1 def insert2(self:"Tree3", x:int, x2:int) -> object: if self.root is None: self.root = makeNode3(x, x, x) self.size = 1 else: if self.root.insert(x): self.size = self.size + 1 def insert3(self:"Tree3", x:int, x2:int, x3:int) -> object: if self.root is None: self.root = makeNode3(x, x, x) self.size = 1 else: if self.root.insert(x): self.size = self.size + 1 def contains(self:"Tree3", x:int) -> bool: if self.root is None: return False else: return self.root.contains(x) def contains2(self:"Tree3", x:int, x2:int) -> bool: if self.root is None: return False else: return self.root.contains(x) def contains3(self:"Tree3", x:int, x2:int, x3:int) -> bool: if self.root is None: return False else: return self.root.contains(x) class Tree4(object): root:TreeNode4 = None root2:TreeNode4 = None root3:TreeNode4 = None root4:TreeNode4 = None size:int = 0 size2:int = 0 size3:int = 0 size4:int = 0 def insert(self:"Tree4", x:int) -> object: if self.root is None: self.root = makeNode4(x, x, x, x) self.size = 1 else: if self.root.insert(x): self.size = self.size + 1 def insert2(self:"Tree4", x:int, x2:int) -> object: if self.root is None: self.root = makeNode4(x, x, x, x) self.size = 1 else: if self.root.insert(x): self.size = self.size + 1 def insert3(self:"Tree4", x:int, x2:int, x3:int) -> object: if self.root is None: self.root = makeNode4(x, x, x, x) self.size = 1 else: if self.root.insert(x): self.size = self.size + 1 def insert4(self:"Tree4", x:int, x2:int, x3:int, x4:int) -> object: if self.root is None: self.root = makeNode4(x, x, x, x) self.size = 1 else: if self.root.insert(x): self.size = self.size + 1 def contains(self:"Tree4", x:int) -> bool: if self.root is None: return False else: return self.root.contains(x) def contains2(self:"Tree4", x:int, x2:int) -> bool: if self.root is None: return False else: return self.root.contains(x) def contains3(self:"Tree4", x:int, x2:int, x3:int) -> bool: if self.root is None: return False else: return self.root.contains(x) def contains4(self:"Tree4", x:int, x2:int, x3:int, x4:int) -> bool: if self.root is None: return False else: return self.root.contains(x) class Tree5(object): root:TreeNode5 = None root2:TreeNode5 = None root3:TreeNode5 = None root4:TreeNode5 = None root5:TreeNode5 = None size:int = 0 size2:int = 0 size3:int = 0 size4:int = 0 size5:int = 0 def insert(self:"Tree5", x:int) -> object: if self.root is None: self.root = makeNode5(x, x, x, x, x) self.size = 1 else: if self.root.insert(x): self.size = self.size + 1 def insert2(self:"Tree5", x:int, x2:int) -> object: if self.root is None: self.root = makeNode5(x, x, x, x, x) self.size = 1 else: if self.root.insert(x): self.size = self.size + 1 def insert3(self:"Tree5", x:int, x2:int, x3:int) -> object: if self.root is None: self.root = makeNode5(x, x, x, x, x) self.size = 1 else: if self.root.insert(x): self.size = self.size + 1 def insert4(self:"Tree5", x:int, x2:int, x3:int, x4:int) -> object: if self.root is None: self.root = makeNode5(x, x, x, x, x) self.size = 1 else: if self.root.insert(x): self.size = self.size + 1 def insert5(self:"Tree5", x:int, x2:int, x3:int, x4:int, x5:int) -> object: if self.root is None: self.root = makeNode5(x, x, x, x, x) self.size = 1 else: if self.root.insert(x): self.size = self.size + 1 def contains(self:"Tree5", x:int) -> bool: if self.root is None: return False else: return self.root.contains(x) def contains2(self:"Tree5", x:int, x2:int) -> bool: if self.root is None: return False else: return self.root.contains(x) def contains3(self:"Tree5", x:int, x2:int, x3:int) -> bool: if self.root is None: return False else: return self.root.contains(x) def contains4(self:"Tree5", x:int, x2:int, x3:int, x4:int) -> bool: if self.root is None: return False else: return self.root.contains(x) def contains5(self:"Tree5", x:int, x2:int, x3:int, x4:int, x5:int) -> bool: if self.root is None: return False else: return self.root.contains(x) def makeNode(x: int) -> TreeNode: b:TreeNode = None b = TreeNode() b.value = x return b def makeNode2(x: int, x2: int) -> TreeNode2: b:TreeNode2 = None b2:TreeNode2 = None b = TreeNode2() b.value = x return b def makeNode3(x: int, x2: int, x3: int) -> TreeNode3: b:TreeNode3 = None b2:TreeNode3 = None b3:TreeNode3 = None b = TreeNode3() b.value = x return b def makeNode4(x: int, x2: int, x3: int, x4: int) -> TreeNode4: b:TreeNode4 = None b2:TreeNode4 = None b3:TreeNode4 = None b4:TreeNode4 = None b = TreeNode4() b.value = x return b def makeNode5(x: int, x2: int, x3: int, x4: int, x5: int) -> TreeNode5: b:TreeNode5 = None b2:TreeNode5 = None b3:TreeNode5 = None b4:TreeNode5 = None b5:TreeNode5 = None b = TreeNode5() b.value = x return b # Input parameters n:int = 100 n2:int = 100 n3:int = 100 n4:int = 100 n5:int = 100 c:int = 4 c2:int = 4 c3:int = 4 c4:int = 4 c5:int = 4 # Data t:Tree = None t2:Tree = None t3:Tree = None t4:Tree = None t5:Tree = None i:int = 0 i2:int = 0 i3:int = 0 i4:int = 0 i5:int = 0 k:int = 37813 k2:int = 37813 k3:int = 37813 k4:int = 37813 k5:int = 37813 # Crunch t = Tree() while i < n: t.insert(k) k = (k * 37813) % 37831 if i % c != 0: t.insert(i) i = i + 1 print(t.size) for i in [4, 8, 15, 16, 23, 42]: if t.contains(i): print(i)
2d7bca278667a97eb99f961aef8b06561c6dc55a
6bf492920985e3741440ba53e1c7f8426b66ac1f
/snakemake_rules/rules/kpal/kpal_matrix.smk
e0f458d60c5838003d24e753e3360530f55ba0b6
[ "MIT" ]
permissive
ukaraoz/snakemake-rules
5b2ba7c9ec19d88b56067a46f66fd0c72e48c368
07e96afeb39307cdf35ecc8482dc1f8b62c120b9
refs/heads/master
2020-03-31T15:20:44.444006
2018-09-07T08:53:47
2018-09-07T08:53:47
null
0
0
null
null
null
null
UTF-8
Python
false
false
734
smk
# -*- snakemake -*- include: "kpal.settings.smk" config_default = {'kpal' :{'matrix' : _kpal_config_rule_default.copy()}} config_default['kpal']['matrix'].update({'options' : "-m -S"}) update_config(config_default, config) config = config_default rule kpal_matrix: """kpal: generate matrix.""" params: cmd = config['kpal']['cmd'], options = config['kpal']['matrix']['options'], runtime = config['kpal']['matrix']['runtime'] wildcard_constraints: kmer = "[0-9]+" input: kmer = "{prefix}.k{kmer}" output: res = "{prefix}.k{kmer}.mat" threads: config['kpal']['matrix']['threads'] conda: "env.yaml" shell: "{params.cmd} matrix {params.options} {input.kmer} {output.res}"
bce20665fafee5860f3d0874347ff4fa12928558
1fa6c2650c791e35feaf57b87e832613e98797dd
/LeetCode/Binary Search/! M Search in Rotated Sorted Array.py
1f36ebf53459a4ab0e059c0dfdc4cadc8b3a3ba8
[]
no_license
hz336/Algorithm
415a37313a068478225ca9dd1f6d85656630f09a
0d2d956d498742820ab39e1afe965425bfc8188f
refs/heads/master
2021-06-17T05:24:17.030402
2021-04-18T20:42:37
2021-04-18T20:42:37
194,006,383
1
0
null
null
null
null
UTF-8
Python
false
false
1,912
py
""" Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). You are given a target value to search. If found in the array return its index, otherwise return -1. You may assume no duplicate exists in the array. Your algorithm's runtime complexity must be in the order of O(log n). Example 1: Input: nums = [4,5,6,7,0,1,2], target = 0 Output: 4 Example 2: Input: nums = [4,5,6,7,0,1,2], target = 3 Output: -1 """ class Solution: def search(self, nums: 'List[int]', target: 'int') -> 'int': if nums is None or len(nums) == 0: return -1 start, end = 0, len(nums) - 1 while start + 1 < end: mid = start + (end - start) // 2 if nums[start] <= nums[mid]: if nums[start] <= target <= nums[mid]: end = mid else: start = mid else: if nums[mid] <= target <= nums[end]: start = mid else: end = mid if nums[start] == target: return start if nums[end] == target: return end return -1 """ Follow up: What if duplicates are allowed? Would this affect the run-time complexity? How and why? 这个问题在面试中不会让实现完整程序 只需要举出能够最坏情况的数据是 [1,1,1,1... 1] 里有一个0即可。 在这种情况下是无法使用二分法的,复杂度是O(n) 因此写个for循环最坏也是O(n),那就写个for循环就好了 如果你觉得,不是每个情况都是最坏情况,你想用二分法解决不是最坏情况的情况,那你就写一个二分吧。 反正面试考的不是你在这个题上会不会用二分法。这个题的考点是你想不想得到最坏情况。 """
9a28629a710d0c1e31f69b87934ebcc4916fe3e3
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p03651/s284460411.py
7a3cadd35f07b8049ff65e723cdebbfad6be1501
[]
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
184
py
import math n,k=map(int,input().split()) a=list(map(int,input().split())) c=a[0] for m in a: c=math.gcd(c,m) if k %c==0 and k<=max(a): print("POSSIBLE") else: print("IMPOSSIBLE")
02c8c0b816a3a71c169216770f654193fbcabcbc
b42879654055f320b7593358330eceb0c06ca1d8
/Hao_Test/data_base_structure/find_element.py
e69721651ac8124e0efbbb28d25c7022d69684fd
[]
no_license
HaoREN211/python-scraping
de3b28b96fb43e47700a6a12b05db6800f583611
c802748e9067e6dfd1e3736ccc20fbd34091f9e5
refs/heads/master
2020-07-18T23:09:23.380362
2019-10-22T01:50:28
2019-10-22T01:50:28
206,331,191
0
0
null
2019-09-04T13:53:26
2019-09-04T13:53:26
null
UTF-8
Python
false
false
1,384
py
# 作者:hao.ren3 # 时间:2019/10/16 18:25 # IDE:PyCharm from python_scraping.Hao_Test.tools.sql import create_mysql_engine from python_scraping.Hao_Test.data_base_structure.init_table import init_data_column_table, init_data_base_table, init_data_table_table from sqlalchemy import MetaData from sqlalchemy.orm.session import sessionmaker if __name__ == "__main__": my_engine = create_mysql_engine("hao_data_base_structure") my_meta_data = MetaData(my_engine) Session = sessionmaker(bind=my_engine) session = Session() table_data_base = init_data_base_table(mysql_meta_data=my_meta_data) table_data_table = init_data_table_table(mysql_meta_data=my_meta_data) table_data_column = init_data_column_table(mysql_meta_data=my_meta_data) test = (table_data_column.select() .join(table_data_table, table_data_column.c.data_table_id==table_data_table.c.id) .join(table_data_base, table_data_column.c.data_base_id==table_data_base.c.id)) test = (session.query(table_data_base.c.name, table_data_table.c.name, table_data_column.c.name) .join(table_data_table, table_data_column.c.data_table_id==table_data_table.c.id) .join(table_data_base, table_data_column.c.data_base_id == table_data_base.c.id).all()) for current_row in test: print(".".join(current_row)) my_engine.dispose()
8d445faa9047767aed6d3755c95e343884f082d2
1ba9e4754ee30e7f45aeb210918be489559dd281
/books/migrations/0009_auto_20180325_1412.py
bfd85093ea4ebec5ee3296a3b5ef14517f90ccd8
[]
no_license
muremwa/Django-Book-s-app
330f36c402f0af59f8e9f81d9751b283602c4b1c
af6829332b5009955d4290ea67af459d2a6b8b69
refs/heads/master
2021-04-15T08:26:13.165957
2018-04-11T22:15:59
2018-04-11T22:15:59
126,845,409
0
0
null
null
null
null
UTF-8
Python
false
false
575
py
# Generated by Django 2.0 on 2018-03-25 11:12 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('books', '0008_book_votes'), ] operations = [ migrations.AlterField( model_name='author', name='picture', field=models.FileField(default='defaulta.png', upload_to=''), ), migrations.AlterField( model_name='book', name='book_cover', field=models.FileField(default='default.png', upload_to=''), ), ]
03678610e296f6f34bf63062be58743d3ea319fa
b8dab6e1a07c4c95e0483df722a4188d44356c1e
/backend/endpoints/predict.py
1864ccb83162f82efe89e660e6a5d3f5f4036d7e
[ "Apache-2.0" ]
permissive
maelstromdat/radon-defuse
363578106ea6c63e9b2f33d648b208708a075c25
269f050a656d527712d88d39db9ae1d5642027bf
refs/heads/main
2023-05-26T05:11:10.880316
2021-05-20T09:44:21
2021-05-20T09:44:21
370,704,590
2
0
Apache-2.0
2021-05-25T13:34:38
2021-05-25T13:34:37
null
UTF-8
Python
false
false
1,115
py
import time from flask import jsonify, make_response from flask_restful import Resource, Api, reqparse class Predict(Resource): def __init__(self, **kwargs): self.db = kwargs['db'] self.bucket = kwargs['bucket'] def get(self): parser = reqparse.RequestParser() parser.add_argument('id', type=str, required=True) # Model id self.args = parser.parse_args() # parse arguments to dictionary # Create Task task_id = self.db.collection('tasks').add({ 'name': 'predict', 'repository_id': self.args.get('id'), 'status': 'progress', 'started_at': time.time() })[1].id # Predict # blob = self.bucket.blob(f'{self.args.get("id")}.joblib') # b_model = blob.download_as_bytes() # Save prediction in collection "predictions"? doc_ref = self.db.collection('tasks').document(task_id) doc_ref.update({ 'status': 'completed', 'ended_at': time.time() }) return make_response(jsonify({"failure-prone": True}), 200)
4b42318ffa82918c518ea028234c2e01d56f329f
cdaaa92f45cac92b34610616fbcab738ebaf0b6d
/project1_22759/urls.py
38ea80b67a152969b919267f41e06bcceea0bf19
[]
no_license
crowdbotics-apps/project1-22759
9317debda23f0eeb7dd8b4bc542297a7971ad016
92a80c481f5601f8d4a89fb9921e5f6144824c99
refs/heads/master
2023-01-13T11:38:02.933334
2020-11-19T04:31:04
2020-11-19T04:31:04
314,136,194
0
0
null
null
null
null
UTF-8
Python
false
false
1,919
py
"""project1_22759 URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path, include from allauth.account.views import confirm_email from rest_framework import permissions from drf_yasg.views import get_schema_view from drf_yasg import openapi urlpatterns = [ path("", include("home.urls")), path("accounts/", include("allauth.urls")), path("api/v1/", include("home.api.v1.urls")), path("admin/", admin.site.urls), path("users/", include("users.urls", namespace="users")), path("rest-auth/", include("rest_auth.urls")), # Override email confirm to use allauth's HTML view instead of rest_auth's API view path("rest-auth/registration/account-confirm-email/<str:key>/", confirm_email), path("rest-auth/registration/", include("rest_auth.registration.urls")), ] admin.site.site_header = "Project1" admin.site.site_title = "Project1 Admin Portal" admin.site.index_title = "Project1 Admin" # swagger api_info = openapi.Info( title="Project1 API", default_version="v1", description="API documentation for Project1 App", ) schema_view = get_schema_view( api_info, public=True, permission_classes=(permissions.IsAuthenticated,), ) urlpatterns += [ path("api-docs/", schema_view.with_ui("swagger", cache_timeout=0), name="api_docs") ]
dab8fddf7efb767eb07b5fd72e4b5956cb2acb34
00b7b6a30e8c851cc1f288370a49a593ee7e0172
/bfrs/migrations/0021_auto_20190508_1443.py
0a5c7528281c61467e60b81f2db616d45e428d65
[]
no_license
rockychen-dpaw/bfrs
e907fd5dbceb8af9769a964990dfaab38bc76080
f468794d1e36419f7bab718edad3f7b2939b82fa
refs/heads/master
2021-04-29T19:02:40.930093
2020-01-15T03:01:37
2020-01-15T03:01:37
121,706,290
0
0
null
2018-02-16T02:05:40
2018-02-16T02:05:40
null
UTF-8
Python
false
false
1,105
py
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2019-05-08 06:43 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('bfrs', '0020_auto_20190508_1247'), ] operations = [ migrations.AddField( model_name='cause', name='report_name', field=models.CharField(default=b'', max_length=50), ), migrations.AddField( model_name='cause', name='report_order', field=models.PositiveSmallIntegerField(default=1, verbose_name=b'order in annual report'), ), migrations.AlterField( model_name='tenure', name='report_group_order', field=models.PositiveSmallIntegerField(default=1, verbose_name=b'group order in annual report'), ), migrations.AlterField( model_name='tenure', name='report_order', field=models.PositiveSmallIntegerField(default=1, verbose_name=b'order in annual report'), ), ]
6d6bb6382252a8618c4eb6a10a181d48b1d1f898
5919508f6fa3756b89b720ca9510423847af6b78
/inputs/loop_helix_loop/get_lhl_distributions.py
ff2570fe3a5b8d20c96d739a23418c00e32f2f3a
[ "MIT" ]
permissive
karlyfear/protein_feature_analysis
0cb87ee340cb1aa5e619d684ebf8040713fee794
fa2ae8bc6eb7ecf17e8bf802ab30814461868114
refs/heads/master
2023-03-16T22:30:45.088924
2020-03-14T20:05:21
2020-03-14T20:05:21
null
0
0
null
null
null
null
UTF-8
Python
false
false
7,168
py
#!/usr/bin/env python3 '''Get distributions for LHL units. Dump the distributions of various features to text files. Usage: ./get_lhl_distributions.py pdbs_path lhl_info_path edges_file ''' import os import sys import json import numpy as np import pyrosetta from pyrosetta import rosetta def xyzV_to_np_array(xyz): return np.array([xyz.x, xyz.y, xyz.z]) def get_backbone_points(pose, residues): '''Get backbone points for residues in a pose.''' points = [] for res in residues: for atom in ['N', 'CA', 'C']: points.append(xyzV_to_np_array(pose.residue(res).xyz(atom))) return points def calc_backbone_RMSD(pose1, residues1, pose2, residues2): '''Calculate backbone RMSD between two poses for specific positions.''' assert(len(residues1) == len(residues2)) def RMSD(points1, poinsts2): '''Calcualte RMSD between two lists of numpy points.''' diff = [points1[i] - poinsts2[i] for i in range(len(points1))] return np.sqrt(sum(np.dot(d, d) for d in diff) / len(diff)) points1 = get_backbone_points(pose1, residues1) points2 = get_backbone_points(pose2, residues2) return RMSD(points1, points2) def get_helix_direction(pose, helix_start, helix_stop): '''Get the helix direction. The direction is defined as the average of the C-O vectors. ''' c_o_vectors = [pose.residue(i).xyz('O') - pose.residue(i).xyz('C') for i in range(helix_start, helix_stop + 1)] sum_vecs = c_o_vectors[0] for i in range(1, len(c_o_vectors)): sum_vecs += c_o_vectors[i] return sum_vecs.normalized() def get_lhl_lengths(lhl_infos): '''Get the distribution of LHL lengths.''' return [lhl['stop'] - lhl['start'] + 1 for lhl in lhl_infos] def get_front_loop_lengths(lhl_infos): '''Get the distribution of front loop lengths of LHL units.''' return [lhl['H_start'] - lhl['start'] for lhl in lhl_infos] def get_back_loop_lengths(lhl_infos): '''Get the distribution of back loop lengths of LHL units.''' return [lhl['stop'] - lhl['H_stop'] for lhl in lhl_infos] def get_lhl_pair_helix_length_diffs(lhl_infos, edges): '''Get the helix length difference between pairs of LHL units.''' length_diffs = [] for i, j in edges: length1 = lhl_infos[i]['H_stop'] - lhl_infos[i]['H_start'] + 1 length2 = lhl_infos[j]['H_stop'] - lhl_infos[j]['H_start'] + 1 length_diffs.append(np.absolute(length1 - length2)) return length_diffs def get_lhl_pair_length_diffs(lhl_infos, edges): '''Get the length difference between pairs of LHL units.''' length_diffs = [] for i, j in edges: length1 = lhl_infos[i]['stop'] - lhl_infos[i]['start'] + 1 length2 = lhl_infos[j]['stop'] - lhl_infos[j]['start'] + 1 length_diffs.append(np.absolute(length1 - length2)) return length_diffs def get_lhl_pair_helix_rmsds(poses_map, lhl_infos, edges): '''Get the helix backbone RMSDs between pairs of LHL units''' rmsds = [] for i, j in edges: length1 = lhl_infos[i]['H_stop'] - lhl_infos[i]['H_start'] + 1 length2 = lhl_infos[j]['H_stop'] - lhl_infos[j]['H_start'] + 1 len_comp = min(length1, length2) h_mid_start1 = (lhl_infos[i]['H_start'] + lhl_infos[i]['H_stop'] - len_comp) // 2 h_mid_start2 = (lhl_infos[j]['H_start'] + lhl_infos[j]['H_stop'] - len_comp) // 2 residues1 = [h_mid_start1 + k for k in range(len_comp)] residues2 = [h_mid_start2 + k for k in range(len_comp)] rmsds.append(calc_backbone_RMSD(poses_map[lhl_infos[i]['pdb_file']], residues1, poses_map[lhl_infos[j]['pdb_file']], residues2)) return rmsds def get_lhl_pair_rmsds(poses_map, lhl_infos, edges): '''Get the backbone RMSDs between pairs of LHL units''' rmsds = [] for i, j in edges: length1 = lhl_infos[i]['stop'] - lhl_infos[i]['start'] + 1 length2 = lhl_infos[j]['stop'] - lhl_infos[j]['start'] + 1 len_comp = min(length1, length2) residues1 = [lhl_infos[i]['start'] + k for k in range(len_comp)] residues2 = [lhl_infos[j]['start'] + k for k in range(len_comp)] rmsds.append(calc_backbone_RMSD(poses_map[lhl_infos[i]['pdb_file']], residues1, poses_map[lhl_infos[j]['pdb_file']], residues2)) return rmsds def get_lhl_pair_helicies_angles(poses_map, lhl_infos, edges): '''Get the angles between helices of pairs of LHL units''' angles = [] for i, j in edges: helix_direction1 = get_helix_direction(poses_map[lhl_infos[i]['pdb_file']], lhl_infos[i]['H_start'], lhl_infos[i]['H_stop']) helix_direction2 = get_helix_direction(poses_map[lhl_infos[j]['pdb_file']], lhl_infos[j]['H_start'], lhl_infos[j]['H_stop']) cos_angle = helix_direction1.dot(helix_direction2) angles.append(180 / np.pi * np.arccos(cos_angle)) return angles def dump_distribution(data, data_name): '''Dump a distribution to a text file''' with open('{0}.txt'.format(data_name), 'w') as f: for d in data: f.write('{0}\n'.format(d)) def get_lhl_distributions(pdbs_path, lhl_info_path, edges_file): '''Get LHL distributions''' # Load the pdbs poses_map = {} for pdb_file in os.listdir(pdbs_path): poses_map[pdb_file] = rosetta.core.import_pose.pose_from_file(os.path.join(pdbs_path, pdb_file)) # Load the lhl_infos lhl_infos = [] for lhl_info_file in os.listdir(lhl_info_path): with open(os.path.join(lhl_info_path, lhl_info_file), 'r') as f: lhl_info = json.load(f) lhl_infos += lhl_info # Load the edges with open(edges_file, 'r') as f: edges = json.load(f) # Calcualte and dump the distributions # lhl_lengths = get_lhl_lengths(lhl_infos) # dump_distribution(lhl_lengths, 'lhl_lengths') # # front_loop_lengths = get_front_loop_lengths(lhl_infos) # dump_distribution(front_loop_lengths, 'front_loop_lengths') # # back_loop_lengths = get_back_loop_lengths(lhl_infos) # dump_distribution(back_loop_lengths, 'back_loop_lengths') # lhl_pair_helix_length_diffs = get_lhl_pair_helix_length_diffs(lhl_infos, edges) dump_distribution(lhl_pair_helix_length_diffs, 'lhl_pair_helix_length_diffs') # # lhl_pair_length_diffs = get_lhl_pair_length_diffs(lhl_infos, edges) # dump_distribution(lhl_pair_length_diffs, 'lhl_pair_length_diffs') # lhl_pair_helix_rmsds = get_lhl_pair_helix_rmsds(poses_map, lhl_infos, edges) dump_distribution(lhl_pair_helix_rmsds, 'lhl_pair_helix_rmsds') # # lhl_pair_rmsds = get_lhl_pair_rmsds(poses_map, lhl_infos, edges) # dump_distribution(lhl_pair_rmsds, 'lhl_pair_rmsds') # # lhl_pair_helices_angles = get_lhl_pair_helicies_angles(poses_map, lhl_infos, edges) # dump_distribution(lhl_pair_helices_angles, 'lhl_pair_helices_angles') if __name__ == '__main__': pdbs_path = sys.argv[1] lhl_info_path = sys.argv[2] edges_file = sys.argv[3] pyrosetta.init(options='-ignore_unrecognized_res true') get_lhl_distributions(pdbs_path, lhl_info_path, edges_file)
0ebec273c17fa7bf8132a5c77df524c49eb07764
df92ea5a3206b2b920086203b3fe0f48ac106d15
/django_docs/onetomany/migrations/0002_car_model.py
6f2951bba6f495c61b627f23e5b211b0d054afe5
[ "MIT" ]
permissive
miscreant1/django_tutorial
b354ea5c28224fe9e3612301e146d0c6a8778f28
736743be66d83ec579b22a0378381042f5207f38
refs/heads/master
2022-04-24T17:48:10.724609
2020-04-27T07:52:24
2020-04-27T07:52:24
null
0
0
null
null
null
null
UTF-8
Python
false
false
460
py
# Generated by Django 3.0.5 on 2020-04-20 02:00 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('onetomany', '0001_initial'), ] operations = [ migrations.AddField( model_name='car', name='model', field=models.CharField(default='소나타', max_length=40, verbose_name='자동차모델'), preserve_default=False, ), ]
9146864977a7d2fe9dc29fbd998218d7d8de3ff8
fdf3a655e46424050790540add959c4b0bd308b3
/src/yacctab.py
bc401bd6a9f1ff37a98345f8486ea8d2c6d241e7
[]
no_license
bernielampe1/ast_js_fuzzing
5e456d500e5d9084f279e18f977d1f306222f11f
8be0b49ca5b341270957c0e940471da31590222c
refs/heads/master
2023-05-29T19:09:58.151434
2021-06-15T15:33:36
2021-06-15T15:33:36
377,209,772
0
0
null
null
null
null
UTF-8
Python
false
false
173,068
py
# yacctab.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '\xbd\xf5(\x01\x93\xb1\xff>#\x00}\x88\xda\x97f\xde' _lr_action_items = {'DO':([0,2,5,7,13,19,21,28,29,31,36,43,44,45,50,58,62,65,67,68,72,75,77,111,114,115,116,126,133,143,147,148,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,379,382,410,412,414,417,429,430,435,465,466,469,471,475,484,493,494,498,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[68,-22,-15,68,-23,-21,-13,-19,-17,-20,-16,-11,68,-9,-10,-8,-24,-12,-6,68,-242,-18,-14,-7,-290,-289,-2,68,-268,-267,-243,-244,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,68,68,-288,-286,68,68,-271,68,68,-249,-272,-245,68,68,68,68,68,-291,68,-252,-287,-273,-247,-248,-246,-292,68,-253,68,68,68,68,-254,-250,-274,-251,]),'OREQUAL':([3,8,12,15,16,20,24,38,41,49,61,63,64,70,71,78,79,80,81,82,85,87,101,102,103,105,107,108,109,110,142,159,169,172,173,216,218,221,222,227,228,237,299,301,303,313,317,336,343,344,347,349,407,409,413,420,423,424,427,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-42,-41,-30,-93,-76,-31,-32,-33,-35,-34,-37,-36,-43,-44,206,-38,-29,-90,-39,-91,-40,-65,-64,-74,-41,206,-83,-82,-77,-74,-47,-46,-75,-74,-79,-55,-78,206,-85,-86,-72,-73,-45,-68,-81,-56,-67,-84,-87,-71,-48,-80,-57,-66,206,-293,-294,-295,-295,-296,-296,]),'DIVEQUAL':([3,8,12,15,16,20,24,38,41,49,61,63,64,70,71,78,79,80,81,82,85,87,101,102,103,105,107,108,109,110,142,159,169,172,173,216,218,221,222,227,228,237,299,301,303,313,317,336,343,344,347,349,407,409,413,420,423,424,427,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-42,-41,-30,-93,-76,-31,-32,-33,-35,-34,-37,-36,-43,-44,193,-38,-29,-90,-39,-91,-40,-65,-64,-74,-41,193,-83,-82,-77,-74,-47,-46,-75,-74,-79,-55,-78,193,-85,-86,-72,-73,-45,-68,-81,-56,-67,-84,-87,-71,-48,-80,-57,-66,193,-293,-294,-295,-295,-296,-296,]),'RETURN':([0,2,5,7,13,19,21,28,29,31,36,43,44,45,50,58,62,65,67,68,72,75,77,111,114,115,116,126,133,143,147,148,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,379,382,410,412,414,417,429,430,435,465,466,469,471,475,484,493,494,498,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[26,-22,-15,26,-23,-21,-13,-19,-17,-20,-16,-11,26,-9,-10,-8,-24,-12,-6,26,-242,-18,-14,-7,-290,-289,-2,26,-268,-267,-243,-244,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,26,26,-288,-286,26,26,-271,26,26,-249,-272,-245,26,26,26,26,26,-291,26,-252,-287,-273,-247,-248,-246,-292,26,-253,26,26,26,26,-254,-250,-274,-251,]),'RSHIFTEQUAL':([3,8,12,15,16,20,24,38,41,49,61,63,64,70,71,78,79,80,81,82,85,87,101,102,103,105,107,108,109,110,142,159,169,172,173,216,218,221,222,227,228,237,299,301,303,313,317,336,343,344,347,349,407,409,413,420,423,424,427,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-42,-41,-30,-93,-76,-31,-32,-33,-35,-34,-37,-36,-43,-44,194,-38,-29,-90,-39,-91,-40,-65,-64,-74,-41,194,-83,-82,-77,-74,-47,-46,-75,-74,-79,-55,-78,194,-85,-86,-72,-73,-45,-68,-81,-56,-67,-84,-87,-71,-48,-80,-57,-66,194,-293,-294,-295,-295,-296,-296,]),'DEFAULT':([2,5,7,13,19,21,28,29,31,36,43,45,50,58,59,62,65,67,72,75,77,111,114,115,116,133,143,147,148,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,410,412,429,465,466,467,469,488,489,490,491,498,504,506,508,509,512,513,514,517,520,522,527,528,529,530,532,],[-22,-15,-5,-23,-21,-13,-19,-17,-20,-16,-11,-9,-10,-8,-4,-24,-12,-6,-242,-18,-14,-7,-290,-289,-2,-268,-267,-243,-244,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,-288,-286,-271,-249,-272,-1,-245,-276,511,-277,-275,-291,-252,-287,-278,-273,-247,-248,-246,-292,-253,-1,-254,-250,-279,-274,-251,]),'VOID':([0,2,4,5,6,7,10,11,13,19,21,23,25,26,28,29,30,31,36,40,43,44,45,48,50,58,62,65,67,68,72,75,77,83,84,88,89,90,92,93,94,95,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,160,163,164,168,170,171,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,226,236,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,308,309,310,311,312,320,321,338,339,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,412,414,416,417,428,429,430,435,437,440,441,465,466,469,471,475,480,483,484,485,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[11,-22,-1,-15,11,11,11,11,-23,-21,-13,11,11,11,-19,-17,11,-20,-16,11,-11,11,-9,11,-10,-8,-24,-12,-6,11,-242,-18,-14,11,11,11,11,11,11,-53,-52,-51,-7,-290,-289,-2,11,11,11,11,11,11,-268,-267,11,-243,-244,11,11,11,11,11,11,11,-259,-260,11,11,11,11,11,-263,-264,-25,11,11,11,11,11,11,11,11,11,11,11,11,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,11,11,-1,-54,11,11,-230,-231,11,-281,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,-269,-270,11,11,11,11,11,11,11,-285,-284,-26,-261,-262,-266,-265,-282,-283,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,-288,-286,11,11,11,11,-271,11,11,11,11,11,-249,-272,-245,11,11,11,11,11,11,11,11,11,-291,11,11,-252,-287,-273,-247,-248,-246,-292,11,-253,11,11,11,11,-254,-250,-274,-251,]),'NUMBER':([0,2,4,5,6,7,10,11,13,19,21,23,25,26,28,29,30,31,36,40,43,44,45,48,50,54,58,62,65,67,68,72,75,77,83,84,88,89,90,92,93,94,95,98,104,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,160,163,164,168,170,171,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,226,236,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,308,309,310,311,312,320,321,338,339,340,341,346,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,412,414,416,417,428,429,430,435,437,440,441,465,466,469,471,475,480,483,484,485,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[70,-22,-1,-15,70,70,70,70,-23,-21,-13,70,70,70,-19,-17,70,-20,-16,70,-11,70,-9,70,-10,70,-8,-24,-12,-6,70,-242,-18,-14,70,70,70,70,70,70,-53,-52,-51,70,70,-7,-290,-289,-2,70,70,70,70,70,70,-268,-267,70,-243,-244,70,70,70,70,70,70,70,-259,-260,70,70,70,70,70,-263,-264,-25,70,70,70,70,70,70,70,70,70,70,70,70,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,70,70,-1,-54,70,70,-230,-231,70,-281,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,-269,-270,70,70,70,70,70,70,70,-285,-284,-26,-261,-262,-266,-265,-282,-283,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,-288,-286,70,70,70,70,-271,70,70,70,70,70,-249,-272,-245,70,70,70,70,70,70,70,70,70,-291,70,70,-252,-287,-273,-247,-248,-246,-292,70,-253,70,70,70,70,-254,-250,-274,-251,]),'LBRACKET':([0,2,3,4,5,6,7,8,10,11,13,15,16,19,20,21,23,24,25,26,28,29,30,31,36,38,40,41,43,44,45,48,49,50,54,58,61,62,63,64,65,67,68,70,71,72,75,77,78,79,80,81,83,84,85,87,88,89,90,92,93,94,95,98,102,103,105,107,108,109,110,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,159,160,163,164,168,169,170,171,173,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,216,218,219,222,226,227,228,236,237,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,301,303,308,309,310,311,312,313,317,320,321,336,338,339,340,341,343,344,347,348,349,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,412,413,414,416,417,420,423,424,427,428,429,430,435,437,440,441,465,466,469,471,474,475,480,483,484,485,487,493,494,496,498,499,502,504,506,509,512,513,514,516,517,519,520,521,522,524,525,526,527,528,530,532,],[4,-22,-28,-1,-15,4,4,-70,4,4,-23,-69,-27,-21,-42,-13,4,-41,4,4,-19,-17,4,-20,-16,-30,4,158,-11,4,-9,4,168,-10,4,-8,-31,-24,-32,-33,-12,-6,4,-35,-34,-242,-18,-14,-37,-36,-43,-44,4,4,-38,-29,4,4,4,4,-53,-52,-51,4,-39,226,-40,-65,-64,236,-41,-7,-290,-289,-2,4,4,4,4,4,4,-268,-267,4,-243,-244,4,4,4,4,4,4,-83,4,-259,-260,4,-82,4,4,236,4,4,-263,-264,-25,4,4,4,4,4,4,4,4,4,4,4,4,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,4,4,-1,-47,-46,-54,236,4,-79,-55,4,-78,-230,-231,4,-281,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,-269,-270,4,4,4,4,4,4,4,-85,-86,-285,-284,-26,-261,-262,-72,-73,-266,-265,-45,-282,-283,4,4,-68,-81,-56,4,-67,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,-84,4,-87,-288,-286,-71,4,4,4,-48,-80,-57,-66,4,-271,4,4,4,4,4,-249,-272,-245,4,-293,4,4,4,4,4,4,4,4,-294,-291,4,4,-252,-287,-273,-247,-248,-246,-295,-292,4,-253,4,4,4,-296,4,-254,-250,-274,-251,]),'BXOR':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,53,60,61,63,64,70,71,73,74,76,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,132,134,135,136,140,142,144,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,288,289,290,291,292,299,301,303,313,316,317,323,324,325,326,327,328,329,330,331,332,333,334,336,343,344,347,349,353,354,355,356,357,358,359,360,361,362,364,365,366,367,368,369,370,371,373,374,378,407,409,413,420,423,424,427,442,443,444,445,446,447,448,449,450,451,452,456,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,171,-102,-31,-32,-33,-35,-34,-174,-165,-180,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,-155,-135,-113,263,-170,-127,-94,-176,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,-160,-178,-142,395,-172,-94,-85,-86,-72,-181,-73,171,-166,-167,-169,-168,-153,-150,-149,-152,-151,-154,-175,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,263,-130,-129,-128,-177,-156,-157,-159,-158,-122,-123,-171,-84,-87,-71,-48,-80,-57,-66,-147,-144,-143,-146,-145,-173,-179,-161,-162,-164,-163,395,-94,-293,-294,-295,-295,-296,-296,]),'WHILE':([0,2,5,7,13,19,21,28,29,31,36,43,44,45,50,58,62,65,67,68,72,75,77,111,114,115,116,126,133,143,147,148,163,164,176,177,179,180,238,239,248,268,269,308,309,310,311,312,320,321,338,339,379,382,410,412,414,417,429,430,435,465,466,469,471,475,484,493,494,498,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[52,-22,-15,52,-23,-21,-13,-19,-17,-20,-16,-11,52,-9,-10,-8,-24,-12,-6,52,-242,-18,-14,-7,-290,-289,-2,52,-268,-267,-243,-244,-259,-260,-263,-264,-25,322,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,52,52,-288,-286,52,52,-271,52,52,-249,-272,-245,52,52,52,52,52,-291,52,-252,-287,-273,-247,-248,-246,-292,52,-253,52,52,52,52,-254,-250,-274,-251,]),'COLON':([3,16,20,24,38,61,63,64,70,71,78,79,80,81,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,130,131,132,134,135,136,137,139,140,141,142,144,145,156,166,209,212,216,218,221,222,223,224,227,228,230,232,233,234,237,286,288,289,290,291,292,295,296,300,303,336,343,344,347,349,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,409,420,423,424,427,436,442,443,444,445,446,447,448,449,450,451,452,456,458,460,461,462,472,474,496,505,507,511,516,525,],[-28,-27,-42,126,-30,-31,-32,-33,-35,-34,-37,-36,-43,-44,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,-155,-188,-194,-135,-113,-182,-170,-206,-224,-127,-200,-94,-176,-111,-107,-112,-108,340,-47,-46,-75,-74,-95,-96,-79,-55,-63,-61,348,-62,-78,-196,-160,-178,-142,-184,-172,-190,-208,-202,-86,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-183,-189,-130,-129,-128,-177,-156,-157,-159,-158,-225,-122,-123,428,-195,-207,-171,-87,-48,-80,-57,-66,-191,-147,-144,-143,-146,-145,-173,-179,-161,-162,-164,-163,-185,-94,-209,485,-197,-201,-293,-294,-203,522,524,-295,-296,]),'BNOT':([0,2,4,5,6,7,10,11,13,19,21,23,25,26,28,29,30,31,36,40,43,44,45,48,50,58,62,65,67,68,72,75,77,83,84,88,89,90,92,93,94,95,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,160,163,164,168,170,171,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,226,236,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,308,309,310,311,312,320,321,338,339,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,412,414,416,417,428,429,430,435,437,440,441,465,466,469,471,475,480,483,484,485,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[30,-22,-1,-15,30,30,30,30,-23,-21,-13,30,30,30,-19,-17,30,-20,-16,30,-11,30,-9,30,-10,-8,-24,-12,-6,30,-242,-18,-14,30,30,30,30,30,30,-53,-52,-51,-7,-290,-289,-2,30,30,30,30,30,30,-268,-267,30,-243,-244,30,30,30,30,30,30,30,-259,-260,30,30,30,30,30,-263,-264,-25,30,30,30,30,30,30,30,30,30,30,30,30,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,30,30,-1,-54,30,30,-230,-231,30,-281,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,-269,-270,30,30,30,30,30,30,30,-285,-284,-26,-261,-262,-266,-265,-282,-283,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,-288,-286,30,30,30,30,-271,30,30,30,30,30,-249,-272,-245,30,30,30,30,30,30,30,30,30,-291,30,30,-252,-287,-273,-247,-248,-246,-292,30,-253,30,30,30,30,-254,-250,-274,-251,]),'LSHIFT':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,60,61,63,64,70,71,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,132,134,140,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,290,299,301,303,313,317,328,329,330,331,332,333,336,343,344,347,349,353,354,355,356,357,358,359,360,361,364,365,366,373,374,407,409,413,420,423,424,427,442,443,444,445,446,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,122,-42,-131,-41,-117,-124,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,262,-113,-127,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,262,-94,-85,-86,-72,-73,262,262,262,262,262,262,-45,-68,-81,-56,-67,-115,-116,-114,262,262,262,262,262,262,-130,-129,-128,-122,-123,-84,-87,-71,-48,-80,-57,-66,262,262,262,262,262,-94,-293,-294,-295,-295,-296,-296,]),'NEW':([0,2,4,5,6,7,10,11,13,19,21,23,25,26,28,29,30,31,36,40,43,44,45,48,50,54,58,62,65,67,68,72,75,77,83,84,88,89,90,92,93,94,95,98,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,160,163,164,168,170,171,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,226,236,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,308,309,310,311,312,320,321,338,339,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,412,414,416,417,428,429,430,435,437,440,441,465,466,469,471,475,480,483,484,485,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[54,-22,-1,-15,98,54,98,98,-23,-21,-13,98,98,98,-19,-17,98,-20,-16,98,-11,54,-9,98,-10,98,-8,-24,-12,-6,54,-242,-18,-14,98,98,98,98,54,98,-53,-52,-51,98,-7,-290,-289,-2,98,98,98,98,98,54,-268,-267,98,-243,-244,98,98,98,98,98,98,98,-259,-260,98,98,54,54,98,-263,-264,-25,54,98,98,98,98,98,98,98,98,98,98,54,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,98,98,-1,-54,98,98,-230,-231,98,-281,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,-269,-270,98,98,98,98,98,98,98,-285,-284,-26,-261,-262,-266,-265,-282,-283,98,98,98,54,54,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,-288,-286,54,98,54,98,-271,54,54,98,98,98,-249,-272,-245,54,54,98,98,54,98,98,54,54,-291,98,54,-252,-287,-273,-247,-248,-246,-292,54,-253,54,54,54,54,-254,-250,-274,-251,]),'DIV':([3,8,12,15,16,20,24,27,35,38,41,46,49,60,61,63,64,70,71,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,134,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,246,247,279,280,281,299,301,303,313,317,336,343,344,347,349,353,354,355,373,374,407,409,413,420,423,424,427,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-42,-41,-117,151,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,249,-113,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,249,249,-120,-119,-118,-94,-85,-86,-72,-73,-45,-68,-81,-56,-67,-115,-116,-114,249,249,-84,-87,-71,-48,-80,-57,-66,-94,-293,-294,-295,-295,-296,-296,]),'NULL':([0,2,4,5,6,7,10,11,13,19,21,23,25,26,28,29,30,31,36,40,43,44,45,48,50,54,58,62,65,67,68,72,75,77,83,84,88,89,90,92,93,94,95,98,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,160,163,164,168,170,171,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,226,236,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,308,309,310,311,312,320,321,338,339,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,412,414,416,417,428,429,430,435,437,440,441,465,466,469,471,475,480,483,484,485,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[71,-22,-1,-15,71,71,71,71,-23,-21,-13,71,71,71,-19,-17,71,-20,-16,71,-11,71,-9,71,-10,71,-8,-24,-12,-6,71,-242,-18,-14,71,71,71,71,71,71,-53,-52,-51,71,-7,-290,-289,-2,71,71,71,71,71,71,-268,-267,71,-243,-244,71,71,71,71,71,71,71,-259,-260,71,71,71,71,71,-263,-264,-25,71,71,71,71,71,71,71,71,71,71,71,71,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,71,71,-1,-54,71,71,-230,-231,71,-281,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,-269,-270,71,71,71,71,71,71,71,-285,-284,-26,-261,-262,-266,-265,-282,-283,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,-288,-286,71,71,71,71,-271,71,71,71,71,71,-249,-272,-245,71,71,71,71,71,71,71,71,71,-291,71,71,-252,-287,-273,-247,-248,-246,-292,71,-253,71,71,71,71,-254,-250,-274,-251,]),'TRUE':([0,2,4,5,6,7,10,11,13,19,21,23,25,26,28,29,30,31,36,40,43,44,45,48,50,54,58,62,65,67,68,72,75,77,83,84,88,89,90,92,93,94,95,98,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,160,163,164,168,170,171,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,226,236,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,308,309,310,311,312,320,321,338,339,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,412,414,416,417,428,429,430,435,437,440,441,465,466,469,471,475,480,483,484,485,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[63,-22,-1,-15,63,63,63,63,-23,-21,-13,63,63,63,-19,-17,63,-20,-16,63,-11,63,-9,63,-10,63,-8,-24,-12,-6,63,-242,-18,-14,63,63,63,63,63,63,-53,-52,-51,63,-7,-290,-289,-2,63,63,63,63,63,63,-268,-267,63,-243,-244,63,63,63,63,63,63,63,-259,-260,63,63,63,63,63,-263,-264,-25,63,63,63,63,63,63,63,63,63,63,63,63,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,63,63,-1,-54,63,63,-230,-231,63,-281,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,-269,-270,63,63,63,63,63,63,63,-285,-284,-26,-261,-262,-266,-265,-282,-283,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,-288,-286,63,63,63,63,-271,63,63,63,63,63,-249,-272,-245,63,63,63,63,63,63,63,63,63,-291,63,63,-252,-287,-273,-247,-248,-246,-292,63,-253,63,63,63,63,-254,-250,-274,-251,]),'MINUS':([0,2,3,4,5,6,7,8,10,11,12,13,15,16,19,20,21,22,23,24,25,26,27,28,29,30,31,35,36,38,40,41,43,44,45,46,48,49,50,58,60,61,62,63,64,65,67,68,70,71,72,75,77,78,79,80,81,82,83,84,85,87,88,89,90,92,93,94,95,97,99,100,101,102,103,105,106,107,108,109,110,111,112,113,114,115,116,120,121,122,123,124,125,126,127,128,133,134,140,142,143,145,146,147,148,149,150,151,152,155,156,158,159,160,163,164,166,168,169,170,171,172,173,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,209,210,213,215,216,218,219,221,222,223,224,226,227,228,236,237,238,239,241,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,279,280,281,299,301,303,308,309,310,311,312,313,317,320,321,336,338,339,340,341,343,344,347,348,349,353,354,355,364,365,366,373,374,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,412,413,414,416,417,420,423,424,427,428,429,430,435,437,440,441,458,465,466,469,471,474,475,480,483,484,485,487,493,494,496,498,499,502,504,506,509,512,513,514,516,517,519,520,521,522,524,525,526,527,528,530,532,],[6,-22,-28,-1,-15,6,6,-70,6,6,-92,-23,-69,-27,-21,-42,-13,124,6,-41,6,6,-117,-19,-17,6,-20,-124,-16,-30,6,-93,-11,6,-9,-103,6,-76,-10,-8,-102,-31,-24,-32,-33,-12,-6,6,-35,-34,-242,-18,-14,-37,-36,-43,-44,-97,6,6,-38,-29,6,6,6,6,-53,-52,-51,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-7,-109,-105,-290,-289,-2,6,6,6,6,6,-106,6,-104,-121,-268,-113,272,-94,-267,-111,6,-243,-244,6,6,6,6,6,-107,6,-83,6,-259,-260,-112,6,-82,6,6,-77,-74,6,6,-263,-264,-25,6,6,6,6,6,6,6,6,6,6,6,6,-214,-219,-220,-98,-217,-215,-222,-213,-216,-218,-221,-99,-212,-223,6,-108,6,-97,-1,-47,-46,-54,-75,-74,-95,-96,6,-79,-55,6,-78,-230,-231,6,272,272,272,-125,-126,-281,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,-269,-270,6,6,6,6,6,6,6,-120,-119,-118,-94,-85,-86,-285,-284,-26,-261,-262,-72,-73,-266,-265,-45,-282,-283,6,6,-68,-81,-56,6,-67,-115,-116,-114,272,272,272,-122,-123,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,-84,6,-87,-288,-286,-71,6,6,6,-48,-80,-57,-66,6,-271,6,6,6,6,6,-94,-249,-272,-245,6,-293,6,6,6,6,6,6,6,6,-294,-291,6,6,-252,-287,-273,-247,-248,-246,-295,-292,6,-253,6,6,6,-296,6,-254,-250,-274,-251,]),'MULT':([3,8,12,15,16,20,24,27,35,38,41,46,49,60,61,63,64,70,71,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,134,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,246,247,279,280,281,299,301,303,313,317,336,343,344,347,349,353,354,355,373,374,407,409,413,420,423,424,427,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-42,-41,-117,152,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,251,-113,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,251,251,-120,-119,-118,-94,-85,-86,-72,-73,-45,-68,-81,-56,-67,-115,-116,-114,251,251,-84,-87,-71,-48,-80,-57,-66,-94,-293,-294,-295,-295,-296,-296,]),'DEBUGGER':([0,2,5,7,13,19,21,28,29,31,36,43,44,45,50,58,62,65,67,68,72,75,77,111,114,115,116,126,133,143,147,148,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,379,382,410,412,414,417,429,430,435,465,466,469,471,475,484,493,494,498,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[14,-22,-15,14,-23,-21,-13,-19,-17,-20,-16,-11,14,-9,-10,-8,-24,-12,-6,14,-242,-18,-14,-7,-290,-289,-2,14,-268,-267,-243,-244,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,14,14,-288,-286,14,14,-271,14,14,-249,-272,-245,14,14,14,14,14,-291,14,-252,-287,-273,-247,-248,-246,-292,14,-253,14,14,14,14,-254,-250,-274,-251,]),'CASE':([2,5,7,13,19,21,28,29,31,36,43,45,50,58,59,62,65,67,72,75,77,111,114,115,116,133,143,147,148,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,410,412,429,465,466,467,469,488,490,498,504,506,508,509,510,512,513,514,517,520,522,524,527,528,529,530,531,532,],[-22,-15,-5,-23,-21,-13,-19,-17,-20,-16,-11,-9,-10,-8,-4,-24,-12,-6,-242,-18,-14,-7,-290,-289,-2,-268,-267,-243,-244,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,-288,-286,-271,-249,-272,487,-245,487,-277,-291,-252,-287,-278,-273,487,-247,-248,-246,-292,-253,-1,-1,-254,-250,-279,-274,-280,-251,]),'LE':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,60,61,63,64,70,71,74,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,132,134,140,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,288,290,299,301,303,313,317,324,325,326,327,328,329,330,331,332,333,336,343,344,347,349,353,354,355,356,357,358,359,360,361,364,365,366,368,369,370,371,373,374,407,409,413,420,423,424,427,442,443,444,445,446,449,450,451,452,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,190,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,256,-135,-113,-127,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,393,-142,-94,-85,-86,-72,-73,256,256,256,256,-153,-150,-149,-152,-151,-154,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-130,-129,-128,256,256,256,256,-122,-123,-84,-87,-71,-48,-80,-57,-66,-147,-144,-143,-146,-145,256,256,256,256,-94,-293,-294,-295,-295,-296,-296,]),'RPAREN':([3,16,20,38,61,63,64,70,71,78,79,80,81,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,130,131,132,134,135,136,137,139,140,141,142,144,145,153,156,160,166,208,209,216,218,221,222,223,224,227,228,237,277,282,284,285,303,304,305,315,319,336,337,342,343,344,347,349,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,376,377,378,383,409,420,421,423,424,427,431,454,455,459,463,464,468,472,474,481,483,496,499,501,503,516,518,525,],[-28,-27,-42,-30,-31,-32,-33,-35,-34,-37,-36,-43,-44,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,-155,-188,-194,-135,-113,-182,-170,-206,-224,-127,-200,-94,-176,-111,283,-107,303,-112,336,-108,-47,-46,-75,-74,-95,-96,-79,-55,-78,379,380,-297,384,-86,409,-88,414,415,-45,417,422,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-183,-189,-130,-129,-128,-177,-156,-157,-159,-158,-225,-122,-123,-195,-207,-171,434,-87,-48,470,-80,-57,-66,-298,-255,-256,484,-89,486,492,-201,-293,502,-1,-294,-1,519,521,-295,526,-296,]),'URSHIFT':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,60,61,63,64,70,71,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,132,134,140,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,290,299,301,303,313,317,328,329,330,331,332,333,336,343,344,347,349,353,354,355,356,357,358,359,360,361,364,365,366,373,374,407,409,413,420,423,424,427,442,443,444,445,446,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,120,-42,-131,-41,-117,-124,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,260,-113,-127,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,260,-94,-85,-86,-72,-73,260,260,260,260,260,260,-45,-68,-81,-56,-67,-115,-116,-114,260,260,260,260,260,260,-130,-129,-128,-122,-123,-84,-87,-71,-48,-80,-57,-66,260,260,260,260,260,-94,-293,-294,-295,-295,-296,-296,]),'SEMI':([0,1,2,3,5,7,8,12,13,14,15,16,18,19,20,21,22,24,26,27,28,29,31,34,35,36,38,41,43,44,45,46,47,49,50,51,53,55,56,58,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,147,148,155,156,159,163,164,165,166,169,172,173,176,177,178,179,196,204,209,211,213,214,216,218,221,222,223,224,227,228,237,238,239,242,243,244,245,246,247,248,268,269,278,279,280,281,286,288,289,290,291,292,293,294,295,296,297,298,299,300,301,303,308,309,310,311,312,313,316,317,318,320,321,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,347,349,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,376,377,378,379,382,386,387,388,400,407,409,410,412,413,414,417,418,420,423,424,427,429,430,435,436,437,439,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,460,462,465,466,469,471,472,474,475,477,478,479,482,484,492,493,494,496,498,500,502,504,505,506,509,512,513,514,516,517,519,520,521,522,524,525,526,527,528,530,532,],[72,-204,-22,-28,-15,72,-70,-92,-23,115,-69,-27,-148,-21,-42,-13,-131,-41,143,-117,-19,-17,-20,147,-124,-16,-30,-93,-11,72,-9,-103,163,-76,-10,-228,-186,-210,-198,-8,-102,-31,-24,-32,-33,-12,176,-6,72,-192,-35,-34,-242,-174,-165,-18,-180,-14,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-7,-109,-105,-290,-289,-2,238,-236,-232,-106,72,-104,-121,-155,-188,-194,-135,-268,-113,-182,-170,-206,268,-224,-127,-200,-94,-267,-176,-111,-243,-244,-1,-107,-83,-259,-260,311,-112,-82,-77,-74,-263,-264,321,-25,-98,-99,-108,338,-97,-199,-47,-46,-75,-74,-95,-96,-79,-55,-78,-230,-231,-237,-134,-133,-132,-125,-126,-281,-269,-270,-229,-120,-119,-118,-196,-160,-178,-142,-184,-172,-226,400,-190,-208,-258,-257,-94,-202,-85,-86,-285,-284,-26,-261,-262,-72,-181,-73,-193,-266,-265,-187,-166,-167,-169,-168,-153,-150,-149,-152,-151,-154,-175,-211,-45,-282,-283,-68,-81,-56,-67,-233,-240,-115,-116,-114,-140,-137,-136,-139,-138,-141,-183,-189,-130,-129,-128,-177,-156,-157,-159,-158,-225,-122,-123,-195,-207,-171,72,72,-234,437,-238,-1,-84,-87,-288,-286,-71,72,72,-205,-48,-80,-57,-66,-271,72,72,-191,-1,-239,-147,-144,-143,-146,-145,-173,-179,-161,-162,-164,-163,483,-255,-256,-185,-227,-94,-209,-197,-249,-272,-245,72,-201,-293,72,499,-235,-238,-241,72,512,72,72,-294,-291,-239,72,-252,-203,-287,-273,-247,-248,-246,-295,-292,72,-253,72,72,72,-296,72,-254,-250,-274,-251,]),'WITH':([0,2,5,7,13,19,21,28,29,31,36,43,44,45,50,58,62,65,67,68,72,75,77,111,114,115,116,126,133,143,147,148,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,379,382,410,412,414,417,429,430,435,465,466,469,471,475,484,493,494,498,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[32,-22,-15,32,-23,-21,-13,-19,-17,-20,-16,-11,32,-9,-10,-8,-24,-12,-6,32,-242,-18,-14,-7,-290,-289,-2,32,-268,-267,-243,-244,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,32,32,-288,-286,32,32,-271,32,32,-249,-272,-245,32,32,32,32,32,-291,32,-252,-287,-273,-247,-248,-246,-292,32,-253,32,32,32,32,-254,-250,-274,-251,]),'MODEQUAL':([3,8,12,15,16,20,24,38,41,49,61,63,64,70,71,78,79,80,81,82,85,87,101,102,103,105,107,108,109,110,142,159,169,172,173,216,218,221,222,227,228,237,299,301,303,313,317,336,343,344,347,349,407,409,413,420,423,424,427,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-42,-41,-30,-93,-76,-31,-32,-33,-35,-34,-37,-36,-43,-44,198,-38,-29,-90,-39,-91,-40,-65,-64,-74,-41,198,-83,-82,-77,-74,-47,-46,-75,-74,-79,-55,-78,198,-85,-86,-72,-73,-45,-68,-81,-56,-67,-84,-87,-71,-48,-80,-57,-66,198,-293,-294,-295,-295,-296,-296,]),'NE':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,60,61,63,64,70,71,73,74,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,132,134,136,140,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,288,290,292,299,301,303,313,317,324,325,326,327,328,329,330,331,332,333,334,336,343,344,347,349,353,354,355,356,357,358,359,360,361,364,365,366,368,369,370,371,373,374,378,407,409,413,420,423,424,427,442,443,444,445,446,447,449,450,451,452,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,183,-165,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,-155,-135,-113,265,-127,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,-160,-142,397,-94,-85,-86,-72,-73,-166,-167,-169,-168,-153,-150,-149,-152,-151,-154,183,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-130,-129,-128,-156,-157,-159,-158,-122,-123,265,-84,-87,-71,-48,-80,-57,-66,-147,-144,-143,-146,-145,397,-161,-162,-164,-163,-94,-293,-294,-295,-295,-296,-296,]),'MULTEQUAL':([3,8,12,15,16,20,24,38,41,49,61,63,64,70,71,78,79,80,81,82,85,87,101,102,103,105,107,108,109,110,142,159,169,172,173,216,218,221,222,227,228,237,299,301,303,313,317,336,343,344,347,349,407,409,413,420,423,424,427,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-42,-41,-30,-93,-76,-31,-32,-33,-35,-34,-37,-36,-43,-44,200,-38,-29,-90,-39,-91,-40,-65,-64,-74,-41,200,-83,-82,-77,-74,-47,-46,-75,-74,-79,-55,-78,200,-85,-86,-72,-73,-45,-68,-81,-56,-67,-84,-87,-71,-48,-80,-57,-66,200,-293,-294,-295,-295,-296,-296,]),'FINALLY':([161,309,310,506,],[306,306,-26,-287,]),'EQEQ':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,60,61,63,64,70,71,73,74,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,132,134,136,140,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,288,290,292,299,301,303,313,317,324,325,326,327,328,329,330,331,332,333,334,336,343,344,347,349,353,354,355,356,357,358,359,360,361,364,365,366,368,369,370,371,373,374,378,407,409,413,420,423,424,427,442,443,444,445,446,447,449,450,451,452,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,182,-165,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,-155,-135,-113,264,-127,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,-160,-142,396,-94,-85,-86,-72,-73,-166,-167,-169,-168,-153,-150,-149,-152,-151,-154,182,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-130,-129,-128,-156,-157,-159,-158,-122,-123,264,-84,-87,-71,-48,-80,-57,-66,-147,-144,-143,-146,-145,396,-161,-162,-164,-163,-94,-293,-294,-295,-295,-296,-296,]),'SWITCH':([0,2,5,7,13,19,21,28,29,31,36,43,44,45,50,58,62,65,67,68,72,75,77,111,114,115,116,126,133,143,147,148,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,379,382,410,412,414,417,429,430,435,465,466,469,471,475,484,493,494,498,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[57,-22,-15,57,-23,-21,-13,-19,-17,-20,-16,-11,57,-9,-10,-8,-24,-12,-6,57,-242,-18,-14,-7,-290,-289,-2,57,-268,-267,-243,-244,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,57,57,-288,-286,57,57,-271,57,57,-249,-272,-245,57,57,57,57,57,-291,57,-252,-287,-273,-247,-248,-246,-292,57,-253,57,57,57,57,-254,-250,-274,-251,]),'LSHIFTEQUAL':([3,8,12,15,16,20,24,38,41,49,61,63,64,70,71,78,79,80,81,82,85,87,101,102,103,105,107,108,109,110,142,159,169,172,173,216,218,221,222,227,228,237,299,301,303,313,317,336,343,344,347,349,407,409,413,420,423,424,427,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-42,-41,-30,-93,-76,-31,-32,-33,-35,-34,-37,-36,-43,-44,202,-38,-29,-90,-39,-91,-40,-65,-64,-74,-41,202,-83,-82,-77,-74,-47,-46,-75,-74,-79,-55,-78,202,-85,-86,-72,-73,-45,-68,-81,-56,-67,-84,-87,-71,-48,-80,-57,-66,202,-293,-294,-295,-295,-296,-296,]),'PLUS':([0,2,3,4,5,6,7,8,10,11,12,13,15,16,19,20,21,22,23,24,25,26,27,28,29,30,31,35,36,38,40,41,43,44,45,46,48,49,50,58,60,61,62,63,64,65,67,68,70,71,72,75,77,78,79,80,81,82,83,84,85,87,88,89,90,92,93,94,95,97,99,100,101,102,103,105,106,107,108,109,110,111,112,113,114,115,116,120,121,122,123,124,125,126,127,128,133,134,140,142,143,145,146,147,148,149,150,151,152,155,156,158,159,160,163,164,166,168,169,170,171,172,173,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,209,210,213,215,216,218,219,221,222,223,224,226,227,228,236,237,238,239,241,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,279,280,281,299,301,303,308,309,310,311,312,313,317,320,321,336,338,339,340,341,343,344,347,348,349,353,354,355,364,365,366,373,374,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,412,413,414,416,417,420,423,424,427,428,429,430,435,437,440,441,458,465,466,469,471,474,475,480,483,484,485,487,493,494,496,498,499,502,504,506,509,512,513,514,516,517,519,520,521,522,524,525,526,527,528,530,532,],[10,-22,-28,-1,-15,10,10,-70,10,10,-92,-23,-69,-27,-21,-42,-13,123,10,-41,10,10,-117,-19,-17,10,-20,-124,-16,-30,10,-93,-11,10,-9,-103,10,-76,-10,-8,-102,-31,-24,-32,-33,-12,-6,10,-35,-34,-242,-18,-14,-37,-36,-43,-44,-97,10,10,-38,-29,10,10,10,10,-53,-52,-51,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-7,-109,-105,-290,-289,-2,10,10,10,10,10,-106,10,-104,-121,-268,-113,271,-94,-267,-111,10,-243,-244,10,10,10,10,10,-107,10,-83,10,-259,-260,-112,10,-82,10,10,-77,-74,10,10,-263,-264,-25,10,10,10,10,10,10,10,10,10,10,10,10,-214,-219,-220,-98,-217,-215,-222,-213,-216,-218,-221,-99,-212,-223,10,-108,10,-97,-1,-47,-46,-54,-75,-74,-95,-96,10,-79,-55,10,-78,-230,-231,10,271,271,271,-125,-126,-281,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,-269,-270,10,10,10,10,10,10,10,-120,-119,-118,-94,-85,-86,-285,-284,-26,-261,-262,-72,-73,-266,-265,-45,-282,-283,10,10,-68,-81,-56,10,-67,-115,-116,-114,271,271,271,-122,-123,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,-84,10,-87,-288,-286,-71,10,10,10,-48,-80,-57,-66,10,-271,10,10,10,10,10,-94,-249,-272,-245,10,-293,10,10,10,10,10,10,10,10,-294,-291,10,10,-252,-287,-273,-247,-248,-246,-295,-292,10,-253,10,10,10,-296,10,-254,-250,-274,-251,]),'CATCH':([161,310,],[307,-26,]),'COMMA':([1,3,4,8,12,15,16,18,20,22,24,27,34,35,38,41,46,49,51,53,55,56,60,61,63,64,69,70,71,73,74,76,78,79,80,81,82,85,87,91,93,94,97,99,100,101,102,103,105,106,107,108,109,110,112,113,117,118,119,125,127,128,129,130,131,132,134,135,136,137,138,139,140,141,142,144,145,156,159,166,169,172,173,196,204,208,209,211,213,214,215,216,217,218,219,221,222,223,224,227,228,229,231,237,242,243,244,245,246,247,277,278,279,280,281,282,284,286,288,289,290,291,292,293,295,296,297,299,300,301,302,303,304,305,313,314,315,316,317,318,319,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,343,344,345,347,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,376,377,378,383,386,387,388,407,409,413,418,419,420,421,423,424,425,426,427,431,436,439,442,443,444,445,446,447,448,449,450,451,452,455,456,457,458,459,460,462,463,468,472,474,478,479,481,482,496,498,500,501,505,507,516,517,525,],[-204,-28,93,-70,-92,-69,-27,-148,-42,-131,-41,-117,149,-124,-30,-93,-103,-76,-228,-186,-210,-198,-102,-31,-32,-33,-192,-35,-34,-174,-165,-180,-37,-36,-43,-44,-97,-38,-29,215,-53,219,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,240,-236,-232,-106,-104,-121,-155,-188,-194,-135,-113,-182,-170,-206,270,-224,-127,-200,-94,-176,-111,-107,-83,-112,-82,-77,-74,-98,-99,270,-108,270,-97,-199,93,-47,-49,-46,-54,-75,-74,-95,-96,-79,-55,346,-58,-78,-237,-134,-133,-132,-125,-126,270,-229,-120,-119,-118,381,-297,-196,-160,-178,-142,-184,-172,-226,-190,-208,402,-94,-202,-85,270,-86,408,-88,-72,270,270,-181,-73,-193,270,-187,-166,-167,-169,-168,-153,-150,-149,-152,-151,-154,-175,-211,-45,270,-68,-81,270,-56,-67,270,-233,-240,-115,-116,-114,-140,-137,-136,-139,-138,-141,-183,-189,-130,-129,-128,-177,-156,-157,-159,-158,-225,-122,-123,-195,-207,-171,381,-234,438,-238,-84,-87,-71,-205,-50,-48,381,-80,-57,-59,-60,-66,-298,-191,-239,-147,-144,-143,-146,-145,-173,-179,-161,-162,-164,-163,270,-185,-227,-94,270,-209,-197,-89,270,-201,-293,-235,-238,270,-241,-294,-295,-239,270,-203,270,-295,-296,-296,]),'STREQ':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,60,61,63,64,70,71,73,74,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,132,134,136,140,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,288,290,292,299,301,303,313,317,324,325,326,327,328,329,330,331,332,333,334,336,343,344,347,349,353,354,355,356,357,358,359,360,361,364,365,366,368,369,370,371,373,374,378,407,409,413,420,423,424,427,442,443,444,445,446,447,449,450,451,452,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,185,-165,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,-155,-135,-113,267,-127,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,-160,-142,399,-94,-85,-86,-72,-73,-166,-167,-169,-168,-153,-150,-149,-152,-151,-154,185,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-130,-129,-128,-156,-157,-159,-158,-122,-123,267,-84,-87,-71,-48,-80,-57,-66,-147,-144,-143,-146,-145,399,-161,-162,-164,-163,-94,-293,-294,-295,-295,-296,-296,]),'BOR':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,53,60,61,63,64,69,70,71,73,74,76,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,130,132,134,135,136,140,142,144,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,288,289,290,291,292,295,299,301,303,313,316,317,318,323,324,325,326,327,328,329,330,331,332,333,334,336,343,344,347,349,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,373,374,378,407,409,413,420,423,424,427,436,442,443,444,445,446,447,448,449,450,451,452,456,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,-186,-102,-31,-32,-33,181,-35,-34,-174,-165,-180,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,-155,258,-135,-113,-182,-170,-127,-94,-176,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,-160,-178,-142,-184,-172,401,-94,-85,-86,-72,-181,-73,181,-187,-166,-167,-169,-168,-153,-150,-149,-152,-151,-154,-175,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-183,258,-130,-129,-128,-177,-156,-157,-159,-158,-122,-123,-171,-84,-87,-71,-48,-80,-57,-66,401,-147,-144,-143,-146,-145,-173,-179,-161,-162,-164,-163,-185,-94,-293,-294,-295,-295,-296,-296,]),'$end':([0,2,5,7,9,13,19,21,28,29,31,33,36,43,45,50,58,59,62,65,67,72,75,77,111,114,115,116,133,143,147,148,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,410,412,429,465,466,469,498,504,506,509,512,513,514,517,520,527,528,530,532,],[-1,-22,-15,-5,0,-23,-21,-13,-19,-17,-20,-3,-16,-11,-9,-10,-8,-4,-24,-12,-6,-242,-18,-14,-7,-290,-289,-2,-268,-267,-243,-244,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,-288,-286,-271,-249,-272,-245,-291,-252,-287,-273,-247,-248,-246,-292,-253,-254,-250,-274,-251,]),'FUNCTION':([0,2,4,5,6,7,10,11,13,19,21,23,25,26,28,29,30,31,36,40,43,44,45,48,50,54,58,62,65,67,68,72,75,77,83,84,88,89,90,92,93,94,95,98,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,160,163,164,168,170,171,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,226,236,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,308,309,310,311,312,320,321,338,339,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,412,414,416,417,428,429,430,435,437,440,441,465,466,469,471,475,480,483,484,485,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[37,-22,-1,-15,96,37,96,96,-23,-21,-13,96,96,96,-19,-17,96,-20,-16,96,-11,37,-9,96,-10,96,-8,-24,-12,-6,37,-242,-18,-14,96,96,96,96,96,96,-53,-52,-51,96,-7,-290,-289,-2,96,96,96,96,96,37,-268,-267,96,-243,-244,96,96,96,96,96,96,96,-259,-260,96,96,96,96,96,-263,-264,-25,96,96,96,96,96,96,96,96,96,96,96,96,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,96,96,-1,-54,96,96,-230,-231,96,-281,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,-269,-270,96,96,96,96,96,96,96,-285,-284,-26,-261,-262,-266,-265,-282,-283,96,96,96,37,37,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,-288,-286,37,96,37,96,-271,37,37,96,96,96,-249,-272,-245,37,37,96,96,37,96,96,37,37,-291,96,37,-252,-287,-273,-247,-248,-246,-292,37,-253,37,37,37,37,-254,-250,-274,-251,]),'INSTANCEOF':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,60,61,63,64,70,71,74,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,132,134,140,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,288,290,299,301,303,313,317,324,325,326,327,328,329,330,331,332,333,336,343,344,347,349,353,354,355,356,357,358,359,360,361,364,365,366,368,369,370,371,373,374,407,409,413,420,423,424,427,442,443,444,445,446,449,450,451,452,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,186,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,252,-135,-113,-127,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,389,-142,-94,-85,-86,-72,-73,252,252,252,252,-153,-150,-149,-152,-151,-154,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-130,-129,-128,252,252,252,252,-122,-123,-84,-87,-71,-48,-80,-57,-66,-147,-144,-143,-146,-145,252,252,252,252,-94,-293,-294,-295,-295,-296,-296,]),'GT':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,60,61,63,64,70,71,74,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,132,134,140,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,288,290,299,301,303,313,317,324,325,326,327,328,329,330,331,332,333,336,343,344,347,349,353,354,355,356,357,358,359,360,361,364,365,366,368,369,370,371,373,374,407,409,413,420,423,424,427,442,443,444,445,446,449,450,451,452,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,187,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,253,-135,-113,-127,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,390,-142,-94,-85,-86,-72,-73,253,253,253,253,-153,-150,-149,-152,-151,-154,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-130,-129,-128,253,253,253,253,-122,-123,-84,-87,-71,-48,-80,-57,-66,-147,-144,-143,-146,-145,253,253,253,253,-94,-293,-294,-295,-295,-296,-296,]),'STRING':([0,2,4,5,6,7,10,11,13,19,21,23,25,26,28,29,30,31,36,40,43,44,45,48,50,54,58,62,65,67,68,72,75,77,83,84,88,89,90,92,93,94,95,98,104,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,160,163,164,168,170,171,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,226,236,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,308,309,310,311,312,320,321,338,339,340,341,346,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,412,414,416,417,428,429,430,435,437,440,441,465,466,469,471,475,480,483,484,485,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[79,-22,-1,-15,79,79,79,79,-23,-21,-13,79,79,79,-19,-17,79,-20,-16,79,-11,79,-9,79,-10,79,-8,-24,-12,-6,79,-242,-18,-14,79,79,79,79,79,79,-53,-52,-51,79,79,-7,-290,-289,-2,79,79,79,79,79,79,-268,-267,79,-243,-244,79,79,79,79,79,79,79,-259,-260,79,79,79,79,79,-263,-264,-25,79,79,79,79,79,79,79,79,79,79,79,79,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,79,79,-1,-54,79,79,-230,-231,79,-281,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,-269,-270,79,79,79,79,79,79,79,-285,-284,-26,-261,-262,-266,-265,-282,-283,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,-288,-286,79,79,79,79,-271,79,79,79,79,79,-249,-272,-245,79,79,79,79,79,79,79,79,79,-291,79,79,-252,-287,-273,-247,-248,-246,-292,79,-253,79,79,79,79,-254,-250,-274,-251,]),'FOR':([0,2,5,7,13,19,21,28,29,31,36,43,44,45,50,58,62,65,67,68,72,75,77,111,114,115,116,126,133,143,147,148,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,379,382,410,412,414,417,429,430,435,465,466,469,471,475,484,493,494,498,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[39,-22,-15,39,-23,-21,-13,-19,-17,-20,-16,-11,39,-9,-10,-8,-24,-12,-6,39,-242,-18,-14,-7,-290,-289,-2,39,-268,-267,-243,-244,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,39,39,-288,-286,39,39,-271,39,39,-249,-272,-245,39,39,39,39,39,-291,39,-252,-287,-273,-247,-248,-246,-292,39,-253,39,39,39,39,-254,-250,-274,-251,]),'PLUSPLUS':([0,2,3,4,5,6,7,8,10,11,12,13,15,16,19,20,21,23,24,25,26,28,29,30,31,36,38,40,41,43,44,45,48,49,50,58,61,62,63,64,65,67,68,70,71,72,75,77,78,79,80,81,82,83,84,85,87,88,89,90,92,93,94,95,99,101,102,103,105,107,108,109,110,111,114,115,116,120,121,122,123,124,126,133,142,143,146,147,148,149,150,151,152,155,158,159,160,163,164,168,169,170,171,172,173,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,213,215,216,218,219,221,222,226,227,228,236,237,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,299,301,303,308,309,310,311,312,313,317,320,321,336,338,339,340,341,343,344,347,348,349,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,412,413,414,416,417,420,423,424,427,428,429,430,435,437,440,441,458,465,466,469,471,474,475,480,483,484,485,487,493,494,496,498,499,502,504,506,509,512,513,514,516,517,519,520,521,522,524,525,526,527,528,530,532,],[40,-22,-28,-1,-15,40,40,-70,40,40,-92,-23,-69,-27,-21,-42,-13,40,-41,40,40,-19,-17,40,-20,-16,-30,40,-93,-11,40,-9,40,-76,-10,-8,-31,-24,-32,-33,-12,-6,40,-35,-34,-242,-18,-14,-37,-36,-43,-44,196,40,40,-38,-29,40,40,40,40,-53,-52,-51,223,-90,-39,-91,-40,-65,-64,-74,-41,-7,-290,-289,-2,40,40,40,40,40,40,-268,223,-267,40,-243,-244,40,40,40,40,40,40,-83,40,-259,-260,40,-82,40,40,-77,-74,40,40,-263,-264,-25,40,40,40,40,40,40,40,40,40,40,40,40,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,40,40,196,-1,-47,-46,-54,-75,-74,40,-79,-55,40,-78,-230,-231,40,-281,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,-269,-270,40,40,40,40,40,40,40,223,-85,-86,-285,-284,-26,-261,-262,-72,-73,-266,-265,-45,-282,-283,40,40,-68,-81,-56,40,-67,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,-84,40,-87,-288,-286,-71,40,40,40,-48,-80,-57,-66,40,-271,40,40,40,40,40,223,-249,-272,-245,40,-293,40,40,40,40,40,40,40,40,-294,-291,40,40,-252,-287,-273,-247,-248,-246,-295,-292,40,-253,40,40,40,-296,40,-254,-250,-274,-251,]),'PERIOD':([3,8,15,16,20,24,38,41,49,61,63,64,70,71,78,79,80,81,85,87,102,103,105,107,108,109,110,159,169,173,216,218,222,227,228,237,301,303,313,317,336,343,344,347,349,407,409,413,420,423,424,427,474,496,498,516,517,525,],[-28,-70,-69,-27,-42,-41,-30,157,167,-31,-32,-33,-35,-34,-37,-36,-43,-44,-38,-29,-39,225,-40,-65,-64,235,-41,-83,-82,235,-47,-46,235,-79,-55,-78,-85,-86,-72,-73,-45,-68,-81,-56,-67,-84,-87,-71,-48,-80,-57,-66,-293,-294,-295,-295,-296,-296,]),'RBRACE':([2,3,5,7,13,16,19,20,21,28,29,31,36,38,43,44,45,50,58,59,61,62,63,64,65,67,70,71,72,75,77,78,79,80,81,85,87,97,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,125,127,128,129,130,131,132,133,134,135,136,137,140,141,142,143,144,145,147,148,156,162,163,164,166,176,177,179,209,216,218,221,222,223,224,227,228,229,231,237,238,239,248,268,269,303,308,309,310,311,312,320,321,336,338,339,343,344,346,347,349,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,373,374,376,377,378,382,409,410,412,420,423,424,425,426,427,429,430,432,433,435,465,466,467,469,471,472,473,474,475,476,488,489,490,491,494,495,496,497,498,504,506,508,509,510,512,513,514,515,516,517,520,522,523,524,525,527,528,529,530,531,532,],[-22,-28,-15,-5,-23,-27,-21,-42,-13,-19,-17,-20,-16,-30,-11,-1,-9,-10,-8,-4,-31,-24,-32,-33,-12,-6,-35,-34,-242,-18,-14,-37,-36,-43,-44,-38,-29,-110,-94,-100,-90,-39,-91,228,-40,-101,-65,-64,-74,-41,-7,-109,-105,-290,-289,-2,-106,-104,-121,-155,-188,-194,-135,-268,-113,-182,-170,-206,-127,-200,-94,-267,-176,-111,-243,-244,-107,310,-259,-260,-112,-263,-264,-25,-108,-47,-46,-75,-74,-95,-96,-79,-55,347,-58,-78,-230,-231,-281,-269,-270,-86,-285,-284,-26,-261,-262,-266,-265,-45,-282,-283,-68,-81,424,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-183,-189,-130,-129,-128,-177,-156,-157,-159,-158,-122,-123,-195,-207,-171,-1,-87,-288,-286,-48,-80,-57,-59,-60,-66,-271,-1,-299,474,-1,-249,-272,-1,-245,-1,-201,496,-293,-1,498,-276,509,-277,-275,-1,516,-294,517,-291,-252,-287,-278,-273,-1,-247,-248,-246,525,-295,-292,-253,-1,530,-1,-296,-254,-250,-279,-274,-280,-251,]),'ELSE':([2,5,13,19,21,28,29,31,36,43,50,62,65,72,75,77,114,115,116,133,143,147,148,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,410,412,429,465,466,469,498,504,506,509,512,513,514,517,520,527,528,530,532,],[-22,-15,-23,-21,-13,-19,-17,-20,-16,-11,-10,-24,-12,-242,-18,-14,-290,-289,-2,-268,-267,-243,-244,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,-288,-286,-271,-249,-272,493,-291,-252,-287,-273,-247,-248,-246,-292,-253,-254,-250,-274,-251,]),'TRY':([0,2,5,7,13,19,21,28,29,31,36,43,44,45,50,58,62,65,67,68,72,75,77,111,114,115,116,126,133,143,147,148,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,379,382,410,412,414,417,429,430,435,465,466,469,471,475,484,493,494,498,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[42,-22,-15,42,-23,-21,-13,-19,-17,-20,-16,-11,42,-9,-10,-8,-24,-12,-6,42,-242,-18,-14,-7,-290,-289,-2,42,-268,-267,-243,-244,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,42,42,-288,-286,42,42,-271,42,42,-249,-272,-245,42,42,42,42,42,-291,42,-252,-287,-273,-247,-248,-246,-292,42,-253,42,42,42,42,-254,-250,-274,-251,]),'BAND':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,60,61,63,64,70,71,73,74,76,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,132,134,136,140,142,144,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,288,289,290,292,299,301,303,313,316,317,324,325,326,327,328,329,330,331,332,333,334,336,343,344,347,349,353,354,355,356,357,358,359,360,361,364,365,366,367,368,369,370,371,373,374,378,407,409,413,420,423,424,427,442,443,444,445,446,447,448,449,450,451,452,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,-174,-165,192,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,-155,-135,-113,-170,-127,-94,276,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,-160,394,-142,-172,-94,-85,-86,-72,192,-73,-166,-167,-169,-168,-153,-150,-149,-152,-151,-154,-175,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-130,-129,-128,276,-156,-157,-159,-158,-122,-123,-171,-84,-87,-71,-48,-80,-57,-66,-147,-144,-143,-146,-145,-173,394,-161,-162,-164,-163,-94,-293,-294,-295,-295,-296,-296,]),'GE':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,60,61,63,64,70,71,74,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,132,134,140,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,288,290,299,301,303,313,317,324,325,326,327,328,329,330,331,332,333,336,343,344,347,349,353,354,355,356,357,358,359,360,361,364,365,366,368,369,370,371,373,374,407,409,413,420,423,424,427,442,443,444,445,446,449,450,451,452,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,189,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,255,-135,-113,-127,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,392,-142,-94,-85,-86,-72,-73,255,255,255,255,-153,-150,-149,-152,-151,-154,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-130,-129,-128,255,255,255,255,-122,-123,-84,-87,-71,-48,-80,-57,-66,-147,-144,-143,-146,-145,255,255,255,255,-94,-293,-294,-295,-295,-296,-296,]),'REGEX':([0,2,4,5,6,7,10,11,13,19,21,23,25,26,28,29,30,31,36,40,43,44,45,48,50,54,58,62,65,67,68,72,75,77,83,84,88,89,90,92,93,94,95,98,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,160,163,164,168,170,171,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,226,236,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,308,309,310,311,312,320,321,338,339,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,412,414,416,417,428,429,430,435,437,440,441,465,466,469,471,475,480,483,484,485,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[78,-22,-1,-15,78,78,78,78,-23,-21,-13,78,78,78,-19,-17,78,-20,-16,78,-11,78,-9,78,-10,78,-8,-24,-12,-6,78,-242,-18,-14,78,78,78,78,78,78,-53,-52,-51,78,-7,-290,-289,-2,78,78,78,78,78,78,-268,-267,78,-243,-244,78,78,78,78,78,78,78,-259,-260,78,78,78,78,78,-263,-264,-25,78,78,78,78,78,78,78,78,78,78,78,78,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,78,78,-1,-54,78,78,-230,-231,78,-281,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,-269,-270,78,78,78,78,78,78,78,-285,-284,-26,-261,-262,-266,-265,-282,-283,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,-288,-286,78,78,78,78,-271,78,78,78,78,78,-249,-272,-245,78,78,78,78,78,78,78,78,78,-291,78,78,-252,-287,-273,-247,-248,-246,-292,78,-253,78,78,78,78,-254,-250,-274,-251,]),'STRNEQ':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,60,61,63,64,70,71,73,74,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,132,134,136,140,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,288,290,292,299,301,303,313,317,324,325,326,327,328,329,330,331,332,333,334,336,343,344,347,349,353,354,355,356,357,358,359,360,361,364,365,366,368,369,370,371,373,374,378,407,409,413,420,423,424,427,442,443,444,445,446,447,449,450,451,452,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,184,-165,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,-155,-135,-113,266,-127,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,-160,-142,398,-94,-85,-86,-72,-73,-166,-167,-169,-168,-153,-150,-149,-152,-151,-154,184,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-130,-129,-128,-156,-157,-159,-158,-122,-123,266,-84,-87,-71,-48,-80,-57,-66,-147,-144,-143,-146,-145,398,-161,-162,-164,-163,-94,-293,-294,-295,-295,-296,-296,]),'LPAREN':([0,2,3,4,5,6,7,8,10,11,13,15,16,19,20,21,23,24,25,26,28,29,30,31,32,36,37,38,39,40,41,43,44,45,48,49,50,52,54,57,58,61,62,63,64,65,67,68,70,71,72,75,77,78,79,80,81,83,84,85,86,87,88,89,90,92,93,94,95,96,98,102,103,105,107,108,109,110,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,154,155,158,159,160,163,164,168,169,170,171,173,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,216,218,219,220,222,226,227,228,236,237,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,301,303,307,308,309,310,311,312,313,317,320,321,322,336,338,339,340,341,343,344,347,348,349,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,412,413,414,416,417,420,423,424,427,428,429,430,435,437,440,441,465,466,469,471,474,475,480,483,484,485,487,493,494,496,498,499,502,504,506,509,512,513,514,516,517,519,520,521,522,524,525,526,527,528,530,532,],[83,-22,-28,-1,-15,83,83,-70,83,83,-23,-69,-27,-21,-42,-13,83,-41,83,83,-19,-17,83,-20,146,-16,153,-30,155,83,160,-11,83,-9,83,160,-10,170,83,175,-8,-31,-24,-32,-33,-12,-6,83,-35,-34,-242,-18,-14,-37,-36,-43,-44,83,83,-38,210,-29,83,83,83,83,-53,-52,-51,153,83,-39,160,-40,-65,-64,160,-41,-7,-290,-289,-2,83,83,83,83,83,83,-268,-267,83,-243,-244,83,83,83,83,285,83,83,-83,83,-259,-260,83,-82,83,83,160,83,83,-263,-264,-25,83,83,83,83,83,83,83,83,83,83,83,83,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,83,83,-1,-47,-46,-54,342,160,83,-79,-55,83,-78,-230,-231,83,-281,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,-269,-270,83,83,83,83,83,83,83,-85,-86,411,-285,-284,-26,-261,-262,-72,-73,-266,-265,416,-45,-282,-283,83,83,-68,-81,-56,83,-67,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,-84,83,-87,-288,-286,-71,83,83,83,-48,-80,-57,-66,83,-271,83,83,83,83,83,-249,-272,-245,83,-293,83,83,83,83,83,83,83,83,-294,-291,83,83,-252,-287,-273,-247,-248,-246,-295,-292,83,-253,83,83,83,-296,83,-254,-250,-274,-251,]),'IN':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,60,61,63,64,70,71,74,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,132,134,140,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,286,288,289,290,291,292,295,296,299,300,301,303,313,317,324,325,326,327,328,329,330,331,332,333,336,343,344,347,349,353,354,355,356,357,358,359,360,361,364,365,366,368,369,370,371,373,374,388,407,409,413,420,423,424,427,436,439,442,443,444,445,446,447,448,449,450,451,452,456,458,460,462,474,482,496,498,505,516,517,525,],[-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,191,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,257,-135,-113,-127,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,-196,-160,-178,-142,-184,-172,-190,-208,403,-202,-85,-86,-72,-73,257,257,257,257,-153,-150,-149,-152,-151,-154,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-130,-129,-128,257,257,257,257,-122,-123,440,-84,-87,-71,-48,-80,-57,-66,-191,480,-147,-144,-143,-146,-145,-173,-179,257,257,257,257,-185,-94,-209,-197,-293,-241,-294,-295,-203,-295,-296,-296,]),'VAR':([0,2,5,7,13,19,21,28,29,31,36,43,44,45,50,58,62,65,67,68,72,75,77,111,114,115,116,126,133,143,147,148,155,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,379,382,410,412,414,417,429,430,435,465,466,469,471,475,484,493,494,498,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[17,-22,-15,17,-23,-21,-13,-19,-17,-20,-16,-11,17,-9,-10,-8,-24,-12,-6,17,-242,-18,-14,-7,-290,-289,-2,17,-268,-267,-243,-244,287,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,17,17,-288,-286,17,17,-271,17,17,-249,-272,-245,17,17,17,17,17,-291,17,-252,-287,-273,-247,-248,-246,-292,17,-253,17,17,17,17,-254,-250,-274,-251,]),'MINUSMINUS':([0,2,3,4,5,6,7,8,10,11,12,13,15,16,19,20,21,23,24,25,26,28,29,30,31,36,38,40,41,43,44,45,48,49,50,58,61,62,63,64,65,67,68,70,71,72,75,77,78,79,80,81,82,83,84,85,87,88,89,90,92,93,94,95,99,101,102,103,105,107,108,109,110,111,114,115,116,120,121,122,123,124,126,133,142,143,146,147,148,149,150,151,152,155,158,159,160,163,164,168,169,170,171,172,173,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,213,215,216,218,219,221,222,226,227,228,236,237,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,299,301,303,308,309,310,311,312,313,317,320,321,336,338,339,340,341,343,344,347,348,349,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,412,413,414,416,417,420,423,424,427,428,429,430,435,437,440,441,458,465,466,469,471,474,475,480,483,484,485,487,493,494,496,498,499,502,504,506,509,512,513,514,516,517,519,520,521,522,524,525,526,527,528,530,532,],[84,-22,-28,-1,-15,84,84,-70,84,84,-92,-23,-69,-27,-21,-42,-13,84,-41,84,84,-19,-17,84,-20,-16,-30,84,-93,-11,84,-9,84,-76,-10,-8,-31,-24,-32,-33,-12,-6,84,-35,-34,-242,-18,-14,-37,-36,-43,-44,204,84,84,-38,-29,84,84,84,84,-53,-52,-51,224,-90,-39,-91,-40,-65,-64,-74,-41,-7,-290,-289,-2,84,84,84,84,84,84,-268,224,-267,84,-243,-244,84,84,84,84,84,84,-83,84,-259,-260,84,-82,84,84,-77,-74,84,84,-263,-264,-25,84,84,84,84,84,84,84,84,84,84,84,84,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,84,84,204,-1,-47,-46,-54,-75,-74,84,-79,-55,84,-78,-230,-231,84,-281,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,-269,-270,84,84,84,84,84,84,84,224,-85,-86,-285,-284,-26,-261,-262,-72,-73,-266,-265,-45,-282,-283,84,84,-68,-81,-56,84,-67,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,-84,84,-87,-288,-286,-71,84,84,84,-48,-80,-57,-66,84,-271,84,84,84,84,84,224,-249,-272,-245,84,-293,84,84,84,84,84,84,84,84,-294,-291,84,84,-252,-287,-273,-247,-248,-246,-295,-292,84,-253,84,84,84,-296,84,-254,-250,-274,-251,]),'LT':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,60,61,63,64,70,71,74,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,132,134,140,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,288,290,299,301,303,313,317,324,325,326,327,328,329,330,331,332,333,336,343,344,347,349,353,354,355,356,357,358,359,360,361,364,365,366,368,369,370,371,373,374,407,409,413,420,423,424,427,442,443,444,445,446,449,450,451,452,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,188,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,254,-135,-113,-127,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,391,-142,-94,-85,-86,-72,-73,254,254,254,254,-153,-150,-149,-152,-151,-154,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-130,-129,-128,254,254,254,254,-122,-123,-84,-87,-71,-48,-80,-57,-66,-147,-144,-143,-146,-145,254,254,254,254,-94,-293,-294,-295,-295,-296,-296,]),'EQ':([3,8,12,15,16,20,24,38,41,49,61,63,64,70,71,78,79,80,81,82,85,87,101,102,103,105,107,108,109,110,118,142,159,169,172,173,216,218,221,222,227,228,237,299,301,303,313,317,336,343,344,347,349,388,407,409,413,420,423,424,427,458,474,479,496,498,516,517,525,],[-28,-70,-92,-69,-27,-42,-41,-30,-93,-76,-31,-32,-33,-35,-34,-37,-36,-43,-44,205,-38,-29,-90,-39,-91,-40,-65,-64,-74,-41,241,205,-83,-82,-77,-74,-47,-46,-75,-74,-79,-55,-78,205,-85,-86,-72,-73,-45,-68,-81,-56,-67,441,-84,-87,-71,-48,-80,-57,-66,205,-293,441,-294,-295,-295,-296,-296,]),'ID':([0,2,4,5,6,7,10,11,13,17,19,21,23,25,26,28,29,30,31,36,37,40,43,44,45,47,48,50,54,58,62,65,66,67,68,72,75,77,83,84,88,89,90,92,93,94,95,96,98,104,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,153,155,157,158,160,163,164,167,168,170,171,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,225,226,235,236,238,239,240,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,285,287,308,309,310,311,312,320,321,338,339,340,341,342,346,348,379,381,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,411,412,414,416,417,428,429,430,435,437,438,440,441,465,466,469,471,475,480,483,484,485,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[85,-22,-1,-15,85,85,85,85,-23,85,-21,-13,85,85,85,-19,-17,85,-20,-16,85,85,-11,85,-9,85,85,-10,85,-8,-24,-12,85,-6,85,-242,-18,-14,85,85,85,85,85,85,-53,-52,-51,85,85,85,-7,-290,-289,-2,85,85,85,85,85,85,-268,-267,85,-243,-244,85,85,85,85,85,85,85,85,85,-259,-260,85,85,85,85,85,85,-263,-264,-25,85,85,85,85,85,85,85,85,85,85,85,85,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,85,85,-1,-54,85,85,85,85,-230,-231,85,85,-281,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,-269,-270,85,85,85,85,85,85,85,85,85,-285,-284,-26,-261,-262,-266,-265,-282,-283,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,-288,85,-286,85,85,85,85,-271,85,85,85,85,85,85,-249,-272,-245,85,85,85,85,85,85,85,85,85,-291,85,85,-252,-287,-273,-247,-248,-246,-292,85,-253,85,85,85,85,-254,-250,-274,-251,]),'IF':([0,2,5,7,13,19,21,28,29,31,36,43,44,45,50,58,62,65,67,68,72,75,77,111,114,115,116,126,133,143,147,148,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,379,382,410,412,414,417,429,430,435,465,466,469,471,475,484,493,494,498,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[86,-22,-15,86,-23,-21,-13,-19,-17,-20,-16,-11,86,-9,-10,-8,-24,-12,-6,86,-242,-18,-14,-7,-290,-289,-2,86,-268,-267,-243,-244,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,86,86,-288,-286,86,86,-271,86,86,-249,-272,-245,86,86,86,86,86,-291,86,-252,-287,-273,-247,-248,-246,-292,86,-253,86,86,86,86,-254,-250,-274,-251,]),'AND':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,53,56,60,61,63,64,69,70,71,73,74,76,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,130,131,132,134,135,136,140,142,144,145,156,159,166,169,172,173,196,204,209,213,214,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,286,288,289,290,291,292,295,299,301,303,313,316,317,318,323,324,325,326,327,328,329,330,331,332,333,334,336,343,344,347,349,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,373,374,376,378,407,409,413,420,423,424,427,436,442,443,444,445,446,447,448,449,450,451,452,456,458,462,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,-186,174,-102,-31,-32,-33,-192,-35,-34,-174,-165,-180,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,-155,-188,259,-135,-113,-182,-170,-127,-94,-176,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,174,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,385,-160,-178,-142,-184,-172,-190,-94,-85,-86,-72,-181,-73,-193,-187,-166,-167,-169,-168,-153,-150,-149,-152,-151,-154,-175,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-183,-189,-130,-129,-128,-177,-156,-157,-159,-158,-122,-123,259,-171,-84,-87,-71,-48,-80,-57,-66,-191,-147,-144,-143,-146,-145,-173,-179,-161,-162,-164,-163,-185,-94,385,-293,-294,-295,-295,-296,-296,]),'LBRACE':([0,2,4,5,6,7,10,11,13,19,21,23,25,26,28,29,30,31,36,40,42,43,44,45,48,50,54,58,62,65,67,68,72,75,77,83,84,88,89,92,93,94,95,98,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,160,163,164,168,170,175,176,177,179,182,183,184,185,186,187,188,189,190,191,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,226,236,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,283,306,308,309,310,311,312,320,321,338,339,340,341,348,379,380,382,384,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,412,414,415,416,417,422,428,429,430,434,435,437,440,441,465,466,469,470,471,475,480,483,484,485,486,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[44,-22,-1,-15,104,44,104,104,-23,-21,-13,104,104,104,-19,-17,104,-20,-16,104,44,-11,44,-9,104,-10,104,-8,-24,-12,-6,44,-242,-18,-14,104,104,104,104,104,-53,-52,-51,104,-7,-290,-289,-2,104,104,104,104,104,44,-268,-267,104,-243,-244,104,104,104,104,104,104,104,-259,-260,104,104,104,-263,-264,-25,104,104,104,104,104,104,104,104,104,104,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,104,104,-1,-54,104,104,-230,-231,104,-281,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,-269,-270,104,104,104,104,104,104,104,382,44,-285,-284,-26,-261,-262,-266,-265,-282,-283,104,104,104,44,430,44,435,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,-288,-286,44,467,104,44,471,104,-271,44,475,44,104,104,104,-249,-272,-245,494,44,44,104,104,44,104,44,104,44,44,-291,104,44,-252,-287,-273,-247,-248,-246,-292,44,-253,44,44,44,44,-254,-250,-274,-251,]),'FALSE':([0,2,4,5,6,7,10,11,13,19,21,23,25,26,28,29,30,31,36,40,43,44,45,48,50,54,58,62,65,67,68,72,75,77,83,84,88,89,90,92,93,94,95,98,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,160,163,164,168,170,171,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,226,236,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,308,309,310,311,312,320,321,338,339,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,412,414,416,417,428,429,430,435,437,440,441,465,466,469,471,475,480,483,484,485,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[64,-22,-1,-15,64,64,64,64,-23,-21,-13,64,64,64,-19,-17,64,-20,-16,64,-11,64,-9,64,-10,64,-8,-24,-12,-6,64,-242,-18,-14,64,64,64,64,64,64,-53,-52,-51,64,-7,-290,-289,-2,64,64,64,64,64,64,-268,-267,64,-243,-244,64,64,64,64,64,64,64,-259,-260,64,64,64,64,64,-263,-264,-25,64,64,64,64,64,64,64,64,64,64,64,64,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,64,64,-1,-54,64,64,-230,-231,64,-281,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,-269,-270,64,64,64,64,64,64,64,-285,-284,-26,-261,-262,-266,-265,-282,-283,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,-288,-286,64,64,64,64,-271,64,64,64,64,64,-249,-272,-245,64,64,64,64,64,64,64,64,64,-291,64,64,-252,-287,-273,-247,-248,-246,-292,64,-253,64,64,64,64,-254,-250,-274,-251,]),'RSHIFT':([3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,60,61,63,64,70,71,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,132,134,140,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,290,299,301,303,313,317,328,329,330,331,332,333,336,343,344,347,349,353,354,355,356,357,358,359,360,361,364,365,366,373,374,407,409,413,420,423,424,427,442,443,444,445,446,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,121,-42,-131,-41,-117,-124,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,261,-113,-127,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,261,-94,-85,-86,-72,-73,261,261,261,261,261,261,-45,-68,-81,-56,-67,-115,-116,-114,261,261,261,261,261,261,-130,-129,-128,-122,-123,-84,-87,-71,-48,-80,-57,-66,261,261,261,261,261,-94,-293,-294,-295,-295,-296,-296,]),'PLUSEQUAL':([3,8,12,15,16,20,24,38,41,49,61,63,64,70,71,78,79,80,81,82,85,87,101,102,103,105,107,108,109,110,142,159,169,172,173,216,218,221,222,227,228,237,299,301,303,313,317,336,343,344,347,349,407,409,413,420,423,424,427,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-42,-41,-30,-93,-76,-31,-32,-33,-35,-34,-37,-36,-43,-44,201,-38,-29,-90,-39,-91,-40,-65,-64,-74,-41,201,-83,-82,-77,-74,-47,-46,-75,-74,-79,-55,-78,201,-85,-86,-72,-73,-45,-68,-81,-56,-67,-84,-87,-71,-48,-80,-57,-66,201,-293,-294,-295,-295,-296,-296,]),'THIS':([0,2,4,5,6,7,10,11,13,19,21,23,25,26,28,29,30,31,36,40,43,44,45,48,50,54,58,62,65,67,68,72,75,77,83,84,88,89,90,92,93,94,95,98,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,160,163,164,168,170,171,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,226,236,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,308,309,310,311,312,320,321,338,339,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,412,414,416,417,428,429,430,435,437,440,441,465,466,469,471,475,480,483,484,485,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[20,-22,-1,-15,20,20,20,20,-23,-21,-13,20,20,20,-19,-17,20,-20,-16,20,-11,20,-9,20,-10,20,-8,-24,-12,-6,20,-242,-18,-14,20,20,20,20,20,20,-53,-52,-51,20,-7,-290,-289,-2,20,20,20,20,20,20,-268,-267,20,-243,-244,20,20,20,20,20,20,20,-259,-260,20,20,20,20,20,-263,-264,-25,20,20,20,20,20,20,20,20,20,20,20,20,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,20,20,-1,-54,20,20,-230,-231,20,-281,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,-269,-270,20,20,20,20,20,20,20,-285,-284,-26,-261,-262,-266,-265,-282,-283,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,-288,-286,20,20,20,20,-271,20,20,20,20,20,-249,-272,-245,20,20,20,20,20,20,20,20,20,-291,20,20,-252,-287,-273,-247,-248,-246,-292,20,-253,20,20,20,20,-254,-250,-274,-251,]),'MINUSEQUAL':([3,8,12,15,16,20,24,38,41,49,61,63,64,70,71,78,79,80,81,82,85,87,101,102,103,105,107,108,109,110,142,159,169,172,173,216,218,221,222,227,228,237,299,301,303,313,317,336,343,344,347,349,407,409,413,420,423,424,427,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-42,-41,-30,-93,-76,-31,-32,-33,-35,-34,-37,-36,-43,-44,197,-38,-29,-90,-39,-91,-40,-65,-64,-74,-41,197,-83,-82,-77,-74,-47,-46,-75,-74,-79,-55,-78,197,-85,-86,-72,-73,-45,-68,-81,-56,-67,-84,-87,-71,-48,-80,-57,-66,197,-293,-294,-295,-295,-296,-296,]),'CONDOP':([1,3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,53,56,60,61,63,64,69,70,71,73,74,76,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,130,131,132,134,135,136,140,141,142,144,145,156,159,166,169,172,173,196,204,209,213,214,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,286,288,289,290,291,292,295,299,300,301,303,313,316,317,318,323,324,325,326,327,328,329,330,331,332,333,334,336,343,344,347,349,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,373,374,376,378,407,409,413,420,423,424,427,436,442,443,444,445,446,447,448,449,450,451,452,456,458,462,474,496,498,516,517,525,],[89,-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,-186,-198,-102,-31,-32,-33,-192,-35,-34,-174,-165,-180,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,-155,-188,-194,-135,-113,-182,-170,-127,273,-94,-176,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-199,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,-196,-160,-178,-142,-184,-172,-190,-94,405,-85,-86,-72,-181,-73,-193,-187,-166,-167,-169,-168,-153,-150,-149,-152,-151,-154,-175,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-183,-189,-130,-129,-128,-177,-156,-157,-159,-158,-122,-123,-195,-171,-84,-87,-71,-48,-80,-57,-66,-191,-147,-144,-143,-146,-145,-173,-179,-161,-162,-164,-163,-185,-94,-197,-293,-294,-295,-295,-296,-296,]),'XOREQUAL':([3,8,12,15,16,20,24,38,41,49,61,63,64,70,71,78,79,80,81,82,85,87,101,102,103,105,107,108,109,110,142,159,169,172,173,216,218,221,222,227,228,237,299,301,303,313,317,336,343,344,347,349,407,409,413,420,423,424,427,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-42,-41,-30,-93,-76,-31,-32,-33,-35,-34,-37,-36,-43,-44,199,-38,-29,-90,-39,-91,-40,-65,-64,-74,-41,199,-83,-82,-77,-74,-47,-46,-75,-74,-79,-55,-78,199,-85,-86,-72,-73,-45,-68,-81,-56,-67,-84,-87,-71,-48,-80,-57,-66,199,-293,-294,-295,-295,-296,-296,]),'OR':([1,3,8,12,15,16,18,20,22,24,27,35,38,41,46,49,53,56,60,61,63,64,69,70,71,73,74,76,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,130,131,132,134,135,136,140,141,142,144,145,156,159,166,169,172,173,196,204,209,213,214,216,218,221,222,223,224,227,228,237,243,244,245,246,247,279,280,281,286,288,289,290,291,292,295,299,300,301,303,313,316,317,318,323,324,325,326,327,328,329,330,331,332,333,334,336,343,344,347,349,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,373,374,376,378,407,409,413,420,423,424,427,436,442,443,444,445,446,447,448,449,450,451,452,456,458,462,474,496,498,516,517,525,],[90,-28,-70,-92,-69,-27,-148,-42,-131,-41,-117,-124,-30,-93,-103,-76,-186,-198,-102,-31,-32,-33,-192,-35,-34,-174,-165,-180,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,-155,-188,-194,-135,-113,-182,-170,-127,274,-94,-176,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-199,-47,-46,-75,-74,-95,-96,-79,-55,-78,-134,-133,-132,-125,-126,-120,-119,-118,-196,-160,-178,-142,-184,-172,-190,-94,406,-85,-86,-72,-181,-73,-193,-187,-166,-167,-169,-168,-153,-150,-149,-152,-151,-154,-175,-45,-68,-81,-56,-67,-115,-116,-114,-140,-137,-136,-139,-138,-141,-183,-189,-130,-129,-128,-177,-156,-157,-159,-158,-122,-123,-195,-171,-84,-87,-71,-48,-80,-57,-66,-191,-147,-144,-143,-146,-145,-173,-179,-161,-162,-164,-163,-185,-94,-197,-293,-294,-295,-295,-296,-296,]),'BREAK':([0,2,5,7,13,19,21,28,29,31,36,43,44,45,50,58,62,65,67,68,72,75,77,111,114,115,116,126,133,143,147,148,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,379,382,410,412,414,417,429,430,435,465,466,469,471,475,484,493,494,498,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[66,-22,-15,66,-23,-21,-13,-19,-17,-20,-16,-11,66,-9,-10,-8,-24,-12,-6,66,-242,-18,-14,-7,-290,-289,-2,66,-268,-267,-243,-244,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,66,66,-288,-286,66,66,-271,66,66,-249,-272,-245,66,66,66,66,66,-291,66,-252,-287,-273,-247,-248,-246,-292,66,-253,66,66,66,66,-254,-250,-274,-251,]),'URSHIFTEQUAL':([3,8,12,15,16,20,24,38,41,49,61,63,64,70,71,78,79,80,81,82,85,87,101,102,103,105,107,108,109,110,142,159,169,172,173,216,218,221,222,227,228,237,299,301,303,313,317,336,343,344,347,349,407,409,413,420,423,424,427,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-42,-41,-30,-93,-76,-31,-32,-33,-35,-34,-37,-36,-43,-44,195,-38,-29,-90,-39,-91,-40,-65,-64,-74,-41,195,-83,-82,-77,-74,-47,-46,-75,-74,-79,-55,-78,195,-85,-86,-72,-73,-45,-68,-81,-56,-67,-84,-87,-71,-48,-80,-57,-66,195,-293,-294,-295,-295,-296,-296,]),'CONTINUE':([0,2,5,7,13,19,21,28,29,31,36,43,44,45,50,58,62,65,67,68,72,75,77,111,114,115,116,126,133,143,147,148,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,379,382,410,412,414,417,429,430,435,465,466,469,471,475,484,493,494,498,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[47,-22,-15,47,-23,-21,-13,-19,-17,-20,-16,-11,47,-9,-10,-8,-24,-12,-6,47,-242,-18,-14,-7,-290,-289,-2,47,-268,-267,-243,-244,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,47,47,-288,-286,47,47,-271,47,47,-249,-272,-245,47,47,47,47,47,-291,47,-252,-287,-273,-247,-248,-246,-292,47,-253,47,47,47,47,-254,-250,-274,-251,]),'TYPEOF':([0,2,4,5,6,7,10,11,13,19,21,23,25,26,28,29,30,31,36,40,43,44,45,48,50,58,62,65,67,68,72,75,77,83,84,88,89,90,92,93,94,95,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,160,163,164,168,170,171,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,226,236,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,308,309,310,311,312,320,321,338,339,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,412,414,416,417,428,429,430,435,437,440,441,465,466,469,471,475,480,483,484,485,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[23,-22,-1,-15,23,23,23,23,-23,-21,-13,23,23,23,-19,-17,23,-20,-16,23,-11,23,-9,23,-10,-8,-24,-12,-6,23,-242,-18,-14,23,23,23,23,23,23,-53,-52,-51,-7,-290,-289,-2,23,23,23,23,23,23,-268,-267,23,-243,-244,23,23,23,23,23,23,23,-259,-260,23,23,23,23,23,-263,-264,-25,23,23,23,23,23,23,23,23,23,23,23,23,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,23,23,-1,-54,23,23,-230,-231,23,-281,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,-269,-270,23,23,23,23,23,23,23,-285,-284,-26,-261,-262,-266,-265,-282,-283,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,-288,-286,23,23,23,23,-271,23,23,23,23,23,-249,-272,-245,23,23,23,23,23,23,23,23,23,-291,23,23,-252,-287,-273,-247,-248,-246,-292,23,-253,23,23,23,23,-254,-250,-274,-251,]),'error':([1,3,8,12,14,15,16,18,20,22,24,26,27,34,35,38,41,46,47,49,51,53,55,56,60,61,63,64,66,69,70,71,73,74,76,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,117,118,119,125,127,128,129,130,131,132,134,135,136,137,138,139,140,141,142,144,145,156,159,165,166,169,172,173,178,196,204,209,211,213,214,216,218,221,222,223,224,227,228,237,242,243,244,245,246,247,278,279,280,281,301,303,313,316,317,318,323,324,325,326,327,328,329,330,331,332,333,334,335,336,343,344,347,349,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,376,377,378,407,409,413,418,420,423,424,427,472,474,492,496,498,516,517,525,],[-204,-28,-70,-92,116,-69,-27,-148,-42,-131,-41,116,-117,116,-124,-30,-93,-103,116,-76,-228,-186,-210,-198,-102,-31,-32,-33,116,-192,-35,-34,-174,-165,-180,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,116,-236,-232,-106,-104,-121,-155,-188,-194,-135,-113,-182,-170,-206,116,-224,-127,-200,-94,-176,-111,-107,-83,116,-112,-82,-77,-74,116,-98,-99,-108,116,-97,-199,-47,-46,-75,-74,-95,-96,-79,-55,-78,-237,-134,-133,-132,-125,-126,-229,-120,-119,-118,-85,-86,-72,-181,-73,-193,-187,-166,-167,-169,-168,-153,-150,-149,-152,-151,-154,-175,-211,-45,-68,-81,-56,-67,-233,-240,-115,-116,-114,-140,-137,-136,-139,-138,-141,-183,-189,-130,-129,-128,-177,-156,-157,-159,-158,-225,-122,-123,-195,-207,-171,-84,-87,-71,-205,-48,-80,-57,-66,-201,-293,116,-294,-295,-295,-296,-296,]),'NOT':([0,2,4,5,6,7,10,11,13,19,21,23,25,26,28,29,30,31,36,40,43,44,45,48,50,58,62,65,67,68,72,75,77,83,84,88,89,90,92,93,94,95,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,160,163,164,168,170,171,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,226,236,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,308,309,310,311,312,320,321,338,339,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,412,414,416,417,428,429,430,435,437,440,441,465,466,469,471,475,480,483,484,485,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[48,-22,-1,-15,48,48,48,48,-23,-21,-13,48,48,48,-19,-17,48,-20,-16,48,-11,48,-9,48,-10,-8,-24,-12,-6,48,-242,-18,-14,48,48,48,48,48,48,-53,-52,-51,-7,-290,-289,-2,48,48,48,48,48,48,-268,-267,48,-243,-244,48,48,48,48,48,48,48,-259,-260,48,48,48,48,48,-263,-264,-25,48,48,48,48,48,48,48,48,48,48,48,48,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,48,48,-1,-54,48,48,-230,-231,48,-281,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,-269,-270,48,48,48,48,48,48,48,-285,-284,-26,-261,-262,-266,-265,-282,-283,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,-288,-286,48,48,48,48,-271,48,48,48,48,48,-249,-272,-245,48,48,48,48,48,48,48,48,48,-291,48,48,-252,-287,-273,-247,-248,-246,-292,48,-253,48,48,48,48,-254,-250,-274,-251,]),'ANDEQUAL':([3,8,12,15,16,20,24,38,41,49,61,63,64,70,71,78,79,80,81,82,85,87,101,102,103,105,107,108,109,110,142,159,169,172,173,216,218,221,222,227,228,237,299,301,303,313,317,336,343,344,347,349,407,409,413,420,423,424,427,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-42,-41,-30,-93,-76,-31,-32,-33,-35,-34,-37,-36,-43,-44,203,-38,-29,-90,-39,-91,-40,-65,-64,-74,-41,203,-83,-82,-77,-74,-47,-46,-75,-74,-79,-55,-78,203,-85,-86,-72,-73,-45,-68,-81,-56,-67,-84,-87,-71,-48,-80,-57,-66,203,-293,-294,-295,-295,-296,-296,]),'RBRACKET':([3,4,16,20,38,61,63,64,70,71,78,79,80,81,85,87,91,92,93,94,95,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,129,130,131,132,134,135,136,137,139,140,141,142,144,145,156,166,209,215,216,217,218,219,221,222,223,224,227,228,237,302,303,314,336,341,343,344,345,347,349,350,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,376,377,378,409,419,420,423,424,427,472,474,496,516,525,],[-28,-1,-27,-42,-30,-31,-32,-33,-35,-34,-37,-36,-43,-44,-38,-29,216,218,-53,-52,-51,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,-121,-155,-188,-194,-135,-113,-182,-170,-206,-224,-127,-200,-94,-176,-111,-107,-112,-108,-1,-47,-49,-46,-54,-75,-74,-95,-96,-79,-55,-78,407,-86,413,-45,420,-68,-81,423,-56,-67,427,-115,-116,-114,-140,-137,-136,-139,-138,-141,-183,-189,-130,-129,-128,-177,-156,-157,-159,-158,-225,-122,-123,-195,-207,-171,-87,-50,-48,-80,-57,-66,-201,-293,-294,-295,-296,]),'MOD':([3,8,12,15,16,20,24,27,35,38,41,46,49,60,61,63,64,70,71,78,79,80,81,82,85,87,97,99,100,101,102,103,105,106,107,108,109,110,112,113,125,127,128,134,142,145,156,159,166,169,172,173,196,204,209,213,216,218,221,222,223,224,227,228,237,246,247,279,280,281,299,301,303,313,317,336,343,344,347,349,353,354,355,373,374,407,409,413,420,423,424,427,458,474,496,498,516,517,525,],[-28,-70,-92,-69,-27,-42,-41,-117,150,-30,-93,-103,-76,-102,-31,-32,-33,-35,-34,-37,-36,-43,-44,-97,-38,-29,-110,-94,-100,-90,-39,-91,-40,-101,-65,-64,-74,-41,-109,-105,-106,-104,250,-113,-94,-111,-107,-83,-112,-82,-77,-74,-98,-99,-108,-97,-47,-46,-75,-74,-95,-96,-79,-55,-78,250,250,-120,-119,-118,-94,-85,-86,-72,-73,-45,-68,-81,-56,-67,-115,-116,-114,250,250,-84,-87,-71,-48,-80,-57,-66,-94,-293,-294,-295,-295,-296,-296,]),'THROW':([0,2,5,7,13,19,21,28,29,31,36,43,44,45,50,58,62,65,67,68,72,75,77,111,114,115,116,126,133,143,147,148,163,164,176,177,179,238,239,248,268,269,308,309,310,311,312,320,321,338,339,379,382,410,412,414,417,429,430,435,465,466,469,471,475,484,493,494,498,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[88,-22,-15,88,-23,-21,-13,-19,-17,-20,-16,-11,88,-9,-10,-8,-24,-12,-6,88,-242,-18,-14,-7,-290,-289,-2,88,-268,-267,-243,-244,-259,-260,-263,-264,-25,-230,-231,-281,-269,-270,-285,-284,-26,-261,-262,-266,-265,-282,-283,88,88,-288,-286,88,88,-271,88,88,-249,-272,-245,88,88,88,88,88,-291,88,-252,-287,-273,-247,-248,-246,-292,88,-253,88,88,88,88,-254,-250,-274,-251,]),'DELETE':([0,2,4,5,6,7,10,11,13,19,21,23,25,26,28,29,30,31,36,40,43,44,45,48,50,58,62,65,67,68,72,75,77,83,84,88,89,90,92,93,94,95,111,114,115,116,120,121,122,123,124,126,133,143,146,147,148,149,150,151,152,155,158,160,163,164,168,170,171,174,175,176,177,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,197,198,199,200,201,202,203,205,206,207,210,215,219,226,236,238,239,241,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,308,309,310,311,312,320,321,338,339,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,410,412,414,416,417,428,429,430,435,437,440,441,465,466,469,471,475,480,483,484,485,487,493,494,498,499,502,504,506,509,512,513,514,517,519,520,521,522,524,526,527,528,530,532,],[25,-22,-1,-15,25,25,25,25,-23,-21,-13,25,25,25,-19,-17,25,-20,-16,25,-11,25,-9,25,-10,-8,-24,-12,-6,25,-242,-18,-14,25,25,25,25,25,25,-53,-52,-51,-7,-290,-289,-2,25,25,25,25,25,25,-268,-267,25,-243,-244,25,25,25,25,25,25,25,-259,-260,25,25,25,25,25,-263,-264,-25,25,25,25,25,25,25,25,25,25,25,25,25,-214,-219,-220,-217,-215,-222,-213,-216,-218,-221,-212,-223,25,25,-1,-54,25,25,-230,-231,25,-281,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,-269,-270,25,25,25,25,25,25,25,-285,-284,-26,-261,-262,-266,-265,-282,-283,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,-288,-286,25,25,25,25,-271,25,25,25,25,25,-249,-272,-245,25,25,25,25,25,25,25,25,25,-291,25,25,-252,-287,-273,-247,-248,-246,-292,25,-253,25,25,25,25,-254,-250,-274,-251,]),} _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 = {'logical_or_expr_nobf':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'throw_statement':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,]),'boolean_literal':([0,6,7,10,11,23,25,26,30,40,44,48,54,68,83,84,88,89,90,92,98,120,121,122,123,124,126,146,149,150,151,152,155,158,160,168,170,171,174,175,181,182,183,184,185,186,187,188,189,190,191,192,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,414,416,417,428,430,435,437,440,441,471,475,480,483,484,485,487,493,494,499,502,519,521,522,524,526,],[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,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,]),'bitwise_or_expr':([26,83,88,89,92,146,149,158,160,168,170,175,207,210,226,236,241,259,270,273,274,275,340,341,348,400,403,408,416,428,437,440,480,483,487,499,],[130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,363,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'property_assignment':([104,346,],[231,425,]),'logical_and_expr_noin':([155,402,404,405,406,441,485,],[286,286,286,286,462,286,286,]),'iteration_statement':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'variable_declaration_noin':([287,438,],[386,478,]),'source_element_list':([0,44,382,430,435,471,475,494,522,524,],[7,7,7,7,7,7,7,7,7,7,]),'function_expr':([0,6,7,10,11,23,25,26,30,40,44,48,54,68,83,84,88,89,90,92,98,120,121,122,123,124,126,146,149,150,151,152,155,158,160,168,170,171,174,175,181,182,183,184,185,186,187,188,189,190,191,192,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,414,416,417,428,430,435,437,440,441,471,475,480,483,484,485,487,493,494,499,502,519,521,522,524,526,],[8,107,8,107,107,107,107,107,107,107,8,107,107,8,107,107,107,107,8,107,107,107,107,107,107,107,8,107,107,107,107,107,107,107,107,107,107,8,8,107,8,107,107,107,107,107,107,107,107,107,107,8,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,107,107,107,107,107,8,8,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,8,107,8,107,8,8,107,107,107,8,8,107,107,8,107,107,8,8,107,8,8,8,8,8,8,]),'multiplicative_expr':([26,83,88,89,92,120,121,122,123,124,146,149,155,158,160,168,170,175,182,183,184,185,186,187,188,189,190,191,207,210,226,236,241,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,416,428,437,440,441,480,483,485,487,499,],[128,128,128,128,128,128,128,128,246,247,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,373,374,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,]),'finally':([161,309,],[308,412,]),'program':([0,],[9,]),'case_block':([415,],[466,]),'formal_parameter_list':([153,285,342,],[282,383,421,]),'new_expr_nobf':([0,7,44,68,90,126,171,174,181,192,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,]),'try_statement':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,]),'element_list':([4,],[91,]),'relational_expr':([26,83,88,89,92,146,149,158,160,168,170,175,182,183,184,185,207,210,226,236,241,258,259,263,264,265,266,267,270,273,274,275,276,340,341,348,396,397,398,399,400,403,408,416,428,437,440,480,483,487,499,],[129,129,129,129,129,129,129,129,129,129,129,129,324,325,326,327,129,129,129,129,129,129,129,129,368,369,370,371,129,129,129,129,129,129,129,129,449,450,451,452,129,129,129,129,129,129,129,129,129,129,129,]),'primary_expr_no_brace':([0,6,7,10,11,23,25,26,30,40,44,48,54,68,83,84,88,89,90,92,98,120,121,122,123,124,126,146,149,150,151,152,155,158,160,168,170,171,174,175,181,182,183,184,185,186,187,188,189,190,191,192,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,414,416,417,428,430,435,437,440,441,471,475,480,483,484,485,487,493,494,499,502,519,521,522,524,526,],[15,102,15,102,102,102,102,102,102,102,15,102,102,15,102,102,102,102,15,102,102,102,102,102,102,102,15,102,102,102,102,102,102,102,102,102,102,15,15,102,15,102,102,102,102,102,102,102,102,102,102,15,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,15,15,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,15,102,15,102,15,15,102,102,102,15,15,102,102,15,102,102,15,15,102,15,15,15,15,15,15,]),'variable_declaration_list_noin':([287,],[387,]),'null_literal':([0,6,7,10,11,23,25,26,30,40,44,48,54,68,83,84,88,89,90,92,98,120,121,122,123,124,126,146,149,150,151,152,155,158,160,168,170,171,174,175,181,182,183,184,185,186,187,188,189,190,191,192,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,414,416,417,428,430,435,437,440,441,471,475,480,483,484,485,487,493,494,499,502,519,521,522,524,526,],[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,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,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,]),'labelled_statement':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,]),'expr_statement':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,]),'logical_and_expr':([26,83,88,89,92,146,149,158,160,168,170,175,207,210,226,236,241,270,273,274,275,340,341,348,400,403,408,416,428,437,440,480,483,487,499,],[131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,376,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,]),'additive_expr_nobf':([0,7,44,68,90,126,171,174,181,192,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,]),'primary_expr':([6,10,11,23,25,26,30,40,48,54,83,84,88,89,92,98,120,121,122,123,124,146,149,150,151,152,155,158,160,168,170,175,182,183,184,185,186,187,188,189,190,191,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,416,428,437,440,441,480,483,485,487,499,],[108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,]),'identifier':([0,6,7,10,11,17,23,25,26,30,37,40,44,47,48,54,66,68,83,84,88,89,90,92,96,98,104,120,121,122,123,124,126,146,149,150,151,152,153,155,157,158,160,167,168,170,171,174,175,181,182,183,184,185,186,187,188,189,190,191,192,207,210,225,226,235,236,240,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,285,287,340,341,342,346,348,379,381,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,411,414,416,417,428,430,435,437,438,440,441,471,475,480,483,484,485,487,493,494,499,502,519,521,522,524,526,],[24,110,24,110,110,118,110,110,110,110,154,110,24,165,110,110,178,24,110,110,110,110,110,110,220,110,232,110,110,110,110,110,24,110,110,110,110,110,284,110,301,110,110,313,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,344,110,349,110,118,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,284,388,110,110,284,232,110,24,431,24,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,464,24,110,24,110,24,24,110,479,110,110,24,24,110,110,24,110,110,24,24,110,24,24,24,24,24,24,]),'bitwise_xor_expr_nobf':([0,7,44,68,90,126,174,181,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[53,53,53,53,53,53,53,323,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,]),'relational_expr_noin':([155,385,394,395,401,402,404,405,406,441,485,],[288,288,288,288,288,288,288,288,288,288,288,]),'with_statement':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,]),'case_clauses_opt':([467,510,],[489,523,]),'initializer':([118,],[242,]),'break_statement':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'bitwise_and_expr_noin':([155,385,395,401,402,404,405,406,441,485,],[289,289,448,289,289,289,289,289,289,289,]),'switch_statement':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,]),'property_list':([104,],[229,]),'postfix_expr':([6,10,11,23,25,26,30,40,48,83,84,88,89,92,120,121,122,123,124,146,149,150,151,152,155,158,160,168,170,175,182,183,184,185,186,187,188,189,190,191,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,416,428,437,440,441,480,483,485,487,499,],[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,]),'source_elements':([0,44,382,430,435,471,475,494,522,524,],[33,162,432,432,432,432,432,432,529,531,]),'shift_expr':([26,83,88,89,92,146,149,155,158,160,168,170,175,182,183,184,185,186,187,188,189,190,191,207,210,226,236,241,252,253,254,255,256,257,258,259,263,264,265,266,267,270,273,274,275,276,340,341,348,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,416,428,437,440,441,480,483,485,487,499,],[132,132,132,132,132,132,132,290,132,132,132,132,132,132,132,132,132,328,329,330,331,332,333,132,132,132,132,132,356,357,358,359,360,361,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,290,442,443,444,445,446,290,290,132,132,132,132,132,290,290,132,290,290,290,132,132,132,132,132,290,132,132,290,132,132,]),'expr_nobf':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,]),'expr_opt':([400,437,483,499,],[453,477,503,518,]),'multiplicative_expr_nobf':([0,7,44,68,90,126,171,174,181,192,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[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,]),'continue_statement':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,]),'argument_list':([160,],[304,]),'expr_noin_opt':([155,],[294,]),'string_literal':([0,6,7,10,11,23,25,26,30,40,44,48,54,68,83,84,88,89,90,92,98,104,120,121,122,123,124,126,146,149,150,151,152,155,158,160,168,170,171,174,175,181,182,183,184,185,186,187,188,189,190,191,192,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,346,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,414,416,417,428,430,435,437,440,441,471,475,480,483,484,485,487,493,494,499,502,519,521,522,524,526,],[38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,234,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,234,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,]),'call_expr_nobf':([0,7,44,68,90,126,171,174,181,192,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,]),'bitwise_xor_expr_noin':([155,385,401,402,404,405,406,441,485,],[291,291,456,291,291,291,291,291,291,]),'variable_statement':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,]),'object_literal':([6,10,11,23,25,26,30,40,48,54,83,84,88,89,92,98,120,121,122,123,124,146,149,150,151,152,155,158,160,168,170,175,182,183,184,185,186,187,188,189,190,191,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,416,428,437,440,441,480,483,485,487,499,],[105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,]),'function_declaration':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[45,45,45,179,179,179,45,179,179,45,45,45,45,179,179,45,179,179,179,45,45,179,]),'unary_expr_common':([0,6,7,10,11,23,25,26,30,40,44,48,68,83,84,88,89,90,92,120,121,122,123,124,126,146,149,150,151,152,155,158,160,168,170,171,174,175,181,182,183,184,185,186,187,188,189,190,191,192,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,414,416,417,428,430,435,437,440,441,471,475,480,483,484,485,487,493,494,499,502,519,521,522,524,526,],[46,106,46,106,106,106,106,106,106,106,46,106,46,106,106,106,106,46,106,106,106,106,106,106,46,106,106,106,106,106,106,106,106,106,106,46,46,106,46,106,106,106,106,106,106,106,106,106,106,46,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,46,46,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,46,106,46,106,46,46,106,106,106,46,46,106,106,46,106,106,46,46,106,46,46,46,46,46,46,]),'additive_expr':([26,83,88,89,92,120,121,122,146,149,155,158,160,168,170,175,182,183,184,185,186,187,188,189,190,191,207,210,226,236,241,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,273,274,275,276,340,341,348,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,416,428,437,440,441,480,483,485,487,499,],[140,140,140,140,140,243,244,245,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,364,365,366,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,]),'assignment_operator':([82,142,299,458,],[207,275,404,404,]),'case_clause':([467,488,510,],[490,508,490,]),'member_expr_nobf':([0,7,44,68,90,126,171,174,181,192,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,]),'numeric_literal':([0,6,7,10,11,23,25,26,30,40,44,48,54,68,83,84,88,89,90,92,98,104,120,121,122,123,124,126,146,149,150,151,152,155,158,160,168,170,171,174,175,181,182,183,184,185,186,187,188,189,190,191,192,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,346,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,414,416,417,428,430,435,437,440,441,471,475,480,483,484,485,487,493,494,499,502,519,521,522,524,526,],[87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,230,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,87,87,87,87,87,87,87,87,87,87,87,87,87,87,230,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,]),'assignment_expr_nobf':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,]),'equality_expr_noin':([155,385,394,395,401,402,404,405,406,441,485,],[292,292,447,292,292,292,292,292,292,292,292,]),'unary_expr':([6,10,11,23,25,26,30,40,48,83,84,88,89,92,120,121,122,123,124,146,149,150,151,152,155,158,160,168,170,175,182,183,184,185,186,187,188,189,190,191,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,416,428,437,440,441,480,483,485,487,499,],[97,112,113,125,127,134,145,156,166,134,209,134,134,134,134,134,134,134,134,134,134,279,280,281,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,353,354,355,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,]),'unary_expr_nobf':([0,7,44,68,90,126,171,174,181,192,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,]),'function_body':([382,430,435,471,475,494,],[433,473,476,495,497,515,]),'variable_declaration':([17,240,],[119,351,]),'bitwise_xor_expr':([26,83,88,89,92,146,149,158,160,168,170,175,207,210,226,236,241,258,259,270,273,274,275,340,341,348,400,403,408,416,428,437,440,480,483,487,499,],[135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,362,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,]),'conditional_expr_nobf':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,]),'equality_expr':([26,83,88,89,92,146,149,158,160,168,170,175,207,210,226,236,241,258,259,263,270,273,274,275,276,340,341,348,400,403,408,416,428,437,440,480,483,487,499,],[136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,378,136,136,136,136,136,136,136,136,136,136,136,136,136,136,]),'literal':([0,6,7,10,11,23,25,26,30,40,44,48,54,68,83,84,88,89,90,92,98,120,121,122,123,124,126,146,149,150,151,152,155,158,160,168,170,171,174,175,181,182,183,184,185,186,187,188,189,190,191,192,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,414,416,417,428,430,435,437,440,441,471,475,480,483,484,485,487,493,494,499,502,519,521,522,524,526,],[80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,]),'logical_and_expr_nobf':([0,7,44,68,90,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[56,56,56,56,214,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,]),'shift_expr_nobf':([0,7,44,68,90,126,171,174,181,192,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,]),'elision':([4,215,],[94,94,]),'statement':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[58,58,58,180,248,429,58,465,469,58,58,58,58,504,514,58,520,527,528,58,58,532,]),'empty':([0,4,44,155,215,382,400,430,435,437,467,471,475,483,494,499,510,522,524,],[59,95,59,298,95,59,454,59,59,454,491,59,59,454,59,454,491,59,59,]),'new_expr':([6,10,11,23,25,26,30,40,48,54,83,84,88,89,92,98,120,121,122,123,124,146,149,150,151,152,155,158,160,168,170,175,182,183,184,185,186,187,188,189,190,191,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,416,428,437,440,441,480,483,485,487,499,],[101,101,101,101,101,101,101,101,101,172,101,101,101,101,101,221,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,]),'postfix_expr_nobf':([0,7,44,68,90,126,171,174,181,192,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[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,]),'regex_literal':([0,6,7,10,11,23,25,26,30,40,44,48,54,68,83,84,88,89,90,92,98,120,121,122,123,124,126,146,149,150,151,152,155,158,160,168,170,171,174,175,181,182,183,184,185,186,187,188,189,190,191,192,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,414,416,417,428,430,435,437,440,441,471,475,480,483,484,485,487,493,494,499,502,519,521,522,524,526,],[61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,]),'conditional_expr_noin':([155,402,404,405,441,485,],[296,296,296,296,296,296,]),'variable_declaration_list':([17,],[117,]),'catch':([161,],[309,]),'expr_noin':([155,],[297,]),'conditional_expr':([26,83,88,89,92,146,149,158,160,168,170,175,207,210,226,236,241,270,273,275,340,341,348,400,403,408,416,428,437,440,480,483,487,499,],[137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,]),'default_clause':([489,],[510,]),'expr':([26,83,88,146,158,168,170,175,210,226,236,400,403,416,437,440,480,483,487,499,],[138,208,211,277,302,314,315,319,337,345,350,455,459,468,455,481,501,455,507,455,]),'empty_statement':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,]),'bitwise_or_expr_noin':([155,385,402,404,405,406,441,485,],[295,436,295,295,295,295,295,295,]),'member_expr':([6,10,11,23,25,26,30,40,48,54,83,84,88,89,92,98,120,121,122,123,124,146,149,150,151,152,155,158,160,168,170,175,182,183,184,185,186,187,188,189,190,191,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,416,428,437,440,441,480,483,485,487,499,],[109,109,109,109,109,109,109,109,109,173,109,109,109,109,109,222,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,]),'assignment_expr':([26,83,88,89,92,146,149,158,160,168,170,175,207,210,226,236,241,270,273,275,340,341,348,400,403,408,416,428,437,440,480,483,487,499,],[139,139,139,212,217,139,278,139,305,139,139,139,335,139,139,139,352,372,375,377,418,419,426,139,139,463,139,472,139,139,139,139,139,139,]),'initializer_noin':([388,479,],[439,500,]),'source_element':([0,7,44,382,430,435,471,475,494,522,524,],[67,111,67,67,67,67,67,67,67,67,67,]),'bitwise_or_expr_nobf':([0,7,44,68,90,126,174,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[69,69,69,69,69,69,318,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,]),'case_clauses':([467,510,],[488,488,]),'logical_or_expr':([26,83,88,89,92,146,149,158,160,168,170,175,207,210,226,236,241,270,273,275,340,341,348,400,403,408,416,428,437,440,480,483,487,499,],[141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,]),'left_hand_side_expr':([6,10,11,23,25,26,30,40,48,83,84,88,89,92,120,121,122,123,124,146,149,150,151,152,155,158,160,168,170,175,182,183,184,185,186,187,188,189,190,191,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,416,428,437,440,441,480,483,485,487,499,],[99,99,99,99,99,142,99,99,99,142,99,142,142,142,99,99,99,99,99,142,142,99,99,99,299,142,142,142,142,142,99,99,99,99,99,99,99,99,99,99,142,142,142,142,142,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,142,99,99,142,99,142,99,142,142,142,99,99,99,99,99,99,99,99,99,99,99,99,142,99,458,142,458,458,99,142,142,142,142,142,458,142,142,458,142,142,]),'property_name':([104,346,],[233,233,]),'equality_expr_nobf':([0,7,44,68,90,126,171,174,181,192,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[73,73,73,73,73,73,73,73,73,334,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,]),'relational_expr_nobf':([0,7,44,68,90,126,171,174,181,192,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,]),'return_statement':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,]),'bitwise_and_expr_nobf':([0,7,44,68,90,126,171,174,181,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[76,76,76,76,76,76,316,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,]),'arguments':([41,49,103,109,173,222,],[159,169,227,237,317,343,]),'if_statement':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,]),'logical_or_expr_noin':([155,402,404,405,441,485,],[300,300,300,300,300,300,]),'auto_semi':([14,26,34,47,66,117,138,165,178,211,492,],[114,133,148,164,177,239,269,312,320,339,513,]),'call_expr':([6,10,11,23,25,26,30,40,48,83,84,88,89,92,120,121,122,123,124,146,149,150,151,152,155,158,160,168,170,175,182,183,184,185,186,187,188,189,190,191,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,416,428,437,440,441,480,483,485,487,499,],[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,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,]),'array_literal':([0,6,7,10,11,23,25,26,30,40,44,48,54,68,83,84,88,89,90,92,98,120,121,122,123,124,126,146,149,150,151,152,155,158,160,168,170,171,174,175,181,182,183,184,185,186,187,188,189,190,191,192,207,210,226,236,241,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,340,341,348,379,382,385,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,408,414,416,417,428,430,435,437,440,441,471,475,480,483,484,485,487,493,494,499,502,519,521,522,524,526,],[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,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,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,]),'left_hand_side_expr_nobf':([0,7,44,68,90,126,171,174,181,192,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[82,82,82,82,213,82,213,213,213,213,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,]),'assignment_expr_noin':([155,402,404,405,441,485,],[293,457,460,461,482,505,]),'elision_opt':([4,215,],[92,341,]),'bitwise_and_expr':([26,83,88,89,92,146,149,158,160,168,170,175,207,210,226,236,241,258,259,263,270,273,274,275,340,341,348,400,403,408,416,428,437,440,480,483,487,499,],[144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,367,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,]),'block':([0,7,42,44,68,126,306,379,382,414,417,430,435,471,475,484,486,493,494,502,519,521,522,524,526,],[50,50,161,50,50,50,410,50,50,50,50,50,50,50,50,50,506,50,50,50,50,50,50,50,50,]),'debugger_statement':([0,7,44,68,126,379,382,414,417,430,435,471,475,484,493,494,502,519,521,522,524,526,],[62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,]),} _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' -> program","S'",1,None,None,None), ('empty -> <empty>','empty',0,'p_empty','/home/alienoid/dev/python/slimit/src/slimit/parser.py',67), ('auto_semi -> error','auto_semi',1,'p_auto_semi','/home/alienoid/dev/python/slimit/src/slimit/parser.py',71), ('program -> source_elements','program',1,'p_program','/home/alienoid/dev/python/slimit/src/slimit/parser.py',99), ('source_elements -> empty','source_elements',1,'p_source_elements','/home/alienoid/dev/python/slimit/src/slimit/parser.py',103), ('source_elements -> source_element_list','source_elements',1,'p_source_elements','/home/alienoid/dev/python/slimit/src/slimit/parser.py',104), ('source_element_list -> source_element','source_element_list',1,'p_source_element_list','/home/alienoid/dev/python/slimit/src/slimit/parser.py',109), ('source_element_list -> source_element_list source_element','source_element_list',2,'p_source_element_list','/home/alienoid/dev/python/slimit/src/slimit/parser.py',110), ('source_element -> statement','source_element',1,'p_source_element','/home/alienoid/dev/python/slimit/src/slimit/parser.py',119), ('source_element -> function_declaration','source_element',1,'p_source_element','/home/alienoid/dev/python/slimit/src/slimit/parser.py',120), ('statement -> block','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',125), ('statement -> variable_statement','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',126), ('statement -> empty_statement','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',127), ('statement -> expr_statement','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',128), ('statement -> if_statement','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',129), ('statement -> iteration_statement','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',130), ('statement -> continue_statement','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',131), ('statement -> break_statement','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',132), ('statement -> return_statement','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',133), ('statement -> with_statement','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',134), ('statement -> switch_statement','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',135), ('statement -> labelled_statement','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',136), ('statement -> throw_statement','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',137), ('statement -> try_statement','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',138), ('statement -> debugger_statement','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',139), ('statement -> function_declaration','statement',1,'p_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',140), ('block -> LBRACE source_elements RBRACE','block',3,'p_block','/home/alienoid/dev/python/slimit/src/slimit/parser.py',147), ('literal -> null_literal','literal',1,'p_literal','/home/alienoid/dev/python/slimit/src/slimit/parser.py',151), ('literal -> boolean_literal','literal',1,'p_literal','/home/alienoid/dev/python/slimit/src/slimit/parser.py',152), ('literal -> numeric_literal','literal',1,'p_literal','/home/alienoid/dev/python/slimit/src/slimit/parser.py',153), ('literal -> string_literal','literal',1,'p_literal','/home/alienoid/dev/python/slimit/src/slimit/parser.py',154), ('literal -> regex_literal','literal',1,'p_literal','/home/alienoid/dev/python/slimit/src/slimit/parser.py',155), ('boolean_literal -> TRUE','boolean_literal',1,'p_boolean_literal','/home/alienoid/dev/python/slimit/src/slimit/parser.py',160), ('boolean_literal -> FALSE','boolean_literal',1,'p_boolean_literal','/home/alienoid/dev/python/slimit/src/slimit/parser.py',161), ('null_literal -> NULL','null_literal',1,'p_null_literal','/home/alienoid/dev/python/slimit/src/slimit/parser.py',166), ('numeric_literal -> NUMBER','numeric_literal',1,'p_numeric_literal','/home/alienoid/dev/python/slimit/src/slimit/parser.py',170), ('string_literal -> STRING','string_literal',1,'p_string_literal','/home/alienoid/dev/python/slimit/src/slimit/parser.py',174), ('regex_literal -> REGEX','regex_literal',1,'p_regex_literal','/home/alienoid/dev/python/slimit/src/slimit/parser.py',178), ('identifier -> ID','identifier',1,'p_identifier','/home/alienoid/dev/python/slimit/src/slimit/parser.py',182), ('primary_expr -> primary_expr_no_brace','primary_expr',1,'p_primary_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',189), ('primary_expr -> object_literal','primary_expr',1,'p_primary_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',190), ('primary_expr_no_brace -> identifier','primary_expr_no_brace',1,'p_primary_expr_no_brace_1','/home/alienoid/dev/python/slimit/src/slimit/parser.py',195), ('primary_expr_no_brace -> THIS','primary_expr_no_brace',1,'p_primary_expr_no_brace_2','/home/alienoid/dev/python/slimit/src/slimit/parser.py',201), ('primary_expr_no_brace -> literal','primary_expr_no_brace',1,'p_primary_expr_no_brace_3','/home/alienoid/dev/python/slimit/src/slimit/parser.py',205), ('primary_expr_no_brace -> array_literal','primary_expr_no_brace',1,'p_primary_expr_no_brace_3','/home/alienoid/dev/python/slimit/src/slimit/parser.py',206), ('primary_expr_no_brace -> LPAREN expr RPAREN','primary_expr_no_brace',3,'p_primary_expr_no_brace_4','/home/alienoid/dev/python/slimit/src/slimit/parser.py',211), ('array_literal -> LBRACKET elision_opt RBRACKET','array_literal',3,'p_array_literal_1','/home/alienoid/dev/python/slimit/src/slimit/parser.py',216), ('array_literal -> LBRACKET element_list RBRACKET','array_literal',3,'p_array_literal_2','/home/alienoid/dev/python/slimit/src/slimit/parser.py',220), ('array_literal -> LBRACKET element_list COMMA elision_opt RBRACKET','array_literal',5,'p_array_literal_2','/home/alienoid/dev/python/slimit/src/slimit/parser.py',221), ('element_list -> elision_opt assignment_expr','element_list',2,'p_element_list','/home/alienoid/dev/python/slimit/src/slimit/parser.py',230), ('element_list -> element_list COMMA elision_opt assignment_expr','element_list',4,'p_element_list','/home/alienoid/dev/python/slimit/src/slimit/parser.py',231), ('elision_opt -> empty','elision_opt',1,'p_elision_opt_1','/home/alienoid/dev/python/slimit/src/slimit/parser.py',241), ('elision_opt -> elision','elision_opt',1,'p_elision_opt_2','/home/alienoid/dev/python/slimit/src/slimit/parser.py',245), ('elision -> COMMA','elision',1,'p_elision','/home/alienoid/dev/python/slimit/src/slimit/parser.py',249), ('elision -> elision COMMA','elision',2,'p_elision','/home/alienoid/dev/python/slimit/src/slimit/parser.py',250), ('object_literal -> LBRACE RBRACE','object_literal',2,'p_object_literal','/home/alienoid/dev/python/slimit/src/slimit/parser.py',259), ('object_literal -> LBRACE property_list RBRACE','object_literal',3,'p_object_literal','/home/alienoid/dev/python/slimit/src/slimit/parser.py',260), ('object_literal -> LBRACE property_list COMMA RBRACE','object_literal',4,'p_object_literal','/home/alienoid/dev/python/slimit/src/slimit/parser.py',261), ('property_list -> property_assignment','property_list',1,'p_property_list','/home/alienoid/dev/python/slimit/src/slimit/parser.py',269), ('property_list -> property_list COMMA property_assignment','property_list',3,'p_property_list','/home/alienoid/dev/python/slimit/src/slimit/parser.py',270), ('property_assignment -> property_name COLON assignment_expr','property_assignment',3,'p_property_assignment','/home/alienoid/dev/python/slimit/src/slimit/parser.py',280), ('property_name -> identifier','property_name',1,'p_property_name','/home/alienoid/dev/python/slimit/src/slimit/parser.py',285), ('property_name -> string_literal','property_name',1,'p_property_name','/home/alienoid/dev/python/slimit/src/slimit/parser.py',286), ('property_name -> numeric_literal','property_name',1,'p_property_name','/home/alienoid/dev/python/slimit/src/slimit/parser.py',287), ('member_expr -> primary_expr','member_expr',1,'p_member_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',293), ('member_expr -> function_expr','member_expr',1,'p_member_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',294), ('member_expr -> member_expr LBRACKET expr RBRACKET','member_expr',4,'p_member_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',295), ('member_expr -> member_expr PERIOD identifier','member_expr',3,'p_member_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',296), ('member_expr -> NEW member_expr arguments','member_expr',3,'p_member_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',297), ('member_expr_nobf -> primary_expr_no_brace','member_expr_nobf',1,'p_member_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',309), ('member_expr_nobf -> function_expr','member_expr_nobf',1,'p_member_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',310), ('member_expr_nobf -> member_expr_nobf LBRACKET expr RBRACKET','member_expr_nobf',4,'p_member_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',311), ('member_expr_nobf -> member_expr_nobf PERIOD identifier','member_expr_nobf',3,'p_member_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',312), ('member_expr_nobf -> NEW member_expr arguments','member_expr_nobf',3,'p_member_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',313), ('new_expr -> member_expr','new_expr',1,'p_new_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',325), ('new_expr -> NEW new_expr','new_expr',2,'p_new_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',326), ('new_expr_nobf -> member_expr_nobf','new_expr_nobf',1,'p_new_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',334), ('new_expr_nobf -> NEW new_expr','new_expr_nobf',2,'p_new_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',335), ('call_expr -> member_expr arguments','call_expr',2,'p_call_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',343), ('call_expr -> call_expr arguments','call_expr',2,'p_call_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',344), ('call_expr -> call_expr LBRACKET expr RBRACKET','call_expr',4,'p_call_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',345), ('call_expr -> call_expr PERIOD identifier','call_expr',3,'p_call_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',346), ('call_expr_nobf -> member_expr_nobf arguments','call_expr_nobf',2,'p_call_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',356), ('call_expr_nobf -> call_expr_nobf arguments','call_expr_nobf',2,'p_call_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',357), ('call_expr_nobf -> call_expr_nobf LBRACKET expr RBRACKET','call_expr_nobf',4,'p_call_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',358), ('call_expr_nobf -> call_expr_nobf PERIOD identifier','call_expr_nobf',3,'p_call_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',359), ('arguments -> LPAREN RPAREN','arguments',2,'p_arguments','/home/alienoid/dev/python/slimit/src/slimit/parser.py',369), ('arguments -> LPAREN argument_list RPAREN','arguments',3,'p_arguments','/home/alienoid/dev/python/slimit/src/slimit/parser.py',370), ('argument_list -> assignment_expr','argument_list',1,'p_argument_list','/home/alienoid/dev/python/slimit/src/slimit/parser.py',376), ('argument_list -> argument_list COMMA assignment_expr','argument_list',3,'p_argument_list','/home/alienoid/dev/python/slimit/src/slimit/parser.py',377), ('left_hand_side_expr -> new_expr','left_hand_side_expr',1,'p_lef_hand_side_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',386), ('left_hand_side_expr -> call_expr','left_hand_side_expr',1,'p_lef_hand_side_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',387), ('left_hand_side_expr_nobf -> new_expr_nobf','left_hand_side_expr_nobf',1,'p_lef_hand_side_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',392), ('left_hand_side_expr_nobf -> call_expr_nobf','left_hand_side_expr_nobf',1,'p_lef_hand_side_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',393), ('postfix_expr -> left_hand_side_expr','postfix_expr',1,'p_postfix_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',399), ('postfix_expr -> left_hand_side_expr PLUSPLUS','postfix_expr',2,'p_postfix_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',400), ('postfix_expr -> left_hand_side_expr MINUSMINUS','postfix_expr',2,'p_postfix_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',401), ('postfix_expr_nobf -> left_hand_side_expr_nobf','postfix_expr_nobf',1,'p_postfix_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',409), ('postfix_expr_nobf -> left_hand_side_expr_nobf PLUSPLUS','postfix_expr_nobf',2,'p_postfix_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',410), ('postfix_expr_nobf -> left_hand_side_expr_nobf MINUSMINUS','postfix_expr_nobf',2,'p_postfix_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',411), ('unary_expr -> postfix_expr','unary_expr',1,'p_unary_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',420), ('unary_expr -> unary_expr_common','unary_expr',1,'p_unary_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',421), ('unary_expr_nobf -> postfix_expr_nobf','unary_expr_nobf',1,'p_unary_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',426), ('unary_expr_nobf -> unary_expr_common','unary_expr_nobf',1,'p_unary_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',427), ('unary_expr_common -> DELETE unary_expr','unary_expr_common',2,'p_unary_expr_common','/home/alienoid/dev/python/slimit/src/slimit/parser.py',432), ('unary_expr_common -> VOID unary_expr','unary_expr_common',2,'p_unary_expr_common','/home/alienoid/dev/python/slimit/src/slimit/parser.py',433), ('unary_expr_common -> TYPEOF unary_expr','unary_expr_common',2,'p_unary_expr_common','/home/alienoid/dev/python/slimit/src/slimit/parser.py',434), ('unary_expr_common -> PLUSPLUS unary_expr','unary_expr_common',2,'p_unary_expr_common','/home/alienoid/dev/python/slimit/src/slimit/parser.py',435), ('unary_expr_common -> MINUSMINUS unary_expr','unary_expr_common',2,'p_unary_expr_common','/home/alienoid/dev/python/slimit/src/slimit/parser.py',436), ('unary_expr_common -> PLUS unary_expr','unary_expr_common',2,'p_unary_expr_common','/home/alienoid/dev/python/slimit/src/slimit/parser.py',437), ('unary_expr_common -> MINUS unary_expr','unary_expr_common',2,'p_unary_expr_common','/home/alienoid/dev/python/slimit/src/slimit/parser.py',438), ('unary_expr_common -> BNOT unary_expr','unary_expr_common',2,'p_unary_expr_common','/home/alienoid/dev/python/slimit/src/slimit/parser.py',439), ('unary_expr_common -> NOT unary_expr','unary_expr_common',2,'p_unary_expr_common','/home/alienoid/dev/python/slimit/src/slimit/parser.py',440), ('multiplicative_expr -> unary_expr','multiplicative_expr',1,'p_multiplicative_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',446), ('multiplicative_expr -> multiplicative_expr MULT unary_expr','multiplicative_expr',3,'p_multiplicative_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',447), ('multiplicative_expr -> multiplicative_expr DIV unary_expr','multiplicative_expr',3,'p_multiplicative_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',448), ('multiplicative_expr -> multiplicative_expr MOD unary_expr','multiplicative_expr',3,'p_multiplicative_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',449), ('multiplicative_expr_nobf -> unary_expr_nobf','multiplicative_expr_nobf',1,'p_multiplicative_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',457), ('multiplicative_expr_nobf -> multiplicative_expr_nobf MULT unary_expr','multiplicative_expr_nobf',3,'p_multiplicative_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',458), ('multiplicative_expr_nobf -> multiplicative_expr_nobf DIV unary_expr','multiplicative_expr_nobf',3,'p_multiplicative_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',459), ('multiplicative_expr_nobf -> multiplicative_expr_nobf MOD unary_expr','multiplicative_expr_nobf',3,'p_multiplicative_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',460), ('additive_expr -> multiplicative_expr','additive_expr',1,'p_additive_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',469), ('additive_expr -> additive_expr PLUS multiplicative_expr','additive_expr',3,'p_additive_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',470), ('additive_expr -> additive_expr MINUS multiplicative_expr','additive_expr',3,'p_additive_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',471), ('additive_expr_nobf -> multiplicative_expr_nobf','additive_expr_nobf',1,'p_additive_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',479), ('additive_expr_nobf -> additive_expr_nobf PLUS multiplicative_expr','additive_expr_nobf',3,'p_additive_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',480), ('additive_expr_nobf -> additive_expr_nobf MINUS multiplicative_expr','additive_expr_nobf',3,'p_additive_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',481), ('shift_expr -> additive_expr','shift_expr',1,'p_shift_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',490), ('shift_expr -> shift_expr LSHIFT additive_expr','shift_expr',3,'p_shift_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',491), ('shift_expr -> shift_expr RSHIFT additive_expr','shift_expr',3,'p_shift_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',492), ('shift_expr -> shift_expr URSHIFT additive_expr','shift_expr',3,'p_shift_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',493), ('shift_expr_nobf -> additive_expr_nobf','shift_expr_nobf',1,'p_shift_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',501), ('shift_expr_nobf -> shift_expr_nobf LSHIFT additive_expr','shift_expr_nobf',3,'p_shift_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',502), ('shift_expr_nobf -> shift_expr_nobf RSHIFT additive_expr','shift_expr_nobf',3,'p_shift_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',503), ('shift_expr_nobf -> shift_expr_nobf URSHIFT additive_expr','shift_expr_nobf',3,'p_shift_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',504), ('relational_expr -> shift_expr','relational_expr',1,'p_relational_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',514), ('relational_expr -> relational_expr LT shift_expr','relational_expr',3,'p_relational_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',515), ('relational_expr -> relational_expr GT shift_expr','relational_expr',3,'p_relational_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',516), ('relational_expr -> relational_expr LE shift_expr','relational_expr',3,'p_relational_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',517), ('relational_expr -> relational_expr GE shift_expr','relational_expr',3,'p_relational_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',518), ('relational_expr -> relational_expr INSTANCEOF shift_expr','relational_expr',3,'p_relational_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',519), ('relational_expr -> relational_expr IN shift_expr','relational_expr',3,'p_relational_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',520), ('relational_expr_noin -> shift_expr','relational_expr_noin',1,'p_relational_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',528), ('relational_expr_noin -> relational_expr_noin LT shift_expr','relational_expr_noin',3,'p_relational_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',529), ('relational_expr_noin -> relational_expr_noin GT shift_expr','relational_expr_noin',3,'p_relational_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',530), ('relational_expr_noin -> relational_expr_noin LE shift_expr','relational_expr_noin',3,'p_relational_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',531), ('relational_expr_noin -> relational_expr_noin GE shift_expr','relational_expr_noin',3,'p_relational_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',532), ('relational_expr_noin -> relational_expr_noin INSTANCEOF shift_expr','relational_expr_noin',3,'p_relational_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',533), ('relational_expr_nobf -> shift_expr_nobf','relational_expr_nobf',1,'p_relational_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',541), ('relational_expr_nobf -> relational_expr_nobf LT shift_expr','relational_expr_nobf',3,'p_relational_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',542), ('relational_expr_nobf -> relational_expr_nobf GT shift_expr','relational_expr_nobf',3,'p_relational_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',543), ('relational_expr_nobf -> relational_expr_nobf LE shift_expr','relational_expr_nobf',3,'p_relational_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',544), ('relational_expr_nobf -> relational_expr_nobf GE shift_expr','relational_expr_nobf',3,'p_relational_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',545), ('relational_expr_nobf -> relational_expr_nobf INSTANCEOF shift_expr','relational_expr_nobf',3,'p_relational_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',546), ('relational_expr_nobf -> relational_expr_nobf IN shift_expr','relational_expr_nobf',3,'p_relational_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',547), ('equality_expr -> relational_expr','equality_expr',1,'p_equality_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',556), ('equality_expr -> equality_expr EQEQ relational_expr','equality_expr',3,'p_equality_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',557), ('equality_expr -> equality_expr NE relational_expr','equality_expr',3,'p_equality_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',558), ('equality_expr -> equality_expr STREQ relational_expr','equality_expr',3,'p_equality_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',559), ('equality_expr -> equality_expr STRNEQ relational_expr','equality_expr',3,'p_equality_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',560), ('equality_expr_noin -> relational_expr_noin','equality_expr_noin',1,'p_equality_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',568), ('equality_expr_noin -> equality_expr_noin EQEQ relational_expr','equality_expr_noin',3,'p_equality_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',569), ('equality_expr_noin -> equality_expr_noin NE relational_expr','equality_expr_noin',3,'p_equality_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',570), ('equality_expr_noin -> equality_expr_noin STREQ relational_expr','equality_expr_noin',3,'p_equality_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',571), ('equality_expr_noin -> equality_expr_noin STRNEQ relational_expr','equality_expr_noin',3,'p_equality_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',572), ('equality_expr_nobf -> relational_expr_nobf','equality_expr_nobf',1,'p_equality_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',580), ('equality_expr_nobf -> equality_expr_nobf EQEQ relational_expr','equality_expr_nobf',3,'p_equality_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',581), ('equality_expr_nobf -> equality_expr_nobf NE relational_expr','equality_expr_nobf',3,'p_equality_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',582), ('equality_expr_nobf -> equality_expr_nobf STREQ relational_expr','equality_expr_nobf',3,'p_equality_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',583), ('equality_expr_nobf -> equality_expr_nobf STRNEQ relational_expr','equality_expr_nobf',3,'p_equality_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',584), ('bitwise_and_expr -> equality_expr','bitwise_and_expr',1,'p_bitwise_and_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',593), ('bitwise_and_expr -> bitwise_and_expr BAND equality_expr','bitwise_and_expr',3,'p_bitwise_and_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',594), ('bitwise_and_expr_noin -> equality_expr_noin','bitwise_and_expr_noin',1,'p_bitwise_and_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',602), ('bitwise_and_expr_noin -> bitwise_and_expr_noin BAND equality_expr_noin','bitwise_and_expr_noin',3,'p_bitwise_and_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',603), ('bitwise_and_expr_nobf -> equality_expr_nobf','bitwise_and_expr_nobf',1,'p_bitwise_and_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',612), ('bitwise_and_expr_nobf -> bitwise_and_expr_nobf BAND equality_expr_nobf','bitwise_and_expr_nobf',3,'p_bitwise_and_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',613), ('bitwise_xor_expr -> bitwise_and_expr','bitwise_xor_expr',1,'p_bitwise_xor_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',622), ('bitwise_xor_expr -> bitwise_xor_expr BXOR bitwise_and_expr','bitwise_xor_expr',3,'p_bitwise_xor_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',623), ('bitwise_xor_expr_noin -> bitwise_and_expr_noin','bitwise_xor_expr_noin',1,'p_bitwise_xor_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',632), ('bitwise_xor_expr_noin -> bitwise_xor_expr_noin BXOR bitwise_and_expr_noin','bitwise_xor_expr_noin',3,'p_bitwise_xor_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',633), ('bitwise_xor_expr_nobf -> bitwise_and_expr_nobf','bitwise_xor_expr_nobf',1,'p_bitwise_xor_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',643), ('bitwise_xor_expr_nobf -> bitwise_xor_expr_nobf BXOR bitwise_and_expr_nobf','bitwise_xor_expr_nobf',3,'p_bitwise_xor_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',644), ('bitwise_or_expr -> bitwise_xor_expr','bitwise_or_expr',1,'p_bitwise_or_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',653), ('bitwise_or_expr -> bitwise_or_expr BOR bitwise_xor_expr','bitwise_or_expr',3,'p_bitwise_or_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',654), ('bitwise_or_expr_noin -> bitwise_xor_expr_noin','bitwise_or_expr_noin',1,'p_bitwise_or_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',663), ('bitwise_or_expr_noin -> bitwise_or_expr_noin BOR bitwise_xor_expr_noin','bitwise_or_expr_noin',3,'p_bitwise_or_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',664), ('bitwise_or_expr_nobf -> bitwise_xor_expr_nobf','bitwise_or_expr_nobf',1,'p_bitwise_or_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',674), ('bitwise_or_expr_nobf -> bitwise_or_expr_nobf BOR bitwise_xor_expr_nobf','bitwise_or_expr_nobf',3,'p_bitwise_or_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',675), ('logical_and_expr -> bitwise_or_expr','logical_and_expr',1,'p_logical_and_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',685), ('logical_and_expr -> logical_and_expr AND bitwise_or_expr','logical_and_expr',3,'p_logical_and_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',686), ('logical_and_expr_noin -> bitwise_or_expr_noin','logical_and_expr_noin',1,'p_logical_and_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',695), ('logical_and_expr_noin -> logical_and_expr_noin AND bitwise_or_expr_noin','logical_and_expr_noin',3,'p_logical_and_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',696), ('logical_and_expr_nobf -> bitwise_or_expr_nobf','logical_and_expr_nobf',1,'p_logical_and_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',705), ('logical_and_expr_nobf -> logical_and_expr_nobf AND bitwise_or_expr_nobf','logical_and_expr_nobf',3,'p_logical_and_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',706), ('logical_or_expr -> logical_and_expr','logical_or_expr',1,'p_logical_or_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',714), ('logical_or_expr -> logical_or_expr OR logical_and_expr','logical_or_expr',3,'p_logical_or_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',715), ('logical_or_expr_noin -> logical_and_expr_noin','logical_or_expr_noin',1,'p_logical_or_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',723), ('logical_or_expr_noin -> logical_or_expr_noin OR logical_and_expr_noin','logical_or_expr_noin',3,'p_logical_or_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',724), ('logical_or_expr_nobf -> logical_and_expr_nobf','logical_or_expr_nobf',1,'p_logical_or_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',732), ('logical_or_expr_nobf -> logical_or_expr_nobf OR logical_and_expr_nobf','logical_or_expr_nobf',3,'p_logical_or_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',733), ('conditional_expr -> logical_or_expr','conditional_expr',1,'p_conditional_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',743), ('conditional_expr -> logical_or_expr CONDOP assignment_expr COLON assignment_expr','conditional_expr',5,'p_conditional_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',744), ('conditional_expr_noin -> logical_or_expr_noin','conditional_expr_noin',1,'p_conditional_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',755), ('conditional_expr_noin -> logical_or_expr_noin CONDOP assignment_expr_noin COLON assignment_expr_noin','conditional_expr_noin',5,'p_conditional_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',756), ('conditional_expr_nobf -> logical_or_expr_nobf','conditional_expr_nobf',1,'p_conditional_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',768), ('conditional_expr_nobf -> logical_or_expr_nobf CONDOP assignment_expr COLON assignment_expr','conditional_expr_nobf',5,'p_conditional_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',769), ('assignment_expr -> conditional_expr','assignment_expr',1,'p_assignment_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',781), ('assignment_expr -> left_hand_side_expr assignment_operator assignment_expr','assignment_expr',3,'p_assignment_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',782), ('assignment_expr_noin -> conditional_expr_noin','assignment_expr_noin',1,'p_assignment_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',792), ('assignment_expr_noin -> left_hand_side_expr assignment_operator assignment_expr_noin','assignment_expr_noin',3,'p_assignment_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',793), ('assignment_expr_nobf -> conditional_expr_nobf','assignment_expr_nobf',1,'p_assignment_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',803), ('assignment_expr_nobf -> left_hand_side_expr_nobf assignment_operator assignment_expr','assignment_expr_nobf',3,'p_assignment_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',804), ('assignment_operator -> EQ','assignment_operator',1,'p_assignment_operator','/home/alienoid/dev/python/slimit/src/slimit/parser.py',813), ('assignment_operator -> MULTEQUAL','assignment_operator',1,'p_assignment_operator','/home/alienoid/dev/python/slimit/src/slimit/parser.py',814), ('assignment_operator -> DIVEQUAL','assignment_operator',1,'p_assignment_operator','/home/alienoid/dev/python/slimit/src/slimit/parser.py',815), ('assignment_operator -> MODEQUAL','assignment_operator',1,'p_assignment_operator','/home/alienoid/dev/python/slimit/src/slimit/parser.py',816), ('assignment_operator -> PLUSEQUAL','assignment_operator',1,'p_assignment_operator','/home/alienoid/dev/python/slimit/src/slimit/parser.py',817), ('assignment_operator -> MINUSEQUAL','assignment_operator',1,'p_assignment_operator','/home/alienoid/dev/python/slimit/src/slimit/parser.py',818), ('assignment_operator -> LSHIFTEQUAL','assignment_operator',1,'p_assignment_operator','/home/alienoid/dev/python/slimit/src/slimit/parser.py',819), ('assignment_operator -> RSHIFTEQUAL','assignment_operator',1,'p_assignment_operator','/home/alienoid/dev/python/slimit/src/slimit/parser.py',820), ('assignment_operator -> URSHIFTEQUAL','assignment_operator',1,'p_assignment_operator','/home/alienoid/dev/python/slimit/src/slimit/parser.py',821), ('assignment_operator -> ANDEQUAL','assignment_operator',1,'p_assignment_operator','/home/alienoid/dev/python/slimit/src/slimit/parser.py',822), ('assignment_operator -> XOREQUAL','assignment_operator',1,'p_assignment_operator','/home/alienoid/dev/python/slimit/src/slimit/parser.py',823), ('assignment_operator -> OREQUAL','assignment_operator',1,'p_assignment_operator','/home/alienoid/dev/python/slimit/src/slimit/parser.py',824), ('expr -> assignment_expr','expr',1,'p_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',830), ('expr -> expr COMMA assignment_expr','expr',3,'p_expr','/home/alienoid/dev/python/slimit/src/slimit/parser.py',831), ('expr_noin -> assignment_expr_noin','expr_noin',1,'p_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',839), ('expr_noin -> expr_noin COMMA assignment_expr_noin','expr_noin',3,'p_expr_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',840), ('expr_nobf -> assignment_expr_nobf','expr_nobf',1,'p_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',848), ('expr_nobf -> expr_nobf COMMA assignment_expr','expr_nobf',3,'p_expr_nobf','/home/alienoid/dev/python/slimit/src/slimit/parser.py',849), ('variable_statement -> VAR variable_declaration_list SEMI','variable_statement',3,'p_variable_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',858), ('variable_statement -> VAR variable_declaration_list auto_semi','variable_statement',3,'p_variable_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',859), ('variable_declaration_list -> variable_declaration','variable_declaration_list',1,'p_variable_declaration_list','/home/alienoid/dev/python/slimit/src/slimit/parser.py',865), ('variable_declaration_list -> variable_declaration_list COMMA variable_declaration','variable_declaration_list',3,'p_variable_declaration_list','/home/alienoid/dev/python/slimit/src/slimit/parser.py',866), ('variable_declaration_list_noin -> variable_declaration_noin','variable_declaration_list_noin',1,'p_variable_declaration_list_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',877), ('variable_declaration_list_noin -> variable_declaration_list_noin COMMA variable_declaration_noin','variable_declaration_list_noin',3,'p_variable_declaration_list_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',878), ('variable_declaration -> identifier','variable_declaration',1,'p_variable_declaration','/home/alienoid/dev/python/slimit/src/slimit/parser.py',888), ('variable_declaration -> identifier initializer','variable_declaration',2,'p_variable_declaration','/home/alienoid/dev/python/slimit/src/slimit/parser.py',889), ('variable_declaration_noin -> identifier','variable_declaration_noin',1,'p_variable_declaration_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',897), ('variable_declaration_noin -> identifier initializer_noin','variable_declaration_noin',2,'p_variable_declaration_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',898), ('initializer -> EQ assignment_expr','initializer',2,'p_initializer','/home/alienoid/dev/python/slimit/src/slimit/parser.py',906), ('initializer_noin -> EQ assignment_expr_noin','initializer_noin',2,'p_initializer_noin','/home/alienoid/dev/python/slimit/src/slimit/parser.py',910), ('empty_statement -> SEMI','empty_statement',1,'p_empty_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',915), ('expr_statement -> expr_nobf SEMI','expr_statement',2,'p_expr_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',920), ('expr_statement -> expr_nobf auto_semi','expr_statement',2,'p_expr_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',921), ('if_statement -> IF LPAREN expr RPAREN statement','if_statement',5,'p_if_statement_1','/home/alienoid/dev/python/slimit/src/slimit/parser.py',927), ('if_statement -> IF LPAREN expr RPAREN statement ELSE statement','if_statement',7,'p_if_statement_2','/home/alienoid/dev/python/slimit/src/slimit/parser.py',931), ('iteration_statement -> DO statement WHILE LPAREN expr RPAREN SEMI','iteration_statement',7,'p_iteration_statement_1','/home/alienoid/dev/python/slimit/src/slimit/parser.py',937), ('iteration_statement -> DO statement WHILE LPAREN expr RPAREN auto_semi','iteration_statement',7,'p_iteration_statement_1','/home/alienoid/dev/python/slimit/src/slimit/parser.py',938), ('iteration_statement -> WHILE LPAREN expr RPAREN statement','iteration_statement',5,'p_iteration_statement_2','/home/alienoid/dev/python/slimit/src/slimit/parser.py',944), ('iteration_statement -> FOR LPAREN expr_noin_opt SEMI expr_opt SEMI expr_opt RPAREN statement','iteration_statement',9,'p_iteration_statement_3','/home/alienoid/dev/python/slimit/src/slimit/parser.py',949), ('iteration_statement -> FOR LPAREN VAR variable_declaration_list_noin SEMI expr_opt SEMI expr_opt RPAREN statement','iteration_statement',10,'p_iteration_statement_3','/home/alienoid/dev/python/slimit/src/slimit/parser.py',950), ('iteration_statement -> FOR LPAREN left_hand_side_expr IN expr RPAREN statement','iteration_statement',7,'p_iteration_statement_4','/home/alienoid/dev/python/slimit/src/slimit/parser.py',963), ('iteration_statement -> FOR LPAREN VAR identifier IN expr RPAREN statement','iteration_statement',8,'p_iteration_statement_5','/home/alienoid/dev/python/slimit/src/slimit/parser.py',970), ('iteration_statement -> FOR LPAREN VAR identifier initializer_noin IN expr RPAREN statement','iteration_statement',9,'p_iteration_statement_6','/home/alienoid/dev/python/slimit/src/slimit/parser.py',977), ('expr_opt -> empty','expr_opt',1,'p_expr_opt','/home/alienoid/dev/python/slimit/src/slimit/parser.py',984), ('expr_opt -> expr','expr_opt',1,'p_expr_opt','/home/alienoid/dev/python/slimit/src/slimit/parser.py',985), ('expr_noin_opt -> empty','expr_noin_opt',1,'p_expr_noin_opt','/home/alienoid/dev/python/slimit/src/slimit/parser.py',990), ('expr_noin_opt -> expr_noin','expr_noin_opt',1,'p_expr_noin_opt','/home/alienoid/dev/python/slimit/src/slimit/parser.py',991), ('continue_statement -> CONTINUE SEMI','continue_statement',2,'p_continue_statement_1','/home/alienoid/dev/python/slimit/src/slimit/parser.py',997), ('continue_statement -> CONTINUE auto_semi','continue_statement',2,'p_continue_statement_1','/home/alienoid/dev/python/slimit/src/slimit/parser.py',998), ('continue_statement -> CONTINUE identifier SEMI','continue_statement',3,'p_continue_statement_2','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1003), ('continue_statement -> CONTINUE identifier auto_semi','continue_statement',3,'p_continue_statement_2','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1004), ('break_statement -> BREAK SEMI','break_statement',2,'p_break_statement_1','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1010), ('break_statement -> BREAK auto_semi','break_statement',2,'p_break_statement_1','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1011), ('break_statement -> BREAK identifier SEMI','break_statement',3,'p_break_statement_2','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1016), ('break_statement -> BREAK identifier auto_semi','break_statement',3,'p_break_statement_2','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1017), ('return_statement -> RETURN SEMI','return_statement',2,'p_return_statement_1','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1024), ('return_statement -> RETURN auto_semi','return_statement',2,'p_return_statement_1','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1025), ('return_statement -> RETURN expr SEMI','return_statement',3,'p_return_statement_2','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1030), ('return_statement -> RETURN expr auto_semi','return_statement',3,'p_return_statement_2','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1031), ('with_statement -> WITH LPAREN expr RPAREN statement','with_statement',5,'p_with_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1037), ('switch_statement -> SWITCH LPAREN expr RPAREN case_block','switch_statement',5,'p_switch_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1042), ('case_block -> LBRACE case_clauses_opt RBRACE','case_block',3,'p_case_block','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1056), ('case_block -> LBRACE case_clauses_opt default_clause case_clauses_opt RBRACE','case_block',5,'p_case_block','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1057), ('case_clauses_opt -> empty','case_clauses_opt',1,'p_case_clauses_opt','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1063), ('case_clauses_opt -> case_clauses','case_clauses_opt',1,'p_case_clauses_opt','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1064), ('case_clauses -> case_clause','case_clauses',1,'p_case_clauses','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1069), ('case_clauses -> case_clauses case_clause','case_clauses',2,'p_case_clauses','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1070), ('case_clause -> CASE expr COLON source_elements','case_clause',4,'p_case_clause','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1079), ('default_clause -> DEFAULT COLON source_elements','default_clause',3,'p_default_clause','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1083), ('labelled_statement -> identifier COLON statement','labelled_statement',3,'p_labelled_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1088), ('throw_statement -> THROW expr SEMI','throw_statement',3,'p_throw_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1093), ('throw_statement -> THROW expr auto_semi','throw_statement',3,'p_throw_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1094), ('try_statement -> TRY block catch','try_statement',3,'p_try_statement_1','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1100), ('try_statement -> TRY block finally','try_statement',3,'p_try_statement_2','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1104), ('try_statement -> TRY block catch finally','try_statement',4,'p_try_statement_3','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1108), ('catch -> CATCH LPAREN identifier RPAREN block','catch',5,'p_catch','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1112), ('finally -> FINALLY block','finally',2,'p_finally','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1116), ('debugger_statement -> DEBUGGER SEMI','debugger_statement',2,'p_debugger_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1121), ('debugger_statement -> DEBUGGER auto_semi','debugger_statement',2,'p_debugger_statement','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1122), ('function_declaration -> FUNCTION identifier LPAREN RPAREN LBRACE function_body RBRACE','function_declaration',7,'p_function_declaration','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1129), ('function_declaration -> FUNCTION identifier LPAREN formal_parameter_list RPAREN LBRACE function_body RBRACE','function_declaration',8,'p_function_declaration','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1130), ('function_expr -> FUNCTION LPAREN RPAREN LBRACE function_body RBRACE','function_expr',6,'p_function_expr_1','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1143), ('function_expr -> FUNCTION LPAREN formal_parameter_list RPAREN LBRACE function_body RBRACE','function_expr',7,'p_function_expr_1','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1144), ('function_expr -> FUNCTION identifier LPAREN RPAREN LBRACE function_body RBRACE','function_expr',7,'p_function_expr_2','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1157), ('function_expr -> FUNCTION identifier LPAREN formal_parameter_list RPAREN LBRACE function_body RBRACE','function_expr',8,'p_function_expr_2','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1158), ('formal_parameter_list -> identifier','formal_parameter_list',1,'p_formal_parameter_list','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1171), ('formal_parameter_list -> formal_parameter_list COMMA identifier','formal_parameter_list',3,'p_formal_parameter_list','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1172), ('function_body -> source_elements','function_body',1,'p_function_body','/home/alienoid/dev/python/slimit/src/slimit/parser.py',1181), ]
579eac1755cc6dfc8c601ef7df132c1a4a830673
674f5dde693f1a60e4480e5b66fba8f24a9cb95d
/armulator/armv6/opcodes/abstract_opcodes/smlsld.py
55da34bdc70ecb6cd43315893e0a2e0c83e6c62f
[ "MIT" ]
permissive
matan1008/armulator
75211c18ebc9cd9d33a02890e76fc649483c3aad
44f4275ab1cafff3cf7a1b760bff7f139dfffb07
refs/heads/master
2023-08-17T14:40:52.793120
2023-08-08T04:57:02
2023-08-08T04:57:02
91,716,042
29
7
MIT
2023-08-08T04:55:59
2017-05-18T16:37:55
Python
UTF-8
Python
false
false
1,242
py
from armulator.armv6.bits_ops import to_signed, set_substring, to_unsigned, substring from armulator.armv6.opcodes.opcode import Opcode from armulator.armv6.shift import ror class Smlsld(Opcode): def __init__(self, instruction, m_swap, m, d_hi, d_lo, n): super().__init__(instruction) self.m_swap = m_swap self.m = m self.d_hi = d_hi self.d_lo = d_lo self.n = n def execute(self, processor): if processor.condition_passed(): operand2 = ror(processor.registers.get(self.m), 32, 16) if self.m_swap else processor.registers.get(self.m) n = processor.registers.get(self.n) product1 = to_signed(substring(n, 15, 0), 16) * to_signed(substring(operand2, 15, 0), 16) product2 = to_signed(substring(n, 31, 16), 16) * to_signed(substring(operand2, 31, 16), 16) d_total = to_signed( set_substring(processor.registers.get(self.d_lo), 63, 32, processor.registers.get(self.d_hi)), 64 ) result = to_unsigned(product1 - product2 + d_total, 64) processor.registers.set(self.d_hi, substring(result, 63, 32)) processor.registers.set(self.d_lo, substring(result, 31, 0))
c3f603d4891e64afab9802c2e85b912f517572e7
f698ab1da4eff7b353ddddf1e560776ca03a0efb
/examples/ogbg_molpcba/models.py
f1cfc01d8d5185b83ecd0d6620dd538ae9890250
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
patrickvonplaten/flax
7489a002190c5cd5611c6ee1097d7407a932314c
48b34ab87c7d20afc567f6e0fe5d67e423cf08bc
refs/heads/main
2023-08-23T13:55:08.002500
2021-10-08T09:23:15
2021-10-08T09:23:54
319,617,897
0
0
Apache-2.0
2020-12-08T11:28:16
2020-12-08T11:28:15
null
UTF-8
Python
false
false
6,732
py
# Copyright 2021 The Flax 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. """Definition of the GNN model.""" from typing import Callable, Sequence from flax import linen as nn import jax.numpy as jnp import jraph def add_graphs_tuples(graphs: jraph.GraphsTuple, other_graphs: jraph.GraphsTuple) -> jraph.GraphsTuple: """Adds the nodes, edges and global features from other_graphs to graphs.""" return graphs._replace( nodes=graphs.nodes + other_graphs.nodes, edges=graphs.edges + other_graphs.edges, globals=graphs.globals + other_graphs.globals) class MLP(nn.Module): """A multi-layer perceptron.""" feature_sizes: Sequence[int] dropout_rate: float = 0 deterministic: bool = True activation: Callable[[jnp.ndarray], jnp.ndarray] = nn.relu @nn.compact def __call__(self, inputs): x = inputs for size in self.feature_sizes: x = nn.Dense(features=size)(x) x = self.activation(x) x = nn.Dropout( rate=self.dropout_rate, deterministic=self.deterministic)(x) return x class GraphNet(nn.Module): """A complete Graph Network model defined with Jraph.""" latent_size: int num_mlp_layers: int message_passing_steps: int output_globals_size: int dropout_rate: float = 0 skip_connections: bool = True use_edge_model: bool = True layer_norm: bool = True deterministic: bool = True @nn.compact def __call__(self, graphs: jraph.GraphsTuple) -> jraph.GraphsTuple: # We will first linearly project the original features as 'embeddings'. embedder = jraph.GraphMapFeatures( embed_node_fn=nn.Dense(self.latent_size), embed_edge_fn=nn.Dense(self.latent_size), embed_global_fn=nn.Dense(self.latent_size)) processed_graphs = embedder(graphs) # Now, we will apply a Graph Network once for each message-passing round. mlp_feature_sizes = [self.latent_size] * self.num_mlp_layers for _ in range(self.message_passing_steps): if self.use_edge_model: update_edge_fn = jraph.concatenated_args( MLP(mlp_feature_sizes, dropout_rate=self.dropout_rate, deterministic=self.deterministic)) else: update_edge_fn = None update_node_fn = jraph.concatenated_args( MLP(mlp_feature_sizes, dropout_rate=self.dropout_rate, deterministic=self.deterministic)) update_global_fn = jraph.concatenated_args( MLP(mlp_feature_sizes, dropout_rate=self.dropout_rate, deterministic=self.deterministic)) graph_net = jraph.GraphNetwork( update_node_fn=update_node_fn, update_edge_fn=update_edge_fn, update_global_fn=update_global_fn) if self.skip_connections: processed_graphs = add_graphs_tuples( graph_net(processed_graphs), processed_graphs) else: processed_graphs = graph_net(processed_graphs) if self.layer_norm: processed_graphs = processed_graphs._replace( nodes=nn.LayerNorm()(processed_graphs.nodes), edges=nn.LayerNorm()(processed_graphs.edges), globals=nn.LayerNorm()(processed_graphs.globals), ) # Since our graph-level predictions will be at globals, we will # decode to get the required output logits. decoder = jraph.GraphMapFeatures( embed_global_fn=nn.Dense(self.output_globals_size)) processed_graphs = decoder(processed_graphs) return processed_graphs class GraphConvNet(nn.Module): """A Graph Convolution Network + Pooling model defined with Jraph.""" latent_size: int num_mlp_layers: int message_passing_steps: int output_globals_size: int dropout_rate: float = 0 skip_connections: bool = True layer_norm: bool = True deterministic: bool = True pooling_fn: Callable[[jnp.ndarray, jnp.ndarray, jnp.ndarray], jnp.ndarray] = jraph.segment_mean def pool(self, graphs: jraph.GraphsTuple) -> jraph.GraphsTuple: """Pooling operation, taken from Jraph.""" # Equivalent to jnp.sum(n_node), but JIT-able. sum_n_node = graphs.nodes.shape[0] # To aggregate nodes from each graph to global features, # we first construct tensors that map the node to the corresponding graph. # Example: if you have `n_node=[1,2]`, we construct the tensor [0, 1, 1]. n_graph = graphs.n_node.shape[0] node_graph_indices = jnp.repeat( jnp.arange(n_graph), graphs.n_node, axis=0, total_repeat_length=sum_n_node) # We use the aggregation function to pool the nodes per graph. pooled = self.pooling_fn(graphs.nodes, node_graph_indices, n_graph) return graphs._replace(globals=pooled) @nn.compact def __call__(self, graphs: jraph.GraphsTuple) -> jraph.GraphsTuple: # We will first linearly project the original node features as 'embeddings'. embedder = jraph.GraphMapFeatures( embed_node_fn=nn.Dense(self.latent_size)) processed_graphs = embedder(graphs) # Now, we will apply the GCN once for each message-passing round. for _ in range(self.message_passing_steps): mlp_feature_sizes = [self.latent_size] * self.num_mlp_layers update_node_fn = jraph.concatenated_args( MLP(mlp_feature_sizes, dropout_rate=self.dropout_rate, deterministic=self.deterministic)) graph_conv = jraph.GraphConvolution( update_node_fn=update_node_fn, add_self_edges=True) if self.skip_connections: processed_graphs = add_graphs_tuples( graph_conv(processed_graphs), processed_graphs) else: processed_graphs = graph_conv(processed_graphs) if self.layer_norm: processed_graphs = processed_graphs._replace( nodes=nn.LayerNorm()(processed_graphs.nodes), ) # We apply the pooling operation to get a 'global' embedding. processed_graphs = self.pool(processed_graphs) # Now, we decode this to get the required output logits. decoder = jraph.GraphMapFeatures( embed_global_fn=nn.Dense(self.output_globals_size)) processed_graphs = decoder(processed_graphs) return processed_graphs
e1df6fc2583f420d43b25ca435c7e20316b96453
b5c5c27d71348937322b77b24fe9e581cdd3a6c4
/graphql/pyutils/cached_property.py
0727c1949d5a114eb73a371fd40463fb8998efc0
[ "MIT" ]
permissive
dfee/graphql-core-next
92bc6b4e5a39bd43def8397bbb2d5b924d5436d9
1ada7146bd0510171ae931b68f6c77dbdf5d5c63
refs/heads/master
2020-03-27T10:30:43.486607
2018-08-30T20:26:42
2018-08-30T20:26:42
146,425,198
0
0
MIT
2018-08-28T09:40:09
2018-08-28T09:40:09
null
UTF-8
Python
false
false
607
py
# Code taken from https://github.com/bottlepy/bottle __all__ = ['cached_property'] class CachedProperty: """A cached property. A property that is only computed once per instance and then replaces itself with an ordinary attribute. Deleting the attribute resets the property. """ def __init__(self, func): self.__doc__ = getattr(func, '__doc__') self.func = func def __get__(self, obj, cls): if obj is None: return self value = obj.__dict__[self.func.__name__] = self.func(obj) return value cached_property = CachedProperty
dfbb2a64692b993bd4d3388133dc94ce6316ab09
141d1fb160fcfb4294d4b0572216033218da702d
/exec -l /bin/zsh/google-cloud-sdk/lib/surface/dataflow/sql/query.py
8660148df0f94ddf4b5afd8079353232390d6b5c
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
sudocams/tech-club
1f2d74c4aedde18853c2b4b729ff3ca5908e76a5
c8540954b11a6fd838427e959e38965a084b2a4c
refs/heads/master
2021-07-15T03:04:40.397799
2020-12-01T20:05:55
2020-12-01T20:05:55
245,985,795
0
1
null
2021-04-30T21:04:39
2020-03-09T08:51:41
Python
UTF-8
Python
false
false
4,392
py
# -*- coding: utf-8 -*- # # Copyright 2020 Google LLC. All Rights Reserved. # # 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. """Implementation of `gcloud dataflow sql query` command.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from googlecloudsdk.api_lib.dataflow import apis from googlecloudsdk.api_lib.dataflow import sql_query_parameters from googlecloudsdk.calliope import base from googlecloudsdk.command_lib.dataflow import dataflow_util from googlecloudsdk.command_lib.dataflow import sql_util from googlecloudsdk.core import properties DETAILED_HELP = { 'DESCRIPTION': 'Execute the user-specified SQL query on Dataflow. Queries must ' 'comply to the ZetaSQL dialect (https://github.com/google/zetasql). ' 'Results may be written to either BigQuery or Cloud Pub/Sub.', 'EXAMPLES': """\ To execute a simple SQL query on Dataflow that reads from and writes to BigQuery, run: $ {command} "SELECT word FROM bigquery.table.`my-project`.input_dataset.input_table where count > 3" --job-name=my-job --region=us-west1 --bigquery-dataset=my_output_dataset --bigquery-table=my_output_table To execute a simple SQL query on Dataflow that reads from and writes to Cloud Pub/Sub, run: $ {command} "SELECT word FROM pubsub.topic.`my-project`.input_topic where count > 3" --job-name=my-job --region=us-west1 --pubsub-topic=my_output_topic To join data from BigQuery and Cloud Pub/Sub and write the result to Cloud Pub/Sub, run: $ {command} "SELECT bq.name AS name FROM pubsub.topic.`my-project`.input_topic p INNER JOIN bigquery.table.`my-project`.input_dataset.input_table bq ON p.id = bq.id" --job-name=my-job --region=us-west1 --pubsub-topic=my_output_topic To execute a parameterized SQL query that reads from and writes to BigQuery, run: $ {command} "SELECT word FROM bigquery.table.`my-project`.input_dataset.input_table where count > @threshold" --parameter=threshold:INT64:5 --job-name=my-job --region=us-west1 --bigquery-dataset=my_output_dataset --bigquery-table=my_output_table """, } @base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA) class Query(base.Command): """Execute the user-specified SQL query on Dataflow.""" detailed_help = DETAILED_HELP @staticmethod def Args(parser): """Register flags for this command. Args: parser: argparse.ArgumentParser to register arguments with. """ sql_util.ArgsForSqlQuery(parser) def Run(self, args): region = dataflow_util.GetRegion(args) if args.sql_launcher_template: gcs_location = args.sql_launcher_template else: gcs_location = 'gs://dataflow-sql-templates-{}/latest/sql_launcher_template'.format( region) if args.parameters_file: query_parameters = sql_query_parameters.ParseParametersFile( args.parameters_file) elif args.parameter: query_parameters = sql_query_parameters.ParseParametersList( args.parameter) else: query_parameters = '[]' template_parameters = { 'dryRun': 'true' if args.dry_run else 'false', 'outputs': sql_util.ExtractOutputs(args), 'queryParameters': query_parameters, 'queryString': args.query, } arguments = apis.TemplateArguments( project_id=properties.VALUES.core.project.GetOrFail(), region_id=region, job_name=args.job_name, gcs_location=gcs_location, zone=args.worker_zone, max_workers=args.max_workers, disable_public_ips=properties.VALUES.dataflow.disable_public_ips .GetBool(), parameters=template_parameters, service_account_email=args.service_account_email) return apis.Templates.LaunchDynamicTemplate(arguments)
73bdff696c0f6700a310bb5a449d673efa9b5b3a
866dee1b3d01b863c31332ec81330d1b5ef5c6fa
/openquake.hazardlib/openquake/hazardlib/gsim/rietbrock_2013.py
62e63bdafc600b463ed33925696bfa2c08e799d1
[ "MIT", "AGPL-3.0-only" ]
permissive
rainzhop/ConvNetQuake
3e2e1a040952bd5d6346905b83f39889c6a2e51a
a3e6de3f7992eac72f1b9883fec36b8c7fdefd48
refs/heads/master
2020-08-07T16:41:03.778293
2019-11-01T01:49:00
2019-11-01T01:49:00
213,527,701
0
0
MIT
2019-10-08T02:08:00
2019-10-08T02:08:00
null
UTF-8
Python
false
false
12,553
py
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2014-2016 GEM Foundation # # OpenQuake is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # OpenQuake is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with OpenQuake. If not, see <http://www.gnu.org/licenses/>. """ Module exports :class:`RietbrockEtAl2013SelfSimilar`, :class:`RietbrockEtAl2013MagDependent` """ from __future__ import division import numpy as np # standard acceleration of gravity in m/s**2 from scipy.constants import g from openquake.hazardlib.gsim.base import CoeffsTable, GMPE from openquake.hazardlib import const from openquake.hazardlib.imt import PGA, PGV, SA class RietbrockEtAl2013SelfSimilar(GMPE): """ Implements the ground motion prediction equation of Rietbrock et al (2013): Rietbrock, A., Strasser, F., Edwards, B. (2013) A Stochastic Earthquake Ground-Motion Prediction Model for the United Kingdom. Bulletin of the Seismological Society of America, 103(1), 57 -77 The GMPE is derived for the United Kingdom, a low seismicity region. Consequently ground motions are generated via numerical simulations using a stochastic point-source model, calibrated with parameters derived from local weak-motion data. This implementation applies to the case when stress drop is considered to be self-similar (i.e. independent of magnitude). """ #: Supported tectonic region type is stabe continental crust, DEFINED_FOR_TECTONIC_REGION_TYPE = const.TRT.STABLE_CONTINENTAL #: Supported intensity measure types are spectral acceleration, peak #: ground acceleration and peak ground velocity. DEFINED_FOR_INTENSITY_MEASURE_TYPES = set([ PGA, PGV, SA ]) #: Supported intensity measure component is the geometric mean of two #: horizontal components DEFINED_FOR_INTENSITY_MEASURE_COMPONENT = const.IMC.AVERAGE_HORIZONTAL #: Supported standard deviation types are inter-event, intra-event and #: total DEFINED_FOR_STANDARD_DEVIATION_TYPES = set([ const.StdDev.INTER_EVENT, const.StdDev.INTRA_EVENT, const.StdDev.TOTAL ]) #: No site parameter is required REQUIRES_SITES_PARAMETERS = set() #: Required rupture parameters are magnitude REQUIRES_RUPTURE_PARAMETERS = set(('mag',)) #: Required distance measure is Rjb REQUIRES_DISTANCES = set(('rjb', )) def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types): """ See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. """ # extract dictionaries of coefficients specific to required # intensity measure type C = self.COEFFS[imt] imean = (self._get_magnitude_scaling_term(C, rup.mag) + self._get_distance_scaling_term(C, dists.rjb, rup.mag)) # convert from cm/s**2 to g for SA and from cm/s**2 to g for PGA (PGV # is already in cm/s) and also convert from base 10 to base e. if isinstance(imt, (PGA, SA)): mean = np.log((10.0 ** (imean - 2.0)) / g) else: mean = np.log(10 ** imean) stddevs = self._get_stddevs(C, stddev_types, dists.rjb.shape[0]) return mean, stddevs def _get_magnitude_scaling_term(self, C, mag): """ Returns the magnitude scaling component of the model Equation 10, Page 63 """ return C["c1"] + (C["c2"] * mag) + (C["c3"] * (mag ** 2.0)) def _get_distance_scaling_term(self, C, rjb, mag): """ Returns the distance scaling component of the model Equation 10, Page 63 """ # Depth adjusted distance, equation 11 (Page 63) rval = np.sqrt(rjb ** 2.0 + C["c11"] ** 2.0) f_0, f_1, f_2 = self._get_distance_segment_coefficients(rval) return ((C["c4"] + C["c5"] * mag) * f_0 + (C["c6"] + C["c7"] * mag) * f_1 + (C["c8"] + C["c9"] * mag) * f_2 + (C["c10"] * rval)) def _get_distance_segment_coefficients(self, rval): """ Returns the coefficients describing the distance attenuation shape for three different distance bins, equations 12a - 12c """ # Get distance segment ends nsites = len(rval) # Equation 12a f_0 = np.log10(self.CONSTS["r0"] / rval) f_0[rval > self.CONSTS["r0"]] = 0.0 # Equation 12b f_1 = np.log10(rval) f_1[rval > self.CONSTS["r1"]] = np.log10(self.CONSTS["r1"]) # Equation 12c f_2 = np.log10(rval / self.CONSTS["r2"]) f_2[rval <= self.CONSTS["r2"]] = 0.0 return f_0, f_1, f_2 def _get_stddevs(self, C, stddev_types, num_sites): """ Returns the standard deviation. Original standard deviations are in logarithms of base 10. Converts to natural logarithm. """ stddevs = [] for stddev_type in stddev_types: assert stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES if stddev_type == const.StdDev.TOTAL: sigma = np.sqrt(C["tau"] ** 2.0 + C["phi"] ** 2.0) stddevs.append(np.log(10.0 ** (sigma + np.zeros(num_sites)))) elif stddev_type == const.StdDev.INTRA_EVENT: stddevs.append(np.log(10.0 ** (C["phi"] + np.zeros(num_sites)))) elif stddev_type == const.StdDev.INTER_EVENT: stddevs.append(np.log(10.0 ** (C["tau"] + np.zeros(num_sites)))) return stddevs # Coefficients from Table 5, Page 64 COEFFS = CoeffsTable(sa_damping=5, table="""\ IMT c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 sigma tau phi pgv -2.9598 0.9039 -0.0434 -1.6243 0.1987 -1.6511 0.1654 -2.4308 0.0851 -0.001472 1.7736 0.347 0.311 0.153 pga -0.0135 0.6889 -0.0488 -1.8987 0.2151 -1.9063 0.1740 -2.0131 0.0887 -0.002747 1.5473 0.436 0.409 0.153 0.03 0.8282 0.5976 -0.0418 -2.1321 0.2159 -2.0530 0.1676 -1.5148 0.1163 -0.004463 1.1096 0.449 0.417 0.167 0.04 0.4622 0.6273 -0.0391 -1.7242 0.1644 -1.6849 0.1270 -1.4513 0.0910 -0.004355 1.1344 0.445 0.417 0.155 0.05 0.2734 0.6531 -0.0397 -1.5932 0.1501 -1.5698 0.1161 -1.5350 0.0766 -0.003939 1.1493 0.442 0.416 0.149 0.06 0.0488 0.6945 -0.0420 -1.4913 0.1405 -1.4807 0.1084 -1.6563 0.0657 -0.003449 1.2154 0.438 0.414 0.143 0.08 -0.2112 0.7517 -0.0460 -1.4151 0.1340 -1.4130 0.1027 -1.7821 0.0582 -0.002987 1.2858 0.433 0.410 0.140 0.10 -0.5363 0.8319 -0.0521 -1.3558 0.1296 -1.3579 0.0985 -1.8953 0.0520 -0.002569 1.3574 0.428 0.405 0.138 0.12 -0.9086 0.9300 -0.0597 -1.3090 0.1264 -1.3120 0.0948 -1.9863 0.0475 -0.002234 1.4260 0.422 0.399 0.138 0.16 -1.3733 1.0572 -0.0698 -1.2677 0.1237 -1.2684 0.0910 -2.0621 0.0434 -0.001944 1.4925 0.416 0.392 0.139 0.20 -1.9180 1.2094 -0.0819 -1.2315 0.1213 -1.2270 0.0872 -2.1196 0.0396 -0.001708 1.5582 0.409 0.384 0.141 0.25 -2.5107 1.3755 -0.0949 -1.1992 0.1189 -1.1881 0.0833 -2.1598 0.0361 -0.001522 1.6049 0.402 0.376 0.144 0.31 -3.1571 1.5549 -0.1087 -1.1677 0.1160 -1.1494 0.0791 -2.1879 0.0328 -0.001369 1.6232 0.395 0.366 0.148 0.40 -3.8516 1.7429 -0.1228 -1.1354 0.1126 -1.1099 0.0746 -2.2064 0.0294 -0.001240 1.6320 0.387 0.356 0.152 0.50 -4.5556 1.9258 -0.1360 -1.1015 0.1084 -1.0708 0.0700 -2.2171 0.0261 -0.001129 1.6109 0.378 0.345 0.156 0.63 -5.2405 2.0926 -0.1471 -1.0659 0.1035 -1.0328 0.0655 -2.2220 0.0229 -0.001033 1.5735 0.369 0.333 0.160 0.79 -5.8909 2.2357 -0.1557 -1.0279 0.0981 -0.9969 0.0612 -2.2229 0.0197 -0.000945 1.5262 0.360 0.320 0.164 1.00 -6.4633 2.3419 -0.1605 -0.9895 0.0925 -0.9665 0.0577 -2.2211 0.0167 -0.000863 1.4809 0.350 0.307 0.168 1.25 -6.9250 2.4037 -0.1612 -0.9545 0.0879 -0.9462 0.0558 -2.2178 0.0139 -0.000785 1.4710 0.341 0.294 0.172 1.59 -7.2960 2.4189 -0.1573 -0.9247 0.0848 -0.9421 0.0567 -2.2137 0.0111 -0.000701 1.5183 0.331 0.280 0.177 2.00 -7.5053 2.3805 -0.1492 -0.9128 0.0855 -0.9658 0.0619 -2.2110 0.0086 -0.000618 1.6365 0.323 0.267 0.181 2.50 -7.5569 2.2933 -0.1376 -0.9285 0.0915 -1.0264 0.0729 -2.2108 0.0067 -0.000535 1.8421 0.315 0.254 0.186 3.13 -7.4510 2.1598 -0.1228 -0.9872 0.1050 -1.1349 0.0914 -2.2141 0.0060 -0.000458 2.1028 0.308 0.242 0.190 4.00 -7.1688 1.9738 -0.1048 -1.1274 0.1325 -1.3132 0.1207 -2.2224 0.0079 -0.000397 2.4336 0.299 0.227 0.195 5.00 -6.8063 1.7848 -0.0879 -1.3324 0.1691 -1.5158 0.1533 -2.2374 0.0142 -0.000387 2.6686 0.291 0.214 0.198 """) CONSTS = {"r0": 10.0, "r1": 50.0, "r2": 100.0} class RietbrockEtAl2013MagDependent(RietbrockEtAl2013SelfSimilar): """ Implements the Rietbrock et al (2013) GMPE for the case in which the stress parameter is magnitude-dependent (Table 6, Page 65) """ # Coefficients from Table 6, Page 65 COEFFS = CoeffsTable(sa_damping=5, table="""\ IMT c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 sigma tau phi pgv -4.9398 1.7051 -0.1081 -1.6063 0.2084 -1.6040 0.1527 -2.2932 0.0659 -0.001643 3.1138 0.276 0.229 0.155 pga -2.6934 1.7682 -0.1366 -1.8544 0.2123 -1.8467 0.1590 -1.8809 0.0681 -0.002888 2.1589 0.335 0.298 0.154 0.03 -1.9654 1.7265 -0.1346 -2.1011 0.2101 -2.0063 0.1555 -1.3684 0.0946 -0.004626 1.3437 0.348 0.304 0.169 0.04 -2.3216 1.7592 -0.1328 -1.7198 0.1635 -1.6582 0.1192 -1.3348 0.0730 -0.004488 1.3363 0.343 0.305 0.157 0.05 -2.4879 1.7771 -0.1328 -1.5910 0.1502 -1.5447 0.1087 -1.4304 0.0599 -0.004056 1.3942 0.339 0.304 0.150 0.06 -2.6647 1.8009 -0.1336 -1.4916 0.1409 -1.4576 0.1013 -1.5603 0.0494 -0.003549 1.4587 0.335 0.302 0.144 0.08 -2.8579 1.8325 -0.1353 -1.4169 0.1349 -1.3909 0.0959 -1.6918 0.0423 -0.003077 1.5466 0.330 0.299 0.140 0.10 -3.0920 1.8771 -0.1381 -1.3587 0.1312 -1.3363 0.0919 -1.8091 0.0363 -0.002651 1.6583 0.325 0.295 0.138 0.12 -3.3595 1.9336 -0.1419 -1.3133 0.1289 -1.2908 0.0884 -1.9038 0.0322 -0.002311 1.7807 0.320 0.289 0.137 0.16 -3.6974 2.0096 -0.1472 -1.2717 0.1262 -1.2472 0.0847 -1.9844 0.0286 -0.002015 1.8540 0.314 0.282 0.138 0.20 -4.1004 2.1032 -0.1537 -1.2341 0.1234 -1.2055 0.0809 -2.0474 0.0254 -0.001772 1.9055 0.307 0.273 0.141 0.25 -4.5462 2.2068 -0.1607 -1.1985 0.1198 -1.1658 0.0770 -2.0935 0.0227 -0.001579 1.9052 0.301 0.263 0.145 0.31 -5.0372 2.3180 -0.1679 -1.1625 0.1155 -1.1258 0.0728 -2.1276 0.0201 -0.001419 1.8732 0.294 0.253 0.150 0.40 -5.5650 2.4307 -0.1745 -1.1242 0.1104 -1.0847 0.0682 -2.1519 0.0176 -0.001282 1.8142 0.288 0.242 0.155 0.50 -6.0933 2.5325 -0.1795 -1.0837 0.1043 -1.0436 0.0635 -2.1680 0.0152 -0.001166 1.7238 0.282 0.231 0.161 0.63 -6.5914 2.6123 -0.1820 -1.0432 0.0985 -1.0044 0.0591 -2.1775 0.0129 -0.001066 1.6524 0.276 0.220 0.167 0.79 -7.0402 2.6616 -0.1813 -1.0023 0.0927 -0.9683 0.0552 -2.1820 0.0109 -0.000977 1.5900 0.272 0.210 0.172 1.00 -7.4028 2.6715 -0.1767 -0.9634 0.0877 -0.9394 0.0526 -2.1827 0.0092 -0.000898 1.5549 0.268 0.201 0.177 1.25 -7.6577 2.6402 -0.1686 -0.9299 0.0842 -0.9226 0.0519 -2.1811 0.0079 -0.000827 1.5712 0.265 0.193 0.181 1.59 -7.8128 2.5609 -0.1559 -0.9021 0.0829 -0.9242 0.0544 -2.1782 0.0069 -0.000756 1.6701 0.262 0.185 0.186 2.00 -7.8368 2.4440 -0.1409 -0.8896 0.0857 -0.9546 0.0613 -2.1751 0.0064 -0.000691 1.9205 0.260 0.177 0.191 2.50 -7.7341 2.2967 -0.1244 -0.9012 0.0975 -1.0270 0.0747 -2.1717 0.0066 -0.000634 2.6233 0.258 0.169 0.195 3.13 -7.4991 2.1232 -0.1072 -0.9638 0.1202 -1.1604 0.0965 -2.1763 0.0077 -0.000571 3.5221 0.256 0.161 0.199 4.00 -7.1376 1.9232 -0.0893 -1.1238 0.1549 -1.3647 0.1284 -2.1901 0.0114 -0.000515 4.0984 0.253 0.152 0.203 5.00 -6.7757 1.7502 -0.0753 -1.3603 0.1960 -1.5804 0.1613 -2.2070 0.0191 -0.000518 4.3313 0.251 0.144 0.205 """)
6d79e71393d64f0edbbbf664cb42d7c442fe0144
291ab4b5b1b99d0d59ce2fb65efef04b84fd78bd
/tmp_testdir/Forex_Trading212/test7_login_trading212_getlist_clickable_ids.py
aea9cb52055d4c857f788869d5590a1fda71a568
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
cromox1/Trading212
15b5ea55d86e7063228f72dd92525e1fca693338
68f9b91098bc9184e16e9823a5e07e6b31e59602
refs/heads/main
2023-04-17T23:03:07.078229
2021-05-05T23:02:54
2021-05-05T23:02:54
320,100,427
0
2
null
2021-04-13T07:03:41
2020-12-09T22:58:06
Python
UTF-8
Python
false
false
3,499
py
__author__ = 'cromox' from time import sleep from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import WebDriverException # from selenium.webdriver.common.action_chains import ActionChains as hoover chromedriverpath = r'C:\tools\chromedriver\chromedriver.exe' chrome_options = Options() chrome_options.add_argument('--ignore-certificate-errors') chrome_options.add_argument("--disable-web-security") # chrome_options.add_argument("--incognito") chrome_options.add_argument("--allow-running-insecure-content") chrome_options.add_argument("--allow-cross-origin-auth-prompt") chrome_options.add_argument("--disable-cookie-encryption") chrome_options.add_argument('--disable-dev-shm-usage') chrome_options.add_argument('--disable-default-apps') chrome_options.add_argument('--disable-prompt-on-repost') chrome_options.add_argument("--disable-zero-browsers-open-for-tests") chrome_options.add_argument("--no-default-browser-check") chrome_options.add_argument("--test-type") prefs = {"profile.default_content_setting_values.notifications" : 2} chrome_options.add_experimental_option("prefs", prefs) ## webdriver section driver = webdriver.Chrome(chromedriverpath, options=chrome_options) driver.implicitly_wait(10) base_url = "https://www.trading212.com" driver.maximize_window() driver.get(base_url) driver.find_element_by_id("cookie-bar").click() driver.find_element_by_id("login-header-desktop").click() user1 = "[email protected]" pswd1 = "Serverg0d!" driver.find_element_by_id("username-real").send_keys(user1 + Keys.ENTER) driver.find_element_by_id("pass-real").send_keys(pswd1 + Keys.ENTER) sleep(10) # ### Need to find a way to go to pop-up window # but for now I just use simple solution - find the xpath :-) xpath1 = '//*[@id="onfido-upload"]/div[1]/div[2]' driver.find_element_by_xpath(xpath1).click() template_bar = '//*[@id="chartTabTemplates"]/div' driver.find_element_by_id("chartTabTemplates").click() search_section = driver.find_element_by_id("navigation-search-button") search_section.click() # search_section.send_keys('GBP/USD' + Keys.ENTER) driver.find_element_by_xpath("//*[contains(text(),'Currencies')]").click() driver.find_element_by_xpath("//*[contains(text(),'Major')]").click() # CSS selector # valuetofind = 'input[id*="uniqName_"]' # list_ids = driver.find_elements_by_css_selector(valuetofind) # # XPATH valuetofind = '//*[contains(@id, "uniqName_")]' list_ids = driver.find_elements_by_xpath(valuetofind) # print('ALL = ', list_ids) print('ALL uniqName = ', len(list_ids)) if len(list_ids) >= 1: i = 1 for idx in list_ids: try: idxx = idx.get_attribute('id') print(i, idxx, end='') try: if 'GBP/USD' in driver.find_element_by_id(idxx).text: idx.click() print(' / CLICKABLE') else: print(' / # NO GBP/USD') except WebDriverException: print(' / NOT CLICKABLE') except WebDriverException: print(i, idx.id, end='') try: if 'GBP/USD' in idx.text: idx.click() print(' / CLICKABLE') else: print(' / # NO GBP/USD') except WebDriverException: print(' / NOT CLICKABLE') i += 1 else: print('NO ELEMENT APPEARED !!')
5b87694f3a2a886ff560e2762344f137ca502f69
434fb731cb30b0f15e95da63f353671b0153c849
/build/hector_slam/hector_slam_launch/catkin_generated/pkg.installspace.context.pc.py
f6f612668cd0e6089313919ad50250aaa8624d2b
[]
no_license
lievech/lhn_ws
e3e10ff20e28e59583e51660d2802ff24c7cd0b5
644fc48b91788078734df9bdece06c8b9f6b45b9
refs/heads/master
2020-08-02T20:21:19.489061
2019-09-28T12:08:26
2019-09-28T12:08:26
211,494,773
0
0
null
null
null
null
UTF-8
Python
false
false
376
py
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else [] PROJECT_CATKIN_DEPENDS = "".replace(';', ' ') PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else [] PROJECT_NAME = "hector_slam_launch" PROJECT_SPACE_DIR = "/home/lhn/lhn_ws/install" PROJECT_VERSION = "0.3.5"
3ab187b444848f3432ee2fe85296aa11c48ef180
7cdfbe80ac56a042b9b99c1cb17766683da439b4
/paper2/setup_files/old_setup/results.py
e65818b069a43060086e85eafae81b63aa9666d4
[]
no_license
bacook17/pixcmd
1e918cc6b147abe1885f9533836005b9f2b30012
fac20ced14492fd32448d2722c377d88145f90a1
refs/heads/master
2021-01-18T11:54:13.625834
2019-07-30T15:13:12
2019-07-30T15:13:12
67,228,636
0
0
null
2016-09-02T14:18:59
2016-09-02T14:18:58
null
UTF-8
Python
false
false
6,480
py
__all__ = ['models', 'results', 'pcmds', 'data'] try: import pcmdpy_gpu as ppy except: import pcmdpy as ppy import numpy as np from os.path import expanduser models = {} run_names = {} results = {} pcmds = {} data = {} results_dir = expanduser('~/pCMDs/pixcmd/paper2/results/') data_dir = expanduser('~/pCMDs/pixcmd/data/') model_nonparam = ppy.galaxy.CustomGalaxy( ppy.metalmodels.SingleFeH(), ppy.dustmodels.SingleDust(), ppy.sfhmodels.NonParam(), ppy.distancemodels.VariableDistance() ) model_fixeddist = ppy.galaxy.CustomGalaxy( ppy.metalmodels.SingleFeH(), ppy.dustmodels.SingleDust(), ppy.sfhmodels.NonParam(), ppy.distancemodels.FixedDistance() ) model_tau = ppy.galaxy.CustomGalaxy( ppy.metalmodels.SingleFeH(), ppy.dustmodels.SingleDust(), ppy.sfhmodels.TauModel(), ppy.distancemodels.VariableDistance() ) model_ssp = ppy.galaxy.CustomGalaxy( ppy.metalmodels.SingleFeH(), ppy.dustmodels.SingleDust(), ppy.sfhmodels.SSPModel(), ppy.distancemodels.VariableDistance() ) model_ssp_mdf = ppy.galaxy.CustomGalaxy( ppy.metalmodels.FixedWidthNormMDF(0.2), ppy.dustmodels.SingleDust(), ppy.sfhmodels.SSPModel(), ppy.distancemodels.VariableDistance() ) model_ssp_fixed = ppy.galaxy.CustomGalaxy( ppy.metalmodels.SingleFeH(), ppy.dustmodels.SingleDust(), ppy.sfhmodels.SSPModel(), ppy.distancemodels.FixedDistance() ) custom_sfh = ppy.sfhmodels.NonParam() custom_sfh.update_sfh_edges(np.array([9.5, 9.75, 10.0, 10.2])) custom_sfh.update_edges(np.arange(9.0, 10.3, 0.1)) model_df2_nonparam = ppy.galaxy.CustomGalaxy( ppy.metalmodels.SingleFeH(), ppy.dustmodels.SingleDust(), custom_sfh, ppy.distancemodels.VariableDistance() ) def add_set(galaxy, mnum, region, key, model=model_nonparam, colors='z_gz', run_name=None): data_file = data_dir + f'{galaxy.lower()}/pcmds/{galaxy}_{colors}_{region}.pcmd' run_names[key] = run_name res_file = results_dir + f'{galaxy}_m{mnum}_r{region}.csv' live_file = res_file.replace('.csv', '_live.csv') pcmd_file = res_file.replace('.csv', '.pcmd') models[key] = model.copy() results[key] = ppy.results.ResultsPlotter( res_file, live_file=live_file, run_name=run_name, gal_model=models[key], model_is_truth=False) data[key] = np.loadtxt(data_file, unpack=True) try: pcmds[key] = np.loadtxt(pcmd_file, unpack=True) except: pass # M87 print('M87') add_set('M87', 3, 44, 'M87_m3', colors='I_VI') add_set('M87', 4, 104, 'M87_m4', colors='I_VI') add_set('M87', 4, 101, 'M87_m4_q1', colors='I_VI') add_set('M87', 4, 102, 'M87_m4_q2', colors='I_VI') add_set('M87', 4, 103, 'M87_m4_q3', colors='I_VI') add_set('M87', 5, 204, 'M87_m5', colors='I_VI') add_set('M87', 6, 264, 'M87_m6', colors='I_VI') add_set('M87', 7, 104, 'M87_m7', model=model_fixeddist, colors='I_VI') add_set('M87', 8, 104, 'M87_m8', model=model_tau, colors='I_VI') add_set('M87', 9, 104, 'M87_m9', model=model_ssp, colors='I_VI') add_set('M87', 10, 104, 'M87_m10', model=model_ssp, colors='I_VI') add_set('M87', 11, 104, 'M87_m11', model=model_ssp, colors='I_VI') add_set('M87', 12, 104, 'M87_m12', model=model_ssp_fixed, colors='I_VI') add_set('M87', 13, 104, 'M87_m13', model=model_ssp, colors='I_VI') add_set('M87', 14, 104, 'M87_m14', model=model_ssp, colors='I_VI') add_set('M87', 15, 104, 'M87_m15', model=model_ssp_mdf, colors='I_VI') add_set('M87', 16, 104, 'M87_m16', model=model_ssp, colors='I_VI') add_set('M87', 17, 104, 'M87_m17', model=model_ssp, colors='I_VI') add_set('M87', 18, 44, 'M87_m18_1', model=model_ssp, colors='I_VI') add_set('M87', 18, 104, 'M87_m18_2', model=model_ssp, colors='I_VI') add_set('M87', 18, 204, 'M87_m18_3', model=model_ssp, colors='I_VI') add_set('M87', 18, 264, 'M87_m18_4', model=model_ssp, colors='I_VI') # M49 print('M49') add_set('M49', 3, 40, 'M49_m3') add_set('M49', 4, 100, 'M49_m4') add_set('M49', 4, 97, 'M49_m4_q1') add_set('M49', 4, 98, 'M49_m4_q2') add_set('M49', 4, 99, 'M49_m4_q3') add_set('M49', 5, 204, 'M49_m5') add_set('M49', 6, 256, 'M49_m6') add_set('M49', 7, 100, 'M49_m7', model=model_fixeddist) add_set('M49', 8, 100, 'M49_m8', model=model_tau) add_set('M49', 9, 100, 'M49_m9', model=model_ssp) add_set('M49', 10, 100, 'M49_m10', model=model_ssp) add_set('M49', 11, 40, 'M49_m11_1', model=model_ssp) add_set('M49', 11, 100, 'M49_m11_2', model=model_ssp) add_set('M49', 11, 204, 'M49_m11_3', model=model_ssp) add_set('M49', 11, 256, 'M49_m11_4', model=model_ssp) # NGC 3377 print('NGC3377') add_set('NGC3377', 3, 41, 'NGC3377_m3') add_set('NGC3377', 4, 97, 'NGC3377_m4') add_set('NGC3377', 4, 98, 'NGC3377_m4_q1') add_set('NGC3377', 4, 99, 'NGC3377_m4_q2') add_set('NGC3377', 4, 100, 'NGC3377_m4_q3') add_set('NGC3377', 5, 173, 'NGC3377_m5') add_set('NGC3377', 6, 241, 'NGC3377_m6') add_set('NGC3377', 7, 97, 'NGC3377_m7', model=model_fixeddist) add_set('NGC3377', 8, 97, 'NGC3377_m8', model=model_tau) add_set('NGC3377', 9, 97, 'NGC3377_m9', model=model_ssp) add_set('NGC3377', 10, 97, 'NGC3377_m10', model=model_ssp) add_set('NGC3377', 11, 41, 'NGC3377_m11_1', model=model_ssp) add_set('NGC3377', 11, 97, 'NGC3377_m11_2', model=model_ssp) add_set('NGC3377', 11, 173, 'NGC3377_m11_3', model=model_ssp) add_set('NGC3377', 11, 241, 'NGC3377_m11_4', model=model_ssp) # NGC 4993 print('NGC4993') add_set('NGC4993', 3, 35, 'NGC4993_m3') add_set('NGC4993', 4, 83, 'NGC4993_m4') add_set('NGC4993', 4, 81, 'NGC4993_m4_q1') add_set('NGC4993', 4, 82, 'NGC4993_m4_q2') add_set('NGC4993', 4, 84, 'NGC4993_m4_q3') add_set('NGC4993', 5, 103, 'NGC4993_m5') # add_set('NGC4993', 6, 241, 'NGC4993_m6') add_set('NGC4993', 7, 83, 'NGC4993_m7', model=model_fixeddist) add_set('NGC4993', 8, 83, 'NGC4993_m8', model=model_tau) add_set('NGC4993', 9, 83, 'NGC4993_m9', model=model_ssp) # DF2 print('DF2') for i in range(1, 6): df2_res = results_dir + f'DF2_m{i}.csv' df2_live = df2_res.replace('.csv', '_live.csv') df2_data = data_dir + 'DF2/pcmds/DF2_I_VI_1.pcmd' if i in [2, 4]: model = model_df2_nonparam.copy() else: model = model_ssp.copy() results[f'DF2_m{i}'] = ppy.results.ResultsPlotter( df2_res, live_file=df2_live, run_name=f'DF2, model {i}', gal_model=model, model_is_truth=False) data[f'DF2_m{i}'] = np.loadtxt(df2_data, unpack=True) try: pcmds[f'DF2_m{i}'] = np.loadtxt(df2_res.replace('.csv', '.pcmd'), unpack=True) except: pass
1fc1f45b446d4c3afe5b69bf2f9515f4c46607ff
3e381dc0a265afd955e23c85dce1e79e2b1c5549
/hs-S1/icice_ucgenler.py
77342ff2d6194916bac0664099c50bf72246660a
[]
no_license
serkancam/byfp2-2020-2021
3addeb92a3ff5616cd6dbd3ae7b2673e1a1a1a5e
c67206bf5506239d967c3b1ba75f9e08fdbad162
refs/heads/master
2023-05-05T04:36:21.525621
2021-05-29T11:56:27
2021-05-29T11:56:27
322,643,962
0
0
null
null
null
null
UTF-8
Python
false
false
253
py
import turtle as t t.Screen().setup(600, 600) # https://studio.code.org/s/course4/stage/10/puzzle/2 for adim in range(50, 101, 10): # 50 60 70 80 90 100 for i in range(3): # 0 1 2 t.forward(adim) t.left(120) t.done()
a3411e1ceb6ec195c179f41219c2ee0009ff2aee
a851573ec818149d03602bb17b1b97235b810a06
/apps/network1/views.py
4660b228bf38e659146ac63097baf2a2b9f8438a
[]
no_license
kswelch53/mypython_projects2
42afc71714ff7e10e1d8d4e6a5965ff58380e9bd
97d9faa5ea326b86dd7f48be1a822b3a58f3189c
refs/heads/master
2021-04-06T07:22:04.982315
2018-03-30T02:35:20
2018-03-30T02:35:20
125,312,491
0
0
null
null
null
null
UTF-8
Python
false
false
3,143
py
from django.shortcuts import render, HttpResponse, redirect # links model to view functions from .models import User # allows flash messages to html from django.contrib import messages # Note: Registration and login validations are done in models.py # displays a form on index.html for users to enter login or registration info def index(request): print("This is index function in network1 views.py") return render(request, 'network1/index.html') # logs in user if validations are met def login(request): print("This is login function in network1 views.py") # saves user POST data from models method login_user in response_from_models: response_from_models = User.objects.login_user(request.POST) print("Response from models:", response_from_models) if response_from_models['status']:#if true (validations are met): #saves user data in session, sends user to 2nd app: request.session['user_id'] = response_from_models['user'].id request.session['user_name'] = response_from_models['user'].name return redirect('network2:index') else:#returns user to index.html, displays error message: messages.error(request, response_from_models['errors']) return redirect('network1:index') # saves a user object if registration validations are met def register(request): print("This is register function in network1 views.py") # this checks that users have submitted form data before proceeding to register route if request.method == 'POST': print("Request.POST:", request.POST) # invokes validations method from the model manager # saves user data from models.py in a variable # whatever is sent back in the UserManager return statement response_from_models = User.objects.validate_user(request.POST) print("Response from models:", response_from_models) if response_from_models['status']:#if true # passed the validations and created a new user # user can now be saved in session, by id: # index method in 2nd app will use this: request.session['user_id'] = response_from_models['user'].id request.session['user_name'] = response_from_models['user'].name print("Name:", request.session['user_name']) #redirects to index method in 2nd app via named route network2 from project-level urls.py return redirect('network2:index')#named route/views.py method # 1st app handles only logging in / registering users else: # add flash messages to html: for error in response_from_models['errors']: messages.error(request, error) # returns to index.html via named route network1, index method in views.py return redirect('network1:index') # if not POST, redirects to index method via named route namespace=network1 else: return redirect('network1:index') def logout (request): request.session.clear()#deletes everything in session return redirect('network1:index')
1eb1a20cca4e64744c3c860ba9ffc78209de8c23
f07a42f652f46106dee4749277d41c302e2b7406
/Data Set/bug-fixing-4/3339d802402fd2f2ed5e954434c637bf7a68124d-<_make_validation_split>-bug.py
1827f4775913b4407f7cdf26bba80b06443aca84
[]
no_license
wsgan001/PyFPattern
e0fe06341cc5d51b3ad0fe29b84098d140ed54d1
cc347e32745f99c0cd95e79a18ddacc4574d7faa
refs/heads/main
2023-08-25T23:48:26.112133
2021-10-23T14:11:22
2021-10-23T14:11:22
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,278
py
def _make_validation_split(self, y): 'Split the dataset between training set and validation set.\n\n Parameters\n ----------\n y : array, shape (n_samples, )\n Target values.\n\n Returns\n -------\n validation_mask : array, shape (n_samples, )\n Equal to 1 on the validation set, 0 on the training set.\n ' n_samples = y.shape[0] validation_mask = np.zeros(n_samples, dtype=np.uint8) if (not self.early_stopping): return validation_mask if is_classifier(self): splitter_type = StratifiedShuffleSplit else: splitter_type = ShuffleSplit cv = splitter_type(test_size=self.validation_fraction, random_state=self.random_state) (idx_train, idx_val) = next(cv.split(np.zeros(shape=(y.shape[0], 1)), y)) if ((idx_train.shape[0] == 0) or (idx_val.shape[0] == 0)): raise ValueError(('Splitting %d samples into a train set and a validation set with validation_fraction=%r led to an empty set (%d and %d samples). Please either change validation_fraction, increase number of samples, or disable early_stopping.' % (n_samples, self.validation_fraction, idx_train.shape[0], idx_val.shape[0]))) validation_mask[idx_val] = 1 return validation_mask
214b351155bd5bbd835658ddee5d7b0cf7b101c2
e1fa4f0e678bcc7a71afd23fd1bd693a4f503765
/ss/ss_coroutine.py
b0e5c58010598a07ff04339fa96dc5854805145a
[]
no_license
smallstrong0/spider
b20460b33aeee5989870acd95cc1addd6996c1ed
cb3807978ff9599fbf669fe4068040f4252f6432
refs/heads/master
2020-03-31T07:59:43.046207
2019-01-03T15:47:06
2019-01-03T15:47:06
152,041,262
3
0
null
null
null
null
UTF-8
Python
false
false
522
py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/10/18 22:07 # @Author : SmallStrong # @Des : # @File : ss_coroutine.py # @Software: PyCharm import sys import os # 被逼无奈 sys.path.append(os.getcwd().replace('/ss', '')) from spider_core import go from func import exe_time from gevent import monkey, pool import config monkey.patch_all() @exe_time def main(): p = pool.Pool(config.COROUTINE_LIMIT_NUM) while config.FLAG: p.spawn(go) if __name__ == '__main__': main()
0f681b24574bb63ce377e1191448ddd879adf9f5
a1a42b2165f8cb899bff02f10d8b081b372ce9d3
/mshub-gc/tools/mshub-gc/proteosafe.py
e07803964ed3cb3f1c66b859fd0c5d1233211319
[ "Apache-2.0" ]
permissive
CCMS-UCSD/GNPS_Workflows
47ca90ba177b3ddc1a71877a3ee92473e0fe392b
8c6772e244c6f3e5ea7cd5eae873b6faa48b7313
refs/heads/master
2023-08-31T13:38:51.911232
2023-08-24T06:06:37
2023-08-24T06:06:37
57,243,138
41
45
NOASSERTION
2023-06-13T16:54:49
2016-04-27T19:52:07
HTML
UTF-8
Python
false
false
72
py
../../../CCMS_ProteoSAFe_pythonAPI/ccmsproteosafepythonapi/proteosafe.py
d8fadea0f97b759ec5a8eb75c034fb3b9505259d
e46a95f42e61c71968c60400f11924b4ad22bf59
/0x09-Unittests_and_integration_tests/test_utils.py
c82ada87f519caa128197f16d307056ad525f535
[]
no_license
mahdibz97/holbertonschool-web_back_end
669b68c7ba6be937757a88999c7acc6afd6b58ca
017a250f477599aee48f77e9d215c74b4bb62a14
refs/heads/master
2023-06-04T15:25:14.752977
2021-06-15T23:39:43
2021-06-15T23:39:43
348,126,696
0
0
null
null
null
null
UTF-8
Python
false
false
2,351
py
#!/usr/bin/env python3 """ unittesting Module """ from typing import Mapping, Sequence import unittest from unittest.case import TestCase from unittest.mock import patch from parameterized import parameterized from utils import access_nested_map, get_json, memoize class TestAccessNestedMap(unittest.TestCase): """ access_nested_map unit testing class """ @parameterized.expand([ ({"a": 1}, ("a",), 1), ({"a": {"b": 2}}, ("a",), {"b": 2}), ({"a": {"b": 2}}, ("a", "b"), 2) ]) def test_access_nested_map(self, nested_map: Mapping, path: Sequence, res): """ access_nested_map result testing method """ self.assertEqual(access_nested_map(nested_map, path), res) @parameterized.expand([ ({}, ("a",)), ({"a": 1}, ("a", "b")), ]) def test_access_nested_map_exception(self, nested_map: Mapping, path: Sequence): """ access_nested_map exceptions testing method """ self.assertRaises(KeyError, access_nested_map, nested_map, path) class TestGetJson(unittest.TestCase): """ get_json unit testing class """ @parameterized.expand([ ("http://example.com", {"test_payload": True}), ("http://holberton.io", {"test_payload": False}) ]) def test_get_json(self, test_url, test_payload): """ get_json result and number of calls testing method """ with patch('requests.get') as patched: patched.return_value.json.return_value = test_payload self.assertEqual(get_json(test_url), test_payload) patched.assert_called_once() class TestMemoize(unittest.TestCase): """ memoize decorator unit testing class """ def test_memoize(self): """ memoize decorator result and number of calls testing method """ class TestClass: def a_method(self): return 42 @memoize def a_property(self): return self.a_method() with patch.object(TestClass, 'a_method', return_value=42) as patched: test_class = TestClass() self.assertEqual(test_class.a_property, patched.return_value) self.assertEqual(test_class.a_property, patched.return_value) patched.assert_called_once()
e372ecde50ffe894a9ac6d0b20f743cc0b640425
b125f9a750a519c9c7a5ed66adb8530e0237367b
/str/StrDemo11.py
5931339c369e670d1e64b0c073cf7184825c807b
[]
no_license
isisisisisitch/geekPython
4e49fe19b4cca9891056f33464518272265e3dab
635e246dca7a221d87a3b3c5b07d1e177527498f
refs/heads/master
2021-05-27T01:29:09.755225
2021-01-18T23:18:46
2021-01-18T23:18:46
254,200,920
0
0
null
null
null
null
UTF-8
Python
false
false
290
py
#the taste is not xxx poor! #the taste is good! #the taste is poor! #the taste is poor! str="the taste is xxx poor" snot = str.find("not") print(snot) spoor = str.find("poor") if spoor> snot and snot>0: str = str.replace(str[snot:(spoor+4)],"good") print(str) else: print(str)
9f52f653a93cd4087e7542d49ffc7bedf4a10ac7
d554b1aa8b70fddf81da8988b4aaa43788fede88
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/222/users/4066/codes/1846_1273.py
b84605ab2c0be8357722a17f2744c6e7aaf7d32b
[]
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
536
py
from numpy import * from numpy.linalg import * # Nosso sistema aqui tem matriz_dos_coeficientes = array([[1,-1,0,0], [0, 1, -1, 0], [0, 0, 1, 0], [1, 0, 0, 1]]) # Resolução do sistema AX = B # onde A = Matriz dos coeficientes, X = Vetor do Fluxo e B = Matriz das incognitas matriz_das_incognitas = array([50,-120,350,870]) Vetor_do_Fluxo = dot(inv(matriz_dos_coeficientes),matriz_das_incognitas) z = zeros(4) for i in range(size(Vetor_do_Fluxo)): z[i] = round(Vetor_do_Fluxo[i], 1) print(z)
54f8f44f719f7d3c0acc91b5c3995ea9a048a642
c0c4b1db16a7f85a74cba224f3ebea5660db379e
/old_files/AGILENT33220A_SERVER.py
9bd730306419b55de399a47b7a53dd5763d04f45
[]
no_license
trxw/HaeffnerLabLattice
481bd222ebbe4b6df72a9653e18e0bf0d43ba15e
d88d345c239e217eeb14a39819cfe0694a119e7c
refs/heads/master
2021-01-16T18:13:36.548643
2014-05-09T21:47:23
2014-05-09T21:47:23
20,747,092
1
0
null
null
null
null
UTF-8
Python
false
false
6,087
py
from labrad.server import LabradServer, setting import serial class AgilentServer(LabradServer): """Controls Agilent 33220A Signal Generator""" name = "%LABRADNODE% AGILENT 33220A SERVER" def initServer( self ): #communication configuration self._port = 'COM11' self._addr = 0 #instruments GPIB address #initialize communication self._ser = serial.Serial(self._port) self._ser.timeout = 1 self._ser.write(self.SetAddrStr(self._addr)) #set address self.SetControllerWait(0) #turns off automatic listen after talk, necessary to stop line unterminated errors @setting(1, "Identify", returns='s') def Identify(self, c): '''Ask instrument to identify itself''' command = self.IdenStr() self._ser.write(command) self.ForceRead() #expect a reply from instrument #time.sleep(self._waitTime) ## apperently not needed, communication fast answer = self._ser.readline()[:-1] return answer @setting(2, "GetFreq", returns='v') def GetFreq(self,c): '''Returns current frequency''' command = self.FreqReqStr() self._ser.write(command) self.ForceRead() #expect a reply from instrument answer = self._ser.readline() return answer @setting(3, "SetFreq", freq = 'v', returns = "") def SetFreq(self,c,freq): '''Sets frequency, enter value in MHZ''' command = self.FreqSetStr(freq) self._ser.write(command) @setting(4, "GetState", returns='w') def GetState(self,c): '''Request current on/off state of instrument''' command = self.StateReqStr() self._ser.write(command) self.ForceRead() #expect a reply from instrument answer = str(int(self._ser.readline())) return answer @setting(5, "SetState", state= 'w', returns = "") def SetState(self,c, state): '''Sets on/off (enter 1/0)''' command = self.StateSetStr(state) self._ser.write(command) @setting(6, "GetPower", returns = 'v') def GetPower(self,c): ''' Returns current power level in dBm''' command = self.PowerReqStr() self._ser.write(command) self.ForceRead() #expect a reply from instrument answer = self._ser.readline() return answer @setting(7, "SetPower", level = 'v',returns = "") def SetPower(self,c, level): '''Sets power level, enter power in dBm''' command = self.PowerSetStr(level) self._ser.write(command) @setting(8, "GetVoltage", returns = 'v') def GetVoltage(self,c): '''Returns current voltage level in Volts''' command = self.VoltageReqStr() self._ser.write(command) self.ForceRead() #expect a reply from instrument answer = self._ser.readline() return answer @setting(9, "SetVoltage", level = 'v',returns = "") def SetVoltage(self,c, level): '''Sets voltage level, enter power in volts''' command = self.VoltageSetStr(level) self._ser.write(command) @setting(10, "Get Function", returns = 's') def GetFunc(self,c): ''' Returns the current function output of the instrument''' command = self.FunctionReqStr() self._ser.write(command) self.ForceRead() #expect a reply from instrument answer = self._ser.readline()[:-1] return answer @setting(11, "Set Function", func = 's',returns = "") def setFunc(self,c, func): '''Sets type of function to output: SINE, SQUARE, RAMP, PULSE, NOISE, or DC''' command = self.FunctionSetStr(func) self._ser.write(command) #send message to controller to indicate whether or not (status = 1 or 0) #a response is expected from the instrument def SetControllerWait(self,status): command = self.WaitRespStr(status) #expect response from instrument self._ser.write(command) def ForceRead(self): command = self.ForceReadStr() self._ser.write(command) def IdenStr(self): return '*IDN?'+'\r\n' # string to request current frequency def FreqReqStr(self): return 'FREQuency?' + '\r\n' # string to set freq in Hz def FreqSetStr(self,freq): return 'FREQuency '+ str(freq) +'\r\n' # string to request on/off? def StateReqStr(self): return 'OUTPut?' + '\r\n' # string to set on/off (state is given by 0 or 1) def StateSetStr(self, state): if state == 1: comstr = 'OUTPut ON' + '\r\n' else: comstr = 'OUTPut OFF' + '\r\n' return comstr # string to request current power def PowerReqStr(self): return 'Voltage:UNIT DBM\r\n'+'Voltage?' + '\r\n' # string to request voltage def VoltageReqStr(self): return 'Voltage:UNIT VPP\r\n'+'Voltage?' + '\r\n' # string to set power (in dBm) def PowerSetStr(self,pwr): return 'Voltage:UNIT DBM\r\n' + 'Voltage ' +str(pwr) + '\r\n' # string to set voltage def VoltageSetStr(self,volt): return 'Voltage:UNIT VPP\r\n'+'Voltage ' +str(volt) + '\r\n' # string to get current function def FunctionReqStr(self): return 'FUNCtion?\r\n' # string to set function def FunctionSetStr(self,func): if func == 'SINE': comstr = 'FUNCtion ' + 'SIN' + '\r\n' elif func == 'SQUARE': comstr = 'FUNCtion ' + 'SQU' + '\r\n' elif func == 'RAMP': comstr = 'FUNCtion ' + 'RAMP' + '\r\n' elif func == 'PULSE': comstr = 'FUNCtion ' + 'PULSe' + '\r\n' elif func == 'NOISE': comstr = 'FUNCtion ' + 'NOISe' + '\r\n' elif func == 'DC': comstr = 'FUNCtion ' + 'DC' + '\r\n' return comstr # string to force read def ForceReadStr(self): return '++read eoi' + '\r\n' # string for prologix to request a response from instrument, wait can be 0 for listen / for talk def WaitRespStr(self, wait): return '++auto '+ str(wait) + '\r\n' # string to set the addressing of the prologix def SetAddrStr(self, addr): return '++addr ' + str(addr) + '\r\n' if __name__ == "__main__": from labrad import util util.runServer(AgilentServer())
a8f705ff4d757e712d27a813079a6e0403a5da1a
d6215e15d2a6adaf046b40012e6b07019b055e07
/ScoringLayer.py
2c299e11ad288ed59c2928fc906cd548403ccd8e
[ "MIT" ]
permissive
WinVector/YConditionalRegularizedModel
4c53c801eb010e640898da7e6532582b809350d8
c4d488871d05d369dcc7e1b7faf110567742d808
refs/heads/master
2021-05-20T08:54:15.635276
2020-04-02T20:20:24
2020-04-02T20:20:24
252,209,212
1
0
null
null
null
null
UTF-8
Python
false
false
9,194
py
# noinspection PyPep8Naming from tensorflow.keras import backend as K from tensorflow.keras.layers import Layer # check all but first shape index def safe_mult(a, b): if len(a.shape) < 2: raise ValueError("Expected shape to be at least rank 2") if str(a.shape[0]) != "?": raise ValueError("Expected first shape entry to be ?") ra = len(a.shape) if ra != len(b.shape): raise ValueError("input ranks did not match") if str(b.shape[0]) != "?": raise ValueError("Expected first shape entry to be ?") for i in range(1, ra): if a.shape[i] != b.shape[i]: raise ValueError("input shapes did not match") c = a * b if len(c.shape) != ra: raise ValueError("result rank did not match") for i in range(1, ra): if a.shape[i] != c.shape[i]: raise ValueError("result shape did not match") if str(c.shape[0]) != "?": raise ValueError("Expected first shape entry to be ?") return c class ScoringLayer(Layer): def __init__(self, *, alpha=0.1, debug=False, var_ratio = True): self.alpha = alpha self.debug = debug self.var_ratio = var_ratio self.var_ratio_smoothing = 1.e-2 super(ScoringLayer, self).__init__() def build(self, input_shape): super(ScoringLayer, self).build(input_shape) def compute_variational_loss(self, *, x, y_true, msg_id=0): var_loss = None if self.alpha <= 0: return var_loss, msg_id n_internal_layers = len(x) - 2 if n_internal_layers <= 0: return var_loss, msg_id layers_normalization = n_internal_layers * (n_internal_layers + 1) / 2 y_triples = [(y_is, row_indicator, K.sum(row_indicator) + 1.0e-6) for y_is, row_indicator in [(1, y_true), (0, 1 - y_true)]] # assuming y_true is 0/1 for y_is, row_indicator, row_weight in y_triples: if len(row_weight.shape) != 0: raise ValueError("Expected row_weight.shape to be 0") for i in range(1, len(x) - 1): # all but first and last layer layer = x[i] layer_weight = i / (layers_normalization * layer.shape.as_list()[1]) for j in range(layer.shape[1]): xij = layer[:, j:(j + 1)] # try to keep shape # y-pass 1/2 get conditional distributions and means y_derived = dict() for y_is, row_indicator, row_weight in y_triples: coords = ( "(" + "y=" + str(y_is) + ", i=" + str(i) + ", j=" + str(j) + ")" ) if self.debug: xij = K.print_tensor( xij, message=str(msg_id).zfill(3) + " " + "xij" + coords ) msg_id = msg_id + 1 xij_conditional = safe_mult(row_indicator, xij) if self.debug: xij_conditional = K.print_tensor( xij_conditional, message=str(msg_id).zfill(3) + " " + "xij_conditional" + coords, ) msg_id = msg_id + 1 xbar = K.sum(xij_conditional) / row_weight if self.debug: xbar = K.print_tensor( xbar, message=str(msg_id).zfill(3) + " " + "xbar" + coords ) msg_id = msg_id + 1 y_derived[y_is] = (xij_conditional, xbar) mean_sq_diff = 1 if self.var_ratio: xbar_0 = y_derived[0][1] if len(xbar_0.shape) != 0: raise ValueError("Expected xbar_0.shape to be 0") xbar_1 = y_derived[1][1] if len(xbar_1.shape) != 0: raise ValueError("Expected xbar_1.shape to be 0") mean_sq_diff = (xbar_1 - xbar_0)**2 + self.var_ratio_smoothing if len(mean_sq_diff.shape) != 0: raise ValueError("Expected mean_sq_diff.shape to be 0") if self.debug: coords = ( "(" + "i=" + str(i) + ", j=" + str(j) + ")" ) mean_sq_diff = K.print_tensor( mean_sq_diff, message=str(msg_id).zfill(3) + " " + "mean_sq_diff" + coords, ) msg_id = msg_id + 1 # y-pass 2/2 compute conditional variances for y_is, row_indicator, row_weight in y_triples: coords = ( "(" + "y=" + str(y_is) + ", i=" + str(i) + ", j=" + str(j) + ")" ) xij_conditional, xbar = y_derived[y_is] if len(xbar.shape) != 0: raise ValueError("Expected xbar.shape to be 0") diff_ij = xij - xbar if self.debug: diff_ij = K.print_tensor( diff_ij, message=str(msg_id).zfill(3) + " " + "diff_ij" + coords, ) msg_id = msg_id + 1 diff_ij_conditional = safe_mult(row_indicator, diff_ij) if self.debug: diff_ij_conditional = K.print_tensor( diff_ij_conditional, message=str(msg_id).zfill(3) + " " + "diff_ij_conditional" + coords, ) msg_id = msg_id + 1 # ratio of y-conditioned var over y-different var conditional_var = diff_ij_conditional**2 / mean_sq_diff wij = self.alpha * layer_weight if self.debug: conditional_var = K.print_tensor( conditional_var, message=str(msg_id).zfill(3) + " " + "conditional_var" + coords + " * " + str(wij), ) msg_id = msg_id + 1 if var_loss is None: var_loss = wij * conditional_var else: var_loss = var_loss + wij * conditional_var return var_loss, msg_id def call(self, x, **kwargs): if not isinstance(x, list): raise TypeError("Expected x to be a list") msg_id = 0 first_item = x[0] y_true = first_item[ :, (first_item.shape[1] - 1):(first_item.shape[1]) ] # keep shape if self.debug: y_true = K.print_tensor( y_true, message=str(msg_id).zfill(3) + " " + "y_true" ) msg_id = msg_id + 1 last_item = x[len(x) - 1] y_pred = last_item # per-row cross-entropy or deviance/2 part of loss eps = 1.0e-6 y_pred = K.maximum(y_pred, eps) y_pred = K.minimum(y_pred, 1 - eps) if self.debug: y_pred = K.print_tensor( y_pred, message=str(msg_id).zfill(3) + " " + "y_pred" ) msg_id = msg_id + 1 loss = -safe_mult(y_true, K.log(y_pred)) - safe_mult(1 - y_true, K.log(1 - y_pred)) if self.debug: loss = K.print_tensor( loss, message=str(msg_id).zfill(3) + " " + "entropy loss" ) msg_id = msg_id + 1 # conditional clustered action/variation on activation var_loss, msg_id = self.compute_variational_loss( x=x, y_true=y_true, msg_id=msg_id ) if var_loss is not None: if self.debug: var_loss = K.print_tensor( var_loss, message=str(msg_id).zfill(3) + " " + "variational loss" ) msg_id = msg_id + 1 loss = loss + var_loss if self.debug: loss = K.print_tensor( loss, message=str(msg_id).zfill(3) + " " + "final squared loss" ) msg_id = msg_id + 1 loss = K.sqrt(loss) if self.debug: loss = K.print_tensor( loss, message=str(msg_id).zfill(3) + " " + "final loss" ) # noinspection PyUnusedLocal msg_id = msg_id + 1 return loss def compute_output_shape(self, input_shape): if not isinstance(input_shape, list): raise TypeError("Expected x to be a list") last_shape = input_shape[len(input_shape) - 1] return last_shape
e258490c9c96a24d1455e651209ea0988d282c37
83f2c9c26a79fdb2d6dd47218484e06875ccdb77
/rpca.py
3b733283c7cb1ac83b215bfd6a464454110d5b53
[]
no_license
zuoshifan/rpca_HI
4fe7a0c76326b57489a719583e2c8f13d07c363c
f94060ba3adbce5971eb4440bd7867240ebd088d
refs/heads/master
2021-01-21T10:14:01.521672
2017-05-12T06:51:17
2017-05-12T06:51:17
83,398,581
0
0
null
null
null
null
UTF-8
Python
false
false
2,195
py
import math import numpy.linalg def robust_pca(M): """ Decompose a matrix into low rank and sparse components. Computes the RPCA decomposition using Alternating Lagrangian Multipliers. Returns L,S the low rank and sparse components respectively """ L = numpy.zeros(M.shape) S = numpy.zeros(M.shape) Y = numpy.zeros(M.shape) print M.shape mu = (M.shape[0] * M.shape[1]) / (4.0 * L1Norm(M)) lamb = max(M.shape) ** -0.5 while not converged(M,L,S): L = svd_shrink(M - S - (mu**-1) * Y, mu) S = shrink(M - L + (mu**-1) * Y, lamb * mu) Y = Y + mu * (M - L - S) return L,S def svd_shrink(X, tau): """ Apply the shrinkage operator to the singular values obtained from the SVD of X. The parameter tau is used as the scaling parameter to the shrink function. Returns the matrix obtained by computing U * shrink(s) * V where U are the left singular vectors of X V are the right singular vectors of X s are the singular values as a diagonal matrix """ U,s,V = numpy.linalg.svd(X, full_matrices=False) return numpy.dot(U, numpy.dot(numpy.diag(shrink(s, tau)), V)) def shrink(X, tau): """ Apply the shrinkage operator the the elements of X. Returns V such that V[i,j] = max(abs(X[i,j]) - tau,0). """ V = numpy.copy(X).reshape(X.size) for i in xrange(V.size): V[i] = math.copysign(max(abs(V[i]) - tau, 0), V[i]) if V[i] == -0: V[i] = 0 return V.reshape(X.shape) def frobeniusNorm(X): """ Evaluate the Frobenius norm of X Returns sqrt(sum_i sum_j X[i,j] ^ 2) """ accum = 0 V = numpy.reshape(X,X.size) for i in xrange(V.size): accum += abs(V[i] ** 2) return math.sqrt(accum) def L1Norm(X): """ Evaluate the L1 norm of X Returns the max over the sum of each column of X """ return max(numpy.sum(X,axis=0)) def converged(M,L,S): """ A simple test of convergence based on accuracy of matrix reconstruction from sparse and low rank parts """ error = frobeniusNorm(M - L - S) / frobeniusNorm(M) print "error =", error return error <= 10e-6
5ef1e7f10dc123b57434e69de06b120e3e884c89
88ed6ed99589f7fb8e49aeb6c15bf0d51fe14a01
/004_medianOfTwoSortedArrays.py
f50d1fe4f60aca33c8dc8105b02120ac6779206e
[]
no_license
ryeLearnMore/LeetCode
3e97becb06ca2cf4ec15c43f77447b6ac2a061c6
04ec1eb720474a87a2995938743f05e7ad5e66e3
refs/heads/master
2020-04-07T19:02:43.171691
2019-06-23T15:09:19
2019-06-23T15:09:19
158,634,176
0
0
null
null
null
null
UTF-8
Python
false
false
2,215
py
#-*-coding:utf-8-*- __author__ = 'Rye' ''' There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). You may assume nums1 and nums2 cannot be both empty. Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The median is (2 + 3)/2 = 2.5 ''' # 正确写法,需要多次学习 # https://github.com/apachecn/awesome-algorithm/blob/master/docs/Leetcode_Solutions/Python/004._median_of_two_sorted_arrays.md class Solution: def findMedianSortedArrays(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: float """ def findKth(A, B, k): if len(A) == 0: return B[k - 1] if len(B) == 0: return A[k - 1] if k == 1: return min(A[0], B[0]) a = A[k // 2 - 1] if len(A) >= k // 2 else None b = B[k // 2 - 1] if len(B) >= k // 2 else None if b is None or (a is not None and a < b): return findKth(A[k // 2:], B, k - k // 2) return findKth(A, B[k // 2:], k - k // 2) num = len(nums1) + len(nums2) if num % 2 == 1: return self.findKth(nums1, nums2, num // 2 + 1) else: smaller = self.findKth(nums1, nums2, num // 2) larger = self.findKth(nums1, nums2, num // 2 + 1) return (smaller + larger) / 2.0 # 自己写的,侥幸也能通过,不过时间复杂度不对 class Solution1: def findMedianSortedArrays(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: float """ num = sorted(nums1 + nums2) if len(num) % 2 == 1: result = (len(num) - 1) / 2 # print(result) return num[int(result)] else: result1 = int(len(num) / 2) result2 = result1 - 1 result = (num[int(result1)] + num[int(result2)]) / 2 return result
38d58c1a1117d022b2d55be2c9392e708dbeb924
583d03a6337df9f1e28f4ef6208491cf5fb18136
/dev4qx/purus-repo/tasks/sync_task.py
b8d89d4424113bbe84c0b939794fb5b17b43eabb
[]
no_license
lescpsn/lescpsn
ece4362a328f009931c9e4980f150d93c4916b32
ef83523ea1618b7e543553edd480389741e54bc4
refs/heads/master
2020-04-03T14:02:06.590299
2018-11-01T03:00:17
2018-11-01T03:00:17
155,309,223
1
0
null
null
null
null
UTF-8
Python
false
false
2,148
py
# encoding: utf-8 import logging import tornado.gen import tornado.ioloop from sqlalchemy.orm import sessionmaker import core request_log = logging.getLogger("purus.request") class SyncTask(tornado.ioloop.PeriodicCallback): def __init__(self, application, callback_time): super(SyncTask, self).__init__(self.do_sync, callback_time) self.application = application self.master = self.application.sentinel.master_for('madeira') self.in_sync = False def session(self, name): if name in self.application.engine: engine = self.application.engine[name] return sessionmaker(bind=engine)() return None @tornado.gen.coroutine def do_sync(self): if self.in_sync: return if self.master.exists('flag:task'): request_log.info('STOP FLAG FOUND!') return if not self.master.exists('list:sync:pricing'): return session = self.session('repo') try: self.in_sync = True sync_list = [] full_sync_set = set() line = self.master.lpop('list:sync:pricing') while line: request_log.info('SYNC LINE {%s}', line) domain_id, product_id, user_id = line.split(',') if product_id == '' and user_id == '': full_sync_set.add(domain_id) sync_list.append((domain_id, product_id, user_id)) line = self.master.lpop('list:sync:pricing') # TODO: merge same, remove for domain_id in full_sync_set: request_log.info('SYNC FULL DOMAIN {%s}', domain_id) sync_list = list(filter(lambda x: x[0] != domain_id, sync_list)) sync_list.append((domain_id, '', '')) for domain_id, product_id, user_id in sync_list: yield core.sync_pricing(session, domain_id, filter_product=product_id, filter_user=user_id) except: request_log.exception('SYNC FAIL') finally: self.in_sync = False session.close()
10f15096eff2605cc1b6f34cae9b10d7dbd66012
de24f83a5e3768a2638ebcf13cbe717e75740168
/moodledata/vpl_data/3/usersdata/138/733/submittedfiles/ex1.py
1e83a25bea9a34b44af82f240fef204ac4552b94
[]
no_license
rafaelperazzo/programacao-web
95643423a35c44613b0f64bed05bd34780fe2436
170dd5440afb9ee68a973f3de13a99aa4c735d79
refs/heads/master
2021-01-12T14:06:25.773146
2017-12-22T16:05:45
2017-12-22T16:05:45
69,566,344
0
0
null
null
null
null
UTF-8
Python
false
false
288
py
# -*- coding: utf-8 -*- from __future__ import division a = input('digite o valor de a:') b = input('digite o valor de b:') c = input('digite o valor de c:') delta = (b**2)-(4*a*c) x1 = (-b+(delta)**(1/2))/(2*a) x2 = (-b-(delta)**(1/2))/(2*a) print('valor de x1') print('valor de x2')
e1f5e6d3be9a072b2c8c54a7db8c2b69ee601459
b60849c71c644b488a9777edd9809883cbaff884
/stringsync/sync.py
ba9ca155174cc1b6c88aba0402ca29118333c4b1
[ "Apache-2.0" ]
permissive
dev-junior/strings-datasync
ded0183a9bea5a715555c4b55ce1ea3ecf2ba6c7
858a0d97687dfc42e0010b25718e2b17084e75fb
refs/heads/master
2020-03-21T02:53:51.338210
2015-10-05T22:41:35
2015-10-05T22:41:35
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,211
py
from StringIO import StringIO import sys from stringsync.mysql2ldif import mysql2ldif, organization_dn from stringsync.ldif_dumper import dump_tree_sorted from stringsync import db from stringsync.ldiff import ldiff_and_apply, ldiff_to_ldif def _sync_db_to_ldap(organization_id, db_server, ldap_server, dry_run): base_domain = organization_dn(organization_id, db_server) if not base_domain: raise Exception("Couldn't get a base dn for org %s, refusing to continue" % organization_id) new_ldif = StringIO() mysql2ldif(organization_id, db_server, new_ldif) new_ldif.seek(0) cur_ldif = StringIO() dump_tree_sorted(ldap_server, base_domain, cur_ldif) cur_ldif.seek(0) if not dry_run: ldiff_and_apply(cur_ldif, new_ldif, ldap_server) else: ldiff_to_ldif(cur_ldif, new_ldif, dry_run) def sync_from_config(db_server, ldap_server, organization_id, dry_run=None): """ If dry_run is non-None, it is considered a file in which to put the ldif, and no changes will be applied to the ldap server itself. """ _sync_db_to_ldap(organization_id, db_server, ldap_server, dry_run=dry_run)
5d9fa9cd1b5f06a381cee08c729581e92b5e5ed0
e23a4f57ce5474d468258e5e63b9e23fb6011188
/125_algorithms/_exercises/templates/_algorithms_challenges/pybites/advanced/93_v3/rps.py
6390079246a910365c6f43a18f17e098926b1800
[]
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
1,078
py
# ____ r__ _______ c.. # # defeated_by d.. paper_ scissors # rock_ paper # scissors_ rock # lose '@ beats @, you lose!' # win '@ beats @, you win!' # tie 'tie!' # # c.. ?.v.. # # ___ _get_computer_move # """Randomly select a move""" # r.. c.. c.. # # # ___ _get_winner computer_choice player_choice # """Return above lose/win/tie strings populated with the # appropriate values (computer vs player)""" # __ ? n.. __ c.. # r.. 'Invalid choice' # __ ? __ ? # r.. t.. # __ ? __ d.. c.. # r.. w__.f.. ? ? # ____ # r.. l__.f.. ? ? # # # ___ game # """Game loop, receive player's choice via the generator's # send method and get a random move from computer (_get_computer_move). # Raise a StopIteration exception if user value received = 'q'. # Check who wins with _get_winner and print its return output.""" # w... T... # player_choice y.. '' # __ ? __ 'q' # r.. S.. # computer_choice _g.. # print _? ? ?
72dd61a158c302f6c81f7b839bd22510c5704f18
9bbc76b0d31fb550392eb387aab54862576c3e6d
/0x08-python-more_classes/6-rectangle.py
df22ebe5faae5a083f60627a756b6e2e54646874
[]
no_license
Jesus-Acevedo-Cano/holbertonschool-higher_level_programming
39c6e99f6368dba61c8668ffac41ea2257910366
ad28e8f296d4c226e1c0d571e476fedb3755fde5
refs/heads/master
2020-09-29T03:20:19.770661
2020-05-15T03:50:10
2020-05-15T03:50:10
226,937,476
0
0
null
null
null
null
UTF-8
Python
false
false
2,391
py
#!/usr/bin/python3 class Rectangle(): """class named Rectangle""" number_of_instances = 0 def __init__(self, width=0, height=0): """Initialization of instance attributes Args: width (int): width of rectangle height (int): rectangle height """ self.width = width self.height = height Rectangle.number_of_instances += 1 @property def width(self): """getter fun""" return self.__width @width.setter def width(self, value): """setter function value: new value to set """ if not isinstance(value, int): raise TypeError("width must be an integer") if value < 0: raise ValueError("width must be >= 0") self.__width = value @property def height(self): """getter fun""" return self.__height @height.setter def height(self, value): """setter function value: new value to set """ if not isinstance(value, int): raise TypeError("height must be an integer") if value < 0: raise ValueError("height must be >= 0") self.__height = value def area(self): """func to calculate the area Return: area of square """ return self.__width * self.__height def perimeter(self): """func to calculate the area Return: perimeter of square """ if (self.__width == 0) or (self.__height == 0): return 0 else: return (self.__width + self.__height) * 2 def __str__(self): """ returning the string representation of the rectangle """ rectangle = "" if self.height == 0 or self.width == 0: return rectangle for i in range(self.__height): rectangle += "#" * self.__width if i + 1 != self.__height: rectangle += "\n" return rectangle def __repr__(self): """ return a string representation of the rectangle """ rep = "{}({}, {})".format(self.__class__.__name__, self.width, self.height) return rep def __del__(self): """prints msg when instance is deleted""" print("Bye rectangle...") Rectangle.number_of_instances -= 1
3d61667e3088b1f1b05106dc5648b7aaf4002b91
e574bfa1acf6ae4662775e0a1dfa22c6ce751cda
/tests/test_types.py
fe2e949778da128c17786d463a9d0a7d2a111d6e
[ "MIT" ]
permissive
shuric80/aioalice
6ef4193cf9c27c1c1692c5d11a95583119ea3214
e04b122b73ee139b42e13d28e4a5434c4c393bcc
refs/heads/master
2020-03-23T20:06:02.678810
2018-07-11T18:59:36
2018-07-11T19:00:15
null
0
0
null
null
null
null
UTF-8
Python
false
false
11,390
py
import unittest from aioalice import types class TestAliceTypes(unittest.TestCase): def _test_meta(self, meta, dct): self.assertEqual(meta.locale, dct['locale']) self.assertEqual(meta.timezone, dct['timezone']) self.assertEqual(meta.client_id, dct['client_id']) def test_meta(self): meta_json = { "locale": "ru-RU", "timezone": "Europe/Moscow", "client_id": "ru.yandex.searchplugin/5.80 (Samsung Galaxy; Android 4.4)" } meta = types.Meta(**meta_json) self._test_meta(meta, meta_json) def _test_markup(self, markup, dct): self.assertEqual(markup.dangerous_context, dct['dangerous_context']) def test_markup(self): markup_json = { "dangerous_context": True } markup = types.Markup(**markup_json) self._test_markup(markup, markup_json) def _test_request(self, req, dct): self.assertEqual(req.command, dct['command']) self.assertEqual(req.original_utterance, dct['original_utterance']) self.assertEqual(req.type, dct['type']) self._test_markup(req.markup, dct['markup']) self.assertEqual(req.payload, dct['payload']) def test_request(self): request_json = { "command": "где поесть", "original_utterance": "Алиса где поесть", "type": "SimpleUtterance", "markup": { "dangerous_context": True }, "payload": {} } request = types.Request(**request_json) self._test_request(request, request_json) def _test_base_session(self, bs, dct): self.assertEqual(bs.user_id, dct['user_id']) self.assertEqual(bs.message_id, dct['message_id']) self.assertEqual(bs.session_id, dct['session_id']) def test_base_session(self): base_session_json = { "message_id": 4, "session_id": "2eac4854-fce721f3-b845abba-20d60", "user_id": "AC9WC3DF6FCE052E45A4566A48E6B7193774B84814CE49A922E163B8B29881DC" } base_session = types.BaseSession(**base_session_json) self._test_base_session(base_session, base_session_json) def _test_session(self, sess, dct): self.assertEqual(sess.new, dct['new']) self.assertEqual(sess.skill_id, dct['skill_id']) self._test_base_session(sess, dct) def test_session(self): session_json = { "new": True, "message_id": 4, "session_id": "2eac4854-fce721f3-b845abba-20d60", "skill_id": "3ad36498-f5rd-4079-a14b-788652932056", "user_id": "AC9WC3DF6FCE052E45A4566A48E6B7193774B84814CE49A922E163B8B29881DC" } session = types.Session(**session_json) self._test_session(session, session_json) def _test_button(self, btn, title, url=None, payload=None, hide=True): self.assertEqual(btn.title, title) self.assertEqual(btn.url, url) self.assertEqual(btn.payload, payload) self.assertEqual(btn.hide, hide) def _tst_buttons(self, btn, dct): self._test_button( btn, dct.get('title'), dct.get('url'), dct.get('payload'), dct.get('hide') ) def test_buttons(self): title = 'Title' btn1 = types.Button(title) self._test_button(btn1, title) btn2 = types.Button(title, url='yandex.ru') self._test_button(btn2, title, 'yandex.ru') btn3 = types.Button(title, payload={'key': 'value'}) self._test_button(btn3, title, payload={'key': 'value'}) btn4 = types.Button(title, payload={'json': {'key': 'value'}}, hide=False) self._test_button(btn4, title, payload={'json': {'key': 'value'}}, hide=False) btn5 = types.Button(title, url='github.com', payload={'json': {'key': 'value'}}, hide=False) self._test_button(btn5, title, url='github.com', payload={'json': {'key': 'value'}}, hide=False) def _test_response(self, resp, dct): self.assertEqual(resp.text, dct['text']) self.assertEqual(resp.tts, dct['tts']) self.assertEqual(resp.end_session, dct['end_session']) if resp.buttons is not None: for btn, btn_dct in zip(resp.buttons, dct['buttons']): self._tst_buttons(btn, btn_dct) def test_response(self): response_json = { "text": "Здравствуйте! Это мы, хороводоведы.", "tts": "Здравствуйте! Это мы, хоров+одо в+еды.", "buttons": [ { "title": "Надпись на кнопке", "payload": {}, "url": "https://responseexample.com/", "hide": True } ], "end_session": False } response = types.Response(**response_json) self._test_response(response, response_json) resp_text = 'Response Text' response = types.Response(resp_text, buttons=['Hi!']) self.assertEqual( response.to_json(), { 'text': resp_text, 'tts': None, 'buttons': [ { 'title': 'Hi!', 'url': None, 'payload': None, 'hide': True } ], 'end_session': False } ) def _test_alice_request(self, arq, dct): self.assertEqual(arq.version, dct['version']) self._test_session(arq.session, dct['session']) self._test_request(arq.request, dct['request']) self._test_meta(arq.meta, dct['meta']) def test_alice_request(self): alice_request_json = { "meta": { "locale": "ru-RU", "timezone": "Europe/Moscow", "client_id": "ru.yandex.searchplugin/5.80 (Samsung Galaxy; Android 4.4)" }, "request": { "command": "где ближайшее отделение", "original_utterance": "Алиса спроси у Сбербанка где ближайшее отделение", "type": "SimpleUtterance", "markup": { "dangerous_context": True }, "payload": {} }, "session": { "new": True, "message_id": 4, "session_id": "2eac4854-fce721f3-b845abba-20d60", "skill_id": "3ad36498-f5rd-4079-a14b-788652932056", "user_id": "AC9WC3DF6FCE052E45A4566A48E6B7193774B84814CE49A922E163B8B29881DC" }, "version": "1.0" } alice_request = types.AliceRequest(**alice_request_json) self.assertEqual(alice_request.to_json(), alice_request_json) self._test_alice_request(alice_request, alice_request_json) def _test_alice_response(self, arp, dct): self.assertEqual(arp.version, dct['version']) def test_alice_response(self): alice_response_json = { "response": { "text": "Здравствуйте! Это мы, хороводоведы.", "tts": "Здравствуйте! Это мы, хоров+одо в+еды.", "end_session": False }, "session": { "session_id": "2eac4854-fce721f3-b845abba-20d60", "message_id": 4, "user_id": "AC9WC3DF6FCE052E45A4566A48E6B7193774B84814CE49A922E163B8B29881DC" }, "version": "1.0" } alice_response = types.AliceResponse(**alice_response_json) self._test_alice_response(alice_response, alice_response_json) alice_response_json["response"]["buttons"] = [ { "title": "Надпись на кнопке", "payload": {}, "url": "https://example.com/", "hide": True }, { "title": "Надпись на кнопке1", "payload": {'key': 'value'}, "url": "https://ya.com/", "hide": False }, ] alice_response = types.AliceResponse(**alice_response_json) self.assertEqual(alice_response.to_json(), alice_response_json) self._test_alice_response(alice_response, alice_response_json) def test_response_from_request(self): alice_request_json = { "meta": { "locale": "ru-RU", "timezone": "Europe/Moscow", "client_id": "ru.yandex.searchplugin/5.80 (Samsung Galaxy; Android 4.4)" }, "request": { "command": "где ближайшее отделение", "original_utterance": "Алиса спроси у Сбербанка где ближайшее отделение", "type": "SimpleUtterance", "markup": { "dangerous_context": True }, "payload": None }, "session": { "new": True, "message_id": 4, "session_id": "2eac4854-fce721f3-b845abba-20d60", "skill_id": "3ad36498-f5rd-4079-a14b-788652932056", "user_id": "AC9WC3DF6FCE052E45A4566A48E6B7193774B84814CE49A922E163B8B29881DC" }, "version": "1.0" } alice_request = types.AliceRequest(**alice_request_json) resp_text = 'Здравствуйте! Это мы, хороводоведы.' alice_response = alice_request.response(resp_text) expected_response = { "response": { "text": resp_text, 'tts': None, 'buttons': None, "end_session": False }, "session": { "session_id": "2eac4854-fce721f3-b845abba-20d60", "message_id": 4, "user_id": "AC9WC3DF6FCE052E45A4566A48E6B7193774B84814CE49A922E163B8B29881DC" }, "version": "1.0" } self.assertEqual(alice_response.to_json(), expected_response) new_tts = "Здравствуйте! Это мы, хоров+одо в+еды." btn_title = "Надпись на кнопке" btn_url = "https://example.com/" new_btn = types.Button(btn_title, url=btn_url) expected_response["response"].update({ "tts": new_tts, "buttons": [ { "title": btn_title, "payload": None, "url": btn_url, "hide": True } ], }) alice_response.response.tts = new_tts alice_response.response.buttons = [new_btn] self.assertEqual(alice_response.to_json(), expected_response) alice_response = alice_request.response(resp_text, tts=new_tts, buttons=[new_btn]) self.assertEqual(alice_response.to_json(), expected_response) if __name__ == '__main__': unittest.main()
540f489a9e94d400b3027d85897af712b39ac85f
9e549ee54faa8b037f90eac8ecb36f853e460e5e
/venv/lib/python3.6/site-packages/future/backports/http/cookies.py
063ed995ba4a12e6bce07a142806bd886a9751cd
[ "MIT" ]
permissive
aitoehigie/britecore_flask
e8df68e71dd0eac980a7de8c0f20b5a5a16979fe
eef1873dbe6b2cc21f770bc6dec783007ae4493b
refs/heads/master
2022-12-09T22:07:45.930238
2019-05-15T04:10:37
2019-05-15T04:10:37
177,354,667
0
0
MIT
2022-12-08T04:54:09
2019-03-24T00:38:20
Python
UTF-8
Python
false
false
21,705
py
#### # Copyright 2000 by Timothy O'Malley <[email protected]> # # All Rights Reserved # # Permission to use, copy, modify, and distribute this software # and its documentation for any purpose and without fee is hereby # granted, provided that the above copyright notice appear in all # copies and that both that copyright notice and this permission # notice appear in supporting documentation, and that the name of # Timothy O'Malley not be used in advertising or publicity # pertaining to distribution of the software without specific, written # prior permission. # # Timothy O'Malley DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS # SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY # AND FITNESS, IN NO EVENT SHALL Timothy O'Malley BE LIABLE FOR # ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. # #### # # Id: Cookie.py,v 2.29 2000/08/23 05:28:49 timo Exp # by Timothy O'Malley <[email protected]> # # Cookie.py is a Python module for the handling of HTTP # cookies as a Python dictionary. See RFC 2109 for more # information on cookies. # # The original idea to treat Cookies as a dictionary came from # Dave Mitchell ([email protected]) in 1995, when he released the # first version of nscookie.py. # #### r""" http.cookies module ported to python-future from Py3.3 Here's a sample session to show how to use this module. At the moment, this is the only documentation. The Basics ---------- Importing is easy... >>> from http import cookies Most of the time you start by creating a cookie. >>> C = cookies.SimpleCookie() Once you've created your Cookie, you can add values just as if it were a dictionary. >>> C = cookies.SimpleCookie() >>> C["fig"] = "newton" >>> C["sugar"] = "wafer" >>> C.output() 'Set-Cookie: fig=newton\r\nSet-Cookie: sugar=wafer' Notice that the printable representation of a Cookie is the appropriate format for a Set-Cookie: header. This is the default behavior. You can change the header and printed attributes by using the .output() function >>> C = cookies.SimpleCookie() >>> C["rocky"] = "road" >>> C["rocky"]["path"] = "/cookie" >>> print(C.output(header="Cookie:")) Cookie: rocky=road; Path=/cookie >>> print(C.output(attrs=[], header="Cookie:")) Cookie: rocky=road The load() method of a Cookie extracts cookies from a string. In a CGI script, you would use this method to extract the cookies from the HTTP_COOKIE environment variable. >>> C = cookies.SimpleCookie() >>> C.load("chips=ahoy; vienna=finger") >>> C.output() 'Set-Cookie: chips=ahoy\r\nSet-Cookie: vienna=finger' The load() method is darn-tootin smart about identifying cookies within a string. Escaped quotation marks, nested semicolons, and other such trickeries do not confuse it. >>> C = cookies.SimpleCookie() >>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=\\012;";') >>> print(C) Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=\012;" Each element of the Cookie also supports all of the RFC 2109 Cookie attributes. Here's an example which sets the Path attribute. >>> C = cookies.SimpleCookie() >>> C["oreo"] = "doublestuff" >>> C["oreo"]["path"] = "/" >>> print(C) Set-Cookie: oreo=doublestuff; Path=/ Each dictionary element has a 'value' attribute, which gives you back the value associated with the key. >>> C = cookies.SimpleCookie() >>> C["twix"] = "none for you" >>> C["twix"].value 'none for you' The SimpleCookie expects that all values should be standard strings. Just to be sure, SimpleCookie invokes the str() builtin to convert the value to a string, when the values are set dictionary-style. >>> C = cookies.SimpleCookie() >>> C["number"] = 7 >>> C["string"] = "seven" >>> C["number"].value '7' >>> C["string"].value 'seven' >>> C.output() 'Set-Cookie: number=7\r\nSet-Cookie: string=seven' Finis. """ from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from future.builtins import chr, dict, int, str from future.utils import PY2, as_native_str # # Import our required modules # import re re.ASCII = 0 # for py2 compatibility import string __all__ = ["CookieError", "BaseCookie", "SimpleCookie"] _nulljoin = "".join _semispacejoin = "; ".join _spacejoin = " ".join # # Define an exception visible to External modules # class CookieError(Exception): pass # These quoting routines conform to the RFC2109 specification, which in # turn references the character definitions from RFC2068. They provide # a two-way quoting algorithm. Any non-text character is translated # into a 4 character sequence: a forward-slash followed by the # three-digit octal equivalent of the character. Any '\' or '"' is # quoted with a preceeding '\' slash. # # These are taken from RFC2068 and RFC2109. # _LegalChars is the list of chars which don't require "'s # _Translator hash-table for fast quoting # _LegalChars = string.ascii_letters + string.digits + "!#$%&'*+-.^_`|~:" _Translator = { "\000": "\\000", "\001": "\\001", "\002": "\\002", "\003": "\\003", "\004": "\\004", "\005": "\\005", "\006": "\\006", "\007": "\\007", "\010": "\\010", "\011": "\\011", "\012": "\\012", "\013": "\\013", "\014": "\\014", "\015": "\\015", "\016": "\\016", "\017": "\\017", "\020": "\\020", "\021": "\\021", "\022": "\\022", "\023": "\\023", "\024": "\\024", "\025": "\\025", "\026": "\\026", "\027": "\\027", "\030": "\\030", "\031": "\\031", "\032": "\\032", "\033": "\\033", "\034": "\\034", "\035": "\\035", "\036": "\\036", "\037": "\\037", # Because of the way browsers really handle cookies (as opposed # to what the RFC says) we also encode , and ; ",": "\\054", ";": "\\073", '"': '\\"', "\\": "\\\\", "\177": "\\177", "\200": "\\200", "\201": "\\201", "\202": "\\202", "\203": "\\203", "\204": "\\204", "\205": "\\205", "\206": "\\206", "\207": "\\207", "\210": "\\210", "\211": "\\211", "\212": "\\212", "\213": "\\213", "\214": "\\214", "\215": "\\215", "\216": "\\216", "\217": "\\217", "\220": "\\220", "\221": "\\221", "\222": "\\222", "\223": "\\223", "\224": "\\224", "\225": "\\225", "\226": "\\226", "\227": "\\227", "\230": "\\230", "\231": "\\231", "\232": "\\232", "\233": "\\233", "\234": "\\234", "\235": "\\235", "\236": "\\236", "\237": "\\237", "\240": "\\240", "\241": "\\241", "\242": "\\242", "\243": "\\243", "\244": "\\244", "\245": "\\245", "\246": "\\246", "\247": "\\247", "\250": "\\250", "\251": "\\251", "\252": "\\252", "\253": "\\253", "\254": "\\254", "\255": "\\255", "\256": "\\256", "\257": "\\257", "\260": "\\260", "\261": "\\261", "\262": "\\262", "\263": "\\263", "\264": "\\264", "\265": "\\265", "\266": "\\266", "\267": "\\267", "\270": "\\270", "\271": "\\271", "\272": "\\272", "\273": "\\273", "\274": "\\274", "\275": "\\275", "\276": "\\276", "\277": "\\277", "\300": "\\300", "\301": "\\301", "\302": "\\302", "\303": "\\303", "\304": "\\304", "\305": "\\305", "\306": "\\306", "\307": "\\307", "\310": "\\310", "\311": "\\311", "\312": "\\312", "\313": "\\313", "\314": "\\314", "\315": "\\315", "\316": "\\316", "\317": "\\317", "\320": "\\320", "\321": "\\321", "\322": "\\322", "\323": "\\323", "\324": "\\324", "\325": "\\325", "\326": "\\326", "\327": "\\327", "\330": "\\330", "\331": "\\331", "\332": "\\332", "\333": "\\333", "\334": "\\334", "\335": "\\335", "\336": "\\336", "\337": "\\337", "\340": "\\340", "\341": "\\341", "\342": "\\342", "\343": "\\343", "\344": "\\344", "\345": "\\345", "\346": "\\346", "\347": "\\347", "\350": "\\350", "\351": "\\351", "\352": "\\352", "\353": "\\353", "\354": "\\354", "\355": "\\355", "\356": "\\356", "\357": "\\357", "\360": "\\360", "\361": "\\361", "\362": "\\362", "\363": "\\363", "\364": "\\364", "\365": "\\365", "\366": "\\366", "\367": "\\367", "\370": "\\370", "\371": "\\371", "\372": "\\372", "\373": "\\373", "\374": "\\374", "\375": "\\375", "\376": "\\376", "\377": "\\377", } def _quote(str, LegalChars=_LegalChars): r"""Quote a string for use in a cookie header. If the string does not need to be double-quoted, then just return the string. Otherwise, surround the string in doublequotes and quote (with a \) special characters. """ if all(c in LegalChars for c in str): return str else: return '"' + _nulljoin(_Translator.get(s, s) for s in str) + '"' _OctalPatt = re.compile(r"\\[0-3][0-7][0-7]") _QuotePatt = re.compile(r"[\\].") def _unquote(mystr): # If there aren't any doublequotes, # then there can't be any special characters. See RFC 2109. if len(mystr) < 2: return mystr if mystr[0] != '"' or mystr[-1] != '"': return mystr # We have to assume that we must decode this string. # Down to work. # Remove the "s mystr = mystr[1:-1] # Check for special sequences. Examples: # \012 --> \n # \" --> " # i = 0 n = len(mystr) res = [] while 0 <= i < n: o_match = _OctalPatt.search(mystr, i) q_match = _QuotePatt.search(mystr, i) if not o_match and not q_match: # Neither matched res.append(mystr[i:]) break # else: j = k = -1 if o_match: j = o_match.start(0) if q_match: k = q_match.start(0) if q_match and (not o_match or k < j): # QuotePatt matched res.append(mystr[i:k]) res.append(mystr[k + 1]) i = k + 2 else: # OctalPatt matched res.append(mystr[i:j]) res.append(chr(int(mystr[j + 1 : j + 4], 8))) i = j + 4 return _nulljoin(res) # The _getdate() routine is used to set the expiration time in the cookie's HTTP # header. By default, _getdate() returns the current time in the appropriate # "expires" format for a Set-Cookie header. The one optional argument is an # offset from now, in seconds. For example, an offset of -3600 means "one hour # ago". The offset may be a floating point number. # _weekdayname = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] _monthname = [ None, "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ] def _getdate(future=0, weekdayname=_weekdayname, monthname=_monthname): from time import gmtime, time now = time() year, month, day, hh, mm, ss, wd, y, z = gmtime(now + future) return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % ( weekdayname[wd], day, monthname[month], year, hh, mm, ss, ) class Morsel(dict): """A class to hold ONE (key, value) pair. In a cookie, each such pair may have several attributes, so this class is used to keep the attributes associated with the appropriate key,value pair. This class also includes a coded_value attribute, which is used to hold the network representation of the value. This is most useful when Python objects are pickled for network transit. """ # RFC 2109 lists these attributes as reserved: # path comment domain # max-age secure version # # For historical reasons, these attributes are also reserved: # expires # # This is an extension from Microsoft: # httponly # # This dictionary provides a mapping from the lowercase # variant on the left to the appropriate traditional # formatting on the right. _reserved = { "expires": "expires", "path": "Path", "comment": "Comment", "domain": "Domain", "max-age": "Max-Age", "secure": "secure", "httponly": "httponly", "version": "Version", } _flags = set(["secure", "httponly"]) def __init__(self): # Set defaults self.key = self.value = self.coded_value = None # Set default attributes for key in self._reserved: dict.__setitem__(self, key, "") def __setitem__(self, K, V): K = K.lower() if not K in self._reserved: raise CookieError("Invalid Attribute %s" % K) dict.__setitem__(self, K, V) def isReservedKey(self, K): return K.lower() in self._reserved def set(self, key, val, coded_val, LegalChars=_LegalChars): # First we verify that the key isn't a reserved word # Second we make sure it only contains legal characters if key.lower() in self._reserved: raise CookieError("Attempt to set a reserved key: %s" % key) if any(c not in LegalChars for c in key): raise CookieError("Illegal key value: %s" % key) # It's a good key, so save it. self.key = key self.value = val self.coded_value = coded_val def output(self, attrs=None, header="Set-Cookie:"): return "%s %s" % (header, self.OutputString(attrs)) __str__ = output @as_native_str() def __repr__(self): if PY2 and isinstance(self.value, unicode): val = str(self.value) # make it a newstr to remove the u prefix else: val = self.value return "<%s: %s=%s>" % (self.__class__.__name__, str(self.key), repr(val)) def js_output(self, attrs=None): # Print javascript return """ <script type="text/javascript"> <!-- begin hiding document.cookie = \"%s\"; // end hiding --> </script> """ % ( self.OutputString(attrs).replace('"', r"\"") ) def OutputString(self, attrs=None): # Build up our result # result = [] append = result.append # First, the key=value pair append("%s=%s" % (self.key, self.coded_value)) # Now add any defined attributes if attrs is None: attrs = self._reserved items = sorted(self.items()) for key, value in items: if value == "": continue if key not in attrs: continue if key == "expires" and isinstance(value, int): append("%s=%s" % (self._reserved[key], _getdate(value))) elif key == "max-age" and isinstance(value, int): append("%s=%d" % (self._reserved[key], value)) elif key == "secure": append(str(self._reserved[key])) elif key == "httponly": append(str(self._reserved[key])) else: append("%s=%s" % (self._reserved[key], value)) # Return the result return _semispacejoin(result) # # Pattern for finding cookie # # This used to be strict parsing based on the RFC2109 and RFC2068 # specifications. I have since discovered that MSIE 3.0x doesn't # follow the character rules outlined in those specs. As a # result, the parsing rules here are less strict. # _LegalCharsPatt = r"[\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=]" _CookiePattern = re.compile( r""" (?x) # This is a verbose pattern (?P<key> # Start of group 'key' """ + _LegalCharsPatt + r"""+? # Any word of at least one letter ) # End of group 'key' ( # Optional group: there may not be a value. \s*=\s* # Equal Sign (?P<val> # Start of group 'val' "(?:[^\\"]|\\.)*" # Any doublequoted string | # or \w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT # Special case for "expires" attr | # or """ + _LegalCharsPatt + r"""* # Any word or empty string ) # End of group 'val' )? # End of optional value group \s* # Any number of spaces. (\s+|;|$) # Ending either at space, semicolon, or EOS. """, re.ASCII, ) # May be removed if safe. # At long last, here is the cookie class. Using this class is almost just like # using a dictionary. See this module's docstring for example usage. # class BaseCookie(dict): """A container class for a set of Morsels.""" def value_decode(self, val): """real_value, coded_value = value_decode(STRING) Called prior to setting a cookie's value from the network representation. The VALUE is the value read from HTTP header. Override this function to modify the behavior of cookies. """ return val, val def value_encode(self, val): """real_value, coded_value = value_encode(VALUE) Called prior to setting a cookie's value from the dictionary representation. The VALUE is the value being assigned. Override this function to modify the behavior of cookies. """ strval = str(val) return strval, strval def __init__(self, input=None): if input: self.load(input) def __set(self, key, real_value, coded_value): """Private method for setting a cookie's value""" M = self.get(key, Morsel()) M.set(key, real_value, coded_value) dict.__setitem__(self, key, M) def __setitem__(self, key, value): """Dictionary style assignment.""" rval, cval = self.value_encode(value) self.__set(key, rval, cval) def output(self, attrs=None, header="Set-Cookie:", sep="\015\012"): """Return a string suitable for HTTP.""" result = [] items = sorted(self.items()) for key, value in items: result.append(value.output(attrs, header)) return sep.join(result) __str__ = output @as_native_str() def __repr__(self): l = [] items = sorted(self.items()) for key, value in items: if PY2 and isinstance(value.value, unicode): val = str(value.value) # make it a newstr to remove the u prefix else: val = value.value l.append("%s=%s" % (str(key), repr(val))) return "<%s: %s>" % (self.__class__.__name__, _spacejoin(l)) def js_output(self, attrs=None): """Return a string suitable for JavaScript.""" result = [] items = sorted(self.items()) for key, value in items: result.append(value.js_output(attrs)) return _nulljoin(result) def load(self, rawdata): """Load cookies from a string (presumably HTTP_COOKIE) or from a dictionary. Loading cookies from a dictionary 'd' is equivalent to calling: map(Cookie.__setitem__, d.keys(), d.values()) """ if isinstance(rawdata, str): self.__parse_string(rawdata) else: # self.update() wouldn't call our custom __setitem__ for key, value in rawdata.items(): self[key] = value return def __parse_string(self, mystr, patt=_CookiePattern): i = 0 # Our starting point n = len(mystr) # Length of string M = None # current morsel while 0 <= i < n: # Start looking for a cookie match = patt.search(mystr, i) if not match: # No more cookies break key, value = match.group("key"), match.group("val") i = match.end(0) # Parse the key, value in case it's metainfo if key[0] == "$": # We ignore attributes which pertain to the cookie # mechanism as a whole. See RFC 2109. # (Does anyone care?) if M: M[key[1:]] = value elif key.lower() in Morsel._reserved: if M: if value is None: if key.lower() in Morsel._flags: M[key] = True else: M[key] = _unquote(value) elif value is not None: rval, cval = self.value_decode(value) self.__set(key, rval, cval) M = self[key] class SimpleCookie(BaseCookie): """ SimpleCookie supports strings as cookie values. When setting the value using the dictionary assignment notation, SimpleCookie calls the builtin str() to convert the value to a string. Values received from HTTP are kept as strings. """ def value_decode(self, val): return _unquote(val), val def value_encode(self, val): strval = str(val) return strval, _quote(strval)
fa1dcb7cf75c38c73c228a0c326b4791efa0218c
09301c71638abf45230192e62503f79a52e0bd80
/besco_erp/besco_warehouse/general_stock_shipping/wizard/__init__.py
39773324ebf286802583121ca1528961e4ec8a3c
[]
no_license
westlyou/NEDCOFFEE
24ef8c46f74a129059622f126401366497ba72a6
4079ab7312428c0eb12015e543605eac0bd3976f
refs/heads/master
2020-05-27T06:01:15.188827
2017-11-14T15:35:22
2017-11-14T15:35:22
null
0
0
null
null
null
null
UTF-8
Python
false
false
151
py
# -*- coding: utf-8 -*- #import stock_partial_picking import stock_invoice_onshipping # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
f8b76ee88bf3199ba784eea23e13478c952ee068
225543bcaa194360aa66c738a99b7ad5c291434b
/main_210516.py
8aabc2d068464e871a923d87cbc79014605fd9b0
[]
no_license
m0100434/zendlijsten
f0eecf12ab3fc90c1db9b5c22f1163a92dcdf6f7
171e1c427db71dad01408072081c85035c57a2b2
refs/heads/main
2023-06-19T05:04:31.619139
2021-07-17T07:51:46
2021-07-17T07:51:46
349,770,868
0
0
null
null
null
null
UTF-8
Python
false
false
10,358
py
# -*- coding: utf-8 -*- """ Created on Wed Jan 6 11:56:59 2021 @author: ArxXi """ from selenium import webdriver import time from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from selenium.common.exceptions import TimeoutException from selenium.common.exceptions import NoSuchElementException import pickle from datetime import date def save_cookie(driver, path): with open(path, 'wb') as filehandler: pickle.dump(driver.get_cookies(), filehandler) def load_cookie(driver, path): with open(path, 'rb') as cookiesfile: cookies = pickle.load(cookiesfile) for cookie in cookies: driver.add_cookie(cookie) def remove_entry(index): ourtime.pop(index-entries_deleted) # print("time which is going to be deleted = "+ ourtime[index]) # ourtime[index] = "-" """ Een v VTM v Vier v Canvas v Vitaya = vtm 4 v Q2 v Vijf v CAZ = vtm 3 v Zes v Ketnet v La Une v RTL-TVI v AB3 ? La Deux v Club RTL v Plug RTL ? La Trois v Nickelodeon FR ? """ def channel_identifier(anchor_link): tmp = anchor_link.split("/") if(tmp[4] == "een"): return "een" if (tmp[4] == "canvas"): return "canvas" if (tmp[4] == "vtm"): return "vtm" if (tmp[4] == "vier"): return "vier" if (tmp[4] == "vijf"): return "vijf" if (tmp[4] == "zes"): return "zes" if (tmp[4] == "rtl-tvi-hd"): return "RTI TVI HD" if (tmp[4] == "la-une"): return "LA UNE" if (tmp[4] == "la-deux"): return "LA DEUX" if (tmp[4] == "ketnet"): return "KETNET" if (tmp[4] == "vtm2"): return "vtm2" if (tmp[4] == "vtm3"): return "vtm3" if (tmp[4] == "club-rtl"): return "club-rtl" if (tmp[4] == "vtm4"): return "vtm4" if (tmp[4] == "caz-2"): return "caz-2" if (tmp[4] == "la-trois"): return "la-trois" return "null" # options = FirefoxOptions() # options.add_arguments("--headless") # driver = webdriver.Firefox(options=options) #0 click een, canvas,vtm, vier #1 click vjtf #2 click zes #9 click la une , la deux, ketnet, la trois #14 click date_of_movie = "" links_traveresed = 0 default_link = "https://www.demorgen.be/tv-gids/dag/16-05-2021" if(len(default_link.split("/")) ==6): date_of_movie =default_link.split("/")[5] print("got true") else: date_of_movie = date.today() date_of_movie = date_of_movie.strftime('%d/%m/%y') driver = webdriver.Firefox() driver.maximize_window() driver.get(default_link) # driver.implicitly_wait(15) delay = 10 # seconds try: myElem = WebDriverWait(driver, delay).until(EC.presence_of_element_located((By.ID, 'sp_message_iframe_404503'))) print("Iframe element ready") except TimeoutException: print("Iframe not loaded issue") a = driver.find_element_by_tag_name("iframe") driver.switch_to.frame(1) print("switching to iframe done") green_button = driver.find_element_by_xpath('//button[text()="Akkoord"]') green_button.click() time.sleep(10) print("It will be on schedule website") driver.switch_to.default_content() #declarration iteration = 0 ourtime = [] channel_names = [] ad_index = 82 associated_channel_name = [] production_date = [] show_title = [] current_episode = [] total_episode = [] season_number = [] myepisode_number = "" description = [] genre = [] series_movie = [] actors = [] episode_text = " " entries_deleted = 0 number_of_clicks = [0,1,2,6,9,14] links = [] while (iteration != (len(number_of_clicks))): try: myElem = WebDriverWait(driver, delay).until(EC.presence_of_element_located((By.XPATH, '/html/body/main/div/div/div[2]/div/div/div[1]/div[2]/button[2]'))) next_button = driver.find_element_by_xpath("/html/body/main/div/div/div[2]/div/div/div[1]/div[2]/button[2]") for i in range(0, number_of_clicks[iteration]): print("next button should be clicked") next_button.click() driver.implicitly_wait(2) print("Next Button located") except TimeoutException: print("Next Button Not Located") a = driver.find_elements_by_class_name("tvgm-channel__logo-placeholder") #Getting channel names on current page for i in range(0,len(a)): ourlink = a[i].get_property("href") distributed = ourlink.split("/") channel = distributed[4] channel_names.append(channel) #time of shows b = driver.find_elements_by_class_name("tvgm-broadcast-teaser__time") for i in range(0,len(b)): ourtime.append(b[i].text) c = driver.find_elements_by_class_name("tvgm-broadcast-teaser__link") for i in range(0,len(c)): if((c[i].get_property("href")) not in links): links.append(c[i].get_property("href")) #getting link for i in range(links_traveresed,len(links)): tmp = links[i] episode_text = " " if(channel_identifier(tmp) != "null"): associated_channel_name.append(channel_identifier(tmp)) driver.get(tmp) #Page visited try: production_date.append(driver.find_element_by_class_name("tvgm-broadcast-detail__productionyear").text) except NoSuchElementException: print("Production Date not found") production_date.append("-") try: show_title.append(driver.find_element_by_class_name("tvgm-broadcast-detail__title").text) except NoSuchElementException: print("Show title not found") show_title.append("-") try: description.append(driver.find_element_by_class_name("tvgm-broadcast-detail__description").text) except NoSuchElementException: print("Description not found") description.append("-") try: actors.append(driver.find_element_by_class_name("tvgm-broadcast-detail__castandcrew").text) except NoSuchElementException: print("Actors not found") actors.append("-") try: temp = driver.find_element_by_class_name("tvgm-broadcast-detail__info-playable").text temp = temp.split(",") if(len(temp) == 2): series_movie.append(temp[0]) genre.append(temp[1]) print("This got executed (Genre)") if (len(temp) == 1): series_movie.append(temp[0]) genre.append("-") except NoSuchElementException: print("Series/Movie not found") series_movie.append("-") genre.append("-") try: driver.find_element_by_class_name("tvgm-broadcast-detail__episode-numbers") myepisode_number = driver.find_element_by_class_name("tvgm-broadcast-detail__episode-numbers").text tmp = myepisode_number.split(" ") season_number.append(tmp[1]) #changing done if(len(tmp)>2): combined_episode_number = tmp[3].split("/") if(len(combined_episode_number) ==2): current_episode.append(combined_episode_number[0]) total_episode.append(combined_episode_number[1]) print("This got executed (Episodes)") if (len(combined_episode_number) == 1): current_episode.append(combined_episode_number[0]) total_episode.append("-") else: #if both not available total_episode.append("-") current_episode.append("-") print("Epsisode starting and ending exist ") except NoSuchElementException: print("Starting ending Episode not exist") season_number.append("-") current_episode.append("-") total_episode.append("-") #tester #break else: #not interested in this channel remove_entry(i) entries_deleted = entries_deleted +1 print("****** ENTRY SKIPPED ********") links_traveresed = len(links) #tester # if(i == ad_index): # break driver.get(default_link) iteration = iteration+1 driver.close() # print("Starting time = " + ourtime[ad_index]) # print("Actors = " + actors[ad_index]) # print("Associated Channel Name = " + associated_channel_name[ad_index]) # print("Production Date = " + production_date[ad_index]) # print("Show title = " + show_title[ad_index]) # print("Current Episode = " + current_episode[ad_index]) # print("Total Episode = " + total_episode[ad_index]) # print("Genre = " + genre[ad_index]) # print("Series_Movie = " + series_movie[ad_index]) # print("Season Number = " + season_number[ad_index]) # for i in range(0,len(ourtime)): # if(ourtime[i] == "-"): # del(ourtime[i]) print(ourtime) print(actors) print(associated_channel_name) print(production_date) print(show_title) print(current_episode) print(total_episode) print(genre) print(series_movie) print(season_number) print(len(ourtime)) print(len(actors)) print(len(associated_channel_name)) print(len(production_date)) print(len(show_title)) print(len(current_episode)) print(len(total_episode)) print(len(genre)) print(len(series_movie)) print(len(season_number)) import csv with open('channel_data_210516.csv', mode='w',newline='') as employee_file: employee_writer = csv.writer(employee_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) for i in range(0,len(ourtime)): if(i==0): employee_writer.writerow(["Date of Movie","Starting Time","Actors","Channel Name","Production Date","Title of Show","Current Episode","Total Episodes","Genre","Series/Movie","Season Number"]) employee_writer.writerow([date_of_movie,ourtime[i],actors[i],associated_channel_name[i],production_date[i],show_title[i],current_episode[i],total_episode[i],genre[i],series_movie[i],season_number[i]])
27a3e0d3c60ec1fc09deb3b837285e09d0373c5c
380a47268c5975473a2e7c38c747bc3bdbd981b1
/benchmark/third_party/transformers/src/transformers/models/swinv2/configuration_swinv2.py
ffffcd12aff0cda9d890cf0c52350bde1c406755
[ "Apache-2.0" ]
permissive
FMInference/FlexGen
07aa9b1918c19b02077e13ad07e76840843810dd
d34f7b4b43ed87a374f394b0535ed685af66197b
refs/heads/main
2023-07-24T02:29:51.179817
2023-07-21T22:38:31
2023-07-21T22:38:31
602,270,517
6,821
411
Apache-2.0
2023-07-07T22:59:24
2023-02-15T21:18:53
Python
UTF-8
Python
false
false
6,527
py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # 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. """ Swinv2 Transformer model configuration""" from ...configuration_utils import PretrainedConfig from ...utils import logging logger = logging.get_logger(__name__) SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP = { "microsoft/swinv2_tiny_patch4_windows8_256": ( "https://huggingface.co/microsoft/swinv2_tiny_patch4_windows8_256/resolve/main/config.json" ), } class Swinv2Config(PretrainedConfig): r""" This is the configuration class to store the configuration of a [`Swinv2Model`]. It is used to instantiate a Swin Transformer v2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the Swin Transformer v2 [microsoft/swinv2_tiny_patch4_windows8_256](https://huggingface.co/microsoft/swinv2_tiny_patch4_windows8_256) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. Args: image_size (`int`, *optional*, defaults to 224): The size (resolution) of each image. patch_size (`int`, *optional*, defaults to 4): The size (resolution) of each patch. num_channels (`int`, *optional*, defaults to 3): The number of input channels. embed_dim (`int`, *optional*, defaults to 96): Dimensionality of patch embedding. depths (`list(int)`, *optional*, defaults to `[2, 2, 6, 2]`): Depth of each layer in the Transformer encoder. num_heads (`list(int)`, *optional*, defaults to `[3, 6, 12, 24]`): Number of attention heads in each layer of the Transformer encoder. window_size (`int`, *optional*, defaults to 7): Size of windows. mlp_ratio (`float`, *optional*, defaults to 4.0): Ratio of MLP hidden dimensionality to embedding dimensionality. qkv_bias (`bool`, *optional*, defaults to `True`): Whether or not a learnable bias should be added to the queries, keys and values. hidden_dropout_prob (`float`, *optional*, defaults to 0.0): The dropout probability for all fully connected layers in the embeddings and encoder. attention_probs_dropout_prob (`float`, *optional*, defaults to 0.0): The dropout ratio for the attention probabilities. drop_path_rate (`float`, *optional*, defaults to 0.1): Stochastic depth rate. hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`): The non-linear activation function (function or string) in the encoder. If string, `"gelu"`, `"relu"`, `"selu"` and `"gelu_new"` are supported. use_absolute_embeddings (`bool`, *optional*, defaults to `False`): Whether or not to add absolute position embeddings to the patch embeddings. patch_norm (`bool`, *optional*, defaults to `True`): Whether or not to add layer normalization after patch embedding. initializer_range (`float`, *optional*, defaults to 0.02): The standard deviation of the truncated_normal_initializer for initializing all weight matrices. layer_norm_eps (`float`, *optional*, defaults to 1e-12): The epsilon used by the layer normalization layers. encoder_stride (`int`, `optional`, defaults to 32): Factor to increase the spatial resolution by in the decoder head for masked image modeling. Example: ```python >>> from transformers import Swinv2Config, Swinv2Model >>> # Initializing a Swinv2 microsoft/swinv2_tiny_patch4_windows8_256 style configuration >>> configuration = Swinv2Config() >>> # Initializing a model (with random weights) from the microsoft/swinv2_tiny_patch4_windows8_256 style configuration >>> model = Swinv2Model(configuration) >>> # Accessing the model configuration >>> configuration = model.config ```""" model_type = "swinv2" attribute_map = { "num_attention_heads": "num_heads", "num_hidden_layers": "num_layers", } def __init__( self, image_size=224, patch_size=4, num_channels=3, embed_dim=96, depths=[2, 2, 6, 2], num_heads=[3, 6, 12, 24], window_size=7, mlp_ratio=4.0, qkv_bias=True, hidden_dropout_prob=0.0, attention_probs_dropout_prob=0.0, drop_path_rate=0.1, hidden_act="gelu", use_absolute_embeddings=False, patch_norm=True, initializer_range=0.02, layer_norm_eps=1e-5, encoder_stride=32, **kwargs ): super().__init__(**kwargs) self.image_size = image_size self.patch_size = patch_size self.num_channels = num_channels self.embed_dim = embed_dim self.depths = depths self.num_layers = len(depths) self.num_heads = num_heads self.window_size = window_size self.mlp_ratio = mlp_ratio self.qkv_bias = qkv_bias self.hidden_dropout_prob = hidden_dropout_prob self.attention_probs_dropout_prob = attention_probs_dropout_prob self.drop_path_rate = drop_path_rate self.hidden_act = hidden_act self.use_absolute_embeddings = use_absolute_embeddings self.path_norm = patch_norm self.layer_norm_eps = layer_norm_eps self.initializer_range = initializer_range self.encoder_stride = encoder_stride # we set the hidden_size attribute in order to make Swinv2 work with VisionEncoderDecoderModel # this indicates the channel dimension after the last stage of the model self.hidden_size = int(embed_dim * 2 ** (len(depths) - 1)) self.pretrained_window_sizes = (0, 0, 0, 0)
0c64319d4b22ac9fcd813f02a4b038fd2894fb06
d61183674ed7de0de626490cfba77d67c298d1be
/py_scripts/bench_plot_lasso_path_63.py
fe9f6bc621d038bca5caf96b8eede3fd982255b9
[]
no_license
Giannos-G/python_dataset
bc670a53143d92cf781e88dee608da38b0e63886
18e24cbef16ada1003a3e15a2ed2a3f995f25e46
refs/heads/main
2023-07-25T20:24:31.988271
2021-09-09T10:31:41
2021-09-09T10:31:41
363,489,911
2
0
null
null
null
null
UTF-8
Python
false
false
3,978
py
"""Benchmarks of Lasso regularization path computation using Lars and CD The input data is mostly low rank but is a fat infinite tail. """ from collections import defaultdict import gc import sys from time import time import numpy as np from sklearn.linear_model import lars_path, lars_path_gram from sklearn.linear_model import lasso_path from sklearn.datasets import make_regression def compute_bench(samples_range, features_range): it = 0 results = defaultdict(lambda: []) max_it = len(samples_range) * len(features_range) for n_samples in samples_range: for n_features in features_range: it += 1 print('====================') print('Iteration %03d of %03d' % (it, max_it)) print('====================') dataset_kwargs = { 'n_samples': n_samples, 'n_features': n_features, 'n_informative': n_features // 10, 'effective_rank': min(n_samples, n_features) / 10, #'effective_rank': None, 'bias': 0.0, } print("n_samples: %d" % n_samples) print("n_features: %d" % n_features) X, y = make_regression(**dataset_kwargs) gc.collect() print("benchmarking lars_path (with Gram):", end='') sys.stdout.flush() tstart = time() G = np.dot(X.T, X) # precomputed Gram matrix Xy = np.dot(X.T, y) lars_path_gram(Xy=Xy, Gram=G, n_samples=y.size, method='lasso') delta = time() - tstart print("%0.3fs" % delta) results['lars_path (with Gram)'].append(delta) gc.collect() print("benchmarking lars_path (without Gram):", end='') sys.stdout.flush() tstart = time() lars_path(X, y, method='lasso') delta = time() - tstart print("%0.3fs" % delta) results['lars_path (without Gram)'].append(delta) gc.collect() print("benchmarking lasso_path (with Gram):", end='') sys.stdout.flush() tstart = time() lasso_path(X, y, precompute=True) delta = time() - tstart print("%0.3fs" % delta) results['lasso_path (with Gram)'].append(delta) gc.collect() print("benchmarking lasso_path (without Gram):", end='') sys.stdout.flush() tstart = time() lasso_path(X, y, precompute=False) delta = time() - tstart print("%0.3fs" % delta) results['lasso_path (without Gram)'].append(delta) return results if __name__ == '__main__': from mpl_toolkits.mplot3d import axes3d # register the 3d projection import matplotlib.pyplot as plt samples_range = np.linspace(10, 500, 3).astype(int) features_range = np.linspace(10, 800 , 3).astype(int) results = compute_bench(samples_range, features_range) max_time = max(max(t) for t in results.values()) fig = plt.figure('scikit-learn Lasso path benchmark results') i = 1 for c, (label, timings) in zip('bcry', sorted(results.items())): ax = fig.add_subplot(2, 2, i, projection='3d') X, Y = np.meshgrid(samples_range, features_range) Z = np.asarray(timings).reshape(samples_range.shape[0], features_range.shape[0]) # plot the actual surface ax.plot_surface(X, Y, Z.T, cstride=1, rstride=1, color=c, alpha=0.8) # dummy point plot to stick the legend to since surface plot do not # support legends (yet?) # ax.plot([1], [1], [1], color=c, label=label) ax.set_xlabel('n_samples') ax.set_ylabel('n_features') ax.set_zlabel('Time (s)') ax.set_zlim3d(0.0, max_time * 1.1) ax.set_title(label) # ax.legend() i += 1 #plt.show()
266caf0b8aac1131892e35df498ac3d0f0b896d4
801c0f1bb516684308ff78cd7a51616791a0e874
/chroniker/management/commands/test_status_update.py
421eb285e80b9811de5d66c6e334a4e16a2a8f26
[]
no_license
Andy-R/django-chroniker
c63283cb1f45b2dfe6aeb6559323085cad226c15
91d239e69fe3ef5eefa8088e80987ccafb6b45ef
refs/heads/master
2020-04-05T22:58:59.964744
2017-02-10T15:08:33
2017-02-10T15:08:33
62,376,921
0
0
null
2016-07-01T08:18:00
2016-07-01T08:17:59
null
UTF-8
Python
false
false
1,742
py
from __future__ import print_function import time from optparse import make_option import django from django.core.management.base import BaseCommand from chroniker.models import Job class Command(BaseCommand): help = 'Incrementally updates status, to help testing transaction ' + \ 'behavior on different database backends.' option_list = getattr(BaseCommand, 'option_list', ()) + ( make_option('--seconds', dest='seconds', default=60, help='The number of total seconds to count up to.'), ) def create_parser(self, prog_name, subcommand): """ For ``Django>=1.10`` Create and return the ``ArgumentParser`` which extends ``BaseCommand`` parser with chroniker extra args and will be used to parse the arguments to this command. """ from distutils.version import StrictVersion # pylint: disable=E0611 parser = super(Command, self).create_parser(prog_name, subcommand) version_threshold = StrictVersion('1.10') current_version = StrictVersion(django.get_version(django.VERSION)) if current_version >= version_threshold: parser.add_argument('args', nargs="*") parser.add_argument('--seconds', dest='seconds', default=60, help='The number of total seconds to count up to.') self.add_arguments(parser) return parser def handle(self, *args, **options): seconds = int(options['seconds']) for i in range(seconds): Job.update_progress(total_parts=seconds, total_parts_complete=i) print('%i of %i' % (i, seconds)) time.sleep(1)
01f8f42fb980f7cf74de36d4025987a48d2a02a3
d77e19636cd7d64019be3bf70d23102bf3e22fa8
/pycheribuild/config/jenkinsconfig.py
af5a922903bacb23cbfd6057cee8eb27f5316c34
[ "BSD-2-Clause" ]
permissive
bitvijays/cheribuild
205d28d7e3b31d1ba43e61ab824a2454bfa841a5
860c1f729f40691f49a3df91f608204f7b128cf8
refs/heads/master
2021-01-02T04:55:26.846710
2020-02-10T11:33:25
2020-02-10T11:33:25
239,497,080
0
0
NOASSERTION
2020-02-10T11:36:06
2020-02-10T11:36:05
null
UTF-8
Python
false
false
14,425
py
# # Copyright (c) 2017 Alex Richardson # All rights reserved. # # This software was developed by SRI International and the University of # Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 # ("CTSRD"), as part of the DARPA CRASH research programme. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # import os from enum import Enum from pathlib import Path from .loader import ConfigLoaderBase from .chericonfig import CheriConfig from .target_info import CompilationTargets, CrossCompileTarget from ..utils import defaultNumberOfMakeJobs, fatalError, IS_MAC, IS_LINUX, IS_FREEBSD def default_install_prefix(conf: "JenkinsConfig", unused): if conf.crossCompileTarget.is_native(): return "/opt/" + conf.targets[0] return "/opt/" + conf.cpu class JenkinsAction(Enum): BUILD = ("--build", "Run (usually build+install) chosen targets (default)") CREATE_TARBALL = ("--create-tarball", "Create an archive of the installed files", "--tarball") TEST = ("--test", "Run tests") EXTRACT_SDK = ("--extract-sdk", "Extract the SDK archive and then exit") # TODO: TEST = ("--test", "Run tests for the passed targets instead of building them", "--run-tests") def __init__(self, option_name, help_message, altname=None, actions=None): self.option_name = option_name self.help_message = help_message self.altname = altname if not actions: actions = [self] if actions: self.actions = actions def absolute_path_only(p: str) -> Path: expanded = os.path.expanduser(os.path.expandvars(str(p))) # print("Expanding env vars in", result, "->", expanded, os.environ) result = Path(expanded) if not result.is_absolute(): raise ValueError("Must be an absolute path but was: " + repr(result)) return result class JenkinsConfig(CheriConfig): def __init__(self, loader: ConfigLoaderBase, availableTargets: list): super().__init__(loader, action_class=JenkinsAction) self.default_action = "" # error if no action set self.cpu = loader.addCommandLineOnlyOption("cpu", default=os.getenv("CPU"), help="The target to build the software for (defaults to $CPU).", choices=["cheri128", "cheri256", "mips", "hybrid-cheri128", "hybrid-cheri256", "native", "x86", "amd64"]) # type: str self.workspace = loader.addCommandLineOnlyOption("workspace", default=os.getenv("WORKSPACE"), type=Path, help="The root directory for building (defaults to $WORKSPACE)") # type: Path self.sdkArchiveName = loader.addCommandLineOnlyOption("sdk-archive", type=str, default=os.getenv("SDK_ARCHIVE"), help="The name of the sdk archive") # type: str self.keepInstallDir = loader.addCommandLineOnlyBoolOption("keep-install-dir", help="Don't delete the install dir prior to build") # type: bool self.keepSdkDir = loader.addCommandLineOnlyBoolOption("keep-sdk-dir", help="Don't delete existing SDK dir even" " if there is a newer archive") # type: bool self.force_update = loader.addCommandLineOnlyBoolOption("force-update", help="Do the updating (not recommended in jenkins!)") # type: bool self.copy_compilation_db_to_source_dir = False self.makeWithoutNice = False self.makeJobs = loader.addCommandLineOnlyOption("make-jobs", "j", type=int, default=defaultNumberOfMakeJobs(), help="Number of jobs to use for compiling") self.installationPrefix = loader.addCommandLineOnlyOption("install-prefix", type=absolute_path_only, default=default_install_prefix, help="The install prefix for cross compiled projects" " (the path where it will end up in the install" " image)") # type: Path self.without_sdk = loader.addCommandLineOnlyBoolOption("without-sdk", help="Don't use the CHERI SDK -> only /usr (for native builds)") self.strip_elf_files = loader.addCommandLineOnlyBoolOption("strip-elf-files", help="Strip ELF files before creating the tarball", default=True) self.cheri_sdk_path = loader.addCommandLineOnlyOption("cheri-sdk-path", default=None, type=Path, help="Override the path to the CHERI SDK (default is $WORKSPACE/cherisdk)") # type: Path self.extract_compiler_only = loader.addCommandLineOnlyBoolOption("extract-compiler-only", help="Don't attempt to extract the CheriBSD sysroot") self.tarball_name = loader.addCommandLineOnlyOption("tarball-name", default=lambda conf, cls: conf.targets[0] + "-" + conf.cpu + ".tar.xz") self.default_output_path = "tarball" self.output_path = loader.addCommandLineOnlyOption("output-path", default=self.default_output_path, help="Path for the output (relative to $WORKSPACE)") # self.strip_install_prefix_from_archive = loader.addCommandLineOnlyBoolOption("strip-install-prefix-from-archive", # help="Only put the files inside the install prefix into the tarball (stripping the leading directories)") # type: bool self.skipUpdate = True self.skipClone = True self.verbose = True self.quiet = False self.clean = loader.addCommandLineOnlyBoolOption("clean", default=True, help="Clean build directory before building") self.force = True # no user input in jenkins self.write_logfile = False # jenkins stores the output anyway self.skipConfigure = False self.forceConfigure = True # self.listTargets = False # self.dumpConfig = False # self.getConfigOption = None self.includeDependencies = False loader.finalizeOptions(availableTargets) @property def cheri_sdk_directory_name(self): return "cherisdk" @property def sdk_cpu(self) -> str: sdk_cpu = os.getenv("SDK_CPU") if not sdk_cpu: if self.cpu in ("cheri128", "cheri256", "mips"): return self.cpu if self.cpu == "hybrid-cheri128": return "cheri128" if self.cpu == "hybrid-cheri256": return "cheri256" else: fatalError("SDK_CPU variable not set, cannot infer the name of the SDK archive") return sdk_cpu @property def sdkArchivePath(self): if self.sdkArchiveName is None: self.sdkArchiveName = "{}-{}-sdk.tar.xz".format(self.sdk_cpu, self.cheri_sdk_isa_name) assert isinstance(self.sdkArchiveName, str) return self.workspace / self.sdkArchiveName @property def cheri_sdk_isa_name(self): guessed_abi_suffix = "cap-table-" + self.cheri_cap_table_abi if self.cheri_cap_table_abi == "legacy": guessed_abi_suffix = "legacy" return os.getenv("ISA", guessed_abi_suffix) @property def qemu_bindir(self): for i in self.cheri_sdk_bindir.glob("qemu-system-*"): if self.verbose: print("Found QEMU binary", i, "in SDK dir -> using that for QEMU binaries") # If one qemu-system-foo exists in the cheri_sdk_bindir use that instead of $WORKSPACE/qemu-<OS> return self.cheri_sdk_bindir if IS_LINUX: os_suffix = "linux" elif IS_FREEBSD: os_suffix = "freebsd" elif IS_MAC: os_suffix = "mac" else: os_suffix = "unknown-os" return self.workspace / ("qemu-" + os_suffix) / "bin" def get_cheribsd_sysroot_path(self, cross_compile_target: CrossCompileTarget): # TODO: currently we need this to be unprefixed since that is what the archives created by jenkins look like return self.cheri_sdk_dir / "sysroot" def load(self): super().load() if not self.workspace or not self.workspace.is_dir(): fatalError("WORKSPACE is not set to a valid directory:", self.workspace) self.sourceRoot = self.workspace self.buildRoot = self.workspace if self.output_path != self.default_output_path: if not self.keepInstallDir: print("Not cleaning non-default output path", self.workspace / self.output_path) self.keepInstallDir = True self.outputRoot = self.workspace / self.output_path # expect the CheriBSD disk images in the workspace root self.cheribsd_image_root = self.workspace self.otherToolsDir = self.workspace / "bootstrap" # check for ctsrd/cheri-sdk-{cheri256,cheri128,mips} docker image if self.cheri_sdk_path is not None: self.cheri_sdk_dir = self.cheri_sdk_path elif Path("/cheri-sdk/bin/cheri-unknown-freebsd-clang").exists(): self.cheri_sdk_dir = Path("/cheri-sdk") else: self.cheri_sdk_dir = self.workspace / self.cheri_sdk_directory_name self.crossCompileTarget = self.cpu if self.cpu == "cheri128": self.cheriBits = 128 self.crossCompileTarget = CompilationTargets.CHERIBSD_MIPS_PURECAP elif self.cpu == "cheri256": self.cheriBits = 256 self.crossCompileTarget = CompilationTargets.CHERIBSD_MIPS_PURECAP elif self.cpu in ("mips", "hybrid-cheri128", "hybrid-cheri256"): # MIPS with CHERI memcpy self.cheriBits = 9998 if self.cpu == "mips" and self.sdk_cpu in ("cheri128", "cheri256"): self.cpu = "hybrid-" + self.sdk_cpu if self.cpu.startswith("hybrid-cheri"): self.cheriBits = int(self.cpu[len("hybrid-cheri"):]) self.run_mips_tests_with_cheri_image = True self.crossCompileTarget = CompilationTargets.CHERIBSD_MIPS_HYBRID else: assert self.cpu == "mips" self.crossCompileTarget = CompilationTargets.CHERIBSD_MIPS_NO_CHERI elif self.cpu in ("x86", "x86_64", "amd64", "host", "native"): self.cheriBits = 9999 self.crossCompileTarget = CompilationTargets.NATIVE else: fatalError("CPU is not set to a valid value:", self.cpu) if IS_MAC and self.crossCompileTarget.is_native(): self.without_sdk = True # cannot build macos binaries with lld if self.force_update: self.skipUpdate = False self.skipClone = False if self.without_sdk: if not self.crossCompileTarget.is_native(): fatalError("The --without-sdk flag only works when building host binaries") self.cheri_sdk_dir = self.outputRoot / str(self.installationPrefix).strip('/') # allow overriding the clang/clang++ paths with HOST_CC/HOST_CXX self.clangPath = Path(os.getenv("HOST_CC", self.clangPath)) self.clangPlusPlusPath = Path(os.getenv("HOST_CXX", self.clangPlusPlusPath)) self.clangCppPath = Path(os.getenv("HOST_CPP", self.clangCppPath)) if not self.clangPath.exists(): fatalError("C compiler", self.clangPath, "does not exit. Pass --clang-path or set $HOST_CC") if not self.clangPlusPlusPath.exists(): fatalError("C++ compiler", self.clangPlusPlusPath, "does not exit. Pass --clang++-path or set $HOST_CXX") if not self.clangCppPath.exists(): fatalError("C pre-processor", self.clangCppPath, "does not exit. Pass --clang-cpp-path or set $HOST_CPP") else: # always use the CHERI clang built by jenkins self.clangPath = self.cheri_sdk_bindir / "clang" self.clangPlusPlusPath = self.cheri_sdk_bindir / "clang++" if self.cheri_sdk_path is not None: assert self.cheri_sdk_bindir == self.cheri_sdk_path / "bin" self._initializeDerivedPaths() assert self._ensure_required_properties_set() if os.getenv("DEBUG") is not None: import pprint for k, v in self.__dict__.items(): if hasattr(v, "__get__"): setattr(self, k, v.__get__(self, self.__class__)) pprint.pprint(vars(self))
7e0b8ad5684c410de74942820196b3c81c829fbe
d36de316f920342823dd60dc10fa8ee5ce146c5e
/brexit_legislation/urls.py
924cff38cbcfd8a9bf87ee22b129c91f764ff4ba
[]
no_license
DemocracyClub/EURegulation
a621afa3ffae555ebd5fbdc205eceb7746a468d1
7cf0bf31b200ab1cb59922f0b3ca120be3757637
refs/heads/master
2022-07-22T04:48:59.555642
2018-06-26T14:42:19
2018-06-26T14:42:19
80,203,236
2
0
null
2022-07-08T16:02:53
2017-01-27T11:47:20
Python
UTF-8
Python
false
false
318
py
from django.conf.urls import include, url from django.views.generic import TemplateView urlpatterns = [ url(r'^$', TemplateView.as_view(template_name='home.html'), name="home"), url(r'^api/', include('api.urls')), url(r'^browse/', include('browse.urls')), url(r'^search/', include('search.urls')), ]
aa4222d7121296f46a7502528baf20ee183c59f5
af0deaee911417589b932022ad8bd0127fe42f24
/store/urls.py
db22aac04b2701050a91449ba9c4263d85097de3
[]
no_license
mayankkushal/go-green-v1
b74e7ec7ca6ab0921e72fe43b5ea76f8eea739c6
76f16616073ecc101fbbbe9fe49173b9638f597c
refs/heads/master
2022-12-08T21:21:12.223347
2019-02-08T16:29:37
2019-02-08T16:29:37
99,202,678
2
1
null
2022-11-22T01:52:51
2017-08-03T07:14:48
JavaScript
UTF-8
Python
false
false
1,135
py
from django.conf.urls import url,include from django.views.generic import DetailView, TemplateView, ListView from django.views.decorators.csrf import csrf_exempt from . import views from .models import Store app_name = "store" urlpatterns = [ url(r'^create_store/$', views.StoreCreate.as_view(), name='store_add'), url(r'^store_update/(?P<slug>[\w\-]+)/$', views.StoreUpdate.as_view(), name="store_update"), url(r'^detail/(?P<slug>[\w\-]+)$', DetailView.as_view( context_object_name="store", model=Store ), name="store_detail"), url(r'^store_list', ListView.as_view( context_object_name='store_list', model=Store ), name="store_list"), url(r'^locator', views.StoreLocator.as_view(), name='locator'), url(r'^statement', views.StoreStatement.as_view(), name='statement'), url(r'^add_product', views.ProductCreate.as_view(), name="add_product"), url(r'^update_product/(?P<pk>[\w\-]+)/', views.ProductUpdate.as_view(), name="update_product"), url(r'^product_list', views.ProductListView.as_view(), name='product_list'), url(r'^(?P<pk>[\w\-]+)/delete', views.ProductDelete.as_view(), name='delete_product') ]
5306a2f64af4a94ca1b18c60aedf583b89749974
875bb84440094ce058a2ec25a661a7da6bb2e129
/algo_py/boj/bj5648.py
711657eeb72989ec9d754ee49844ee659979c08d
[]
no_license
shg9411/algo
150e4291a7ba15990f17ca043ae8ab59db2bf97b
8e19c83b1dbc0ffde60d3a3b226c4e6cbbe89a7d
refs/heads/master
2023-06-22T00:24:08.970372
2021-07-20T06:07:29
2021-07-20T06:07:29
221,694,017
2
0
null
null
null
null
UTF-8
Python
false
false
138
py
import sys num = [] while l := sys.stdin.readline(): num.extend(map(lambda x: int(x[::-1]), l.split())) [*map(print,sorted(num[1:]))]
2799157d96b71ff3615a6ab9753f9497cd1bee80
e13cd9a8a53a3d688bcc2621c18e4d0ce79fabcb
/legacy_code/process_back_test_can_1.py
23c21ce071369a7039cd23115f6fb210432d302f
[]
no_license
renewday/sds
2d59560515e67dcc84cb259b61e52ccf08f362f0
167b5fe6d1533506e104981c9beffdec4d274a0f
refs/heads/master
2020-04-03T15:34:20.487630
2016-06-23T01:14:06
2016-06-23T01:14:06
null
0
0
null
null
null
null
UTF-8
Python
false
false
65,401
py
import os import copy import math import sys import matplotlib.pyplot as plt import datetime from scipy.signal import argrelextrema import numpy as np sys.path.append("../emd_util") from generate_emd_data import generateEMDdata from analyze import * from spline_predict import linerestruct from emd import * from leastsqt import leastsqt_predict from svm_uti import * from spline_predict import splinerestruct from calc_SNR import calc_SNR2 from calc_SNR import calc_SNR from calc_match import matchlist2 from calc_match import matchlist3 from calc_match import matchlist1 from calc_match import matchlist4 class process_util(): def __init__(self,open_price,close_price,macd,date,vol,high_price,low_price,je,kdjk,kdjd,wr): self.money = 10000 self.share = 0 self.sell_x_index = [] self.sell_y_index = [] self.buy_x_index = [] self.buy_y_index = [] self.open_price = open_price self.high_price = high_price self.low_price = low_price self.close_price = close_price self.kdjk=kdjk self.kdjd=kdjd self.wr=wr self.total_asset_list = [] self.total_asset = 0 self.buy_price = 0 self.je = je self.macd = macd self.date = date self.vol = vol self.fail_flag = 0 self.stdimf=[] self.buy_day = 0 self.last_buy_result=0 self.buy_mean_price = 0 self.one_time_day=0 self.ma_count1=0 self.ma_count=0 self.ma_count2=0 self.sell_flag=0 self.sell_flag2=0 self.snr=[] self.open_flag=0 self.power_flag=0 self.emdstd=[] self.matchcha=[] self.extenflag=[] self.imf_flag_list=[] self.close_flag=[] self.high_flag=[] self.f_d=0 self.day_count=0 self.last_as=10000 self.hb=[] self.last_fail=0 def sell(self, share, price): return float(share)*float(price) def buy(self, money, price): return float(money)/float(price) def file_count(self, train_data_dir): f = os.popen("ls %s|wc -l"%train_data_dir) file_num = f.readline() f.close() return file_num def sell_fee(self, money): return money*0.0002+money*0.001 def buy_fee(self, share, price): return share*price*0.0002 def run_predict1(self,imf_list,current_price_index,date,datafile,residual,imf_open,imf_macd,sel_flag,emd_data,emd_data2): print "\n\n begin" for i in range(len(imf_list)): imfp = imf_list[i] data = np.array(imfp) max_index = list(argrelextrema(data,np.greater)[0]) min_index = list(argrelextrema(data,np.less)[0]) print "imf %s"%i print "max %s"%max_index print "min %s"%min_index #### imf1_max_index = list(argrelextrema(np.array(imf_list[1]),np.greater)[0]) imf1_min_index = list(argrelextrema(np.array(imf_list[1]),np.less)[0]) imf1_or_flag=0 #if imf1_min_index[-1]>imf1_max_index[-1] and imf1_min_index[-1]>996: # imf1_or_flag=1 if imf1_min_index[-1]<imf1_max_index[-1] :#and imf1_max_index[-1]>=496: imf1_or_flag=2 ### imf2_max_index = list(argrelextrema(np.array(imf_list[2]),np.greater)[0]) #print " imf max index %s"%imf2_max_index imf2_min_index = list(argrelextrema(np.array(imf_list[2]),np.less)[0]) #print " imf min index %s"%imf2_min_index imf2_or_flag=0 if imf2_min_index[-1]>imf2_max_index[-1] and imf2_min_index[-1]>996 and imf2_min_index[-1]-imf2_max_index[-1]>3: imf2_or_flag=1 if imf2_min_index[-1]<imf2_max_index[-1] and imf2_max_index[-1]>996 and imf2_max_index[-1]-imf2_min_index[-1]>3: imf2_or_flag=2 #print "imf2 or flag%s"%imf2_or_flag #imf2_max_index = list(argrelextrema(np.array(imf_list[2][:-4]),np.greater)[0]) #imf2_min_index = list(argrelextrema(np.array(imf_list[2][:-4]),np.less)[0]) #if imf2_min_index[-1]<imf2_max_index[-1] and imf2_max_index[-1]<995 and imf2_max_index[-1]-imf2_min_index[-1]>3: # imf2_or_flag=11 #if imf2_min_index[-1]>imf2_max_index[-1] and imf2_min_index[-1]<995 and imf2_min_index[-1]-imf2_max_index[-1]>3: # imf2_or_flag=0 #if imf2_min_index[-1]>imf2_max_index[-1] and imf2_min_index[-1]<990 : # imf2_or_flag=1 residual_max_index = list(argrelextrema(np.array(residual),np.greater)[0]) residual_min_index = list(argrelextrema(np.array(residual),np.less)[0]) print "residual" residual_max_index.insert(0,0) residual_min_index.insert(0,0) print "max %s"%residual_max_index print "min %s"%residual_min_index residual_flag=0 #if (residual_max_index[-1]<residual_min_index[-1] and residual_min_index[-1]<45): if (residual_max_index[-1]<residual_min_index[-1] and residual_min_index[-1]>46): residual_flag=1 print "residual %s"%residual_flag s=[emd_data2[i]-imf_list[0][i] for i in range(len(emd_data2))] s=[s[i]-imf_list[1][i] for i in range(len(emd_data2))] #s=imf_list[2] ##process_data = self.close_price[current_price_index-99:current_price_index+1] data = np.array(s) max_index = list(argrelextrema(data,np.greater)[0]) min_index = list(argrelextrema(data,np.less)[0]) #print "s index%s"%max_index #print "s index%s"%min_index #tmp=max_index+min_index #tmp.sort() if 0:#tmp[-1]<270: s=imf_list[1] data = np.array(s) max_index = list(argrelextrema(data,np.greater)[0]) min_index = list(argrelextrema(data,np.less)[0]) decision=0 if max_index[-1]>min_index[-1]: decision=0 #elif max_index[-1]<min_index[-1] and min_index[-1]>980: else: decision=1 ###### imf0_max_index = list(argrelextrema(np.array(imf_list[0]),np.greater)[0]) imf0_min_index = list(argrelextrema(np.array(imf_list[0]),np.less)[0]) tmp = imf0_max_index+imf0_min_index tmp.sort() trust0=tmp[-2] imf1_max_index = list(argrelextrema(np.array(imf_list[1]),np.greater)[0]) imf1_min_index = list(argrelextrema(np.array(imf_list[1]),np.less)[0]) imf1_min_index=filter(lambda n:n<=trust0,imf1_min_index) imf1_max_index=filter(lambda n:n<=trust0,imf1_max_index) tmp = imf1_max_index+imf1_min_index tmp.sort() trust1=tmp[-2] imf1_min_index=filter(lambda n:n<trust0,imf1_min_index) imf1_max_index=filter(lambda n:n<trust0,imf1_max_index) tmp = imf1_max_index+imf1_min_index tmp.sort() trust11=tmp[-1] #use=2 ##if trust11<993 and tmp[-1]-tmp[-2]>3: ## use=1 imf2_max_index = list(argrelextrema(np.array(imf_list[2]),np.greater)[0]) imf2_min_index = list(argrelextrema(np.array(imf_list[2]),np.less)[0]) imf2_min_index=filter(lambda n:n<=trust1,imf2_min_index) imf2_max_index=filter(lambda n:n<=trust1,imf2_max_index) tmp = imf2_max_index+imf2_min_index tmp.sort() trust2=tmp[-1] #trust22=tmp[-2] #imf3_max_index = list(argrelextrema(np.array(imf_list[2]),np.greater)[0]) #imf3_min_index = list(argrelextrema(np.array(imf_list[2]),np.less)[0]) #imf3_min_index=filter(lambda n:n<=trust2,imf3_min_index) #imf3_max_index=filter(lambda n:n<=trust2,imf3_max_index) #tmp = imf3_max_index+imf3_min_index #tmp.sort() #trust3=tmp[-1] ############################################################### #if len(imf_list)<2: # imf_process = list(imf_list[0]) #else: # imf_process = list(imf_list[1]) #imf_process = list(imf_list[2]) #imf_process3 = list(imf_list[2]) # # print "imf process len%s"%len(imf_process) # # #tmp = matchlist(imf_process,10,20) # # print "imf process%s"%imf_process[-10:] # # (tmp,extenflag1) = matchlist3(imf_process) # # print "tmp len%s"%len(tmp) # # imf_process=tmp # # print "imf process%s"%imf_process[-10:] # # tmp = imf_max_index+imf_min_index # # tmp.sort() # # i=1 # # while tmp[-i]>trust: # # i+=1 # # print "use %s "%i # # if i==1 :#or tmp[-2]<990: # # (imf_process,extenflag1,ex_num) = matchlist1(imf_process) # # elif i==2: # # (imf_process,extenflag1,ex_num) = matchlist2(imf_process) # # else: # # (imf_process,extenflag1,ex_num) = matchlist3(imf_process) imf2_max_index = list(argrelextrema(np.array(imf_list[2]),np.greater)[0]) imf2_min_index = list(argrelextrema(np.array(imf_list[2]),np.less)[0]) tmp = imf2_max_index+imf2_min_index tmp.sort() i=1 while tmp[-i]>trust2: i+=1 if tmp[-i]<490: i-=1 if tmp[-i]<490: i-=1 if tmp[-i]>495: i+=1 if i<0: i=1 print "haha %s"%i if i==1 :#or tmp[-2]<990: (imf_process,extenflag1,ex_num,cha,cha2) = matchlist1(imf_list[2],3,emd_data) elif i==2: (imf_process,extenflag1,ex_num,cha,cha2) = matchlist2(imf_list[2],3,emd_data) else: (imf_process,extenflag1,ex_num,cha,cha2) = matchlist3(imf_list[2],3,emd_data) #print "imf2 cha %s"%cha2 ##### ##### #last_power=imf_process[-2]-(np.mean(imf_process[-4:-1])) #current_power=imf_process[-1]-(np.mean(imf_process[-3:])) #power_de=0 #if last_power<0 and current_power>0: # power_de=1 #if last_power>0 and current_power<0: # power_de=2 # imf_max_index = list(argrelextrema(np.array(imf_process),np.greater)[0]) print " imf max index %s"%imf_max_index imf_min_index = list(argrelextrema(np.array(imf_process),np.less)[0]) print " imf min index %s"%imf_min_index #### imf_value=[] for i in imf_max_index: imf_value.append(imf_process[i]) print "std imf value%s"%np.std(imf_value[-10:]) self.stdimf.append(np.std(imf_value[-10:])) #### #print "imf process %s"%imf_process[-10:] #print "imf process extenflag%s "%extenflag1 #print imf_process[-1] #print "-1imf_min_index %s"%imf_process[imf_min_index[-1]] #print "-1imf_max_index %s"%imf_process[imf_max_index[-1]] #ex_flag=1 #if ex_num>2: # ex_flag=0 #print "ex flag%s num %s"%(ex_flag,ex_num) #self.extenflag.append(extenflag1) #print "extenflag %s"%self.extenflag[-10:] #self.matchcha.append(cha) #print "matchcha%s"%self.matchcha[-10:] # imf2_flag=0 #print imf_min_index[-1] #print imf_max_index[-1] #last_max=current_price_index-(999-imf_max_index[-1])+1 #if imf_min_index[-1]>imf_max_index[-1]: # if imf_min_index[-1]-imf_max_index[-1]<3: # imf_min_index.pop() #if imf_max_index[-1]>imf_min_index[-1]: # if imf_max_index[-1]-imf_min_index[-1]<3: # imf_max_index.pop() if imf_min_index[-1]>imf_max_index[-1] and imf_min_index[-1]>=496 :#and imf_min_index[-1]-imf_max_index[-1]>10:#and ex_flag==1:#and imf_process[-1]<0 : imf2_flag=1 if imf_min_index[-1]<imf_max_index[-1] and imf_max_index[-1]>=496: imf2_flag=2 transfer_index=imf_min_index #print "pwoer de %s"%power_de ########## imf1_max_index = list(argrelextrema(np.array(imf_list[1]),np.greater)[0]) imf1_min_index = list(argrelextrema(np.array(imf_list[1]),np.less)[0]) tmp = imf1_max_index+imf1_min_index tmp.sort() i=1 while tmp[-i]>trust1: i+=1 if tmp[-i]<490: i-=1 if tmp[-i]<490: i-=1 if tmp[-i]>496: i+=1 if i<0: i=1 print "3haha %s"%i if i==1 :#or tmp[-2]<990: (imf_process,extenflag1,ex_num,cha,cha2) = matchlist1(imf_list[1],2,emd_data) elif i==2: (imf_process,extenflag1,ex_num,cha,cha2) = matchlist2(imf_list[1],2,emd_data) else: (imf_process,extenflag1,ex_num,cha,cha2) = matchlist3(imf_list[1],2,emd_data) imf_max_index = list(argrelextrema(np.array(imf_process),np.greater)[0]) print " imf1 max index %s"%imf_max_index imf_min_index = list(argrelextrema(np.array(imf_process),np.less)[0]) print " imf1 min index %s"%imf_min_index imf1_flag=0 if (imf_min_index[-1]>imf_max_index[-1] and imf_min_index[-1]>496) :#and imf1_or_flag!=2) or (imf1_or_flag==1) :#and ex_flag==1:#and imf_process[-1]<0 : imf1_flag=1 if (imf_min_index[-1]<imf_max_index[-1] and imf_max_index[-1]>=496 ) :#or (imf1_or_flag==2): imf1_flag=2 ############ #ma3 = self.ma(self.close_price, 3, 0, current_price_index) #ma5 = self.ma(self.close_price, 5, 0, current_price_index) #current_price = self.close_price[current_price_index] #imf1_max_index = list(argrelextrema(np.array(imf_list[1]),np.greater)[0]) #imf1_min_index = list(argrelextrema(np.array(imf_list[1]),np.less)[0]) #tmp = imf1_max_index+imf1_min_index #tmp.sort() #i=1 #while tmp[-i]>trust11: # i+=1 #print "1haha %s"%i #if i==1 :#or tmp[-2]<990: # (imf_process,extenflag1,ex_num,cha,cha2) = matchlist1(imf_list[1],3,emd_data) #elif i==2: # (imf_process,extenflag1,ex_num,cha,cha2) = matchlist2(imf_list[1],3,emd_data) #else: # (imf_process,extenflag1,ex_num,cha,cha2) = matchlist3(imf_list[1],3,emd_data) #imf_max_index = list(argrelextrema(np.array(imf_process),np.greater)[0]) #print " imf1 max index %s"%imf_max_index #imf_min_index = list(argrelextrema(np.array(imf_process),np.less)[0]) #print " imf1 min index %s"%imf_min_index #print "cha2 %s"%cha2 #imf1_flag=0 #if (imf_min_index[-1]>imf_max_index[-1] and imf_min_index[-1]>996 and cha2>1) or (imf1_or_flag==1):#len(imf_process)-5 and extenflag1<2:#and imf_process[-1]<0 : # imf1_flag=1 #if imf_max_index[-1]>imf_min_index[-1] and imf_max_index[-1]<991 and cha2>1 :#len(imf_process)-5 and extenflag1<2:#and imf_process[-1]<0 : # imf1_flag=1 #if imf_min_index[-1]<imf_max_index[-1] and imf_max_index[-1]>996:#=len(imf_process)-5: # imf1_flag=2 #if imf_min_index[-1]>imf_max_index[-1] and imf_min_index[-1]<991 and current_price<ma5:#len(imf_process)-5 and extenflag1<2:#and imf_process[-1]<0 : # imf1_flag=2 print "imf2flag %s"%imf2_flag ############## ########### last_max=0 decision=0 if sel_flag==2: # #if ((imf2_flag==1 and imf1_flag==1 and imf2_or_flag==11) or (imf2_or_flag==1 and imf1_flag==1)) and (imf0_flag==1) :#and imf2_flag6==1:#or self.close_flag==1:#and imf2_open_flag!=2: # #if ((imf2_flag==1 and imf2_or_flag!=2) or imf2_or_flag==1):# and len(self.imf_flag_list)>1 and self.imf_flag_list[-1]==1:#and imf2_or_flag!=2:# and imf1_flag==1:#and imf2_flag6==1:#or self.close_flag==1:#and imf2_open_flag!=2: if imf2_flag==1 and imf1_flag!=2:#and imf1_flag==1:# and len(self.imf_flag_list)>1 and self.imf_flag_list[-1]==1:#and imf2_or_flag!=2:# and imf1_flag==1:#and imf2_flag6==1:#or self.close_flag==1:#and imf2_open_flag!=2: # #if imf2_flag==1 and imf2_flag_open_flag!=2 and imf2_macd_flag!=2 and imf2_or_flag!=2:#and imf2_open_flag==1:#and (imf_process3[-1]<0 or imf_process[-1]<0) :#and (extenflag1+extenflag3)<3:#and imf2_open_flag!=2: # # if (imf2_flag==1 and self.open_flag==1) or (imf2_flag==1 and imf2_macd_flag==1) or (imf2_macd_flag==1 and self.close_flag==1) or (imf2_macd_flag==1 and imf2_flag==1):#and imf2_macd_flag==1:#and power_de==1:#and imf3_flag==1: decision=1 # #elif ((imf2_flag==1 and imf2_or_flag==11 ) or (imf2_or_flag==1)) and (imf0_flag==1) :#and imf2_flag6==1:#or self.close_flag==1:#and imf2_open_flag!=2: # # decision=3 # #if (imf2_flag==2 or imf2_macd_flag==2) and imf2_or_flag==2 :#and imf2_open_flag!=2: if imf2_flag==2 :#and imf2_open_flag==2 : # #if (imf2_flag==2 and self.open_flag==2) or (imf2_flag==2 and imf2_open_flag==2) or (imf2_open_flag==2 and self.close_flag==2) : # elif (imf2_flag==2 and imf2_or_flag!=2) or imf2_or_flag==2 :#and imf1_flag==2:#imf2_flag==2 and imf2_open_flag==2: decision=2 #elif 0:#sel_flag==1: # if imf1_flag==1 : # decision=1 # elif imf1_flag==2 : # decision=2 # #self.imf_flag_list.append(imf2_flag) #print "flaglist %s"%self.imf_flag_list[-5:] #print "decision%s"%decision return (decision,last_max,transfer_index) #return (imf1_flag,last_max) #return imf2_flag ########################## ########################### def run_predict(self,imf_list,current_price_index,date,datafile,residual,emd_data,imf_open,imf_macd,emd_std,preflag,emd_data2): (imf_close_flag,last_max,imf_min_index)=self.run_predict1(imf_list,current_price_index,date,datafile,residual,imf_open,imf_macd,2,emd_data,emd_data2) (imf_high_flag,last_max,imf_min_index)=self.run_predict1(imf_open,current_price_index,date,datafile,residual,imf_open,imf_macd,2,emd_data,emd_data2) #(imf_5_flag,last_max)=self.run_predict1(imf_macd,current_price_index,date,datafile,residual,imf_open,imf_macd) #imf_high_flag=1 # last_max=1 self.snr.append(calc_SNR(emd_data,imf_list)) print "SNR%s"%self.snr[-10:] imf_flag=0 deltama10 = self.ma(self.close_price, 10, 0, current_price_index)-self.ma(self.close_price, 10, -1, current_price_index) deltama20 = self.ma(self.close_price, 20, 0, current_price_index)-self.ma(self.close_price, 20, -1, current_price_index) deltama30 = self.ma(self.close_price, 30, 0, current_price_index)-self.ma(self.close_price, 30, -1, current_price_index) deltama3 = self.ma(self.close_price, 3, 0, current_price_index)-self.ma(self.close_price, 3, -1, current_price_index) deltama5 = self.ma(self.close_price, 5, 0, current_price_index)-self.ma(self.close_price, 5, -1, current_price_index) #if (imf_close_flag==1): #if self.buy_price==0 and (imf_close_flag==1 or (len(self.close_flag)>0 and (self.close_flag[-1]==1) ) or ( len(self.close_flag)>1 and self.close_flag[-1]!=2 and self.close_flag[-2]==1) or ( len(self.close_flag)>2 and self.close_flag[-3]==1 and self.close_flag[-1]!=2 and self.close_flag[-2]!=2) or (len(self.close_flag)>3 and (self.close_flag[-4]==1) and self.close_flag[-3]!=2 and self.close_flag[-2]!=2 and self.close_flag[-1]!=2)) :#and ((len(self.high_flag)>0 and self.high_flag[-1]==1) or imf_high_flag==1): #if (self.last_fail==0 and imf_close_flag==1 ) or (self.last_fail==1 and imf_close_flag==1 and imf_high_flag!=2):#and (len(self.close_flag)>0 and (self.close_flag[-1]!=2) and (self.close_flag[-2]!=2) ) :#or ( len(self.close_flag)>1 and self.close_flag[-1]!=2 and self.close_flag[-2]==1) or ( len(self.close_flag)>2 and self.close_flag[-3]==1 and self.close_flag[-1]!=2 and self.close_flag[-2]!=2) or (len(self.close_flag)>3 and (self.close_flag[-4]==1) and self.close_flag[-3]!=2 and self.close_flag[-2]!=2 and self.close_flag[-1]!=2)) :#and ((len(self.high_flag)>0 and self.high_flag[-1]==1) or imf_high_flag==1): #if imf_close_flag==1 and len(self.high_flag)>3 and (2 not in self.high_flag[-3:]):#or imf_high_flag==1: m_d=0 if deltama10>0 and deltama5<0 and deltama3<0: m_d=1 #if ( m_d==1 and imf_close_flag==1 and imf_high_flag==1) or (m_d==0 and self.last_fail==0 and imf_close_flag==1) : if imf_close_flag==1: #if self.buy_price==0 and (imf_close_flag==1 or imf_high_flag==1) :#or (imf_high_flag==1 and imf_close_flag!=2): imf_flag=1 #if len(self.close_flag)>0 and self.close_flag[-1]==1 and imf_high_flag==1: # imf_flag=1 #if imf_close_flag==1 and len(self.high_flag)>0 and self.high_flag[-1]==1: # imf_flag=1 # if imf_high_flag==1 and (len(self.close_flag)>1 and ( self.close_flag[-1]!=2 and self.close_flag[-2]!=2 and imf_close_flag!=2)): # imf_flag=1 if (imf_close_flag==2):# and imf_high_flag!=1) or (imf_high_flag==2 and imf_close_flag!=1):#and imf_high_flag==2: #if (imf_close_flag==2 ) :#or (imf_high_flag==2 and imf_close_flag!=1):#and imf_high_flag==2: imf_flag=2 self.close_flag.append(imf_close_flag) self.high_flag.append(imf_high_flag) print "imf flag %s %s"%(imf_close_flag,imf_high_flag) print "imf flag %s"%imf_flag print "high list%s"%self.high_flag[-5:] print "close list%s"%self.close_flag[-5:] ###### ma5 = [] for i in range(7): ma5.append(0) # for i in range(7,current_price_index+1): mean_5 = np.mean(self.close_price[i-6:i+1]) ma5.append(mean_5) print self.close_price[i] print "ma5 %s"%ma5[-10:] ma_max_index = list(argrelextrema(np.array(ma5[-500:]),np.greater)[0]) print " ma max index %s"%ma_max_index ma_min_index = list(argrelextrema(np.array(ma5[-500:]),np.less)[0]) print " ma min index %s"%ma_min_index print "last max%s"%last_max ma5 = self.ma(self.close_price, 5, 0, current_price_index) ma10 = self.ma(self.close_price, 10, 0, current_price_index) ma20 = self.ma(self.close_price, 20, 0, current_price_index) ma30 = self.ma(self.close_price, 30, 0, current_price_index) ma60 = self.ma(self.close_price, 60, 0, current_price_index) deltama5 = self.ma(self.close_price, 5, 0, current_price_index)-self.ma(self.close_price, 5, -1, current_price_index) deltama5_before = self.ma(self.close_price, 5, -1, current_price_index)-self.ma(self.close_price, 5, -2, current_price_index) ma_ex_de=0 #if (not (ma5>ma10>ma20>ma30 and deltama5>deltama5_before)) and ma_max_index[-1]>ma_min_index[-1] and ma_max_index[-1]>=496:#and len(ma5)-ma_min_index[-1]<=5 :#and ma_min_index[-1]-ma_max_index[-1]>=2:#and abs(ma_max_index[-1]-last_max)<2: if ma_max_index[-1]>ma_min_index[-1] and ma_max_index[-1]>496 and ma_min_index[-1]>480 and ((ma_min_index[-1] in imf_min_index) or (ma_min_index[-1]-1 in imf_min_index) or (ma_min_index[-1]-2 in imf_min_index) or (ma_min_index[-1]+1 in imf_min_index) or (ma_min_index[-1]+2 in imf_min_index)):#and len(ma5)-ma_min_index[-1]<=5 :#and ma_min_index[-1]-ma_max_index[-1]>=2:#and abs(ma_max_index[-1]-last_max)<2: ma_ex_de=2 if ma_max_index[-1]>ma_min_index[-1] and ma_max_index[-1]>496 and ma_min_index[-2]>480 and ((ma_min_index[-2] in imf_min_index) or (ma_min_index[-2]-1 in imf_min_index) or (ma_min_index[-2]-2 in imf_min_index) or (ma_min_index[-2]+1 in imf_min_index) or (ma_min_index[-2]+2 in imf_min_index)):#and len(ma5)-ma_min_index[-1]<=5 :#and ma_min_index[-1]-ma_max_index[-1]>=2:#and abs(ma_max_index[-1]-last_max)<2: ma_ex_de=2 print "ma ex de%s"%ma_ex_de ####### ma5 = self.ma(self.close_price, 5, 0, current_price_index) ma5_before = self.ma(self.close_price, 5, -1, current_price_index) deltama5 = self.ma(self.close_price, 5, 0, current_price_index)-self.ma(self.close_price, 5, -1, current_price_index) deltama5_before = self.ma(self.close_price, 5, -1, current_price_index)-self.ma(self.close_price, 5, -2, current_price_index) deltama5_before2 = self.ma(self.close_price, 5, -2, current_price_index)-self.ma(self.close_price, 5, -3, current_price_index) deltama3 = self.ma(self.close_price, 3, 0, current_price_index)-self.ma(self.close_price, 3, -1, current_price_index) deltama3_before = self.ma(self.close_price, 3, -1, current_price_index)-self.ma(self.close_price, 3, -2, current_price_index) deltama3_before2 = self.ma(self.close_price, 3, -2, current_price_index)-self.ma(self.close_price, 3, -3, current_price_index) deltama3_before3 = self.ma(self.close_price, 3, -3, current_price_index)-self.ma(self.close_price, 3, -4, current_price_index) deltama9 = self.ma(self.close_price, 9, 0, current_price_index)-self.ma(self.close_price, 9, -1, current_price_index) deltama10 = self.ma(self.close_price, 10, 0, current_price_index)-self.ma(self.close_price, 10, -1, current_price_index) deltama9_before = self.ma(self.close_price, 9, -1, current_price_index)-self.ma(self.close_price, 9, -2, current_price_index) deltama10_before = self.ma(self.close_price, 10, -1, current_price_index)-self.ma(self.close_price, 10, -2, current_price_index) deltama9_before2 = self.ma(self.close_price, 9, -2, current_price_index)-self.ma(self.close_price, 9, -3, current_price_index) ma3 = self.ma(self.close_price, 3, 0, current_price_index) ma3_b = self.ma(self.close_price, 3, -1, current_price_index) ma3_b2 = self.ma(self.close_price, 3, -2, current_price_index) ma3_b3 = self.ma(self.close_price, 3, -3, current_price_index) ma3_b4 = self.ma(self.close_price, 3, -4, current_price_index) ma3_b5 = self.ma(self.close_price, 3, -5, current_price_index) ma9 = self.ma(self.close_price, 9, 0, current_price_index) ma10 = self.ma(self.close_price, 10, 0, current_price_index) ma10_b = self.ma(self.close_price, 10, -1, current_price_index) deltama10 = self.ma(self.close_price, 10, 0, current_price_index)-self.ma(self.close_price, 10, -1, current_price_index) ma20 = self.ma(self.close_price, 25, 0, current_price_index) deltama20 = self.ma(self.close_price, 20, 0, current_price_index)-self.ma(self.close_price, 20, -1, current_price_index) deltama25 = self.ma(self.close_price, 25, 0, current_price_index)-self.ma(self.close_price, 25, -1, current_price_index) deltama25_before = self.ma(self.close_price, 25, -1, current_price_index)-self.ma(self.close_price, 25, -2, current_price_index) deltama25_before2 = self.ma(self.close_price, 25, -2, current_price_index)-self.ma(self.close_price, 25, -3, current_price_index) deltama25_before3 = self.ma(self.close_price, 25, -3, current_price_index)-self.ma(self.close_price, 25, -9, current_price_index) ma30 = self.ma(self.close_price, 30, 0, current_price_index) ma60 = self.ma(self.close_price, 60, 0, current_price_index) deltama30 = self.ma(self.close_price, 30, 0, current_price_index)-self.ma(self.close_price, 30, -1, current_price_index) deltama60 = self.ma(self.close_price, 60, 0, current_price_index)-self.ma(self.close_price, 60, -1, current_price_index) deltama60_b = self.ma(self.close_price, 60, -1, current_price_index)-self.ma(self.close_price, 60, -2, current_price_index) deltama30_b = self.ma(self.close_price, 30, -1, current_price_index)-self.ma(self.close_price, 30, -2, current_price_index) deltamacd10 = self.ma(self.macd, 10, 0, current_price_index)-self.ma(self.macd, 10, -1, current_price_index) deltamacd20 = self.ma(self.macd, 20, 0, current_price_index)-self.ma(self.macd, 20, -1, current_price_index) deltamacd10_b = self.ma(self.macd, 10, -1, current_price_index)-self.ma(self.macd, 10, -2, current_price_index) deltamacd20_b = self.ma(self.macd, 20, -1, current_price_index)-self.ma(self.macd, 20, -2, current_price_index) p = self.close_price[current_price_index-10:current_price_index+1] print "current price%s"%self.close_price[current_price_index] print p print "cal %s"%((p[-4]+3*p[-3]+6*p[-2]+17*p[-1])/27.0) print "mama3 %s %s"%(((ma3_b+ma3_b2+ma3_b3)/3.0),((ma3+ma3_b+ma3_b2)/3.0)) mama_decision=0 mama3 = (ma3+ma3_b+ma3_b2)/3.0 mama3_b = (ma3_b+ma3_b2+ma3_b3)/3.0 mama3_b2 = (ma3_b2+ma3_b3+ma3_b4)/3.0 mama3_b3 = (ma3_b3+ma3_b4+ma3_b5)/3.0 mamama3 = (mama3+mama3_b+mama3_b2)/3.0 mamama3_b = (mama3_b+mama3_b2+mama3_b3)/3.0 print "mamama3 %s %s"%(mamama3_b,mamama3) if (mamama3>mamama3_b) and mama3>mama3_b:# or (mama3>mama3_b>mama3_b2 and mama3_b2<mama3_b3): mama_decision=1 power_ma5_de=0 if self.close_price[current_price_index]-ma5>0 and self.close_price[current_price_index-1]-ma5_before<0: power_ma5_de=1 if self.close_price[current_price_index]-ma3<0 and self.close_price[current_price_index-1]-ma3_b>0: power_ma5_de=2 macdma5 = self.ma(self.macd, 5, 0, current_price_index) macdma5_before = self.ma(self.macd, 5, -1, current_price_index) macdma5_before2 = self.ma(self.macd, 5, -2, current_price_index) macdma5_before3 = self.ma(self.macd, 5, -3, current_price_index) deltamacdma5 = macdma5-macdma5_before deltamacdma5_before = macdma5_before-macdma5_before2 deltamacdma5_before2 = macdma5_before2-macdma5_before3 print "deltamacd %s %s"%(deltamacdma5_before,deltamacdma5) ################### current_price = self.close_price[current_price_index] if ma5>ma10: if self.ma_count<=0: self.ma_count = 0 self.ma_count += 1 else: self.ma_count += 1 else: if self.ma_count>=0: self.ma_count =0 self.ma_count -=1 else: self.ma_count -=1 if ma10>ma20: if self.ma_count2<=0: self.ma_count2 = 0 self.ma_count2 += 1 else: self.ma_count2 += 1 else: if self.ma_count2>=0: self.ma_count2 =0 self.ma_count2 -=1 else: self.ma_count2 -=1 if current_price>ma5: if self.ma_count1<=0: self.ma_count1 = 0 self.ma_count1 += 1 else: self.ma_count1 += 1 else: if self.ma_count1>=0: self.ma_count1 =0 self.ma_count1 -=1 else: self.ma_count1 -=1 print "ma count1 %s count %s count2 %s"%(self.ma_count1,self.ma_count,self.ma_count2) ma_de=1 if (deltama3_before>deltama3 and deltama3<0) : ma_de=0 ######## ############## pvma3=(emd_data[-1]+emd_data[-2]+emd_data[-3])/3.0 pvma5=(emd_data[-1]+emd_data[-2]+emd_data[-3]+emd_data[-4]+emd_data[-5])/5.0 pvma5_before=(emd_data[-6]+emd_data[-2]+emd_data[-3]+emd_data[-4]+emd_data[-5])/5.0 pvma5_before2=(emd_data[-7]+emd_data[-6]+emd_data[-3]+emd_data[-4]+emd_data[-5])/5.0 pvma3_before=(emd_data[-2]+emd_data[-3]+emd_data[-4])/3.0 pvma3_before2=(emd_data[-3]+emd_data[-4]+emd_data[-5])/3.0 pvma10=np.mean(emd_data[-10:]) pvma10_before=np.mean(emd_data[-11:-1]) pvma10_before2=np.mean(emd_data[-12:-2]) pvdeltama10=pvma10-pvma10_before pvdeltama10_before=pvma10_before-pvma10_before2 pvdeltama3=pvma3-pvma3_before pvdeltama3_before=pvma3_before-pvma3_before2 pvpower_de=0 if emd_data[-1]-pvma3>0 and emd_data[-2]-pvma3_before<0 and pvdeltama3<0: pvpower_de=1 print "pv ma3 %s %s %s"%(pvma3_before2,pvma3_before,pvma3) print "pv ma5 %s %s %s"%(pvma5_before2,pvma5_before,pvma5) print "pv ma10 %s %s %s"%(pvma10_before2,pvma10_before,pvma10) print "pv deltama10 %s %s"%(pvdeltama10_before,pvdeltama10) print "pv deltama3 %s %s"%(pvdeltama3_before,pvdeltama3) print "pv %s"%emd_data[-10:] ############ print "ma5 %s"%ma5 print "delta ma5 %s %s"%(deltama5_before,deltama5) print "delta ma3 before %s"%deltama3_before print "delta ma3 %s"%deltama3 print "delta ma9 before %s %s"%(deltama9_before,deltama9) print "ma3 %s"%ma3 print "ma9 %s"%ma9 print "ma10 %s"%ma10 print "delta ma10 %s"%deltama10 print "ma20 %s"%ma20 print "delta ma20 %s"%deltama20 print "delta ma25 %s"%deltama25 print "ma30 %s"%ma30 print "ma60 %s"%ma60 print "delta ma30 %s"%deltama30 if self.buy_price==0: trade_price = self.open_price[current_price_index+1]+0.1 if trade_price>self.high_price[current_price_index+1]: trade_price = self.close_price[current_price_index+1] else: trade_price = self.open_price[current_price_index+1]-0.1 if trade_price<self.low_price[current_price_index+1]: trade_price = self.close_price[current_price_index+1] print "date %s"%self.date[current_price_index] print "current price %s %s %s %s"%(self.open_price[current_price_index],self.high_price[current_price_index],self.low_price[current_price_index],self.close_price[current_price_index]) print "next price %s %s %s %s"%(self.open_price[current_price_index+1],self.high_price[current_price_index+1],self.low_price[current_price_index+1],self.close_price[current_price_index+1]) print "trade price %s"%trade_price print "buy price %s"%self.buy_price current_mean_price = self.ma(self.close_price, 5, 0, current_price_index) print "buy mean%s current mean%s"%(self.buy_mean_price,current_mean_price) ####### print "fail flag %s"%self.fail_flag #if self.snr[-1]<np.mean(self.snr[-20:]) and self.snr[-1]<np.mean(self.snr[-5:]): if self.one_time_day>0: self.one_time_day+=1 distance_decision = 1 if len(self.sell_x_index)>0 and current_price_index-self.sell_x_index[-1]<3: distance_decision = 0 distance_decision2 = 1 if len(self.buy_x_index)>0 and current_price_index-self.buy_x_index[-1]<3: distance_decision2 = 0 distance_decision3 = 1 if len(self.buy_x_index)>0 and current_price_index-self.buy_x_index[-1]<1: distance_decision2 = 0 if ((self.sell_flag==2 and imf_flag!=2) or (self.sell_flag==2 and imf_flag==2 and current_price<self.close_price[current_price_index-1])) and self.buy_price!=0: self.sell_flag2=2 emd_de=0 if emd_data[-1]-emd_data[-2]>0 and (emd_data[-2]-emd_data[-3])<0: emd_de=1 if emd_data[-1]-emd_data[-2]>0 and (emd_data[-2]-emd_data[-3])>0 and (emd_data[-3]-emd_data[-4])<0: emd_de=1 if emd_data[-1]-emd_data[-2]>0 and (emd_data[-2]-emd_data[-3])>0 and (emd_data[-3]-emd_data[-4])>0 and (emd_data[-4]-emd_data[-5])<0: emd_de=1 if emd_data[-1]-emd_data[-2]>0 and (emd_data[-2]-emd_data[-3])>0 and (emd_data[-3]-emd_data[-4])>0 and (emd_data[-4]-emd_data[-5])>0 and (emd_data[-5]-emd_data[-6])>0: emd_de=1 if min(emd_data[-5:])>0: emd_de=0 ####### use_boll=0 qu_de=0 pivot=(self.high_price[current_price_index-1]+self.low_price[current_price_index-1]+self.close_price[current_price_index-1])/3.0 res1=2*pivot-self.low_price[current_price_index-1] sup1=2*pivot-self.high_price[current_price_index-1] if sup1<current_price<res1: use_boll=1 elif current_price>res1: qu_de=1 ######## ma5_list=[] for i in range(3): ma5_list.append(0) for i in range(3,len(self.close_price)): ma5_list.append(np.mean(self.close_price[i-2:i+1])) tmp=self.close_price self.close_price=ma5_list current_price=self.close_price[current_price_index] period=5 k1=1 k2=1 boll_de=0 boll_high1 = k2*np.std(self.close_price[current_price_index-period:current_price_index+1])+np.mean(self.close_price[current_price_index-period:current_price_index+1]) boll_high1_b = k2*np.std(self.close_price[current_price_index-period-1:current_price_index])+np.mean(self.close_price[current_price_index-period-1:current_price_index]) boll_high1_b2 = k2*np.std(self.close_price[current_price_index-period-2:current_price_index-1])+np.mean(self.close_price[current_price_index-period-2:current_price_index-1]) boll_low1 = k1*(-np.std(self.close_price[current_price_index-period:current_price_index+1]))+np.mean(self.close_price[current_price_index-period:current_price_index+1]) boll_low1_b = k1*(-np.std(self.close_price[current_price_index-period-1:current_price_index]))+np.mean(self.close_price[current_price_index-period-1:current_price_index]) boll_low1_b2 = k1*(-np.std(self.close_price[current_price_index-period-2:current_price_index-1]))+np.mean(self.close_price[current_price_index-period-2:current_price_index-1]) period1=20 boll_high2 = 3*(np.std(self.close_price[current_price_index-period1:current_price_index+1]))+np.mean(self.close_price[current_price_index-period1:current_price_index+1]) boll_low2 = 2*(-np.std(self.close_price[current_price_index-period1:current_price_index+1]))+np.mean(self.close_price[current_price_index-period1:current_price_index+1]) if current_price<boll_low1: if deltama20<0: boll_de=2 else: boll_de=1 elif current_price>boll_high1: if deltama20<0: boll_de=1 else: boll_de=2 boll_de=0 if current_price>boll_high1 :#and current_price>boll_low2: boll_de=2 elif current_price<boll_low1 :#and : boll_de=1 #boll_de=0 #if self.close_price[current_price_index-1]<boll_low1_b and current_price>boll_low1: # boll_de=1 ####if self.close_price[current_price_index-1]<boll_high1_b and current_price>boll_high1: #### boll_de=1 ##if self.close_price[current_price_index-1]>boll_low1_b and current_price<boll_low1: ## boll_de=2 #if self.close_price[current_price_index-1]>boll_high1_b and current_price<boll_high1: # boll_de=2 print "low1 low2%s %s"%(boll_low1,boll_low2) print "current %s"%current_price print "width %s"%(boll_high1-boll_low1) print "widthb %s"%(boll_high1_b-boll_low1_b) print "widthb2 %s"%(boll_high1_b2-boll_low1_b2) self.close_price=tmp current_price=self.close_price[current_price_index] width_b2=boll_high1_b2-boll_low1_b2 width_b1=boll_high1_b-boll_low1_b width=boll_high1-boll_low1 mean1=(width+width_b1)/2.0 mean2=(width_b1+width_b2)/2.0 down_de=1 if mean1<mean2 and deltama10>10 and deltama20>0 :#and (deltama3<deltama3_before and deltama3<0) and deltama30>0: down_de=0 ma_de=1 if ma5<ma10<ma20<ma30: ma_de=0 print "boll %s"%boll_de decision=0 if use_boll==1 and boll_de==1: decision=1 #if use_boll==1 and boll_de==2: # decision=2 #if use_boll==0 and qu_de==1: # decision=1 print "imf flag %s"%imf_flag ##### current_k=self.kdjk[current_price_index+1] before_k=self.kdjk[current_price_index] before_k2=self.kdjk[current_price_index-1] current_d=self.kdjd[current_price_index+1] before_d=self.kdjd[current_price_index] print "k %s %s %s"%(before_k2,before_k,current_k) print "d %s %s"%(before_d,current_d) kdj_de=0 #if before_k<before_d and current_k>current_d: #if ((current_k+before_k)/2.0)<35 :#and (current_k-before_k)>(before_k-before_k2):#and current_k>current_d: if current_k>before_k: kdj_de=1 print "kdj_de %s"%kdj_de print "wr%s"%self.wr[current_price_index-5:current_price_index+1] print "current_price_index%s"%current_price_index ###### ma_list=[deltama20,deltama25,deltama30,deltama60] mac=0 for i in ma_list: if i>0: mac+=1 if mac>=2: ma_decision=1 else: ma_decision=0 #### wrma3=(self.wr[current_price_index]+self.wr[current_price_index-1]+self.wr[current_price_index-2])/3.0 wr_de=0 #if self.wr[current_price_index]>50 and self.wr[current_price_index]<self.wr[current_price_index-1]: #if wrma3>60: if wrma3>60: wr_de=1 #### if wr_de==1 and self.buy_price==0 and (boll_de==1 ) and imf_flag==1: self.f_d=1 elif self.buy_price!=0: self.f_d=0 ###### if self.fail_flag==1: if deltama60>0 and deltama20>0: self.fail_flag=0 print "macd %s"%self.macd[current_price_index-10:current_price_index+1] #if self.buy_price!=0 and imf_flag!=1 and (imf_flag==2 or (deltama5<0 and deltama5_before>0) or (deltama3<0 and deltama3_before>0)) and distance_decision2==1: print "emd %s"%np.std(emd_data[-31:-1]) print "emd %s"%np.std(emd_data[-30:]) std_de=0 if np.std(emd_data[-30:])>0.5: std_de=1 #if self.buy_price!=0 and ( (deltama5_before2>deltama5_before>deltama5 )) and ((current_price-self.buy_price)/self.buy_price)>0.01: flag_fail=1 print "ma decision%s"%ma_decision if self.buy_price!=0 and (boll_de==2 ) :#(imf_flag==2) and deltama3<deltama3_before :# ((current_price-self.buy_price)/self.buy_price)>0.01:#((deltamacd10<0 and deltamacd10_b>0) ) and ((current_price-self.buy_price)/self.buy_price)>0.01:#(current_price<ma5 )and distance_decision2==1 and ((current_price-self.buy_price)/self.buy_price)>0.01: #if self.buy_price!=0 and deltama5<0: #if self.buy_price!=0 and self.macd[current_price_index]<self.macd[current_price_index-1]<self.macd[current_price_index-2] and distance_decision2==1: #if self.buy_price!=0 and deltama3_before>0 and deltama3<0 and distance_decision2==1 :#and current_price-self.buy_price>0:#emd_data[-1]<emd_data[-2] and emd_data[-2]>emd_data[-3] :#mama3<mama3_b and mama3_b>mama3_b2 and current_price-self.buy_price>0 and self.buy_price!=0: if 1:#self.fail_flag==0: print "sell sell 1" self.money = self.sell(self.share,trade_price) self.share = 0 self.total_asset = self.money - self.sell_fee(self.money) self.money = self.total_asset self.sell_x_index.append(current_price_index) self.sell_y_index.append(current_price) if self.buy_price>=trade_price: self.fail_flag=0#+=flag_fail else: self.fail_flag=0 self.last_fail=0 self.buy_price = 0 self.buy_mean_price = 0 self.one_time_day=0 self.sell_flag=0 self.sell_flag2=0 else: if self.buy_price>=trade_price: self.fail_flag=1 else: self.fail_flag=0 self.buy_price=0 print "sellsell 1" elif 0:#self.buy_price!=0 and ma3<boll_low1 and distance_decision2==1:#((((self.buy_mean_price-current_mean_price)/self.buy_mean_price)>0.01 ) ) and self.share > 0 and np.mean(self.snr[-3:])<np.mean(self.snr[-4:-1]): #and (self.buy_price-current_price)<0 and self.share > 0: print "sell sell 2" if self.fail_flag==0: if self.buy_price>trade_price: self.fail_flag=flag_fail else: self.fail_flag=0 self.money = self.sell(self.share,trade_price) self.share = 0 self.buy_price = 0 self.total_asset = self.money - self.sell_fee(self.money) self.money = self.total_asset self.sell_x_index.append(current_price_index) self.sell_y_index.append(current_price) self.buy_mean_price = 0 self.one_time_day=0 self.sell_flag=0 self.sell_flag2=0 else: if self.buy_price>=trade_price: self.fail_flag=1 else: self.fail_flag=0 print "sellsell 1" self.buy_price=0 elif self.buy_price!=0 and ((((self.buy_price-current_price)/self.buy_price)>0.05 ) ) :#and self.share > 0 : print "sell sell 4" if 1:#self.fail_flag==0: if self.buy_price>=trade_price: self.fail_flag+=flag_fail self.last_fail=1 else: self.fail_flag=0 self.last_fail=0 self.money = self.sell(self.share,trade_price) self.share = 0 self.buy_price = 0 self.total_asset = self.money - self.sell_fee(self.money) self.money = self.total_asset self.sell_x_index.append(current_price_index) self.sell_y_index.append(current_price) self.buy_mean_price = 0 self.one_time_day=0 self.sell_flag=0 self.sell_flag2=0 else: if self.buy_price>=trade_price: self.fail_flag=1 else: self.fail_flag=0 print "sellsell 1" self.buy_price=0 elif 0:# self.buy_price!=0 and self.one_time_day>10 and imf_flag==2 and self.share > 0 and np.mean(self.snr[-3:])<np.mean(self.snr[-4:-1]): print "sell sell 3" if self.buy_price>=trade_price: self.fail_flag=1 else: self.fail_flag=0 self.money = self.sell(self.share,trade_price) self.share = 0 self.buy_price = 0 self.total_asset = self.money - self.sell_fee(self.money) self.money = self.total_asset self.sell_x_index.append(current_price_index) self.sell_y_index.append(current_price) self.buy_mean_price = 0 self.one_time_day=0 self.sell_flag=0 self.sell_flag2=0 #elif imf_flag==1 and self.buy_price==0 and snr_decision==1 and distance_decision==1 and deltama5_before<deltama5 :#and ma_decision==1 :#and distance_decision==1:#deltama3_before<deltama3:# (deltama3_before>deltama3 or deltama3<0): elif ( std_de==1 and self.f_d==1 and kdj_de==1 and distance_decision==1 and self.fail_flag==0 and (ma_decision==0 )) or ( ma_ex_de!=2 and std_de==1 and imf_flag==1 and boll_de==1 and ma_decision==1 and distance_decision==1 and self.buy_price==0):#and deltamacdma5_before<deltamacdma5:#:and deltama30>0:#emd_de==1 and (deltama3>0) and deltama10>0:# and deltama30<0 and deltama10>0) :#deltama3_before :#and mamama3>mamama3_b :#and mama3_b2<mama3_b3:#and self.macd[current_price_index]>self.macd[current_price_index-1] :#and self.macd[current_price_index-3]>self.macd[current_price_index-2] :#and deltamacdma5_before<deltamacdma5 and deltamacdma5_before<deltamacdma5_before2:#and pvpower_de==1 :#emd_data[-1]>emd_data[-2] and emd_data[-2]<emd_data[-3]:#self.close_price[current_price_index]>self.close_price[current_price_index-1]:#and (deltama3_before<deltama3 and deltama3_before<0 and deltama3>0) :#and ma_ex_de==1:#and distance_decision==1 and deltama3_before<deltama3 and deltama3_before<deltama3_before2 :#and deltama3_before2<deltama3_before3 :#and ma_ex_de==1:# and distance_decision==1 :# and self.close_price[current_price_index]>self.close_price[current_price_index-1]:#deltama3_before<deltama3:#self.macd[current_price_index-1]<self.macd[current_price_index] :#and (self.macd[current_price_index-2]<0 or self.macd[current_price_index-1]<0 or self.macd[current_price_index]<0):#and deltama5>=0 :#and deltama3_before<deltama3 ) or (deltama3>0 and deltama3_before<0)):# and mama3>mama3_b and mama3_b<mama3_b2 and distance_decision==1:#and deltama5<0:#and self.close_price[current_price_index]>self.close_price[current_price_index-1] and deltama5_before<deltama5<0: #and deltama3_before<0 and deltama3>0 and deltama5_before<deltama5<0:#and ma_decision==1 :#and distance_decision==1:#deltama3_before<deltama3:# (deltama3_before>deltama3 or deltama3<0): #elif ( (imf_flag==1 ) ) :#and self.buy_price==0 and deltama3>deltama3_before :#and deltama3>deltama3_before:#and pvpower_de==1 :#emd_data[-1]>emd_data[-2] and emd_data[-2]<emd_data[-3]:#self.close_price[current_price_index]>self.close_price[current_price_index-1]:#and (deltama3_before<deltama3 and deltama3_before<0 and deltama3>0) :#and ma_ex_de==1:#and distance_decision==1 and deltama3_before<deltama3 and deltama3_before<deltama3_before2 :#and deltama3_before2<deltama3_before3 :#and ma_ex_de==1:# and distance_decision==1 :# and self.close_price[current_price_index]>self.close_price[current_price_index-1]:#deltama3_before<deltama3:#self.macd[current_price_index-1]<self.macd[current_price_index] :#and (self.macd[current_price_index-2]<0 or self.macd[current_price_index-1]<0 or self.macd[current_price_index]<0):#and deltama5>=0 :#and deltama3_before<deltama3 ) or (deltama3>0 and deltama3_before<0)):# and mama3>mama3_b and mama3_b<mama3_b2 and distance_decision==1:#and deltama5<0:#and self.close_price[current_price_index]>self.close_price[current_price_index-1] and deltama5_before<deltama5<0: #and deltama3_before<0 and deltama3>0 and deltama5_before<deltama5<0:#and ma_decision==1 :#and distance_decision==1:#deltama3_before<deltama3:# (deltama3_before>deltama3 or deltama3<0): if 0:#self.fail_flag!=0: #self.fail_flag-=1 self.buy_price=trade_price print "buy buy 2" else: print "buy buy 1" self.share = self.buy(self.money,trade_price) self.money = 0 self.buy_price = trade_price self.buy_mean_price = current_mean_price self.total_asset = self.share*trade_price self.buy_x_index.append(current_price_index) self.buy_y_index.append(current_price) self.one_time_day=1 self.last_buy_result=0 elif 0:#self.fail_flag!=0 and ( (imf_flag==1 ) ) and self.buy_price==0 and deltama5>deltama5_before and deltama3>deltama3_before and distance_decision==1 :#and pvpower_de==1 :#emd_data[-1]>emd_data[-2] and emd_data[-2]<emd_data[-3]:#self.close_price[current_price_index]>self.close_price[current_price_index-1]:#and (deltama3_before<deltama3 and deltama3_before<0 and deltama3>0) :#and ma_ex_de==1:#and distance_decision==1 and deltama3_before<deltama3 and deltama3_before<deltama3_before2 :#and deltama3_before2<deltama3_before3 :#and ma_ex_de==1:# and distance_decision==1 :# and self.close_price[current_price_index]>self.close_price[current_price_index-1]:#deltama3_before<deltama3:#self.macd[current_price_index-1]<self.macd[current_price_index] :#and (self.macd[current_price_index-2]<0 or self.macd[current_price_index-1]<0 or self.macd[current_price_index]<0):#and deltama5>=0 :#and deltama3_before<deltama3 ) or (deltama3>0 and deltama3_before<0)):# and mama3>mama3_b and mama3_b<mama3_b2 and distance_decision==1:#and deltama5<0:#and self.close_price[current_price_index]>self.close_price[current_price_index-1] and deltama5_before<deltama5<0: #and deltama3_before<0 and deltama3>0 and deltama5_before<deltama5<0:#and ma_decision==1 :#and distance_decision==1:#deltama3_before<deltama3:# (deltama3_before>deltama3 or deltama3<0): if 0:#self.fail_flag!=0: self.fail_flag-=1 else: print "buy buy 1" self.share = self.buy(self.money,trade_price) self.money = 0 self.buy_price = trade_price self.buy_mean_price = current_mean_price self.total_asset = self.share*trade_price self.buy_x_index.append(current_price_index) self.buy_y_index.append(current_price) self.one_time_day=1 self.last_buy_result=0 if self.buy_price!=0: self.buy_day += 1 if imf_flag==2: self.sell_flag=2 else: self.sell_flag=0 print "buy day%s"%self.buy_day self.day_count+=1 if self.day_count%100==0: self.hb.append(float(self.total_asset-self.last_as)/self.last_as) self.last_as=self.total_asset print "hb %s"%self.hb self.total_asset_list.append(self.total_asset) print "total asset is %s"%(self.total_asset) print "money is %s"%(self.money) print "share is %s"%(self.share) def format_data(self, data): if isinstance(data,list): return [2*((float(data[i])-min(data))/(max(data)-float(min(data))))-1 for i in range(len(data))] def run(self,emd_data, datafile,current_index,date,emd_file,emd_data2,emd_data3,preflag): starttime = datetime.datetime.now() tmp = [i for i in emd_data] emd_data = tmp print "\n\n\n" print "emd data std %s"%(np.std(emd_data[-20:])/(np.mean(emd_data[-20:]))) print "emd data %s"%emd_data[-10:] my_emd = one_dimension_emd(emd_data,3) (imf, residual) = my_emd.emd(0.03,0.03) #my_emd2 = one_dimension_emd(emd_data2,3) #(imf_open, residual) = my_emd2.emd(0.03,0.03) # my_emd3 = one_dimension_emd(emd_data3,9) # (imf_macd, residual) = my_emd3.emd(0.03,0.03) print "len imf %s"%len(imf) imf_open=imf imf_macd=imf_open std = (np.std(emd_data[-30:])/(np.mean(emd_data[-30:]))) self.emdstd.append(std) print "emdstd%s"%self.emdstd[-10:] if len(self.emdstd)>10: print "stdma3 %s %s"%(np.mean(self.emdstd[-10:-5]),np.mean(self.emdstd[-5:])) self.run_predict(imf,current_index,date,datafile,residual,emd_data,imf_open,imf_macd,std,preflag,emd_data2) endtime = datetime.datetime.now() print "run time" print (endtime - starttime).seconds def ma(self, data, period, start, current_index): sum_period = 0 for i in range(period): sum_period += data[current_index + start - i] return float(sum_period)/period def show_sharp(self): print "sharp %s"%(np.mean(self.hb)/np.std(self.hb)) def show_success(self): print success_ratio(precondition(self.total_asset_list)) def show_stat(self): print income_mean_std(precondition(self.total_asset_list)) def show_rss(self): profit_smooth(self.total_asset_list) def draw_fig(self,datafile,start,save=0): data = self.vol pv2=[self.close_price[i]*self.vol[i] for i in range(len(self.close_price))] pv = pvpv(self.close_price,self.vol) #### maa5 = [] for i in range(60): maa5.append(0) # for i in range(60,len(data)): mean_5 = np.mean(self.close_price[i-59:i+1]) maa5.append(mean_5) # # data = maa5 maa5 = [] for i in range(3): maa5.append(0) # for i in range(3,len(data)): mean_5 = np.mean(data[i-2:i+1]) maa5.append(mean_5) ### ma5 = [] for i in range(5): ma5.append(0) # for i in range(5,len(data)): mean_5 = np.mean(self.close_price[i-4:i+1]) ma5.append(mean_5) # # # data = ma5 data = self.close_price my_emd = one_dimension_emd(data) (imf, residual) = my_emd.emd(0.1,0.1) imf = imf[2] print "stdimf%s"%self.stdimf imf_buy_value = [imf[i] for i in self.buy_x_index] imf_sell_value = [imf[i] for i in self.sell_x_index] buy_x = [i-start for i in self.buy_x_index] sell_x = [i-start for i in self.sell_x_index] data1 = ma5 data = self.close_price data2= maa5 plt.figure(1) plt.subplot(411).axis([start,len(data),min(data[start:]),max(data[start:])]) plt.plot([i for i in range(len(data))],data,'o',[i for i in range(len(data))],data,'b',self.buy_x_index,self.buy_y_index,'r*',self.sell_x_index,self.sell_y_index,'g*') plt.subplot(412).axis([start,len(data),min(data1[start:]),max(data1[start:])]) plt.plot([i for i in range(len(data1))],data1,'o',[i for i in range(len(data1))],data1,'b') plt.subplot(413).axis([start,len(data),min(data2[start:]),max(data2[start:])]) plt.plot([i for i in range(len(data2))],data2,'o',[i for i in range(len(data2))],data2,'b') plt.subplot(414).axis([start,len(imf),min(imf[start:]),max(imf[start:])]) plt.plot([i for i in range(len(imf))],imf,'o',[i for i in range(len(imf))],imf,'b',self.buy_x_index,imf_buy_value,'r*',self.sell_x_index,imf_sell_value,'g*') ##### ##### asset_list=[] x_spline_asset=[] for i in range(1,len(self.total_asset_list)): if abs(self.total_asset_list[i]-self.total_asset_list[i-1])>10: x_spline_asset.append(i) asset_list.append(self.total_asset_list[i]) spline_asset = linerestruct(x_spline_asset,asset_list) plt.figure(2) plt.plot([i for i in range(len(self.total_asset_list))],self.total_asset_list,'b',x_spline_asset,spline_asset,'r') plt.show() def format_data(data): if isinstance(data,list): return [10*((float(data[i])-min(data))/(max(data)-float(min(data)))) for i in range(len(data))] def pvpv(l1,l2): pv=[l1[0]*l2[0]] for i in range(1,len(l1)): if l1[i]>=l1[i-1]: pv.append(pv[i-1]+l1[i]*l2[i]) else: pv.append(pv[i-1]-l1[i]*l2[i]) return pv def wr_func(c,h,l,n): wr=[] for i in range(n): wr.append(0) for i in range(n,len(c)): cn=c[i] print "wri %s"%i print cn hn=max(h[i-(n):i+1]) ln=min(l[i-(n):i+1]) wr.append(100*(hn-cn)/(hn-ln)) return wr def kdj_func(c,h,l,n): k=[] d=[] for i in range(n-2): k.append(0) d.append(0) k.append(50) d.append(50) for i in range(n-1,len(c)): cn=c[i-1] print "i%s"%i print "cn%s"%cn print i-n+1 print i hn=max(h[i-(n-1):i]) print h[i-(n-1):i] print l[i-(n-1):i] print hn ln=min(l[i-(n-1):i]) print ln print (float(cn-ln)/(hn-ln)) print (2/3.0)*k[-1] rsv=100*(float(cn-ln)/(hn-ln)) print rsv print (1/3.0)*rsv print "k%s"%k[-5:] print "d%s"%d[-5:] k.append((2/3.0)*k[-1]+(1/3.0)*rsv) d.append((2/3.0)*d[-1]+(1/3.0)*k[-1]) return (k,d) def ma_func(data, period, start, current_index): sum_period = 0 for i in range(period): sum_period += data[current_index + start - i] return float(sum_period)/period if __name__ == "__main__": datafile = sys.argv[1] begin = int(sys.argv[2]) fp = open(datafile) lines = fp.readlines() fp.close() close_price = [] open_price = [] high_price = [] low_price = [] date = [] macd = [] vol = [] je = [] for eachline in lines: eachline.strip() close_price.append(float(eachline.split("\t")[4])) high_price.append(float(eachline.split("\t")[2])) low_price.append(float(eachline.split("\t")[3])) macd.append(float(eachline.split("\t")[5])) open_price.append(float(eachline.split("\t")[1])) date.append(eachline.split("\t")[0]) vol.append(float(eachline.split("\t")[5])) je.append(float(eachline.split("\t")[5])) (k,d)=kdj_func(close_price,high_price,low_price,5) wr=wr_func(close_price,high_price,low_price,10) process = process_util(open_price,close_price,macd,date,vol,high_price,low_price,je,k,d,wr) emd_dir = os.path.abspath('.')+"/"+"emd_data" print emd_dir os.popen("rm -r %s"%emd_dir) os.popen("mkdir %s"%emd_dir) generate_emd_func = generateEMDdata(datafile,begin,1000,emd_dir) #generate_emd_func.generate_machao_emd_data_fix(3) generate_emd_func.generate_ma_emd_data_fix(5) #generate_emd_func.generate_emd_data_fix() ### period=2 #close_price=[j*10 for j in macd] pv=[close_price[i]*vol[i] for i in range(len(close_price))] pv = pvpv(close_price,vol) ma = [] for ii in range(period): ma.append(0) for ii in range(period,len(close_price)): ma.append(np.mean(close_price[ii-(period-1):ii+1])) ma2 = [] for ii in range(period): ma2.append(0) for ii in range(period,len(close_price)): ma2.append(np.mean(ma[ii-(period-1):ii+1])) # data=ma # for ii in range(period): # ma.append(0) # for ii in range(period,len(close_price)): # ma.append(np.mean(data[ii-(period-1):ii+1])) period1=5 maa = [] for ii in range(period1): maa.append(0) for ii in range(period,len(close_price)): maa.append(np.mean(close_price[ii-(period1-1):ii+1])) z=[(high_price[i]+low_price[i]+2*close_price[i])/4.0 for i in range(len(close_price))] z=[ i*3 for i in close_price] z2=[ i*10 for i in close_price] z=[ma[i] for i in range(len(close_price))] m=[p*100 for p in macd] pv = pvpv(close_price,vol) pv2=[close_price[i]*vol[i] for i in range(len(close_price))] ### presnr=[] presnr2=[] for i in range(begin,begin+int(process.file_count(emd_dir))-1): print "\n\nemd file %s"%i #### print "close price%s"%close_price[-1] print "close price%s"%close_price[i] ##### #pre_emd_data=close_price[i-200:i] #print "std emd%s"%np.std(close_price[i-30:i]) #my_emd = one_dimension_emd(pre_emd_data) #(imf, residual) = my_emd.emd(0.01,0.01) #presnr.append(calc_SNR(pre_emd_data,imf)[0]) #my_emd2 = one_dimension_emd(z[i-200:i]) #(imf, residual) = my_emd2.emd(0.01,0.01) #presnr2.append(calc_SNR(z[i-200:i],imf)[0]) pre_flag=0 ##if np.mean(presnr[-3:])>np.mean(presnr[-6:-3]): #if len(presnr)>1 and (presnr[-1])>(presnr[-2]): ##if presnr[-1]>10 or presnr2[-1]>10: # pre_flag=1 print "presnr%s"%presnr[-10:] print "presnr%s"%presnr2[-10:] emd_data = ma[i-1000:i] emd_data2 = open_price[i-1000:i] emd_data3 = macd[i-1000:i] emd_data = close_price[i-1000:i] emd_data = [j for j in emd_data] #emd_data = ma2[i-1000:i] emd_data = ma[i-1000:i] emd_data2 = ma2[i-1000:i] emd_data = close_price[i-1000:i] emd_data = z[i-1000:i] emd_data2 = close_price[i-1000:i] emd_data3 = z2[i-1000:i] emd_data = close_price[i-1000:i] emd_data2 = ma[i-1000:i] emd_data = pv2[i-1000:i] emd_data = ma[i-1000:i] emd_data2 =maa[i-100:i] emd_data = close_price[i-500:i] ma5 = ma_func(close_price, 5, 0, i-1) ma10 = ma_func(close_price, 10, 0, i-1) ma20 = ma_func(close_price, 20, 0, i-1) ma30 = ma_func(close_price, 30, 0, i-1) print "ma%s %s %s %s"%(ma5,ma10,ma20,ma30) if 0:#ma5<ma10<ma20<ma30: emd_data = ma[i-500:i] else: emd_data=(close_price[i-500:i]) emd_data2 = ma[i-500:i] emd_file = "%s/emd_%s"%(emd_dir,i) print "len emddata%s"%len(emd_data) ### #### process.run(emd_data,datafile,i-1,date[-1],emd_file,emd_data2,emd_data3,pre_flag) process.show_success() process.show_stat() # process.show_rss() process.show_sharp() process.draw_fig(datafile,begin)
dda22826a3fe9a31734e8493f8266e7652b50549
5c6a1c0d7fc61c13f3c5b370f4c07542ddfbb582
/others/ODES/orbit_adaptive.py
c0f442686a2211dd2f07d297c6eea1163c5a2d34
[ "Apache-2.0" ]
permissive
hbcbh1999/Numerical-Methods-for-Physics
7afab39eb3171ce22ebbad8bdced8d9e0a263607
77c41fdf6184fe15fd6b897c3472f2bc00e4347c
refs/heads/master
2021-01-12T01:28:40.519633
2014-03-20T15:32:37
2014-03-20T15:32:37
78,389,812
6
4
null
2017-01-09T03:19:33
2017-01-09T03:19:32
null
UTF-8
Python
false
false
7,089
py
# orbital motion. We consider low mass objects orbiting the Sun. We # work in units of AU, yr, and solar masses. From Kepler's third law: # # 4 pi**2 a**3 = G M P**2 # # if a is in AU, P is in yr, and M is in solar masses, then # # a**3 = P**2 # # and therefore # # 4 pi**2 = G # # we work in coordinates with the Sun at the origin # # This version implements adaptive timestepping # # M. Zingale (2013-02-19) import math import numpy # global parameters GM = 4.0*math.pi**2 #(assuming M = 1 solar mass) # adaptive timestepping S1 = 0.9 S2 = 4.0 class orbitHistory: """ a simple container to store the integrated history of an orbit """ def __init__(self, t=None, x=None, y=None, u=None, v=None): self.t = numpy.array(t) self.x = numpy.array(x) self.y = numpy.array(y) self.u = numpy.array(u) self.v = numpy.array(v) def finalR(self): """ the radius at the final integration time """ N = len(self.t) return math.sqrt(self.x[N-1]**2 + self.y[N-1]**2) def displacement(self): """ distance between the starting and ending point """ N = len(self.t) return math.sqrt( (self.x[0] - self.x[N-1])**2 + (self.y[0] - self.y[N-1])**2 ) def energy(self): """ return the energy (per unit mass) at each point in time """ return 0.5*(self.u**2 + self.v**2) \ - GM/numpy.sqrt(self.x**2 + self.y**2) def RK4_singlestep(X0, V0, t, dt, rhs): """ take a single RK-4 timestep from t to t+dt for the system ydot = rhs """ x = X0[0] y = X0[1] u = V0[0] v = V0[1] # get the RHS at several points xdot1, ydot1, udot1, vdot1 = rhs([x,y], [u,v]) xdot2, ydot2, udot2, vdot2 = \ rhs([x+0.5*dt*xdot1,y+0.5*dt*ydot1], [u+0.5*dt*udot1,v+0.5*dt*vdot1]) xdot3, ydot3, udot3, vdot3 = \ rhs([x+0.5*dt*xdot2,y+0.5*dt*ydot2], [u+0.5*dt*udot2,v+0.5*dt*vdot2]) xdot4, ydot4, udot4, vdot4 = \ rhs([x+dt*xdot3,y+dt*ydot3], [u+dt*udot3,v+dt*vdot3]) # advance unew = u + (dt/6.0)*(udot1 + 2.0*udot2 + 2.0*udot3 + udot4) vnew = v + (dt/6.0)*(vdot1 + 2.0*vdot2 + 2.0*vdot3 + vdot4) xnew = x + (dt/6.0)*(xdot1 + 2.0*xdot2 + 2.0*xdot3 + xdot4) ynew = y + (dt/6.0)*(ydot1 + 2.0*ydot2 + 2.0*ydot3 + ydot4) return xnew, ynew, unew, vnew class orbit: """ hold the initial conditions of a planet/comet/etc. orbiting the Sun and integrate """ def __init__(self, a, e): """ a = semi-major axis (in AU), e = eccentricity """ self.x0 = 0.0 # start at x = 0 by definition self.y0 = a*(1.0 - e) # start at perihelion self.a = a self.e = e # perihelion velocity (see C&O Eq. 2.33 for ex) self.u0 = -math.sqrt( (GM/a)* (1.0 + e) / (1.0 - e) ) self.v0 = 0.0 def keplerPeriod(self): """ return the period of the orbit in yr """ return math.sqrt(self.a**3) def circularVelocity(self): """ return the circular velocity (in AU/yr) corresponding to the initial radius -- assuming a circle """ return math.sqrt(GM/self.a) def escapeVelocity(self): """ return the escape velocity (in AU/yr) corresponding to the initial radius -- assuming a circle """ return math.sqrt(2.0*GM/self.a) def intRK4(self, dt, err, tmax): """ integrate the equations of motion using 4th order R-K method with an adaptive stepsize, to try to achieve the relative error err. dt here is the initial timestep if err < 0, then we don't do adaptive stepping, but rather we always walk at the input dt """ # initial conditions t = 0.0 x = self.x0 y = self.y0 u = self.u0 v = self.v0 # store the history for plotting tpoints = [t] xpoints = [x] ypoints = [y] upoints = [u] vpoints = [v] # start with the old timestep dtNew = dt while (t < tmax): if (err > 0.0): # adaptive stepping # iteration loop -- keep trying to take a step until # we achieve our desired error relError = 1.e10 while (relError > err): dt = dtNew if t+dt > tmax: dt = tmax-t # take 2 half steps xtmp, ytmp, utmp, vtmp = \ RK4_singlestep([x,y], [u,v], t, 0.5*dt, self.rhs) xnew, ynew, unew, vnew = \ RK4_singlestep([xtmp,ytmp], [utmp,vtmp], t+0.5*dt, 0.5*dt, self.rhs) # now take just a single step to cover dt xsingle, ysingle, usingle, vsingle = \ RK4_singlestep([x,y], [u,v], t, dt, self.rhs) # {x,y,u,v}double should be more accurate that # {x,y,u,v}single, since it used smaller steps. # estimate the relative error now relError = max( abs((xnew-xsingle)/xnew), abs((ynew-ysingle)/ynew), abs((unew-usingle)/unew), abs((vnew-vsingle)/vnew) ) # adaptive timestep algorithm from Garcia (Eqs. 3.30 # and 3.31) dtEst = dt*abs(err/relError)**0.2 dtNew = min(max(S1*dtEst, dt/S2), S2*dt) else: if t+dt > tmax: dt = tmax-t # take just a single step to cover dt xnew, ynew, unew, vnew = \ RK4_singlestep([x,y], [u,v], t, dt, self.rhs) t += dt # store tpoints.append(t) xpoints.append(xnew) ypoints.append(ynew) upoints.append(unew) vpoints.append(vnew) # set for the next step x = xnew; y = ynew; u = unew; v = vnew # return a orbitHistory object with the trajectory H = orbitHistory(tpoints, xpoints, ypoints, upoints, vpoints) return H def rhs(self, X, V): """ RHS of the equations of motion. X is the input coordinate vector and V is the input velocity vector """ # current radius r = math.sqrt(X[0]**2 + X[1]**2) # position xdot = V[0] ydot = V[1] # velocity udot = -GM*X[0]/r**3 vdot = -GM*X[1]/r**3 return xdot, ydot, udot, vdot
7f2ab6c1bdbd251b25752a7629109fcb73413d66
4e353bf7035eec30e5ad861e119b03c5cafc762d
/QtGui/QWhatsThis.py
5b6146b3bf483cf8974d8bf69fddaa4d3f5f1a53
[]
no_license
daym/PyQt4-Stubs
fb79f54d5c9a7fdb42e5f2506d11aa1181f3b7d5
57d880c0d453641e31e1e846be4087865fe793a9
refs/heads/master
2022-02-11T16:47:31.128023
2017-10-06T15:32:21
2017-10-06T15:32:21
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,497
py
# encoding: utf-8 # module PyQt4.QtGui # from C:\Python27\lib\site-packages\PyQt4\QtGui.pyd # by generator 1.145 # no doc # imports import PyQt4.QtCore as __PyQt4_QtCore class QWhatsThis(): # skipped bases: <type 'sip.simplewrapper'> # no doc def createAction(self, QObject_parent=None): # real signature unknown; restored from __doc__ """ QWhatsThis.createAction(QObject parent=None) -> QAction """ return QAction def enterWhatsThisMode(self): # real signature unknown; restored from __doc__ """ QWhatsThis.enterWhatsThisMode() """ pass def hideText(self): # real signature unknown; restored from __doc__ """ QWhatsThis.hideText() """ pass def inWhatsThisMode(self): # real signature unknown; restored from __doc__ """ QWhatsThis.inWhatsThisMode() -> bool """ return False def leaveWhatsThisMode(self): # real signature unknown; restored from __doc__ """ QWhatsThis.leaveWhatsThisMode() """ pass def showText(self, QPoint, QString, QWidget_widget=None): # real signature unknown; restored from __doc__ """ QWhatsThis.showText(QPoint, QString, QWidget widget=None) """ pass def __init__(self, *args, **kwargs): # real signature unknown pass __weakref__ = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """list of weak references to the object (if defined)"""
8437f6181538d26b696fd736237986f5361a9524
fa2ffc5487bef8240a1a5c7cfb893c234df21ee0
/ormproject1/ormproject1/urls.py
84231ae88dbbf078c2576b57e4b5aaff759cc7e0
[]
no_license
sandipdeshmukh77/django-practice-projects
cfd4d8f29aa74832ed3dc5501a651cba3f201251
78f9bd9f0fac4aaeecce4a94e88c6880e004b873
refs/heads/main
2023-02-11T05:59:28.029867
2020-12-29T22:12:52
2020-12-29T22:12:52
325,446,362
0
0
null
null
null
null
UTF-8
Python
false
false
809
py
"""ormproject1 URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from testapp import views urlpatterns = [ path('admin/', admin.site.urls), path('', views.emp_view), ]
bbf399a94e325f9bc2091e29633b06ec8093eecf
b144c5142226de4e6254e0044a1ca0fcd4c8bbc6
/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/lblearnedinfo_ec56ce29319e76b0e1d8451951f052e6.py
e78c3385472f2daf5a117b909eb5acbcc9efa81a
[ "MIT" ]
permissive
iwanb/ixnetwork_restpy
fa8b885ea7a4179048ef2636c37ef7d3f6692e31
c2cb68fee9f2cc2f86660760e9e07bd06c0013c2
refs/heads/master
2021-01-02T17:27:37.096268
2020-02-11T09:28:15
2020-02-11T09:28:15
239,721,780
0
0
NOASSERTION
2020-02-11T09:20:22
2020-02-11T09:20:21
null
UTF-8
Python
false
false
5,389
py
# MIT LICENSE # # Copyright 1997 - 2019 by IXIA Keysight # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. from ixnetwork_restpy.base import Base from ixnetwork_restpy.files import Files class LbLearnedInfo(Base): """This object contains the loopback learned information. The LbLearnedInfo class encapsulates a list of lbLearnedInfo resources that is managed by the system. A list of resources can be retrieved from the server using the LbLearnedInfo.find() method. """ __slots__ = () _SDM_NAME = 'lbLearnedInfo' def __init__(self, parent): super(LbLearnedInfo, self).__init__(parent) @property def CVlan(self): """(read only) The stacked VLAN identifier for the loopback message. Returns: str """ return self._get_attribute('cVlan') @property def DstMacAddress(self): """(read only) The destination MAC address for the loopback message. Returns: str """ return self._get_attribute('dstMacAddress') @property def MdLevel(self): """(read only) The MD level for the loopback message. Returns: number """ return self._get_attribute('mdLevel') @property def Reachability(self): """(read only) Indiates the status of the Ping. If true, the ping was responded to. Returns: bool """ return self._get_attribute('reachability') @property def Rtt(self): """(read only) The round trip time for the loopback message. Returns: number """ return self._get_attribute('rtt') @property def SVlan(self): """(read only) The single VLAN identifier for the loopback message. Returns: str """ return self._get_attribute('sVlan') @property def SrcMacAddress(self): """(read only) The source MAC address for the loopback message. Returns: str """ return self._get_attribute('srcMacAddress') @property def TransactionId(self): """(read only) The transaction identifier attached to the loopback message. Returns: number """ return self._get_attribute('transactionId') def find(self, CVlan=None, DstMacAddress=None, MdLevel=None, Reachability=None, Rtt=None, SVlan=None, SrcMacAddress=None, TransactionId=None): """Finds and retrieves lbLearnedInfo data from the server. All named parameters support regex and can be used to selectively retrieve lbLearnedInfo data from the server. By default the find method takes no parameters and will retrieve all lbLearnedInfo data from the server. Args: CVlan (str): (read only) The stacked VLAN identifier for the loopback message. DstMacAddress (str): (read only) The destination MAC address for the loopback message. MdLevel (number): (read only) The MD level for the loopback message. Reachability (bool): (read only) Indiates the status of the Ping. If true, the ping was responded to. Rtt (number): (read only) The round trip time for the loopback message. SVlan (str): (read only) The single VLAN identifier for the loopback message. SrcMacAddress (str): (read only) The source MAC address for the loopback message. TransactionId (number): (read only) The transaction identifier attached to the loopback message. Returns: self: This instance with matching lbLearnedInfo data retrieved from the server available through an iterator or index Raises: ServerError: The server has encountered an uncategorized error condition """ return self._select(locals()) def read(self, href): """Retrieves a single instance of lbLearnedInfo data from the server. Args: href (str): An href to the instance to be retrieved Returns: self: This instance with the lbLearnedInfo data from the server available through an iterator or index Raises: NotFoundError: The requested resource does not exist on the server ServerError: The server has encountered an uncategorized error condition """ return self._read(href)
a7e57c370cdd942ba3edee059b279d2474ce76b3
31c50ab5729ee999698f0683c7f893a11c994269
/home/migrations/0002_load_initial_data.py
b3b1bef16fb9c537436e22c7f4f5835b367fe7f8
[]
no_license
crowdbotics-apps/regi-test-20062
e86c2eeabb0156f17c7046820452fa8249ffb8f6
3089a7ccf13444fbdaedb40b02b9347ed7338010
refs/heads/master
2022-12-09T00:20:00.701341
2020-09-06T11:46:38
2020-09-06T11:46:38
293,265,252
0
0
null
null
null
null
UTF-8
Python
false
false
1,290
py
from django.db import migrations def create_customtext(apps, schema_editor): CustomText = apps.get_model("home", "CustomText") customtext_title = "Regi Test" CustomText.objects.create(title=customtext_title) def create_homepage(apps, schema_editor): HomePage = apps.get_model("home", "HomePage") homepage_body = """ <h1 class="display-4 text-center">Regi Test</h1> <p class="lead"> This is the sample application created and deployed from the Crowdbotics app. You can view list of packages selected for this application below. </p>""" HomePage.objects.create(body=homepage_body) def create_site(apps, schema_editor): Site = apps.get_model("sites", "Site") custom_domain = "regi-test-20062.botics.co" site_params = { "name": "Regi Test", } if custom_domain: site_params["domain"] = custom_domain Site.objects.update_or_create(defaults=site_params, id=1) class Migration(migrations.Migration): dependencies = [ ("home", "0001_initial"), ("sites", "0002_alter_domain_unique"), ] operations = [ migrations.RunPython(create_customtext), migrations.RunPython(create_homepage), migrations.RunPython(create_site), ]
a702e4b80caf7a516d063910b16df3193a3b12f8
c7c1a7030ce94f9678fbb9c9e8469a9726592a0a
/server.py
8f43ad1cccafa8117dc18e3aa062fcf936d5ae0e
[ "WTFPL" ]
permissive
giogodo/hydrus
a7e5d8a6b256109e914216d18efa2e4ed341ccf7
836ae13e1f80b02e063dac9829faaec0e5c89f89
refs/heads/master
2020-04-17T18:52:00.309884
2019-01-16T22:40:53
2019-01-16T22:40:53
null
0
0
null
null
null
null
UTF-8
Python
false
false
4,392
py
#!/usr/bin/env python3 # This program is free software. It comes without any warranty, to # the extent permitted by applicable law. You can redistribute it # and/or modify it under the terms of the Do What The Fuck You Want # To Public License, Version 2, as published by Sam Hocevar. See # http://sam.zoy.org/wtfpl/COPYING for more details. try: from include import HydrusPy2To3 HydrusPy2To3.do_2to3_test() import locale try: locale.setlocale( locale.LC_ALL, '' ) except: pass from include import HydrusExceptions from include import HydrusConstants as HC from include import HydrusData from include import HydrusPaths import os import sys import time from include import ServerController import threading from twisted.internet import reactor from include import HydrusGlobals as HG from include import HydrusLogger import traceback # import argparse argparser = argparse.ArgumentParser( description = 'hydrus network server' ) argparser.add_argument( 'action', default = 'start', nargs = '?', choices = [ 'start', 'stop', 'restart' ], help = 'either start this server (default), or stop an existing server, or both' ) argparser.add_argument( '-d', '--db_dir', help = 'set an external db location' ) argparser.add_argument( '--no_daemons', action='store_true', help = 'run without background daemons' ) argparser.add_argument( '--no_wal', action='store_true', help = 'run without WAL db journalling' ) result = argparser.parse_args() action = result.action if result.db_dir is None: db_dir = HC.DEFAULT_DB_DIR if not HydrusPaths.DirectoryIsWritable( db_dir ) or HC.RUNNING_FROM_OSX_APP: db_dir = HC.USERPATH_DB_DIR else: db_dir = result.db_dir db_dir = HydrusPaths.ConvertPortablePathToAbsPath( db_dir, HC.BASE_DIR ) try: HydrusPaths.MakeSureDirectoryExists( db_dir ) except: raise Exception( 'Could not ensure db path ' + db_dir + ' exists! Check the location is correct and that you have permission to write to it!' ) no_daemons = result.no_daemons no_wal = result.no_wal # action = ServerController.ProcessStartingAction( db_dir, action ) with HydrusLogger.HydrusLogger( db_dir, 'server' ) as logger: try: if action in ( 'stop', 'restart' ): ServerController.ShutdownSiblingInstance( db_dir ) if action in ( 'start', 'restart' ): HydrusData.Print( 'Initialising controller\u2026' ) threading.Thread( target = reactor.run, kwargs = { 'installSignalHandlers' : 0 } ).start() controller = ServerController.Controller( db_dir, no_daemons, no_wal ) controller.Run() except HydrusExceptions.PermissionException as e: error = str( e ) HydrusData.Print( error ) except: error = traceback.format_exc() HydrusData.Print( 'Hydrus server failed' ) HydrusData.Print( traceback.format_exc() ) finally: HG.view_shutdown = True HG.model_shutdown = True try: controller.pubimmediate( 'wake_daemons' ) except: pass reactor.callFromThread( reactor.stop ) except HydrusExceptions.PermissionException as e: HydrusData.Print( e ) except Exception as e: import traceback import os print( traceback.format_exc() ) if 'db_dir' in locals() and os.path.exists( db_dir ): dest_path = os.path.join( db_dir, 'crash.log' ) with open( dest_path, 'w', encoding = 'utf-8' ) as f: f.write( traceback.format_exc() ) print( 'Critical error occurred! Details written to crash.log!' )
323dc9dfafaaecd399097690749c647753a3ee63
2699b6508febc0fddde5520c5498000746eee775
/metadata/ns_swe20.py
6c5a30471dad8351f5968fbd06f135d5c361138e
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
DREAM-ODA-OS/tools
e1c71ddb65c255dc291a1e10778b461f32e1b017
66090fc9c39b35b4ef439d4dfe26ac1349d9c5f2
refs/heads/master
2021-01-19T02:13:59.489229
2017-11-18T10:27:25
2017-11-18T10:27:25
18,381,247
0
0
null
null
null
null
UTF-8
Python
false
false
2,357
py
#------------------------------------------------------------------------------ # # SWE v2.0 namespace # # Project: XML Metadata Handling # Authors: Martin Paces <[email protected]> # #------------------------------------------------------------------------------- # Copyright (C) 2013 EOX IT Services GmbH # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies of this Software or works derived from this Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. #------------------------------------------------------------------------------- from lxml.builder import ElementMaker from xml_utils import nn #------------------------------------------------------------------------------ # namespace NS = "http://www.opengis.net/swe/2.0" NS_MAP = {"swe": NS} #------------------------------------------------------------------------------ # element maker E = ElementMaker(namespace=NS, nsmap=NS_MAP) #------------------------------------------------------------------------------ # predefined fully qualified names # attributes # elements DataRecord = nn(NS, 'DataRecord') AllowedValues = nn(NS, 'AllowedValues') NilValues = nn(NS, 'NilValues') field = nn(NS, 'field') Quantity = nn(NS, 'Quantity') description = nn(NS, 'description') nilValues = nn(NS, 'nilValues') nilValue = nn(NS, 'nilValue') uom = nn(NS, 'uom') constraint = nn(NS, 'constraint') interval = nn(NS, 'interval') significantFigures = nn(NS, 'significantFigures')
7e674560d2a9be8aff0f294dad3f242b65276e81
fd40d6375ddae5c8613004a411341f0c984e80d5
/src/visions/core/implementations/types/visions_object.py
4ca3062561d0563c83583f542943063a6f1c8e55
[ "LicenseRef-scancode-public-domain", "MIT" ]
permissive
ieaves/tenzing
93c3353e62621c90adefc5a174a2dcde9aacbc46
92d39c1c3a5633d8074e0ffe8c2687c465aebbc8
refs/heads/master
2020-04-25T07:14:31.388737
2020-01-07T02:51:13
2020-01-07T02:51:13
172,608,080
0
0
null
null
null
null
UTF-8
Python
false
false
904
py
import pandas.api.types as pdt import pandas as pd from typing import Sequence from visions.core.model.relations import ( IdentityRelation, InferenceRelation, TypeRelation, ) from visions.core.model.type import VisionsBaseType def _get_relations() -> Sequence[TypeRelation]: from visions.core.implementations.types import visions_generic relations = [IdentityRelation(visions_object, visions_generic)] return relations class visions_object(VisionsBaseType): """**Object** implementation of :class:`visions.core.model.type.VisionsBaseType`. Examples: >>> x = pd.Series(['a', 1, np.nan]) >>> x in visions_object True """ @classmethod def get_relations(cls) -> Sequence[TypeRelation]: return _get_relations() @classmethod def contains_op(cls, series: pd.Series) -> bool: return pdt.is_object_dtype(series)
35a8c74de378ac521d1c86e29ff4fb0fe804eba7
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p03829/s130253347.py
369c68d33d9d4cee44e80bfa246abbd4af28f0be
[]
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
157
py
n,a,b=map(int,input().split()) xs=list(map(int,input().split())) l=[xs[i+1]-xs[i] for i in range(n-1)] ans=[a*k if a*k < b else b for k in l] print(sum(ans))
66b046fca4348342f44b6fccb8ee072e0a4f1306
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p03696/s509896752.py
d2b5b083923b99b338db190c7478f534cf557b8f
[]
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
226
py
n = int(input()) s = input() opens = 0 l = 0 for i in range(n): if s[i] == "(": opens += 1 else: opens -= 1 if opens < 0: l += 1 opens = 0 print("("*l + s + ")"*opens)