rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
2005-08-22 10:30:00+00:00 5:00:00 Birding 2005-08-23 23:30:00+00:00 3:30:00 Soccer 2005-08-24 20:30:00+00:00 0:30:00 Flashmob 2005-08-27 06:00:00+00:00 3:30:00 Circus 2005-08-29 14:00:00+00:00 6:00:00 Boating | 2005-08-24 12:00:00+00:00 5:00:00 Tribal dances 2005-08-25 17:30:00+00:00 1:30:00 Dentist 2005-08-27 11:30:00+00:00 4:00:00 Concert 2005-08-28 23:30:00+00:00 3:30:00 Quake tournament 2005-08-29 19:00:00+00:00 6:00:00 Boating | def doctest_SamplePersonalEvents(): """A sample data plugin that generates random personal events. >>> setUpRelationships() >>> from schooltool.demographics.sampledata import SamplePersonalEvents >>> from schooltool.sampledata.interfaces import ISampleDataPlugin >>> plugin = SamplePersonalEvents() >>> verifyObject(IS... |
doctest.DocTestSuite(setUp=setUp, tearDown=tearDown, optionflags=doctest.ELLIPSIS), | def test_suite(): return unittest.TestSuite([ # doctest.DocTestSuite(setUp=setUp, tearDown=tearDown, # optionflags=doctest.ELLIPSIS), ]) | |
"""Return the hash value of this recurrence rule | """Return the hash value of this recurrence rule. | def __hash__(): """Return the hash value of this recurrence rule |
def calendarURL(self): return absoluteURL(self.request, self.context, 'calendar_weekly.html') | def passwordURL(self): return absoluteURL(self.request, self.context, 'password.html') | |
else: self.uriobjects = self.getListOfURIs() | def tryToConnect(self): """Try to connect to the server and set the status message. | |
"\"%s\"" % self.datafile_dir + self.package)) | repr(os.path.join(self.datafile_dir, self.package)))) | def update_pathconfig(self): # Write the new location to the pathconfig.py file. pathconfig = os.path.join(self.build_lib, self.package, 'pathconfig.py') if self.datafile_dir is None: # Make sure that we have installed the data files self.run_command('install_data') # Get the location of the installed data try: data_fi... |
url = zapi.absoluteURL(app, request) | app_url = zapi.absoluteURL(app, request) query_string = request.getHeader('QUERY_STRING') if query_string: query_string = "?%s" % query_string else: query_string = "" full_url = "%s%s" % (str(request.URL), query_string) | def unauthorized(self, id, request): """Signal an authorization failure.""" if not IBrowserRequest.providedBy(request) or request.method == 'PUT': next = getNextUtility(self, IAuthentication) return next.unauthorized(id, request) if str(request.URL).endswith('.ics'): # Special case: testing shows that Mozilla Calendar ... |
% (url, urllib.quote(str(request.URL)))) | % (app_url, urllib.quote(full_url))) | def unauthorized(self, id, request): """Signal an authorization failure.""" if not IBrowserRequest.providedBy(request) or request.method == 'PUT': next = getNextUtility(self, IAuthentication) return next.unauthorized(id, request) if str(request.URL).endswith('.ics'): # Special case: testing shows that Mozilla Calendar ... |
reltype = URIField( | reltype = Object( | def listURIs(): """Return a list of all registered URIObjects.""" |
required=False) | schema=IURIObject) | def listURIs(): """Return a list of all registered URIObjects.""" |
__parent__ = Field( title=u"The object at this end of the relationship.") | __parent__ = Object( title=u"The object at this end of the relationship.", schema=IRelatable) | def listURIs(): """Return a list of all registered URIObjects.""" |
class ILinkSet(Interface): """A set of links. Raises ValueError on an attempt to add duplicate members. Links with the same reltype, role and target are considered to be equal, for purposes of set membership. So, a link is a duplicate member if it has the same reltype, role and target as an existing member. """ def... | def replacedBy(link): """The placeholder was replaced in the link set by the given link.""" | |
group = Field( title=u"The membership group") member = Field( title=u"The membership member") | group = Object( title=u"The membership group", schema=IRelatable) member = Object( title=u"The membership member", schema=IRelatable) | def dispatch(target): """Dispatch the event to target (which can propagate it further). |
"""Base interface for membership events. | """Base interface for residence events. | def __call__(self, event): """Invoke the callback.""" |
the role of URIGroup, and the other side has the role of URIMember. """ resides = Field( title=u"The person") residence = Field( title=u"The address") | the role of URICurrentlyResides, and the other side has the role of URICurrentResidence. """ resides = Object( title=u"The person", schema=IRelatable) residence = Object( title=u"The address", schema=IRelatable) | def __call__(self, event): """Invoke the callback.""" |
notandum = Field( title=u"The noted object") notation = Field( title=u"The note") | notandum = Object( title=u"The noted object", schema=IRelatable) notation = Object( title=u"The note", schema=IRelatable) | def __call__(self, event): """Invoke the callback.""" |
notandum = Field( title=u"The noted object") notation = Field( title=u"The note") | custodian = Object( title=u"Custodian", schema=IRelatable) ward = Object( title=u"Ward", schema=IRelatable) | def __call__(self, event): """Invoke the callback.""" |
title=u"The object this facet is augmenting") | title=u"The object this facet is augmenting" description=u""" The object will provide IFaceted, but we cannot declare that without creating a dependency cycle. """) | def __call__(self, event): """Invoke the callback.""" |
title=u"The agent responsible for adding this facet to its __parent__") | title=u"The agent responsible for adding this facet to its __parent__", description=u""" Some facets are attached to an object because the user requested them to be added. Other facets appear on object automatically as a side effect of, for example, group membership. The second sort of facets (called "owned facets") ... | def __call__(self, event): """Invoke the callback.""" |
view.cursor = datetime(2004, 8, 12, tzinfo=utc) | view.cursor = date(2004, 8, 12) | def test_getColumns_periods(self): from schoolbell.app.browser.cal import DailyCalendarView from schoolbell.app.app import Person, Calendar from schoolbell.calendar.utils import parse_datetimetz |
[{'perms': [], 'id': 'zope.authenticated', 'title': 'Authenticated users'}, {'perms': [], 'id': 'zope.unauthenticated', 'title': 'Unauthenticated users'}, | [{'perms': [], 'id': 'zope.authenticated', 'title': u'Authenticated users'}, {'id': 'zope.unauthenticated', 'perms': [], 'title': u'Unauthenticated users'}, | def doctest_ACLView(): r""" Set up for local grants: >>> from zope.app.annotation.interfaces import IAnnotatable >>> from zope.app.securitypolicy.interfaces import \ ... IPrincipalPermissionManager >>> from zope.app.securitypolicy.principalpermission import \ ... Annotat... |
(name, absoluteURL(self.request, app, 'dfschemas', name))] | (name, absoluteURL(self.request, app, 'dfschemas/%s' % name))] | def breadcrumbs(self): app = traverse(self.context, '/') name = self.context.__name__ return [ (_('Start'), absoluteURL(self.request, app, 'start')), (_('Dynamic facet schemas'), absoluteURL(self.request, app, 'dfschemas')), (name, absoluteURL(self.request, app, 'dfschemas', name))] |
datafile_re = re.compile(r'.*\.(pt|js|png|gif|css|mo|rng" "|xml|zcml|ico|pot|po)\Z') | datafile_re = re.compile(r'.*\.(pt|js|png|gif|css|mo' r'|rng|xml|zcml|ico|pot|po)\Z') | def setup(**kwargs): if kwargs.has_key("classifiers"): del kwargs["classifiers"] _setup(**kwargs) |
standalone server or a Zope 3 component. This server allows for people and resources to have individual and group calendars. | standalone server or a Zope 3 component. This server allows people and resources to have individual and group calendars. | def setup(**kwargs): if kwargs.has_key("classifiers"): del kwargs["classifiers"] _setup(**kwargs) |
* Shareable * Overlayable * Access controllable * Importable and exportable to iCal clients (e.g. Apple's iCal or Mozilla Sunbird) * Time zone aware * Provide resource booking * Support for Allday events * Atom feed support for upcoming events | * Shareable * Overlayable * Access controllable * Importable and exportable to iCalendar clients (e.g. Apple's iCal or Mozilla Sunbird) * Timezone-aware * Capable of handling all-day events Upcoming events can be provided using an Atom feed. | def setup(**kwargs): if kwargs.has_key("classifiers"): del kwargs["classifiers"] _setup(**kwargs) |
* Re-usable calendaring Zope 3 components. * iCal parser. * Rigourous functional and unit testing. | * Re-usable calendaring Zope 3 components. * iCalendar parser. * Rigorous functional and unit testing. | def setup(**kwargs): if kwargs.has_key("classifiers"): del kwargs["classifiers"] _setup(**kwargs) |
"Topic :: Office/Business :: Groupware", | def setup(**kwargs): if kwargs.has_key("classifiers"): del kwargs["classifiers"] _setup(**kwargs) | |
while isinstance(requirement, InheritedRequirement): | while requirement.__class__ == InheritedRequirement: | def unwrapRequirement(requirement): """Remove all inherited requirement wrappers.""" while isinstance(requirement, InheritedRequirement): requirement = requirement.original return requirement |
class PersonPreferencesCrowd(ConfigurableCrowd): | def getPreferencesOwner(preferences): """Adapt IPersonPreferences to IPerson""" return interfaces.IPerson(preferences.__parent__) class PersonPreferencesEditorsCrowd(ConfigurableCrowd): | def getPersonPreferences(person): """Adapt an IAnnotatable object to IPersonPreferences.""" annotations = IAnnotations(person) try: return annotations[PERSON_PREFERENCES_KEY] except KeyError: prefs = PersonPreferences() prefs.__parent__ = person annotations[PERSON_PREFERENCES_KEY] = prefs return prefs |
def import_module(filename, cfg): | def import_module(filename, cfg, tracer=None): | def import_module(filename, cfg): """Imports and returns a module.""" filename = os.path.splitext(filename)[0] modname = filename[len(cfg.basedir):].replace(os.path.sep, '.') if modname.startswith('.'): modname = modname[1:] mod = __import__(modname) components = modname.split('.') for comp in components[1:]: mod = get... |
mod = __import__(modname) | if tracer is not None: mod = tracer.runfunc(__import__, modname) else: mod = __import__(modname) | def import_module(filename, cfg): """Imports and returns a module.""" filename = os.path.splitext(filename)[0] modname = filename[len(cfg.basedir):].replace(os.path.sep, '.') if modname.startswith('.'): modname = modname[1:] mod = __import__(modname) components = modname.split('.') for comp in components[1:]: mod = get... |
def get_test_cases(test_files, cfg): | def get_test_cases(test_files, cfg, tracer=None): | def get_test_cases(test_files, cfg): """Returns a list of test cases from a given list of test modules.""" matcher = compile_matcher(cfg.test_regex) results = [] for file in test_files: module = import_module(file, cfg) test_suite = module.test_suite() if test_suite is None: continue if cfg.warn_omitted: all_classes = ... |
module = import_module(file, cfg) test_suite = module.test_suite() | module = import_module(file, cfg, tracer=tracer) if tracer is not None: test_suite = tracer.runfunc(module.test_suite) else: test_suite = module.test_suite() | def get_test_cases(test_files, cfg): """Returns a list of test cases from a given list of test modules.""" matcher = compile_matcher(cfg.test_regex) results = [] for file in test_files: module = import_module(file, cfg) test_suite = module.test_suite() if test_suite is None: continue if cfg.warn_omitted: all_classes = ... |
def get_test_hooks(test_files, cfg): | def get_test_hooks(test_files, cfg, tracer=None): | def get_test_hooks(test_files, cfg): """Returns a list of test hooks from a given list of test modules.""" results = [] dirs = Set(map(os.path.dirname, test_files)) for dir in list(dirs): if os.path.basename(dir) == 'ftests': dirs.add(os.path.join(os.path.dirname(dir), 'tests')) dirs = list(dirs) dirs.sort() for dir in... |
module = import_module(filename, cfg) hooks = module.test_hooks() | module = import_module(filename, cfg, tracer=tracer) if tracer is not None: hooks = tracer.runfunc(module.test_hooks) else: hooks = module.test_hooks() | def get_test_hooks(test_files, cfg): """Returns a list of test hooks from a given list of test modules.""" results = [] dirs = Set(map(os.path.dirname, test_files)) for dir in list(dirs): if os.path.basename(dir) == 'ftests': dirs.add(os.path.join(os.path.dirname(dir), 'tests')) dirs = list(dirs) dirs.sort() for dir in... |
test_cases = get_test_cases(test_files, cfg) | test_cases = get_test_cases(test_files, cfg, tracer=tracer) | def main(argv): """Main program.""" # Environment if sys.version_info < (2, 3): print >> sys.stderr, '%s: need Python 2.3 or later' % argv[0] print >> sys.stderr, 'your python is %s' % sys.version return 1 # Defaults cfg = Options() cfg.basedir = os.path.join(os.path.dirname(argv[0]), 'src') cfg.basedir = os.path.abs... |
test_hooks = get_test_hooks(test_files, cfg) | test_hooks = get_test_hooks(test_files, cfg, tracer=tracer) | def main(argv): """Main program.""" # Environment if sys.version_info < (2, 3): print >> sys.stderr, '%s: need Python 2.3 or later' % argv[0] print >> sys.stderr, 'your python is %s' % sys.version return 1 # Defaults cfg = Options() cfg.basedir = os.path.join(os.path.dirname(argv[0]), 'src') cfg.basedir = os.path.abs... |
if cfg.coverage: import trace ignoremods = ['test'] ignoredirs = [sys.prefix, sys.exec_prefix] tracer = trace.Trace(count=True, trace=False, ignoremods=ignoremods, ignoredirs=ignoredirs) | if tracer is not None: | def main(argv): """Main program.""" # Environment if sys.version_info < (2, 3): print >> sys.stderr, '%s: need Python 2.3 or later' % argv[0] print >> sys.stderr, 'your python is %s' % sys.version return 1 # Defaults cfg = Options() cfg.basedir = os.path.join(os.path.dirname(argv[0]), 'src') cfg.basedir = os.path.abs... |
>>> lastweek = CalendarEvent(datetime.utcnow().replace(hour=12) - | >>> lastweek = CalendarEvent(datetime.now().replace(hour=12) - | def doctest_AtomCalendarView(): r"""Tests for AtomCalendarView. Some setup: >>> setup.placefulSetUp() >>> app = sbsetup.setupSchoolToolSite() >>> sbsetup.setupTimetabling() >>> registerCalendarHelperViews() >>> from schooltool.app.browser.cal import AtomCalendarView >>> from schooltool.app.cal import Calendar >>> f... |
... timedelta(datetime.utcnow().weekday())) | ... timedelta(datetime.now().weekday())) | def doctest_AtomCalendarView(): r"""Tests for AtomCalendarView. Some setup: >>> setup.placefulSetUp() >>> app = sbsetup.setupSchoolToolSite() >>> sbsetup.setupTimetabling() >>> registerCalendarHelperViews() >>> from schooltool.app.browser.cal import AtomCalendarView >>> from schooltool.app.cal import Calendar >>> f... |
u'2005-07-01, Friday' | '2005-07-01, Friday' | def doctest_WeeklyPDFCalendarView(): r"""Tests for WeeklyPDFCalendarView. >>> from schooltool.app.browser.pdfcal import WeeklyPDFCalendarView >>> calendar = ISchoolToolCalendar(Person()) >>> request = TestRequest(form={'date': '2005-07-01'}) >>> view = WeeklyPDFCalendarView(calendar, request) >>> view.getCalendars = l... |
u'2005-07-03, Sunday' | '2005-07-03, Sunday' | def doctest_WeeklyPDFCalendarView(): r"""Tests for WeeklyPDFCalendarView. >>> from schooltool.app.browser.pdfcal import WeeklyPDFCalendarView >>> calendar = ISchoolToolCalendar(Person()) >>> request = TestRequest(form={'date': '2005-07-01'}) >>> view = WeeklyPDFCalendarView(calendar, request) >>> view.getCalendars = l... |
u'2005-07-01, Friday' | '2005-07-01, Friday' | def doctest_MonthlyPDFCalendarView(): r"""Tests for MonthlyPDFCalendarView. >>> from schooltool.app.browser.pdfcal import MonthlyPDFCalendarView >>> calendar = ISchoolToolCalendar(Person()) >>> request = TestRequest(form={'date': '2005-07-01'}) >>> view = MonthlyPDFCalendarView(calendar, request) >>> view.getCalendars... |
u'2005-07-31, Sunday' | '2005-07-31, Sunday' | def doctest_MonthlyPDFCalendarView(): r"""Tests for MonthlyPDFCalendarView. >>> from schooltool.app.browser.pdfcal import MonthlyPDFCalendarView >>> calendar = ISchoolToolCalendar(Person()) >>> request = TestRequest(form={'date': '2005-07-01'}) >>> view = MonthlyPDFCalendarView(calendar, request) >>> view.getCalendars... |
return self.loadResource(r) | try: return self.loadResource(r) finally: r.close() | def loadFile(self, file, url=None): if not url: url = _url_from_file(file) r = self.createResource(file, url) return self.loadResource(r) |
self._parse_resource(section, r, defines) | try: self._parse_resource(section, r, defines) finally: r.close() | def includeConfiguration(self, section, url, defines): url = self.normalizeURL(url) r = self.openResource(url) self._parse_resource(section, r, defines) |
KeyError: 'There is no AccessControlSetting associated with this key.' | KeyError: 'there is no AccessControlSetting associated with this key.' | ... def __repr__(self): |
Attendance status (UNKNOWN, PRESENT, ABSENT, TARDY. | Attendance status (UNKNOWN, PRESENT, ABSENT, TARDY). | def record(section, datetime, duration, period_id, present): """Record the student's absence or presence. |
self.datamgr.add(p) | self.datamgr.root()['p'] = p | def test(self): from schooltool.db import PersistentKeysSet p = PersistentKeysSet() self.datamgr.add(p) a, b = P(), P() self.assertEqual(len(p), 0) p.add(a) self.assertEquals(list(p), [a]) self.assertEqual(len(p), 1) p.add(a) self.assertEquals(list(p), [a]) self.assertEqual(len(p), 1) p.add(b) self.assertEqualsSorted(l... |
expanded = sets.Set() stack = [root] while stack: item = stack.pop() if item is not root and self.groupTreeCtrl.IsExpanded(item): expanded.add(self.groupTreeCtrl.GetPyData(item)[1]) next, cookie = self.groupTreeCtrl.GetFirstChild(item, 0) while next.IsOk(): stack.append(next) next, cookie = self.groupTreeCtrl.GetNextCh... | if root.IsOk(): stack = [root] while stack: item = stack.pop() if item is not root and self.groupTreeCtrl.IsExpanded(item): expanded.add(self.groupTreeCtrl.GetPyData(item)[1]) next, cookie = self.groupTreeCtrl.GetFirstChild(item, 0) while next.IsOk(): stack.append(next) next, cookie = self.groupTreeCtrl.GetNextChild(it... | def _refresh(self): # Get the tree from the server try: group_tree = self.client.getGroupTree() except SchoolToolError, e: self.SetStatusText(str(e)) group_tree = [] else: self.SetStatusText(self.client.status) |
person = app['persons'][username] return person.checkPassword(password) | if username in app['persons']: person = app['persons'][username] return person.checkPassword(password) | def _checkPassword(self, username, password): app = getSchoolBellApplication(self) person = app['persons'][username] return person.checkPassword(password) |
class TimetableDictPublishTraverse(object): | class TimetableDictPublishTraverse(ItemTraverser): | def _traverse(self, request, name): return ITimetables(self.context).timetables |
return self.context[name] except KeyError: app = getSchoolToolApplication() try: term, schema = name.split('.') except ValueError: raise NotFound(self.context, name, request) | return itemTraverse.publishTraverse(request, name) except NotFound: pass app = getSchoolToolApplication() try: term, schema = name.split('.') except ValueError: pass else: | def publishTraverse(self, request, name): # Note: the way the code is written now lets the user access # existing timetables even if their name refers to a deleted # term/schema. Not sure if that is a good or a bad thing. try: return self.context[name] except KeyError: app = getSchoolToolApplication() try: term, schema... |
else: raise NotFound(self.context, name, request) | raise NotFound(self.context, name, request) | def publishTraverse(self, request, name): # Note: the way the code is written now lets the user access # existing timetables even if their name refers to a deleted # term/schema. Not sure if that is a good or a bad thing. try: return self.context[name] except KeyError: app = getSchoolToolApplication() try: term, schema... |
File "<doctest schoolbell.app.tests.test_app.run_unit_tests[3]>", line 3, in test2 self.assertEquals(2 * 2, 5) File "/usr/lib/python2.3/unittest.py", line 302, in failUnlessEqual raise self.failureException, \ | ... | ... def test2(self): |
if event.__parent__ == self.context: if not event.unique_id in my_events: my_events.append(event.unique_id) yield EventForDisplay(event, color1, color2, calendar) else: yield EventForDisplay(event, color1, color2, calendar) | if event.__parent__ is self.context and calendar is not self.context: continue yield EventForDisplay(event, color1, color2, calendar) | def getEvents(self, start_dt, end_dt): """Get a list of EventForDisplay objects for a selected time interval. |
return "".join(traceback.format_exception(*err)) | return "".join(format_exception(basedir=self.cfg.basedir, *err)) | def formatError(self, err): return "".join(traceback.format_exception(*err)) |
f = open("persons.csv", "w") r = open("roster.txt", "w") | persons = open("persons.csv", "w") roster = open("roster.txt", "w") | def createPersons(): """Create a randomly generated persons.csv in the current directory. Format of the file: id, surname, name, groups, dob, comments where groups is a space separated list of groups this pupils is a member of """ f = open("persons.csv", "w") r = open("roster.txt", "w") names = sets.Set() subNames = s... |
print >> f, '"","%s","%s","%s","%s",""' % (surname, name, groups_str, birthday) | print >> persons, '"","%s","%s","%s","%s",""' % (surname, name, groups_str, birthday) | def createPersons(): """Create a randomly generated persons.csv in the current directory. Format of the file: id, surname, name, groups, dob, comments where groups is a space separated list of groups this pupils is a member of """ f = open("persons.csv", "w") r = open("roster.txt", "w") names = sets.Set() subNames = s... |
print >> f, '"","%s","%s","%s teachers","%s",""' % (surname, name, subNames[count], birthday) timetable[count][period] = '%s %s | %s %s' % (\ subjects[subNames[count]], team, name, surname) print >> r, '%s %s' % (\ subjects[subNames[count]], team) | print >> persons, ('"","%s","%s","%s teachers","%s",""' % (surname, name, subNames[count], birthday)) timetable[count][period] = ('%s %s | %s %s' % (subjects[subNames[count]], team, name, surname)) print >> roster, '%s %s' % (subjects[subNames[count]], team) | def createPersons(): """Create a randomly generated persons.csv in the current directory. Format of the file: id, surname, name, groups, dob, comments where groups is a space separated list of groups this pupils is a member of """ f = open("persons.csv", "w") r = open("roster.txt", "w") names = sets.Set() subNames = s... |
print >> r, kid print >> r, "" r.close() f.close() | print >> roster, kid print >> roster, "" roster.close() persons.close() | def createPersons(): """Create a randomly generated persons.csv in the current directory. Format of the file: id, surname, name, groups, dob, comments where groups is a space separated list of groups this pupils is a member of """ f = open("persons.csv", "w") r = open("roster.txt", "w") names = sets.Set() subNames = s... |
print >> f, '''"2004-fall","default" "" "Day 1" "","A","B"''' for count in range(1,9): | print >> f, '"2004-fall","default"' print >> f, '""' print >> f, '"Day 1"' print >> f, '"","A","B"' for count in range(1, 9): | def createTimetable(): f = open("timetable.csv", "w") print >> f, '''"2004-fall","default" |
timetable[count-1][1]) print >> f, '''"" "Day 2" "","C","D"''' for count in range(1,9): | timetable[count-1][1]) print >> f, '""' print >> f, '"Day 2"' print >> f, '"","C","D"' for count in range(1, 9): | def createTimetable(): f = open("timetable.csv", "w") print >> f, '''"2004-fall","default" |
do("bin/mkschooltoolinstance -d`pwd`/../i -uadmin:123") | do("bin/mkschooltoolinst -d`pwd`/../i -uadmin:123") os.chdir('../i') | def do(command): print command if os.system(command): sys.exit(1) |
class TestMonthlyCalendarView(NiceDiffsMixin, unittest.TestCase): | class TestMonthlyCalendarView(unittest.TestCase): | def test_render(self): from schooltool.browser.cal import DailyCalendarView from schooltool.cal import CalendarEvent, Calendar from schooltool.model import Person |
' <h3>\n' ' <a href="delete_event.html?event_id=id">[X]</a>\n' ' <a href="edit_event.html?event_id=id">Main event</a>\n' ' </h3>\n' | ' \n' ' <div class="dellink">\n' ' <a href="delete_event.html?event_id=id">[delete]</a>\n' ' </div>\n' ' <h3>\n' ' <a href="edit_event.html?event_id=id">Main event</a>\n' ' </h3>\n' ' \n' | def test(self): from schooltool.cal import CalendarEvent from schooltool.browser.cal import CalendarEventView ev = CalendarEvent(datetime(2004, 12, 01, 12, 01), timedelta(hours=1), "Main event", unique_id="id") view = CalendarEventView(ev) request = RequestStub() |
results = [item for item in self.context.values() | results = [item for item in sorted | def update(self): if 'SEARCH' in self.request: searchstr = self.request['SEARCH'].lower() results = [item for item in self.context.values() if searchstr in item.title.lower()] else: results = list(self.context.values()) |
results = list(self.context.values()) | results = list(sorted) | def update(self): if 'SEARCH' in self.request: searchstr = self.request['SEARCH'].lower() results = [item for item in self.context.values() if searchstr in item.title.lower()] else: results = list(self.context.values()) |
self.assertEquals(name, 'new-resource') | self.assertEquals(name, 'Resource') | def test_post_with_a_description(self): name = self.test_post(body=''' <object title="New Resource" description="A new resource" xmlns='http://schooltool.org/ns/model/0.1'/>''') self.assertEquals(self.app['resources'][name].title, 'New Resource') self.assertEquals(self.app['resources'][name].description, 'A new resourc... |
def name_of_test(test): | DocFileCase_classes = (doctest.DocFileCase,) def name_of_test(test, basedir=None): | def name_of_test(test): """Return the name of a test. In most cases the name will be "package.module.class.method", however it is different for doctest files. """ return test.id() |
is different for doctest files. | is different for doctest files, where it will be "subdir/subdir/filename". | def name_of_test(test): """Return the name of a test. In most cases the name will be "package.module.class.method", however it is different for doctest files. """ return test.id() |
return test.id() def filter_testsuite(suite, matcher, level=None): | if isinstance(test, DocFileCase_classes): doctest_filename = os.path.abspath(str(test)) if basedir and doctest_filename.startswith(basedir + '/'): doctest_filename = doctest_filename[len(basedir) + 1:] return doctest_filename else: return test.id() def filter_testsuite(suite, matcher, level=None, basedir=None): | def name_of_test(test): """Return the name of a test. In most cases the name will be "package.module.class.method", however it is different for doctest files. """ return test.id() |
testname = name_of_test(test) | testname = name_of_test(test, basedir) | def filter_testsuite(suite, matcher, level=None): """Return a flattened list of test cases that match the given matcher.""" if not isinstance(suite, unittest.TestSuite): raise TypeError('not a TestSuite', suite) results = [] for test in suite._tests: if level is not None and getattr(test, 'level', 0) > level: continue ... |
filtered = filter_testsuite(test, matcher, level) | filtered = filter_testsuite(test, matcher, level, basedir) | def filter_testsuite(suite, matcher, level=None): """Return a flattened list of test cases that match the given matcher.""" if not isinstance(suite, unittest.TestSuite): raise TypeError('not a TestSuite', suite) results = [] for test in suite._tests: if level is not None and getattr(test, 'level', 0) > level: continue ... |
filtered = filter_testsuite(test_suite, matcher, cfg.level) | filtered = filter_testsuite(test_suite, matcher, cfg.level, cfg.basedir) | def get_test_cases(test_files, cfg, tracer=None): """Return a list of test cases from a given list of test modules.""" matcher = compile_matcher(cfg.test_regex) results = [] startTime = time.time() for file in test_files: module = import_module(file, cfg, tracer=tracer) try: func = module.test_suite except AttributeErr... |
return name_of_test(test) | return name_of_test(test, self.cfg.basedir) | def getDescription(self, test): return name_of_test(test) |
s = name_of_test(test) | s = name_of_test(test, self.cfg.basedir) | def getShortDescription(self, test): s = name_of_test(test) if len(s) > self._maxWidth: # In most cases s is "package.module.class.method". # Try to keep the method name intact, and replace the middle # part of "package.module.class" with an ellipsis. namelen = len(s.split('.')[-1]) left = max(0, (self._maxWidth - name... |
print "\n".join([name_of_test(test) for test in test_cases]) | print "\n".join([name_of_test(test, cfg.basedir) for test in test_cases]) | def main(argv): """Main program.""" # Environment if sys.version_info < (2, 3): print >> sys.stderr, '%s: need Python 2.3 or later' % argv[0] print >> sys.stderr, 'your python is %s' % sys.version return 1 # Defaults cfg = Options() cfg.basedir = os.path.join(os.path.dirname(argv[0]), 'src') cfg.basedir = os.path.abs... |
menu.AppendItem(item) | getattr(menu, item[0])(*item[1:]) | def menu(title, *items): menu = wxMenu() for item in items: menu.AppendItem(item) return menu, title |
return wxMenuItem(kind=wxITEM_SEPARATOR) | return ('AppendSeparator', ) | def separator(): return wxMenuItem(kind=wxITEM_SEPARATOR) |
item = wxMenuItem(None, id, title, description) | def item(title, description='', action=None, id=None): if not id: id = wxNewId() item = wxMenuItem(None, id, title, description) if action: EVT_MENU(self, id, action) return item | |
return item | return ('Append', id, title, description) | def item(title, description='', action=None, id=None): if not id: id = wxNewId() item = wxMenuItem(None, id, title, description) if action: EVT_MENU(self, id, action) return item |
submenu = wxMenu() for item in items: submenu.AppendItem(item) | def submenu(title, *items, **kw): description = kw.get('description', '') id = kw.get('id', None) submenu = wxMenu() for item in items: submenu.AppendItem(item) if not id: id = wxNewId() item = wxMenuItem(None, id, title, description, subMenu=submenu) return item | |
item = wxMenuItem(None, id, title, description, subMenu=submenu) return item | submenu, title = menu(title, items) return ('AppendMenu', id, title, submenu, description) | def submenu(title, *items, **kw): description = kw.get('description', '') id = kw.get('id', None) submenu = wxMenu() for item in items: submenu.AppendItem(item) if not id: id = wxNewId() item = wxMenuItem(None, id, title, description, subMenu=submenu) return item |
>>> request = TestRequest(form={'field.title': 'NonHackig', | >>> request = TestRequest(form={'field.title': 'NonHacking', | def doctest_CalendarEventEditView_edit(): r"""Tests for CalendarEventEditView editing of new event. Let's create an event: >>> import datetime >>> event = CalendarEvent(title="Hacking", ... dtstart=datetime.datetime(2004, 8, 13, 20, 0), ... duration=datetime.timedelta(minut... |
test_files = get_test_files(cfg) if cfg.list_tests or cfg.run_tests: test_cases = get_test_cases(test_files, cfg, tracer=tracer) if cfg.list_hooks or cfg.run_tests: test_hooks = get_test_hooks(test_files, cfg, tracer=tracer) import logging logging.basicConfig() logging.root.setLevel(logging.CRITICAL) | def main(argv): """Main program.""" # Environment if sys.version_info < (2, 3): print >> sys.stderr, '%s: need Python 2.3 or later' % argv[0] print >> sys.stderr, 'your python is %s' % sys.version return 1 # Defaults cfg = Options() cfg.basedir = os.path.join(os.path.dirname(argv[0]), 'src') cfg.basedir = os.path.abs... | |
def title(self): """This is required for the site calendar views to work.""" | def _title(self): """This is required for the site calendar views to work. Calendar views expect that their underlying objects (calendar parents) have an attribute named `title`. """ | def title(self): """This is required for the site calendar views to work.""" # XXX This docstring does not explain anything at all. It does hint # at the fact that an ugly hack is hiding beneath. return IApplicationPreferences(self).title |
title = property(title) | title = property(_title) | def title(self): """This is required for the site calendar views to work.""" # XXX This docstring does not explain anything at all. It does hint # at the fact that an ugly hack is hiding beneath. return IApplicationPreferences(self).title |
"ISchooldaySlotss (got %r)" % (obj,)) | "ISchooldaySlots (got %r)" % (obj,)) | def add(self, obj): if not ISchooldaySlot.providedBy(obj): raise TypeError("SchooldayTemplate can only contain " "ISchooldaySlotss (got %r)" % (obj,)) self.events.add(obj) |
... for ar in sorted(sa.getAllForDay(day)): | ... def key(ar): ... return (ar.datetime, ar.section.title) ... for ar in sorted(sa.getAllForDay(day), key=key): | >>> def print_for(day): |
2005-12-07 A Chem False | >>> def print_for(day): | |
... for ar in sorted(sa.filter(first, last)): | ... def key(ar): ... return (ar.datetime, ar.section.title) ... for ar in sorted(sa.filter(first, last), key=key): | >>> def print_for(first, last): |
2005-12-07 B Math False >>> print_for(dt2a.date(), dt3a.date()) | >>> def print_for(first, last): | |
2005-12-07 A Chem False | >>> def print_for(first, last): | |
>>> request.setPrincipal(ConformantStub(object())) | >>> request.setPrincipal(ConformantStub(person)) | >>> def redirected(request, day, person='person'): |
from schooltool.interfaces import ILocation | def test_interface(self): from schooltool.timetable import Term from schooltool.interfaces import ITerm, ITermWrite from schooltool.interfaces import ILocation | |
from schooltool.interfaces import ILocation | def test_interface(self): from schooltool.timetable import Timetable from schooltool.interfaces import ITimetable, ITimetableWrite from schooltool.interfaces import ILocation | |
key = 'schoolbell.app.PersonPreferences' | def getPersonPreferences(person): """Adapt an IAnnotatable object to IPersonPreferences.""" annotations = IAnnotations(person) key = 'schoolbell.app.PersonPreferences' try: return annotations[key] except KeyError: annotations[key] = PersonPreferences() annotations[key].__parent__ = person return annotations[key] | |
return annotations[key] | return annotations[PERSON_PREFERENCES_KEY] | def getPersonPreferences(person): """Adapt an IAnnotatable object to IPersonPreferences.""" annotations = IAnnotations(person) key = 'schoolbell.app.PersonPreferences' try: return annotations[key] except KeyError: annotations[key] = PersonPreferences() annotations[key].__parent__ = person return annotations[key] |
annotations[key] = PersonPreferences() annotations[key].__parent__ = person return annotations[key] | prefs = PersonPreferences() prefs.__parent__ = person annotations[PERSON_PREFERENCES_KEY] = prefs return prefs | def getPersonPreferences(person): """Adapt an IAnnotatable object to IPersonPreferences.""" annotations = IAnnotations(person) key = 'schoolbell.app.PersonPreferences' try: return annotations[key] except KeyError: annotations[key] = PersonPreferences() annotations[key].__parent__ = person return annotations[key] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.