def __get_pdt_calendar(): try: import parsedatetime.parsedatetime_consts as pdt except ImportError: import parsedatetime as pdt consts = pdt.Constants(usePyICU=False) consts.DOWParseStyle = -1 # "Monday" will be either today or the last Monday calendar = pdt.Calendar(consts) return calendar
def __init__(self, name='default', **kwargs): self.config = { 'journal': "journal.txt", 'encrypt': False, 'default_hour': 9, 'default_minute': 0, 'timeformat': "%Y-%m-%d %H:%M", 'tagsymbols': '@', 'highlight': True, 'linewrap': 80, } self.config.update(kwargs) # Set up date parser consts = pdt.Constants(usePyICU=False) consts.DOWParseStyle = -1 # "Monday" will be either today or the last Monday self.dateparse = pdt.Calendar(consts) self.key = None # used to decrypt and encrypt the journal self.search_tags = None # Store tags we're highlighting self.name = name self.open()
def __init__(self, **kwargs): self.config = { 'journal': "journal.txt", 'encrypt': False, 'password': "", 'default_hour': 9, 'default_minute': 0, 'timeformat': "%Y-%m-%d %H:%M", 'tagsymbols': '@', 'highlight': True, 'linewrap': 80, } self.config.update(kwargs) # Set up date parser consts = pdt.Constants(usePyICU=False) consts.DOWParseStyle = -1 # "Monday" will be either today or the last Monday self.dateparse = pdt.Calendar(consts) self.key = None # used to decrypt and encrypt the journal journal_txt = self.open() self.entries = self.parse(journal_txt) self.sort()
import jrnl.time from jrnl import Journal from jrnl import __version__ from jrnl import plugins from jrnl.cli import cli from jrnl.config import load_config from jrnl.os_compat import split_args try: import parsedatetime.parsedatetime_consts as pdt except ImportError: import parsedatetime as pdt consts = pdt.Constants(usePyICU=False) consts.DOWParseStyle = -1 # Prefers past weekdays CALENDAR = pdt.Calendar(consts) class TestKeyring(keyring.backend.KeyringBackend): """A test keyring that just stores its values in a hash""" priority = 1 keys = defaultdict(dict) def set_password(self, servicename, username, password): self.keys[servicename][username] = password def get_password(self, servicename, username): return self.keys[servicename].get(username) def delete_password(self, servicename, username):