This file contains hidden or 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
| class JsonHandler(object): | |
| """ | |
| Handles serialization/deserialization of attributes in the JSON blob. | |
| Requires a field of type TextField named 'blob' on the source model. | |
| These are not searchable unless you do FTS on the obj.blob field! | |
| """ | |
| def __init__(self, node, *args, **kwargs): | |
| # Must set via dict interface or else it triggers __setattr__ |
This file contains hidden or 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 concordance(string, search_term, width=25): | |
| """ | |
| Alternative implementation of NLTK's concordance() that | |
| allows printing to stdout or saving to a variable and | |
| does not require NLTK. | |
| Just feed it a raw string, JSON string, etc. with any line | |
| breaks stripped out. | |
| """ | |
| # Offset tracks our progress as we parse through the string |
This file contains hidden or 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
| from threading import Thread | |
| from multiprocessing import Process | |
| from os import remove | |
| from time import time | |
| class IOTest: | |
| max_workers = 10 | |
| max_lines = 10000000 | |
NewerOlder