code stringlengths 1 199k |
|---|
from pyfeyner import *
from pyfeyner.user import *
fd = FeynDiagram()
pt_in = Vertex(0, 0)
pt_out = Vertex(0, 6)
vtx = Vertex(3, 3)
f = Fermion(pt_in, pt_out).arcThru(vtx)
fd.draw("test-bend90a.pdf") |
from admin_views import * |
"""
Command line interface for cobbler.
Copyright 2006-2009, Red Hat, Inc and Others
Michael DeHaan <michael.dehaan AT gmail>
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 Li... |
from django.shortcuts import render, render_to_response
from django.contrib.auth import authenticate, login, logout
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.views.generic import ListView
from bookrental.forms import UserCreateForm
from bookrental.models import Book
f... |
import regexUtils
import re
import urllib
import urlparse
def findJS(data):
idName = '(?:f*id|ch)'
jsName = '([^\"\']+?\.js[^\"\']*?)'
regex = "(?:java)?scr(?:'\+')?ipt.*?" + idName + "\s*=\s*[\"']([^\"']+)[\"'][^<]*</scr(?:'\+')?ipt\s*>[^<]*<scr(?:'\+')?ipt[^<]*src=[\"']" + jsName + "[\"']"
jscript = r... |
import os
debug = False
debug_word = ""
LOCAL_PATH = os.path.dirname(os.path.realpath(__file__))
import web
import os
import re
if not debug_word:
import random
syllables = 0
glorand_word = ""
urls = (
"/", "index"
)
class index:
def GET(self):
return render.index("pyku")
def pyku():
"""
Bui... |
__revision__ = "$Id$"
import os
import re
from invenio.dbquery import run_sql
from invenio.websubmit_config import InvenioWebSubmitFunctionStop
def Check_Group(parameters, curdir, form, user_info=None):
"""
Check that a group exists.
Read from file "/curdir/Group"
If the group does not exist, switch to ... |
import unittest
from geobricks_modis.core import modis_core as c
class GeobricksModisTest(unittest.TestCase):
def test_get_modis_product_table(self):
products = c.get_modis_product_table()
self.assertEqual(len(products), 68)
def test_list_products(self):
products = c.list_products()
... |
from __future__ import print_function
"""BibMatch - tool to match records with database content of an Invenio instance,
either locally or remotely through invenio_connector."""
__revision__ = "$Id$"
import sys
if sys.hexversion < 0x2040000:
# pylint: disable=W0622
from sets import Set as set #for "&" intersecti... |
"""
Caching of generated images.
"""
import time
import weakref
try:
import popplerqt4
except ImportError:
from . import popplerqt4_dummy as popplerqt4
from PyQt4.QtCore import Qt, QThread
from . import render
from . import rectangles
from .locking import lock
__all__ = ['maxsize', 'setmaxsize', 'image', 'gener... |
import select
import socket
from dulwich.protocol import Protocol, TCP_GIT_PORT, extract_capabilities
class SimpleFetchGraphWalker(object):
def __init__(self, local_heads, get_parents):
self.heads = set(local_heads)
self.get_parents = get_parents
self.parents = {}
def ack(self, ref):
... |
import sys
import seq
import os
from logger import Logger
"""
right now this just chooses the longest
BEWARE, this writes over the file
"""
if __name__ == "__main__":
if len(sys.argv) != 4 and len(sys.argv) != 5:
print("python "+sys.argv[0]+" table clusterdir fending [logfile]")
sys.exit(0)
fend... |
from mmap import mmap
class gifxmp:
def __init__(self,filename):
self.mmaped = self.__mmap(filename)
self.fst = self.__checkxmp()
if self.fst != -1:
self.xml = self.__loadxmppacket()
print self.xml
## dict = ModuleXML.parsexmp(self.xml) ##
def __mmap(self,filename):
with open(filename,"r+b") as fd:
... |
import unittest
import thread
from jcl.tests import JCLTestCase
import jcl.model as model
from jcl.error import FieldError
from jcl.model.account import Account, PresenceAccount, User
import jmc.model.account
from jmc.model.account import MailAccount, POP3Account, IMAPAccount, \
GlobalSMTPAccount, AbstractSMTPAccou... |
"""
This file re-creates the major DFXML classes with an emphasis on type safety, serializability, and de-serializability.
With this module, reading disk images or DFXML files is done with the parse or iterparse functions. Writing DFXML files can be done with the DFXMLObject.print_dfxml function.
"""
__version__ = "0.... |
from action import *
from conn import *
from logic import *
from log import *
from protocol import *
from schedule import *
from server import *
from util import * |
from django.core.exceptions import ImproperlyConfigured
from django import VERSION
if VERSION[0]<1 and VERSION[1]<7:
raise ImproperlyConfigured("""
The app_config required 1.7 or higher version of django.
""")
from .core import AppCache |
"""test passlib.hosts"""
from __future__ import with_statement
import logging; log = logging.getLogger(__name__)
import warnings
from lib.passlib import hosts, hash as hashmod
from lib.passlib.utils import unix_crypt_schemes
from lib.passlib.tests.utils import TestCase
class HostsTest(TestCase):
"""perform general ... |
"""
***************************************************************************
BarPlot.py
---------------------
Date : January 2013
Copyright : (C) 2013 by Victor Olaya
Email : volayaf at gmail dot com
*******************************************************... |
from netbench.pattern_match.b_symbol import io_mapper
from netbench.pattern_match.sym_char import b_Sym_char
from netbench.pattern_match.sym_kchar import b_Sym_kchar
from netbench.pattern_match.sym_string import b_Sym_string
from netbench.pattern_match.sym_char_class import b_Sym_char_class
from netbench.pattern_match.... |
"""optparse - a powerful, extensible, and easy-to-use option parser.
By Greg Ward <gward@python.net>
Originally distributed as Optik; see http://optik.sourceforge.net/ .
If you have problems with this module, please do not file bugs,
patches, or feature requests with Python; instead, use Optik's
SourceForge project pag... |
from matplotlib import rcParams, rc
import numpy as np
import sys
from fitFunctions import gaussian
import scipy.interpolate
import scipy.signal
from baselineIIR import IirFilter
import pickle
import smooth
params = {'savefig.dpi': 300, # save figures to 300 dpi
'axes.labelsize': 14,
'text.fontsize'... |
import swisseph as swe
import unittest
class TestSweLunEclipse(unittest.TestCase):
@classmethod
def setUpClass(cls):
swe.set_ephe_path()
def test_01(self):
jd = 2454466.5
flags = swe.FLG_SWIEPH
geopos = (12.1, 49.0, 330)
rflags, tret = swe.lun_eclipse_when(jd, flags, ... |
""" A set of utilities, mostly for post-processing and visualization
We put arrays on disk as raw bytes, extending along the first dimension.
Alongside each array x we ensure the value x.dtype which stores the string
description of the array's dtype.
See Also:
------------
@url
.. image::
@author epnev
"""
from builti... |
import os
from csvn.core import *
from csvn.repos import RemoteRepository, RepositoryURI
from csvn.auth import User
from optparse import OptionParser
usage = """python mucc.py [OPTION]... [ACTION]...
Actions:
cp REV URL1 URL2 copy URL1@REV to URL2
mkdir URL create new directory URL
mv URL1 URL2 ... |
import os
import re
import subprocess
import sys
import threading
import time
import urllib
from subprocess import Popen, PIPE
sys.path.append("..")
from check_with_sitemap import CheckWithSitemap
DEFAULT_JAVA_PATH = 'java'
class CheckWithSiteMapVpro(CheckWithSitemap):
"""
This specialization is customized for ... |
import ntpath
import os
import sys
from test.test_support import TestFailed
from test import test_support, test_genericpath
import unittest
def tester0(fn, wantResult):
gotResult = eval(fn)
if wantResult != gotResult:
raise TestFailed, "%s should return: %r but returned: %r" \
%(fn, wantRe... |
import bpy
import time
import mathutils
import math
from math import *
from mathutils import *
from bpy.props import *
from bpy_extras import object_utils
import sys, numpy,pickle
from cam.chunk import *
from cam.collision import *
from cam.simple import *
from cam.pattern import *
from cam.polygon_utils_cam import *
f... |
"""
This is a collection of classes that contain data for files from a
sosreport in the directory:
var/log/*
@author : Shane Bradley
@contact : sbradley@redhat.com
@version : 2.16
@copyright : GPLv2
"""
class VarLogMessagesMsg:
def __init__(self, orginalMessage, timestamp, hostname, messageSender, pid, mes... |
"""B2share records errors."""
from jsonschema.exceptions import ValidationError
from invenio_rest.errors import RESTValidationError, FieldError
class B2ShareRecordsError(RESTValidationError):
"""B2Share records error."""
class InvalidRecordError(B2ShareRecordsError):
"""Raise when a record is invalid."""
class ... |
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import Selector
from lyricwiki.items import LyricWikiItem
class LyricWikiSpider(CrawlSpider):
name = "mastakilla" #CHANGE NAME
allowe... |
from .Gender import Gender
from .Profile import Profile
from .Measurement import Measurement
from .MeasurementSource import MeasurementSource
from .MeasurementType import MeasurementType
from .MeasurementUnit import MeasurementUnit |
__author__ = "Devin Kelly"
import pymongo
import time
import json
import re
import os
import daemon
from datetime import datetime
from tornado import httpclient, ioloop
def parseHTML(htmlData):
expr = re.compile("In current traffic: [0-9]{0,2} mins")
matches = re.finditer(expr, htmlData)
trafficData = []
fo... |
from tempfile import NamedTemporaryFile
from django.contrib.sites.models import Site
from django.template.loader import render_to_string
from django.utils import translation
import re, subprocess
import cStringIO as StringIO
from django.conf import settings
WETO_REQUEST_FORMAT_NAME = getattr(settings, 'WETO_REQUEST_FOR... |
__all__ = ["pval_task", "annotation_task"] |
import PyQt5.sip as sip
sip.setapi('QString', 2)
from PyQt5 import QtCore, QtGui, QtWidgets
import sys
import os
import sqlite3 as sqlite
sys.path.append(os.path.join(os.getcwd(), 'Generic'))
genericPath = sys.path[len(sys.path) - 1]
sys.path.append(os.path.join(genericPath, 'Kernel'))
sys.path.append(os.path.join(gen... |
import askapdev.sphinx
askapdev.sphinx.project = u'askap.parset'
from askapdev.sphinx.conf import *
version = 'current'
release = 'current' |
from django.contrib.auth.decorators import login_required, permission_required,\
user_passes_test
from django.shortcuts import render_to_response, get_object_or_404
from django.template.context import RequestContext
from project.tramitacao.forms import FormTipoCaixa
from django.http import HttpResponseRedirect
from... |
from kivy.support import install_twisted_reactor
install_twisted_reactor()
from twisted.internet import reactor
from twisted.internet import protocol
class EchoProtocol(protocol.Protocol):
def dataReceived(self, data):
response = self.factory.app.handle_message(data)
if response:
self.tr... |
import sys
from geopy import Point
from django.apps import apps as django_apps
from django.core.exceptions import ImproperlyConfigured
from django.core.management.color import color_style
from .geo_mixin import GeoMixin
LANDMARK_NAME = 0
LATITUDE = 2
LETTERS = list(map(chr, range(65, 91)))
LONGITUDE = 1
style = color_s... |
from __future__ import division
import numpy as np
from fatiando.gravmag.euler import Classic, ExpandingWindow, MovingWindow
from fatiando.gravmag import sphere, fourier
from fatiando.mesher import Sphere
from fatiando import utils, gridder
model = None
xp, yp, zp = None, None, None
inc, dec = None, None
struct_ind = N... |
'''
Created on Jan 6, 2013
__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 2012-2013, Intel Corp."
__credits__ = ["Elizabeth Flanagan"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "Elizabeth Flanagan"
__email__ = "elizabeth.flanagan@intel.com"
'''
from buildbot.steps.shell import Shell... |
import os, sys, shutil, zipfile, tempfile, re, time, datetime, platform, subprocess, multiprocessing
from os.path import join, exists, dirname, basename, getmtime
from argparse import ArgumentParser, REMAINDER
import mx
import sanitycheck
import itertools
import json, textwrap
_graal_home = dirname(dirname(__file__))
"... |
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GLib
from sepolicy.sedbus import SELinuxDBus
import sys
import sepolicy
import selinux
from selinux import DISABLED, PERMISSIVE, ENFORCING
import sepolicy.network
import sepolicy.manpage
import dbus
import time
import os
import re
imp... |
"""
Example demonstrating how to use the ``input_label`` to send images between
blocks.
This mechanism is useful to perform fake tests by using using generated images
instead of cameras to read images.
Required hardware:
- Any camera
"""
import crappy
if __name__ == "__main__":
cam1 = crappy.blocks.Camera('Webcam')... |
"""
This is the Host Storage Manager module.
"""
import os
import threading
import logging
import glob
from fnmatch import fnmatch
from itertools import imap
from collections import defaultdict
from functools import partial, wraps
import errno
import time
import signal
import types
import math
import numbers
import sta... |
import cv2
import sys
from os import path, getenv
PPRZ_SRC = getenv("PAPARAZZI_SRC", path.normpath(path.join(path.dirname(path.abspath(__file__)), '../../../')))
sys.path.append(PPRZ_SRC + "/sw/ext/pprzlink/lib/v1.0/python")
from pprzlink.ivy import IvyMessagesInterface
from pprzlink.message import PprzMessage
class Rt... |
'''
This module controls the dialog to set filter criteria
'''
from PyQt5 import QtCore, Qt, QtWidgets
from views.filter_dialog import Ui_FilterDialog
class FilterGamesController(QtWidgets.QDialog):
'''
Controller object for the filter games dialog.
'''
def __init__(self, table, parent=None):
Qt... |
"""thumbbar.py - Thumbnail sidebar for main window."""
import urllib
import Queue
import gtk
import gobject
import threading
from mcomix.preferences import prefs
from mcomix import image_tools
from mcomix import tools
from mcomix import constants
from mcomix import callback
class ThumbnailSidebar(gtk.HBox):
"""A th... |
from Components.Converter.Converter import Converter
from Components.Element import cached
from pprint import pprint
class Streaming2(Converter):
@cached
def getText(self):
service = self.source.service
if service is None:
return "-NO SERVICE\n"
streaming = service.stream()
s = streaming and streaming.getS... |
from enigma import eConsoleAppContainer
from Components.Console import Console
from Components.About import about
from Components.PackageInfo import PackageInfoHandler
from Components.Language import language
from Components.Sources.List import List
from Components.Ipkg import IpkgComponent
from Components.Network impo... |
__author__ = 'fatihka'
from sqlalchemy import Column, Integer, String, Unicode, Float, Boolean, create_engine, Table
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
db_name = ':memory:'
tanimlar = {'company': 'Fatih Ka.', 'optional': 'NO'}
periodss = list()
len_periods = ... |
from django.views.generic.base import TemplateView
from sarGraphs.lib.sar import get_cpu, get_load
from sarGraphs.lib.sar import get_swap, get_memory
class HomeView(TemplateView):
'Home Page View'
template_name = "home.html"
def get_context_data(self, **kwargs):
context = {}
context['cpu'] =... |
from django.contrib import admin
from django.utils.translation import ugettext as _
from .models import Project, Repository
class ProjectAdmin(admin.ModelAdmin):
"""
Admin interface class for project model
"""
list_display = ("__unicode__", "version", "home", "license", "vcs",
"creat... |
from optparse import OptionParser
from datetime import datetime
from datetime import timedelta
import pyopencl as cl
import numpy as np
import time
MIN_ELAPSED = 0.25
KEY_LENGTH = 64
BUF_MAX_SIZE= 1024 * 1024
class BurnInTarget():
def __init__(self, platform, kernel):
self.name = platform.get_info(cl.platfo... |
"""Spell checking provider
"""
import os, sys
import wx
from wx.lib.pubsub import Publisher
from peppy.yapsy.plugins import *
from peppy.lib.stcspellcheck import *
class SpellCheck(IPeppyPlugin):
"""Plugin for spell check provider
This simple plugin provides the spelling checker for Fundamental mode.
"""
... |
"""extends the standard Python gettext classes
allows multiple simultaneous domains... (makes multiple sessions with different languages easier too)"""
import gettext
import locale
import os.path
from errno import ENOENT
from jToolkit import languagenames
class ManyTranslations(gettext.NullTranslations):
"""this prox... |
from setuptools import setup, find_packages
import sys, os
version = '0.1'
setup(
name='appserver',
version=version,
description="Sample application server for bilsbrowser",
long_description="""\
""",
classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
k... |
'''
IADC safety factor recommendations:
drilling and other routine operations = 3
mast rising = 2.5
setting casing = 2
jarring = 2
'''
def get_float(message, default):
try:
f=input (message)
st=type(f)
if f==0:
f=default
return float(f) ##dodo
elif f==" ":
f=default
return float(f) ##dodo... |
from distutils.core import setup, Extension
include_dirs = ['/usr/include', '/usr/local/include']
library_dirs = ['/usr/lib', '/usr/local/lib']
libraries = ['jpeg']
runtime_library_dirs = []
extra_objects = []
define_macros = []
setup(name = "pyjpegoptim",
version = "0.1.1",
author = "Guangming Li",
a... |
import sys
import re
import os
import urllib2
import optparse
from subprocess import Popen, PIPE
from modules.Utils import GREEN, RED, ENDC
from modules.Packages import packageInPkgdb
from modules.Utils import FormatedPrint
from modules.ImportPath import ImportPath
from modules.ImportPathsDecomposer import ImportPathsD... |
import logging
import time
import datetime
__version__ = "0.1"
__applic__ = "Live F1 Web"
__author__ = "Marc Bertens"
class F1Text( object ):
def __init__( self, ts = 0, c = '', t = '' ):
self.timestamp = ts
self.clock = c
self.text = t
return
def reset( self ):
... |
from itertools import izip
import numpy
import time
import ds9
from sherpa.utils import get_keyword_defaults, SherpaFloat
from sherpa.utils.err import DS9Err
_target = 'sherpa'
def _get_win():
return ds9.ds9(_target)
def doOpen():
_get_win()
def isOpen():
targets = ds9.ds9_targets()
if targets is None:
... |
import re
import sys
binary_funcs = [ "and", "nand", "or", "nor", "xor" ]
compare_funcs = [ "=", "/=", ">", ">=", "<", "<=" ]
vec_types = ['UNSIGNED', 'SIGNED']
logics = ['bit', 'std']
logic_types = {'bit' : 'bit', 'std': 'sl_x01' }
logic_undefs = {'bit' : "'0'", 'std': "'X'" }
logic = 'xx' # Current logic, either bit ... |
import re
from widgetastic_patternfly import Input, BootstrapSelect
from wrapanapi.hawkular import Hawkular
from cfme.common import TopologyMixin
from cfme.common.provider import DefaultEndpoint, DefaultEndpointForm
from cfme.utils.appliance import Navigatable
from cfme.utils.appliance.implementations.ui import navigat... |
"""This module contains code to load legacy user save data."""
import pickle
import re
from .build import NUM_MACROS, NULL_SYMBOL, key_mode_map, led_modes, led_assignments
from .scancodes import scancodes
from .userdata import Map
legacy_layers = ["Default", "Layer 1", "Layer 2", "Layer 3", "Layer 4",
... |
import math
import numpy
import pyaudio
import time
import ntplib
def sine(frequency, length, rate):
length = int(length * rate)
factor = float(frequency) * (math.pi * 2) / rate
return numpy.sin(numpy.arange(length) * factor)
chunks = []
chunks.append(sine(440, 1, 44100))
chunk = numpy.concatenate(chunks) *... |
"""
Use this class to fork off a thread to recieve event callbacks from the bitbake
server and queue them for the UI to process. This process must be used to avoid
client/server deadlocks.
"""
import socket, threading, pickle, collections
from xmlrpc.server import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
class BB... |
from Sire.IO import *
from Sire.MM import *
from Sire.System import *
from Sire.Mol import *
from Sire.Maths import *
from Sire.FF import *
from Sire.Move import *
from Sire.Units import *
from Sire.Vol import *
from Sire.Qt import *
import os
coul_cutoff = 20 * angstrom
lj_cutoff = 10 * angstrom
amber = Amber()
(molec... |
""" Dropbox upload daemon.
"""
from fnmatch import fnmatch
from operator import itemgetter
from os import listdir, path, mknod, stat
from time import strptime, sleep, time
from dropbox.client import DropboxClient, DropboxOAuth2FlowNoRedirect
from dropbox.rest import ErrorResponse
from urllib3.exceptions import MaxR... |
'''
@author: Pedro Peña Pérez
'''
import sys
import logging
from exe.engine.persistxml import encodeObjectToXML
from exe.engine.path import Path
from exe.engine.package import Package
from exe.export.scormexport import ScormExport
from exe.export.imsexport import IMSExport
from exe.export.websiteexport import WebsiteEx... |
"""
Copyright (C) 2007-2013 Guake authors
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 program is distributed in the hop... |
import socket
import re
import binascii
import struct
import time
import sys
import random
from base64 import b64encode
from hashlib import sha1
from thread import *
events = "/var/www/map/eventstream"
with open(events) as f:
content = f.read().splitlines()
f.close()
websocket_answer = (
'HTTP/1.1 101 Switching Pr... |
from wax import *
class MainFrame(Frame):
def Body(self):
app = core.GetApp()
print app
assert isinstance(app, Application)
app = Application(MainFrame, title="core-getapp")
app.Run() |
import os
import glob
v = "Version 0.1"
fastq_indir = "/home/chris/transcriptome/fastq/trimmed/"
fastq_outdir = "/home/chris/transcriptome/fastq/reports/quality stats"
print "Analyzing Sample 1..."
os.system("fastx_quality_stats -i %s/Sample_1_L001_trimmed.fastq %s/Sample_1_L001_trimmed.txt" % (fastq_indir, fastq_outd... |
from sre_parse import isdigit
import sys
__author__ = 'jpijper'
import roslib; roslib.load_manifest('smach_tutorials')
import rospy
import smach_ros
from DialogStateMachine import SMDialog
def main():
# To restrict the amount of feedback to the screen, a feedback level can be given on the command line.
# Level ... |
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0006_auto_20141207_2112'),
]
operations = [
migrations.AlterField(
model_name='ward',
... |
import Image
import operator
def _border(border):
if type(border) is type(()):
if len(border) == 2:
left, top = right, bottom = border
elif len(border) == 4:
left, top, right, bottom = border
else:
left = top = right = bottom = border
return left, top, right, ... |
import logging
from gettext import gettext as _
import sys
import gconf
import glib
import gobject
import gtk
import dbus
from sugar.graphics import style
from sugar.graphics.icon import get_icon_state
from sugar.graphics.tray import TrayIcon
from sugar.graphics.palette import Palette
from sugar.graphics.xocolor import... |
import numpy as np
mecanum_matrix = np.matrix([
[+1, +1, +1, +1], # Unitless! Shooting for rad/s
[+1, -1, +1, -1], # Unitless! Shooting for rad/s
[+1, +1, -1, -1], # Unitless! Shooting for rad/s
# [+1, -1, -1, +1], # This is the error row (May not be necessary)
], dtype=np.float32) / 4.0 # All of t... |
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm.load_numbers('../data/fm_train_real.dat')
testdat = lm.load_numbers('../data/fm_test_real.dat')
label_traindat = lm.load_labels('../data/label_train_twoclass.dat')
parameter_list = [[traindat,testdat,label_traindat,1,1e-5],[traindat,testdat,label_traindat,... |
"""
Automatic generated reports can be edited by an healthprofessional during
handling filled in controls (questionnaires) by a patient. The report
can be exported in docX and PDF format.
""" |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import models
class Noticia(models.Model):
Publicado = 'Publicado'
Borrador = 'Borrador'
Titulo = models.CharField(max_length=30)
Subtitulo = models.CharField(max_length=50)
Imagen = models.FileField(blank=True, uplo... |
"""
--------------------------------------------------------------------------------------------------
prc_aproximacao
procedimento de aproximação de acordo com o aeródromo e pista estabelecidos
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as ... |
from glob import iglob
from os.path import basename, exists, isdir, join
from time import time
__all__ = ('Loc',)
__version__ = '16.10.25'
class Loc(object):
'''Lines-Of-Code accumulator.
'''
blank = 42
comment = 0
files = 0
source = 0
ext = '.py'
_time0 = 0
_recurse = False... |
'''apport package hook for udisks
(c) 2009 Canonical Ltd.
Author: Martin Pitt <martin.pitt@ubuntu.com>
'''
import os
import os.path
import apport.hookutils
import dbus
UDISKS = 'org.freedesktop.UDisks'
def add_info(report):
apport.hookutils.attach_hardware(report)
user_rules = []
for f in os.listdir('/etc/u... |
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
exce... |
from base_classes import EndCondition as _EndCondition
class MinLength(_EndCondition):
'End simulation after duration seconds.'
__slots__ = ['duration']
def __init__(self, value=None, label=None):
self.value = int(value)
_EndCondition.__init__(self, label=label)
def reset(self):
... |
get_ipython().system('pip install -I "phoebe>=2.2,<2.3"')
get_ipython().run_line_magic('matplotlib', 'inline')
import phoebe
from phoebe import u # units
import numpy as np
import matplotlib.pyplot as plt
logger = phoebe.logger()
b = phoebe.default_binary()
b.add_dataset('lc', times=phoebe.linspace(0,1,101))
b.run_comp... |
import json
import time
import git
import discord
import os
import aiohttp
from cogs.utils.dataIO import dataIO
from urllib.parse import quote as uriquote
try:
from lxml import etree
except ImportError:
from bs4 import BeautifulSoup
from urllib.parse import parse_qs, quote_plus
def load_config():
with open(... |
from tasty.types import conversions
from tasty.types import *
from tasty.types.driver import TestDriver
__params__ = {'la': 32, 'lb': 32, 'da': 10}
driver = TestDriver()
def protocol(client, server, params):
server.ga = Garbled(val=Unsigned(bitlen=764, dim=[1], signed=False, passive=True, empty=True), signed=False,... |
from __future__ import absolute_import
import unittest as ut
import tempfile
from mock import MagicMock, sentinel, call
from hopr.tool.run import * # Run, parse_args, run
class Test1Misc(ut.TestCase):
def test_timeout(self):
dt = 0.01
e = 0.001
timeout = Timeout(dt)
t1 = time()
... |
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth import authenticate, login
from django.contrib.auth import logout
from django.contrib.auth.decorators import login_required
import time
from ControlUsuarios.forms import *
from ControlUsuarios.models import UserProfile
from django.http import... |
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_classification
import numpy as np
def predictClothesGeneral(temp):
dataFile = open("data.txt")
data = dataFile.read()
data = data.split("\n")
X = []
Y = []
Y2 = []
for i in range... |
""" The benchmarks below are useful for testing performance when making changes to the maze algorithms. """
from datetime import datetime
from sysconfig import get_python_version
from timeit import Timer
from mazelib import __version__ as version
SIZES = [5, 10, 25, 50, 100]
ITERATIONS = [100, 50, 20, 5, 1]
GENERATORS ... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding M2M table for field last_read_by on 'Message'
m2m_table_name = db.shorten_name(u'digiapprov... |
import sublime
import sublime_plugin
import re
import os
import datetime
TMLP_DIR = 'templates'
KEY_SYNTAX = 'syntax'
KEY_FILE_EXT = 'extension'
IS_GTE_ST3 = int(sublime.version()) >= 3000
PACKAGE_NAME = 'new-file-pro'
PACKAGES_PATH = sublime.packages_path()
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
class ... |
'''
create ardupilot terrain database files
'''
from MAVProxy.modules.mavproxy_map import srtm
import math, struct, os, sys
import crc16, time, struct
TERRAIN_GRID_MAVLINK_SIZE = 4
TERRAIN_GRID_BLOCK_MUL_X = 7
TERRAIN_GRID_BLOCK_MUL_Y = 8
TERRAIN_GRID_BLOCK_SPACING_X = ((TERRAIN_GRID_BLOCK_MUL_X-1)*TERRAIN_GRID_MAVLINK... |
"""
DGA: Implementation of the Distributed Greedy Algorithm for channel assignment
The DMP class handles the control flow after the initialization of DGA.
Authors: Simon Seif <seif.simon@googlemail.com>,
Felix Juraschek <fjuraschek@gmail.com>
Copyright 2008-2013, Freie Universitaet Berlin (FUB). All righ... |
from __future__ import unicode_literals
from django.db import migrations, models
import markupfield.fields
class Migration(migrations.Migration):
dependencies = [
('cal', '0005_attachment_comment'),
]
operations = [
migrations.AddField(
model_name='task',
name='_body_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.