This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Invoke progress callbacks to notify clients that garbage collection | |
* is starting or stopping | |
*/ | |
static Py_ssize_t | |
collect_with_callback(int generation) | |
{ | |
Py_ssize_t result, collected, uncollectable; | |
invoke_gc_callback("start", generation, 0, 0); | |
result = collect(generation, &collected, &uncollectable, 0); | |
invoke_gc_callback("stop", generation, collected, uncollectable); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import click | |
click.disable_unicode_literals_warning = True | |
import json | |
import random | |
import re | |
from concurrent.futures import ThreadPoolExecutor, as_completed | |
# from flaskext.mysql import MySQL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import sys | |
from concurrent.futures import ThreadPoolExecutor | |
from subprocess import call, check_output, PIPE, Popen | |
from Redy.Tools.PathLib import Path | |
test_dir = Path('test') | |
logging.basicConfig(level=logging.INFO, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# alg.9 in paper | |
def closure(d_state, conf): | |
# to prevent compute over and over again... | |
if conf in d_state.busy: | |
return set() | |
else: | |
d_state.busy.add(conf) | |
ret = set() | |
ret.add(conf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# alg.8 in paper | |
def create_dfa(a_start_state): | |
ret = dfa() | |
work = [] | |
D0 = dfa_state() # dfa start state for this rule | |
for alt in range( | |
len(a_start_state.transitions)): # init all final states, num of start state transitions is num of alts | |
f_i = dfa_state(alt) | |
ret.add_dummy_final_state(alt, f_i) | |
for i, (_, pa_i) in enumerate(a_start_state.transitions): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def merge_to_atn(self, a_net): | |
ret = a_net | |
pa = self.__new_atn_state(self.name, ret) # start state | |
ret.n_term_start_state_mapping[self.get_n_term_this_rule()] = pa | |
pa1 = self.__new_atn_state(self.name + "_end", ret, True) # end state | |
for i, alt in enumerate(self.alts): | |
pai = self.__new_atn_state(self.name + "_" + str(i), ret) # alt start state | |
pa.add_transition(epsilon, pai) # start state epsilon transition to alt start state | |
if len(alt) != 0: |
NewerOlder