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 JSONEncoder(json.JSONEncoder): | |
| def __init__(self, dateformat="%Y-%m-%d %H:%M:%S"): | |
| self.dateformat = dateformat | |
| def default(self, obj): | |
| if isinstance(obj, datetime): | |
| obj = obj.strftime(self.dateformat) | |
| elif isinstance(obj, sc2reader.events.ChatEvent): | |
| return self.default({ | |
| 'time': obj.time.seconds, |
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
| /* | |
| Missing dictionary keys can get filled at runtime with defaults. | |
| classifications allow us to answer "is a" questions. | |
| */ | |
| /* | |
| base_unit allows for basic inheritance of missing fields from other units. | |
| At least 3 classifications: worker, army, building. Units like spine crawler may be army and building. | |
| */ | |
| units = [ |
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 __future__ import absolute_import | |
| import operator | |
| import collections | |
| from bisect import bisect_left | |
| from sc2reader.events import * | |
| class Engine(object): | |
| """ Engine Specification |
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 MetaData(type): | |
| def __new__(self,clsname,bases,dct): | |
| #The base class is the exception to the rule | |
| if clsname == 'BaseData': | |
| return type.__new__(self,clsname,bases,dct) | |
| def getSC2Classes(dct): | |
| filter = lambda v: hasattr(v, '__bases__') and Object in v.__mro__ | |
| return [value for key,value in dct.iteritems() if filter(value)] |
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
| // Exceptions - Allow for catching of anticipated vs. unanticipated | |
| // | |
| class OpenLegislationException extends Exception { } | |
| class PluginException extends OpenLegislationException {} | |
| class LoaderException extends OpenLegislationException {} | |
| // Primary work flow. Directs the ingest process at a high level | |
| // | |
| class Ingest<T extends Collection<V>,V extends BaseObject> { | |
| Loader<T,V> loader; |
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 allow(file, include_regex=None): | |
| name, ext = os.path.splitext(file) | |
| if ext.lower() != ".sc2replay": | |
| return False | |
| elif include_regex and not re.match(include_regex,name): | |
| return False | |
| else: | |
| return True | |
| def get_files( location, include_regex=None, |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| from helper import AttributeDict | |
| import calendar, datetime | |
| import sc2reader | |
| from sc2reader.config import DefaultConfig | |
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
| Traceback (most recent call last): | |
| File "/home/Observatory/observatory/dashboard/fetch/fetch_repositories.py", line 127, in <module> | |
| project.calculate_score() | |
| File "/home/Observatory/observatory/dashboard/models/Project.py", line 99, in calculate_score | |
| self.save() | |
| File "/home/Observatory/observatory/dashboard/models/Project.py", line 73, in save | |
| super(Project, self).save(*args, **kwargs) | |
| File "/home/Observatory/observatory/dashboard/models/URLPathedModel.py", line 27, in save | |
| super(URLPathedModel, self).save(*args, **kwargs) | |
| File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py", line 460, in save |
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
| <response> | |
| <metadata> | |
| <status_code>200</status_code> | |
| <status_msg>SUCCESS</status_msg> | |
| <num_results>1</num_results> | |
| </metadata> | |
| <results> | |
| <result> | |
| <uid></uid> | |
| <firstName>Graylin</firstName> |
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
| <doc> | |
| <str name="bio"> </str> | |
| <str name="department">Senator Thomas K. Duane</str> | |
| <str name="email">chausow@nysenate.gov</str> | |
| <str name="email2"> </str> | |
| <str name="facebook"> </str> | |
| <str name="firstName">Jared</str> | |
| <str name="fullName">Jared Chausow</str> |
NewerOlder