code stringlengths 1 199k |
|---|
"""
This Bot gives you information about projects and other Goteo stuff by using its
api: https://api.goteo.org/
First, a few handler functions are defined. Then, those functions are passed to
the Dispatcher and registered at their respective places.
Then, the bot is started and runs until we press Ctrl-C on the comman... |
from Tank import Tank, TankType
from Config import TANK_WIDTH, TANK_HEIGHT, BASIC_TANK_SPEED, BASIC_TANK_ARMOR, BASIC_TANK_ATTACK
from Resources import BASIC_TANK_UP, BASIC_TANK_RIGHT, BASIC_TANK_DOWN, BASIC_TANK_LEFT
class BasicTank(Tank):
# self, x, y, width, height, resources, speed, armor, attack, object_id, li... |
import numpy
import scipy.linalg
from sandbox.util.Parameter import Parameter
from apgl.kernel import *
from sandbox.util.Util import Util
"""
An implementation of the primal-dual Canonincal Correlation Analysis algorithm.
"""
class PrimalDualCCA(object):
def __init__(self, kernelX, tau1, tau2):
Parameter.c... |
import urllib,urllib2,sys,platform,os,re
class bcolors:
HEADER = '\033[95m'
OKGREEN = '\033[92m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
ghc=open("githubcli","r")
code=ghc.read()
ghc.close()
ln=1
for line in code.splitlines():
if ln==3:
av=''.join(re.findall(r'#(.*?)#',line)).replace("v ","")
brea... |
from application import db
from application.model.operational import Ambulance
from application.model.workforce import ParamedicTeam
def most_dispatched_ambulance():
query = "SELECT TOP 1 id_ambulance, COUNT(*) FROM dispatch GROUP BY id_ambulance ORDER BY count(*) DESC"
result = db.engine.execute(query).fetchal... |
import datetime
import sys
import numpy as np
import tensorflow as tf
import tensorflow.contrib.layers as tf_layers
import tensorflow.contrib.losses as tf_losses
import forecast_dataset
class Network:
def __init__(self, args, data_train):
self.args = args
# Create an empty graph and a session
... |
import sigrokdecode as srd
class SamplerateError(Exception):
pass
class Decoder(srd.Decoder):
api_version = 3
id = 'spdif'
name = 'S/PDIF'
longname = 'Sony/Philips Digital Interface Format'
desc = 'Serial bus for connecting digital audio devices.'
license = 'gplv2+'
inputs = ['logic']
... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ldap_people', '0005_rename_ldapperson_to_ldap_people_ldapperson'),
]
operations = [
migrations.RunSQL("ALTER TABLE ldap_people_ldapperson ADD COLUMN host... |
"""
EVE Swagger Interface
An OpenAPI for EVE Online
OpenAPI spec version: 0.4.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class GetCharactersCharacterIdMailForbidden(object):
"""
NOTE: This class is auto ge... |
from ..paginated import Paginated
from ..utils import URL
class Top(Paginated):
"""
Top torrents featuring category management.
"""
base_path = '/top'
def __init__(self, base_url, use_tor, category='0'):
super(Top, self).__init__(use_tor=use_tor)
self.url = URL(
base=base... |
import sys, time
from daemon import Daemon
class MyDaemon(Daemon):
def run(self):
while True:
time.sleep(1)
if __name__ == "__main__":
daemon = MyDaemon('/tmp/daemon-example.pid')
if len(sys.argv) == 2:
if 'start' == sys.argv[1]:
daemon.start()
elif 'stop' == ... |
import rospy, math
from geometry_msgs.msg import Twist
from pses_basis.msg import Command
from std_msgs.msg import Bool
def convert_motor_level(v):
global maxSpeedCmd
global minSpeedCmd
global maxSpeedCmdBack
global minSpeedCmdBack
global maxVel
global minVel
if v == 0:
return 0
if v < 0:
return... |
import operator
from copy import deepcopy
import numpy as np
import scipy.optimize
from charge_method import ChargeMethodSkeleton
from charges import Charges
from statistics import calculate_statistics
from structures.molecule_set import MoleculeSet
def run_one_iter(data: np.ndarray, molecules: MoleculeSet, method: Cha... |
from vcsn_cxx import polynomial
from vcsn.tools import _is_equal, _right_mult
polynomial.__add__ = polynomial.sum
polynomial.__and__ = polynomial.conjunction
polynomial.__eq__ = _is_equal
polynomial.__mul__ = _right_mult
polynomial.__repr__ = lambda self: self.format('text')
polynomial._repr_latex_ = lambda self: '$' +... |
from collections import defaultdict
def read_dict(filename, token_field, tag_field):
"""Read tagset + tag dictionary from corpus"""
tags = set()
norm_tags = defaultdict(set)
max_field = max(token_field, tag_field)
with open(filename, 'r', encoding='utf-8') as f:
for line in f:
fi... |
import typing
import attr
import numpy as np
from ._fwdpy11 import (GeneticValueIsTrait, GeneticValueNoise, _ll_Additive,
_ll_GaussianNoise, _ll_GBR, _ll_GSSmo,
_ll_Multiplicative, _ll_MultivariateGSSmo, _ll_NoNoise,
_ll_Optimum, _ll_PleiotropicOptima... |
__author__ = 'benjaminsmith'
class UnitModel(object):
#this is a simple way to standarize how we're storing layers of units
#right now a layer is simply a list of units.
#it has to be a list in order to be indexable.
#we could extend it later to be a class, possibly a class inheriting from a dictionary ... |
import numpy as np
def ccc(l1, l2):
'''
Concordance correlation coefficient.
See: https://en.wikipedia.org/wiki/Concordance_correlation_coefficient
'''
ccc_val = 2 * np.cov(l1, l2)[0, 1] / (np.var(l1) + np.var(l2) +
(np.mean(l1) - np.mean(l2)) ** 2)
retu... |
import numpy as np
if len(AxisOut) != 1:
Msg.Error(3, "Number of output axis has to be one, when using numpy")
if len(AxisIn) != 1:
Msg.Error(3, "Number of input axis has to be one, when using numpy")
Func = Analyse["Routine"]
ValuesOut = list()
for RowValues in ValuesIn:
ValuesOut.append([eval('np.'+Func+'... |
import bz2
import gnupg
import hashlib
import os
import datadecorator
class GPGBZ2Decorator(datadecorator.DataDecorator):
def __init__(self, gpghome, gpgkeys, compresslevel=5, compressed=True, encrypted=True, DEBUG=False):
# this function takes home directory for gnupg encryption library
# and key f... |
from starcluster.clustersetup import ClusterSetup
from starcluster.logger import log
import re
local_pe_attrs = {
'pe_name': 'local',
'slots': '999',
'user_lists': 'NONE',
'xuser_lists': 'NONE',
'start_proc_args': 'NONE',
'stop_proc_args': 'NONE',
... |
from __future__ import division, print_function, absolute_import
import numpy as np
import scipy.stats
import pandas
import tqdm
from sklearn.model_selection import StratifiedKFold
from streams import utils
from streams.metrics.classifiers import MatchToSampleClassifier
from streams.envs import objectome
def internal_c... |
from FilmSpecimenGenerator import Config
cfg = Config()
cfg.add_parameter("sizeX", "real_t", "0", "Specimen length (x direction)")
cfg.add_parameter("sizeY", "real_t", "0", "Specimen length (y direction)")
cfg.add_parameter("sizeZ", "real_t", ... |
from fife import fife
import base
from base import BaseBehaviour
class MovingAgentBehaviour (BaseBehaviour):
"""Fife agent listener"""
def __init__(self):
BaseBehaviour.__init__(self)
self.speed = 0
self.idle_counter = 1
def onNewMap(self, layer):
"""Sets the agent onto the n... |
from PySide import QtCore
class Interface(QtCore.QObject):
highlightedPostcardIndexChangedSignal = QtCore.Signal(int)
screenStateChangedSignal = QtCore.Signal(str)
forceScreenChangeSignal = QtCore.Signal()
forceCreateStampSignal = QtCore.Signal()
@QtCore.Slot(int)
def highlightedPostcardIndexCha... |
"""
Mail services.
This is quite moving work still.
This should be moved to the different packages when it stabilizes.
"""
import json
import os
from collections import defaultdict
from collections import namedtuple
from twisted.application import service
from twisted.internet import defer
from twisted.python import lo... |
from django.contrib import admin
from django.conf.urls import patterns, include, url
admin.autodiscover()
urlpatterns = patterns('',
url(r'^grappelli/', include('grappelli.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^customers/', include('customers.urls')),
url(r'^', include('readings.urls... |
from gnuradio import gr, gr_unittest
import analog_swig as analog
import blocks_swig as blocks
import math
def sincos(x):
return math.cos(x) + math.sin(x) * 1j
class test_phase_modulator(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_block()
def tearDown(self):
self.tb = None
... |
import os
def data_file(fname):
"""Return the path to a data file of ours."""
return os.path.join(os.path.split(__file__)[0], fname) |
"""General test code for pyfusion.
Test code which doesn't have any other obvious home
(e.g.: data, acquisition, ...) goes here.
"""
import unittest, random, string, ConfigParser, os
import inspect, pkgutil, sys
import StringIO
import pyfusion
TEST_FLAGS = ['dev']
TEST_DATA_PATH = os.path.abspath(os.path.dirname(__file... |
"""server.py: Process requests to RNNSearch"""
from __future__ import absolute_import, division, print_function, unicode_literals
__author__ = "Frederic Bergeron"
__license__ = "undecided"
__version__ = "1.0"
__email__ = "bergeron@pa.jst.jp"
__status__ = "Development"
import datetime
import json
import numpy as np
from... |
"""
Given: Six nonnegative integers, each of which does not exceed 20,000.
The integers correspond to the number of couples in a population possessing each genotype pairing for a given factor.
In order, the six given integers represent the number of couples having the following genotypes:
AA-AA
AA-Aa
AA... |
from test_support import gnatprove
gnatprove(opt=["-P", "test.gpr", "--mode=check", "-cargs", "-gnat2012"]) |
"""
cfbrank -- A college football ranking algorithm
conference.py: Defines the Conference class for generating rankings
and other statistical information on an athletic conference as a
whole.
Written by Michael V. DePalatis <depalatis@gmail.com>
cfbrank is distributed under the terms of the GNU GPL.
"""
class Conferenc... |
from cherrypy.test import test
test.prefer_parent_path()
import cherrypy
def setup_server():
class WSGIResponse(object):
def __init__(self, appresults):
self.appresults = appresults
self.iter = iter(appresults)
def __iter__(self):
return self
def next(self... |
from __future__ import division
import math
import random
import sys
import time
from twisted.internet import defer, protocol, reactor
from twisted.python import failure, log
import p2pool
from p2pool import data as p2pool_data
from p2pool.bitcoin import data as bitcoin_data
from p2pool.util import deferral, p2protocol... |
import shesha.config as conf
simul_name = "bench_scao_sh_40x40_10pix_lgs"
p_loop = conf.Param_loop()
p_loop.set_niter(5000)
p_loop.set_ittime(0.002) # =1/500
p_geom = conf.Param_geom()
p_geom.set_zenithangle(0.)
p_tel = conf.Param_tel()
p_tel.set_diam(8.0)
p_tel.set_cobs(0.12)
p_atmos = conf.Param_atmos()
p_atmos.set_... |
"""Unit tests for collections.py."""
import unittest, doctest, operator
from test.support import TESTFN, forget, unlink
import inspect
from test import support
from collections import namedtuple, Counter, OrderedDict, _count_elements
from test import mapping_tests
import pickle, copy
from random import randrange, shuff... |
"""
:copyright: (c) 2013 by Carlos Abalde, see AUTHORS.txt for more details.
:license: GPL, see LICENSE.txt for more details.
"""
from __future__ import absolute_import
import sys
import codecs
from time import ctime
from optparse import OptionParser
try:
from xml.etree.ElementTree import parse
except ImportError:
... |
class SkillNotFound(Exception):
def __init__(self, skill_id):
self.skill_id = skill_id
msg = "Skill not found: {}".format(skill_id)
Exception.__init__(self, msg) |
from . import ast
from .setree import SEBlockItem, SEScope, SEIf, SESwitch, SETry, SEWhile
from ..ssa import ssa_types, ssa_ops, ssa_jumps, objtypes
from ..namegen import LabelGen
from ..verifier.descriptors import parseFieldDescriptor, parseMethodDescriptor
from .. import opnames
_prefix_map = {objtypes.IntTT:'i', obj... |
'''
Compute the analysis (through direct inversion of B+R innovation matrix) and output the error reduction.
For both observation and forecast errors, statistics need to be provided:
- correlation model
- correlation length
- bias (0 by default)
- variance (constant on the domain)
By default (and as it is a com... |
from .daemon import app
def start():
app.run(host='0.0.0.0', port=8001)
if __name__ == '__main__':
start() |
"""
A PyQT4 dialog to show ID log and progress
"""
"""
Copyright 2012-2014 Anthony Beville
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... |
import unittest
from unittest import mock
from unittest.mock import MagicMock
import datetime
import sys
from lofar.sas.resourceassignment.resourceassigner.resource_availability_checker import ResourceAvailabilityChecker
from lofar.sas.resourceassignment.resourceassigner.resource_availability_checker import CouldNotFin... |
import logging
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from pylons import response
from pkg_resources import resource_stream
from lxml import etree
from ckan.lib.base import request, config, abort
from ckan.controllers.api import ApiController as BaseApiController
f... |
VERSION = '0.7.1'
import sys, rpcalc, argparse
parser = argparse.ArgumentParser(prog='rpcalc',
description="A reverse polish notation calculator written in Python 3.",
epilog="For more information, see qguv.github.io/rpcalc")
parser.add_argument("-s", "--stack-size",
help="Limits the stack to a certain numb... |
from __future__ import print_function, unicode_literals, division, absolute_import
import argparse
import sys
import os
import io
from libsemeval2014task5.format import Reader
from libsemeval2014task5.common import log, runcmd, red, yellow, white
VERSION = "2.0"
def main():
parser = argparse.ArgumentParser(descript... |
import sys # System module
noerror="NO UNDEFINED SYMBOLS"
noerror_len=len(noerror)
error="UNDEFINED SYMBOLS"
error_len=len(error)
def ckas(filename):
try:
listing=open(filename,"rt")
except IOError:
print("ckaslst.py: error - could not open GNU as listing: %s" % filename)
sys.exit(... |
"""Pychemqt, Chemical Engineering Process simulator
Copyright (C) 2009-2017, Juan José Gómez Romera <jjgomera@gmail.com>
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... |
from google.appengine.ext import ndb
class Game(ndb.Model):
name = ndb.StringProperty()
description = ndb.StringProperty()
draws = ndb.IntegerProperty(repeated=True)
price = ndb.FloatProperty()
@property
def draw_sun(self):
return 0 in self.draws
@property
def draw_mon(self):
return 1 in self.dr... |
import collections
import datetime
import itertools
from bson import objectid
from pymongo import errors
from pymongo import ReturnDocument
from anubis import error
from anubis import db
from anubis.constant import contest
from anubis.util import argmethod
from anubis.util import validator
from anubis.util import json
... |
"""Unit test for the irf.arf module.
"""
import unittest
import os
import numpy
from ximpol.core.spline import xInterpolatedUnivariateSplineLinear
from ximpol.detector.xipe import _full_path
from ximpol.irf import load_arf
IRF_NAME = 'xipe_baseline'
OPT_AEFF_FILE_PATH = _full_path('Area_XIPE_201602b_x3.asc')
GPD_QEFF_F... |
"""
This file is our entrypoint.
Here is where we import and subclass the modreader.file_format and change behaviour.
"""
from . import records, fields
from ...file_format import ModFile, ModField
class SkyrimMod(ModFile):
"""
This is our subclass of modreader.file_format.ModFile
Most code wont do much exce... |
import itertools
import operator
import os
import copy
import pytest
from click.testing import CliRunner
import perun.cli as cli
import perun.utils.log as log
import perun.postprocess.clusterizer.run as clusterizer
import perun.logic.store as store
import perun.testing.asserts as asserts
__author__ = 'Tomas Fiedor'
def... |
from abc import ABCMeta, abstractmethod
from hoomd import variant
import matplotlib
matplotlib.use('AGG')
import matplotlib.pyplot as plt
class TemperatureProfileBuilder(object):
"""Common base class for all TemperatureProfiles."""
__metaclass__ = ABCMeta
def __init__(self):
self.temperature_profile... |
import collections
import json
import logging
import re
import time
import sys
import pprint
from errbot.backends.base import Message, Presence, ONLINE, AWAY, Room, RoomError, RoomDoesNotExistError, \
UserDoesNotExistError, RoomOccupant, Person
from errbot.errBot import ErrBot
from errbot.utils import PY3, split_st... |
"""Visualization and display functions.
Author: Michael Denbina
Copyright 2016 California Institute of Technology. All rights reserved.
United States Government Sponsorship acknowledged.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Publi... |
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 kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen, WipeTransition
from kivy.properties import ObjectProperty
from kivy.uix.widget import Widget
class MenuScreen(Screen):
pass
class NewGameScreen(Screen):
class XY(Widget):
def on_touch_down(se... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from itertools import chain
class Migration(DataMigration):
def forwards(self, orm):
sensors = chain(orm.SonoSensor.objects.all(), orm.EmgSensor.objects.all())
f... |
import datetime
import json
import os
import re
import traceback
from operator import itemgetter
from urllib.parse import unquote_plus
import dateutil.parser
from tornado.escape import xhtml_unescape
from tornado.web import HTTPError
import sickchill
from sickchill import logger, settings
from sickchill.helper import s... |
"""Bot object for Dozer"""
import logging
import re
import sys
import traceback
import discord
import aiohttp
from discord.ext import commands
from . import utils
from .asyncdb.orm import orm
dozer_logger = logging.getLogger('dozer')
dozer_logger.level = logging.DEBUG
discord_logger = logging.getLogger('discord')
disco... |
from django.shortcuts import render_to_response
from django.http import HttpResponse, HttpResponseServerError
from django.template import Context
from django.views.decorators.csrf import csrf_exempt
from Photos.messages import MessageCode
from Photos.models import *
from Common.component.messages import MessageVO
from ... |
import os
import unittest
from vsg.rules import entity
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_002_test_input.vhd'))
lExpected = []
lExpected.append('')
utils.read_file(os.path.join(sTestDir, 'rule_... |
from textwrap import dedent
from unittest import mock
import pytest
from testtools import TestCase
from testtools.matchers import Contains, Equals
import snapcraft.internal.project_loader._config # noqa: F401
import snapcraft.yaml_utils.errors
from snapcraft.project._schema import Validator
from . import ProjectBaseTe... |
import math
print(math.sqrt(81)) |
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.togglebutton import ToggleButton
from kivy.uix.scrollview import ScrollView
from kivy.uix.dropdown import DropDown
from kivy.uix.screenmanager import Screen, ScreenManage... |
print('Let\'s practice everything.')
print('You\'d need to konw \'bout escapes with \\ that do \n newlines and \t tabs.')
poem = """
\tThe lovely world
with logic so firmly planted
cannot discern \n the needs of love
nor comprehend passion from intuition
and requires an explanation
\n\t\twhere there is none.
"""
print(... |
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub',desired_capabilities=DesiredCapabilities.FIREFOX)
driver.get('http://example.com')
if driver.get_screenshot_as_file('./screen.png'):
p... |
"""Class defintition of Elements."""
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC # noqa
LOCATOR_MAP = {'css': By.CSS_SELECTOR,
'id_': By.ID,
'name': By.NAME,... |
""" SlackAction
This action posts the status change to a Slack channel
It uses Slack Webhooks.
Also compatible with Mattermost, which is an open source alternative to Slack.
To create a webhook URL refer the following :
* Slack : https://api.slack.com/incoming-webhooks
* Mattermost : https://docs.mattermost... |
"""
.. module:: fatbotslim.irc.bot
.. moduleauthor:: Mathieu D. (MatToufoutu)
This module contains IRC protocol related stuff.
"""
import re
from random import choice
from gevent import spawn, joinall, killall
from gevent.pool import Group
from fatbotslim.irc import u
from fatbotslim.irc.codes import *
from fatbotslim.... |
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_InvalidRedditObjectDialog(object):
def setupUi(self, InvalidRedditObjectDialog):
InvalidRedditObjectDialog.setObjectName("InvalidRedditObjectDialog")
InvalidRedditObjectDialog.resize(596, 651)
self.verticalLayout_2 = QtWidgets.QVBoxLayout(I... |
import os
def getpart(src,dest,start,length,bufsize=1024 * 1024):
f1 = open(src,'rb')
f1.seek(start)
f2 = open(dest,'wb')
while length:
chunk = min(bufsize,length)
data = f1.read(chunk)
f2.write(data)
length -= chunk
f1.close()
f2.close()
def split(f, splitsize = ... |
"""PyDbLite.py
BSD licence
Author : Pierre Quentel (pierre.quentel@gmail.com)
In-memory database management, with selection by list comprehension
or generator expression
Fields are untyped : they can store anything that can be pickled.
Selected records are returned as dictionaries. Each record is
identified by a unique... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0028_auto_20170720_1024'),
]
operations = [
migrations.AlterField(
model_name='footprint',
... |
__author__ = "Harish Narayanan"
__copyright__ = "Copyright (C) 2009 Simula Research Laboratory and %s" % __author__
__license__ = "GNU GPL Version 3 or any later version"
from dolfin import *
from cbc.twist.nonlinear_solver import *
from cbc.common import *
from cbc.common.utils import *
from cbc.twist.kinematics impo... |
import MySQLdb
import string
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import ConfigParser
def get_item(data_dict,item):
try:
item_value = data_dict[item]
return item_value
except:
pass
def get_parameters(conn):
try:
curs=conn.cursor()
data=curs.execute('sele... |
from wampy.peers.clients import Client
def test_send_really_long_string(router, echo_service):
really_long_string = "a" * 1000
caller = Client(url=router.url)
with caller:
response = caller.rpc.echo(message=really_long_string)
assert response['message'] == really_long_string |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('community', '0025_auto_20200415_0517'),
]
operations = [
migrations.AddField(
model_name='community',
name='verification_threshold_follower',
field=models.Po... |
"""Week3 warm up task 12 importing decimal and fractions."""
import decimal
import fractions
INTVAL = 1
FLOATVAL = 0.1
DECVAL = decimal.Decimal('0.1')
FRACVAL = fractions.Fraction(1, 10) |
from django.conf import settings
import jinja2
from django.template.loader import render_to_string
from django_jinja import library
from bedrock.firefox.firefox_details import firefox_desktop, firefox_android, firefox_ios
from bedrock.base.urlresolvers import reverse
from lib.l10n_utils import get_locale
def desktop_bu... |
import logging
from socorro.external import MissingArgumentError, BadArgumentError
from socorro.external.postgresql.base import PostgreSQLBase
from socorro.lib import external_common
logger = logging.getLogger("webapi")
class Bugs(PostgreSQLBase):
"""Implement the /bugs service with PostgreSQL. """
filters = [
... |
from typing import cast
from abc import ABCMeta, abstractmethod
class Result:
def __init__(self, value, pos):
self.value = value
self.pos = pos
def __repr__(self):
return 'Result(%s, %d)' % (self.value, self.pos)
class Parser(metaclass=ABCMeta):
def __add__(self, other):
retu... |
from __future__ import absolute_import, division, unicode_literals
from jx_base.expressions._utils import builtin_ops
from jx_base.expressions.expression import Expression
from jx_base.expressions.false_op import FALSE
from jx_base.expressions.literal import Literal
from jx_base.expressions.null_op import NULL
from jx_... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("services", "0079_update_notification"),
]
operations = [
migrations.AddField(
model_name="announcement",
name="external_url_title",
field=models.CharField(
... |
"""Utility mixins that simplify tests for map reduce jobs."""
import json
import datetime
import luigi
class MapperTestMixin(object):
"""
Base class for map function tests.
Assumes that self.task_class is defined in a derived class.
"""
DEFAULT_USER_ID = 10
DEFAULT_TIMESTAMP = "2013-12-17T15:38:... |
from openerp.osv import orm, fields
class sale_order_confirm(orm.TransientModel):
_inherit = "sale.order.confirm"
_columns = {
'requested_date': fields.date(string="Requested Date", help="Date requested by the customer for the sale."),
}
def get_sale_order_confirm_line_vals(self, cr, uid, sale_o... |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from gasistafelice.base.utils import get_ctype_from_model_label
from permissions.models import Permission, Role
from gasistafelice.base.models import Resource
class ParamRole(Resource,... |
"""Adobe PDF core font set"""
import os
from . import FONTS_PATH
from ..font import TypeFace, TypeFamily
from ..font.type1 import Type1Font
from ..font.style import REGULAR, MEDIUM, BOLD, OBLIQUE, ITALIC, CONDENSED
def path(name):
return os.path.join(FONTS_PATH, 'adobe14', name)
courier = TypeFace('Courier',
... |
from twisted.internet.defer import inlineCallbacks
from juju.control import legacy
from juju.control.utils import expand_constraints, get_environment
def configure_subparser(subparsers):
"""Configure bootstrap subcommand"""
sub_parser = subparsers.add_parser("bootstrap", help=command.__doc__)
sub_parser.add... |
"""
Provide tests for sysadmin dashboard feature in sysadmin.py
"""
import glob
import os
import re
import shutil
import unittest
from uuid import uuid4
from mock import patch
from pymongo.errors import PyMongoError
from util.date_utils import get_time_display, DEFAULT_DATE_TIME_FORMAT
from nose.plugins.attrib import a... |
"""
Tests for the course home page.
"""
from datetime import datetime, timedelta
import ddt
import mock
import six
from django.conf import settings
from django.http import QueryDict
from django.urls import reverse
from django.utils.http import urlquote_plus
from django.utils.timezone import now
from pytz import UTC
fro... |
from openerp.report import report_sxw
from openerp import models
class PayslipRunReport(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(PayslipRunReport, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'get_payslips_by_department': self.... |
from django.conf.urls import url, patterns, include
from django.conf import settings
urlpatterns = patterns('')
if getattr(settings, 'IDP_SAML2', False):
urlpatterns += patterns('',
(r'^saml2/', include('authentic2.idp.saml.urls')),)
if getattr(settings, 'IDP_OPENID', False):
urlpatterns += patterns('',
... |
import logging
from odoo import api, fields, models
_logger = logging.getLogger(__name__)
class PersonAuxAssociateToFamilyAux(models.TransientModel):
_description = 'Person (Aux) Associate to Family (Aux)'
_name = 'clv.person_aux.associate_to_family_aux'
def _default_person_aux_ids(self):
return sel... |
bind = "127.0.0.1:4567"
logfile = "/usr/local/ohc/log/elcid.gunicorn.log"
workers = 6
timeout = 120
accesslog = "/usr/local/ohc/log/elcid.access.log"
errorlog = "/usr/local/ohc/log/elcid.error.log" |
"""
The latest version of this package is available at:
<http://github.com/jantman/biweeklybudget>
Copyright 2016 Jason Antman <jason@jasonantman.com> <http://www.jasonantman.com>
This file is part of biweeklybudget, also known as biweeklybudget.
biweeklybudget is free software: you can redistribute it and/or m... |
from openerp import fields, models
class ResCompany(models.Model):
_inherit = "res.company"
leave_request_sequence_id = fields.Many2one(
string="Leave Request Sequence",
comodel_name="ir.sequence",
company_dependent=True,
)
allocation_request_sequence_id = fields.Many2one(
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.