rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
return self.fs.build_dir_target_climb(self, [])
return self.fs.build_dir_target_climb(self, self, [])
def alter_targets(self): """Return any corresponding targets in a build directory. """ return self.fs.build_dir_target_climb(self, [])
return self.fs.build_dir_target_climb(self.dir, [self.name])
return self.fs.build_dir_target_climb(self, self.dir, [self.name])
def alter_targets(self): """Return any corresponding targets in a build directory. """ if self.is_derived(): return [], None return self.fs.build_dir_target_climb(self.dir, [self.name])
env.Cat('bbb.out', 'sub/bbb.in')
bbb_in = File('sub/bbb.in') bbb_in.is_pseudo_derived() env.Cat('bbb.out', bbb_in)
def sc_cat(env, source, target): source = [] for t in target: head, tail = os.path.split(str(t)) source.append(os.path.join(head, 'sc-' + tail)) cat(env, source, target)
env.SourceCode('$SUBDIR', Builder(action=sc_cat, env=env))
def sc_cat(env, source, target): source = [] for t in target: head, tail = os.path.split(str(t)) source.append(os.path.join(head, 'sc-' + tail)) cat(env, source, target)
if value == "pdb": if os.name == 'java': python = os.path.join(sys.prefix, 'jython') else: python = sys.executable args = [ python, "pdb.py" ] + \ filter(lambda x: x != "--debug=pdb", sys.argv) if sys.platform == 'win32': args[1] = os.path.join(sys.prefix, "lib", "pdb.py") sys.exit(os.spawnve(os.P_WAIT, args[0], args, ...
if value in ["pdb","tree", "dtree", "time", "includes"]:
def opt_debug(option, opt, value, parser): if value == "pdb": if os.name == 'java': python = os.path.join(sys.prefix, 'jython') else: python = sys.executable args = [ python, "pdb.py" ] + \ filter(lambda x: x != "--debug=pdb", sys.argv) if sys.platform == 'win32': args[1] = os.path.join(sys.prefix, "lib", "pdb.py") sys...
def _main():
def _main(args):
def _main(): targets = [] # Enable deprecated warnings by default. SCons.Warnings._warningOut = _scons_internal_warning SCons.Warnings.enableWarningClass(SCons.Warnings.DeprecatedWarning) SCons.Warnings.enableWarningClass(SCons.Warnings.CorruptSConsignWarning) all_args = sys.argv[1:] try: all_args = string.split(os.e...
all_args = sys.argv[1:] try: all_args = string.split(os.environ['SCONSFLAGS']) + all_args except KeyError: pass parser = OptParser() global options, ssoptions options, args = parser.parse_args(all_args)
global ssoptions
def _main(): targets = [] # Enable deprecated warnings by default. SCons.Warnings._warningOut = _scons_internal_warning SCons.Warnings.enableWarningClass(SCons.Warnings.DeprecatedWarning) SCons.Warnings.enableWarningClass(SCons.Warnings.CorruptSConsignWarning) all_args = sys.argv[1:] try: all_args = string.split(os.e...
cmd = SCons.Util.CLVar('$SHLINK', '$SHLINKFLAGS')
cmd = SCons.Util.CLVar(['$SHLINK', '$SHLINKFLAGS'])
def shlib_generator(target, source, env, for_signature): cmd = SCons.Util.CLVar('$SHLINK', '$SHLINKFLAGS') dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') if dll: cmd.extend(['-o', dll]) cmd.extend(['$SOURCES', '$_LIBDIRFLAGS', '$_LIBFLAGS']) implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') if implib...
raise SCons.Errors.UserError, "Export of non-existant variable '%s'"%x
raise SCons.Errors.UserError, "Export of non-existent variable '%s'"%x
def compute_exports(exports): """Compute a dictionary of exports given one of the parameters to the Export() function or the exports argument to SConscript().""" loc, glob = get_calling_namespaces() retval = {} try: for export in exports: if SCons.Util.is_Dict(export): retval.update(export) else: try: retval[export] ...
raise SCons.Errors.UserError, "Return of non-existant variable '%s'"%x
raise SCons.Errors.UserError, "Return of non-existent variable '%s'"%x
def Return(*vars): retval = [] try: for var in vars: for v in string.split(var): retval.append(stack[-1].globals[v]) except KeyError, x: raise SCons.Errors.UserError, "Return of non-existant variable '%s'"%x if len(retval) == 1: stack[-1].retval = retval[0] else: stack[-1].retval = tuple(retval)
raise SCons.Errors.UserError, "Import of non-existant variable '%s'"%x
raise SCons.Errors.UserError, "Import of non-existent variable '%s'"%x
def Import(self, *vars): try: for var in vars: var = self.Split(var) for v in var: if v == '*': stack[-1].globals.update(global_exports) stack[-1].globals.update(stack[-1].exports) else: if stack[-1].exports.has_key(v): stack[-1].globals[v] = stack[-1].exports[v] else: stack[-1].globals[v] = global_exports[v] except Ke...
regex = '\\\\(include|input){([^}]*)}',
regex = '\\\\(?:include|input){([^}]*)}',
def LaTeXScanner(fs = SCons.Node.FS.default_fs): """Return a prototype Scanner instance for scanning LaTeX source files""" ds = LaTeX(name = "LaTeXScanner", suffixes = '$LATEXSUFFIXES', path_variable = 'TEXINPUTS', regex = '\\\\(include|input){([^}]*)}', recursive = 0) return ds
Mylib.Subdirs("src")
Mylib.Subdirs(env, "src")
def MyCScan(node, env, target): deps = c_scanner(node, env, target) global Scanned n = str(node) try: Scanned[n] = Scanned[n] + 1 except KeyError: Scanned[n] = 1 write_out('MyCScan.out', Scanned) return deps
def Subdirs(dirlist):
def Subdirs(env, dirlist):
def Subdirs(dirlist): for file in _subconf_list(dirlist): SCons.Script.SConscript.SConscript(file, "env")
Mylib.Subdirs("lib_geng")
Mylib.Subdirs(env, "lib_geng")
def AddLibDirs(env, str): env.Append(LIBPATH = string.split(str))
def get_scons_prefix(libdir):
def get_scons_prefix(libdir, is_win32):
def get_scons_prefix(libdir): """ Return the right prefix for SCons library installation. Find this by starting with the library installation directory (.../site-packages, most likely) and crawling back up until we reach a directory name beginning with "python" (or "Python"). """ drive, head = os.path.splitdrive(libdi...
if sys.platform == "win32":
if is_win32:
def get_scons_prefix(libdir): """ Return the right prefix for SCons library installation. Find this by starting with the library installation directory (.../site-packages, most likely) and crawling back up until we reach a directory name beginning with "python" (or "Python"). """ drive, head = os.path.splitdrive(libdi...
if not set_explicitly("lib", self.distribution.script_args):
args = self.distribution.script_args if not set_explicitly("lib", args):
def finalize_options(self): _install_lib.finalize_options(self) if not set_explicitly("lib", self.distribution.script_args): # They didn't explicitly specify the installation # directory for libraries... prefix = get_scons_prefix(self.install_dir) standard_dir = os.path.join(self.install_dir, "SCons") version_dir = os....
prefix = get_scons_prefix(self.install_dir)
is_win32 = sys.platform == "win32" or args[0] == 'bdist_wininst' prefix = get_scons_prefix(self.install_dir, is_win32)
def finalize_options(self): _install_lib.finalize_options(self) if not set_explicitly("lib", self.distribution.script_args): # They didn't explicitly specify the installation # directory for libraries... prefix = get_scons_prefix(self.install_dir) standard_dir = os.path.join(self.install_dir, "SCons") version_dir = os....
return self.string
return self._strfunc
def strfunction(self): try: return self.string except AttributeError: action = self.action build_env = self.get_build_env() if action.strfunction is None: # This instance has strfunction set to None to suppress # printing of the action. Call the method directly # through the class instead. self._strfunc = action.__cla...
if all:
if printcmd:
def rep(e): if len(e) == 1: e = '0' + e return e
except LookupError:
lines = map(lambda l, e=encoder: e(l)[0], f.readlines()) except (LookupError, UnicodeError):
def _parse_msvc7_overrides(version): """ Parse any overridden defaults for MSVS directory locations in MSVS .NET. """ # First, we get the shell folder for this user: if not SCons.Util.can_read_reg: raise SCons.Errors.InternalError, "No Windows registry module was found" comps = "" try: (comps, t) = SCons.Util.RegGetV...
else: lines = map(lambda l, e=encoder: e(l)[0], f.readlines())
def _parse_msvc7_overrides(version): """ Parse any overridden defaults for MSVS directory locations in MSVS .NET. """ # First, we get the shell folder for this user: if not SCons.Util.can_read_reg: raise SCons.Errors.InternalError, "No Windows registry module was found" comps = "" try: (comps, t) = SCons.Util.RegGetV...
if sys.argv[1] == "bdist_wininst": arguments['data_files'] = [('.', ["script/scons.bat"])]
try: if sys.argv[1] == "bdist_wininst": arguments['data_files'] = [('.', ["script/scons.bat"])] except IndexError: pass
def finalize_options(self): install_lib.finalize_options(self)
assert bdt == ['build/var1/file11', 'build/var2/file11'], bdt
var1_file11 = os.path.normpath('build/var1/file11') var2_file11 = os.path.normpath('build/var2/file11') assert bdt == [var1_file11, var2_file11], bdt
def runTest(self): """Test build dir functionality""" test=TestCmd(workdir='')
assert bdt == ['build/var1/new_dir', 'build/var2/new_dir'], bdt
var1_new_dir = os.path.normpath('build/var1/new_dir') var2_new_dir = os.path.normpath('build/var2/new_dir') assert bdt == [var1_new_dir, var2_new_dir], bdt
def runTest(self): """Test build dir functionality""" test=TestCmd(workdir='')
def tasks_where_serial(self):
def tasks_were_serial(self):
def tasks_where_serial(self): "analyze the task order to see if they were serial" serial = 1 # assume the tasks where serial for i in range(num_tasks): serial = serial and (self.begin_list[i] == self.end_list[i] == (i + 1)) return serial
self.failUnless(not taskmaster.tasks_where_serial(), "the tasks where not executed in parallel")
self.failUnless(not taskmaster.tasks_were_serial(), "the tasks were not executed in parallel")
def runTest(self): "test parallel jobs" try: import threading except: raise NoThreadsException()
"all the tests where not executed")
"all the tests were not executed")
def runTest(self): "test parallel jobs" try: import threading except: raise NoThreadsException()
"all the tests where not iterated over")
"all the tests were not iterated over")
def runTest(self): "test parallel jobs" try: import threading except: raise NoThreadsException()
self.failUnless(taskmaster.tasks_where_serial(), "the tasks where not executed in series")
self.failUnless(taskmaster.tasks_were_serial(), "the tasks were not executed in series")
def runTest(self): "test a serial job"
"all the tests where not executed")
"all the tests were not executed")
def runTest(self): "test a serial job"
"all the tests where not iterated over")
"all the tests were not iterated over")
def runTest(self): "test a serial job"
k = SCons.Util.RegOpenKeyEx(root, keyp) return SCons.Util.RegQueryValueEx(k,val)
k = RegOpenKeyEx(root, keyp) return RegQueryValueEx(k,val)
def RegGetValue(root, key): """This utility function returns a value in the registry without having to open the key first. Only available on Windows platforms with a version of Python that can read the registry. Returns the same thing as SCons.Util.RegQueryValueEx, except you just specify the entire path to the value...
line = " re.sub('[^A-Za-z0-9_]', '_', str(have)))
line = "
line = "/* #undef %s */\n" % key_up
"""check if diffpy has __init__.py and create one if not
"""check if diffpy/__init__.py exists and create one if not
def check_diffpy__init__(distribution): """check if diffpy has __init__.py and create one if not """ from distutils import log install_lib = None if 'install' in distribution.commands: opts = distribution.get_option_dict('install') install_lib = opts.get('install_lib', 2*[None])[1] if 'install_lib' in distribution.comm...
install_lib = None if 'install' in distribution.commands: opts = distribution.get_option_dict('install') install_lib = opts.get('install_lib', 2*[None])[1] if 'install_lib' in distribution.commands and not install_lib: opts = distribution.get_option_dict('install_lib') install_lib = opts.get('install_dir', 2*[None])[1]...
if distribution.dry_run: return if 'install_lib' not in distribution.command_obj: return lib_install_dir = distribution.get_command_obj('install_lib').install_dir initfile = os.path.join(lib_install_dir, 'diffpy', '__init__.py')
def check_diffpy__init__(distribution): """check if diffpy has __init__.py and create one if not """ from distutils import log install_lib = None if 'install' in distribution.commands: opts = distribution.get_option_dict('install') install_lib = opts.get('install_lib', 2*[None])[1] if 'install_lib' in distribution.comm...
rc += self.handle_inline( node )
inline = self.handle_inline( node ) rc += inline.getText()
def getText(self, node): rc = "" for node in node.childNodes: if node.nodeType == node.TEXT_NODE: rc += node.data elif node.nodeName == 'fo:inline': rc += self.handle_inline( node ) elif node.nodeName == 'fo:page-number': rc += "#1" elif node.nodeName == 'fo:marker': pass # text = self.getText( node ) # print "fo:marke...
attrs = dict( i.attributes.items() )
attrs = Attrs( i )
def handle_layout_master_set(self, set): for i in set.getElementsByTagName("fo:simple-page-master"): attrs = dict( i.attributes.items() ) self.fo_simple_page_master( attrs ) ## print "###", attrs['master-name'] # Get values for various page regions for region in i.childNodes: if region.nodeType == region.TEXT_NODE: co...
attrs = dict( h.attributes.items() )
attrs = Attrs( h )
def handle_layout_master_set(self, set): for i in set.getElementsByTagName("fo:simple-page-master"): attrs = dict( i.attributes.items() ) self.fo_simple_page_master( attrs ) ## print "###", attrs['master-name'] # Get values for various page regions for region in i.childNodes: if region.nodeType == region.TEXT_NODE: co...
attrs = dict( seq.attributes.items() )
attrs = Attrs( seq )
def handle_page_sequence(self, seq ): attrs = dict( seq.attributes.items() ) ## print "Page Sequence - Ref:", attrs['master-reference'] page_sequence = attrs['master-reference'] self.fo_page_sequence( page_sequence ) for c in seq.childNodes: if c.nodeName[:3] != 'fo:': continue ## print c.nodeName if c.nodeName == '...
attrs = dict( static.attributes.items() )
attrs = Attrs( static )
def handle_static_content(self, static, page_sequence): attrs = dict( static.attributes.items() ) region = attrs['flow-name'] # print "Static Content: ==> ", region blocks = static.getElementsByTagName("fo:block") ##for i in blocks: ## print i.nodeName, ' - ' ,self.getText( i ) self.handle_blocks( blocks, page_sequence...
print "Static Content: ==> ", region, " page_sequence:", page_sequence
def handle_static_content(self, static, page_sequence): attrs = dict( static.attributes.items() ) region = attrs['flow-name'] # print "Static Content: ==> ", region blocks = static.getElementsByTagName("fo:block") ##for i in blocks: ## print i.nodeName, ' - ' ,self.getText( i ) self.handle_blocks( blocks, page_sequence...
attrs = dict( flow.attributes.items() )
attrs = Attrs( flow )
def handle_flow(self, flow, page_sequence): attrs = dict( flow.attributes.items() ) region = attrs['flow-name'] print "Flow: ==> ", region blocks = flow.getElementsByTagName("fo:block") self.handle_blocks( blocks, page_sequence, region )
attrs = dict( block.attributes.items() )
attrs = Attrs( block )
def handle_block(self, block, page_sequence, region ): # print "fo:block" attrs = dict( block.attributes.items() ) # print "TEXT:", getText( block ) self.fo_block( self.getText(block), attrs, page_sequence, region ) # for b in block.getElementsByTagName('fo:block'): # self.handle_block( b )
print "fo:inline" attrs = dict( inline.attributes.items() ) print attrs return "<i>%s</i>" % unicode( self.getText( inline ) )
return Inline( inline )
def handle_inline(self, inline ): print "fo:inline" attrs = dict( inline.attributes.items() ) print attrs return "<i>%s</i>" % unicode( self.getText( inline ) )
print "\nAdded Inline Formatting:" print self.prefix + self.getText() + self.suffix + "\n\n"
def __init__(self, node): Properties.__init__(self) self.node = node self.attrs = Attrs( node ) self.common_fonts( self.attrs ) self.common_borders( self.attrs ) self.common_align( self.attrs ) self.common_text( self.attrs ) self.prefix = '' self.suffix = '' p = self.properties font = {} if 'font-family' in self.at...
s = ''
self.text = ''
def getText(self): s = '' for n in self.node.childNodes: if n.nodeType == n.TEXT_NODE: s += n.data elif n.nodeName == 'fo:inline': i = Inline( n ) s += i.getText() elif n.nodeName == 'fo:page-number': s += "#1#"
s += n.data
self.text += n.data
def getText(self): s = '' for n in self.node.childNodes: if n.nodeType == n.TEXT_NODE: s += n.data elif n.nodeName == 'fo:inline': i = Inline( n ) s += i.getText() elif n.nodeName == 'fo:page-number': s += "#1#"
s += i.getText()
self.text += i.getText()
def getText(self): s = '' for n in self.node.childNodes: if n.nodeType == n.TEXT_NODE: s += n.data elif n.nodeName == 'fo:inline': i = Inline( n ) s += i.getText() elif n.nodeName == 'fo:page-number': s += "#1#"
s += "
self.text += "
def getText(self): s = '' for n in self.node.childNodes: if n.nodeType == n.TEXT_NODE: s += n.data elif n.nodeName == 'fo:inline': i = Inline( n ) s += i.getText() elif n.nodeName == 'fo:page-number': s += "#1#"
return unicode( s )
self.text = self.prefix + self.text + self.suffix return unicode( trim_spaces( self.text ) )
def getText(self): s = '' for n in self.node.childNodes: if n.nodeType == n.TEXT_NODE: s += n.data elif n.nodeName == 'fo:inline': i = Inline( n ) s += i.getText() elif n.nodeName == 'fo:page-number': s += "#1#"
font['font-family'] = self.attrs['font-family']
font['font'] = self.attrs['font-family']
def __init__(self, node): Properties.__init__(self) self.node = node self.attrs = Attrs( node ) self.common_fonts( self.attrs ) self.common_borders( self.attrs ) self.common_align( self.attrs ) self.common_text( self.attrs ) self.prefix = '' self.suffix = '' p = self.properties font = {} if 'font-family' in self.at...
if self.attrs.get('font-weight') == 'bold': self.add('b') if self.attrs.get('font-style') in ('italic', 'oblique'): self.add('i')
def __init__(self, node): Properties.__init__(self) self.node = node self.attrs = Attrs( node ) self.common_fonts( self.attrs ) self.common_borders( self.attrs ) self.common_align( self.attrs ) self.common_text( self.attrs ) self.prefix = '' self.suffix = '' p = self.properties font = {} if 'font-family' in self.at...
print self.sequence.name print self.pageTemplates pt = self.pageTemplates[ self.sequence.name ]
if not self.sequence.name in self.pageTemplates.keys(): Error("Page master '%s' not defined." % self.sequence.name ) pt = self.sequence.name
def handle_pageBegin( self ): page = self.page + 1 if self.seq_master: pt = self.seq_master.getMaster( page, self.rel_page ) else: print self.sequence.name print self.pageTemplates pt = self.pageTemplates[ self.sequence.name ] Log( "\t\t[%u] PageMaster='%s' [rel:%u]" % ( page, pt, self.rel_page ) ) self.pageTemplate = ...
font['font'] = self.attrs['font-family']
font['face'] = self.attrs['font-family']
def __init__(self, node): Properties.__init__(self) self.node = node self.attrs = Attrs( node ) self.common_fonts( self.attrs ) self.common_borders( self.attrs ) self.common_align( self.attrs ) self.common_text( self.attrs ) self.prefix = '' self.suffix = '' p = self.properties font = {} if 'font-family' in self.at...
self._add( 'font', font )
if font: self._add( 'font', font ) print font, self.getText()
def __init__(self, node): Properties.__init__(self) self.node = node self.attrs = Attrs( node ) self.common_fonts( self.attrs ) self.common_borders( self.attrs ) self.common_align( self.attrs ) self.common_text( self.attrs ) self.prefix = '' self.suffix = '' p = self.properties font = {} if 'font-family' in self.at...
self.text = self.prefix + self.text + self.suffix
self.text = self.prefix + escape_tags(self.text) + self.suffix print "
def getText(self): """ Return the processed text of the Inline object, resolving all the nested tags. """ self.text = '' for n in self.node.childNodes: if n.nodeType == n.TEXT_NODE: self.text += n.data elif n.nodeName == 'fo:inline': i = Inline( n ) self.text += i.getText() elif n.nodeName == 'fo:page-number': self.tex...
return False if not ircdb.checkCapability(msg.prefix, capability): irc.queueMsg(ircmsgs.privmsg(' irc.reply("Your edit request has been forwarded to
lfd = open('/home/dennis/public_html/botlogs/lock','a') fcntl.lockf(lfd, fcntl.LOCK_EX) fd = open('/home/dennis/public_html/botlogs/%s.log' % datetime.date.today().strftime('%Y-%m-%d'),'a') fd.write("%s %-20s %-16s %s\n" % (datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),msg.args[0], msg.nick, msg.args[1])) fd....
def _precheck(self, irc, msg, capability=None, timeout=None, withnick=False): channel = msg.args[0].lower() inchannel = channel.startswith('#') excl = msg.args[1].startswith('!') wn = msg.args[1].startswith('ubotu') if inchannel and not (excl or (wn and withnick)): return False for c in irc.callbacks: comm = msg.args[1...
r"^(!|!?ubotu\S?\s)?(?P<noalias>-)?\s*(tell\s+(?P<nick>\S+)\s+about\s+)?(?P<factoid>\S.+?)(>\s*(?P<nick2>\S+))?$"
r"^(!|!?ubotu\S?\s)?(?P<noalias>-)?\s*(tell\s+(?P<nick>\S+)\s+about\s+)?(?P<factoid>\S.*?)(>\s*(?P<nick2>\S+).*)?$"
def showfactoid(self, irc, msg, match): r"^(!|!?ubotu\S?\s)?(?P<noalias>-)?\s*(tell\s+(?P<nick>\S+)\s+about\s+)?(?P<factoid>\S.+?)(>\s*(?P<nick2>\S+))?$" withnick = bool(match.group(1)) and msg.args[1].startswith('ubotu') db = self._precheck(irc, msg, withnick=True, timeout=(msg.args[0], match.group('nick'), match.grou...
if not noalias: factoid = resolve_alias(db,factoid,channel) else:
if noalias:
def showfactoid(self, irc, msg, match): r"^(!|!?ubotu\S?\s)?(?P<noalias>-)?\s*(tell\s+(?P<nick>\S+)\s+about\s+)?(?P<factoid>\S.+?)(>\s*(?P<nick2>\S+))?$" withnick = bool(match.group(1)) and msg.args[1].startswith('ubotu') db = self._precheck(irc, msg, withnick=True, timeout=(msg.args[0], match.group('nick'), match.grou...
if not self._precheck(irc, msg, timeout=(to,factoid.name)): return cur.execute("UPDATE FACTS SET popularity = %d WHERE name = %s", factoid.popularity+1, factoid.name) db.commit() if factoid.value.startswith('<reply>'): irc.queueMsg(ircmsgs.privmsg(to, '%s%s' % (retmsg, factoid.value[7:].strip()))) else: irc.queueMsg(ir...
if noalias: if not self._precheck(irc, msg, timeout=(to,factoid.name,1)): return cur.execute("SELECT name FROM facts WHERE value = %s", '<alias> ' + factoid.name) data = cur.fetchall() if(len(data)): aliases = "%s aliases: %s" % (factoid.name, ', '.join([x[0].strip() for x in data])) else: if factoid.value.strip().star...
def showfactoid(self, irc, msg, match): r"^(!|!?ubotu\S?\s)?(?P<noalias>-)?\s*(tell\s+(?P<nick>\S+)\s+about\s+)?(?P<factoid>\S.+?)(>\s*(?P<nick2>\S+))?$" withnick = bool(match.group(1)) and msg.args[1].startswith('ubotu') db = self._precheck(irc, msg, withnick=True, timeout=(msg.args[0], match.group('nick'), match.grou...
r"^!?(?P<no>no,?\s+)?(?P<factoid>\S.*?)\s+is\s+(?P<fact>\S.*)"
r"^!?(?P<no>no,?\s+)?(?P<factoid>\S.*?)\s+is\s+(?P<also>also\s+)?(?P<fact>\S.*)"
def addfactoid(self, irc, msg, match): r"^!?(?P<no>no,?\s+)?(?P<factoid>\S.*?)\s+is\s+(?P<fact>\S.*)" db = self._precheck(irc, msg, capability='editfactoids', timeout=(msg.args[0],match.group(0))) if not db: return channel = msg.args[0] cur = db.cursor()
db = self._precheck(irc, msg, capability='editfactoids', timeout=(msg.args[0],match.group(0))) if not db: return channel = msg.args[0] cur = db.cursor()
def addfactoid(self, irc, msg, match): r"^!?(?P<no>no,?\s+)?(?P<factoid>\S.*?)\s+is\s+(?P<also>also\s+)?(?P<fact>\S.*)" db = self._precheck(irc, msg, capability='editfactoids', timeout=(msg.args[0],match.group(0))) if not db: return channel = msg.args[0] cur = db.cursor()
u.removeCapability('editfactoids')
try: u.removeCapability('editfactoids') except: irc.error('User %s is not an editor' % name) else: irc.replySuccess()
def removeeditor(self, irc, msg, args, name): self._precheck(irc, msg, capability='addeditors') try: u = ircdb.users.getUser(name) except: irc.error('User %s is not registered' % name) else: u.removeCapability('editfactoids')
self.clear_details()
def change_filter(self): x = 0 criteria = gutils.on_combo_box_entry_changed(self.filter_criteria) text = gutils.gescape(self.e_filter.get_text()) if criteria == self._("Original Title") and text: data = self.db.select_movie_by_original_title(text) elif criteria == self._("Title") and text: data = self.db.select_movie_...
self.picture_url = gutils.trim(self.page,"alt=\"cover\" src=\"","\"")
self.picture_url = gutils.after(self.page,"a name=\"poster\""); self.picture_url = gutils.trim(self.picture_url,"src=\"","\"")
def picture(self): self.picture_url = gutils.trim(self.page,"alt=\"cover\" src=\"","\"")
shutil.copy(image_file, os.path.join(config['exported_dir'],'posters'))
try: shutil.copy(image_file, os.path.join(config['exported_dir'],'posters')) except: gdebug.debug("Can't copy %s" % image_file)
def export_data(self, widget): '''Main exporting function'''
eval("self.%s_volume_combo.insert_text(int(volume['id']), volume['name'])"%tmp)
eval("self.%s_volume_combo.insert_text(int(volume['id']), str(volume['name']))"%tmp)
def fill_volumes_combo(self, prefix='e', default=0): for tmp in 'e', "am": eval("self.%s_volume_combo.get_model().clear()"%tmp) for volume in self.db.get_all_volumes_data(): eval("self.%s_volume_combo.insert_text(int(volume['id']), volume['name'])"%tmp) eval("self.%s_volume_combo.show_all()"%tmp) if prefix == 'e': self...
eval("self.%s_collection_combo.insert_text(int(collection['id']), collection['name'])"%tmp)
eval("self.%s_collection_combo.insert_text(int(collection['id']), str(collection['name']))"%tmp)
def fill_collections_combo(self, prefix='e', default=0): for tmp in 'e', "am": eval("self.%s_collection_combo.get_model().clear()"%tmp) for collection in self.db.get_all_collections_data(): eval("self.%s_collection_combo.insert_text(int(collection['id']), collection['name'])"%tmp) eval("self.%s_collection_combo.show_al...
if not os.path.isfile(image_path):
if not os.path.isfile(new_image_path):
def add_movie_db(self, close): details = get_details(self) if not details['o_title'] and not details['title']: gutils.error(self.widgets['results']['window'], _("You should fill the original title\nor the movie title."), parent=self.widgets['add']['window']) return False if details['o_title']: tmp_movie = self.db.Movi...
handler = self.Image.set_from_file(image_path)
handler = self.Image.set_from_file(new_image_path)
def add_movie_db(self, close): details = get_details(self) if not details['o_title'] and not details['title']: gutils.error(self.widgets['results']['window'], _("You should fill the original title\nor the movie title."), parent=self.widgets['add']['window']) return False if details['o_title']: tmp_movie = self.db.Movi...
self.original_title = self.title
self.original_title = gutils.gdecode(self.title, self.encode)
def title(self): self.title = re.search(r"<title>CSFD: (.*) \(",self.page) if self.title: self.title = self.title.group(1) else: self.title = "" if self.original_title == "": self.original_title = self.title
self.commit()
objectstore.commit()
def set_loaned(self): """ Set loaned=True for all movies in volume/collection and for movie itself Set loan's date to today's date """ if self.movie == None: debug.show("Loan: wrong movie_id. Aborting") return False if self.person == None: debug.show("Loan: wrong person_id. Aborting") return False if self.collection_id...
self.commit()
objectstore.commit()
def set_returned(self): """ Set loaned=False for all movies in volume/collection and for movie itself. Set return_date to today's date """ if self.movie == None: debug.show("Loan: wrong movie_id. Aborting") return False if self.person == None: debug.show("Loan: wrong person_id. Aborting") return False if self.collectio...
self.engine = create_engine('sqlite', {'filename':os.path.join(griffith_dir, "griffith,db")})
self.engine = create_engine('sqlite', {'filename':os.path.join(griffith_dir, "griffith.db")})
def __init__(self, config, gdebug, griffith_dir): #{{{ self.griffith_dir = griffith_dir self.config = config global debug debug = gdebug if not config.has_key("db_type"): config["db_type"] = "sqlite"
if t_movies.has_key("year") and (t_movies["year"]==None or int(t_movies["year"]) < 1986):
if t_movies.has_key("year") and (t_movies["year"]==None or int(t_movies["year"]) < 1886):
def clean_t_movies(self, t_movies): for i in t_movies.keys(): if t_movies[i] == '': t_movies[i]=None for i in ["color","cond","layers","region", 'media', 'vcodec']: if t_movies.has_key(i) and t_movies[i] == -1: t_movies[i]=None for i in ["volume_id","collection_id", 'runtime']: if t_movies.has_key(i) and (t_movies[i]==...
handler = self.am_plugin_image.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file(image))
handler = self.widgets['add']['plugin_image'].set_from_pixbuf(gtk.gdk.pixbuf_new_from_file(image))
def source_changed(self): option = gutils.on_combo_box_entry_changed_name(self.widgets['add']['source']) self.active_plugin = option plugin_name = 'PluginMovie' + option plugin = __import__(plugin_name) self.widgets['add']['plugin_desc'].set_text(plugin.plugin_name+"\n" \ +plugin.plugin_description+"\n"+_("Url: ") \ +p...
self.ids.append(gutils.trim(element,'<a href="view.php?page=film&fid=','">')) self.titles.append(gutils.trim(element,">","</a>"))
elementid = gutils.digits_only( gutils.trim(element,'<a href="view.php?page=film&fid=','">') ) if elementid != 0: self.ids.append(elementid) self.titles.append(gutils.trim(element,">","</a>"))
def get_searches(self): elements = string.split(self.page,"<br>")
url = "sqlite://%s" % os.path.join(griffith_dir, config['default_db'])
url = "sqlite:///%s" % os.path.join(griffith_dir, config['default_db'])
def __init__(self, config, gdebug, griffith_dir): #{{{ from sqlalchemy.mods.threadlocal import assign_mapper self.griffith_dir = griffith_dir self.config = config global debug debug = gdebug if not config.has_key('db_type'): config['db_type'] = 'sqlite'
url = "sqlite://%s" % os.path.join(griffith_dir, 'griffith.db')
url = "sqlite:///%s" % os.path.join(griffith_dir, 'griffith.db')
def __init__(self, config, gdebug, griffith_dir): #{{{ from sqlalchemy.mods.threadlocal import assign_mapper self.griffith_dir = griffith_dir self.config = config global debug debug = gdebug if not config.has_key('db_type'): config['db_type'] = 'sqlite'
self.Movie.mapped_table.insert().execute(t_movies)
self.Movie.mapper.mapped_table.insert().execute(t_movies)
def add_movie(self, t_movies, t_languages=None, t_tags=None): self.clean_t_movies(t_movies) self.Movie.mapped_table.insert().execute(t_movies) movie = self.Movie.get_by(number=t_movies['number']) # languages if t_languages != None: for lang in t_languages.keys(): for type in t_languages[lang].keys(): movie.languages.ap...
self.Movie.mapped_table.update(self.Movie.c.movie_id==movie_id).execute(t_movies) self.MovieLanguage.mapped_table.delete(self.MovieLanguage.c.movie_id==movie_id).execute() self.MovieTag.mapped_table.delete(self.MovieTag.c.movie_id==movie_id).execute()
self.Movie.mapper.mapped_table.update(self.Movie.c.movie_id==movie_id).execute(t_movies) self.MovieLanguage.mapper.mapped_table.delete(self.MovieLanguage.c.movie_id==movie_id).execute() self.MovieTag.mapper.mapped_table.delete(self.MovieTag.c.movie_id==movie_id).execute()
def update_movie(self, t_movies, t_languages=None, t_tags=None): movie_id = t_movies['movie_id'] if movie_id == None: debug.show('Update movie: Movie ID is not set. Operation aborted!') return False self.clean_t_movies(t_movies) self.Movie.mapped_table.update(self.Movie.c.movie_id==movie_id).execute(t_movies) self.Movi...
retriever = Retriever(self.url, parent_window, progress)
try: url = self.url.encode(self.encode) except UnicodeEncodeError: url = self.url.encode('utf-8') retriever = Retriever(url, parent_window, progress)
def open_search(self,parent_window): self.titles = [""] self.ids = [""] self.url=string.replace(self.url+self.title,' ','%20') progress = Progress(parent_window,_("Searching"),_("Wait a moment")) retriever = Retriever(self.url, parent_window, progress) retriever.start() while retriever.isAlive(): progress.pulse() if pr...
self.encode='utf-8'
self.encode='iso-8859-1'
def __init__(self, id): self.encode='utf-8' self.movie_id = id self.url = "http://imdb.com/title/tt" + str(self.movie_id)
self.encode='utf-8'
self.encode='iso-8859-1'
def __init__(self): self.original_url_search = "http://imdb.com/find?more=tt;q=" self.translated_url_search = "http://imdb.com/find?more=tt;q=" self.encode='utf-8'
self.page = self.page.decode('utf-8')
self.page = self.page.decode('iso-8859-1')
def sub_search(self): self.page = gutils.trim(self.page,"</b> found the following results:", "<b>Suggestions For Improving Your Results</b>"); self.page = self.page.decode('utf-8')
for collection in self.db.get_all_data(table_name="collections", order_by=None):
for collection in self.get_all_data(table_name="collections", order_by=None):
def add_collection(self, name): # check if volume already exists for collection in self.db.get_all_data(table_name="collections", order_by=None): if name == collection['name']: self.debug.show("Collection '%s' already exists"%name) return False self.debug.show("Adding '%s' collection to database..."%name) try: self.cur...
self.flush()
self.mapper.get_session().flush()
def set_loaned(self): """ Set loaned=True for all movies in volume/collection and for movie itself Set loan's date to today's date """ if self.movie == None: debug.show("Loan: wrong movie_id. Aborting") return False if self.person == None: debug.show("Loan: wrong person_id. Aborting") return False if self.collection_id...
self.flush()
self.mapper.get_session().flush()
def set_returned(self): """ Set loaned=False for all movies in volume/collection and for movie itself. Set return_date to today's date """ if self.movie == None: debug.show("Loan: wrong movie_id. Aborting") return False if self.person == None: debug.show("Loan: wrong person_id. Aborting") return False if self.collectio...
'assigned_movies': relation(self.Movie)})
'assigned_movies': relation(self.Movie, backref='volume')})
def __init__(self, config, gdebug, griffith_dir): #{{{ from sqlalchemy.mods.threadlocal import assign_mapper self.griffith_dir = griffith_dir self.config = config global debug debug = gdebug if not config.has_key('db_type'): config['db_type'] = 'sqlite'
'assigned_movies': relation(self.Movie)})
'assigned_movies': relation(self.Movie, backref='collection')})
def __init__(self, config, gdebug, griffith_dir): #{{{ from sqlalchemy.mods.threadlocal import assign_mapper self.griffith_dir = griffith_dir self.config = config global debug debug = gdebug if not config.has_key('db_type'): config['db_type'] = 'sqlite'
'assigned_movies': relation(self.Movie)})
'assigned_movies': relation(self.Movie, backref='medium')})
def __init__(self, config, gdebug, griffith_dir): #{{{ from sqlalchemy.mods.threadlocal import assign_mapper self.griffith_dir = griffith_dir self.config = config global debug debug = gdebug if not config.has_key('db_type'): config['db_type'] = 'sqlite'
'assigned_movies': relation(self.Movie)})
'assigned_movies': relation(self.Movie, backref='vcodec')})
def __init__(self, config, gdebug, griffith_dir): #{{{ from sqlalchemy.mods.threadlocal import assign_mapper self.griffith_dir = griffith_dir self.config = config global debug debug = gdebug if not config.has_key('db_type'): config['db_type'] = 'sqlite'
'volume' : relation(self.Volume), 'collection' : relation(self.Collection), 'medium' : relation(self.Medium),
def __init__(self, config, gdebug, griffith_dir): #{{{ from sqlalchemy.mods.threadlocal import assign_mapper self.griffith_dir = griffith_dir self.config = config global debug debug = gdebug if not config.has_key('db_type'): config['db_type'] = 'sqlite'
'tags' : relation(self.MovieTag), 'vcodec' : relation(self.VCodec)})
'tags' : relation(self.MovieTag)})
def __init__(self, config, gdebug, griffith_dir): #{{{ from sqlalchemy.mods.threadlocal import assign_mapper self.griffith_dir = griffith_dir self.config = config global debug debug = gdebug if not config.has_key('db_type'): config['db_type'] = 'sqlite'
def add_movie(self, t_movies, t_languages=None, t_tags=None):
def clean_t_movies(self, t_movies):
def add_movie(self, t_movies, t_languages=None, t_tags=None): # remove empty fields (insert default value instead - mostly "NULL") for i in t_movies.keys(): if t_movies[i] == '': t_movies.pop(i) for i in ["color","cond","layers","region","media_num"]: if t_movies[i] == -1: t_movies.pop(i) for i in ["volume_id","collect...
t_movies.pop(i) for i in ["color","cond","layers","region","media_num"]: if t_movies[i] == -1: t_movies.pop(i) for i in ["volume_id","collection_id"]: if t_movies.has_key(i) and int(t_movies[i]) == 0:
t_movies[i]=None for i in ["color","cond","layers","region", 'media', 'vcodec']: if t_movies.has_key(i) and t_movies[i] == -1: t_movies[i]=None for i in ["volume_id","collection_id", 'runtime']: if t_movies.has_key(i) and (t_movies[i]==None or int(t_movies[i]) == 0):
def add_movie(self, t_movies, t_languages=None, t_tags=None): # remove empty fields (insert default value instead - mostly "NULL") for i in t_movies.keys(): if t_movies[i] == '': t_movies.pop(i) for i in ["color","cond","layers","region","media_num"]: if t_movies[i] == -1: t_movies.pop(i) for i in ["volume_id","collect...
if t_movies.has_key("year") and int(t_movies["year"]) < 1986: t_movies[i] = None self.Movie.mapper.table.insert().execute(t_movies)
if t_movies.has_key("year") and (t_movies["year"]==None or int(t_movies["year"]) < 1986): t_movies["year"] = None def add_movie(self, t_movies, t_languages=None, t_tags=None): self.clean_t_movies(t_movies) objectstore.clear()
def add_movie(self, t_movies, t_languages=None, t_tags=None): # remove empty fields (insert default value instead - mostly "NULL") for i in t_movies.keys(): if t_movies[i] == '': t_movies.pop(i) for i in ["color","cond","layers","region","media_num"]: if t_movies[i] == -1: t_movies.pop(i) for i in ["volume_id","collect...
movie.commit()
objectstore.commit()
def add_movie(self, t_movies, t_languages=None, t_tags=None): # remove empty fields (insert default value instead - mostly "NULL") for i in t_movies.keys(): if t_movies[i] == '': t_movies.pop(i) for i in ["color","cond","layers","region","media_num"]: if t_movies[i] == -1: t_movies.pop(i) for i in ["volume_id","collect...