rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
fromReading = options.pop('reading', self.READING) | def _getReadingSearch(self, readingStr, **options): fromReading = options.pop('reading', self.READING) | |
dictionaryTable.c.Reading, readingStr, fromReading, **options) | dictionaryTable.c.Reading, readingStr, **options) | def _getReadingSearch(self, readingStr, **options): fromReading = options.pop('reading', self.READING) |
readingStr, fromReading, **options) | readingStr, **options) | def _getReadingSearch(self, readingStr, **options): fromReading = options.pop('reading', self.READING) |
if hasattr(self.readingSearchStrategy, 'getWhereClauseMixed'): mixedClause = self.readingSearchStrategy.getWhereClauseMixed( | if self.mixedReadingSearchStrategy: mixedClause = self.mixedReadingSearchStrategy.getWhereClause( | def _getReadingSearch(self, readingStr, **options): fromReading = options.pop('reading', self.READING) |
= self.readingSearchStrategy.getMatchFunctionMixed( readingStr, fromReading, **options) | = self.mixedReadingSearchStrategy.getMatchFunction( readingStr, **options) | def _getReadingSearch(self, readingStr, **options): fromReading = options.pop('reading', self.READING) |
def __init__(self, entryFactory=None, columnFormatStrategies=None, readingSearchStrategy=None, translationSearchStrategy=None, databaseUrl=None, dbConnectInst=None): columnFormatStrategies = columnFormatStrategies or {} | def __init__(self, **options): columnFormatStrategies = options.get('columnFormatStrategies', {}) | def __init__(self, entryFactory=None, columnFormatStrategies=None, readingSearchStrategy=None, translationSearchStrategy=None, databaseUrl=None, dbConnectInst=None): |
if not readingSearchStrategy: readingSearchStrategy = SimpleReadingSearchStrategy() super(EDICTStyleEnhancedReadingDictionary, self).__init__(entryFactory, columnFormatStrategies, readingSearchStrategy, translationSearchStrategy, databaseUrl, dbConnectInst) | options['columnFormatStrategies'] = columnFormatStrategies if 'readingSearchStrategy' not in options: options['readingSearchStrategy'] \ = SimpleWildcardReadingSearchStrategy() super(EDICTStyleEnhancedReadingDictionary, self).__init__(**options) | def __init__(self, entryFactory=None, columnFormatStrategies=None, readingSearchStrategy=None, translationSearchStrategy=None, databaseUrl=None, dbConnectInst=None): |
def __init__(self, entryFactory=None, columnFormatStrategies=None, readingSearchStrategy=None, translationSearchStrategy=None, databaseUrl=None, dbConnectInst=None): if not translationSearchStrategy: translationSearchStrategy = CEDICTTranslationSearchStrategy() super(CEDICTGR, self).__init__(entryFactory, columnFormat... | def __init__(self, **options): if 'translationSearchStrategy' not in options: options['translationSearchStrategy'] \ = CEDICTWildcardTranslationSearchStrategy() super(CEDICTGR, self).__init__(**options) | def __init__(self, entryFactory=None, columnFormatStrategies=None, readingSearchStrategy=None, translationSearchStrategy=None, databaseUrl=None, dbConnectInst=None): |
def __init__(self, entryFactory=None, columnFormatStrategies=None, readingSearchStrategy=None, translationSearchStrategy=None, databaseUrl=None, dbConnectInst=None, headword='b'): | def __init__(self, **options): | def __init__(self, entryFactory=None, columnFormatStrategies=None, readingSearchStrategy=None, translationSearchStrategy=None, databaseUrl=None, dbConnectInst=None, headword='b'): """ Initialises the CEDICT instance. By default the both, simplified and traditional, headword forms are used for lookup. |
@type entryFactory: instance @param entryFactory: entry factory instance @type columnFormatStrategies: list @param columnFormatStrategies: column formatting strategy instances @type readingSearchStrategy: instance @param readingSearchStrategy: reading search strategy instance @type translationSearchStrategy: instance @... | @keyword entryFactory: entry factory instance @keyword columnFormatStrategies: column formatting strategy instances @keyword headwordSearchStrategy: headword search strategy instance @keyword readingSearchStrategy: reading search strategy instance @keyword translationSearchStrategy: translation search strategy instance... | def __init__(self, entryFactory=None, columnFormatStrategies=None, readingSearchStrategy=None, translationSearchStrategy=None, databaseUrl=None, dbConnectInst=None, headword='b'): """ Initialises the CEDICT instance. By default the both, simplified and traditional, headword forms are used for lookup. |
@type dbConnectInst: instance @param dbConnectInst: instance of a L{DatabaseConnector} @type headword: str @param headword: C{'s'} if the simplified headword is used as default, | @keyword dbConnectInst: instance of a L{DatabaseConnector} @keyword headword: C{'s'} if the simplified headword is used as default, | def __init__(self, entryFactory=None, columnFormatStrategies=None, readingSearchStrategy=None, translationSearchStrategy=None, databaseUrl=None, dbConnectInst=None, headword='b'): """ Initialises the CEDICT instance. By default the both, simplified and traditional, headword forms are used for lookup. |
if not translationSearchStrategy: translationSearchStrategy = CEDICTTranslationSearchStrategy() super(CEDICT, self).__init__(entryFactory, columnFormatStrategies, readingSearchStrategy, translationSearchStrategy, databaseUrl, dbConnectInst) | if 'translationSearchStrategy' not in options: options['translationSearchStrategy'] \ = CEDICTWildcardTranslationSearchStrategy() super(CEDICT, self).__init__(**options) headword = options.get('headword', 'b') | def __init__(self, entryFactory=None, columnFormatStrategies=None, readingSearchStrategy=None, translationSearchStrategy=None, databaseUrl=None, dbConnectInst=None, headword='b'): """ Initialises the CEDICT instance. By default the both, simplified and traditional, headword forms are used for lookup. |
if hasattr(self.readingSearchStrategy, 'getWhereClauseMixed'): mixedClauseS = self.readingSearchStrategy.getWhereClauseMixed( dictionaryTable.c.HeadwordSimplified, dictionaryTable.c.Reading, readingStr, fromReading, **options) if mixedClauseS: mixedClauseT = self.readingSearchStrategy.getWhereClauseMixed( | if self.mixedReadingSearchStrategy: mixedClauses = [] if self.headword != 't': mixedClauseS = self.mixedReadingSearchStrategy.getWhereClause( dictionaryTable.c.HeadwordSimplified, dictionaryTable.c.Reading, readingStr, **options) if mixedClauseS: mixedClauses.append(mixedClauseS) if self.headword != 's': mixedClauseT =... | def _getReadingSearch(self, readingStr, **options): fromReading = options.pop('reading', self.READING) |
dictionaryTable.c.Reading, readingStr, fromReading, **options) clauses.append(mixedClauseS) clauses.append(mixedClauseT) | dictionaryTable.c.Reading, readingStr, **options) if mixedClauseT: mixedClauses.append(mixedClauseT) if mixedClauses: clauses.extend(mixedClauses) | def _getReadingSearch(self, readingStr, **options): fromReading = options.pop('reading', self.READING) |
= self.readingSearchStrategy.getMatchFunctionMixed( readingStr, fromReading, **options) filters.append((['HeadwordSimplified', 'Reading'], mixedReadingMatchFunc)) filters.append((['HeadwordTraditional', 'Reading'], mixedReadingMatchFunc)) | = self.mixedReadingSearchStrategy.getMatchFunction( readingStr, **options) if self.headword != 't': filters.append((['HeadwordSimplified', 'Reading'], mixedReadingMatchFunc)) if self.headword != 's': filters.append((['HeadwordTraditional', 'Reading'], mixedReadingMatchFunc)) | def _getReadingSearch(self, readingStr, **options): fromReading = options.pop('reading', self.READING) |
filters = [ (['HeadwordSimplified'], lambda headword: headword == headwordStr), (['HeadwordTraditional'], lambda headword: headword == headwordStr)] | def _getHeadwordSearch(self, headwordStr, **options): filters = [ (['HeadwordSimplified'], lambda headword: headword == headwordStr), (['HeadwordTraditional'], lambda headword: headword == headwordStr)] | |
clauses.append(dictionaryTable.c.HeadwordSimplified == headwordStr) | clauses.append(self.headwordSearchStrategy.getWhereClause( dictionaryTable.c.HeadwordSimplified, headwordStr)) filters.append((['HeadwordSimplified'], self.headwordSearchStrategy.getMatchFunction(headwordStr))) | def _getHeadwordSearch(self, headwordStr, **options): filters = [ (['HeadwordSimplified'], lambda headword: headword == headwordStr), (['HeadwordTraditional'], lambda headword: headword == headwordStr)] |
clauses.append(dictionaryTable.c.HeadwordTraditional == headwordStr) | clauses.append(self.headwordSearchStrategy.getWhereClause( dictionaryTable.c.HeadwordTraditional, headwordStr)) filters.append((['HeadwordTraditional'], self.headwordSearchStrategy.getMatchFunction(headwordStr))) | def _getHeadwordSearch(self, headwordStr, **options): filters = [ (['HeadwordSimplified'], lambda headword: headword == headwordStr), (['HeadwordTraditional'], lambda headword: headword == headwordStr)] |
def __init__(self, entryFactory=None, columnFormatStrategies=None, readingSearchStrategy=None, translationSearchStrategy=None, databaseUrl=None, dbConnectInst=None, headword='b'): if not translationSearchStrategy: translationSearchStrategy = HanDeDictTranslationSearchStrategy() super(HanDeDict, self).__init__(entryFac... | def __init__(self, **options): if 'translationSearchStrategy' not in options: options['translationSearchStrategy'] \ = HanDeDictWildcardTranslationSearchStrategy() super(HanDeDict, self).__init__(**options) | def __init__(self, entryFactory=None, columnFormatStrategies=None, readingSearchStrategy=None, translationSearchStrategy=None, databaseUrl=None, dbConnectInst=None, headword='b'): |
if charLocale: self.locale = charLocale elif dictionaryN and dictionaryN in self.DICTIONARY_CHAR_LOCALE: self.locale = self.DICTIONARY_CHAR_LOCALE[dictionaryN] else: self.locale = self.guessCharacterLocale() | def __init__(self, charLocale=None, characterDomain='Unicode', readingN=None, dictionaryN=None, dictionaryDatabaseUrl=None): """ Initialises the CharacterInfo object. | |
self.characterLookup = characterlookup.CharacterLookup(self.locale, characterDomain, dbConnectInst=self.db) self.characterLookupTraditional = characterlookup.CharacterLookup('T', characterDomain, dbConnectInst=self.db) | def __init__(self, charLocale=None, characterDomain='Unicode', readingN=None, dictionaryN=None, dictionaryDatabaseUrl=None): """ Initialises the CharacterInfo object. | |
({'query': '[[Category:Glyph]]', | ({'query': '[[Category:Glyph]] [[Decomposition::!]]', | def localeEntryPreparator(entryList): columns = ['glyph', 'locale'] entryDict = dict(zip(columns, entryList)) character, glyphIndex = entryDict['glyph'].split('/', 1) locales = entryDict.get('locale', '').strip('"') localeEntries = sorted(re.findall(r'(\w)', locales)) if localeEntries: return [(character, glyphIndex... |
({'query': '[[Category:Glyph]]', 'properties': ['StrokeOrder']}, | ({'query': '[[Category:Glyph]] [[ManualStrokeOrder::!]]', 'properties': ['ManualStrokeOrder']}, | def localeEntryPreparator(entryList): columns = ['glyph', 'locale'] entryDict = dict(zip(columns, entryList)) character, glyphIndex = entryDict['glyph'].split('/', 1) locales = entryDict.get('locale', '').strip('"') localeEntries = sorted(re.findall(r'(\w)', locales)) if localeEntries: return [(character, glyphIndex... |
({'query': '[[Category:Glyph]]', 'properties': ['Locale']}, | ({'query': '[[Category:Glyph]] [[ManualLocale::!]]', 'properties': ['Locale']}, | def localeEntryPreparator(entryList): columns = ['glyph', 'locale'] entryDict = dict(zip(columns, entryList)) character, glyphIndex = entryDict['glyph'].split('/', 1) locales = entryDict.get('locale', '').strip('"') localeEntries = sorted(re.findall(r'(\w)', locales)) if localeEntries: return [(character, glyphIndex... |
f = codecReader(urllib.urlopen(query)) | logging.info("Opening %r" % query) try: f = codecReader(urllib.urlopen(query)) except IOError: f = codecReader(urllib.urlopen(query)) | def getDataSetIterator(name): try: parameter, preparatorFunc = DATA_SETS[name] except KeyError: raise ValueError("Unknown data set %r" % name) parameter = parameter.copy() if 'properties' in parameter: parameter['properties'] = '/'.join(('?' + prop) for prop in parameter['properties']) codecReader = codecs.getreader(... |
return lambda headword: regex.search(headword) is not None | return lambda headword: (headword is not None and regex.search(headword) is not None) | def getMatchFunction(self, searchStr): if self.hasWildcardCharacters(searchStr): regex = self._getWildcardRegex(searchStr) return lambda headword: regex.search(headword) is not None else: # simple routine is faster return ExactSearchStrategy.getMatchFunction(self, searchStr) |
return lambda translation: regex.search(translation) is not None | return lambda translation: (translation is not None and regex.search(translation) is not None) | def getMatchFunction(self, searchStr): if self.hasWildcardCharacters(searchStr): regex = self._getWildcardRegex(readingStr) return lambda translation: regex.search(translation) is not None else: # simple routine is faster return SingleEntryTranslationSearchStrategy.getMatchFunction(self, searchStr) |
return lambda translation: regex.search(translation) is not None | return lambda translation: (translation is not None and regex.search(translation) is not None) | def getMatchFunction(self, searchStr): # start with a slash '/', make sure any opening parenthesis is # closed and match search string. Finish with other content in # parantheses and a slash regex = re.compile('/' + '(\s+|\([^\)]+\))*' + re.escape(searchStr) + '(\s+|\([^\)]+\))*' + '/') |
regex = self._getWildcardRegex(readingStr) return lambda translation: regex.search(translation) is not None | regex = self._getWildcardRegex(searchStr) return lambda translation: (translation is not None and regex.search(translation) is not None) | def getMatchFunction(self, searchStr): if self.hasWildcardCharacters(searchStr): regex = self._getWildcardRegex(readingStr) return lambda translation: regex.search(translation) is not None else: # simple routine is faster return SimpleTranslationSearchStrategy.getMatchFunction(self, searchStr) |
return lambda translation: regex.search(translation) is not None | return lambda translation: (translation is not None and regex.search(translation) is not None) | def getMatchFunction(self, searchStr): # start with a slash '/', make sure any opening parenthesis is # closed and match search string. Finish with other content in # parantheses and a slash regex = re.compile('/' + '(\s+|\([^\)]+\))*' + re.escape(searchStr) + '(\s+|\([^\)]+\))*' + '[/,]') |
return lambda translation: regex.search(translation) is not None | return lambda translation: (translation is not None and regex.search(translation) is not None) | def getMatchFunction(self, searchStr): if self.hasWildcardCharacters(searchStr): regex = self._getWildcardRegex(searchStr) return lambda translation: regex.search(translation) is not None else: # simple routine is faster return CEDICTTranslationSearchStrategy.getMatchFunction(self, searchStr) |
return lambda translation: regex.search(translation) is not None | return lambda translation: (translation is not None and regex.search(translation) is not None) | def getMatchFunction(self, searchStr): # start with a slash '/', make sure any opening parenthesis is # closed, end any other entry with a punctuation mark, and match # search string. Finish with other content in parantheses and # a slash or punctuation mark regex = re.compile('/((\([^\)]+\)|[^\(])+' + '(?!; Bsp.... |
return lambda translation: regex.search(translation) is not None | return lambda translation: (translation is not None and regex.search(translation) is not None) | def getMatchFunction(self, searchStr): if self.hasWildcardCharacters(searchStr): regex = self._getWildcardRegex(searchStr) return lambda translation: regex.search(translation) is not None else: # simple routine is faster return HanDeDictTranslationSearchStrategy.getMatchFunction(self, searchStr) |
return lambda reading: regex.search(reading) is not None | return lambda reading: (reading is not None and regex.search(reading) is not None) | def getMatchFunction(self, searchStr, **options): if self.hasWildcardCharacters(searchStr): regex = self._getWildcardRegex(searchStr) return lambda reading: regex.search(reading) is not None else: # simple routine is faster return ExactSearchStrategy.getMatchFunction(self, searchStr) |
self._registerViews() | def __init__(self, configuration): """ Constructs the DatabaseConnector object and connects to the database specified by the options given in databaseSettings. | |
def _registerViews(self): """ Registers all views and makes them accessible through the same methods as tables in SQLAlchemy. | def _getViews(self): """ Returns all views. | def _registerViews(self): """ Registers all views and makes them accessible through the same methods as tables in SQLAlchemy. |
@return: List of registered views | @return: list of views | def _registerViews(self): """ Registers all views and makes them accessible through the same methods as tables in SQLAlchemy. |
@todo Impl: registering for all attached databases """ | """ schemas = [self._mainSchema] + self.attached.values() | def _registerViews(self): """ Registers all views and makes them accessible through the same methods as tables in SQLAlchemy. |
dbName = self.engine.url.database viewList = self.execute( text("SELECT table_name FROM Information_schema.views" " WHERE table_schema = :dbName"), dbName=dbName).fetchall() | views = [] for schema in schemas: viewList = self.execute( text("SELECT table_name FROM Information_schema.views" " WHERE table_schema = :schema"), schema=schema).fetchall() views.extend([view for view, in viewList if view not in views]) | def _registerViews(self): """ Registers all views and makes them accessible through the same methods as tables in SQLAlchemy. |
viewList = self.execute( text("SELECT name FROM sqlite_master WHERE type IN ('view')"))\ .fetchall() | views = [] identifier_preparer = self.engine.dialect.identifier_preparer for schema in schemas: qschema = identifier_preparer.quote_identifier(schema) s = ("SELECT name FROM %s.sqlite_master " "WHERE type='view' ORDER BY name") % qschema viewList = self.execute(text(s)).fetchall() views.extend([view for view, in viewL... | def _registerViews(self): """ Registers all views and makes them accessible through the same methods as tables in SQLAlchemy. |
return for viewName, in viewList: Table(viewName, self.metadata, autoload=True) return [viewName for viewName, in viewList] | return [] return views | def _registerViews(self): """ Registers all views and makes them accessible through the same methods as tables in SQLAlchemy. |
tables = set(self._registerViews()) | tables = set(self._getViews()) | def getTableNames(self): """ Gets the unique list of names of all tables (and views) from the databases. |
if {} not in optionSets: optionSets.append({}) | def testBuild(self): """Test if build finishes successfully.""" optionSets = self.OPTIONS[:] if {} not in optionSets: optionSets.append({}) for databasePath in self.dbInstances: for options in optionSets: myOptions = options.copy() if 'dataPath' not in myOptions: myOptions['dataPath'] = self.dataPath assert('quiet' not... | |
OPTIONS = [{'wideBuild': True}, {'slimUnihanTable': True}] | OPTIONS = [{'wideBuild': False}, {'wideBuild': True}, {'slimUnihanTable': True}] | def removeMySQL(databaseUrls): return [url for url in databaseUrls if not url.startswith('mysql://')] |
OPTIONS = [{'slimUnihanTable': True}] | OPTIONS = [{'wideBuild': False, 'slimUnihanTable': True}] | def filterMySQL(databaseUrls): return [url for url in databaseUrls if url.startswith('mysql://')] |
OPTIONS = [{'wideBuild': True}] | OPTIONS = [{'wideBuild': False}, {'wideBuild': True}] | def removeMySQL(databaseUrls): return [url for url in databaseUrls if not url.startswith('mysql://')] |
OPTIONS = [] | OPTIONS = [{'wideBuild': False}] | def filterMySQL(databaseUrls): return [url for url in databaseUrls if url.startswith('mysql://')] |
OPTIONS = [] | OPTIONS = [{'wideBuild': False}] TABLE_DEPEND_OPTIONS = [(builder.UnihanBuilder, {'wideBuild': False})] | def filterMySQL(databaseUrls): return [url for url in databaseUrls if url.startswith('mysql://')] |
for table in self.db.tables: | for table in self.db.getTableNames(): | def getAvailableCharacterDomains(self): """ Gets a list of all available I{character domains}. By default available is domain C{Unicode}, which represents all Chinese characters encoded in Unicode. Further domains can be given to the database as tables ending in C{...Set} including a column C{ChineseCharacter}, e.g. C{... |
ACTIONS = Option.ACTIONS + ("extendResetDefault",) STORE_ACTIONS = Option.STORE_ACTIONS + ("extendResetDefault",) TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extendResetDefault",) ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extendResetDefault",) | ACTIONS = Option.ACTIONS + ("extendResetDefault", "appendResetDefault") STORE_ACTIONS = Option.STORE_ACTIONS + ("extendResetDefault", "appendResetDefault") TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extendResetDefault", "appendResetDefault") ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extendResetDefault", "app... | def check_pathstring(option, opt, value): return value.split(':') |
options['prefer'] = cls.DB_PREFER_BUILDERS | options['prefer'] = cls.DB_PREFER_BUILDERS[:] | def getDefaultOptions(cls): """ Gets default options that always overwrite those specified in the build module. Boolean options of the L{DatabaseBuilder} can not be changed here as they are hardcoded in the given command line options. """ options = {} # dataPath options['dataPath'] = ['.', getDataPath()] # prefer optio... |
parser.add_option("-p", "--prefer", action="append", metavar="BUILDER", dest="prefer", default=defaults.get("prefer", []), | parser.add_option("-p", "--prefer", action="appendResetDefault", metavar="BUILDER", dest="prefer", default=defaults.get("prefer", []), | def buildParser(self): usage = "%prog [options] [build | list]" description = self.DESCRIPTION version = """%%prog %s |
os.path.join(homeDir, '%s.conf' % projectName), | def getConfigSettings(section, projectName='cjklib'): """ Reads the configuration from the given section of the project's config file. @type section: str @param section: section of the config file @type projectName: str @param projectName: name of project which will be used as name of the config file @rtype: dict @ret... | |
warnings.warn_explicit( "Call to deprecated function %(funcname)s." % { 'funcname': func.__name__, }, category=DeprecationWarning, filename=func.func_code.co_filename, lineno=func.func_code.co_firstlineno + 1 ) | warnings.warn("Call to deprecated function %s." % func.__name__, category=DeprecationWarning, stacklevel=2) | def new_func(*args, **kwargs): warnings.warn_explicit( "Call to deprecated function %(funcname)s." % { 'funcname': func.__name__, }, category=DeprecationWarning, filename=func.func_code.co_filename, lineno=func.func_code.co_firstlineno + 1 ) return func(*args, **kwargs) |
category=DeprecationWarning) | category=DeprecationWarning, stacklevel=2) | def new_func(*args, **kwargs): warnings.warn("Call to deprecated function %s." % func.__name__, category=DeprecationWarning) return func(*args, **kwargs) |
return cls._characterLookup().getDomainCharacterIterator() | hanScriptIterator = cjk.getDomainCharacterIterator() return itertools.ifilter(lambda x: unicodedata.normalize('NFD', x) == x, hanScriptIterator) | def titleIterator(cls): return cls._characterLookup().getDomainCharacterIterator() |
templateClass = classes[template] | try: templateClass = classes[template] except KeyError: print >> sys.stderr, "Unknown template %r" % template sys.exit(1) | def main(): importModule = __import__("importcjklib") classes = dict((clss.TEMPLATE.lower(), clss) for clss in importModule.__dict__.values() if (type(clss) == types.TypeType and issubclass(clss, importModule.ImporterBase) and clss.TEMPLATE)) if len(sys.argv) < 2: print """usage: python importcjklib.py TEMPLATE [TITLE... |
options['dataPath'] \ = resource_filename(Requirement.parse("cjklib"), "cjklib/data") | options['dataPath'] = [resource_filename( Requirement.parse("cjklib"), "cjklib/data")] | def __init__(self, **options): """ Constructs the DatabaseBuilder. |
self._instancesUnrequestedTable.remove(instance) | def clearTemporary(self): """ Removes all tables only built temporarily as to satisfy build dependencies. This method is called before L{build()} terminates. If the build process is interruptes (e.g. by the user pressing Ctrl+C), this method should be called as to make sure that these temporary tables are removed and n... | |
def __init__(self, plainEntity): | def __init__(self, plainEntity, escape): | def __init__(self, plainEntity): self._plainEntity = plainEntity |
return _escapeWildcards(self._plainEntity) + '_' | return _escapeWildcards(self._plainEntity, self._escape) + '_' | def getSQL(self): return _escapeWildcards(self._plainEntity) + '_' |
entity = self.TonalEntityWildcard(plainEntity) | entity = self._createTonalEntityWildcard( plainEntity) | def _getWildcardForms(self, searchStr, **options): if self._getWildcardFormsOptions != (searchStr, options): decompEntities = self._getPlainForms(searchStr, **options) |
""" | u""" | def _getSimpleMatchFunction(self, searchStr, **options): simpleForms = self._getWildcardForms(searchStr, **options) return lambda reading: self._getReadingEntities(reading) in simpleForms |
and hasattr(self.readingOperatorClass, "splitEntityTone")): | and hasattr(self.readingOperatorClass, "splitEntityTone") and hasattr(self.readingOperatorClass, "getReadingEntities")): | def testGetTonalEntityOfSplitEntityToneIsIdentity(self): """ Test if the composition of C{getTonalEntity()} and C{splitEntityTone()} returns the original value for all entities returned by C{getReadingEntities()}. """ if not (hasattr(self.readingOperatorClass, "getTonalEntity") and hasattr(self.readingOperatorClass, "s... |
if mixedClause: | if mixedClause is not None: | def _getReadingSearch(self, readingStr, **options): dictionaryTable = self.db.tables[self.DICTIONARY_TABLE] |
if mixedClauseS: mixedClauses.append(mixedClauseS) | if mixedClauseS is not None: mixedClauses.append(mixedClauseS) | def _getReadingSearch(self, readingStr, **options): dictionaryTable = self.db.tables[self.DICTIONARY_TABLE] |
if mixedClauseT: mixedClauses.append(mixedClauseT) | if mixedClauseT is not None: mixedClauses.append(mixedClauseT) | def _getReadingSearch(self, readingStr, **options): dictionaryTable = self.db.tables[self.DICTIONARY_TABLE] |
if self.engine.has_table(tableName, schema=self._mainSchema): | def has_table(tableName, schema): identifier_preparer = self.engine.dialect.identifier_preparer qschema = identifier_preparer.quote_identifier(schema) tableNames = self.selectScalars( text("SELECT name FROM %s.sqlite_master" % qschema)) return tableName in tableNames import sys if sys.platform == 'win32' and self.eng... | def _findTable(self, tableName): """ Gets the schema (database name) of the database that offers the given table. |
if self.engine.has_table(tableName, schema=schema): | if hasTable(tableName, schema=schema): | def _findTable(self, tableName): """ Gets the schema (database name) of the database that offers the given table. |
if line[1:8] == 'Energy=': if not hasattr(self, "scfenergies"): self.scfenergies = [] self.scfenergies.append(utils.convertor(self.float(line.split()[1]), "hartree", "eV")) | def extract(self, inputfile, line): """Extract information from the file object inputfile.""" # Number of atoms. if line[1:8] == "NAtoms=": | |
self.homos.resize([2]) self.homos[1] = i-1 | if (hasattr(self, "homos")): self.homos.resize([2]) self.homos[1] = i-1 else: self.homos = numpy.array([i-1], "i") | def extract(self, inputfile, line): """Extract information from the file object inputfile.""" # Number of atoms. if line[1:8] == "NAtoms=": |
parts = line.split() | def extract(self, inputfile, line): """Extract information from the file object inputfile.""" | |
irIntensity = map(float, line.strip().split()[2:]) self.vibirs.extend([utils.convertor(x, "Debye^2/amu-Angstrom^2", "km/mol") for x in irIntensity]) line = inputfile.next() | if line.find("IR INTENSITY") >= 0: irIntensity = map(float, line.strip().split()[2:]) self.vibirs.extend([utils.convertor(x, "Debye^2/amu-Angstrom^2", "km/mol") for x in irIntensity]) line = inputfile.next() | def extract(self, inputfile, line): """Extract information from the file object inputfile.""" |
n,nuclear,Fx,Fy,Fz = line.split() | broken = line.split() Fx, Fy, Fz = broken[-3:] | def extract(self, inputfile, line): """Extract information from the file object inputfile.""" # Number of atoms. if line[1:8] == "NAtoms=": |
@cart_mass.setter | @pendulum_mass.setter | def pendulum_mass(self): """ Get mass of the pendulum """ return stw.invertedPendulumGetPendulumMass(self.object) |
@cart_length.setter | @pendulum_length.setter | def pendulum_length(self): """ Get length of the pendulum """ return stw.invertedPendulumGetPendulumLength(self.object) |
print ("stringValue = %s" % stringValue) | def state(self, value): """ Set the value of the state signal from a given input vector """ if len(value) is not 4: raise RuntimeError("Size of state should be 4.") | |
def parseExpedLists(site): | def getPersonList(site): | def parseExpedLists(site): page = wikipedia.Page(site, u"User:AperfectBot/User_expedition_lists") people_hash = getSections(page.get()) formats = [ (Expedition.RE_DATE, re.escape(Expedition.date_comment) + ".*?" + re.escape(Expedition.date_comment)), (Expedition.RE_GRATADD, re.escape(Expedi... |
return people_hash def getExpeditions(site, person, person_entry): | def parseExpedLists(site): page = wikipedia.Page(site, u"User:AperfectBot/User_expedition_lists") people_hash = getSections(page.get()) formats = [ (Expedition.RE_DATE, re.escape(Expedition.date_comment) + ".*?" + re.escape(Expedition.date_comment)), (Expedition.RE_GRATADD, re.escape(Expedi... | |
text_arr = re.split('\n', people_hash[person]) page = wikipedia.Page(site, text_arr[0]) if(page.exists()): page_text = page.get() else: page_text = u"" exp_list_text_match = RE_EXPLIST_COMMENT.search(page_text) if(exp_list_text_match != None): exp_list_text = exp_list_text_match.group(1) else: exp_list_text = u"" for... | expedListPeople[person] = getExpeditions(site, person, people_hash[person]) | def parseExpedLists(site): page = wikipedia.Page(site, u"User:AperfectBot/User_expedition_lists") people_hash = getSections(page.get()) formats = [ (Expedition.RE_DATE, re.escape(Expedition.date_comment) + ".*?" + re.escape(Expedition.date_comment)), (Expedition.RE_GRATADD, re.escape(Expedi... |
def writeExpedLists(site, expedListPeople): for person in expedListPeople.keys(): | def updateUserTexts(site): global expedListPeople re_text = Expedition.RE_USERTEXT.pattern + ".*?" + Expedition.RE_USERTEXT.pattern RE_USERTEXT_COMMENT = re.compile(re_text, re.DOTALL) people_hash = getPersonList(site) for person in people_hash.keys(): | def writeExpedLists(site, expedListPeople): for person in expedListPeople.keys(): if(len(person) > 0): page = wikipedia.Page(site, expedListPeople[person][2]) if(not page.exists()): page_text = u"<!--EXPLIST-->" + u"\n<!--EXPLIST-->" page = wikipedia.Page(site, expedListPeople[person][2]) page_write(page, page_text, si... |
page = wikipedia.Page(site, expedListPeople[person][2]) if(not page.exists()): page_text = u"<!--EXPLIST-->" + u"\n<!--EXPLIST-->" page = wikipedia.Page(site, expedListPeople[person][2]) page_write(page, page_text, site) else: page_text = page.get() userExpeds = u"<!--EXPLIST-->" ExpedDates = expedListPeople[person][1]... | personExpeds = getExpeditions(site, person, people_hash[person]) for date in personExpeds[1].keys(): matchObj = RE_USERTEXT_COMMENT.search(personExpeds[1][date]) if(matchObj != None): expedListPeople[person][1][date] = RE_USERTEXT_COMMENT.sub(matchObj.group(0),expedListPeople[person][1][date]) writeExpedListPerson(site... | def writeExpedLists(site, expedListPeople): for person in expedListPeople.keys(): if(len(person) > 0): page = wikipedia.Page(site, expedListPeople[person][2]) if(not page.exists()): page_text = u"<!--EXPLIST-->" + u"\n<!--EXPLIST-->" page = wikipedia.Page(site, expedListPeople[person][2]) page_write(page, page_text, si... |
writeExpedLists(enwiktsite, expedListPeople) | updateUserTexts(enwiktsite) | def main(): global expedListPeople |
query = reference.getObject().buildQuery() | query = references.getObject().buildQuery() | def _data(self): limit = self.data.count |
else: return '%s/recently_modified_view' % self.context.absolute_url() | def more_link(self): references = self.context.portal_catalog({ 'path' : { 'query' : self.portal_path + str(self.data.section), 'depth' : 0, } }) if references: if self.context.portal_type == "Topic": references[0].getURL() else: return '%s/recently_modified_view' % references[0].getURL() | |
brains = self.catalog(path={'query' : self.portal_path + self.data.section, 'depth' : 0}) | brains = self.catalog(path={'query' : self.portal_path + str(self.data.section), 'depth' : 0}) | def title(self): brains = self.catalog(path={'query' : self.portal_path + self.data.section, 'depth' : 0}) if len(brains) == 1: section_title = brains[0].Title.decode('utf-8') else: section_title = self.portal.Title().decode('utf-8') return _(u"recent_changes_in", default=u"Recent Changes in ${section}", mapping={u"sec... |
reference = self.context.portal_catalog({ 'path' : { 'query' : self.portal_path + str(self.data.section), 'depth' : 0, } })[0] | def _data(self): limit = self.data.count reference = self.context.portal_catalog({ 'path' : { 'query' : self.portal_path + str(self.data.section), 'depth' : 0, } })[0] | |
if reference.portal_type == "Topic": | references = self.context.portal_catalog({ 'path' : { 'query' : self.portal_path + str(self.data.section), 'depth' : 0, } }) if references and len(references)>0 and references[0].portal_type == "Topic": | def _data(self): limit = self.data.count reference = self.context.portal_catalog({ 'path' : { 'query' : self.portal_path + str(self.data.section), 'depth' : 0, } })[0] |
query = references.getObject().buildQuery() | query = references[0].getObject().buildQuery() | def _data(self): limit = self.data.count |
"""Objects that can be consisdered as a source of documentation. | """Objects that can be considered as a source of documentation. | def docsources(self): """Objects that can be consisdered as a source of documentation. |
args = list(args) + options.modules + options.packages | def main(args): import cPickle options, args = parse_args(args) args = list(args) + options.modules + options.packages exitcode = 0 if options.configfile: readConfigFile(options) try: # step 1: make/find the system if options.systemclass: systemclass = findClassFromDottedName(options.systemclass, '--system-class') ... | |
for b, attrs in self.baselists[1:]] | for b, attrs in baselists] | def baseTables(self, item): return [fillSlots(item, baseName=self.baseName(b), baseTable=ChildTable(self.docgetter, self.ob, self.has_lineno_col(), sorted(attrs, key=lambda o:-o.privacyClass))) for b, attrs in self.baselists[1:]] |
def mediumName(obj): fn = obj.fullName() if '.' not in fn: return fn path, name = fn.rsplit('.', 1) def process(part): return obj.system.abbrevmapping.get(part, part[0]) return '.'.join([process(p) for p in path.split('.')]) + '.' + name | def mediumName(obj): fn = obj.fullName() if '.' not in fn: return fn path, name = fn.rsplit('.', 1) def process(part): return obj.system.abbrevmapping.get(part, part[0]) return '.'.join([process(p) for p in path.split('.')]) + '.' + name | |
self.ob.kind + " " + mediumName(self.ob)] | self.mediumName(self.ob), " : ", self.ob.kind.lower(), " documentation"] | def heading(self): return tags.h1(class_=self.ob.css_class)[ self.ob.kind + " " + mediumName(self.ob)] |
def heading(self): tag = super(ClassPage, self).heading() | def mediumName(self, ob): r = [super(ClassPage, self).mediumName(ob)] | def heading(self): tag = super(ClassPage, self).heading() zipped = zip(self.ob.rawbases, self.ob.bases, self.ob.baseobjects) if zipped: tag['('] for i, (n, m, o) in enumerate(zipped): if o is None: tag[tags.span(title=m)[n]] else: tag[taglink(o, n)] if i != len(zipped)-1: tag[', '] tag[')'] tag[':'] return tag |
tag['('] | r.append('(') | def heading(self): tag = super(ClassPage, self).heading() zipped = zip(self.ob.rawbases, self.ob.bases, self.ob.baseobjects) if zipped: tag['('] for i, (n, m, o) in enumerate(zipped): if o is None: tag[tags.span(title=m)[n]] else: tag[taglink(o, n)] if i != len(zipped)-1: tag[', '] tag[')'] tag[':'] return tag |
tag[tags.span(title=m)[n]] | r.append(tags.span(title=m)[n]) | def heading(self): tag = super(ClassPage, self).heading() zipped = zip(self.ob.rawbases, self.ob.bases, self.ob.baseobjects) if zipped: tag['('] for i, (n, m, o) in enumerate(zipped): if o is None: tag[tags.span(title=m)[n]] else: tag[taglink(o, n)] if i != len(zipped)-1: tag[', '] tag[')'] tag[':'] return tag |
tag[taglink(o, n)] | r.append(taglink(o, n)) | def heading(self): tag = super(ClassPage, self).heading() zipped = zip(self.ob.rawbases, self.ob.bases, self.ob.baseobjects) if zipped: tag['('] for i, (n, m, o) in enumerate(zipped): if o is None: tag[tags.span(title=m)[n]] else: tag[taglink(o, n)] if i != len(zipped)-1: tag[', '] tag[')'] tag[':'] return tag |
tag[', '] tag[')'] tag[':'] return tag | r.append(', ') r.append(')') return r | def heading(self): tag = super(ClassPage, self).heading() zipped = zip(self.ob.rawbases, self.ob.bases, self.ob.baseobjects) if zipped: tag['('] for i, (n, m, o) in enumerate(zipped): if o is None: tag[tags.span(title=m)[n]] else: tag[taglink(o, n)] if i != len(zipped)-1: tag[', '] tag[')'] tag[':'] return tag |
return self.registry.services[self.url_path].service_class | return self.registry.services[self.url_path].service_factory | def service_class(self): return self.registry.services[self.url_path].service_class |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.