code stringlengths 1 199k |
|---|
from rest_framework import serializers
from rest_framework.validators import UniqueValidator
from rest_framework_jwt.settings import api_settings
from accounts.models import CustomUser
from accounts.api.utils.jwt import jwt_payload_handler
jwt_encode_handler = api_settings.JWT_ENCODE_HANDLER
class UserFullSerializer(se... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^website/', include('website.foo.urls')),
url(r'^$', 'website.views.home'),
url(r'^pages/', include('pages.urls')),
url(r'^blog/', include('blog.ur... |
from entries import Song
from tagcomp import tag_group_similarity,find_best_tag_group
class MergeFile(object):
"""Object holding all information needed to create a song
Is basically a conclumeration of multiple, similar, files.
"""
def __init__(self,file_ = None):
"""Constructs the conclumeratio... |
"""
MagPy-absolutes:
Analysis of DI data.
Uses mainly two classes
- DILineStruct (can contain multiple DI measurements; used for storage, database com and autodif)
- AbsStruct (contains a single measurement, is extended by variation and scalar data, used for calculation)
Calculation returns a data stream with absolute ... |
from inspect import getargspec, ismethod
def total_ordering(cls):
"""Class decorator that fills in missing ordering methods"""
convert = {
'__lt__': [('__gt__', lambda self, other: not (self < other or self == other)),
('__le__', lambda self, other: self < other or self == other),
... |
import pandas as pd
import numpy as np
from sklearn.decomposition import PCA
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import plotly.plotly as py
import plotly.graph_objs as go
import matplotlib.pyplot as plt
path = 'C:\\Users\\michel\\Desktop\\Spectrecourrier\\CSV\\Jam_clustering\\A... |
class Station:
pass |
from urllib2 import urlopen, build_opener, install_opener
from urllib2 import Request, HTTPSHandler
from urllib2 import URLError, HTTPError
from urllib import urlencode
import random
import datetime
import time
import uuid
import hashlib
import socket
def generate_uuid(basedata = None):
""" Provides a _random_ UUID... |
import wx
from wxbanker.lib.pubsub import Publisher
import wx.lib.delayedresult as delayedresult
import re, datetime
from wxbanker import currencies
from wxbanker.bankobjects.ormobject import ORMKeyValueObject
from wxbanker.bankobjects.accountlist import AccountList
from wxbanker.mint.api import Mint
from wxbanker.curr... |
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 field 'PurpleRobotReading.size'
db.add_column(u'purple_robot_app_purplerobotreading', 'size... |
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('payments', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... |
from utils.exceptions import BinarySkyException, FatalError
class DatabaseFatalError(FatalError):
'''This raises if something very bad happens to database.
For example, if we cannot be sure that its data is still reliable.
'''
class DatabaseException(BinarySkyException):
'''Base of errors in the databas... |
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Missile Launcher Operation"),
"maxVelocity", ship.getModifiedItemAttr("shipBonusRole7")) |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt, nowdate, add_days, getdate
from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.buying_controller import BuyingController
from erpnext.buying.utils import validate_for_items
form_grid_templates = ... |
"""
Minimal working example of the SSASC program, examining second-order interaction
between two cells. Note that modules are imported at the top of each section
that uses them (in contrast to the usual convention of importing all modules at
the top of the file) so as to be completely explicit about the external
requir... |
import urlparse,urllib2,urllib,re
import os
from core import scrapertools
from core import logger
from core import config
def test_video_exists( page_url ):
logger.info("[extabit.py] test_video_exists(page_url='%s')" % page_url)
# Vídeo borrado: uploaded.to/file/q4rkg1rw -> Redirige a otra página uploaded.to/41... |
import os
import sys
import subprocess
import re
import argparse
import pycountry
import fcntl
import select
from utils import Utils
class SubRipper(object):
"""
Yes that what everyone want or need a Ripper of MKV SubTitles.
That tool is here for help everyone during him numerical life, without special atte... |
"""选股因子参数以及选择图形可视化"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from abc import abstractmethod
import ipywidgets as widgets
from ..WidgetBu.ABuWGBase import WidgetFactorBase, WidgetFactorManagerBase, accordion_shut
from ..WidgetBu.ABuWGBFBase import BFS... |
import random
sorteados = []
while(len(sorteados)<20):
bola = random.randint(1,99)
if bola not in sorteados :
sorteados.append(bola)
print(sorteados) |
from discord.ext import commands
from discordbot.command import MtgContext
@commands.command()
async def modobug(ctx: MtgContext) -> None:
"""Report a Magic Online bug."""
await ctx.send('Report Magic Online issues at <https://github.com/PennyDreadfulMTG/modo-bugs/issues/new>. Please follow the instructions the... |
cdict = {
'aliceblue': '#F0F8FF',
'antiquewhite': '#FAEBD7',
'aqua': '#00FFFF',
'aquamarine': '#7FFFD4',
'azure': '#F0FFFF',
'beige': '#F5F5DC',
'bisque': '#FFE4C4',
'black': '#000000',
'blanchedalmond': '#FFEB... |
import pygtk
import gtk
import dill
import pango
import os
import gobject
import time
import sqlite3
from subprocess import Popen, PIPE, call
from os.path import expanduser
pygtk.require('2.0')
from cmd_editor import CmdEditor
from dialog import Dialog
from lib.Project import Project
from lib.Module import Module
from ... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = [
url(r'^post_parser/', include('post_parser.urls')),
url(r'admin/', admin.site.urls),
url(r'^', include('post_parser.urls'))
] |
"""
This module consumes the Camara's Web API to get it in SQL DML Insert Scripts
"""
import json
import requests
PAGE_SIZE = 100
URL_DEPUTADOS = "https://dadosabertos.camara.leg.br/api/v2/deputados?pagina=1&itens={pagesize}".format(pagesize=PAGE_SIZE)
URL_PARTIDOS = "https://dadosabertos.camara.leg.br/api/v2/parti... |
from hashlib import sha256
from hashlib import new as hashn
from sha3 import keccak_256
from ecdsa import SigningKey
from ecdsa import SECP256k1
from binascii import hexlify
from os import urandom
MAX = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140
MIN = 0x1
B58 = '123456789ABCDEF... |
"""The main browser widgets."""
import html
import functools
from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QUrl, QPoint
from PyQt5.QtGui import QDesktopServices
from PyQt5.QtNetwork import QNetworkReply, QNetworkRequest
from PyQt5.QtWidgets import QFileDialog
from PyQt5.QtPrintSupport import QPrintDialog
from PyQt... |
from __future__ import division
import random, math
from cmath import exp, pi, log, sqrt
from gnuradio import gr, gr_unittest, digital, blocks
from gnuradio.digital.utils import mod_codes
from gnuradio.digital import psk, qam, qamlike
tested_mod_codes = (mod_codes.NO_CODE, mod_codes.GRAY_CODE)
def twod_constell():
... |
import sys
import getopt
from Bio import SeqIO
from HTSeq import SAM_Reader
def complete_cover(cover, read_len):
if cover[0] == 0:
return False
if len(cover) - read_len >= 0:
if cover[len(cover) - read_len] == 0:
return False
prev = None
for pos in xrange(len(cover)):
... |
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_import_helper():
import importlib
pkg = __name__.rpartition('.')[0]
mname = '.'.join((pkg, '_gdal_array')).lstrip('.')
try:
return importlib.import_module(mname)
... |
from paraview.simple import *
Sphere()
Show()
Render()
WriteImage('rendering-base.png') |
import mock
from librarian_core.contrib.cache import backends
from librarian_core.contrib.cache import decorators as mod
@mock.patch.object(mod, 'request')
def test_cached_no_backend(request):
request.app.supervisor.exts.cache = backends.NoOpCache()
orig_func = mock.Mock(__name__='orig_func')
orig_func.retu... |
import bpy
import os
import re
import inspect
from mv import utils, unit
from bpy.types import Header, Menu, Operator
from bpy.props import (StringProperty,
BoolProperty,
IntProperty,
FloatProperty,
FloatVectorProperty,
... |
__revision__ = "$Rev: 421 $"
__author__ = "David Stanek <dstanek@dstanek.com>"
__copyright__ = "Copyright 2005, David Stanek"
import kid
def test_strip_no_expr():
"""A py:strip without an expression will strip that element."""
source = """
<test xmlns:py="http://purl.org/kid/ns#">
<wrapper p... |
from ptools import *
import sys
import os
import math
import string
def surreal(i):
return i
class Rotation:
class _Rot:
ssi=0.0
phi=0.0
rot=0.0
def __init__(self, ssii, phii, roti):
self.ssi=ssii
self.phi=phii
self.rot=roti
def read_rotdat... |
from feedparser.api import parse
from . import logger
from .helper.exceptions import ex
def getFeed(url, params=None, request_hook=None):
try:
data = request_hook(url, params=params, returns='text', timeout=30)
if not data:
raise Exception
feed = parse(data, response_headers={'co... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Game',
fields=[
('id', m... |
import math
import MLC.Log.log as lg
import numpy as np
from BaseCreation import BaseCreation
from MLC.individual.Individual import Individual
class MixedRampedGauss(BaseCreation):
def __init__(self):
BaseCreation.__init__(self)
def create(self, gen_size):
ramp = np.array(self._config.get_list('... |
def longest_increasing_subsequence(X, N):
""" Returns the Longest Increasing Subsequence in the Given List """
P = [0 for i in range(N)]
M = [0 for i in range(N+1)]
L = 0
for i in range(N):
lo = 1
hi = L
while lo <= hi:
mid = (lo+hi)//2
if (X[M[mid]] < X[i]):
lo = mid+1
else:
hi = mid-1
ne... |
indico_conf = "/opt/indico/src/etc/indico.conf" # path to indico.conf
import os
if indico_conf == '': # we may be in development mode or in installation mode
indico_conf = os.path.join(os.path.dirname(__file__), '..', '..', '..', 'etc', 'indico.conf')
if not os.path.exists(indico_conf):
# eggmode
... |
import re
import yaml
import datetime
import time
from SiteFab import utils
date_matcher = re.compile('(\d+) +(\w{3}) +(\d+) +(\d+):(\d+)')
frontmatter_matcher = re.compile(r'(^\s*---.*?---\s*$)', re.DOTALL|re.MULTILINE)
def parse_fields(fields=None):
""" Recursively parse a given dict of fields to add extra inform... |
'''
Created on 02/07/2016
@author: thiago
'''
from pyspark import SparkContext
from datetime import datetime
from graficos import plotData
if __name__ == '__main__':
byCountry = 'GlobalLandTemperatures/GlobalLandTemperaturesByCountry.csv'
byGlobal = 'GlobalLandTemperatures/GlobalTemperatures.csv'
sc = Spark... |
import sys, os, time
import threading, Queue
import MySQLdb as mdb
import subprocess
import string
import re
pathname = os.path.abspath(os.path.dirname(sys.argv[0]))
def readConfig():
Configfile = pathname+"/../../../www/config.php"
file = open( Configfile, "r")
# Match a config line
m =... |
class ImproperlyConfigured(Exception):
"""The configuration is not given or is invalid."""
pass
class AppRegistryNotReady(Exception):
"""The registry was not yet ready to invoke"""
pass
class InvalidAppModule(Exception):
"""The given app string is invalid or the app itself is misconfigured!"""
class TransportExcep... |
__author__ = u"Edwin Dalmaijer"
from libinput import check_click, check_mouseclicks, textfield
from libhelper import check_colour, draw_Landolt_C
import os
import random
import time
import numpy
import pygame
try:
import android
except:
pass
def start_task(settings):
"""Prepares the task, and runs it (saving data ha... |
"""Utilities for |EVMDD| library.
"""
from functools import wraps
def memoize(obj):
"""Memoizes an object.
We use memoization for |EVMDD| nodes and edges to avoid duplicate nodes with
identical level and children, and duplicate edges with identical weights and
successor nodes, respectively. Such |EVMDDs... |
from vsg.rules import multiline_alignment_between_tokens
from vsg import token
lTokenPairs = []
lTokenPairs.append([token.concurrent_simple_signal_assignment.assignment, token.concurrent_simple_signal_assignment.semicolon])
class rule_003(multiline_alignment_between_tokens):
'''
This rule checks alignment of mu... |
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
import time
from lib.core.agent import agent
from lib.core.bigarray import BigArray
from lib.core.common import Backend
from lib.core.common import calculateDeltaSeconds
from lib.core.commo... |
"""
Tuxepedia HTML extractor
author: Andy Mender <andymenderunix@gmail.com>
license: GPLv3
"""
import logging
import os
import os.path
import shutil
from sys import version_info
import requests
from lxml import html
assert version_info[0] == 3, "Use Python 3 for this script"
from . import WEB_PATHS, RESOURC... |
import dbus
__all__ = 'DBusPropertiesExposer',
class DBusPropertiesExposer(object):
"""
Reusable org.freedesktop.DBus.Properties Implementation Mixin.
Usage:
Add your python ``property`` objects to an instance attribute dict named ``_dbus_properties``.
"""
_dbus_properties = {}
@dbus.ser... |
""" This module defines the type for storing game configuration. """
class GameConfig:
num_of_players = 2
ai_players = [None, None]
x_size = 10
y_size = 10
win_len = 4
# 0 1 2 3 4 5 6
colours = ["blue", "deeppink", "green", "orange", "... |
import argparse
from sakura.common.conf import merge_args_and_conf
def load_conf():
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--conf-file',
help="Specify alternate configuration file",
type=argparse.FileType('r'),
default='/etc/sakura/daemon.co... |
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders
import os
gmail_user = "auto.mail.ncmrwf.in@gmail.com"
gmail_pwd = "Monsoon@Ncmrwf"
def gmail(to, subject, text, attach=None, port=587):
msg = MIMEMultipart(... |
from __future__ import unicode_literals
import time
from taskq import Queue
from taskq import policy
def test_fifo():
q = Queue()
q.push('test1')
q.push('test2')
assert q.pop() == 'test1'
assert q.pop() == 'test2'
def test_duplicate():
q = Queue()
q.push('test')
try:
q.push('test... |
from __future__ import division
import os
import re
from ox.utils import json
from ox.django.api import actions
from ox.django.decorators import login_required_json
from ox.django.http import HttpFileResponse
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
from django impo... |
"""
Copyright (C) 2019 Quinn D Granfor <spootdev@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
W... |
from __future__ import (absolute_import, division, print_function)
import mantid.simpleapi
import mantid.api
import mantid.kernel
import numpy
from collections import defaultdict
class MaskBTP(mantid.api.PythonAlgorithm):
""" Class to generate grouping file
"""
# list of supported instruments
INSTRUMENT... |
from gi.repository import Gtk, WebKit
from urlparse import urlparse, parse_qs
from settings import Settings
def _start_login_process(window, callback):
sw = Gtk.ScrolledWindow()
wk = WebKit.WebView()
sw.add(wk)
win = Gtk.Window()
win.resize(400, 400)
win.add(sw)
win.set_modal(True)
win.s... |
"""
help plugin: Displays help for commands and other topics.
"""
__author__ = "Petr Morávek (xificurk@gmail.com)"
__copyright__ = ["Copyright (C) 2009-2011 Petr Morávek"]
__license__ = "GPL 3.0"
__version__ = "0.5.0"
import logging
log = logging.getLogger(__name__)
__ = lambda x: x # Fake gettext function
class help:
... |
from django.apps import AppConfig
class PyuserConfig(AppConfig):
name = 'pyuser' |
from pyrser import meta, fmt
from pyrser.parsing import node
import weakref
scalar = {'bool': bool, 'int': int, 'float': float, 'str': str}
composed = {'list': list, 'dict': dict, 'set': set}
@meta.add_method(node.Node)
def to_yml(self):
"""
Allow to get the YML string representation of a Node.::
from p... |
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
def janela():
aplicacao = QApplication(sys.argv)
minha_janela = QWidget()
botao_1 = QPushButton("Botao 1")
botao_2 = QPushButton("Botao 2")
caixa_vertical = QVBoxLayout()
caixa_vertical.addWidget(botao_1)
caixa_vertical.addStretch()
... |
import logging
import h5py
import numpy as np
import westpa
from westpa.core.segment import Segment
from westpa.oldtools.aframe import AnalysisMixin
from westpa.oldtools.miscfn import parse_int_list
log = logging.getLogger(__name__)
class WESTDataReaderMixin(AnalysisMixin):
'''A mixin for analysis requiring access ... |
import sys
import pgdb
import pg
from math import pi
from optparse import OptionParser
import getpass
from database import getDBname, getDBhost, getDBport, getDBuser
def get_rotation_lines(filename):
"""
Returns a list containing all lines with rotations
"""
f = open(filename, 'r')
lines = f.readlin... |
import Tkinter as tki
from cache import Cache
from blogspotharvester import BlogspotHarvester, BlogspotItemWithIsbn
from varbergsettings import Settings3, InifileDataSourceDescription, sBlog
class download3:
"""Download data to the cache directory."""
def __init__(self, inidir, inifile, amount):
"""Comm... |
"""
Logout
Example:
$ dirac-logout
"""
import os
import sys
import DIRAC
from DIRAC import gLogger, S_OK, S_ERROR, gConfig
from DIRAC.Core.Security import Locations
from DIRAC.Core.Base.Script import Script
from DIRAC.Resources.IdProvider.IdProviderFactory import IdProviderFactory
from DIRAC.FrameworkSystem.private.a... |
from keras.applications.vgg19 import VGG19
from keras.applications.vgg16 import preprocess_input, decode_predictions
import numpy as np
model = VGG19(weights='imagenet')
x, y = result['res'][frame - 1][0], result['res'][frame - 1][1]
width = result['res'][frame - 1][2]
height = result['res'][frame - 1][3]
img_crop = im... |
"""empty message
Revision ID: 29e3fab8b333
Revises: None
Create Date: 2015-06-14 00:12:39.739301
"""
revision = '29e3fab8b333'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('events',
sa.Column('i... |
from django.db import models
class Question(models.Model):
"""
Coding challenge question
"""
question_no = models.IntegerField(unique=True)
question_text = models.TextField()
def __str__(self):
return "Q{}. {}".format(self.question_no, self.question_text[:80])
class InputCase(models.Mode... |
import glob
import math
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import matplotlib.ticker as tkr
import os
import pandas as pd
import urbs
import sys
def get_most_recent_entry(search_dir):
""" Return most recently modified entry from given directory.
Args:
search_dir: an ab... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
class Inventory:
def __init__(self, host_list=C.DEFAULT_HOST_LIST, vault_password=None):
pass
def get_hosts(self, pattern="all"):
pass
def clear_pattern_cache(self):
# Possibly not needed?
... |
from __future__ import unicode_literals
from nose.tools import assert_true, assert_false, assert_raises, assert_greater
from nose.tools import assert_less_equal
from datetime import datetime, timedelta
from montefevents import Seminar, Sender, Policy
from montefevents.notification import Channel
from montefevents.data ... |
import serial
import time
import math
import string
import rospy
import threespace as tsa
import find_ports
from threespace import *
from socket import *
def returnDev(arg):
# rospy.init_node("detect")
result = find_ports.findPorts()
dng_list = []
dev_list = []
rospy.logwarn(result)
if arg == "d... |
from odoo import fields, models
class AccountAnalyticTag(models.Model):
_inherit = 'account.analytic.tag'
task_ids = fields.Many2many('project.task', string='Tasks')
project_ids = fields.Many2many('project.project', string='Projects') |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from oppia.api.resources import TrackerResource, CourseResource, ScheduleResource, TagResource, ClientsResource, \
ClientTrackerResource
from oppia.api.resources import PointsResource, ... |
from datetime import date
from django.contrib.auth.models import User, Group
from scrumtools.apps.wishlist.models import Wish
from scrumtools.apps.scrumboard.models import Status, Project, Sprint, Story, Task
from rest_framework import serializers
class UserSerializer(serializers.HyperlinkedModelSerializer):
class ... |
"""Tests for qutebrowser.config.configtypes."""
import re
import collections
import itertools
import os.path
import base64
import warnings
import pytest
from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QColor, QFont
from PyQt5.QtNetwork import QNetworkProxy
from qutebrowser.config import configtypes, configexc
fro... |
from game.gamemanager import GameManager
from game.move import Move
class HumanPlayer:
def __init__(self):
self.game = GameManager()
def startGame(self):
self.game.initialize()
self.makeMove()
def makeMove(self):
self.game.outputGame()
move_t = self.getUserMove()
if move_t == 'L': move = Move.LEFT_MOVE
... |
import random
import pygame
import time
import sys
import math
import sprite
import constants
import wall
import spikes
import data
import player
class Collectable(sprite.Sprite):
def __init__(self, game, x, y, descriptor):
super(Collectable, self).__init__(game)
self.invalid_collect = 0
sel... |
import random
chat_responses = {}
chat_responses['not-a-city'] = [
'Isso é uma cidade do Brasil? Não está na minha lista... :( Tente o botão abaixo para locais fora do país.',
'Tem certeza de que isso é uma cidade? 8) Só reconheço cidades do Brasil.' \
'No botão abaixo dá pra escolher no mapa locais fora do... |
from os import walk, rename, remove
from os.path import join, dirname, basename, splitext
from convert_nomenclature import list_files_sorted, root
for name in list_files_sorted(root):
if splitext(name)[1].lower() == ".stepzip":
remove(name) |
import sys
import os
sys.path.insert(0, os.path.abspath('..'))
from pyphi import __version__, __author__
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinxcontrib.napoleon'
]
mathjax_path = 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?c... |
import genwrap as _genwrap
from seiscomp.db.xmlio import inventory as _xmlio
from seiscomp.db import DBError
class _StationReference(_genwrap.base_StationReference):
def __init__(self, myStationGroup, stationID, args):
_genwrap.base_StationReference.__init__(self)
self.__dict__.update(args)
self.__dict__['myStat... |
import os
import collectd
import signal
import epics
import yaml
"""
example of metric name:
collectd.usop.S1B.1.humidity
"""
os.environ["PYEPICS_LIBCA"] = "/opt/epics/base/lib/linux-arm/libca.so"
debug = False
doc = {}
pvs = set()
pvstate = {}
def onConnectionChange(pvname=None, conn=None, **kws):
collectd.info... |
import codecs
import json
import shutil
import xml.dom.minidom
from xml.dom.minidom import Node
from xml.sax.saxutils import unescape
from zipfile import ZipFile, BadZipfile
import os
from django.conf import settings
from django.contrib import messages
from django.utils import timezone
from django.utils.translation imp... |
from openerp import models, fields, api, _
from openerp.exceptions import UserError
import openerp.addons.decimal_precision as dp
class StockQuantPackage(models.Model):
_inherit = "stock.quant.package"
@api.one
@api.depends('quant_ids', 'children_ids')
def _compute_weight(self):
weight = 0
... |
""" DIRAC FileCatalog component representing a directory tree with
enumerated paths
"""
__RCSID__ = "$Id$"
import os
from types import ListType, StringTypes
from DIRAC import S_OK, S_ERROR
from DIRAC.DataManagementSystem.DB.FileCatalogComponents.DirectoryTreeBase import DirectoryTreeBase
MAX_LEVELS = 15
class Direc... |
__author__ = 'Mike McCann,Duane Edgington,Reiko Michisaki'
__copyright__ = '2013'
__license__ = 'GPL v3'
__contact__ = 'mccann at mbari.org'
__doc__ = '''
Master loader for all Worden's CN13ID Western Flyer cruise in October 2013
CN13ID: CANON 2013 Interdisciplinary
Mike McCann
MBARI 23 October 2013
@var __date_... |
"""Low Level Reader Protocol implemtnation in pure Python
"""
from __future__ import unicode_literals
from pkg_resources import get_distribution
__all__ = ('llrp', 'llrp_decoder', 'llrp_errors', 'llrp_proto', 'util',
'inventory')
__version__ = get_distribution('sllurp').version |
"""ReleaseManager manages the gathering and writing of one release's metadata.
The Overview
The metadata gathering process is the most important and most complex task
that Audiolog performs. The goal of this process is simple: Find complete,
accurate metadata for every track without any human intervention.
We begin wit... |
"""
Created on Wed May 03 19:01:42 2017
@author: jrpeacock
"""
import sys
from PyQt5 import QtWidgets, QtGui, QtCore
import mtpy.core.mt as mt
label_font = QtGui.QFont()
label_font.setBold = True
label_font.setPointSize (13)
class MTMainWindow(QtWidgets.QMainWindow):
def __init__(self):
super(MTMainWindow, ... |
from django.contrib import admin
from .models import CalendarFeed
admin.site.register(CalendarFeed) |
import unittest
import datetime
from devicecloud.conditions import Attribute
class TestConditions(unittest.TestCase):
def test_gt(self):
a = Attribute("a")
self.assertEqual((a > 21).compile(), "a>'21'")
def test_lt(self):
a = Attribute("a")
self.assertEqual((a < 25).compile(), "a... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [("clusters", "0022_convert_cluster_emr_release")]
operations = [
migrations.AlterField(
model_name="cluster",
n... |
from subprocess import Popen, PIPE
for i in xrange(100):
p = Popen(['python', 'committer.py'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
pout, pin = p.communicate()
print pin
assert 'Cheater' not in pin |
from dadi import Numerics, PhiManip, Integration
from dadi.Spectrum_mod import Spectrum
def custom_model(params, ns, pts):
nuPre,TPre,nu1_0,nu2_0,nu1_1,nu2_1,T1,T2,T3,m12_1,m21_1,m12_2,m21_2,m12_3,m21_3 = params
xx = Numerics.default_grid(pts)
phi = PhiManip.phi_1D(xx)
phi = Integration.one_pop(phi, xx,... |
tempsum = 0
for i in range(1,10000000001):
if i % 3 == 0:
tempsum = tempsum + i
elif i % 5 == 0:
tempsum = tempsum + i
else:
pass
print("TEMPSUM=",tempsum) |
"""Inline Analytics integration tests"""
import json
from mock import patch
from django.test import RequestFactory
from django.test.utils import override_settings
from courseware.views.views import get_analytics_answer_dist, process_analytics_answer_dist
from courseware.tests.factories import UserFactory, InstructorFac... |
from flow.shell_command.lsf import resource
import mock
import unittest
class LSFResourceBaseTest(unittest.TestCase):
def setUp(self):
class TestClass(resource.LSFResource):
def set_select_component(self, *args, **kw):
resource.LSFResource.set_select_component(self, *args, **kw)
... |
"""
Simple utility functions that operate on course metadata.
This is a place to put simple functions that operate on course metadata. It
allows us to share code between the CourseDescriptor and CourseOverview
classes, which both need these type of functions.
"""
from base64 import b32encode
from datetime import dateti... |
import sys
from functools import wraps
from twisted.internet import reactor
from spiralgalaxygame.clopts import DBArgumentParser
from spiralgalaxygame.log import bind_log
from spiralgalaxygame.async import then
from spiralgalaxygame import sql
def simple_sql_app(description, dbadmin=False):
"""A decorator for apps ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.