text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
import logging
from datetime import datetime
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
import requests
from companies.models import Company
logger = logging.getLogger('jobs.management.commands')
class Command(BaseCommand):
help = 'Update currently listed... | rodxavier/open-pse-initiative | django_project/jobs/management/commands/update_listed_companies.py | Python | mit | 1,437 | 0.001392 |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the co... | qtproject/qt-creator | tests/system/tools/toolfunctions.py | Python | gpl-3.0 | 1,722 | 0.000581 |
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2014 Star2Billing S.L.
#
# The primar... | tarikgwa/nfd | newfies/dialer_campaign/models.py | Python | mpl-2.0 | 26,728 | 0.003218 |
import errno
import os
import types
import typing as t
from werkzeug.utils import import_string
class ConfigAttribute:
"""Makes an attribute forward to the config"""
def __init__(self, name: str, get_converter: t.Optional[t.Callable] = None) -> None:
self.__name__ = name
self.get_converter =... | mitsuhiko/flask | src/flask/config.py | Python | bsd-3-clause | 11,068 | 0.000542 |
from django.db import models
from django.contrib.auth.models import User, Group
from django.utils.translation import ugettext_lazy as _
from django.core.validators import RegexValidator
from django.conf import settings
class Repository(models.Model):
"""
Git repository
"""
# basic info
name = mode... | gitmill/gitmill | django/repository/models.py | Python | mit | 2,579 | 0.002326 |
import sys
import cherrypy
from cherrypy._cpcompat import ntob
def get_xmlrpclib():
try:
import xmlrpc.client as x
except ImportError:
import xmlrpclib as x
return x
def process_body():
"""Return (params, method) from request body."""
try:
return get_xmlrpclib().loads(cher... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/cherrypy/cherrypy/lib/xmlrpcutil.py | Python | bsd-3-clause | 1,606 | 0.002491 |
"""
Multilayer Perceptron
"""
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2012-2013, Universite de Montreal"
__credits__ = ["Ian Goodfellow", "David Warde-Farley"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
import logging
import math
import operator
import sys
import warnings
import numpy ... | goodfeli/pylearn2 | pylearn2/models/mlp.py | Python | bsd-3-clause | 166,284 | 0 |
from django.conf.urls import *
urlpatterns = patterns('tendenci.apps.payments.payflowlink.views',
url(r'^thankyou/$', 'thank_you', name="payflowlink.thank_you"),
url(r'^silentpost/', 'silent_post', name="payflowlink.silent_post"),
) | alirizakeles/tendenci | tendenci/apps/payments/payflowlink/urls.py | Python | gpl-3.0 | 243 | 0.00823 |
# -*- coding: utf-8 -*-
import pytest
from yarr_client.app import configurate_app
@pytest.fixture
def app():
app, _, _ = configurate_app()
return app
| bluecap-se/yarr.client | tests/conftest.py | Python | mit | 161 | 0 |
'''
Copyright 2011 Jean-Baptiste B'edrune, Jean Sigwald
Using New BSD License:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditio... | ydkhatri/mac_apt | plugins/helpers/hfs_alt.py | Python | mit | 22,333 | 0.006358 |
import _plotly_utils.basevalidators
class CminValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="cmin", parent_name="scatter3d.marker.line", **kwargs
):
super(CminValidator, self).__init__(
plotly_name=plotly_name,
parent_name=pare... | plotly/python-api | packages/python/plotly/plotly/validators/scatter3d/marker/line/_cmin.py | Python | mit | 533 | 0 |
"""Representation of a deCONZ gateway."""
import asyncio
import async_timeout
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.const import CONF_EVENT, CONF_HOST, CONF_ID
from homeassistant.core import EventOrigin, callback
from homeassistant.helpers import aiohttp_client
from homeassistant.... | MartinHjelmare/home-assistant | homeassistant/components/deconz/gateway.py | Python | apache-2.0 | 8,357 | 0 |
"""
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License ... | mwhooker/jones | tests/__init__.py | Python | apache-2.0 | 532 | 0 |
import wx
import eos.db
from logbook import Logger
pyfalog = Logger(__name__)
class FitRemoveBoosterCommand(wx.Command):
""""
from sFit.removeBooster
"""
def __init__(self, fitID, position):
wx.Command.__init__(self, True, "Implant remove")
self.fitID = fitID
self.position = po... | blitzmann/Pyfa | gui/fitCommands/calc/fitRemoveBooster.py | Python | gpl-3.0 | 849 | 0.002356 |
#!/usr/bin/env python
"""
Cacheability checking function.
"""
from redbot.formatter import relative_time, f_num
from redbot.message import HttpRequest, HttpResponse
from redbot.speak import Note, categories, levels
### configuration
cacheable_methods = ["GET"]
heuristic_cacheable_status = ["200", "203", "206", "300"... | mnot/redbot | redbot/message/cache.py | Python | mit | 29,383 | 0.004016 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 OpenStack Foundation. All rights reserved
#
# 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.apach... | Juniper/neutron | neutron/db/loadbalancer/loadbalancer_db.py | Python | apache-2.0 | 34,064 | 0.000059 |
#!/adsc/DDEA_PROTO/bin/python
"""
@author: NGO Quang Minh Khiem
@contact: khiem.ngo@adsc.com.sg
"""
import urllib
import urllib2
from datetime import *
from pathos.multiprocessing import ProcessingPool
import pathos.multiprocessing as pmp
from toolset import dill_save_obj
airport_codes = {
'SDH' : ... | TinyOS-Camp/DDEA-DEV | [Python]Collection/retrieve_weather.py | Python | gpl-2.0 | 6,690 | 0.009716 |
from stbt import press, wait_for_match
def checkers_via_gamut():
"""Change input video to "gamut" patterns, then "checkers" pattern"""
wait_for_match("videotestsrc-redblue.png")
press("gamut")
wait_for_match("videotestsrc-gamut.png")
press("checkers-8")
| wmanley/stb-tester | tests/preconditions.py | Python | lgpl-2.1 | 276 | 0 |
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | tensorflow/tfx | tfx/experimental/templates/penguin/pipeline/pipeline.py | Python | apache-2.0 | 6,485 | 0.005705 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
BatchInputSelectionPanel.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**************... | GeoCat/QGIS | python/plugins/processing/gui/BatchInputSelectionPanel.py | Python | gpl-2.0 | 7,904 | 0.001772 |
# -*- coding: utf-8 -*-
"""Copyright (c) 2012 Sergio Gabriel Teves
All rights reserved.
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 ... | dahool/vertaal | versioncontrol/lib/types/filesystem.py | Python | gpl-3.0 | 2,573 | 0.005441 |
#!/usr/bin/env python
#
# Copyright 2012 <+YOU OR YOUR COMPANY+>.
#
# This 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, or (at your option)
# any later version.
#
# This software is dis... | zeza/gnuradio-rc-testcode | gr-flysky/python/qa_flysky_dumpsync.py | Python | gpl-3.0 | 1,124 | 0.010676 |
#!/usr/bin/env python3
"""
Adds participant metadata to a given tabular data file for those sessions.
"""
__author__ = "Todd Shore <errantlinguist+github@gmail.com>"
__copyright__ = "Copyright 2018 Todd Shore"
__license__ = "Apache License, Version 2.0"
import argparse
import csv
import os
import sys
from typing imp... | errantlinguist/tangrams-analysis | add_tabular_participant_metadata.py | Python | apache-2.0 | 4,239 | 0.020996 |
#!/usr/bin/python
##############################################
###Python template
###Author: Elizabeth Lee
###Date: 11/4/14
###Function: RR of incidence in adults to incidence in children vs. week number. Incidence in children and adults is normalized by the size of the child and adult populations in the second cale... | eclee25/flu-SDI-exploratory-age | scripts/create_fluseverity_figs_v5/ILINet_RR_time_v5.py | Python | mit | 3,186 | 0.016949 |
"""
Using redirect route instead of simple routes since it supports strict_slash
Simple route: http://webapp-improved.appspot.com/guide/routing.html#simple-routes
RedirectRoute: http://webapp-improved.appspot.com/api/webapp2_extras/routes.html#webapp2_extras.routes.RedirectRoute
"""
from webapp2_extras.routes import R... | roninio/gae-boilerplate | boilerplate/routes.py | Python | lgpl-3.0 | 2,607 | 0.008055 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-10 16:10
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
migrations.swappabl... | uclouvain/osis_louvain | base/migrations/0024_documentfile.py | Python | agpl-3.0 | 1,981 | 0.003029 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
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-... | des-testbed/des_chan_algorithms | dga/dmp.py | Python | gpl-3.0 | 27,779 | 0.011124 |
import enum
import gzip
import pickle
from .base import Player
from .map import Map
class ActionType(enum.Enum):
target = 0
clear_target = 1
stop = 2
class Command(object):
'''a command received from a player
{'id': '<uuid>', 'action': '<action-type>.name', 'target': '<uuid>' | {'posx': X, 'pos... | eguven/mobai | mobai/engine/game.py | Python | mit | 7,171 | 0.001116 |
# Copyright (c) 2011, 2012 Free Software Foundation
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later vers... | gnowledge/ncert_nroer | demo/urls.py | Python | agpl-3.0 | 9,860 | 0.012069 |
from django.template import RequestContext
from django.shortcuts import render_to_response,get_object_or_404
from django.core.mail import send_mail
from questionnaire.models import *
import re,os
body_template = """
Thank you %s for your sumbission for the %s.
We appreciate your help in improving the OpenShift Mobile... | openshift-mobile/openshift-mobile-app-demo | wsgi/osmdemo/questionnaire/views.py | Python | gpl-3.0 | 2,536 | 0.039038 |
from os import makedirs
from os.path import join, dirname, exists
from string import Template
from galaxy.util.bunch import Bunch
from galaxy.objectstore import build_object_store_from_config
from .test_utils import TempDirectoryTestCase
from .test_objectstore import MockDataset
class PulsarObjectStoreTest(TempDirec... | ssorgatem/pulsar | test/pulsar_objectstore_test.py | Python | apache-2.0 | 5,154 | 0.002716 |
# Copyright 2017 Priscilla Boyd. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | priscillaboyd/SPaT_Prediction | src/decision_tree/DT_Utils.py | Python | apache-2.0 | 3,533 | 0.000566 |
import pypower.api as pp
import networkx as nx
import numpy as np
import copy
import pypower.idx_brch as idx_brch
import pypower.idx_bus as idx_bus
import pypower.idx_gen as idx_gen
def rescale_power_down(ppc):
"""Rescales power generation or load within a component uniformly among all
buses to balance genera... | kevinzhou96/CascadingFailureSimulation | rescale_power.py | Python | gpl-3.0 | 2,340 | 0.00641 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import six
from django.utils.transl... | lawzou/shoop | shoop/admin/modules/methods/views/edit_detail.py | Python | agpl-3.0 | 1,471 | 0.00068 |
import os
import numpy
from pylab import *
import traceback
import zmq
context = zmq.Context()
socket = context.socket(zmq.REP)
addr = os.environ.get("PYSERVER","tcp://127.0.0.1:9876")
socket.bind(addr)
poller = zmq.Poller()
poller.register(socket, zmq.POLLIN)
def farg(index):
global args
return numpy.fromstr... | tmbdev/clstm | display_server.py | Python | apache-2.0 | 819 | 0.015873 |
#!/usr/bin/python
#
# Simple script to echo the ttyUSB0 serial port to the console at 74880 baud.
# Based on http://www.esp8266.com/viewtopic.php?p=33650.
# I found it really really hard to do using standard tools like cu...
# By doing ./monitory.py and resetting the esp8226 (while it is connected
# via USB) you can se... | OpenSeizureDetector/ESP8266_SD | monitor.py | Python | gpl-3.0 | 516 | 0.001938 |
from datetime import datetime
from openerp.tests.common import TransactionCase
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
class TestOnchangeProductId(TransactionCase):
"""Test that when an included tax is mapped by a fiscal position, the included tax must be
subtracted to the price of the product... | vileopratama/vitech | src/addons/purchase/tests/test_onchange_product_id.py | Python | mit | 3,448 | 0.00348 |
#!/usr/bin/env python3
# Copyright (c) 2008-11 Qtrac Ltd. All rights reserved.
# This program or module 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) an... | therealjumbo/python_summer | py31eg/grepword-m.py | Python | gpl-3.0 | 4,049 | 0.00247 |
"""
Tequila: a command-line Minecraft server manager written in python
Copyright (C) 2014 Snaipe
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) ... | Snaipe/Tequila | tequila/server/group/exception.py | Python | gpl-3.0 | 1,272 | 0.000786 |
import mock
from cliff.commandmanager import CommandManager
class TestCommand(object):
@classmethod
def load(cls):
return cls
def __init__(self):
return
class TestCommandManager(CommandManager):
def _load_commands(self):
self.commands = {
'one': TestCommand,
... | citrix-openstack-build/cliff | cliff/tests/test_commandmanager.py | Python | apache-2.0 | 3,511 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author: Daniel E. Cook
Handles redirecting the user to the API Documentation.
"""
from base.application import app
from flask import send_from_directory
@app.route("/data/api/docs/")
@app.route("/data/api/docs/<path:path>")
def docs(path="index.html"):
return sen... | AndersenLab/cegwas-web | base/views/api/api_docs.py | Python | mit | 370 | 0.002703 |
##############################################################################
#
# Copyright (C) 2014 Pexego Sistemas Informáticos All Rights Reserved
# $Jesús Ventosinos Mayor <jesus@pexego.es>$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero ... | Comunitea/CMNT_004_15 | project-addons/purchase_picking/models/stock.py | Python | agpl-3.0 | 14,639 | 0.002528 |
# Copyright (c) 2012 Citrix Systems, Inc.
# All Rights Reserved.
#
# 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 ... | SUSE-Cloud/nova | nova/tests/api/openstack/compute/contrib/test_aggregates.py | Python | apache-2.0 | 18,885 | 0.000688 |
# -*- coding: utf-8-*-
import imaplib
import email
import re
from dateutil import parser
WORDS = ["EMAIL", "INBOX"]
def getSender(email):
"""
Returns the best-guess sender of an email.
Arguments:
email -- the email whose sender is desired
Returns:
Sender of the email.
... | brad999/nikita | client/modules/Gmail.py | Python | mit | 3,834 | 0 |
import bisect
import json
import progress
import zoning
def calculate_stream_size(stream):
old_pos = stream.tell()
stream.seek(0, 2)
size = f.tell()
stream.seek(old_pos, 0)
return size
class NullFeatures(object):
def __init__(self, map1_len, map2_len):
self._mapping = map1_len * map2_l... | ESultanik/ZoningMaps | intersect_maps.py | Python | gpl-3.0 | 10,096 | 0.00733 |
import json
import os.path
from hashlib import md5
class TargetFile:
def __init__(self, path, data = None):
self.path = path
self.hash = None
self.dependencies = {}
if data is not None:
self.hash = data['hash']
self.dependencies = data['dependencies']
def raw(self):
return {
'hash': self.hash,
... | mlowen/Pyke | pyke/meta.py | Python | mit | 2,310 | 0.040693 |
import random
from diesel import quickstart, first, sleep, fork
from diesel.util.queue import Queue
def fire_random(queues):
while True:
sleep(1)
random.choice(queues).put(None)
def make_and_wait():
q1 = Queue()
q2 = Queue()
both = [q1, q2]
fork(fire_random, both)
while True... | dieseldev/diesel | examples/newwait.py | Python | bsd-3-clause | 530 | 0.00566 |
# Licensed under a 3-clause BSD style license - see LICENSES
import math
import numpy as np
import pytest
from astropy import units as u
from numpy.testing import assert_allclose, assert_almost_equal
import sncosmo
def test_abmagsystem():
magsys = sncosmo.ABMagSystem()
m = magsys.band_flux_to_mag(1.0, 'bes... | kbarbary/sncosmo | sncosmo/tests/test_magsystems.py | Python | bsd-3-clause | 2,223 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: mec
| mecforlove/oj-web | app/utils/__init__.py | Python | apache-2.0 | 61 | 0 |
"""
Forms and validation code for user registration.
Note that all of these forms assume Django's bundle default ``User``
model; since it's not possible for a form to anticipate in advance the
needs of custom user models, you will need to write your own forms if
you're using a custom model.
"""
from __future__ import... | ArtemBernatskyy/FundExpert.NET | mutual_funds/registration/forms.py | Python | gpl-3.0 | 4,680 | 0.001709 |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, earthians and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestHealthcareServiceOrderPriority(unittest.TestCase):
pass
| ESS-LLP/erpnext | erpnext/healthcare/doctype/healthcare_service_order_priority/test_healthcare_service_order_priority.py | Python | gpl-3.0 | 232 | 0.008621 |
#!/usr/bin/env python3
import requests
from database import is_in_db
import database
__author__ = 'flshrmb'
def handle(some_story, conn):
cursor = conn.cursor()
database.insert(some_story, cursor)
cursor.close()
conn.commit()
def main():
top_list = requests.get('https://hacker-news.firebaseio.co... | nielsole/ycombinator_newsletter | code/crawl.py | Python | mit | 916 | 0.004367 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import json
import random... | suutari-ai/shoop | shuup_tests/default_reports/test_default_reports.py | Python | agpl-3.0 | 36,452 | 0.002826 |
from tests.base import TestCaseWithFlask, MOCKURL, TEST_DATA
from tests.servermock.server import app
import tests.servermock.yum_mock.config as config
import os.path
import unittest
import tempfile
import shutil
import gpgme
import librepo
PUB_KEY = TEST_DATA+"/key.pub"
class TestCaseYumRepoDownloading(TestCaseWithFl... | zde/librepo | tests/python/tests/test_yum_repo_downloading.py | Python | gpl-2.0 | 58,125 | 0.003802 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""Unit tests for the `iris.fileformats.pp._interpret_field` function."""
# Import iris.tests first so that some things can be... | SciTools/iris | lib/iris/tests/unit/fileformats/pp/test__interpret_field.py | Python | lgpl-3.0 | 5,255 | 0 |
"""
Tests for the integration test suite itself.
"""
import logging
import os
import subprocess
from collections import defaultdict
from pathlib import Path
from typing import Set
import yaml
from get_test_group import patterns_from_group
__maintainer__ = 'adam'
__contact__ = 'tools-infra-team@mesosphere.io'
log =... | GoelDeepak/dcos | packages/dcos-integration-test/extra/test_meta.py | Python | apache-2.0 | 3,623 | 0.000552 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/armor/component/shared_heavy_armor_layer_environmental.iff"... | anhstudios/swganh | data/scripts/templates/object/draft_schematic/armor/component/shared_heavy_armor_layer_environmental.py | Python | mit | 476 | 0.046218 |
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
#if __name__ == "__main__":
# print "Hello World"
from ProgrammingOutlook import AddMapiJournalToPST
import jpype
import os.path
asposeapis... | kashifiqb/Aspose.Email-for-Java | Plugins/Aspose.Email Java for Python/tests/ProgrammingOutlook/AddMapiJournalToPST/AddMapiJournalToPST.py | Python | mit | 672 | 0.00744 |
from unittest import TestCase, main
from preconditions import PreconditionError, preconditions
class PreconditionTestBase (TestCase):
def assertPreconditionFails(self, target, *args, **kw):
self.assertRaises(PreconditionError, target, *args, **kw)
def assertPreconditionFailsRegexp(self, rgx, target,... | nejucomo/preconditions | tests.py | Python | mit | 7,012 | 0.000143 |
# coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
from asn1crypto import pem, x509
from ._errors import pretty_message
from ._types import byte_cls, type_name
from .errors import DuplicateCertificateError
class ValidationPath():
"""
Represents a path going to... | wbond/certvalidator | certvalidator/path.py | Python | mit | 6,777 | 0.000738 |
"""use __file__ to determine library path
"""
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import language_model | paradisessssspee/nlptools | tests/context.py | Python | gpl-3.0 | 174 | 0.017241 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# 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.apach... | jessicalucci/NovaOrc | nova/openstack/common/processutils.py | Python | apache-2.0 | 5,488 | 0 |
from django.conf.urls import patterns, url
from django.conf import settings
import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
)
| esenti/ld-poznan | ldpoznan/core/urls.py | Python | mit | 160 | 0.0125 |
#!/usr/bin/env python
"""settings.py
Udacity conference server-side Python App Engine app user settings
$Id$
created/forked from conference.py by wesc on 2014 may 24
"""
# Replace the following lines with client IDs obtained from the APIs
# Console or Cloud Console.
WEB_CLIENT_ID = '942213791788-amreps3i4mdhv6d64... | yamrock/confcentral | settings.py | Python | apache-2.0 | 495 | 0.00202 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Vpic(CMakePackage):
"""VPIC is a general purpose particle-in-cell simulation code for mod... | LLNL/spack | var/spack/repos/builtin/packages/vpic/package.py | Python | lgpl-2.1 | 1,121 | 0.000892 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "smyt.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Ins1ne/smyt | manage.py | Python | mit | 253 | 0 |
from openerp import models, api, _
from openerp.exceptions import UserError
class ExportMoveExport(models.TransientModel):
_name = 'export.move.export'
_description = 'Export Moves'
@api.multi
def create_export_file(self):
context = dict(self._context or {})
moves = self.env['export.mo... | mncoon/odoo-addons | syscoon_finance_export/wizard/move_export.py | Python | lgpl-3.0 | 748 | 0.004011 |
from django.contrib import messages
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from django.views.generic import ListView, CreateView, UpdateView
from .models import Article
class ArticleListView(ListView):
"""
View to list all the articles
""... | andresgz/zshoes | zshoes/articles/views.py | Python | bsd-3-clause | 1,444 | 0 |
#!/usr/bin/env python
import os
import sys
import time
from ServerConfig import General
from ServerConfig import Hadoop
from ServerConfig import Hive
xmlProp = lambda key, value: "<property><name>" + key +"</name><value>" + value + "</value></property>\n"
concatStr = lambda servers, sep: sep.join(servers)
def copy... | tellproject/helper_scripts | hive.py | Python | apache-2.0 | 3,067 | 0.013694 |
# -*- coding: utf-8 -*-
"""
flaskbb.utils.fields
~~~~~~~~~~~~~~~~~~~~
Additional fields for wtforms
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
from datetime import datetime
from wtforms.fields import DateField
class BirthdayField(DateField):
""... | KevinHock/rtdpyt | profiling/test_projects/flaskbb_lite_3/flaskbb/utils/fields.py | Python | gpl-2.0 | 1,093 | 0 |
# -*- coding: utf-8 -*-
#
desc = 'Plot Taylor--Green Vortex using pcolormesh'
# phash = 'ff1a8578c9847b22'
phash = '7f1a8578c9857932'
def plot():
from matplotlib import pyplot as plt
import numpy as np
x = np.linspace(0*np.pi, 2*np.pi, 128)
y = np.linspace(0*np.pi, 2*np.pi, 128)
X, Y = np.meshgri... | dougnd/matplotlib2tikz | test/testfunctions/quadmesh.py | Python | mit | 840 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Throwaway where I play with pygit"""
| jrbl/pygitplay | pygitplay.py | Python | gpl-3.0 | 87 | 0.011494 |
from __future__ import absolute_import
import os
from pymongo import MongoClient
from test_helpers import bases, mixins, mongo
class WhenCreatingTemporaryDatabase(bases.BaseTest):
@classmethod
def configure(cls):
super(WhenCreatingTemporaryDatabase, cls).configure()
cls.database = mongo.Te... | aweber/test-helpers | tests/integration/test_mongo.py | Python | bsd-3-clause | 2,050 | 0.000488 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2006 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 t... | staranjeet/fjord | vendor/packages/translate-toolkit/translate/misc/autoencode.py | Python | bsd-3-clause | 2,252 | 0 |
"""
Timezone-related classes and functions.
"""
import functools
from contextlib import ContextDecorator
from datetime import datetime, timedelta, tzinfo
from threading import local
import pytz
from django.conf import settings
__all__ = [
'utc', 'get_fixed_timezone',
'get_default_timezone', 'get_default_tim... | Beauhurst/django | django/utils/timezone.py | Python | bsd-3-clause | 8,544 | 0 |
#-*- coding: utf-8 -*-
"""
Purevid urlresolver XBMC Addon
Copyright (C) 2011 t0mm0, belese, JUL1EN094
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 Licen... | VioletRed/script.module.urlresolver | lib/urlresolver/plugins/purevid.py | Python | gpl-2.0 | 5,907 | 0.00965 |
from room import Room
r = Room()
r.roomname = 'room 420'
r.exits = {'hallway': 'hallway'}
r.roomdesc = """
as the door opens smoke languidly rolls out. The lights are off and the curtain is pulled, which would normally make for a very dark room except for what appears to be a super nova sitting in the corner of the ro... | elstupido/rpg | rooms/prolog/Room420-1.room.py | Python | mit | 1,463 | 0.006835 |
# Copyright 2019 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | coreycb/charms.openstack | charms_openstack/plugins/trilio.py | Python | apache-2.0 | 24,279 | 0 |
# -*- coding: utf-8 -*-
"""
Extensions to Cauldron are user-facing helpful features
which do not strictly obey the KTL API, but which are
compatible with the KTL API when used via Cauldron.
""" | alexrudy/Cauldron | Cauldron/ext/__init__.py | Python | bsd-3-clause | 193 | 0.010363 |
# This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
import unittest as ut
from h5py import h5p, h5f, ve... | h5py/h5py | h5py/tests/test_h5p.py | Python | bsd-3-clause | 6,042 | 0.000662 |
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class Mycar168Pipeline(object):
def process_item(self, item, spider):
return item
| yzhuan/car | crawler/mycar168/mycar168/pipelines.py | Python | gpl-2.0 | 262 | 0 |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
# Copyright 2020 Red Hat, Inc. All rights reserved.
#
# 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/licens... | openstack/octavia | octavia/controller/worker/v2/flows/amphora_flows.py | Python | apache-2.0 | 27,873 | 0 |
''' Renderers for various kinds of annotations that can be added to
Bokeh plots
'''
from __future__ import absolute_import
from six import string_types
from ..core.enums import (AngleUnits, Dimension, FontStyle, LegendClickPolicy, LegendLocation,
Orientation, RenderMode, SpatialUnits, Verti... | rs2/bokeh | bokeh/models/annotations.py | Python | bsd-3-clause | 34,179 | 0.001141 |
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------------------
# Logger (kodi)
# --------------------------------------------------------------------------------
import inspect
import xbmc
from platformcode import config
loggeractive = (config.get_setting("debug") == True)... | pitunti/alfaPitunti | plugin.video.alfa/platformcode/logger.py | Python | gpl-3.0 | 1,925 | 0.000519 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from sqlalchemy.ext.declarative import declared_attr
from indico... | mvidalgarcia/indico | indico/modules/events/sessions/models/types.py | Python | mit | 1,690 | 0.000592 |
from django.views.generic import DetailView
from entries.models import Entry
class EntryView(DetailView):
model = Entry
template_name = "entry.html"
context_object_name = 'entry'
slug_field = 'sname'
slug_url_kwarg = 'entry_sname' | IlyaGusev/PersonalPage | PersonalPage/apps/entries/views.py | Python | gpl-2.0 | 252 | 0.003968 |
# Copyright 2013, Big Switch Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | zouyapeng/horizon-newtouch | openstack_dashboard/dashboards/project/firewalls/tabs.py | Python | apache-2.0 | 5,342 | 0 |
#! /usr/bin/python
from twisted.spread import pb
from twisted.internet import reactor
def main():
factory = pb.PBClientFactory()
reactor.connectTCP("localhost", 8800, factory)
d = factory.getRootObject()
d.addCallbacks(got_obj)
reactor.run()
def got_obj(obj):
# change "broken" into "broken2" ... | hortonworks/hortonworks-sandbox | desktop/core/ext-py/Twisted/doc/core/howto/listings/pb/exc_client.py | Python | apache-2.0 | 810 | 0.007407 |
# -*- coding: utf-8 -*-
#
# ownCloud Documentation documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 22 23:16:40 2012-2014.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogen... | evook/mirall | doc/ocdoc/user_manual/conf.py | Python | gpl-2.0 | 9,650 | 0.007254 |
# -*- coding: utf-8 -*-
# Copyright 2007-2022 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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 y... | hyperspy/hyperspy | hyperspy/tests/misc/test_utils.py | Python | gpl-3.0 | 4,362 | 0.000689 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
# =============================================================================
#
# Dialog implementation generated from a XDL file.
#
# Created: Sat Jul 9 15:14:39 2016
# by: unodit 0.5
#
# WARNING! All changes made in this file will be overwritten
# if the... | kelsa-pi/unodit | examples/embed dialog/src/Test_embed.py | Python | gpl-3.0 | 27,471 | 0.004405 |
self.description = "incoming package replaces symlink with directory (order 2)"
lp = pmpkg("pkg2")
lp.files = ["usr/lib/foo",
"lib -> usr/lib"]
self.addpkg2db("local", lp)
p1 = pmpkg("pkg1")
p1.files = ["lib/bar"]
self.addpkg2db("sync", p1)
p2 = pmpkg("pkg2", "1.0-2")
p2.files = ["usr/lib/foo"]
self.addp... | kylon/pacman-fakeroot | test/pacman/tests/sync702.py | Python | gpl-2.0 | 504 | 0 |
from __future__ import unicode_literals, division, absolute_import
import difflib
import logging
import re
from bs4.element import Tag
from flexget.utils.soup import get_soup
from flexget.utils.requests import Session
from flexget.utils.tools import str_to_int
from flexget.plugin import get_plugin_by_name, PluginErro... | lildadou/Flexget | flexget/utils/imdb.py | Python | mit | 12,292 | 0.001627 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/mission/quest_item/shared_sayama_edosun_q2_needed.iff"
result.attri... | anhstudios/swganh | data/scripts/templates/object/tangible/mission/quest_item/shared_sayama_edosun_q2_needed.py | Python | mit | 481 | 0.045738 |
from django import forms
from django.core.validators import EMPTY_VALUES
from django_filters.filters import ChoiceFilter, ModelChoiceFilter
from django_filters.filterset import FilterSet
import amo
import mkt
from addons.models import Category
from mkt.api.forms import SluggableModelChoiceField
from mkt.collections.m... | wagnerand/zamboni | mkt/collections/filters.py | Python | bsd-3-clause | 6,380 | 0.000784 |
"""
WSGI config for belmis project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` s... | pgergov/belmis | config/wsgi.py | Python | mit | 1,443 | 0 |
#!/usr/bin/env python
"""Handle records from PID specific /proc/PID/sched data files"""
import regentest as RG
import ProcHandlers as PH
import ProcBaseRoutines as PBR
PFC = PH.ProcFieldConstants
# ---
# pylint: disable=R0914
def re_self_sched(inprecs):
"""Iterate through parsed records and re-generate data ... | cnamejj/PyProc | regentest/self_sched.py | Python | gpl-2.0 | 3,267 | 0.003979 |
# Copyright (c) 2015 Uber Technologies, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | Willyham/tchannel-python | tchannel/testing/vcr/proxy/ttypes.py | Python | mit | 6,330 | 0.012638 |
# Add your own choices here!
fruit = ["apples", "oranges", "pears", "grapes", "blueberries"]
lunch = ["pho", "timmies", "thai", "burgers", "buffet!", "indian", "montanas"]
situations = {"fruit":fruit, "lunch":lunch}
| rbracken/internbot | plugins/pick/choices.py | Python | bsd-2-clause | 218 | 0.013761 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Profile'
db.create_table('edxval_profile', (
('id', self.gf('django.db.models.fi... | GbalsaC/bitnamiP | edx-val/edxval/migrations/0001_initial.py | Python | agpl-3.0 | 7,559 | 0.007408 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.