code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
# Copyright 2012 Google Inc. All Rights Reserved.
"""Library to make BigQuery v2 client requests."""
__author__ = 'kbrisbin@google.com (Kathryn Hurley)'
import cgi
import errors
import logging
from apiclient.discovery import build
from apiclient.errors import HttpError
TIMEOUT_MS = 1000
BIGQUERY_API_VERSION = 'v2'
... | 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 |
#!/usr/bin/env python2.5
# Freecell4Maemo, Copyright 2008, Roy Wood
# 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 Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#... | Python |
#!/usr/bin/env python2.5
# Freecell4Maemo, Copyright 2008, Roy Wood
# 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 Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#... | 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 |
'''
Check for mismatches between GNIS/Geonames name and the Freebase topic name.
Created on Jan 23, 2010
@author: tfmorris
'''
import csv
from fileinput import FileInput
import urllib
import zipfile
from FreebaseSession import FreebaseSession, getSessionFromArgs
baseurl = 'http://geonames.usgs.gov/docs/stategaz/'
... | Python |
'''
Program to count votes
for a time period. We start with the desired interval and sub-divide if
necessary due to timeouts during the counting process.
@author: Tom Morris <tfmorris@gmail.com>
@license: EPL v1
'''
import sys
from datetime import datetime, timedelta
from optparse import OptionParser
im... | Python |
'''
Look for duplicate publishers
'''
from freebase.api import HTTPMetawebSession, MetawebError
def main():
session = HTTPMetawebSession('api.freebase.com')
query = {
"type":"/business/company",
'name':None,
"id":None
}
# suffixes = ['inc.', 'inc', 'incorporated', 'co... | Python |
'''
Simple demo of the geosearch API.
Find the 10 closest National Register of Historic Places listings which are
of National significance and within 50 km, using the most recently added
listing as a starting point for the search.
Requires a version of freebase-api greater than 1.0.3
@author: Tom Morris <tf... | Python |
'''
Identify duplicate publisher topics.
Simplistic analysis currently - only finds identical name matches
(230 of 10,500 publishers)
'''
import codecs
from freebase.api import HTTPMetawebSession, MetawebError
def normalize_publisher_name(name):
# remove parenthetical expressions
# remove comp... | Python |
'''
Find all locations contained in French departements which which have the
departement name appended to the commune name and fix the names to match
the Freebase.com naming standards.
Freebase's convention is to store disambiguating information in structured
information, rather than as part of the name like Wik... | Python |
'''
Fix up bad author names from Open Library load.
@author: Tom Morris <tfmorris@gmail.com>
@license: EPL v1
'''
import sys
from bisect import bisect_left
import codecs
from datetime import datetime, timedelta
from optparse import OptionParser
import getpass
import logging
from freebase.api import HTTP... | Python |
import uno
import unohelper
from json import JSONEncoder
from com.freebase.util.JsonEncode import XJsonEncode
# JsonEncode OOo Calc Add-in implementation.
# Based on example by jan@biochemfusion.com April 2009.
class JsonEncodeImpl( unohelper.Base, XJsonEncode ):
def __init__( self, ctx ):
self.ctx = ctx... | Python |
# ========================================================================
# Copyright (c) 2007, Metaweb Technologies, 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:
# * Redistribution... | Python |
# XML generation for JsonEncode OOo Calc Add-in
# based on DoobieDoo example by jan@biochemfusion.com April 2009.
# A unique ID for the add-in.
addin_id = "com.freebase.util.JsonEncode"
addin_version = "0.02"
addin_displayname = "A JSON encoder add-in. Provides JSONENCODE() and FBKEYENCODE() functions."
addin_publish... | Python |
# coding: utf-8
'''
Created on Mar 11, 2009
@author: Tom Morris <tfmorris@gmail.com>
@copyright: 2009 Thomas F. Morris
@license: Eclipse Public License v1 http://www.eclipse.org/legal/epl-v10.html
licensing arrangements)
'''
import codecs
import logging
from math import sqrt
from freebase.api import H... | Python |
'''
Created on Mar 6, 2009
@author: Tom Morris <tfmorris@gmail.com>
@copyright: 2009 Thomas F. Morris
@license: Eclipse Public License v1 http://www.eclipse.org/legal/epl-v10.html
'''
from __future__ import with_statement
import codecs
import csv
from datetime import datetime
from freebase.api import ... | Python |
'''
Created on Mar 6, 2009
This data loader works with the GovTrack.us data file people.xml containing
all U.S. Congress people which can be fetched from
http://www.govtrack.us/data/us/<congress>/repstats/people.xml
e.g. http://www.govtrack.us/data/us/111/repstats/people.xml
@author: Tom Morris <tfmorri... | Python |
# coding: utf-8
'''
Class to encapsulate handling of attributes associated with a person such
as name(s), birth & death dates, etc.
Includes code to attempt to parse a name into its component pieces.
Created on Mar 7, 2009
@author: Tom Morris <tfmorris@gmail.com>
@copyright: 2009 Thomas F. Morris
@license... | Python |
'''
Utility to check Wikipedia Human name disambiguation pages
against Freebase Person topics.
@author: Tom Morris <tfmorris@gmail.com>
@copyright 2009 Thomas F. Morris
@license Eclipse Public License v1
'''
from bfg_session import BfgSession
import bfg_wputil
from freebase.api import HTTPMetawebSession
... | Python |
'''
Utility to extract Math Genealogy ID numbers for mathematicians who are
in both Wikipedia and Freebase
@author: Tom Morris <tfmorris@gmail.com>
@copyright 2009 Thomas F. Morris
@license Eclipse Public License v1
'''
from bfg_session import BfgSession
import bfg_wputil
from freebase.api import HTTPMetaw... | Python |
'''
BFG (Big F*ing Graph) Session Management
Created on Aug 14, 2009
@author: Tom Morris <tfmorris@gmail.com>
@copyright 2009 Thomas F. Morris
@copyright 2007-2009 Metaweb Technologies (see notice below)
@license Eclipse Public License v1
'''
# ===============================================================... | Python |
'''
Utilities for dealing with the WEX index for Wikipedia on Metaweb's BFG
Created on Oct 16, 2009
@author: Tom Morris <tfmorris@gmail.com>
@license: Eclipse Public License
'''
from bfg_session import BfgSession
from datetime import datetime
import logging
log = logging.getLogger('bfg-wputil')
def ... | Python |
'''
Utility to check for and reconcile duplicate Human Language entries which
appear to come from new Wikipedia articles being created for languages and
not getting reconciled on import into Freebase.
Running time: about one hour
Latest results (15 Oct 2009) :
missing : 4
multiple matches: 226 <== duplicat... | Python |
'''
Utility to extract National Register Information System IDs for
National Register of Historic Places listings which are
in both Wikipedia and Freebase using the BFG service to access
the Wikipedia EXtract (WEX).
A later stage of processing will user this information to see
which topics were misreconciled u... | Python |
'''
Program to count the results of a complex query. There are times when either
Freebase is being slow or our queries are too complex for them to be able to
complete without timing out. Rather than trying to get the graph engine to
count them all for us before our timeslice expires, we iteratively fetch them
in... | Python |
'''
The simplest Python program for Freebase.
Display the more recently created 10 topics with their id, name, and types.
'''
from freebase.api import HTTPMetawebSession, MetawebError
COUNT = 10
def main():
session = HTTPMetawebSession('api.freebase.com')
query = [{"t:type":"/common/topic",
... | Python |
'''
Program to count newly created topics of a given type (or which match a query)
for a time period. We start with the desired interval and sub-divide if
necessary due to timeouts during the counting process.
As configured, this show the dramatic spike in new book authors from the
initial OpenLibrary author l... | Python |
'''
Created on Aug 8, 2009
@author: Tom Morris <tfmorris@gmail.com>
@license: Eclipse Public License
@copyright: 2009 Thomas F. Morris
'''
import json
import logging
from optparse import OptionParser
from freebase.api import HTTPMetawebSession, MetawebError
SEPARATORS = (",", ":")
_log = logging.getL... | Python |
'''
Perform mass 'flag for delete' operation on topics which were previously identified as
Wikipedia disambiguation pages (by bfg-wex/person-disambig.py)
!USE THIS SPARINGLY! If you adapt this application for other uses, understand that
multiple human beings will have to review each and every topic that you fl... | Python |
'''
Remove a given type from a set of topics which match a given query.
@author: Tom Morris <tfmorris@gmail.com>
@license: EPL v1
'''
import FreebaseSession
write = False
def main():
session = FreebaseSession.getSessionFromArgs();
if write:
session.login()
q = {'t1:type':'/b... | Python |
'''
Created on September 8, 2009
Find all properties which are reflexive and expect their own type as a target.
@author: Tom Morris <tfmorris@gmail.com>
'''
from freebase.api import HTTPMetawebSession, MetawebError
PROPERTY_MAX = 250 # max number of property instances to consider
TYPE_MAX = 10000 # Max n... | Python |
'''
Created on Aug 3, 2009
@author: Tom Morris <tfmorris@gmail.com>
'''
from freebase.api import HTTPMetawebSession, MetawebError
def main():
session = HTTPMetawebSession('api.freebase.com')
since = "2009-10-01"
query = [{"type":"/pipeline/merge_task",
"timestamp":None,
... | Python |
'''
Geographic utilities
Created on Feb 28, 2009
@author: Tom Morris <tfmorris@gmail.com>
@copyright: 2009,2010 Thomas F. Morris
@license: Eclipse Public License v1 http://www.eclipse.org/legal/epl-v10.html
'''
import logging
from math import cos, sqrt
from pyproj import Proj, transform
from Freeb... | Python |
'''
Created on Jul 24, 2009
@author: Tom Morris <tfmorris@gmail.com>
@copyright: 2009 Thomas F. Morris
@license: Eclipse Public License v1 http://www.eclipse.org/legal/epl-v10.html
'''
import logging
import re
import time
import urllib2
from freebase.api import HTTPMetawebSession, MetawebError
from s... | Python |
'''
Check previously id pairs previously extracted from Wikipedia using
BFG (bfg-wex/nrhp-ids.py) against the current Freebase graph and
note whether they are OK, missing, or have already been added,
but for a different topic (a sign that the two topics need to be
reviewed for merging).
Expected input is a three col... | Python |
'''
Created on Jul 24, 2009
@author: Tom Morris <tfmorris@gmail.com>
@copyright: 2009 Thomas F. Morris
@license: Eclipse Public License v1 http://www.eclipse.org/legal/epl-v10.html
'''
import logging
import re
suffixRe = re.compile('(J|j)r|Sr|II|III|IV|(S|s)econd|2nd|Inc|MD|M\.D\.')
prefixRe = re.compile... | Python |
'''
Load missing NRIS ids into Freebase using FreeQ/Triple Loader. Input is a file of
Wikipedia ID / NRIS ref num tuples. This file is separately generated using
template/infobox data from BFG. Program creates triples to assign keys for the
reference number and add appropriate types to the existing topics.
Created... | Python |
'''
Read the U.S. National Register of Historic Places database and load it
into Freebase.
@requires: dbf from http://dbfpy.sourceforge.net/
@requires: freebase-api from http://freebase-api.code.google.com
@requires: mdbtools
@author: Tom Morris <tfmorris@gmail.com>
@copyright: 2009,2010 Thomas F. Morris... | Python |
'''
Module to parse a National Park Service KML file containing locations for the
National Register of Historic places.
Created on Feb 27, 2009
@author: Tom Morris <tfmorris@gmail.com>
@copyright: 2009 Thomas F. Morris
@license: Eclipse Public License v1 http://www.eclipse.org/legal/epl-v10.html
'''
fro... | Python |
'''
A super simple package of counters with two levels of categorization.
Created on Jul 26, 2009
@author: Tom Morris <tfmorris@gmail.com>
@copyright: 2009 Thomas F. Morris
@license: Eclipse Public License v1 http://www.eclipse.org/legal/epl-v10.html
'''
from collections import defaultdict
class _defaultd... | Python |
'''
Created on Sep 12, 2009
@author: tfmorris
'''
from freebase.api.session import HTTPMetawebSession
def main():
q = {
'type': '/base/usnris/nris_listing',
'/location/location/containedby': [{
'type': '/location/us_state'
}],
'item_number':... | Python |
#!/usr/bin/env python
# Copyright 2010 Morris Blackham
#
#
# 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 Software Foundation, either version 3 of the License, or
# (at your option) any later version.... | Python |
#!/usr/bin/env python
# Copyright 2010 Morris Blackham
#
#
# 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 Software Foundation, either version 3 of the License, or
# (at your option) any l... | Python |
#!/usr/bin/env python
# Copyright 2010 Morris Blackham
#
#
# 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 Software Foundation, either version 3 of the License, or
# (at your option) any later version.... | Python |
#!/usr/bin/env python
# Copyright 2010 Morris Blackham
#
#
# 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 Software Foundation, either version 3 of the License, or
# (at your option) any l... | Python |
#!/usr/bin/env python
# Copyright 2010 Morris Blackham
#
#
# 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 Software Foundation, either version 3 of the License, or
# (at your option) any later version.... | Python |
#!/usr/bin/env python
# Copyright 2010 Morris Blackham
#
#
# 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 Software Foundation, either version 3 of the License, or
# (at your option) any l... | Python |
#!/usr/bin/env python
# Copyright 2010 Morris Blackham
#
#
# 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 Software Foundation, either version 3 of the License, or
# (at your option) any later version.... | Python |
#!/usr/bin/env python
# Copyright 2010 Morris Blackham
#
#
# 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 Software Foundation, either version 3 of the License, or
# (at your option) any l... | Python |
#!/usr/bin/env python
# Copyright 2010 Morris Blackham
#
#
# 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 Software Foundation, either version 3 of the License, or
# (at your option) any later version.... | Python |
#!/usr/bin/env python
# Copyright 2010 Morris Blackham
#
#
# 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 Software Foundation, either version 3 of the License, or
# (at your option) any l... | Python |
#!/usr/bin/env python
# Copyright 2010 Morris Blackham
#
#
# 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 Software Foundation, either version 3 of the License, or
# (at your option) any l... | Python |
#!/usr/bin/env python
# Copyright 2010 Morris Blackham
#
#
# 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 Software Foundation, either version 3 of the License, or
# (at your option) any later version.... | Python |
# Django settings for FreeBouting project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
import imp
try:
imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized t... | Python |
import datetime
def makeInsert(table, args):
global everything
printMe = "insert into bouting_" + table + " values("
lastNull = False
print args
for arg in args:
if arg == "":
printMe = printMe + "NULL, "
lastNull = True
else:
printMe = ... | Python |
import json
import urllib2
import time
import datetime
def importEvent(item, tournament):
print "---EVENT---"
# Parsing the gender from the 5 options (which I don't really understand, but ok)
gender = item['gender'].lower()
if "men" in gender:
gender = "Men"
elif "women" in gender:
... | Python |
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('bouting.views',
(r'^bouting/$', 'index'),
(r'^bouting/personList/$', 'personList'),
(r'^bouting/(?P<person_id>\d+)/$', 'detail'),
(r... | Python |
from django.db import models
import datetime
from django.forms import ModelForm, Textarea, ModelChoiceField
from django.contrib.auth.models import User
from django.core import validators
from django.forms import forms, ModelForm, Textarea, PasswordInput, TextInput
from django import forms
from django.db.models import ... | Python |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | Python |
from django.template import Context, loader
from bouting.models import *
from django.http import HttpResponse
from django.http import Http404
from django.shortcuts import render_to_response, get_object_or_404
from django.core.urlresolvers import reverse
from django.template import RequestContext
from django.contrib.aut... | Python |
from bouting.models import *
from django.contrib import admin
admin.site.register(WeaponRating)
admin.site.register(RefRating)
admin.site.register(Tournament)
#admin.site.register(Club)
admin.site.register(Division)
admin.site.register(Section)
#admin.site.register(UsfaCard)
#admin.site.register(Person)
admin.site.reg... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
import imp
try:
imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized t... | Python |
# freeband.py
# Copyright (C) 2007 Sergio Perez Camacho - BRUE
#
# 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 Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Thi... | Python |
# sngeditor.py
# Copyright (C) 2007 Sergio Perez Camacho - BRUE
#
# 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 Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Th... | Python |
# basicsfx.py
# Copyright (C) 2007 Sergio Perez Camacho - BRUE
#
# 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 Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Thi... | Python |
# basic3d.py
# Copyright (C) 2007 Sergio Perez Camacho - BRUE
#
# 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 Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This... | Python |
# mini taeko ... test for pygame music
# Copyright (C) 2007 Sergio Perez Camacho - BRUE
#
# 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 Software Foundation; either version 2 of the License, or
# (at your option) a... | Python |
import re
import sys
import math
import os.path
from time import time
import maya.OpenMaya as om
import maya.cmds as mc
import maya.OpenMayaAnim as omanim
import maya.OpenMayaMPx as OpenMayaMPx
import pymel.core.datatypes
import pyawd
from pyawd.core import *
from pyawd.anim import *
from pyawd.scene import *
from py... | Python |
import bpy
import bpy.path
from bpy.props import *
from bpy_extras.io_utils import ExportHelper
__all__ = ['awd_export']
bl_info = {
'name': 'Away3D AWD2 format',
'author': 'Richard Olsson',
'blender': (2,5,9),
'api': 35622,
'location': 'File > Export',
'description': 'Export AWD2 files',
... | Python |
import re
import os.path
import functools
import mathutils
from math import radians
import bpy
import pyawd
from pyawd.core import *
from pyawd.anim import *
from pyawd.scene import *
from pyawd.geom import *
from pyawd.material import *
from pyawd.utils.math import *
from pyawd.utils.geom import AWDGeomUtil
class... | Python |
#!/usr/bin/env python
import sys
import getopt
import struct
import zlib
#from pyawd import core
BLOCKS = 0x1
GEOMETRY = 0x2
SCENE = 0x4
ANIMATION = 0x8
include = 0
offset = 0
indent_level = 0
wide_geom = False
wide_geom = True
BT_MESH_DATA = 1
BT_CONTAINER = 22
BT_MESH_INST = 23
BT_SKELETON = 101... | Python |
#!/usr/bin/env python
import os
import sys
import getopt
from distutils.core import setup, Extension
version_macro = ('PYTHON_VERSION', sys.version_info[0])
source_files = [
'src/util.cc',
'src/bcache.cc',
'src/prepgeom.cc',
'src/prepscene.cc',
'src/prepmaterial.cc',
'src/prepanim.cc',
's... | Python |
from pyawd import core
STR_VERTICES = 1
STR_TRIANGLES = 2
STR_UVS = 3
STR_VERTEX_NORMALS = 4
STR_VERTEX_TANGENTS = 5
STR_JOINT_INDICES = 6
STR_JOINT_WEIGHTS = 7
class AWDSubGeom:
def __init__(self):
self.__data_streams = []
def add_stream(self, type, data):
self.__data_streams.append((type,da... | Python |
import struct
import sys
# Compression constants
UNCOMPRESSED = 0
DEFLATE = 1
LZMA = 2
class AWDBlockBase(object):
def __init__(self, type=0):
super(AWDBlockBase, self).__init__()
self.__type = 0
def write_block(self, file, addr):
file.write(struct.pack('>IBBI', addr, 0, self.__type,... | Python |
class AWDGeomUtil(object):
def __init__(self):
self._vertices = []
self.normal_threshold = 0.0
def append_vert_data(self, index, pos, uv=None, norm=None, joint_wheights=None, joint_indices=None, force_hard = False):
if uv is None:
uv = [0,0]
if norm is None:
... | Python |
class AWDMatrix3x4(object):
def __init__(self, raw_data=None):
self.raw_data = raw_data
if self.raw_data is None:
self.raw_data = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]
class AWDMatrix2x3(object):
def __init__(self, raw_data=None):
self.raw_data = raw_data
if self.raw_... | Python |
__all__ = [ 'geom', 'math' ]
| Python |
from pyawd import utils
from pyawd import core
class AWDSceneBlockBase(core.AWDAttrElement, core.AWDBlockBase):
def __init__(self, name='', transform=None):
super(AWDSceneBlockBase, self).__init__()
self.__children = []
self.__parent = None
self.name = name
self.transform ... | Python |
class AWDWriter(object):
def __init__(self):
self.__block_addr = 1
def write(self, awd, file):
def write_blocks(blocks):
for b in blocks:
b.write_block(file, self.__block_addr)
self.__block_addr += 1
write_blocks(awd.texture_blocks)
... | Python |
from pyawd import utils
from pyawd import core
class GenericAnimFrame(object):
def __init__(self, data=None, duration=0):
self.duration = duration
self.data = data
class GenericAnim(object):
def __init__(self, frames):
super(GenericAnim, self).__init__()
self.__frames = frame... | Python |
__all__ = [ 'core', 'anim', 'geom', 'material', 'scene' ]
version = ('PyAWD', 2, 0, 0, 'a')
try:
from pyawd import cpyawd
# Ignore release letter for final releases
release = chr(cpyawd.LIBAWD_VERSION_RELEASE)
if release == 'f':
release = ''
backend = ('libawd',
cpyawd.LIBAWD_VER... | Python |
from pyawd import core
class AWDBitmapTexture(core.AWDAttrElement, core.AWDBlockBase):
EXTERNAL = 0
EMBED = 1
def __init__(self, type=0, name='', url=None):
super(AWDBitmapTexture, self).__init__()
self.type = type
self.name = name
self.url = url
def embed_file(self, ... | Python |
import numpy as np
import cv2
import urllib2
import socket
import sys
import math
import os
class Processor:
def get_blue(self, img):
blue = cv2.split(img)[2]
return blue
def get_blue_hue(self, img):
#filters img based on hsv values of blue
#may need finetuning based on lighting conditions... | Python |
# $Id: session.py,v 1.14 2010/03/20 18:29:22 jribbens Exp $
import time, hmac, re, random, os, errno
try:
import hashlib
sha = hashlib.sha1
shanew = hashlib.sha1
except ImportError:
import sha
shanew = sha.new
try:
import cPickle as pickle
except ImportError:
import pickle
class Error(Exce... | Python |
class BasicHandler:
def __init__(self):
pass
| Python |
import handler
from models import directories
class CreateDir(handler.BasicHandler):
def run(self, app, input):
self.input = input
if not self.is_valid_input(): return { error: 'InvalidArguments' }
def is_valid_input(self):
return 'directory' in self.input or 'directoryId' in ... | Python |
import handler
from models import directories
class ListDir(handler.BasicHandler):
def run(self, app, input):
self.input = input
if 'directory' not in self.input: return { 'error': 'InvalidArguments' }
result = directories.get_by_hierarchical_path(self.input['directory'])
... | Python |
__all__ = [
'topicwrite',
'getfile',
'mkdir',
'listdir',
'login',
] | Python |
# -*- coding: utf-8 -*-
import dbo, sys
from string import Template
from web.db import sqlquote
from objects.directory import Directory
def _parse_hierarchy(paths):
"""
Распарсивает иерархию на join'ы
@param list paths
@return list
"""
vars = {}
left_joins = []
dir_no = ... | Python |
#-*- encoding: utf-8 -*-
import web
__conn = None
def connect(*arg, **kwarg):
global __conn
__conn = web.database(*arg, **kwarg)
def get_conn():
global __conn
return __conn
def get_cursor():
"""
Возвращает подключение к БД в стандартном для Python формате
"""
return ... | Python |
__all__ = ['users', 'directories'] | Python |
#-*- encoding: utf-8 -*-
import web
#web.config.debug = False
from apihandler import *
from handlers import *
from models import dbo
# Соединяемся с БД
dbo.connect(dbn='mysql', user='root', pw='', db='console')
# Добавляем команды
handlers = {
# Пользователи
'login' : login.Login,
'... | Python |
#-*- encoding: utf-8 -*-
import web
import json
from objects.entity import Entity
def json_encode(func):
"""
Декоратор для вывода всех данных в JSON
@return func
"""
def encode(*args, **kwargs):
result = func(*args, **kwargs)
if isinstance(result, Entity):
... | Python |
class Entity(object):
_data = None
def __init__(self, data = None):
if hasattr(self, '_default_data'):
self._data = self._default_data.copy()
if data is not None:
for key in data.iterkeys():
self._data[key] = data[key]
else:... | 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.