code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
#! /usr/bin/python
# -*- coding: utf-8 -*-
#######################################################################################
# #
# File: main.py #
# Par... | Python |
#! /usr/bin/python
#######################################################################################
# #
# File: gojuon_gen.py #
# Part of 2dgal-cheater ... | Python |
#! /usr/bin/python
from distutils.core import setup
import py2exe
import main
from glob import glob
data_files = [("Microsoft.VC100.CRT",
glob(r'D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\redist\x86\Microsoft.VC100.CRT\*.*'))]
setup(
options = {"py2exe": {"optimize": 2,... | Python |
#! /usr/bin/python
from distutils.core import setup
import py2exe
import main
from glob import glob
data_files = [("Microsoft.VC100.CRT",
glob(r'D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\redist\x86\Microsoft.VC100.CRT\*.*'))]
setup(
options = {"py2exe": {"optimize": 2,... | Python |
#! /usr/bin/python
#######################################################################################
# #
# File: gojuon_gen.py #
# Part of 2dgal-cheater ... | Python |
#This contains global definition of Browser class and other useful thing
#######################################################################################
# #
# File: browser_bogus.py ... | Python |
#! /usr/bin/python
#######################################################################################
# #
# File: ad_auto.py #
# Part of 2dgal-cheater ... | Python |
#######################################################################################
# #
# File: gojuon.py #
# Part of 2dgal-cheater ... | Python |
#! /usr/bin/python
#######################################################################################
# #
# File: kf_star_1.py #
# Part of 2dgal-cheater ... | Python |
#! /usr/bin/python
#######################################################################################
# #
# File: ad_auto.py #
# Part of 2dgal-cheater ... | Python |
#! /usr/bin/python
#######################################################################################
# #
# File: gojuon_gen.py #
# Part of 2dgal-cheater ... | Python |
#! /usr/bin/python
#######################################################################################
# #
# File: kf_star_1.py #
# Part of 2dgal-cheater ... | Python |
#! /usr/bin/python
#######################################################################################
# #
# File: gojuon_gen.py #
# Part of 2dgal-cheater ... | Python |
import unittest
import bots.inmessage as inmessage
import bots.botslib as botslib
import bots.botsinit as botsinit
import utilsunit
'''plugin unitinmessageedifact.zip'''
class TestInmessage(unittest.TestCase):
def testEdifact0401(self):
''' 0401 Errors in records'''
self.assertRaises(botslib.InMe... | Python |
#!/usr/bin/env python
from bots import engine
if __name__ == '__main__':
engine.start()
| Python |
import os
import sys
from distutils.core import setup
from distutils.command.install import INSTALL_SCHEMES
#install data file in the same way as *.py
for scheme in INSTALL_SCHEMES.values():
scheme['data'] = scheme['purelib']
def fullsplit(path, result=None):
"""
Split a pathname into components (the op... | Python |
import os
import sys
from distutils.core import setup
from distutils.command.install import INSTALL_SCHEMES
#install data file in the same way as *.py
for scheme in INSTALL_SCHEMES.values():
scheme['data'] = scheme['purelib']
def fullsplit(path, result=None):
"""
Split a pathname into components (the op... | Python |
#!/usr/bin/env python
from bots import xml2botsgrammar
if __name__=='__main__':
xml2botsgrammar.start()
| Python |
import os
import unittest
import shutil
import bots.inmessage as inmessage
import bots.outmessage as outmessage
import filecmp
try:
import json as simplejson
except ImportError:
import simplejson
import bots.botslib as botslib
import bots.botsinit as botsinit
import utilsunit
''' pluging unitinisout.zip'''
c... | Python |
#!/usr/bin/env python
from bots import grammarcheck
if __name__=='__main__':
grammarcheck.start()
| Python |
import os
import sys
from distutils.core import setup
def fullsplit(path, result=None):
"""
Split a pathname into components (the opposite of os.path.join) in a
platform-neutral way.
"""
if result is None:
result = []
head, tail = os.path.split(path)
if head == '':
ret... | Python |
#!/usr/bin/env python
if __name__ == '__main__':
import cProfile
cProfile.run('from bots import engine; engine.start()','profile.tmp')
import pstats
p = pstats.Stats('profile.tmp')
#~ p.sort_stats('cumulative').print_stats(25)
p.sort_stats('time').print_stats(25)
#~ p.print_callees('deepcop... | Python |
import os
import unittest
import shutil
import bots.inmessage as inmessage
import bots.outmessage as outmessage
import filecmp
import bots.botslib as botslib
import bots.botsinit as botsinit
import utilsunit
''' pluging unitinmessagexml.zip'''
class TestInmessage(unittest.TestCase):
''' Read messages; some shoul... | Python |
#!/usr/bin/env python
from bots import webserver
if __name__ == '__main__':
webserver.start()
| Python |
import filecmp
import glob
import shutil
import os
import sys
import subprocess
import logging
import logging
import bots.botslib as botslib
import bots.botsinit as botsinit
import bots.botsglobal as botsglobal
from bots.botsconfig import *
'''plugin unitretry.zip'''
#!!!activate rotues
''' input: mime (complex struc... | Python |
import unittest
import bots.botslib as botslib
import bots.botsinit as botsinit
import bots.grammar as grammar
import bots.inmessage as inmessage
import bots.outmessage as outmessage
import utilsunit
''' plugin unitgrammar.zip '''
class TestGrammar(unittest.TestCase):
def testgeneralgrammarerrors(self):
... | Python |
import unittest
import bots.botsglobal as botsglobal
import bots.inmessage as inmessage
import bots.botslib as botslib
import bots.transform as transform
import pickle
import bots.botsinit as botsinit
import utilsunit
'''plugin unittranslateutils.zip '''
#as the max length is
class TestTranslate(unittest.TestCase):
... | Python |
import unittest
import filecmp
import glob
import shutil
import os
import subprocess
import logging
import utilsunit
import bots.botslib as botslib
import bots.botsinit as botsinit
import bots.botsglobal as botsglobal
from bots.botsconfig import *
'''
plugin unitconfirm.zip
before each run: clear transactions!
'''
b... | Python |
import unittest
import bots.botslib as botslib
import bots.botsinit as botsinit
import bots.inmessage as inmessage
import bots.outmessage as outmessage
from bots.botsconfig import *
import utilsunit
''' plugin unitformats '''
#python 2.6 treats -0 different. in outmessage this is adapted, for inmessage: python 2.6 do... | Python |
import os
import sys
import posixpath
try:
import cPickle as pickle
except:
import pickle
import time
import datetime
import email
import email.Utils
import email.Generator
import email.Message
import email.encoders
import glob
import shutil
import fnmatch
import codecs
if os.name == 'nt':
import msvcrt
eli... | Python |
from datetime import datetime
from django.db import models
from django.utils.translation import ugettext as _
'''
django is not excellent in generating db. But they have provided a way to customize the generated database using SQL. see bots/sql/*.
'''
STATUST = [
(0, _(u'Open')),
(1, _(u'Error')),
(2, _(u'... | Python |
''' Reading/lexing/parsing/splitting an edifile.'''
import StringIO
import time
import sys
try:
import cPickle as pickle
except:
import pickle
try:
import cElementTree as ET
except ImportError:
try:
import elementtree.ElementTree as ET
except ImportError:
try:
from xml.et... | Python |
codeconversions = {
'351':'AAK',
'35E':'AAK',
'220':'ON',
'224':'ON',
'50E':'ON',
'83':'IV',
'380':'IV',
'384':'IV',
'TESTIN':'TESTOUT',
}
| Python |
""" Python Character Mapping Codec generated from CP1252.TXT with gencodec.py.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
(c) Copyright 2000 Guido van Rossum.
Adapted by Henk-Jan Ebbers for Bots open source EDI translator
Regular UNOA: UNOA char, CR, LF and... | Python |
""" Python Character Mapping Codec generated from CP1252.TXT with gencodec.py.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
(c) Copyright 2000 Guido van Rossum.
Adapted by Henk-Jan Ebbers for Bots open source EDI translator
Regular UNOB: UNOB char, CR, LF and... | Python |
import shutil
import time
from django.utils.translation import ugettext as _
#bots-modules
import botslib
import botsglobal
import grammar
import outmessage
from botsconfig import *
@botslib.log_session
def mergemessages(startstatus=TRANSLATED,endstatus=MERGED,idroute=''):
''' Merges en envelopes several messages ... | Python |
# Django settings for bots project.
import os
import bots
#*******settings for bots error reports**********************************
MANAGERS = ( #bots will send error reports to the MANAGERS
('name_manager', 'manager@domain.org'),
)
#~ EMAIL_HOST = 'smtp.gmail.com' #Default: 'localhost'
#~ EMAIL... | Python |
import sys
from django.utils.translation import ugettext as _
#bots-modules
import communication
import envelope
import transform
import botslib
import botsglobal
import preprocess
from botsconfig import *
@botslib.log_session
def prepareretransmit():
''' prepare the retransmittable files. Return: indication if fi... | Python |
import os
import sys
import time
import zipfile
import zipimport
import operator
import django
from django.core import serializers
from django.utils.translation import ugettext as _
import models
import botslib
import botsglobal
'''
some tabel have 'id' as primary key. This is always an artificial key.
this is not usab... | Python |
import time
import django
import models
import viewlib
import botslib
import botsglobal
django.contrib.admin.widgets.AdminSplitDateTime
HiddenInput = django.forms.widgets.HiddenInput
DEFAULT_ENTRY = ('',"---------")
editypelist=[DEFAULT_ENTRY] + sorted(models.EDITYPES)
confirmtypelist=[DEFAULT_ENTRY] + models.CONFIRMTY... | Python |
'''module contains the functions to be called from user scripts'''
try:
import cPickle as pickle
except:
import pickle
import copy
import collections
from django.utils.translation import ugettext as _
#bots-modules
import botslib
import botsglobal
import inmessage
import outmessage
from botsconfig import *
#**... | Python |
import os
import sys
import atexit
import traceback
import logging
#import bots-modules
import bots.botslib as botslib
import bots.botsglobal as botsglobal
def showusage():
print ' Update existing bots database for new release 1.6.0'
print ' Options:'
print " -c<directory> directory for conf... | Python |
from django.conf.urls.defaults import *
from django.contrib import admin,auth
from django.views.generic.simple import redirect_to
from django.contrib.auth.decorators import login_required,user_passes_test
from bots import views
admin.autodiscover()
staff_required = user_passes_test(lambda u: u.is_staff)
superuser_requ... | Python |
from django import template
register = template.Library()
@register.filter
def url2path(value):
if value.startswith('/admin/bots/'):
value = value[12:]
else:
value = value[1:]
if value:
if value[-1] == '/':
value = value[:-1]
else:
value = 'home'
return ... | Python |
#!/usr/bin/env python
import os
import optparse
import subprocess
import sys
here = os.path.dirname(__file__)
def main():
usage = "usage: %prog [file1..fileN]"
description = """With no file paths given this script will automatically
compress all jQuery-based files of the admin app. Requires the Google Closure... | Python |
#!/usr/bin/env python
import os
import optparse
import subprocess
import sys
here = os.path.dirname(__file__)
def main():
usage = "usage: %prog [file1..fileN]"
description = """With no file paths given this script will automatically
compress all jQuery-based files of the admin app. Requires the Google Closure... | Python |
"""SMTP over SSL client.
used for python < 2.5
in python 2.6 and up the smtp-library has a class SMTP_SSL
Public class: SMTP_SSL
Public errors: SMTPSSLException
"""
# Author: Matt Butcher <mbutche@luc.edu>, Feb. 2007
# License: MIT License (or, at your option, the GPL, v.2 or later as posted at
# http://gnu... | Python |
import os
import sys
import copy
import inmessage
import outmessage
import botslib
import botsinit
import botsglobal
from botsconfig import *
#buggy
#in usersys/grammars/xmlnocheck should be a file xmlnocheck
#usage: c:\python25\python bots-xml2botsgrammar.py botssys/infile/test.xml botssys/infile/resultgrammar.py... | Python |
import sys
import copy
import datetime
import django
from django.core.paginator import Paginator,EmptyPage, InvalidPage
from django.utils.translation import ugettext as _
import models
import botsglobal
from botsconfig import *
def preparereport2view(post,runidta):
terugpost = post.copy()
thisrun = models.repo... | Python |
'''
code found at code.djangoproject.com/ticket/3777
'''
from django import http
class FilterPersistMiddleware(object):
def _get_default(self, key):
""" Gets any set default filters for the admin. Returns None if no
default is set. """
default = None
#~ default = settings.ADM... | Python |
import time
import sys
try:
import cPickle as pickle
except:
import pickle
import decimal
NODECIMAL = decimal.Decimal(1)
try:
import cElementTree as ET
#~ print 'imported cElementTree'
except ImportError:
try:
import elementtree.ElementTree as ET
#~ print 'imported elementtree.Elemen... | Python |
import os
import glob
import time
import datetime
import stat
import shutil
from django.utils.translation import ugettext as _
#bots modules
import botslib
import botsglobal
from botsconfig import *
def cleanup():
''' public function, does all cleanup of the database and file system.'''
try:
_cleanups... | Python |
#Globals used by Bots
incommunicate = False #used to set all incommunication off
db = None #db-object
ini = None #ini-file-object that is read (bots.ini)
routeid = '' #current route. This is used to set routeid for Processes.
preprocessnumber = 0 #different preprocessnumbers ... | Python |
import copy
from django.utils.translation import ugettext as _
import botslib
import botsglobal
from botsconfig import *
def grammarread(editype,grammarname):
''' dispatch function for class Grammar or subclass
read whole grammar
'''
try:
classtocall = globals()[editype]
except KeyError... | Python |
#!/usr/bin/env python
import sys
import os
import logging
from logging.handlers import TimedRotatingFileHandler
from django.core.handlers.wsgi import WSGIHandler
from django.utils.translation import ugettext as _
import cherrypy
from cherrypy import wsgiserver
import botslib
import botsglobal
import botsinit
def showu... | Python |
#!/usr/bin/env python
''' This script starts bots-engine.'''
import sys
import os
import atexit
import traceback
import logging
import datetime
logging.raiseExceptions = 0 #if errors occur in writing to log: ignore error; this will lead to a missing log line.
#it is better to have a... | Python |
import sys
import os
import time
import shutil
import subprocess
import django
from django.utils.translation import ugettext as _
import forms
import models
import viewlib
import botslib
import pluglib
import botsglobal
import glob
from botsconfig import *
def server_error(request, template_name='500.html'):
""" t... | Python |
import os
import re
import zipfile
from django.utils.translation import ugettext as _
#bots-modules
import botslib
import botsglobal
from botsconfig import *
@botslib.log_session
def preprocess(routedict,function, status=FILEIN,**argv):
''' for pre- and postprocessing of files.
these are NOT translations; ... | Python |
from django.utils.translation import ugettext as _
#bots-modules
import botslib
import node
from botsconfig import *
class Message(object):
''' abstract class; represents a edi message.
is subclassed as outmessage or inmessage object.
'''
def __init__(self):
self.recordnumber=0 ... | Python |
import decimal
import copy
from django.utils.translation import ugettext as _
import botslib
import botsglobal
from botsconfig import *
comparekey=None
def nodecompare(node):
global comparekey
return node.get(*comparekey)
class Node(object):
''' Node class for building trees in inmessage and outmessage
... | Python |
import sys
import os
import encodings
import codecs
import ConfigParser
import logging, logging.handlers
from django.utils.translation import ugettext as _
#Bots-modules
from botsconfig import *
import botsglobal
import botslib
class BotsConfig(ConfigParser.SafeConfigParser):
''' See SafeConfigParser.... | Python |
# Django settings for bots project.
import os
import bots
#*******settings for bots error reports**********************************
MANAGERS = ( #bots will send error reports to the MANAGERS
('name_manager', 'manager@domain.org'),
)
#~ EMAIL_HOST = 'smtp.gmail.com' #Default: 'localhost'
#~ EMAIL... | Python |
''' Base library for bots. Botslib should not import from other Bots-modules.'''
import sys
import os
import codecs
import traceback
import subprocess
import socket #to set a time-out for connections
import string
import urlparse
import urllib
import platform
import django
from django.utils.translation import ugettex... | Python |
"""
sef2bots.py
Command line params: sourcefile.sef targetfile.py
Optional command line params: -seq, -struct
Converts a SEF grammar into a Bots grammar. If targetfile exists (and is writeable),
it will be overwritten.
If -seq is specified, field names in record definitions will be
sequential (TAG01, TAG... | Python |
#constants/definitions for Bots
#to be used as from bots.config import *
#for statust in ta:
OPEN = 0 #Bots always closes transaction. OPEN is severe error
ERROR = 1 #error in transaction.
OK = 2 #successfull, result is 'save'. But processing has stopped: next step with error, or no next steps defined
DONE ... | Python |
import django
from django.contrib import admin
from django.utils.translation import ugettext as _
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.contrib.admin.util import unquote, flatten_fieldsets, get_deleted_objects, model_ngettext, model_format_dict
from django.core.exceptions impor... | Python |
#bots modules
import botslib
import botsglobal
from botsconfig import *
from django.utils.translation import ugettext as _
tavars = 'idta,statust,divtext,child,ts,filename,status,idroute,fromchannel,tochannel,frompartner,topartner,frommail,tomail,contenttype,nrmessages,editype,messagetype,errortext,script'
def evalua... | Python |
try:
from pysqlite2 import dbapi2 as sqlite #prefer external modules for pylite
except ImportError:
import sqlite3 as sqlite #works OK for python26
#~ #bots engine uses:
#~ ''' SELECT *
#~ FROM ta
#~ WHERE idta=%(idta)s ''',
#~ {'idta':12345})
#~ #SQLite wants:
#~ ''' SELECT *
#~ FROM ta... | Python |
import sys
import os
import botsinit
import botslib
import grammar
def showusage():
print
print " Usage: %s -c<directory> <editype> <messagetype>"%os.path.basename(sys.argv[0])
print
print " Checks a Bots grammar."
print " Same checks are used as in translations with bots-engine."
pr... | Python |
import sys
import os
import tarfile
import glob
import shutil
import subprocess
import traceback
import bots.botsglobal as botsglobal
def join(path,*paths):
return os.path.normpath(os.path.join(path,*paths))
#******************************************************************************
#*** start ... | Python |
import copy
import os
import glob
import bots.inmessage as inmessage
import bots.outmessage as outmessage
def comparenode(node1,node2org):
node2 = copy.deepcopy(node2org)
if node1.record is not None and node2.record is None:
print 'node2 is "None"'
return False
if node1.record is None and ... | Python |
import os
import unittest
import shutil
import bots.inmessage as inmessage
import bots.outmessage as outmessage
import filecmp
try:
import json as simplejson
except ImportError:
import simplejson
import bots.botslib as botslib
import bots.botsinit as botsinit
import utilsunit
try:
import cElementTree as ET... | Python |
import os
import unittest
import shutil
import filecmp
import bots.inmessage as inmessage
import bots.outmessage as outmessage
import bots.botslib as botslib
import bots.botsinit as botsinit
'''plugin unitnode.zip'''
class Testnode(unittest.TestCase):
''' test node.py and message.py.
'''
def testedifact0... | Python |
#!/usr/bin/python2.6
#
# Simple http server to emulate api.playfoursquare.com
import logging
import shutil
import sys
import urlparse
import SimpleHTTPServer
import BaseHTTPServer
class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
"""Handle playfoursquare.com requests, for testing."""
def do_GET(self... | Python |
#!/usr/bin/python
import datetime
import sys
import textwrap
import common
from xml.dom import pulldom
PARSER = """\
/**
* Copyright 2009 Joe LaPenna
*/
package com.joelapenna.foursquare.parsers;
import com.joelapenna.foursquare.Foursquare;
import com.joelapenna.foursquare.error.FoursquareError;
import com.joel... | Python |
#!/usr/bin/python
"""
Pull a oAuth protected page from foursquare.
Expects ~/.oget to contain (one on each line):
CONSUMER_KEY
CONSUMER_KEY_SECRET
USERNAME
PASSWORD
Don't forget to chmod 600 the file!
"""
import httplib
import os
import re
import sys
import urllib
import urllib2
import urlparse
import user
from xml.... | Python |
#!/usr/bin/python
import os
import subprocess
import sys
BASEDIR = '../main/src/com/joelapenna/foursquare'
TYPESDIR = '../captures/types/v1'
captures = sys.argv[1:]
if not captures:
captures = os.listdir(TYPESDIR)
for f in captures:
basename = f.split('.')[0]
javaname = ''.join([c.capitalize() for c in basena... | Python |
#!/usr/bin/python
import logging
from xml.dom import minidom
from xml.dom import pulldom
BOOLEAN = "boolean"
STRING = "String"
GROUP = "Group"
# Interfaces that all FoursquareTypes implement.
DEFAULT_INTERFACES = ['FoursquareType']
# Interfaces that specific FoursqureTypes implement.
INTERFACES = {
}
DEFAULT_CLA... | Python |
#====================================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you ... | Python |
import time
import pprint
def fib6(x):
if x==0 or x==1:
return 1
else:
return fib6(x-2)+fib6(x-1)
def main():
beg = time.clock()
print fib6(33)
end = time.clock()
return end - beg
print __name__
print fib6, fib6.__code__
print fib6.__code__.co_c_function... | Python |
#!/usr/bin/python
# Back-Propagation Neural Networks
#
# Written in Python. See http://www.python.org/
#
# Neil Schemenauer <nascheme@enme.ucalgary.ca>
import math
import random as random
import operator
import string
#import psyco
#psyco.full()
#from psyco.classes import *
#psyco.log()
#psyco.profile()
#__metaclass... | Python |
# based on a Java version:
# Based on original version written in BCPL by Dr Martin Richards
# in 1981 at Cambridge University Computer Laboratory, England
# and a C++ version derived from a Smalltalk version written by
# L Peter Deutsch.
# Java version: Copyright (C) 1995 Sun Microsystems, Inc.
# Translation fr... | Python |
#! /usr/bin/env python
"""
"PYSTONE" Benchmark Program
Version: Python/1.1 (corresponds to C/1.1 plus 2 Pystone fixes)
Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
Translated from ADA to C by Rick Richardson.
Every method to preserve ADA-likeness h... | Python |
"""2c.py -- Python-to-C compiler"""
Author = "Bulatov Vladislav"
## 2c.py is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
## 2c.p... | Python |
import t_const
FPS= t_const.FPS_SERVER
| Python |
#! /usr/bin/env python
#coding=utf-8
#游戏地图事件
data = {
#类型 警告
"warn01":{
"type":"Warning",
"pos":(915,3380), # 坐标
"size":(100), # 范围
"zbpos":(915,2900), #出现僵尸
"zbsize":(800,400), #随机范围
"time":5000, # 持续时间
"zbshow":30, # 僵尸出现机率
},
}
def get_data(id):
return data.get(id)
... | Python |
#! /usr/bin/env python
#coding=utf-8
import base_object
import math
import t_const,t_cmd
import random,copy
class CEvent(object):
def __init__(self):
self.time = 0
self.event = None
pass
class CMapEvent(base_object.CObject):
def __init__(self, mapmgr):
self.sizelist = {}
self.timelist = ... | Python |
#! /usr/bin/env python
#coding=utf-8
import base_object
import math
import t_const,t_cmd
import random,copy
class CEvent(object):
def __init__(self):
self.time = 0
self.event = None
pass
class CMapEvent(base_object.CObject):
def __init__(self, mapmgr):
self.sizelist = {}
self.timelist = ... | Python |
#! /usr/bin/env python
#coding=utf-8
#游戏地图事件
data = {
#类型 警告
"warn01":{
"type":"Warning",
"pos":(915,3380), # 坐标
"size":(100), # 范围
"zbpos":(915,2900), #出现僵尸
"zbsize":(800,400), #随机范围
"time":5000, # 持续时间
"zbshow":30, # 僵尸出现机率
},
}
def get_data(id):
return data.get(id)
... | Python |
# -*- coding: utf-8 -*-
import hall_callback
import t_const, t_error, t_cmd, tgame_wizard
#import tgame_struct
#import tgame_factroy_s
import game_player_s
#import tgame_sprite_config, tgame_stage_config
import tgame_room
import random, cPickle
import tgame_mapevent_s
#游戏逻辑类,单局游戏的全局数据保存在这里
class CMap(obj... | Python |
#-- coding: utf-8 -*-
import t_const
"""巫师指令定义方面客户端和服务端公用,其他的函数为客户端专用"""
WIZARD_CHANGE_SUN = 0x01 #改变阳光数量
WIZARD_END_GAME = 0x02 #立刻结束游戏
WIZARD_ADD_ZOMBIE = 0x03 #立刻刷新僵尸
#帮助文字字典
HELP_TEXT = {WIZARD_CHANGE_SUN : "改变阳光数量指令//change_sun:参数1:整数(可正负,代表阳光数量的改变值),示例://change_sun 100", \
WIZARD_END_GAM... | Python |
# -*- coding: utf-8 -*-
"""以下是帧数相关配置"""
FPS = 30 #客户端逻辑帧数
FPS_SERVER = 5 #服务端逻辑帧数
FPS_RATE = FPS / FPS_SERVER #客户端服务端帧率比
"""以下是游戏模式相关配置"""
GAME_MODE_SINGLE = 0x01 #单人模式
"""以下是玩家个人数据相关的配置"""
#存关卡完成情况的buff的key
BUFF_COMPLETE = "buf0"
#所有用到的buff的列表
ALL_USED_BUFF = (BUFF_COMPLETE, )
#存关卡完成信... | Python |
#! /usr/bin/env python
#coding=utf-8
# 此方法用于生成寻路网格
import tgame_map
import iworld2d
class rect(object):
def __init__(self, lu, ru, ld, rd):
self.lu = lu
self.ru = ru
self.ld = ld
self.rd = rd
def init():
global g_allpos, g_allsize, possum, sizesum
g_allpos = {}
g_allsize = {}
possum = ... | Python |
#! /usr/bin/env python
#coding=utf-8
# 此方法用于生成寻路网格
import tgame_map
import iworld2d
class rect(object):
def __init__(self, lu, ru, ld, rd):
self.lu = lu
self.ru = ru
self.ld = ld
self.rd = rd
def init():
global g_allpos, g_allsize, possum, sizesum
g_allpos = {}
g_allsize = {}
possum = ... | Python |
data = {
"id0":{
"p1":(0,4099),
"p2":(4099,4099),
"p3":(1534,4096),
"minwidth":3,
"lj":["id12","id13"],
},
"id1":{
"p1":(4099,4099),
"p2":(4099,0),
"p3":(1534,2196),
"minwidth":2869,
"lj":["id2","id8"],
},
"id2":{
"p1":(4099,0),
"p2":(0,0),
"p3":(1534... | Python |
data = {
"id0":{
"p1":(-1,7200),
"p2":(15300,7200),
"p3":(6976,7190),
"minwidth":11,
"lj":["id8","id188"],
},
"id1":{
"p1":(15300,7200),
"p2":(15300,-1),
"p3":(15217,3645),
"minwidth":92,
"lj":["id93","id189"],
},
"id2":{
"p1":(15300,-1),
"p2":(-1,-1),
... | Python |
#-- coding: utf-8 -*-
#import tgame_stage_config, tgame_achieve_config
import tgame_stage_config
#房间内玩家对象类
class CPlayer(object):
def __init__(self, objRoom, uid):
super(CPlayer, self).__init__()
self.objRoom = objRoom #房间对象的引用
self.iSide = -1 #玩家的唯一标识
self.hid = -1 #玩家的socket(其实客户端不知道)
sel... | Python |
#! /usr/bin/env python
#coding=utf-8
# tgame_entity
import tgame_player
import tgame_map
import tgame_mapmgr
g_builds = {}
g_entitys = {}
g_phys = {}
g_items = {}
ET_Player = 0x01
ET_Zombie = 0x02
ET_Barrier = 0x03
ET_Other = 0x04
def init():
pass
def addentity(playerinfo, AItype = None):
imp... | Python |
#! /usr/bin/env python
#coding=utf-8
import tgame_fsm
class PlayerFSMClass(tgame_fsm.IFsmCallbackObj):
TransitionMap = {
('stand', 'onMove'):'move',
('move', 'stopMove'):'stand',
('stand', 'Fire'):'atk',
}
MapState2Look = {
'move' : 'anim_stand_clip1',
'walk' : 'anim_walk_clip1',
... | Python |
#! /usr/bin/env python
#coding=utf-8
import math3d,math
LEFT_SIDE = 0x01
RIGHT_SIDE = 0x02
NONE_SIDE = 0x03
def angle(o, s, e):
cosfi = 0
fi = 0
norm = 0
dsx = s[0] - o[0]
dsy = s[1] - o[1]
dex = e[0] - o[0]
dey = e[1] - o[1]
cosfi = dsx * dex + dsy * dey
norm = (dsx * dsx + dsy * dsy)... | 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.