code
stringlengths
1
1.72M
language
stringclasses
1 value
import sys,os if len(sys.argv)<4: print 'Usage: python Fpeak.py plus.bedGraph minus.bedGraph prefix' exit(1) class ChrBin: chr='chr1' beg=0 end=0 val=0 def __init__(self, chr, beg, end, val): self.chr=chr self.beg=beg self.end=end self.val=val prefix=sys.argv[3] bin=20...
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 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 """ 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 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 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
#!/usr/bin/python # # Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # # Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/env python # # Copyright (c) 2002, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this ...
Python
#!/usr/bin/env python # Copyright (c) 2010, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this l...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
#!/usr/bin/python2.4 # -*- coding: utf-8 -*- # # Copyright (C) 2011 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
Python
# Copyright 2011 Google Inc. All Rights Reserved. """Locked file interface that should work on Unix and Windows pythons. This module first tries to use fcntl locking to ensure serialized access to a file, then falls back on a lock file if that is unavialable. Usage: f = LockedFile('filename', 'r+b', 'rb') f....
Python
# Copyright 2011 Google Inc. All Rights Reserved. """Multi-credential file store with lock support. This module implements a JSON credential store where multiple credentials can be stored in one file. That file supports locking both in a single process and across processes. The credential themselves are keyed off o...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2011 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
__version__ = "1.0c2"
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2007 Joe Gregorio # # Licensed under the MIT License """MIME-Type Parser This module provides basic functions for handling mime-types. It can handle matching mime-types against a list of media-ranges. See section 14.1 of the HTTP specification [RFC 2616] for a complete explanation. http://www.w3.o...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
__version__ = "1.0c2"
Python
#!/usr/bin/python2.4 # # Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
Python
#!/usr/bin/python2.4 # # Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
Python
""" iri2uri Converts an IRI to a URI. """ __author__ = "Joe Gregorio (joe@bitworking.org)" __copyright__ = "Copyright 2006, Joe Gregorio" __contributors__ = [] __version__ = "1.0.0" __license__ = "MIT" __history__ = """ """ import urlparse # Convert an IRI to a URI following the rules in RFC 3987 # # The characte...
Python
from __future__ import generators """ httplib2 A caching http interface that supports ETags and gzip to conserve bandwidth. Requires Python 2.3 or later Changelog: 2007-08-18, Rick: Modified so it's able to use a socks proxy if needed. """ __author__ = "Joe Gregorio (joe@bitworking.org)" __copyright__ = "Copyright...
Python
"""SocksiPy - Python SOCKS module. Version 1.00 Copyright 2006 Dan-Haim. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this ...
Python
import Cookie import datetime import time import email.utils import calendar import base64 import hashlib import hmac import re import logging # Ripped from the Tornado Framework's web.py # http://github.com/facebook/tornado/commit/39ac6d169a36a54bb1f6b9bf1fdebb5c9da96e09 # # Tornado is licensed under the Apache Licen...
Python
# This is the version of this source code. manual_verstr = "1.5" auto_build_num = "211" verstr = manual_verstr + "." + auto_build_num try: from pyutil.version_class import Version as pyutil_Version __version__ = pyutil_Version(verstr) except (ImportError, ValueError): # Maybe there is no pyutil insta...
Python
""" The MIT License Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the ...
Python
""" The MIT License Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the ...
Python
""" The MIT License Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the ...
Python
# Early, and incomplete implementation of -04. # import re import urllib RESERVED = ":/?#[]@!$&'()*+,;=" OPERATOR = "+./;?|!@" EXPLODE = "*+" MODIFIER = ":^" TEMPLATE = re.compile(r"{(?P<operator>[\+\./;\?|!@])?(?P<varlist>[^}]+)}", re.UNICODE) VAR = re.compile(r"^(?P<varname>[^=\+\*:\^]+)((?P<explode>[\+\*])|(?P<part...
Python
""" Compare stuff. """ import os import sys import argparse import pdb import pprint import numpy as np import matplotlib.pyplot as pl from lcm import EventLog from fovis.update_t import update_t from fovis.stats_t import stats_t from fovis.tictoc_t import tictoc_t from bot_core.pose_t import pose_t from bot_core.r...
Python
import math import numpy class Quaternion: def __init__ (self, *args): if len(args) == 4: self.q = numpy.array(args[:]) elif len(args) == 1: if isinstance(args[0], Quaternion): self.q = args[0].q.copy() elif len(args[0]) == 4: self...
Python
import math import numpy from quaternion import Quaternion class RigidTransform(object): def __init__(self, rotation_quat, translation_vec): self.quat = Quaternion(rotation_quat) self.tvec = numpy.array(translation_vec) def inverse(self): """ returns a new RigidTransform that correspon...
Python
import numpy as np from rigid_transform import RigidTransform VEL_DTYPE = [('utime', float), ('trans_vel', float, 3)] def quat_slerp(q0, q1, w): """ spherical interpolation. q0, q1: arrays of Nx4, each row is a rotation quaternion. w: array of N weights. output: array Nx4 with spherically interpolate...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2010 Paulo Jerônimo # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2010 Paulo Jerônimo # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
Python
# # # # # # # # # # # # # # # # # # # # # # # # # ObZen, a security through obscurity script # # Feel free to use this script to your liking # # # # By Denzo # # # # # # # # # # # # # # # # # # # # # # # # # # Import libs needed for encoding/decoding functions import codecs import ...
Python
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Four-Leaf Bank GUI # # ## ## # # Geschreven voor de Four-Leaf Bank # # # ...
Python
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Four-Leaf Bank Module # # ## ## # # Geschreven voor de Four-Leaf Bank # # # ## ## # # Door Dennis Bogers ...
Python
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "forward.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
Python
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "forward.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
Python
from __future__ import unicode_literals from django.db import models from optitrans.domain.route import Route from optitrans.domain.ville import Ville class PoiStation(models.Model): id = models.IntegerField(primary_key=True) id_route = models.ForeignKey(Route, db_column='id_route',related_name='route_poi_sta...
Python
from __future__ import unicode_literals from django.db import models class Client(models.Model): id = models.IntegerField(primary_key=True) nom = models.CharField(max_length=50L) adresse = models.CharField(max_length=100L) telephone = models.CharField(max_length=50L) ville = models.CharField(max_le...
Python
from __future__ import unicode_literals from django.db import models class AuthGroup(models.Model): id = models.IntegerField(primary_key=True) name = models.CharField(max_length=80L, unique=True) class Meta: db_table = 'auth_group' class AuthGroupPermissions(models.Model): id = models.Integ...
Python
from __future__ import unicode_literals from django.db import models from optitrans.domain.route import Route from optitrans.domain.ville import Ville class PoiPoste(models.Model): id = models.IntegerField(primary_key=True) id_route = models.ForeignKey(Route, db_column='id_route',related_name='route_poi_poste...
Python
from django.db import models from optitrans.domain.position import Position class PositionManager(models.Manager): def vehicule_position(self, id_vehicules): return Position.objects.order_by('-id').get(id_vehicule=id_vehicules)
Python
from __future__ import unicode_literals from django.db import models from optitrans.domain.device import Device from optitrans.domain.vehicule import Vehicule class Arret(models.Model): id = models.IntegerField(primary_key=True) id_device = models.ForeignKey(Device, db_column='id_device',related_name='device_s...
Python
from __future__ import unicode_literals from django.db import models from optitrans.domain.ville import Ville class Gare(models.Model): id_gare = models.IntegerField(primary_key=True) nom = models.CharField(max_length=50L) id_ville = models.ForeignKey(Ville, db_column='id_ville') latitude = models.Flo...
Python
from __future__ import unicode_literals from django.db import models class Route(models.Model): id = models.IntegerField(primary_key=True) nom = models.CharField(max_length=50L) distance = models.FloatField() ville_depart = models.CharField(max_length=50L, blank=True) ville_arrivee = models.CharFie...
Python
from __future__ import unicode_literals from django.db import models from optitrans.domain.modelhelper import PositionManager from optitrans.domain.position import Position from optitrans.domain.chauffeur import Chauffeur class PositionManager(models.Manager): def position(self, id): return Po...
Python
from __future__ import unicode_literals from django.db import models from optitrans.domain.client import Client class ClientParam(models.Model): id = models.IntegerField(primary_key=True) id_client = models.ForeignKey(Client, db_column='id_client') url_server = models.CharField(max_length=120L) url_sms...
Python
from __future__ import unicode_literals from django.db import models class Pays(models.Model): id = models.CharField(max_length=11L, primary_key=True) nom = models.CharField(max_length=50L) class Meta: db_table = 'pays'
Python
from __future__ import unicode_literals from django.db import models from optitrans.domain.client import Client class Device(models.Model): id = models.IntegerField(primary_key=True) uuid = models.CharField(max_length=64L, unique=True) type = models.CharField(max_length=50L) id_client = models.Foreig...
Python
from __future__ import unicode_literals from django.db import models from optitrans.domain.chauffeur import Chauffeur from optitrans.domain.device import Device class DeviceParam(models.Model): id = models.DateTimeField(primary_key=True) id_vehicule = models.ForeignKey('Vehicule', db_column='id_vehicule',rel...
Python
from __future__ import unicode_literals from django.db import models from optitrans.domain.pays import Pays class Ville(models.Model): id = models.IntegerField(primary_key=True) name = models.CharField(max_length=50L) id_country = models.ForeignKey(Pays, db_column='id_country',related_name='country') ...
Python
from django.contrib.auth import logout from django.contrib.auth.decorators import login_required from django.core import serializers from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from django.template import RequestContext from django.utils import simplejson from optitrans....
Python
from django.conf.urls import patterns, url from optitrans import pages, views urlpatterns = patterns('', (r'^login/$', 'django.contrib.auth.views.login'), url(r'^$', pages.home, name='home'), url(r'^config/$', pages.config, name='config'), url(r'^gestion/$', pages.gestion, name='gestion'), ...
Python
from django.forms import ModelForm from optitrans.domain.chauffeur import Chauffeur from optitrans.domain.client import Client class ChauffeurForm(ModelForm): class Meta: model = Client
Python
from django.shortcuts import render_to_response from django.contrib.auth.decorators import login_required from django.contrib.auth import logout from django.template import RequestContext from django.http import HttpResponseRedirect from optitrans.domain.vehicule import Vehicule from django.core import serializers from...
Python
from django.conf.urls import patterns, include, url from django.contrib import admin from optitrans import views admin.autodiscover() urlpatterns = patterns('', (r'^login/$', 'django.contrib.auth.views.login'), url(r'^optitrans/', include('optitrans.urls')), url(r'^admin/', include(admin.site.urls)), ...
Python
import os.path # Django settings for forward project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS PROJECT_DIR = os.path.dirname(__file__) # this is not Django setting. DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', ...
Python
import math def distance(lat1, long1, lat2, long2): degrees_to_radians = math.pi/180.0 phi1 = (90.0 - lat1)*degrees_to_radians phi2 = (90.0 - lat2)*degrees_to_radians theta1 = long1*degrees_to_radians theta2 = long2*degrees_to_radians cos = (math.sin(phi1)*math.sin(phi2)*math.cos(theta1 - theta2...
Python
""" WSGI config for forward project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` ...
Python
#!/usr/bin/env python import elFinder elFinder.connector({ 'root': '/home/user/Sites/elfinder/files', 'URL': 'http://localhost/~user/elfinder/files', ## other options # 'debug': True, # 'dirSize': True, # 'dotFiles': True, # 'perms': { # 'backup': { # 'read': True, # 'write': False, # 'rm': False #...
Python
#!/usr/bin/env python # # Connector for elFinder File Manager # author Troex Nevelin <troex@fury.scancode.ru> import cgi import hashlib import json import mimetypes import os import os.path import re import shutil import sys import time from datetime import datetime class connector(): """Connector for elFinder""" ...
Python
#!/usr/bin/env python import elFinder elFinder.connector({ 'root': '/home/user/Sites/elfinder/files', 'URL': 'http://localhost/~user/elfinder/files', ## other options # 'debug': True, # 'dirSize': True, # 'dotFiles': True, # 'perms': { # 'backup': { # 'read': True, # 'write': False, # 'rm': False #...
Python
#!/usr/bin/env python # # Connector for elFinder File Manager # author Troex Nevelin <troex@fury.scancode.ru> import cgi import hashlib import json import mimetypes import os import os.path import re import shutil import sys import time from datetime import datetime class connector(): """Connector for elFinder""" ...
Python
############################################################################## # # Copyright (c) 2006 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SO...
Python
############################################################################## # # Copyright (c) 2006 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SO...
Python
############################################################################## # # Copyright (c) 2006 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SO...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ nntune: find the best rapport hidden/epsilon in the neuralnetwork library """ # # Copyright 2010 <Michele Orrù> # # This program 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 ...
Python
""" options.py: provides extra options for the controllers """ from foxgame.gamecore import FoxGameError from foxgame.structures import Direction, Vector from functools import wraps class FoxgameOption(object): """ A FoxgameOption provides some attributes useful for parsing and configuring some specific c...
Python
""" controller.py: basic classes for managing inputs (CTL). """ from foxgame.structures import Direction class Controller(object): """ A basic controller which provides some properties useful for specific controllers. """ def __init__(self, pawn, brain, postfilters): """ Set up ba...
Python
class StateMachine(object): """ Simple finite state machine with stateful methods. """ def __init__(self): # Registered states self.states = dict() # Current state self.state = None # Registered stateful methods self.statefuls = ['enter', 'exit'] ...
Python
from collections import deque from functools import partial class ShortDequeImpl(deque): """ Deque with bounded length. Mimics Python 2.6 deque with maxlen. Once a shortdeque is full, when new items are added, a corresponding number of items are discarded from the opposite end. """ ...
Python
# -*- coding: utf-8 -*- """ ./tests/: library for testing. """ __author__ = 'Michele Orrù' __mail__ = 'maker.py@gmail.com' __license__ = 'GPLv2' __contrbutors__ = ['Davide Rizzo', 'Edmund_Ogban']
Python
""" Draw primitives for brain designers. Commands: - circle(V pos, R radius) - line(V v1, V v2) - vector(V pos, V v) - highlight(GameObject o) Arguments: - R (radius): a number, a Vector, an object with .radius - V (vector): a Vector, an object with .pos, a sequence of two - GameObject: an object with .pos and .radiu...
Python
# -*- coding: utf-8 -*- """ simulator.py: a masochistic GUI. Used mainly for tests/controller learning """ from __future__ import division from collections import defaultdict from math import sqrt from traceback import format_exc from foxgame.structures import Direction from foxgame.options import FoxgameOption from ...
Python
from foxgame.UI.brainz import DrawingContext from collections import defaultdict import pygame from draw import draw_circle, draw_lines, draw_line from foxgame.structures import Vector class BZManager(object): def __init__(self, arena): self.arena = arena self.bzpainter = BZPaint...
Python
# -*- coding: utf-8 -*- """ bubbles.py: simple funny interface with pygame using bubbles. """ from __future__ import division import pygame from traceback import format_exc import logging log = logging.getLogger(__name__) from foxgame.structures import Direction, Vector from foxgame.gamecore import MovingPawn from f...
Python
from pygame.colordict import THECOLORS class ColorsDict(object): def __init__(self, dic): self.dic = dic def __getitem__(self, name): return self.dic[name.lower()] colors = ColorsDict(THECOLORS)
Python
# -*- coding: utf-8 -*- """ Bubbles GUI for Foxgame """ __author__ = 'Davide Rizzo' __mail__ = 'sorcio@gmail.com' __license__ = 'GPLv2' __contributors__ = ['Michele Orrù'] from gui import main
Python
import pygame try: from pygame.gfxdraw import aacircle, filled_circle use_gfxdraw = True except ImportError: from pygame.draw import circle use_gfxdraw = False from pygame.draw import aalines, aaline from colors import colors def ident(x, dim=0, abs=0): """ No coordinate transform. """ ...
Python
from __future__ import division from os.path import join as osjoin import pygame # very thin wrapper around pygame Font from pygame.font import Font, SysFont from colors import colors from draw import draw_circle from bzdraw import BZManager from foxgame.structures import Direction import logging log = logging.getLo...
Python
# -*- coding: utf-8 -*- """ ./UI: GUIs for foxgame. """ __author__ = 'Michele Orrù' __mail__ = 'maker.py@gmail.com' __license__ = 'GPLv2' __contributors__ = ['Davide Rizzo']
Python
""" gamecore.py: basic classes for pawns and game logic (GL). """ from __future__ import division from random import randrange from foxgame.structures import Vector import logging log = logging.getLogger('CORE') class FoxGameError(Exception): """ A Simple Exception raised if some components of the game fail...
Python
""" factories.py: factory classes used to store and configure controllers. """ from foxgame.gamecore import Game, FoxGameError from foxgame.controller import Controller class GameFactory(object): """ Once incapsulated, this class let the user build a new game dynamically configured. """ def __in...
Python