code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
# coding: utf-8
# imports
import re
# django imports
from django import template
from django.contrib.contenttypes.models import ContentType
from django.contrib import admin
from django.db import models
from django.db.models import Q
from django.contrib.auth.models import Group
# grappelli imports
from grappelli.mode... | Python |
# coding: utf-8
from django.conf import settings
# Admin Site Title
ADMIN_HEADLINE = getattr(settings, "GRAPPELLI_ADMIN_HEADLINE", 'Fimu 2010')
ADMIN_TITLE = getattr(settings, "GRAPPELLI_ADMIN_TITLE", 'Fimu 2010')
# Link to your Main Admin Site (no slashes at start and end)
ADMIN_URL = getattr(settings, "GRAPPELLI_A... | Python |
# coding: utf-8
from django.contrib import admin
from django.utils.translation import ugettext as _
from django import forms
from django.conf import settings
from grappelli.models.navigation import Navigation, NavigationItem
from grappelli.models.bookmarks import Bookmark, BookmarkItem
from grappelli.models.help impo... | Python |
# coding: utf-8
import re
from django import http, template
from django.contrib.admin import ModelAdmin
from django.contrib.admin import actions
from django.contrib.auth import authenticate, login
from django.db.models.base import ModelBase
from django.core.exceptions import ImproperlyConfigured
from django.core.urlre... | Python |
# -*- encoding: utf-8 -*-
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
# Liste des applications pour le moteur de rubrique
APPS = [('home', _('Page d\'accueil')), ('page', _('Page')), ('sitemap', _('Plan du site'))]
for apps in settings.INSTALLED_APPS:
app = apps.split... | Python |
# -*- encoding: utf-8 -*-
from django.db import models
from multilingual.translation import TranslationModel
from django.utils.translation import ugettext_lazy as _
from modulo.page.models import Section
class Gallery(models.Model):
section = models.ForeignKey(Section, related_name="galleries",
... | Python |
# -*- encoding: utf-8 -*-
from django.conf import settings
from filebrowser import settings as fb_settings
import re
import os
def get_images(path):
# Precompile regular expressions
filter_re = []
for exp in fb_settings.EXCLUDE:
filter_re.append(re.compile(exp))
for k,v in fb_settings.VERSIONS... | Python |
# -*- encoding: utf-8 -*-
from models import Gallery
from django.contrib import admin
admin.site.register(Gallery)
| Python |
# -*- encoding: utf-8 -*-
from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.decorators import user_passes_test
from django.views.decorators.cache import cache_page
from models import Gallery
@cache_page(60 * 15)
def galleries(reques... | Python |
logger = None
| Python |
'''
Created on 17-Mar-2011
@author: xie
'''
######################## matrix ##################
import math
import re
import global_var
class SparseVector:
'''
A class that implement the sparse vector,
in which the data is organized as a dic.
And the dimension to be infinite.
'''
vec = None
... | Python |
###################### construct graph ##########################
###### the version : complete sub-graph with super node
import matrix
import global_var
### twitter api agent ###
import twitter
import MySQLdb
import cPickle as pickle
class TwitterApiAgentDB:
api = twitter.Api( \
consumer_ke... | Python |
#!/usr/bin/python
# Copyright 2011 Google, Inc. All Rights Reserved.
# simple script to walk source tree looking for third-party licenses
# dumps resulting html page to stdout
import os, re, mimetypes, sys
# read source directories to scan from command line
SOURCE = sys.argv[1:]
# regex to find /* */ style commen... | Python |
# -*- coding: iso-8859-1 -*-
########################################################################################################
### LICENSE
########################################################################################################
#
# findmyhash.py - v 1.1.2
#
# This script is under GPL v3 License ... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#License: GPL
#Copyright(C)Bill Lee
#Modified By(C) Finalx
#To veiw the weather of a different city, go to www.weather.com.cn to search your city. Then replace "101220501" below with the number in the URL of weather of your city.
import os
os.system(r"w3m -no-cookie -no-gra... | Python |
import sys
import os.path
# This is a tiny script to help you creating a CSV file from a face
# database with a similar hierarchie:
#
# philipp@mango:~/facerec/data/at$ tree
# .
# |-- README
# |-- s1
# | |-- 1.pgm
# | |-- ...
# | |-- 10.pgm
# |-- s2
# | |-- 1.pgm
# | |-- ...
# | |-- 10.pgm
# .... | Python |
#!/usr/bin/env python
import os
import subprocess
import pygtk
pygtk.require('2.0')
import gtk
import time
import threading
import gobject
gobject.threads_init()
class LogViewer(threading.Thread):
mInFile = ""
mTextBuffer = None
mOldStrings = ""
mStoped = False
def close_application(self, widget... | Python |
#! /usr/bin/env python
import sys
import xml.etree.ElementTree as ET
def getpath(elem, path):
if len(list(elem)):
path = path + "." + elem.attrib['name']
for child in elem:
getpath(child, path)
else:
print path + "." + elem.attrib['name']
tree = ET.parse(sys.argv[1])
root ... | Python |
#!/usr/bin/env python
import sys
def check_arg():
if (sys.argv.__len__() != 3):
print "usage:" + sys.argv[0] + " source_file dest_file"
exit()
check_arg()
origfile = open(sys.argv[1], 'r')
reached = False
size_count = 0
while (not reached):
if (origfile.read(1) == '\n'):
reached = ... | Python |
#!/usr/bin/env python
import sys,os,FetchMail
def copyfile(src,dest):
fsrc=file(src,"rb")
fdest=file(dest,"wb")
fdest.write(fsrc.read())
fsrc.close()
fdest.close()
list=["aPhoneLocate_Windows,py","mail_address","mail_passwd","maproad","14","path.png"]
if(len(sys.argv)<=2 or sys.argv[1]=="hel... | Python |
#!/usr/bin/env python
import imaplib,getpass,time,os,sys,urllib2
def FetchMail(user,passwd,maptyp="roadmap",zoom=14):
if(user.endswith("gmail.com")):
M=imaplib.IMAP4_SSL("imap.gmail.com")
elif(user.endswith("163.com")):
M=imaplib.IMAP4_SSL("imap.163.com",993)
else:
print("email not... | Python |
#!/usr/bin/env python
import os,sys,FetchMail,time,threading
try:
import pygtk
pygtk.require("2.0")
except:
pass
try:
import gtk
import gtk.glade
except:
print("This program need to be run in graphical environment!")
sys.exit(1)
result="false"
class FMthread(threading.Thread):
def __in... | Python |
#!/usr/bin/env python
import sys,os,FetchMail
def copyfile(src,dest):
fsrc=file(src,"rb")
fdest=file(dest,"wb")
fdest.write(fsrc.read())
fsrc.close()
fdest.close()
list=["aPhoneLocate_Windows,py","mail_address","mail_passwd","maproad","14","path.png"]
if(len(sys.argv)<=2 or sys.argv[1]=="hel... | Python |
#!/usr/bin/env python
import imaplib,getpass,time,os,sys,urllib2
def FetchMail(user,passwd,maptyp="roadmap",zoom=14):
if(user.endswith("gmail.com")):
M=imaplib.IMAP4_SSL("imap.gmail.com")
elif(user.endswith("163.com")):
M=imaplib.IMAP4_SSL("imap.163.com",993)
else:
print("email not... | Python |
#!/usr/bin/env python
import os,sys,FetchMail,time,threading
try:
import pygtk
pygtk.require("2.0")
except:
pass
try:
import gtk
import gtk.glade
except:
print("This program need to be run in graphical environment!")
sys.exit(1)
result="false"
class FMthread(threading.Thread):
def __in... | Python |
import os
import re
import sys
from System.Diagnostics import Process
def Main():
asmFileName, vcsDirectory = HandleArguments()
revNr = QueryRevNr(vcsDirectory)
underTeamCity, buildNr = DetectTeamCityAndBuildNr()
asvFileName = InsertVerInfix(asmFileName)
PatchAssemblyInf... | Python |
import re
import sys
ccf = open("CC_base.cs", "r", 1)
cc0 = open("CC0_forward.cs", "w")
cc1 = open("CC1_forward.cs", "w")
#############################################################################
def transform_headline (headline):
pattern = re.compile(r"int\s+firstIndex\,?\s*")
cha... | Python |
import os
import re
import sys
from System.Diagnostics import Process
def Main():
asmFileName, vcsDirectory = HandleArguments()
revNr = QueryRevNr(vcsDirectory)
underTeamCity, buildNr = DetectTeamCityAndBuildNr()
asvFileName = InsertVerInfix(asmFileName)
PatchAssemblyInf... | Python |
import re
import sys
ccf = open("CC_base.cs", "r", 1)
cc0 = open("CC0_forward.cs", "w")
cc1 = open("CC1_forward.cs", "w")
#############################################################################
def transform_headline (headline):
pattern = re.compile(r"int\s+firstIndex\,?\s*")
cha... | Python |
import os
import re
os.system("svn info .. > svn-info.txt")
revision = ""
revision_pattern = re.compile(r"Revision:\s*(\d+)\D*")
revision_found = False
version_line_pattern = re.compile(r".*Assembly.*Version\D*\d+.\d+.(\d+).(\d+).*")
info_f = open("svn-info.txt", "r", 1)
for line in info_f:
match... | Python |
import os
import re
import sys
from System.Diagnostics import Process
def Main():
asmFileName, vcsDirectory = HandleArguments()
revNr = QueryRevNr(vcsDirectory)
underTeamCity, buildNr = DetectTeamCityAndBuildNr()
asvFileName = InsertVerInfix(asmFileName)
PatchAssemblyInf... | Python |
import re
import sys
ccf = open("CC_base.cs", "r", 1)
cc0 = open("CC0_forward.cs", "w")
cc1 = open("CC1_forward.cs", "w")
#############################################################################
def transform_headline (headline):
pattern = re.compile(r"int\s+firstIndex\,?\s*")
cha... | Python |
import os
import re
import sys
from System.Diagnostics import Process
def Main():
versionTemplate, fileNames = HandleArguments()
revNr = QueryRevNr(".")
underTeamCity, buildNr = DetectTeamCityAndBuildNr()
versionStr = HandleVersion(versionTemplate, revNr, buildNr, underTeamCity)
... | Python |
import re
ccf = open("CC_base.cs", "r", 1)
cc0 = open("CC0_forward.cs", "w")
cc1 = open("CC1_forward.cs", "w")
#############################################################################
def transform_headline (headline):
pattern = re.compile(r"int\s+firstIndex\,?\s*")
changed_headlin... | Python |
#!/usr/bin/env python
"""
EVENNIA SERVER STARTUP SCRIPT
This is the start point for running Evennia.
Sets the appropriate environmental variables and launches the server
and portal through the runner. Run without arguments to get a
menu. Run the script with the -h flag to see usage information.
"""
import os
import... | Python |
"""
This defines the cmdset for the red_button. Here we have defined
the commands and the cmdset in the same module, but if you
have many different commands to merge it is often better
to define the cmdset separately, picking and choosing from
among the available commands as to what should be included in the
cmdset -... | Python |
"""
This is the second component of using a Command in your game - a
command set. A cmdset groups any number of commands together. CmdSets
are stored on character and objects and all available cmdsets are
searched when Evennia tries to determine if a command is
available. Sets can be merged and combined in many differ... | Python |
"""
Inherit from this and
overload the member functions to define your own commands.
See src/commands/default/muxcommand.py for an example.
"""
from src.commands.command import Command as BaseCommand
from src.commands.default.muxcommand import MuxCommand as BaseMuxCommand
from src.utils import utils
class Mux... | Python |
"""
Custom at_initial_setup method. This allows you to hook special
modifications to the initial server startup process. Note that this
will only be run once - when the server starts up for the very first
time! It is called last in the startup process and can thus be used to
overload things that happened before it.
Th... | Python |
#
# MSSP (Mud Server Status Protocol) meta information
#
# MUD website listings (that you have registered with) can use this
# information to keep up-to-date with your game stats as you change
# them. Also number of currently active players and uptime will
# automatically be reported. You don't have to fill in everyth... | Python |
"""
This is an example module for holding custom lock funcs, used in
in-game locks. The modules available to use as lockfuncs are defined
in the tuple settings.LOCK_FUNC_MODULES.
All functions defined globally in this module are assumed to be
available for use in lockstrings to determine access. See
http://code.goog... | Python |
#
# This module holds textual connection screen definitions. All global
# string variables (only) in this module are read by Evennia and
# assumed to define a Connection screen. You can change which module is
# used with settings.CONNECTION_SCREEN_MODULE.
#
# The names of the string variables doesn't matter (except ... | Python |
#
# Example module holding functions for out-of-band protocols to
# import and map to given commands from the client. This module
# is selected by settings.OOB_FUNC_MODULE.
#
# All functions defined global in this module will be available
# for the oob system to call. They will be called with a session/character
# a... | Python |
"""
These are the base object typeclasses, a convenient shortcut to the
objects in src/objects/objects.py. You can start building your game
from these bases if you want.
To change these defaults to point to some other object,
change some or all of these variables in settings.py:
BASE_OBJECT_TYPECLASS
BASE_C... | Python |
"""
This is a more advanced example object. It combines functions from
script.examples as well as commands.examples to make an interactive
button typeclass.
Create this button with
@create/drop examples.red_button.RedButton
Note that if you must drop the button before you can see its messages!
"""
import random... | Python |
#
# Batchcode script
#
#
# The Batch-code processor accepts full python modules (e.g. "batch.py") that
# looks identical to normal Python files with a few exceptions that allows them
# to the executed in blocks. This way of working assures a sequential execution
# of the file and allows for features like stepping from... | Python |
"""
The base object to inherit from when implementing new Scripts.
Scripts are objects that handle everything in the game having
a time-component (i.e. that may change with time, with or without
a player being involved in the change). Scripts can work like "events",
in that they are triggered at regular intervals to d... | Python |
"""
Example of scripts.
These are scripts intended for a particular object - the
red_button object type in gamesrc/types/examples. A few variations
on uses of scripts are included.
"""
from game.gamesrc.scripts.basescript import Script
from game.gamesrc.commands.examples import cmdset_red_button as cmdsetexamples
#... | Python |
"""
Example script for testing. This adds a simple timer that
has your character make observations and noices at irregular
intervals.
To test, use
@script me = examples.bodyfunctions.BodyFunctions
The script will only send messages to the object it
is stored on, so make sure to put it on yourself
or you won't see... | Python |
#!/usr/bin/env python
"""
Set up the evennia system. A first startup consists of giving
the command './manage syncdb' to setup the system and create
the database.
"""
import sys
import os
# Tack on the root evennia directory to the python path.
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__fil... | Python |
#!/usr/bin/env python
"""
This runner is controlled by evennia.py and should normally not be
launched directly. It manages the two main Evennia processes (Server
and Portal) and most importanly runs a passive, threaded loop that
makes sure to restart Server whenever it shuts down.
Since twistd does not allow for ... | Python |
"""
ANSI -> html converter
Credit for original idea and implementation
goes to Muhammad Alkarouri and his
snippet #577349 on http://code.activestate.com.
(extensively modified by Griatch 2010)
"""
import re
import cgi
from src.utils import ansi
class TextToHTMLparser(object):
"""
This class describes a p... | Python |
"""
General helper functions that don't fit neatly under any given category.
They provide some useful string and conversion methods that might
be of use when designing your own game.
"""
import os, sys, imp
import textwrap
import datetime
import random
from twisted.internet import threads
from django.conf import se... | Python |
"""
Dummy client runner
This module implements a stand-alone launcher for stress-testing
an Evennia game. It will launch any number of fake clients. These
clients will log into the server and start doing random operations.
Customizing and weighing these operations differently depends on
which type of game is tested. T... | Python |
"""
This file contains the core methods for the Batch-command- and
Batch-code-processors respectively. In short, these are two different
ways to build a game world using a normal text-editor without having
to do so 'on the fly' in-game. They also serve as an automatic backup
so you can quickly recreate a world also aft... | Python |
"""
ANSI - Gives colour to text.
Use the codes defined in ANSIPARSER in your text
to apply colour to text according to the ANSI standard.
Examples:
This is %crRed text%cn and this is normal again.
This is {rRed text{n and this is normal again.
Mostly you should not need to call parse_ansi() explicitly;
it is run... | Python |
"""
Logging facilities
This file should have an absolute minimum in imports. If you'd like to layer
additional functionality on top of some of the methods below, wrap them in
a higher layer module.
"""
from traceback import format_exc
from twisted.python import log
from src.utils import utils
def log_trace(errmsg=No... | Python |
"""
Debug mechanisms for easier developing advanced game objects
The functions in this module are intended to stress-test various
aspects of an in-game entity, notably objects and scripts, during
development. This allows to run several automated tests on the
entity without having to do the testing by creating/delet... | Python |
import os.path
import warnings
__version__ = (0, 2)
def _get_git_revision(path):
revision_file = os.path.join(path, 'refs', 'heads', 'master')
if not os.path.exists(revision_file):
return None
fh = open(revision_file, 'r')
try:
return fh.read()
finally:
fh.close()
def get_... | Python |
"""
This is mostly unmodified from the original idmapper.
Evennia changes:
The cache mechanism was changed from a WeakValueDictionary to a
normal dictionary. The old way caused very hard-to-diagnose bugs
over long periods of time (which Evennia requires)
added save() overloading mechanism to update cache
... | Python |
from django.db.models.manager import Manager
class SharedMemoryManager(Manager):
# TODO: improve on this implementation
# We need a way to handle reverse lookups so that this model can
# still use the singleton cache, but the active model isn't required
# to be a SharedMemoryModel.
def get(self, **... | Python |
from django.db.models import *
from base import SharedMemoryModel | Python |
from django.test import TestCase
from base import SharedMemoryModel
from django.db import models
class Category(SharedMemoryModel):
name = models.CharField(max_length=32)
class RegularCategory(models.Model):
name = models.CharField(max_length=32)
class Article(SharedMemoryModel):
name = models.CharField... | Python |
"""
The gametime module handles the global passage of time in the mud.
It also supplies some useful methods to convert between
in-mud time and real-world time as well allows to get the
total runtime of the server and the current uptime.
"""
from django.conf import settings
from src.scripts.scripts import Script
from ... | Python |
"""
This module gathers all the essential database-creation
methods for the game engine's various object types.
Only objects created 'stand-alone' are in here,
e.g. object Attributes are always created directly through their
respective objects.
The respective object managers hold more methods for
manipulating and sear... | Python |
"""
These are actions for the dummy client runner, using
the default command set and intended for unmodified Evennia.
Each client action is defined as a function. The clients
will perform these actions randomly (except the login action).
Each action-definition function should take one argument- "client",
which is ... | Python |
"""
This is a convenient container gathering all the main
search methods for the various database tables.
It is intended to be used e.g. as
> from src.utils import search
> match = search.objects(...)
Note that this is not intended to be a complete listing of all search
methods! You need to refer to the respectiv... | Python |
"""
A cmdset holds a set of commands available to the object or to other
objects near it. All the commands a player can give (look, @create etc)
are stored as the default cmdset on the player object and managed using the
CmdHandler object (see cmdhandler.py).
The power of having command sets in CmdSets like this is th... | Python |
"""
CmdSethandler
The Cmdhandler tracks an object's 'Current CmdSet', which is the
current merged sum of all CmdSets added to it.
A CmdSet constitues a set of commands. The CmdSet works as a special
intelligent container that, when added to other CmdSet make sure that
same-name commands are treated correctly (usually... | Python |
"""
Batch processors
These commands implements the 'batch-command' and 'batch-code'
processors, using the functionality in src.utils.batchprocessors.
They allow for offline world-building.
Batch-command is the simpler system. This reads a file (*.ev)
containing a list of in-game commands and executes them in seque... | Python |
"""
Admin commands
"""
import time, re
from django.conf import settings
from django.contrib.auth.models import User
from src.players.models import PlayerDB
from src.server.sessionhandler import SESSIONS
from src.server.models import ServerConfig
from src.utils import utils
from src.commands.default.muxcommand import... | Python |
"""
Building and world design commands
"""
from django.conf import settings
from src.objects.models import ObjectDB, ObjAttribute
from src.players.models import PlayerAttribute
from src.utils import create, utils, debug
from src.commands.default.muxcommand import MuxCommand
# used by @find
CHAR_TYPECLASS = settin... | Python |
"""
The command template for the default MUX-style command set
"""
from src.utils import utils
from src.commands.command import Command
class MuxCommand(Command):
"""
This sets up the basis for a MUX command. The idea
is that most other Mux-related commands should just
inherit from this and don't hav... | Python |
"""
Comsystem command module.
Comm commands are OOC commands and intended to be made available to
the Player at all times (they go into the PlayerCmdSet). So we
make sure to homogenize self.caller to always be the player object
for easy handling.
"""
from django.conf import settings
from src.comms.models import Cha... | Python |
"""
System commands
These are the default commands called by the system commandhandler
when various exceptions occur. If one of these commands are not
implemented and part of the current cmdset, the engine falls back
to a default solution instead.
Some system commands are shown in this module
as a REFERENCE only (th... | Python |
"""
This module describes the unlogged state of the default game.
The setting STATE_UNLOGGED should be set to the python path
of the state instance in this module.
"""
from src.commands.cmdset import CmdSet
from src.commands.default import unloggedin
class UnloggedinCmdSet(CmdSet):
"""
Sets up the unlogged cmd... | Python |
"""
This is the cmdset for OutOfCharacter (OOC) commands. These are
stored on the Player object and should thus be able to handle getting
a Player object as caller rather than a Character.
"""
from src.commands.cmdset import CmdSet
from src.commands.default import help, comms, general, admin
class OOCCmdSet(CmdSet)... | Python |
"""
This module ties together all the commands of the default command
set. Note that some commands, such as communication-commands are
instead put in the OOC cmdset.
"""
from src.commands.cmdset import CmdSet
from src.commands.default import general, help, admin, system
from src.commands.default import building
from s... | Python |
# -*- coding: utf-8 -*-
"""
** OBS - this is not a normal command module! **
** You cannot import anything in this module as a command! **
This is part of the Evennia unittest framework, for testing the
stability and integrity of the codebase during updates. This module
test the default command set. It is instantiat... | Python |
"""
The help command. The basic idea is that help texts for commands
are best written by those that write the commands - the admins. So
command-help is all auto-loaded and searched from the current command
set. The normal, database-tied help system is used for collaborative
creation of other help topics such as RP help... | Python |
"""
System commands
"""
import traceback
import os, datetime, time
import django, twisted
from django.contrib.auth.models import User
from django.conf import settings
from src.server.sessionhandler import SESSIONS
from src.scripts.models import ScriptDB
from src.objects.models import ObjectDB
from src.players.model... | Python |
"""
Generic command module. Pretty much every command should go here for
now.
"""
import time
from django.conf import settings
from src.server.sessionhandler import SESSIONS
from src.utils import utils
from src.objects.models import ObjectNick as Nick
from src.commands.default.muxcommand import MuxCommand
AT_SEARCH_RE... | Python |
"""
Commands that are available from the connect screen.
"""
import re
import traceback
from django.conf import settings
from django.contrib.auth.models import User
from src.server import sessionhandler
from src.players.models import PlayerDB
from src.objects.models import ObjectDB
from src.server.models import Server... | Python |
#
# This is Evennia's default connection screen. It is imported
# and run from game/gamesrc/world/connection_screens.py.
#
from src.utils import utils
DEFAULT_SCREEN = \
"""{b=============================================================={n
Welcome to {gEvennia{n, version %s!
If you have an existing account, co... | Python |
"""
The default command parser. Use your own by assigning
settings.ALTERNATE_PARSER to a Python path to a module containing the
replacing cmdparser function. The replacement parser must
return a CommandCandidates object.
"""
def cmdparser(raw_string, cmdset, caller, match_index=None):
"""
This function is call... | Python |
"""
The base Command class.
All commands in Evennia inherit from the 'Command' class in this module.
"""
from src.locks.lockhandler import LockHandler
from src.utils.utils import is_iter
class CommandMeta(type):
"""
This metaclass makes some minor on-the-fly convenience fixes to the command
class in ca... | Python |
"""
Command handler
This module contains the infrastructure for accepting commands on the
command line. The process is as follows:
1) The calling object (caller) inputs a string and triggers the command parsing system.
2) The system checks the state of the caller - loggedin or not
3) If no command string was supplie... | Python |
#
# This file defines global variables that will always be
# available in a view context without having to repeatedly
# include it. For this to work, this file is included in
# the settings file, in the TEMPLATE_CONTEXT_PROCESSORS
# tuple.
#
from django.db import models
from django.conf import settings
from src.ut... | Python |
"""
This file contains the generic, assorted views that don't fall under one of
the other applications. Views are django's way of processing e.g. html
templates on the fly.
"""
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.contrib.auth.mode... | Python |
#
# Define database entities for the app.
#
from django.db import models
| Python |
"""
This structures the (simple) structure of the
webpage 'application'.
"""
from django.conf.urls.defaults import *
urlpatterns = patterns('src.web.website.views',
(r'^$', 'page_index'),
)
| Python |
#
# This makes the news model visible in the admin web interface
# so one can add/edit/delete news items etc.
#
from django.contrib import admin
from src.web.news.models import NewsTopic, NewsEntry
class NewsTopicAdmin(admin.ModelAdmin):
list_display = ('name', 'icon')
admin.site.register(NewsTopic, NewsTopicAdm... | Python |
"""
This is a very simple news application, with most of the expected features
like news-categories/topics and searchable archives.
"""
import django.views.generic.list_detail as gv_list_detail
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.c... | Python |
#
# This module implements a simple news entry system
# for the evennia website. One needs to use the
# admin interface to add/edit/delete entries.
#
from django.db import models
from django.contrib.auth.models import User
class NewsTopic(models.Model):
"""
Represents a news topic.
"""
name = models... | Python |
"""
This structures the url tree for the news application.
It is imported from the root handler, game.web.urls.py.
"""
from django.conf.urls.defaults import *
urlpatterns = patterns('src.web.news.views',
(r'^show/(?P<entry_id>\d+)/$', 'show_news'),
(r'^archive/$', 'news_archive'),
(r'^search/$', 'sear... | Python |
"""
This contains a simple view for rendering the webclient
page and serve it eventual static content.
"""
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.conf import settings
from src.server.sessionhandler import SESSIONS
def webclient(request):
"""
W... | Python |
#
# Define database entities for the app.
#
from django.db import models
| Python |
"""
This structures the (simple) structure of the
webpage 'application'.
"""
from django.views.generic.simple import direct_to_template
from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^$', 'src.web.webclient.views.webclient'),)
#url(r'^$', direct_to_template, {'template': 'webclient.ht... | Python |
#
# File that determines what each URL points to. This uses _Python_ regular
# expressions, not Perl's.
#
# See:
# http://diveintopython.org/regular_expressions/street_addresses.html#re.matching.2.3
#
from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
# fix to re... | Python |
"""
This defines how to edit help entries in Admin.
"""
from django import forms
from django.contrib import admin
from src.help.models import HelpEntry
class HelpEntryForm(forms.ModelForm):
"Defines how to display the help entry"
class Meta:
model = HelpEntry
db_help_category = forms... | 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.