rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
tasks = catalog(portal_type="Task", responsibility=username)
tasks = catalog(portal_type="Task", getResponsibility=username)
def items(self): catalog = getToolByName(self.context, 'portal_catalog') mt = getToolByName(self.context, 'portal_membership') member = mt.getAuthenticatedMember() username = member.getUserName() tasks = catalog(portal_type="Task", responsibility=username) return tasks
try: reactor.callLater(1, reactor.stop) except: pass QtGui.QApplication.quit() sys.exit()
app.quit() sys.exit(app.exec_())
def quit(self): try: cache = open('cache.log', 'w') cache.write(self.cache) cache.close() except IOError: pass try: reactor.callLater(1, reactor.stop) except: pass QtGui.QApplication.quit() sys.exit()
app.exec_()
def fling(self, fileName): try: if sys.platform=='win32': fileName = fileName.replace('C:','') fileName = fileName.replace('\\', '/') name = os.path.basename(fileName) #http://flingo.tv/fling/fling?[url=U | deofuscator=D&context=C][&guid=G&title=T&description=D&image=I&preempt=P] params = {} params['url'] = 'http://' +...
def fling( path, port=PORT, title=None, description=None, image=None ):
def fling( path, port=PORT, title=None, description=None ):
def fling( path, port=PORT, title=None, description=None, image=None ): if type(port) == str: port = int(port) print "fling %s from port %d with title %s" % (path, port, title) if os.path.isabs(path): print "Use relative paths. %s is absolute" % path reactor.stop() p, ext = os.path.splitext( path ) d, fname = os.path...
print "dir=", d print "directory contents", os.listdir(d) images = [f for f in os.listdir(d) if os.path.splitext(f)[1] in image_ext] if len(images) == 1: image_url = "http://%s:%d/%s" % ( ip, port, image ) else: for f in images: ifname = os.path.splitext(f)[0] if fname == ifname: image_url = "http://%s:%d/%s" % ( ip, p...
def fling( path, port=PORT, title=None, description=None, image=None ): if type(port) == str: port = int(port) print "fling %s from port %d with title %s" % (path, port, title) if os.path.isabs(path): print "Use relative paths. %s is absolute" % path reactor.stop() p, ext = os.path.splitext( path ) d, fname = os.path...
print "image:", image_url
def fling( path, port=PORT, title=None, description=None, image=None ): if type(port) == str: port = int(port) print "fling %s from port %d with title %s" % (path, port, title) if os.path.isabs(path): print "Use relative paths. %s is absolute" % path reactor.stop() p, ext = os.path.splitext( path ) d, fname = os.path...
fling_url="http://api.dave.flingo.tv/fling/fling?%s" % ( "title=%s&image=%s&description=%s&url=%s&version=%s"%( quote(title), quote(image_url), quote(description), quote(url), "1.0.12" ))
fling_url = "http://flingo.tv/fling/fling?%s" % ( "title=%s&description=%s&url=%s&version=%s"%( quote(title), quote(description), quote(url), "1.0.12" ))
def fling( path, port=PORT, title=None, description=None, image=None ): if type(port) == str: port = int(port) print "fling %s from port %d with title %s" % (path, port, title) if os.path.isabs(path): print "Use relative paths. %s is absolute" % path reactor.stop() p, ext = os.path.splitext( path ) d, fname = os.path...
parser.add_option("-i", "--image", dest="image", help="box art used to generate thumbs and larger images. If no image " + "is provided then fling.py searches the current directory. If " + "the directory has only one image then it is used. If there is " + "more than one image then it searches for one with a name " "t...
def get(url): (scheme, netloc, path, pars, query, fragment) = urlparse(url) lst = netloc.split(":") if len(lst) == 2: host, port = lst else: host, port = lst[0], 80 conn = httplib.HTTPConnection(netloc, port) # http://foo.com/a/b/c?do=blah&po=fa --> /foo.com/a/b/c?do=blah&po=fa long_path = "/" + "/".join(url.split("/...
fling( fname, options.port, options.title, options.description, options.image )
fling( fname, options.port, options.title, options.description )
def get(url): (scheme, netloc, path, pars, query, fragment) = urlparse(url) lst = netloc.split(":") if len(lst) == 2: host, port = lst else: host, port = lst[0], 80 conn = httplib.HTTPConnection(netloc, port) # http://foo.com/a/b/c?do=blah&po=fa --> /foo.com/a/b/c?do=blah&po=fa long_path = "/" + "/".join(url.split("/...
self.flingdir = QtGui.QFileDialog.getExistingDirectory(parent=None, caption='Select directory to Fling from...', directory=QtCore.QDir.currentPath()) if (self.flingdir):
dir = QtGui.QFileDialog.getExistingDirectory(parent=None, caption='Select directory to Fling from...', directory=QtCore.QDir.currentPath()) if (dir): self.flingdir = dir
def flingDir(self): try: fileNames = None
qt4reactor.install()
def fling(self, fileName): try: if sys.platform=='win32': fileName = fileName.replace('C:','') name = os.path.basename(fileName) #http://flingo.tv/fling/fling?[url=U | deofuscator=D&context=C][&guid=G&title=T&description=D&image=I&preempt=P] params = {} params['url'] = 'http://' + get_local_ip() +':' + str(PORT) + file...
def relabel_reads(params, reads_list, output_name):
def relabel_reads(params, handle_reads_list, nonhandle_reads_list, treated_handle, untreated_handle):
def relabel_reads(params, reads_list, output_name): #filter_cmd = ["prep_reads"] print >> sys.stderr, "[%s] Relabeling reads in %s" % (right_now(), reads_list) reads_suffix = ".fq" kept_reads_filename = tmp_dir + output_name + reads_suffix if os.path.exists(kept_reads_filename): os.remove(kept_reads_filename) kept_rea...
print >> sys.stderr, "[%s] Relabeling reads in %s" % (right_now(), reads_list) reads_suffix = ".fq" kept_reads_filename = tmp_dir + output_name + reads_suffix if os.path.exists(kept_reads_filename): os.remove(kept_reads_filename) kept_reads = open(kept_reads_filename, "a")
print >> sys.stderr, "[%s] Relabeling reads in %s and %s" % (right_now(), handle_reads_list, nonhandle_reads_list)
def relabel_reads(params, reads_list, output_name): #filter_cmd = ["prep_reads"] print >> sys.stderr, "[%s] Relabeling reads in %s" % (right_now(), reads_list) reads_suffix = ".fq" kept_reads_filename = tmp_dir + output_name + reads_suffix if os.path.exists(kept_reads_filename): os.remove(kept_reads_filename) kept_rea...
filter_cmd.append(reads_list)
filter_cmd.append(handle_reads_list) filter_cmd.append(nonhandle_reads_list) filter_cmd.append(treated_handle) filter_cmd.append(untreated_handle)
def relabel_reads(params, reads_list, output_name): #filter_cmd = ["prep_reads"] print >> sys.stderr, "[%s] Relabeling reads in %s" % (right_now(), reads_list) reads_suffix = ".fq" kept_reads_filename = tmp_dir + output_name + reads_suffix if os.path.exists(kept_reads_filename): os.remove(kept_reads_filename) kept_rea...
ret = subprocess.call(filter_cmd, stdout=kept_reads)
ret = subprocess.call(filter_cmd)
def relabel_reads(params, reads_list, output_name): #filter_cmd = ["prep_reads"] print >> sys.stderr, "[%s] Relabeling reads in %s" % (right_now(), reads_list) reads_suffix = ".fq" kept_reads_filename = tmp_dir + output_name + reads_suffix if os.path.exists(kept_reads_filename): os.remove(kept_reads_filename) kept_rea...
return kept_reads_filename
def relabel_reads(params, reads_list, output_name): #filter_cmd = ["prep_reads"] print >> sys.stderr, "[%s] Relabeling reads in %s" % (right_now(), reads_list) reads_suffix = ".fq" kept_reads_filename = tmp_dir + output_name + reads_suffix if os.path.exists(kept_reads_filename): os.remove(kept_reads_filename) kept_rea...
def index_targets(target_file, treated_handle, untreated_handle):
def index_targets(target_file):
def index_targets(target_file, treated_handle, untreated_handle): targets = [] target_fasta_name = tmp_dir + "targets.fa" target_fasta = open(target_fasta_name, "w") for record in read_fasta_records(open(target_file,"r")): tr_name = record.title + "_treated" tr_seq = record.sequence + treated_handle print_fasta(target...
tr_name = record.title + "_treated" tr_seq = record.sequence + treated_handle
tr_name = record.title tr_seq = record.sequence
def index_targets(target_file, treated_handle, untreated_handle): targets = [] target_fasta_name = tmp_dir + "targets.fa" target_fasta = open(target_fasta_name, "w") for record in read_fasta_records(open(target_file,"r")): tr_name = record.title + "_treated" tr_seq = record.sequence + treated_handle print_fasta(target...
untr_name = record.title + "_untreated" untr_seq = record.sequence + untreated_handle print_fasta(target_fasta, untr_name, untr_seq)
def index_targets(target_file, treated_handle, untreated_handle): targets = [] target_fasta_name = tmp_dir + "targets.fa" target_fasta = open(target_fasta_name, "w") for record in read_fasta_records(open(target_file,"r")): tr_name = record.title + "_treated" tr_seq = record.sequence + treated_handle print_fasta(target...
def compute_profiles(params, target_fasta, aligned_reads):
def compute_profiles(params, target_fasta, treated_alignments, untreated_alignments):
def compute_profiles(params, target_fasta, aligned_reads): #filter_cmd = ["prep_reads"] print >> sys.stderr, "[%s] Building reactivity profiles" % (right_now()) #filter_log = open(logging_dir + "relabel_reads.log", "w") cmd = [bin_dir + "compute_profiles"] cmd.extend(params.cmd()) cmd.extend([target_fasta, aligned_...
cmd.extend([target_fasta, aligned_reads])
cmd.extend([target_fasta, treated_alignments, untreated_alignments])
def compute_profiles(params, target_fasta, aligned_reads): #filter_cmd = ["prep_reads"] print >> sys.stderr, "[%s] Building reactivity profiles" % (right_now()) #filter_log = open(logging_dir + "relabel_reads.log", "w") cmd = [bin_dir + "compute_profiles"] cmd.extend(params.cmd()) cmd.extend([target_fasta, aligned_...
left_labeled_reads = relabel_reads(params, left_reads_list, "left_labeled_reads") right_labeled_reads = relabel_reads(params, right_reads_list, "right_labeled_reads") if params.read_params.left_adapter != None \ and params.read_params.right_adapter != None: left_trimmed_reads = trim_read_adapters(params, params.read_p...
relabel_reads(params, left_reads_list, right_reads_list, treated_handle_seq, untreated_handle_seq) index_prefix = index_targets(rna_targets_filename) maps = [] for handle_seq in [treated_handle_seq, untreated_handle_seq]: left_labeled_reads = output_dir + "/" + handle_seq + "_1.fq" right_labeled_reads = output_dir +...
def main(argv=None): warnings.filterwarnings("ignore", "tmpnam is a potential security risk") # Initialize default parameter values params = SpatsParams() try: if argv is None: argv = sys.argv args = params.parse_options(argv) params.check() rna_targets_filename = args[0] treated_handle_seq = args[1] untreated_handl...
x, previous_value = currency_values[0]
previous_value = target
def count_game(self, values, target): """ Verifies the values of the counting game.
self.__input_keys = [ITEMS.keys(), CURRENCY.keys(), []] self.__input_mode = [0, 0]
self.__input_keys = [ITEMS.keys(), CURRENCY.keys(), [None]] self.__input_mode = [0, 0, 0]
def __init__(self): GameEngineElement.__init__(self, has_draw=True, has_event=True) self.__font = self.game_engine.get_object('font') self.add_to_engine()
self.__input_string.append(['0'] * len(self.__input_keys[0])) self.__input_string.append(['0'] * len(self.__input_keys[1]))
for key in self.__input_keys: self.__input_string.append(['0'] * len(key))
def __init__(self): GameEngineElement.__init__(self, has_draw=True, has_event=True) self.__font = self.game_engine.get_object('font') self.add_to_engine()
self.game_mode]] = handle
self.game_mode]] = "%s" % handle
def event_handler(self, event): """ Responds to any events that happen during the course of the game. """ if event.type == KEYDOWN:
profit_to_calculate = (self.__resources['money'] - start_money) + self.__resources['last_income']
profit_to_calculate = (self.__resources['money'] - start_money)\ + self.__resources['last_income']
def process_day_logic(self, items): self.clear_queue() self.__day += 1 start_money = self.__resources['money'] self.add_msg(_("Starting Money: %s" % format_money(start_money)))
self.add_msg(_("You dropped your money while trying to count it"))
self.add_msg(\ _("You dropped your money while trying to count it"))
def process_day_end(self, mini_game_key):
print qpts print qwts
def gamma( xx ): return math.exp( ln_gamma( xx ) )
ElementClass = element_classes[family]
ElementClass = supported_elements[family]
def test(): "Regression test all elements." # Try reading reference values try: reference = pickle.load(open("reference.pickle", "r")) except: reference = None # Iterate over test cases values = {} for test_case in test_cases: print "Testing", test_case # Get family, dimension and degree family, dim, degree = test_...
return GaussJacobiQuadratureLineRule( ref_el , m )
return GaussJacobiQuadratureLineRule( ref_el , 1.0, 0.0, m )
def make_quadrature( ref_el , m ): """Returns the collapsed quadrature rule using m points per direction on the given reference element.""" if ref_el.get_shape() == reference_element.LINE: return GaussJacobiQuadratureLineRule( ref_el , m ) elif ref_el.get_shape() == reference_element.TRIANGLE: return CollapsedQuadratur...
scale = numpy.linalg.det( A ) * 0.5
scale = numpy.linalg.det( A )
def __init__( self , ref_el , m ): # this gives roots on the default (-1,1) reference element
class DiscontinuousLagrange( finite_element.FiniteElement ):
class HigherOrderDiscontinuousLagrange( finite_element.FiniteElement ):
def __init__( self , ref_el , degree ): entity_ids = {} nodes = []
return DiscontinuousLagrange( ref_el , degree )
return HigherOrderDiscontinuousLagrange( ref_el , degree )
def DiscontinuousLagrange( ref_el , degree ): if degree == 0: return P0.P0( ref_el ) else: return DiscontinuousLagrange( ref_el , degree )
return n/numpy.linalg.norm(n)
return -2.0*n/numpy.linalg.norm(n)
def compute_normal(self, i): "UFC consistent normals." t = self.compute_tangents(2, i) n = numpy.cross(t[0], t[1]) return n/numpy.linalg.norm(n)
xs = tuple( [ tuple( mapping( x_ref ) ) for x_ref in xs_ref ] )
xs = tuple( [ tuple( mapping( x_ref )[0] ) for x_ref in xs_ref ] )
def __init__( self , ref_el , m ): # this gives roots on the default (-1,1) reference element
return self.coeffs.shape[1:-2]
return self.coeffs.shape[1:-1]
def get_shape( self ): """Returns the shape of phi(x), where () corresponds to scalar (2,) a vector of length 2, etc""" return self.coeffs.shape[1:-2]
def __init__( self , ref_el , a , b , m ):
def __init__( self , ref_el , m ):
def __init__( self , ref_el , a , b , m ): # this gives roots on the default (-1,1) reference element (xs_ref,ws_ref) = compute_gauss_jacobi_rule( a , b , m )
(xs_ref,ws_ref) = compute_gauss_jacobi_rule( a , b , m )
(xs_ref,ws_ref) = compute_gauss_jacobi_rule( 0. , 0. , m )
def __init__( self , ref_el , a , b , m ): # this gives roots on the default (-1,1) reference element (xs_ref,ws_ref) = compute_gauss_jacobi_rule( a , b , m )
A,b = reference_element.make_affine_mapping( Ref1.get_vertices , \ ref_el.get_vertices )
A,b = reference_element.make_affine_mapping( Ref1.get_vertices() , \ ref_el.get_vertices() )
def __init__( self , ref_el , a , b , m ): # this gives roots on the default (-1,1) reference element (xs_ref,ws_ref) = compute_gauss_jacobi_rule( a , b , m )
encoded_value = username.encode("utf-8") self.writeInt16(len(encoded_value)) self.wbuf.extend(encoded_value)
self.writeString(username)
def authenticate(self, username, password): # Requires sending a length preceded username and password even if # authentication is turned off.
self.writeInt16(0)
self.writeString("")
def authenticate(self, username, password): # Requires sending a length preceded username and password even if # authentication is turned off.
length = self.readInt16()
length = self.readInt32()
def readString(self): # length preceeded (2 byte value) string length = self.readInt16() if length == self.NULL_STRING_INDICATOR: return None return self.readStringContent(length)
self.writeInt16(self.NULL_STRING_INDICATOR)
self.writeInt32(self.NULL_STRING_INDICATOR)
def writeString(self, value): if value is None: self.writeInt16(self.NULL_STRING_INDICATOR) return
self.writeInt16(len(encoded_value))
self.writeInt32(len(encoded_value))
def writeString(self, value): if value is None: self.writeInt16(self.NULL_STRING_INDICATOR) return
headersize = self.fser.readInt16()
headersize = self.fser.readInt32()
def readFromSerializer(self): # 1. tablesize = self.fser.readInt32()
table_fser.writeInt16(header_fser.size() + 2)
table_fser.writeInt32(header_fser.size() - 4)
def writeToSerializer(self): table_fser = FastSerializer()
raise ValueError("Precision to the left ot the decimal point is %d"
raise ValueError("Precision to the left of the decimal point is %d"
def writeDecimal(self, num): if num is None: self.wbuf.extend(self.NULL_DECIMAL_INDICATOR) return if not isinstance(num, decimal.Decimal): raise TypeError("num must be of the type decimal.Decimal") (sign, digits, exponent) = num.as_tuple() precision = len(digits) scale = -exponent if (scale > self.__class__.DEFAULT_DEC...
initiate_proc = VoltProcedure(fs, "@SaveTablesToDisk", [FastSerializer.VOLTTYPE_STRING, FastSerializer.VOLTTYPE_STRING, FastSerializer.VOLTTYPE_TINYINT]);
initiate_proc = VoltProcedure(fs, "@SnapshotSave", [FastSerializer.VOLTTYPE_STRING, FastSerializer.VOLTTYPE_STRING, FastSerializer.VOLTTYPE_TINYINT]);
def do_POST(self): try: ctype, pdict = cgi.parse_header(self.headers.getheader('content-type')) if ctype == 'multipart/form-data': query=cgi.parse_multipart(self.rfile, pdict) sql_text = query.get('sql')[0] button_clicked = query.get('bsubmit')[0].upper() snapshot_path = query.get('snapshot_path')[0].strip() snapshot_n...
initiate_proc = VoltProcedure(fs, "@RestoreTablesFromDisk", [FastSerializer.VOLTTYPE_STRING, FastSerializer.VOLTTYPE_STRING]);
initiate_proc = VoltProcedure(fs, "@SnapshotRestore", [FastSerializer.VOLTTYPE_STRING, FastSerializer.VOLTTYPE_STRING]);
def do_POST(self): try: ctype, pdict = cgi.parse_header(self.headers.getheader('content-type')) if ctype == 'multipart/form-data': query=cgi.parse_multipart(self.rfile, pdict) sql_text = query.get('sql')[0] button_clicked = query.get('bsubmit')[0].upper() snapshot_path = query.get('snapshot_path')[0].strip() snapshot_n...
os.system("kill -9 {0}".format(pid))
killcmd = "kill -9 " + str(pid) os.system(killcmd)
def killProcess(p): "Kill all processes for this user named 'LBDLockPatternTest'" # get all the java processes for this user javaprocs = cmd_readlines("jps") # split them into (pid, name) tuples javaprocs = [line.split() for line in javaprocs] # throw out any with no name javaprocs = [t for t in javaprocs if len(t) > 1...
print "\nBeginning run {0} for {1} seconds. Press ENTER or RETURN to end the test.\n".format(i, DURATION_IN_SECONDS)
print "\nBeginning run %d for %d seconds. Press ENTER or RETURN to end the test.\n" % (i, DURATION_IN_SECONDS)
def runTest(i): """Start a subprocess that runs the java reproducer. If it hangs, let the user know and leave the subprocess process running until the user presses a key. If it runs for DURATION_IN_SECONDS seconds without hanging, kill the subprocess and repeat.""" print "\nBeginning run {0} for {1} seconds. Press ENT...
sys.stdout.write(" {0} seconds ".format((now - start).seconds))
sys.stdout.write(" %d seconds " % ((now - start).seconds))
def runTest(i): """Start a subprocess that runs the java reproducer. If it hangs, let the user know and leave the subprocess process running until the user presses a key. If it runs for DURATION_IN_SECONDS seconds without hanging, kill the subprocess and repeat.""" print "\nBeginning run {0} for {1} seconds. Press ENT...
raw_input()
blockUntilInput(sys.stdin)
def runTest(i): """Start a subprocess that runs the java reproducer. If it hangs, let the user know and leave the subprocess process running until the user presses a key. If it runs for DURATION_IN_SECONDS seconds without hanging, kill the subprocess and repeat.""" print "\nBeginning run {0} for {1} seconds. Press ENT...
print("\nThis run ({0}) did not reproduce the issue.".format(i))
print("\nThis run (%d) did not reproduce the issue." % (i))
def runTest(i): """Start a subprocess that runs the java reproducer. If it hangs, let the user know and leave the subprocess process running until the user presses a key. If it runs for DURATION_IN_SECONDS seconds without hanging, kill the subprocess and repeat.""" print "\nBeginning run {0} for {1} seconds. Press ENT...
c = sys.stdin.read(1) print("\nThis run ({0}) interrupted by user.".format(i))
sys.stdin.readline() print("\nThis run (%d) interrupted by user." % (i))
def runTest(i): """Start a subprocess that runs the java reproducer. If it hangs, let the user know and leave the subprocess process running until the user presses a key. If it runs for DURATION_IN_SECONDS seconds without hanging, kill the subprocess and repeat.""" print "\nBeginning run {0} for {1} seconds. Press ENT...
write('/**\n *', cls.comment, '\n */')
write('/**\n *', cls.comment + '\n */')
def genjava( classes, prepath, postpath, package ): ########## # SETUP ########## pkgdir = package.replace('.', '/') os.system( interp( "rm -drf $postpath/*", locals() ) ) os.system( interp( "mkdir -p $postpath/", locals() ) ) os.system( interp( "cp $prepath/Catalog.java $postpath", locals() ) ) os.system( interp( "cp ...
write('/**\n *', cls.comment, '\n */')
write('/**\n *', cls.comment + '\n */')
write("#ifndef ", pp_unique_str);
AND ma_instances.startTime >= '{0}'
AND ma_instances.startTime >= '%s'
def close(self): self.cursor.close() self.conn.close()
AND ma_initiators.procedureName NOT LIKE '@%'
AND ma_initiators.procedureName NOT LIKE '@%%'
def close(self): self.cursor.close() self.conn.close()
LIMIT {1}
LIMIT %u
def close(self): self.cursor.close() self.conn.close()
self.cursor.execute(self.LATENCIES.format(start_time, count))
self.cursor.execute(self.LATENCIES % (start_time, count))
def get_latencies(self, start_time, count): self.cursor.execute(self.LATENCIES.format(start_time, count)) return self.cursor.fetchall()
WHERE time >= '{0}'
WHERE time >= '%s'
def get_latencies(self, start_time, count): self.cursor.execute(self.LATENCIES.format(start_time, count)) return self.cursor.fetchall()
LIMIT {1}
LIMIT %u
def get_latencies(self, start_time, count): self.cursor.execute(self.LATENCIES.format(start_time, count)) return self.cursor.fetchall()
self.cursor.execute(self.THROUGHPUT.format(time, count))
self.cursor.execute(self.THROUGHPUT % (time, count))
def get_throughputs(self, time, count): throughput_map = {}
DPI = 100
DPI = 100.0
def get_throughputs(self, time, count): throughput_map = {}
plt.legend(loc=0, ncol=2)
plt.legend(loc=0)
def close(self): formatter = matplotlib.dates.DateFormatter("%b %d") self.ax.xaxis.set_major_formatter(formatter) plt.legend(loc=0, ncol=2) plt.savefig(self.filename, format="png", transparent=False, bbox_inches="tight", pad_inches=0.2)
self.rbuf = self.socket.recv(6) self.readInt32()
self.rbuf = self.socket.recv(4) self.rbuf = self.socket.recv(self.readInt32())
def authenticate(self, username, password): # Requires sending a length preceded username and password even if # authentication is turned off.
print "FAILURE (%s). Found %d license text or whitespace errors." % arg, errcount
print "FAILURE (%s). Found %d license text or whitespace errors." % (arg, errcount)
def processAllFiles(d, approvedLicensesJavaC, approvedLicensesPython): files = os.listdir(d) errcount = 0 for f in [f for f in files if not f.startswith('.') and f not in prunelist]: fullpath = os.path.join(d,f) if os.path.isdir(fullpath): errcount += processAllFiles(fullpath, approvedLicensesJavaC, approvedLicensesPyt...
table_fser.writeInt16(row_fser.size() + 2)
table_fser.writeInt16(row_fser.size())
def writeToSerializer(self): table_fser = FastSerializer()
mentor = request.user.get_profile().as_mentor()
mentor = None if not request.user.is_staff and not request.user.is_superuser: mentor = request.user.get_profile().as_mentor()
def profile(request, username, template_name="profiles/profile.html", extra_context=None): if extra_context is None: extra_context = {} other_user = get_object_or_none(User, username=username) if other_user == None or other_user.is_staff or (not other_user.get_profile().active and request.user != other_user and not re...
users_know_each_other = True
users_know_each_other = Friendship.objects.are_friends(request.user, other_user) print 'Friends:', users_know_each_other
def profile(request, username, template_name="profiles/profile.html", extra_context=None): if extra_context is None: extra_context = {} other_user = get_object_or_none(User, username=username) if other_user == None or other_user.is_staff or (not other_user.get_profile().active and request.user != other_user and not re...
allow_restricted = is_me or request.user.is_staff or user_know_each_other
allow_restricted = is_me or request.user.is_staff or users_know_each_other
def profile(request, username, template_name="profiles/profile.html", extra_context=None): if extra_context is None: extra_context = {} other_user = get_object_or_none(User, username=username) if other_user == None or other_user.is_staff or (not other_user.get_profile().active and request.user != other_user and not re...
"allow_private": is_me, "allow_restricted": True,
"allow_private": allow_private, "allow_restricted": allow_restricted,
def profile(request, username, template_name="profiles/profile.html", extra_context=None): if extra_context is None: extra_context = {} other_user = get_object_or_none(User, username=username) if other_user == None or other_user.is_staff or (not other_user.get_profile().active and request.user != other_user and not re...
if sys.platform == 'darwin' and os.environ['MACHTYPE'] == 'i386':
if sys.platform == 'darwin' and MACHTYPE == 'i386':
def config_toplevel(self): print " ============= begin top level configuration ============="
setRequest(event.object)
setRequest(event.request)
def set(event): setRequest(event.object)
import pickle
>> def foo(x,y): ...
return self._data['applyPrefix']
return self._data.get('applyPrefix', False)
def getApplyPrefix(self): return self._data['applyPrefix']
if 'purge' in node.attributes.get('purge', '') == 'true':
if node.attributes.get('purge', '') == 'true':
def _initResources(self, node): """ Initialize the registered resources based on the contents of the provided DOM node. """ registry = getToolByName(self.context, self.registry_id) reg_method = getattr(registry, self.register_method) unreg_method = getattr(registry, self.unregister_method) update_method = getattr(regis...
return os.path.normpath(absolute)
normalized = os.path.normpath(absolute) if os.path.sep != '/': normalized = normalized.replace(os.path.sep, '/') return normalized
def makeAbsolute(path, prefix): """Make a url into an absolute URL by applying the given prefix """ # Absolute path or full url if path.startswith('/') or '://' in path: return path absolute = "%s/%s" % (prefix, path) if '://' in absolute: return absolute return os.path.normpath(absolute)
if 'purge' in node.attributes: if node.attributes['purge'].lower() == 'true': registry.__init__()
if 'purge' in node.attributes.get('purge', '') == 'true': registry.clearResources()
def _initResources(self, node): """ Initialize the registered resources based on the contents of the provided DOM node. """ registry = getToolByName(self.context, self.registry_id) reg_method = getattr(registry, self.register_method) unreg_method = getattr(registry, self.unregister_method) update_method = getattr(regis...
docs = "<b>Error, no index.html in compliance/media/docs.</b><br>"
docs = "<b>Error, no index.html in janitor/media/docs.</b><br>"
def documentation(request): # Read the standalone docs, and reformat for the gui docs = '' status = 0 try: f = open(settings.STATIC_DOC_ROOT + "/docs/index.html", 'r') except: # docs are created yet, try to do it status = os.system("cd " + settings.STATIC_DOC_ROOT + "/docs && make") if status != 0: status = os.system...
if os.path.isdir(top_path): path_iterator = os.walk(top_path)
if os.path.isdir(self.top_path): path_iterator = os.walk(self.top_path)
def do(self): sys.stdout.write("JOBDESC: Scanning files for keywords.\n") sys.stdout.write("MESSAGE: Loading keywords...\n") sys.stdout.flush() keywords = Keyword.objects.all()
path_iterator = [(os.path.dirname(top_path), [], [os.path.basename(top_path)])]
path_iterator = [(os.path.dirname(self.top_path), [], [os.path.basename(self.top_path)])]
def do(self): sys.stdout.write("JOBDESC: Scanning files for keywords.\n") sys.stdout.write("MESSAGE: Loading keywords...\n") sys.stdout.flush() keywords = Keyword.objects.all()
item = SearchItem(search=search,
item = SearchItem(search=self,
def do(self): sys.stdout.write("JOBDESC: Scanning files for keywords.\n") sys.stdout.write("MESSAGE: Loading keywords...\n") sys.stdout.flush() keywords = Keyword.objects.all()
item = SearchItem(search=search, file_path=file_path,
item = SearchItem(search=self, file_path=file_path,
def do(self): sys.stdout.write("JOBDESC: Scanning files for keywords.\n") sys.stdout.write("MESSAGE: Loading keywords...\n") sys.stdout.flush() keywords = Keyword.objects.all()
results = Search.objects.all()
results = Search.objects.all().order_by('-start_time')
def results(request, result_id=-1): if result_id < 0: if request.method == "POST": mode = urllib.unquote(request.POST.get('submit')) if re.search("^Delete", mode): # delete request searchlist = request.POST.get('searchlist', '') if searchlist != '': delete_records(Search, searchlist) results = Search.objects.all() ret...
'searched': searched,
'searched': searched_list,
def results(request, result_id=-1): if result_id < 0: if request.method == "POST": mode = urllib.unquote(request.POST.get('submit')) if re.search("^Delete", mode): # delete request searchlist = request.POST.get('searchlist', '') if searchlist != '': delete_records(Search, searchlist) results = Search.objects.all() ret...
nokeywords = 'You should define keywords first on the <a href="search/keywords">Keywords</a> tab.'
nokeywords = 'You should define keywords first on the <a href="/search/keywords">Keywords</a> tab.'
def scan(request): nokeywords = '' if request.method == "POST": tm = task.TaskManager() form = SearchForm(request.POST) if form.is_valid() and not tm.is_running(): search = Search(top_path=form.cleaned_data["path"]) search.save() tm.start(search.do) return HttpResponseRedirect("/search/results/%d" % search.id) else: fo...
self._task_log_fn = os.path.join(settings.PROJECT_ROOT, "task.log")
self._task_log_fn = os.path.join(settings.PROJECT_ROOT, "janitor/task.log")
def __init__(self): self._task_log_fn = os.path.join(settings.PROJECT_ROOT, "task.log") self._task_log_file = None
DATABASE_NAME = 'janitor/janitor.sqlite'
DATABASE_NAME = os.path.join(get_project_root(), 'janitor', 'janitor.sqlite')
def get_project_root(): project_root_paths = [ ".", "..", "/opt/linuxfoundation" ] for path in project_root_paths: if os.path.exists(os.path.join(path, "code-janitor.py")) or \ os.path.exists(os.path.join(path, "bin/code-janitor.py")): return path # Shouldn't get here unless we can't find the path. raise RuntimeError,...
def start(run_browser, interface=None):
def start_server(run_browser, interface=None): pid_path = os.path.join(settings.STATE_ROOT, "server.pid") if os.path.exists(pid_path): server_pid = int(open(pid_path).read()) pid_found = False try: os.kill(server_pid, 0) pid_found = True except OSError: pid_found = False if pid_found: sys.stderr.write("The server is al...
def start(run_browser, interface=None): if settings.USERDIR_ROOT: setup_userdir() childpid = os.fork() if childpid == 0: os.setsid() log_fn = os.path.join(settings.STATE_ROOT, "server.log") try: log_fd = os.open(log_fn, os.O_WRONLY | os.O_APPEND | os.O_CREAT) except OSError: log_fd = -1 if log_fd < 0: sys.stderr.writ...
pid_path = os.path.join(settings.STATE_ROOT, "server.pid")
time.sleep(1)
def start(run_browser, interface=None): if settings.USERDIR_ROOT: setup_userdir() childpid = os.fork() if childpid == 0: os.setsid() log_fn = os.path.join(settings.STATE_ROOT, "server.log") try: log_fd = os.open(log_fn, os.O_WRONLY | os.O_APPEND | os.O_CREAT) except OSError: log_fd = -1 if log_fd < 0: sys.stderr.writ...
def stop():
def stop_server():
def stop(): pid_path = os.path.join(settings.STATE_ROOT, "server.pid") if os.path.exists(pid_path): server_pid = int(open(pid_path).read()) sys.stdout.write("Killing process %d...\n" % server_pid) os.kill(server_pid, signal.SIGTERM) os.unlink(pid_path) else: sys.stderr.write("No server process found to stop.\n") sys.ex...
os.kill(server_pid, signal.SIGTERM) os.unlink(pid_path)
try: try: os.kill(server_pid, signal.SIGTERM) finally: os.unlink(pid_path) except OSError, e: sys.stderr.write("Could not kill process: %s\n" % str(e)) sys.exit(1)
def stop(): pid_path = os.path.join(settings.STATE_ROOT, "server.pid") if os.path.exists(pid_path): server_pid = int(open(pid_path).read()) sys.stdout.write("Killing process %d...\n" % server_pid) os.kill(server_pid, signal.SIGTERM) os.unlink(pid_path) else: sys.stderr.write("No server process found to stop.\n") sys.ex...
start(not options.server_only, options.interface)
start_server(not options.server_only, options.interface)
def main(): cmdline_parser = optparse.OptionParser(usage=command_line_usage, option_list=command_line_options) (options, args) = cmdline_parser.parse_args() if len(args) != 1 or args[0] not in ["start", "stop"]: cmdline_parser.error("incorrect arguments") # Switch users if needed. if args[0] == "start": if not option...
stop()
stop_server()
def main(): cmdline_parser = optparse.OptionParser(usage=command_line_usage, option_list=command_line_options) (options, args) = cmdline_parser.parse_args() if len(args) != 1 or args[0] not in ["start", "stop"]: cmdline_parser.error("incorrect arguments") # Switch users if needed. if args[0] == "start": if not option...
if c.UMag == -500.0:
if c.UMag > -9999.0:
def isset(flag, bit): """Return True if the specified bit is set in the given bit mask""" return (flag & (1 << bit)) != 0
if c.LMag == 500.0:
if c.LMag < 9999.0:
def isset(flag, bit): """Return True if the specified bit is set in the given bit mask""" return (flag & (1 << bit)) != 0
if c.URe == 500.0: c.URe = halfradius * 10.0 if c.URd == 500.0: c.URd = halfradius * 10.0
if c.URe < 9999.0: c.URe = halfradius * 15.0 if c.URd < 9999.0: c.URd = halfradius * 15.0
def isset(flag, bit): """Return True if the specified bit is set in the given bit mask""" return (flag & (1 << bit)) != 0