code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
import logging
import json
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from sqlalchemy import desc, func
from sqlalchemy.exc import IntegrityError
from fidoweb.lib.base import Session, BaseController, render
from fidoweb.model.map import *... | Python |
import logging
import json
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from fidoweb.lib.base import Session, BaseController, render
log = logging.getLogger(__name__)
class DiscountController(BaseController) :
def index(self) :
from fi... | Python |
import cgi
from paste.urlparser import PkgResourcesParser
from pylons.middleware import error_document_template
from webhelpers.html.builder import literal
from fidoweb.lib.base import BaseController
class ErrorController(BaseController):
"""Generates error documents as and when they are required.
The Error... | Python |
# -*- coding: gb18030 -*-
import logging
import json
import random
import string
import datetime
import hashlib
import sys
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from fidoweb.lib.base import Session, BaseController, render
from fidowe... | Python |
import logging
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from fidoweb.lib.base import BaseController, render, Session
from fidoweb.model.user import User, UserGroup, User_UserGroup
log = logging.getLogger(__name__)
class UserGroupContro... | Python |
import logging
import json
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from fidoweb.lib.base import Session, BaseController, render
from fidoweb.model.homepageGalleryPic import *
log = logging.getLogger(__name__)
class HomepageController(... | Python |
import gzip
import StringIO
class GzipMiddleware(object):
def __init__(self, app, compresslevel = 9) :
self.app = app
self.compresslevel = compresslevel
def __call__(self, environ, start_response):
if 'gzip' not in environ.get('HTTP_ACCEPT_ENCODING', '') : return self.app(environ, start_response)
path = e... | Python |
"""Routes configuration
The more specific and detailed routes should be defined first so they
may take precedent over the more generic routes. For more information
refer to the routes manual at http://routes.groovie.org/docs/
"""
from routes import Mapper
def make_map(config):
"""Create, configure and return the rou... | Python |
"""Pylons middleware initialization"""
from beaker.middleware import SessionMiddleware
from paste.cascade import Cascade
from paste.registry import RegistryManager
from paste.urlparser import StaticURLParser
from paste.deploy.converters import asbool
from pylons.middleware import ErrorHandler, StatusCodeRedirect
from p... | Python |
"""Pylons environment configuration"""
import os
from mako.lookup import TemplateLookup
from pylons.configuration import PylonsConfig
from pylons.error import handle_mako_error
from sqlalchemy import engine_from_config
import fidoweb.lib.app_globals as app_globals
import fidoweb.lib.helpers
from fidoweb.config.routin... | Python |
import datetime
import string
class FormChecker :
def isValidEmail(self, addr) :
if (len(addr) == 0) : return False
rfc822_specials = '()<>,;:\\"[]'
c = 0
while (c < len(addr)) :
if (ord(addr[c]) < 32 or ord(addr[c]) >= 127) : return False
if (addr[c] in rfc822_specials) : return False
if (addr[c] =... | Python |
"""Helper functions
Consists of functions to typically be used within templates, but also
available to Controllers. This module is available to templates as 'h'.
"""
# Import helpers as desired, or define your own, ie:
#from webhelpers.html.tags import checkbox, password
| Python |
"""The base Controller API
Provides the BaseController class for subclassing.
"""
from pylons.controllers import WSGIController
from pylons.templating import render_mako as render
from fidoweb.model.meta import Session
class BaseController(WSGIController):
def __call__(self, environ, start_response):
""... | Python |
"""The application's Globals object"""
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
class Globals(object):
"""Globals acts as a container for objects available throughout the
life of the application
"""
def __init__(self, config):
"""One instance o... | Python |
import random
import datetime
import math
import pytz
from pytz import timezone
from pylons import session
# Fidocard:
# BWT info(5 bit) + mobile(36 bit) + random(1 bit) + fixed bit(1,1 bit)
class Algorithm :
def fidocardBWT(self, num) :
tmp = list()
for i in range(0, 19) :
tmp.append([num, i])
lst = nu... | Python |
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(
name='FidoWeb',
version='0.1',
description='',
author='',
author_email='',
url='',
install_requires=[
... | Python |
#!python
"""Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools... | Python |
# -*- coding: utf-8 -*-
#this will translate a web page to another language
from urllib import urlopen
from BeautifulSoup import BeautifulSoup
import simplejson
# The google translate API can be found here:
# http://code.google.com/apis/ajaxlanguage/documentation/#Examples
def translate(text, sourceLang = 'en', tar... | Python |
# -*- coding: utf-8 -*-
"""Unit tests for Beautiful Soup.
These tests make sure the Beautiful Soup works as it should. If you
find a bug in Beautiful Soup, the best way to express it is as a test
case like this that fails."""
import unittest
from BeautifulSoup import *
class SoupTest(unittest.TestCase):
def ass... | Python |
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup parses a (possibly invalid) XML or HTML document into a
tree representation. It provides methods and Pythonic idioms that make
it easy to navigate, search, and modify the tree.
A well-formed X... | Python |
from distutils.core import setup
import unittest
import warnings
warnings.filterwarnings("ignore", "Unknown distribution option")
import sys
# patch distutils if it can't cope with the "classifiers" keyword
if sys.version < '2.2.3':
from distutils.dist import DistributionMetadata
DistributionMetadata.classifie... | Python |
from urllib import urlopen
import simplejson
from lxml import etree
# The google translate API can be found here:
# http://code.google.com/apis/ajaxlanguage/documentation/#Examples
def translate(text, sourceLang = 'en', targetLang = 'pt'):
try:
url = "https://www.googleapis.com/language/translate/v2?" + \
... | Python |
"""
pyText2Pdf - Python script to convert plain text files into Adobe
Acrobat PDF files.
Version 1.2
Author: Anand B Pillai <abpillai at lycos dot com>
Keywords: python, tools, converter, pdf, text2pdf, adobe, acrobat,
processing.
Copyright (C) 2003-2004 Free Software Foundation, Inc.
This file is... | Python |
"""
httpExists.py
A quick and dirty way to to check whether a web file is there.
Usage:
>>> from httpExists import *
>>> httpExists('http://www.python.org/')
1
>>> httpExists('http://www.python.org/PenguinOnTheTelly')
Status 404 Not Found : http://www.python.org/PenguinOnTheTelly
0
"""
import httplib
import urlparse... | Python |
# -*- coding: utf-8 -*-
import translator
import recipe
import checkURL
langDict = {'AFRIKAANS' : 'af',
'ALBANIAN' : 'sq',
'AMHARIC' : 'am',
'ARABIC' : 'ar',
'ARMENIAN' : 'hy',
'AZERBAIJANI' : 'az',
'BASQUE' : 'eu',
'BELARUSIAN' : 'be'... | Python |
import time
import os
import re
import sys
import logging
import logging.handlers
import yaml
import getopt
from os.path import getmtime, getsize, normpath, join
logger = None
def init_logger(verbose=True,
filelogging=False,
logfilename='filemonitor.out',
logfilesiz... | Python |
import socket
import time
import thread
import threading
from Tkinter import *
import tkFileDialog
def main():
finestra=Tk()
finestra.title("Lan Sharer")
finestra.minsize(300,300)
finestra.maxsize(300,300)
cornice=Frame(finestra)
cornice.pack()
B1=Button(cornice,text="Start Server",borderwidth=1,command=P... | Python |
S_OK = 0;
S_FALSE = 1;
E_FAIL = 2147500037;
E_INVALIDARG = 2147942487;
E_NOTIMPL = 2147500033;
E_OUTOFMEMORY = 2147942414;
E_POINTER = ... | Python |
#!/usr/bin/env python
#This is the main executable. Don't change it unless you really need to.
import sys
import re
DEFAULT_PORT = 1337
def print_usage():
print
print "Usage: ./client.py <remote IP> <options>"
print "Remote IP can be written as <ip> or <ip>:<port>"
print "Default port is " + str(DEFAULT... | Python |
"""
This is the part of the code that interfaces with Entangled. Ideally,
you'll be getting everything you need from the UI in this code to talk
to the DHT, regardless of which UI it is. Then, you'll return what you
get in some standardized way.
The uiClass passed to the constructor is the instance of w... | Python |
"""
This is the source file for the text-based user interface. It's nice
and simple and has a shell.
"""
import sys, os
import thread
import binascii
import string
import threading
import traceback
import fileT
from network import EntangledNetworkLayer
from listen import Listener
from ui_abstract import Abstract... | Python |
"""
This is the abstract UI class. It should not be used except by its
subclasses.
"""
import sys
import os
import thread
from network import EntangledNetworkLayer
from listen import Listener
import socket
import time
class AbstractUI:
#don't worry about myPort not being set to DEFAULT_PORT, it gets overwritt... | Python |
#!/usr/bin/env python
#samsterlicious when cut across the neck a sound like wailing winds is heard
'''
file transfer and recieve classes
these are called by ui's
'''
import socket, os, sys, threading, tempfile, re, time, math, random, string
buf = 10000
class recieve_thread(threading.Thread):
# socket file sema
d... | Python |
#!/usr/bin/env python
#This is the main executable. Don't change it unless you really need to.
import sys
import re
DEFAULT_PORT = 1337
def print_usage():
print
print "Usage: ./client.py <remote IP> <options>"
print "Remote IP can be written as <ip> or <ip>:<port>"
print "Default port is " + str(DEFAULT... | Python |
#!/usr/bin/env python
#samsterlicious when cut across the neck a sound like wailing winds is heard
'''
file transfer and recieve classes
these are called by ui's
'''
import socket, os, sys, threading, tempfile, re, time, math, random, string
buf = 10000
class recieve_thread(threading.Thread):
# socket file sema
d... | Python |
"""
Main source file for the headless UI. It's nice and simple and does
almost nothing!
"""
import sys
import thread
from network import EntangledNetworkLayer
from listen import Listener
from ui_abstract import AbstractUI
class HeadlessUI(AbstractUI):
#Unlike the TextUI, we don't have any interactivity, so we... | Python |
import socket
import threading
from fileT import send_thread
class Listener(threading.Thread):
sock = None
port = 1338
def __init__(self, port):
threading.Thread.__init__(self)
self.port = port
print "listenT port: "+str(port)
self.sock = socket.socket()
self.sock... | Python |
'''Collection of utility functions'''
import hashlib
import os
def filehash(path):
inFile = file(path, 'r')
md5 = hashlib.md5()
while 1:
fileBuf = inFile.read(1024)
if not fileBuf:
break
md5.update(fileBuf)
return md5.hexdigest()
| Python |
import os, sys, commands, ntpath, math, hashlib, unicodedata
__version__ = '1.0.0'
__author__ = "joesox@gmail.com"
__url__ = 'www.joeswammi.com'
"""
writing on Python 2.6.5
PREREQUISITES:
TrID (and its .trd file)- File Identifier: http://mark0.net/soft-trid-e.html
ssdeep: http://code.google.com/p/pyssdeep/
P... | Python |
#
# jQuery File Tree
# Python/Django connector script
# By Martin Skou
#
import os
import urllib
def dirlist(request):
r=['<ul class="jqueryFileTree" style="display: none;">']
try:
r=['<ul class="jqueryFileTree" style="display: none;">']
d=urllib.unquote(request.POST.get('dir','c:\\temp... | Python |
class Error:
def __init__(self,sample,path,message):
self.sample = sample
self.path = path
self.message = str(message).rstrip()
class ErrorCollator:
def __init__(self):
self.errors = []
def add(self,error):
self.errors.append(error)
def hasErrors(self):
if len(self.errors)<=0:
... | Python |
#!/usr/bin/env python
import sys
from config import *
import logging
from errorCollator import *
LOGFILENAME = __file__ + ".log"
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s',
filename = LOGFILENAME, level=logging.INFO)
hiccups = ErrorCollator()
from ZSI import FaultException
from xml... | Python |
#!/usr/bin/env python
from config import *
import sys
import logging
from errorCollator import *
LOGFILENAME = __file__ + ".log"
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s',
filename = LOGFILENAME, level=logging.INFO)
hiccups = ErrorCollator()
from pdbWrapper import PDBWS
from ZSI im... | Python |
#!/usr/bin/env python
import sys
from config import *
# ping proposaldb server, get all new users since given date/time,
from ZSI import FaultException
#populate remote ICAT FACILITY_USER table with these users
print "Connecting: ICAT Oracle Database"
from xmlMapping.dbConnect import *
bypass=False
try:
dbcnx =... | Python |
#!/usr/bin/env python
from config import *
import sys
import logging
LOGFILENAME = __file__ + ".log"
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s',
filename = LOGFILENAME, level=logging.INFO)
logger = logging.getLogger("fileWatcher")
from errorCollator import *
hiccups = ErrorCollator()
... | Python |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# just a dummy class to pull metadata from oxford Diffraction .img image file
# shamelessly hacked from CCP$ DiffractionImage
# http://www.ccp4.ac.uk/ccp4bin/viewcvs/ccp4/lib/DiffractionImage/DiffractionImageOxford.cpp?rev=1.15&content-type=text/vnd.viewcvs-markup
import s... | Python |
#!/usr/bin/env python
# just a dummy class to pull metadata from Bruker Frame (.sfrm) files
from string import strip
class SFRM:
def __init__(self,file):
self.tbufsize = 80
self.file = file
def getMetadata(self):
buf = self.file.read(self.tbufsize)
if not buf.startswith("FORMAT :"):
rai... | Python |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# just an adHoc hack to pull metadata from an OD CIF
# for proper CIF reading, you would want to use PyCifRW ...
DEBUG = 0
class ODCIF:
def __init__(self,file):
self.tbufsize = 80
self.file = file
def getMetadata(self):
meta = {}
#get these lin... | Python |
#!/usr/bin/env python
# just a dummy class to pull metadata from Bruker Frame (.sfrm) files
from string import strip
class SFRM:
def __init__(self,file):
self.tbufsize = 80
self.file = file
def getMetadata(self):
buf = self.file.read(self.tbufsize)
if not buf.startswith("FORMAT :"):
rai... | Python |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# just a dummy class to pull metadata from oxford Diffraction .img image file
# shamelessly hacked from CCP$ DiffractionImage
# http://www.ccp4.ac.uk/ccp4bin/viewcvs/ccp4/lib/DiffractionImage/DiffractionImageOxford.cpp?rev=1.15&content-type=text/vnd.viewcvs-markup
import s... | Python |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# just an adHoc hack to pull metadata from an OD CIF
# for proper CIF reading, you would want to use PyCifRW ...
DEBUG = 0
class ODCIF:
def __init__(self,file):
self.tbufsize = 80
self.file = file
def getMetadata(self):
meta = {}
#get these lin... | Python |
#!/usr/bin/env python
from config import *
import sys
import logging
LOGFILENAME = __file__ + ".log"
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s',
filename = LOGFILENAME, level=logging.INFO)
logger = logging.getLogger("fileWatcher")
from errorCollator import *
hiccups = ErrorCollator()
... | Python |
#
# This file is importedd by the XML template, for instrument specific handling
#
# Hopefully OxfordDatasetBuilder is a bit mor ecoherent than BrukerFrameBuilder
#
from config import DataFormats
from datasetBuilder import DatasetBuilder
class OxfordDatasetBuilder(DatasetBuilder):
""" The idea here is to make th... | Python |
#
# file: $Id: templateParser.py 78 2010-08-17 00:42:53Z duboulay $
#
# Author: Doug du Boulay <boulay_d@chem.usyd.edu.au>
# Copyright (c) 2009, The University of Sydney
# All rights reserved.
#
# This software is distributed under the BSD license.
# Redistribution and use in source and binary forms, with or without
# ... | Python |
#
# file: $Id: xml2dict.py 72 2009-10-18 23:25:15Z duboulay $
#
# This code is in the public domain.
# see http://code.activestate.com/recipes/415983/
# Recipe 415983: Simple XML serlializer/de-serializer using
# Python dictionaries and marshalling
#
# - though modified somewhat for the purposes of the DataMINX proje... | Python |
#
# file: $Id: mapConfig.py 67 2009-08-28 06:01:54Z duboulay $
#
# Author: Doug du Boulay <boulay_d@chem.usyd.edu.au>
# Copyright (c) 2009, The University of Sydney
# All rights reserved.
#
# This software is distributed under the BSD license.
# Redistribution and use in source and binary forms, with or without
# modi... | Python |
# file: $Id: dbConnect.py 68 2009-08-31 00:12:51Z duboulay $
#
# Author: Doug du Boulay <boulay_d@chem.usyd.edu.au>
# Copyright (c) 2009, The University of Sydney
# All rights reserved.
#
# This software is distributed under the BSD license.
# Redistribution and use in source and binary forms, with or without
# modific... | Python |
from config import *
import os
import os.path
import logging
class Collection:
def __init__(self,folder,contents,period, map):
self._log = logging.getLogger('%s.%s' % (__name__, self.__class__.__name__))
self.parent = folder # a pathname string
#self.lastModified = os.path.getctime(folder)
self.la... | Python |
from config import DataFormats
import logging
class DatasetBuilder(object):
""" This is a base class to be extended by various
instrument/manufacturer specific instance classes.
This should provide some generic file metadata handling mechanisms
"""
def __init__(self,dataFormat):
self._log = loggi... | Python |
#!/usr/bin/env python
import sys
from config import *
# ping proposaldb server, get all new users since given date/time,
from ZSI import FaultException
#populate remote ICAT FACILITY_USER table with these users
print "Connecting: ICAT Oracle Database"
from xmlMapping.dbConnect import *
bypass=False
try:
dbcnx =... | Python |
#
#
#
# Look for experiment data folders modified more recently than
# the timestamp of this file. For testing purposes, adjust as
# touch -t 199501131000 /var/lib/dataMINX
# Additionally it contains a hashtable of experiment folder mod times
DATAMINX="/var/lib/dataMINX"
#mount -t cifs //192.168.97.140/csaf_oth... | Python |
#!/usr/bin/env python
import sys
from config import *
import logging
from errorCollator import *
LOGFILENAME = __file__ + ".log"
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s',
filename = LOGFILENAME, level=logging.INFO)
hiccups = ErrorCollator()
from ZSI import FaultException
from xml... | Python |
#! /usr/bin/env python
from DrupalSoap_client import *
from ZSI import FaultException
import sys
filename ="VBLMetaMan.wsdl"
FILENAME = "https://vbl.synchrotron.org.au/MetaMan/VBLMetaMan.wsdl"
URL = "http://cima.example.com:8080/?q=services/soap"
LOGNAME=""
PASSWORD=""
DATASETID="10tdk013"
def getFromListRespons... | Python |
#! /usr/bin/env python
from DrupalSoap_client import *
from ZSI import FaultException
import sys
filename ="VBLMetaMan.wsdl"
FILENAME = "https://vbl.synchrotron.org.au/MetaMan/VBLMetaMan.wsdl"
URL = "http://cima.example.com:8080/?q=services/soap"
LOGNAME=""
PASSWORD=""
DATASETID="10tdk013"
def getFromListRespons... | Python |
#! /usr/bin/env python
from DrupalSoap_services import *
import sys
filename ="VBLMetaMan.wsdl"
FILENAME = "https://vbl.synchrotron.org.au/MetaMan/VBLMetaMan.wsdl"
URL = "http://cima.chem.usyd.edu.au:8080/?q=services/soap"
LOGNAME="admin"
PASSWORD="CSAFPropPass"
if __name__ == '__main__':
print "locating the... | Python |
#! /usr/bin/env python
from DrupalSoap_services import *
import sys
filename ="VBLMetaMan.wsdl"
FILENAME = "https://vbl.synchrotron.org.au/MetaMan/VBLMetaMan.wsdl"
URL = "http://cima.chem.usyd.edu.au:8080/?q=services/soap"
LOGNAME="admin"
PASSWORD="CSAFPropPass"
if __name__ == '__main__':
print "locating the... | Python |
INVESTIGATIONTITLE = "lflj134"
ADMINURL = "https://icat.admin.ws.host.net/ICATAdminService/ICATAdmin"
ICATURL = "https://icat.ws.host.net/ICATService/ICAT"
ICATUSER = "user"
ICATPASS = "pass"
ADMINUSER ="admin"
ADMINPASS ="pass"
from icatWS.ICATAdminService_client import *
from icatWS.ICATService_client import *
... | Python |
#
# THis file is imported by the XML template, for instrument specific
# handling.
#
# BrukerFrameBuilder is a bit confused. It started off as a trial
# method of generating metadata for ICAT based purely on records
# from the Bruker PostgreSQL database. Subsequently it has
# been adapted to generate metadata based o... | Python |
#!/usr/bin/env python
from config import *
import sys
import logging
from errorCollator import *
LOGFILENAME = __file__ + ".log"
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s',
filename = LOGFILENAME, level=logging.INFO)
hiccups = ErrorCollator()
from pdbWrapper import PDBWS
from ZSI im... | Python |
import urllib
import webapp2
from google.appengine.ext import blobstore,db
from google.appengine.ext.blobstore import BlobInfo
from google.appengine.ext.webapp import blobstore_handlers
class FileRecord(db.Model):
blob = blobstore.BlobReferenceProperty()
class MainHandler(webapp2.RequestHandler):
def get(self)... | Python |
#===istalismanplugin===
# -*- coding: utf-8 -*-
# Registers Plugin
def register_plugin_join(groupchat, nick, afl, role):
if time.time()-INFO['start']>10: # Очень полезная конструкция, добавляет "паузу" перед началом работы в 10 секунд.
msg(groupchat, u'К нам присоединился '+nick+u',... | Python |
from distutils.core import setup
import os
import fileprocessor
currentFileDirectory = os.path.dirname(__file__)
with open(os.path.join(currentFileDirectory, "README"), "r") as f:
readme = f.read()
setup(
name="fileprocessor",
version=fileprocessor.VERSION,
description="Harness that makes bulk proces... | Python |
import sys
import os
import unittest
def runTests(testDirectory, projectDirectory = None, testName = None):
"""Run unit tests from files with filenames of the form test_*.py.
Arguments:
testDirectory -- Absolute path to directory containing all the tests
Keyword arguments:
projectDirectory -- Path to... | Python |
"""Recursviely searches through directory and displays any image URLs
inside web pages.
Created to provide an example of how to use the fileprocessor module.
"""
import sys
import re
from fileprocessor import FileProcessor, searchers, filterers, extractors
class ImageURLExtractor(extractors.TextExtractor... | Python |
"""Generates checksums for every file within a directory (recursively),
displaying those checksums through stdout.
Created to provide an example of how to use the fileprocessor module.
"""
import sys
import hashlib
from fileprocessor import FileProcessor, searchers, filterers, extractors
class ChecksumGe... | Python |
"""Contains all built-in Filterer classes."""
import collections
import fnmatch
import os
from fileprocessor.abstracts import Filterer
class ExcludeListFilterer(Filterer):
"""Filterer which filters files based on glob patterns."""
def __init__(self, excludeList):
"""Construct instance of Exclude... | Python |
"""Contains the abstract classes for the major components of the library."""
class Searcher:
"""Searches directory for files to process."""
def search(self, rootDirectory):
"""Search directory for files and return list of absolute paths to those files.
Arguments:
rootDirectory -- Root directory to... | Python |
"""Contains all built-in Extractor classes."""
from fileprocessor.abstracts import Extractor
class ByteExtractor(Extractor):
"""Extractor used for extracting data from a binary file.
If the files being read are large, then it may be worth
using ByteStreamExtractor to read the file bit-by-bit.
Otherwise, a lot o... | Python |
"""Main import for fileprocessing library. Contains main class for
processing files."""
import sys
import os
import collections
# Constant which specifies which version of fileprocessor this is
VERSION = "0.1"
# Done so importing modules from library is easier
def getSubModulesAndPackages():
"""Retu... | Python |
"""Contains all built-in Searcher classes."""
import sys
import os
import collections
from .abstracts import Searcher
class FileSearcher(Searcher):
"""Searches the filesystem for files, either recursively and non-recursively."""
def __init__(self, recurse = False):
"""Construct instance of FileSe... | Python |
#!/usr/bin/python
import os, sys
sys.path.append(os.getcwd() + '/lib')
sys.path.append(os.getcwd() + '/lib/general')
sys.path.append(os.getcwd() + '/lib/gtk')
sys.path.append(os.getcwd() + '/lib/c')
# my libraries
from CFileRunnerGUI import CFileRunnerGUI
def real_main():
oApp = CFileRunnerGUI()
oApp.run()
return... | Python |
#!/usr/bin/python
import os, sys
sys.path.append(os.getcwd() + '/lib')
sys.path.append(os.getcwd() + '/lib/general')
sys.path.append(os.getcwd() + '/lib/gtk')
sys.path.append(os.getcwd() + '/lib/c')
# my libraries
from CFileRunnerGUI import CFileRunnerGUI
def real_main():
oApp = CFileRunnerGUI()
oApp.run()
return... | Python |
# Name: CFileRunnerGUI.py
# Date: Sat Mar 27 09:56:02 CET 2010
# Purpose: Common FileRunner constants
import os
### general const
HOME = os.path.expanduser('~')
#HOME = os.path.expanduser('~/tmp/filerunner_testing/CFG')
VERSION = '<DEVEL-VERSION>'
AUTHOR = 'Filip Husak'
CFG_DIR = HOME + '/.filerunner'
CFG_FILE =... | Python |
# Name: CDataHnd.py
# Date: Tue Mar 23 23:18:22 CET 2010
# Purpose: main data class of fileRunner application. It loads data from config and data files.
# Def: CDataHnd()
# Inputs:
import os
import sys
import string
import fnmatch
import re
import commands
import errno
import time
# my libraries
from CFil... | Python |
# Name: CFileRunnerGUI.py
# Date: Tue Mar 23 22:26:28 CET 2010
# Purpose: main GUI class of fileRunner application
# Def: CFileRunnerGUI()
# Inputs:
import os
import sys
import gtk
import gobject
import time
import errno
from threading import Lock
# my libraries
from CDataHnd import CDataHnd
from CTrayIcon ... | Python |
# Name: CProfile.py
# Date: Thu Apr 8 22:04:26 CEST 2010
# Purpose: Create and update profile. The profile is often created in the $HOME directory.
# Def: CProfile(profileDir)
# Inputs:
import os
# my libraries
from CProcMngr import CProcMngr
#############################################################... | Python |
# Name: CProcMngr.py
# Date: Sat Mar 27 10:42:41 CET 2010
# Purpose: Create and show about dialog
# Depends: myconst module
# Def: CProcMngr(widget = None)
# Inputs:
import os
import commands
####################################################################################################
class CProcM... | Python |
# Name: CThread.py
# Date: Sat May 1 19:59:54 CEST 2010
# Purpose: The abstract thread class with callback function.
# The base class (which inherits CThread) MUST call run method.
# super(ClassName, self).run()
# Def CThread(name)
# Inputs: name - the name of the thread [string].
import t... | Python |
# Name: CExceptionHnd.py
# Date: Sun May 2 15:18:25 CEST 2010
# Purpose: Handles exceptions
# Def CExceptionHnd(extExcHnd_cb)
# Inputs:
import sys
####################################################################################################
class CExceptionHnd():
'''
'' Base class for handling e... | Python |
# Name: CFile.py
# Date: Tue Mar 9 15:30:27 CET 2010
# Purpose: The class handles file descriptor
# Def: CFile(filename, mode)
# Inputs: filename - the name of file to work with
# mode - the mode in which the file is opened [r, w]
import os
import sys
#############################################... | Python |
# Name: CConfigReader.py
# Date: Sun Mar 21 19:11:46 CET 2010
# Purpose: Load and parse config file and get variables/valus for given section
# Def: ConfigReader(fileName)
# Inputs: filename - the name of config file
import ConfigParser
class CConfigReader():
'''
'' Load and parse config file and get var... | Python |
#!/usr/bin/python
from distutils.core import setup, Extension
module1 = Extension('mmStrMatch', sources = ['mmStrMatch.c'])
setup (name = 'mmStrMatch',
version = '1.0',
description = 'My Module for matching string and pattern. Module is written in C.',
ext_modules = [module1])
| Python |
#!/usr/bin/python
from distutils.core import setup, Extension
module1 = Extension('mmStrMatch', sources = ['mmStrMatch.c'])
setup (name = 'mmStrMatch',
version = '1.0',
description = 'My Module for matching string and pattern. Module is written in C.',
ext_modules = [module1])
| Python |
# Name: CTrayIcon.py
# Date: Sat Mar 27 09:41:29 CET 2010
# Purpose:
# Def: CTrayIcon()
# Inputs:
import gtk
####################################################################################################
class CTrayIcon(gtk.StatusIcon):
__file = None
__tooltip = None
#----------------------------... | Python |
# Name: CProgressWndRnd.py
# Date: Sat May 1 20:56:56 CEST 2010
# Purpose: Show random status of progress bar. It is used while running long-time operation.
# Depends: CThread
# Def: CProgressWndRnd()
# Inputs:
from threading import Event
import random, time
import gtk
import gobject
# my libraries
from ... | Python |
# Name: CKeyPressHnd.py
# Date: Sun Mar 28 21:24:42 CEST 2010
# Purpose: Handles key pressing
# Def: CKeyPressHnd()
# Inputs:
import gtk
####################################################################################################
class CKeyPressHnd():
__event = None
#---------------------------... | Python |
# Name: CAboutDlg.py
# Date: Sat Mar 27 10:42:41 CET 2010
# Purpose: Create and show about dialog
# Depends: myconst module
# Def: CAboutDlg(widget = None)
# Inputs: widget
import gtk
# my libraries
import myconst
############################################################################################... | Python |
# Name: CSimpleMsgDlg.py
# Date: Sat Mar 27 10:42:41 CET 2010
# Purpose: Create and show simple message dialog
# Def: CSimpleMsgDlg(msg)
# Inputs: msg - message to be diplayed in the dialog
import gtk
####################################################################################################
clas... | Python |
# Name: CGenerateDb.py
# Date: Sat May 1 20:37:18 CEST 2010
# Purpose: Generate DB file.
# Depends: CThread, CFile
# Def: CGenerateDB(dataHandler)
# Inputs: dataHandler - instance of CDataHnd
import sys
import gtk
# my libraries
from CThread import CThread
from CFile import CFile
from CProcMngr import CPr... | Python |
#!/usr/bin/python
import os, sys
sys.path.append(os.getcwd() + '/lib')
sys.path.append(os.getcwd() + '/lib/general')
sys.path.append(os.getcwd() + '/lib/gtk')
sys.path.append(os.getcwd() + '/lib/c')
# my libraries
from CFileRunnerGUI import CFileRunnerGUI
def real_main():
oApp = CFileRunnerGUI()
oApp.run()
return... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.