code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "nanothings.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| webvalley2013/nanothings | manage.py | Python | agpl-3.0 | 253 |
"""Adaptive Smoothed Aggregation"""
__docformat__ = "restructuredtext en"
from warnings import warn
import numpy as np
import scipy as sp
from scipy.sparse import csr_matrix, bsr_matrix, isspmatrix_csr,\
isspmatrix_csc, isspmatrix_bsr, eye, SparseEfficiencyWarning
from pyamg.multilevel import multilevel_solver
f... | huahbo/pyamg | pyamg/aggregation/adaptive.py | Python | mit | 32,425 |
"""
Views related to EdxNotes.
"""
from __future__ import absolute_import
import json
import logging
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.urls import reverse
from django.http import Http404, HttpResponse
from django.views.decorators.http import require_... | Stanford-Online/edx-platform | lms/djangoapps/edxnotes/views.py | Python | agpl-3.0 | 9,222 |
# pylint: disable=wildcard-import,unused-wildcard-import
from pylab.settings.base import * # noqa
DEBUG = False
ALLOWED_HOSTS = ['pylab.lt', 'localhost']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'pylab',
'USER': 'pylab',
}
}
LOGGING['ro... | python-dirbtuves/website | pylab/settings/production.py | Python | agpl-3.0 | 444 |
from itertools import chain
from django.db.models import Q
from django.conf import settings
from django.http import HttpResponsePermanentRedirect, HttpResponse
from django.shortcuts import render, get_object_or_404
from django.template.base import TemplateDoesNotExist
from django.utils import translation
from HavelCM... | uhuramedia/Havel | HavelCMS/views.py | Python | bsd-3-clause | 1,390 |
#!/usr/bin/env python
# nova.py: a pygame demo which draws circles
# Copyright 2011 Austin Pocus, see LICENSE for details
# TODO: - write circle class
# - distill main logic into functions, possible circle methods
# - modify main logic to change properties of circle
# - upon mousebuttonup[0], save circle to permanent... | ajpocus/nova | nova.py | Python | bsd-3-clause | 1,874 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2011 - 2012, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance w... | NeCTAR-RC/designate | designate/openstack/common/rpc/amqp.py | Python | apache-2.0 | 23,639 |
# coding: utf-8
# Copyright (c) 2015 Fabian Barkhau <fabian.barkhau@gmail.com>
# License: MIT (see LICENSE file)
class BlockchainService(object):
def __init__(self, testnet=False, dryrun=False):
"""TODO doc string"""
self.testnet = testnet
self.dryrun = dryrun
def get_tx(self, txid):... | Storj/btctxstore | btctxstore/services/interface.py | Python | mit | 819 |
"""
WSGI config for indumatic project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "indumatic.settings")
from django.co... | jantoniomartin/django-machinery | indumatic/wsgi.py | Python | agpl-3.0 | 393 |
import unittest
import nose.tools
import numpy as np
from scipy.spatial import distance_matrix
from tspsolver.tsp_generator import TSPGenerator
from ..population_generation import SimplePopulationGenerator
from ..selection import RouletteWheelSelection, TournamentSelection
class RouletteWheelSelectionTest(unittest.T... | samueljackson92/tsp-solver | tspsolver/ga/test/selection_test.py | Python | mit | 2,841 |
#!/usr/bin/env upython
#########################################################################
# Filename: upPost.py #
# Date: 2017-May-02 #
# Version: 1. #
# ... | BV-DR/foamBazar | pythonScripts/upPost.py | Python | gpl-3.0 | 1,848 |
# -*- coding: utf-8 -*-
"""
werkzeug.contrib.testtools
~~~~~~~~~~~~~~~~~~~~~~~~~~
This module implements extended wrappers for simplified testing.
`TestResponse`
A response wrapper which adds various cached attributes for
simplified assertions on various content types.
... | jeremydane/Info3180-Project4 | server/lib/werkzeug/contrib/testtools.py | Python | apache-2.0 | 2,520 |
from icrawl_plugin import IHostCrawler
from utils.jar_utils import crawl_jar_files
class JarHostCrawler(IHostCrawler):
def get_feature(self):
return 'jar'
def crawl(
self,
root_dir='/',
exclude_dirs=[
'/boot',
'/dev',
... | cloudviz/agentless-system-crawler | crawler/plugins/systems/jar_host_crawler.py | Python | apache-2.0 | 668 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Difference'] , ['MovingAverage'] , ['NoCycle'] , ['NoAR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Difference/model_control_one_enabled_Difference_MovingAverage_NoCycle_NoAR.py | Python | bsd-3-clause | 156 |
#!/usr/bin/env python
# encoding: utf-8
"""
qrcan_store.py
Created by Michael Hausenblas on 2011-03-07.
"""
import logging
_logger = logging.getLogger('qrcan')
import os
import rdflib
from rdflib import plugin
from rdflib import Graph
from rdflib import Namespace
from rdflib import URIRef
from rdflib import Literal
f... | mhausenblas/qrcan | qrcan_store.py | Python | unlicense | 3,900 |
from argparse import ArgumentParser
from queryutils.parse import parse_query
from sqlite3 import connect
from os import path
from contextlib import closing
thisdir = path.dirname(path.realpath(__file__))
SCHEMA = path.join(thisdir, "parsetrees_schema.sql")
def main(database, schema):
init_table(database, schema)... | stevedh/queryutils | loadparsetrees.py | Python | bsd-3-clause | 1,427 |
import numpy as np
from OSIM.Modeling.Components.NPN_Vertical_Bipolar_Intercompany_Model.VBIC_Charges.VBIC_DepletionCharge import VBIC_DepletionCharge
from OSIM.Modeling.Components.Resistor import Resistor
from OSIM.Modeling.Components.VoltageSource import VoltageSource
from OSIM.Modeling.Components.Capacity import Cap... | tmaiwald/OSIM | OSIM/Modeling/Testbenches/DepletionCharge_TB.py | Python | bsd-2-clause | 1,541 |
'''
Created on Jan 30, 2011
@author: mkiyer
chimerascan: chimeric transcript discovery using RNA-seq
Copyright (C) 2011 Matthew Iyer
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 ... | tectronics/chimerascan | chimerascan/deprecated/nominate_spanning_reads_v01.py | Python | gpl-3.0 | 5,222 |
"""
Factor analysis using MINRES or ML, with optional rotation using Varimax or Promax.
:author: Jeremy Biggs (jbiggs@ets.org)
:author: Nitin Madnani (nmadnani@ets.org)
:organization: Educational Testing Service
:date: 2021-10-18
"""
import warnings
import numpy as np
import pandas as pd
import scipy as sp
from scip... | EducationalTestingService/factor_analyzer | factor_analyzer/factor_analyzer.py | Python | gpl-2.0 | 33,606 |
#!~/envs/python3/udacity_python_mongodb
"""
To experiment with this code freely you will have to run this code locally.
Take a look at the main() function for an example of how to use the code. We
have provided example json output in the other code editor tabs for you to look
at, but you will not be able to run any qu... | francisrod01/wrangling_mongodb | lesson 1/musicbrainz.py | Python | mit | 2,947 |
# -*- coding: utf-8 -*-
# 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/.
import pickle
from flask import abort
from flask import request
from sqlalchemy.orm.exc import ... | lundjordan/services | src/uplift/backend/uplift_backend/api.py | Python | mpl-2.0 | 11,834 |
# ==============================================================================
# Copyright 2018-2020 Intel Corporation
#
# 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://ww... | tensorflow/ngraph-bridge | examples/keras_sample.py | Python | apache-2.0 | 1,380 |
import unittest
from lxml import etree
from pythonic_testcase import assert_contains
from soapfish import soap11, soap12, wsa, xsd
from soapfish.py2xsd import generate_xsd
SOAP11_ENVELOPE = '''\
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
{0}<soa... | iurisilvio/soapfish | tests/soap2_test.py | Python | bsd-3-clause | 8,191 |
import models
__author__ = 'pythoo'
from functools import wraps
import flask
from flask import Flask, render_template, request, Response, session, flash, redirect, url_for, jsonify
import flask.ext.sqlalchemy
import flask.ext.restless
from flask.ext.restless import ProcessingException
import time
from itsdangerous im... | PythoO/Contest | app.py | Python | mit | 6,234 |
#!/usr/bin/python
from utility import PunditDBUtil
cnx = PunditDBUtil.createDB() | pundit-project/pundit | pundit-central/lib/PuNDIT/db/createDB.py | Python | apache-2.0 | 82 |
import Orange
import numpy as np
data = Orange.data.Table("voting")
classifier = Orange.classification.LogisticRegressionLearner(data)
x = np.sum(data.Y != classifier(data))
| cheral/orange3 | doc/data-mining-library/source/tutorial/code/classification-accuracy-train.py | Python | bsd-2-clause | 175 |
# -*- coding: utf-8 -*-
"""
S3XRC Resource Framework
@version: 2.1
@see: U{B{I{S3XRC-2}} <http://eden.sahanafoundation.org/wiki/S3XRC>} on Eden wiki
@requires: U{B{I{lxml}} <http://codespeak.net/lxml>}
@author: nursix
@contact: dominic AT nursix DOT org
@copyright: 2009-2010 (c) Sahana S... | luisibanez/SahanaEden | modules/s3xrc.py | Python | mit | 182,380 |
# uasyncio.core fast_io
# (c) 2014-2018 Paul Sokolovsky. MIT license.
# This is a fork of official MicroPython uasynco. It is recommended to use
# the official version unless the specific features of this fork are required.
# Changes copyright (c) Peter Hinch 2018, 2019
# Code at https://github.com/peterhinch/micropy... | peterhinch/micropython-async | v2/fast_io/core.py | Python | mit | 17,175 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... | sasha-gitg/python-aiplatform | google/cloud/aiplatform_v1beta1/types/tensorboard_data.py | Python | apache-2.0 | 5,111 |
# Copyright 2016 The TensorFlow Authors. 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 applica... | ghchinoy/tensorflow | tensorflow/contrib/slim/python/slim/nets/resnet_v1_test.py | Python | apache-2.0 | 18,776 |
from __future__ import (absolute_import, division, print_function)
import numpy as np
from CrystalField.energies import energies as CFEnergy
from CrystalField.fitting import ionname2Nre
from six import iteritems
from six import string_types
def _get_normalisation(nre, bnames):
""" Helper function to calculate the... | ScreamingUdder/mantid | scripts/Inelastic/CrystalField/normalisation.py | Python | gpl-3.0 | 9,395 |
from os import path
extra_plugin_dir = path.join(path.dirname(path.realpath(__file__)), 'fail_config_plugin')
def test_failed_config(testbot):
assert 'Incorrect plugin configuration: Message explaining why it failed.' \
in testbot.exec_command('!plugin config Failp {}')
| gbin/err | tests/plugin_config_fail_test.py | Python | gpl-3.0 | 289 |
#!python
"""Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools... | pombredanne/opc-diag | ez_setup.py | Python | mit | 8,638 |
# Name: mapper_modisL1
# Purpose: Mapping for MODIS-L1 data
# Authors: Anton Korosov
# Licence: This file is part of NANSAT. You can redistribute it or modify
# under the terms of GNU General Public License, v.3
# http://www.gnu.org/licenses/gpl-3.0.html
import os
import... | yuxiaobu/nansat | mappers/mapper_viirs_l1.py | Python | gpl-3.0 | 4,485 |
# Copyright 2015 Google 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 required by applicable law or a... | DeepThoughtTeam/tensorflow | tensorflow/examples/how_tos/reading_data/fully_connected_preloaded_var.py | Python | apache-2.0 | 5,946 |
#!/usr/bin/env python
from __future__ import print_function
import itertools
from collections import namedtuple
from textwrap import dedent
# https://xkcd.com/1319/
# https://xkcd.com/1205/
TestEnvBase = namedtuple('TestEnvBase', ['python_version', 'pytest_version',
'django_... | aptivate/pytest-django | generate_configurations.py | Python | bsd-3-clause | 8,991 |
from tsserver import db
from tsserver.strutils import to_camel_case
class Model(db.Model):
"""
Base class for all models. What differs it from default Model class is
serializable method, which is used to convert objects to JSON (or any other
representation) more easily.
"""
__abstract__ = Tru... | m4tx/techswarm-server | tsserver/model.py | Python | mit | 1,346 |
import ovation.lab.workflows as workflows
from ovation.session import DataDict,Session,simplify_response
from unittest.mock import Mock, sentinel, patch
from nose.tools import istest, assert_equal
from tqdm import tqdm
@istest
def should_create_activity():
label = 'activity-label'
workflow_id = 1
workflo... | physion/ovation-python | test/test_workflows.py | Python | gpl-3.0 | 4,563 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Transformation of any input using Python Templating as
# meant in: https://wiki.python.org/moin/Templating.
# A TemplatingFilter typically is configured with a template file.
# The input is typically the Template context, the variables to be substituted.
# The output is... | sebastic/stetl | stetl/filters/templatingfilter.py | Python | gpl-3.0 | 12,163 |
import random
import string
import cherrypy
class A(object):
@cherrypy.expose
def a(self, arg):
return "hello " + arg
class B(object):
@cherrypy.expose
def b(self, arg):
return "bye " + arg
cherrypy.tree.mount(A(), '/a', a_conf)
cherrypy.tree.mount(B(), '/b', b_conf)
cherrypy.eng... | github/codeql | python/ql/test/library-tests/web/cherrypy/test.py | Python | mit | 355 |
"""Global variables associated to the test suite."""
#: List of CPP variables that should be defined in config.h in order to enable this suite.
need_cpp_vars = [
"HAVE_LIBXC",
]
#: List of keywords that are automatically added to all the tests of this suite.
keywords = [
]
#: List of input files
inp_files = [
"t00.... | jmbeuken/abinit | tests/libxc/__init__.py | Python | gpl-3.0 | 651 |
import json
import os
from PySide2 import QtCore, QtWidgets
import appglobals
from conversions import coordinates
from ui import ui_modifylocation
class LocationDialog(QtWidgets.QDialog, ui_modifylocation.Ui_LocationDialog):
def __init__(self):
super().__init__()
self.setWindowFlags(QtCore.Qt.Wind... | EthanChappel/Solar-System-Sequencer | solarsystemsequencer/modifylocation.py | Python | gpl-3.0 | 1,795 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modiy
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your... | Forage/Gramps | gramps/gui/undohistory.py | Python | gpl-2.0 | 10,049 |
#-*- coding: utf-8 -*-
from django.conf import settings
from django.db.models import get_model
PRODUCT_MODEL = get_model(*settings.SHOPPING_CART_PRODUCT_MODEL.split(u'.'))
| eerlo/django-shopping-cart | shopping_cart/config.py | Python | apache-2.0 | 174 |
input = """
% Simplified version of a program by Michael Fink, which segfaults
% with the Jun 11 2001 Release.
object(o1,4).
object(o2,5).
object(o3,17).
bid(1,14).
bid(2,34).
bid(3,14).
contains(1,o1,2).
contains(1,o2,4).
contains(1,o3,2).
contains(2,o3,10).
contains(3,o2,5).
%#maxint=62.
selec... | veltri/DLV2 | tests/parser/bug.69_working.test.py | Python | apache-2.0 | 1,691 |
import pytest
def test_pack_unpack():
header = ('json', 301)
from gpopup.ipc import _pack_header, _unpack_header
header_bytes = _pack_header(*header)
header_out = _unpack_header(header_bytes)
assert header == header_out
assert header[0] == header_out.type
assert header[1] == header_out.leng... | frostidaho/python-gpopup | tests/test_ipc2.py | Python | bsd-2-clause | 2,655 |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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... | USGSDenverPychron/pychron | pychron/pipeline/plot/editors/isochron_editor.py | Python | apache-2.0 | 3,053 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import functools
import logging
import sys
... | iafan/zing | pootle/apps/accounts/utils.py | Python | gpl-3.0 | 15,822 |
# TmLibrary - TissueMAPS library for distibuted image analysis routines.
# Copyright (C) 2016 Markus D. Herrmann, University of Zurich and Robin Hafen
# Copyright (C) 2018 University of Zurich
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Publi... | TissueMAPS/TmLibrary | tmlib/config.py | Python | agpl-3.0 | 12,488 |
# -*- coding: utf-8 -*-
from django.db import models
from base.models import *
from appconf import AppConf
from django.conf import settings
from django.contrib.postgres.search import SearchVector
from djorm_pgfulltext.models import SearchManager
from djorm_pgfulltext.fields import VectorField
from django.core.urlresolv... | Kungbib/CIPAC | webapp/kortkatalogen/skillingtryck/models.py | Python | apache-2.0 | 1,715 |
from datetime import datetime, timedelta
from os import path
from django.core.urlresolvers import reverse
import jingo
from mock import Mock
from pyquery import PyQuery as pq
from olympia import amo
from olympia.amo.tests import TestCase
from olympia.addons.models import Addon, AddonUser
from olympia.bandwagon.model... | mstriemer/addons-server | src/olympia/devhub/tests/test_models.py | Python | bsd-3-clause | 15,591 |
'''Searches wikipedia and returns first sentence of article
Scaevolus 2009'''
import re
from util import hook, http
api_prefix = "http://en.wikipedia.org/w/api.php"
search_url = api_prefix + "?action=opensearch&format=xml"
paren_re = re.compile('\s*\(.*\)$')
@hook.command('w')
@hook.command
def wiki(inp):
''... | Stratos42/EveBot | plugins.disabled/wikipedia.py | Python | gpl-3.0 | 1,288 |
# Various statistics functions.
#
# Written by Konrad Hinsen <hinsen@ibs.ibs.fr>
# last revision: 1997-6-1
#
import Numeric
#
# Univariate statistics functions
#
def average(data):
data = Numeric.array(data)
return Numeric.add.reduce(data)/len(data)
def variance(data):
data = Numeric.array(data)
retu... | fxia22/ASM_xf | PythonD/site_python/Numeric/RNG/Statistics.py | Python | gpl-2.0 | 1,224 |
import configparser
config = configparser.ConfigParser(allow_no_value=True)
config.read('manifest.ini')
for key in config['prod']:
print(key)
| mozilla-services/services-test | opengraph/dom-test/parse_manifest.py | Python | mpl-2.0 | 150 |
#!/usr/bin/env python
# Stolen from taskcluster-vcs
# https://github.com/taskcluster/taskcluster-vcs/blob/master/src/vcs/detect_remote.js
from urllib2 import Request, urlopen
from urlparse import urlsplit, urlunsplit
from os.path import exists, join
def first(seq):
return next(iter(filter(lambda x: x, seq)), '')
... | cstipkovic/spidermonkey-research | testing/mozharness/external_tools/detect_repo.py | Python | mpl-2.0 | 1,611 |
# -*- coding: utf8 -*-
from __future__ import unicode_literals
import unittest
import os
import sys
from flake8.api import legacy as engine
if sys.version_info[0] == 3:
unicode = str
if sys.version_info[:2] == (2, 6):
# Monkeypatch to make tests work on 2.6
def assert_less(first, second, msg=None):
... | psykzz/flask-rollbar | tests/test_flake8.py | Python | mit | 1,281 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 t... | imajes/Sick-Beard | sickbeard/config.py | Python | gpl-3.0 | 24,490 |
# Status: minor updates by Steven Watanabe to make gcc work
#
# Copyright (C) Vladimir Prus 2002. Permission to copy, use, modify, sell and
# distribute this software is granted provided this copyright notice appears in
# all copies. This software is provided "as is" without express or implied
# warranty, and with ... | rkq/cxxexp | third-party/src/boost_1_56_0/tools/build/src/tools/builtin.py | Python | mit | 30,266 |
# needed to cast image data
from ctypes import *
class Rect:
'''Fast rectangular collision structure'''
def __init__(self, x1, y1, x2, y2):
'''Create a rectangle from a minimum and maximum point'''
self.x1, self.y1 = x1, y1
self.x2, self.y2 = x2, y2
def intersect(self... | ObivouseCheste/craftroom | collide.py | Python | mit | 3,674 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.racing.FlyingGag
from panda3d.physics import ActorNode
from panda3d.core import GeomNode, NodePath
from direct.gui.DirectGui import *
from direct.interval.IntervalGlobal import *
from otp.avatar.ShadowCaster import ShadowCaster
class FlyingGag(... | DedMemez/ODS-August-2017 | racing/FlyingGag.py | Python | apache-2.0 | 1,205 |
#! /usr/bin/env python
# This file is part of the dune-pymor project:
# https://github.com/pymor/dune-pymor
# Copyright Holders: Stephan Rave, Felix Schindler
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
import pybindgen
from pybindgen import retval, param
def inject_ParameterFunct... | pymor/dune-pymor | dune/pymor/parameters/functional.py | Python | bsd-2-clause | 1,885 |
from binding import *
from .namespace import llvm
from .Type import Type
GenericValue = llvm.Class()
@GenericValue
class GenericValue:
delete = Destructor()
def _factory(name, *argtys):
return CustomStaticMethod('GenericValue_' + name,
ptr(GenericValue), *argtys)
... | llvmpy/llvmpy | llvmpy/src/GenericValue.py | Python | bsd-3-clause | 1,070 |
import smtplib
def main():
fromaddr = 'rohithrajreganti@gmail.com'
toaddrs = 'rohithrajreganti@gmail.com'
msg = "\r\n".join([
"From: rohithrajreganti@gmail.com",
"To: rohithrajreganti@gmail.com",
"Subject: Just a message",
"","Why, oh why" ])
username = 'rohithrajreganti@gmail.... | virtualvector/pyBOX | send_mail.py | Python | mit | 588 |
'''
Implements Protein class
This file is part of protein-analysis
protein-analysis is ree software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
protein... | tenshikun12/protein-analysis | protein.py | Python | gpl-3.0 | 9,008 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
import __builtin__
from os import environ, path, isatty, makedirs
from contextlib import closing
import shelve
import pickle
from anydbm import error as DBE... | BenLubar/dag-jbo | jbo.py | Python | bsd-2-clause | 27,426 |
# ===========================================================================
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE D... | lordtangent/arsenalsuite | python/pythondotnet/pythonnet/src/tests/leaktest.py | Python | gpl-2.0 | 11,909 |
"""
@copyright Copyright (c) 2011 - 2016, Intel Corporation.
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 agr... | taf3/testcases | general/test_ixnetwork.py | Python | apache-2.0 | 10,920 |
"""
This command exports a course from CMS to a git repository.
It takes as arguments the course id to export (i.e MITx/999/2020 ) and
the repository to commit too. It takes username as an option for identifying
the commit, as well as a directory path to place the git repository.
By default it will use settings.GIT_R... | edx-solutions/edx-platform | cms/djangoapps/contentstore/management/commands/git_export.py | Python | agpl-3.0 | 2,499 |
# Copyright (c) 2015-2016 Tigera, 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 required by applicabl... | caseydavenport/calico-docker | tests/st/calicoctl/test_autodetection.py | Python | apache-2.0 | 4,864 |
from datetime import timedelta
def date_range(start_date, end_date):
for n in range(int((end_date - start_date).days) + 1):
yield start_date + timedelta(n)
def ordinal(value: int) -> str:
exceptions_mapping = {1: 'st', 2: 'nd', 3: 'rd'}
suffix = 'th' if 4 <= value % 100 <= 20 else exceptions_map... | vapkarian/soccer-analyzer | src/utils.py | Python | mit | 378 |
"""Tests for stevedore.example.simple
"""
from stevedore.example import simple
from stevedore.tests import utils
class TestExampleSimple(utils.TestCase):
def test_simple_items(self):
f = simple.Simple(100)
text = ''.join(f.format({'a': 'A', 'b': 'B'}))
expected = '\n'.join([
'... | mandeepdhami/stevedore | stevedore/tests/test_example_simple.py | Python | apache-2.0 | 417 |
# Copyright (c) 2013 Mirantis 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 applicable law or agreed to in writi... | mattray/stackalytics | dashboard/reports.py | Python | apache-2.0 | 7,944 |
# This code is licensed under the MIT License (see LICENSE file for details)
from . import state_stack
class PropertyDevice(state_stack.StateStackDevice):
"""A base class that provides convenience methods for microscope
device classes that want to present a few properties to the server."""
def __init__(s... | zplab/rpc-scope | scope/util/property_device.py | Python | mit | 1,627 |
#!/usr/bin/python
#
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
# Copyright (c) 2016 Dell Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_versio... | shsingh/ansible | lib/ansible/modules/network/dellos9/dellos9_config.py | Python | gpl-3.0 | 13,592 |
identifier = 'edu.cmu.sv.componentGraph'
name = 'Component Graph'
version = '1.0.0'
def menu_items():
"""menu_items() -> tuple of (str,function)
It returns a list of pairs containing text for the menu and a
callback function that will be executed when that menu item is selected.
"""
from test_for... | CMUSV-VisTrails/WorkflowRecommendation | vistrails/packages/componentGraph/__init__.py | Python | bsd-3-clause | 1,248 |
"""
Tally counts stuff.
Copyright (c) 2013, Thom Leggett.
License: MIT (see LICENSE for details)
"""
from gevent import monkey; monkey.patch_all()
import bottle
from bottle import Bottle, view, static_file, redirect, abort, request
from gevent import sleep
from gevent.pywsgi import WSGIServer
from geventwebsocket imp... | tteggel/tally | tally/server.py | Python | mit | 8,166 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.rst... | abgov/ckanext-workflow | setup.py | Python | agpl-3.0 | 3,644 |
# 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
# d... | openstack/tempest | tempest/lib/api_schema/response/compute/v2_70/servers.py | Python | apache-2.0 | 3,787 |
'''
Created on Jul 2, 2014
@author: viejoemer
I can print a dict as a string in Python?
¿Yo puedo imprimir un dict como un string en Python?
str(dict) Produces a printable string representation of a dictionary, but
this not work for JSON format.
'''
#Definition of a dictionary
d = {'three': 3, 'two': 2, 'one': 1... | OxPython/Python-dict-str | dict_str.py | Python | epl-1.0 | 411 |
#from flask import session, render_template
#from functools import wraps
from passlib.apps import custom_app_context as passlib_ctx
from abc import ABCMeta, abstractmethod
from flask import session
from functools import wraps
import time
#def is_valid_user(some_user, timestamp):
# """Given a user, is this a valid user... | ZachAnders/FlaskMiniAuth | CoreAuth.py | Python | bsd-2-clause | 2,669 |
from collections import deque
from ..apib_extra_parse_utils import parse_property_member_declaration
from ..apib_extra_parse_utils import get_indentation
def parser_json_data_structures(json_content):
"""Retrieves data structures definition from JSON file and writes them in an easier to access format"""
... | Lenijas/test-travisci | fiware_api_blueprint_renderer/src/drafter_postprocessing/data_structures.py | Python | bsd-3-clause | 5,286 |
# -*- coding: utf-8 -*-
"""Application configuration."""
import os
class Config(object):
"""Base configuration."""
SECRET_KEY = os.environ.get('P101STAT_SECRET', 'secret-key') # TODO: Change me
APP_DIR = os.path.abspath(os.path.dirname(__file__)) # This directory
PROJECT_ROOT = os.path.abspath(os.p... | pmrowla/p101stat | p101stat/settings.py | Python | bsd-3-clause | 1,568 |
# -*- coding: utf-8 -*-
#
# Multilingual websites with Sphinx documentation build configuration file, created by
# sphinx-quickstart on Thu Nov 13 11:09:54 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the names... | lsaffre/timtools | docs/conf.py | Python | bsd-2-clause | 3,761 |
# pylint: disable=too-many-ancestors, invalid-name, no-self-use
""" View Set for personalised GymItem api """
from django.shortcuts import get_object_or_404
from rest_framework.response import Response
from rest_framework import viewsets, status
from app.models.profile import Profile
from app.models.gym_item import Gym... | Gimpneek/exclusive-raid-gym-tracker | app/views/view_sets/personalised_gym_item_view_set.py | Python | gpl-3.0 | 3,546 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
r_li_patchnum.py
----------------
Date : February 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
**************************... | gioman/QGIS | python/plugins/processing/algs/grass7/ext/r_li_patchnum.py | Python | gpl-2.0 | 1,330 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import traceback
from lazagne.config.module_info import ModuleInfo
from xml.etree.cElementTree import ElementTree
from lazagne.config import homes
class Pidgin(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'pidgin', 'chats')
# If... | AlessandroZ/LaZagne | Linux/lazagne/softwares/chats/pidgin.py | Python | lgpl-3.0 | 2,313 |
from django.core.management.base import BaseCommand
from django.core.exceptions import ImproperlyConfigured
from django.conf import settings
from django.utils.dateparse import parse_datetime, parse_date
from django.utils.text import slugify
from django.db.utils import IntegrityError, DataError
from django.db.models imp... | CivicTechTO/django-councilmatic | councilmatic_core/management/commands/loaddata.py | Python | mit | 38,219 |
# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
# Chris Houseknecht, <house@redhat.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
import os
import re
import types
import copy
import inspect
import traceback
import json
from os.path import e... | azaghal/ansible | test/support/integration/plugins/module_utils/azure_rm_common.py | Python | gpl-3.0 | 65,418 |
# -*- coding: utf-8 -*-
# Copyright 2015 Opener B.V. (<https://opener.am>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, api
class SaleOrder(models.Model):
_inherit = 'sale.order'
@api.multi
@api.onchange('partner_id')
def onchange_partner_id(self):
... | kittiu/sale-workflow | sale_partner_incoterm/models/sale_order.py | Python | agpl-3.0 | 537 |
import numpy
import yarp
# Initialise YARP
yarp.Network.init()
# Create the array with random data
img_array = numpy.random.uniform(0., 255., (240, 320)).astype(numpy.float32)
# Create the yarp image and wrap it around the array
yarp_image = yarp.ImageFloat()
yarp_image.setExternal(img_array, img_array.shape[1]... | mpatacchiola/pyERA | examples/ex_icub_head_imitation/example_sender_yarp_numpy.py | Python | mit | 615 |
from move import *
from player import Player
from abc import ABCMeta, abstractmethod
class Piece:
"""Common abstract base class for pieces"""
__metaclass__ = ABCMeta
colors = ['green', 'cyan', 'magenta', 'blue', 'yellow']
def __init__(self, name, label, player):
self.name = name
sel... | krame505/board_games | python/piece.py | Python | gpl-3.0 | 658 |
import sys
import ssscrapeapi
class EnclosureRestriction(ssscrapeapi.TableObject):
def __init__(self, *args, **kwargs):
'''
Initializes an EnclosureRestriction object.
'''
ssscrapeapi.TableObject.__init__(self, **kwargs)
self.table = 'ssscrape_enclosure_restriction'
... | ssscrape/ssscrape | lib/ssscrapeapi/feeds/enclosure_restriction.py | Python | lgpl-3.0 | 606 |
# -*- coding: utf-8 -*-
'''
The service module for NetBSD
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here
<module-provider-override>`.
''... | stephane-martin/salt-debian-packaging | salt-2016.3.3/salt/modules/netbsdservice.py | Python | apache-2.0 | 5,965 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (C) 2010-2014 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
you can redistribute it and/or modify it under the terms of the GNU
General Public License (G... | Chilledheart/vbox | src/VBox/ValidationKit/td-dummy.py | Python | gpl-2.0 | 1,513 |
a = 5 % 3
print(a)
"""<
2
>"""
b = 5 % 3.0
print(b)
"""<
2.0
>"""
import math
c = math.fmod(5, 3)
print(c)
"""<
2.0
>"""
| pythonpatterns/patterns | p0115.py | Python | unlicense | 121 |
#!/usr/bin/env python2
import argparse
from dada2_qiime1.dada2_qiime import run
import os
import shutil
def main(args):
# parse arguments
input_fastq = os.path.abspath(args.input_fastq)
skip_split = args.skip_split
if skip_split:
barcode_fastq = None
mapping = None
else:
b... | shafferm/dada2_qiime1 | scripts/qiime_dada2.py | Python | mit | 2,889 |
import xml.etree.ElementTree as ET
from xml.dom import minidom
#
# Autoconfig class for archive XML files.
#
class CAFile:
def __init__(self, filename = None):
if filename is not None:
self.openFile(filename);
def openFile(self, filename):
"""Open archiver XML file"""
self._tree = ET.parse(filena... | dchabot/caautoconfig | CAAutoConfig/files.py | Python | bsd-2-clause | 2,433 |
import json
import logging
import os
from pulse_actions.handlers import config
from mozillapulse.config import PulseConfiguration
from mozillapulse.consumers import GenericConsumer
logging.basicConfig(format='%(levelname)s:\t %(message)s')
LOG = logging.getLogger()
class PulseConsumer(GenericConsumer):
"""
... | vaibhavmagarwal/pulse_actions | pulse_actions/worker.py | Python | mpl-2.0 | 2,494 |
import binascii
from unittest import TestCase
from aioquic.buffer import encode_uint_var
from aioquic.h3.connection import (
H3_ALPN,
ErrorCode,
FrameType,
FrameUnexpected,
H3Connection,
StreamType,
encode_frame,
)
from aioquic.h3.events import DataReceived, HeadersReceived, PushPromiseRece... | KiChjang/servo | tests/wpt/web-platform-tests/tools/third_party/aioquic/tests/test_h3.py | Python | mpl-2.0 | 45,118 |
#------------------------------------------------------------------------------
# Copyright 2015 Esri
# 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/LICENS... | JudTown17/solutions-geoprocessing-toolbox | capability/test/test_poo_tools/TemplateConfigTest.py | Python | apache-2.0 | 2,996 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.