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 |
|---|---|---|---|---|---|
'''A checker for Draft Designer Smart Grids. Checks several different aspects of the grid and
reports Errors and Warnings.
Created on May 15, 2013
@author: Cam Moore
'''
from apps.managers.challenge_mgr import challenge_mgr
from apps.widgets.smartgrid_design.models import DesignerAction, DesignerEvent, DesignerGrid, \... | yongwen/makahiki | makahiki/apps/managers/smartgrid_mgr/gcc.py | Python | mit | 19,805 |
import main
import webapp2
class MainPage(main.Handler):
def get(self):
query = main.Blog.all()
query.order("-created")
posts = query.fetch(100)
username_cookie = self.request.cookies.get('username')
welcome_name, user = self.get_user_name(username_cookie)
image_... | saymorec/mzansi_yarona | post.py | Python | apache-2.0 | 5,351 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: Ansible Project
# 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_version': '1.1',
... | alxgu/ansible | lib/ansible/modules/cloud/atomic/atomic_host.py | Python | gpl-3.0 | 2,728 |
'''
Author: Wenchang Yang (yang.wenchang@uci.edu)
'''
import numpy as np
def _reshape_data(X):
"""Reshape a ndarray X into a 2d array that can be used in sklearn models.
The first dimension of X is usually 'time' (serves as the 'sample' dimension
in the sklearn dataset).
The remaining dimens... | wy2136/xlearn | xlearn/util.py | Python | bsd-3-clause | 961 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# filetools
# Gestion de archivos con discriminación xbmcvfs/samba/local
# ------------------------------------------------------------
import os
import traceback
import sys
from core import scrapertools
from platformcod... | alfa-jor/addon | plugin.video.alfa/core/filetools.py | Python | gpl-3.0 | 26,821 |
# Copyright (c) 2013 MetaMetrics, 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, publish, d... | seandst/cfn-pyplates | cfn_pyplates/functions.py | Python | mit | 12,495 |
import sys
import unittest
import importlib
import asn1tools
sys.path.append('tests/files')
sys.path.append('tests/files/3gpp')
sys.path.append('tests/files/cen')
sys.path.append('tests/files/etsi')
sys.path.append('tests/files/ieee')
sys.path.append('tests/files/ietf')
sys.path.append('tests/files/oma')
class Asn1... | eerimoq/asn1tools | tests/test_parse.py | Python | mit | 19,718 |
#!/usr/bin/env python
# -*- Mode: Python; py-indent-offset: 4 -*-
import sys, os, getopt
module_init_template = \
'/* -*- Mode: C; c-basic-offset: 4 -*- */\n' + \
'#ifdef HAVE_CONFIG_H\n' + \
'# include "config.h"\n' + \
'#endif\n' + \
'#include <Python.h>\n' + \
'#include <pygtk.h>\n' + \
'\n' + \
'/* include any e... | alessandrod/gst-rtsputils-python | rtsputils/codegen/mkskel.py | Python | gpl-3.0 | 2,803 |
# 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.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | silenceli/nova | nova/tests/unit/api/openstack/compute/contrib/test_extended_status.py | Python | apache-2.0 | 4,923 |
#!/usr/bin/env python
config = {
"default_vcs": "tc-vcs",
"default_actions": [
'checkout-sources',
'build',
'build-symbols',
'prep-upload'
],
"upload": {
"default": {
"upload_dep_target_exclusions": []
}
},
"env": {
"GAIA_OPTIMI... | simar7/build-mozharness | configs/b2g/taskcluster-phone.py | Python | mpl-2.0 | 1,056 |
# -*- coding: utf-8 -*-
"""MA-specific Form helpers"""
from __future__ import unicode_literals
from django.forms.fields import CharField, RegexField, Select
from django.utils.translation import ugettext_lazy as _
from .ma_provinces import PROVINCE_CHOICES_PER_REGION
from .ma_regions import REGION_CHOICES
class MAPo... | jieter/django-localflavor | localflavor/ma/forms.py | Python | bsd-3-clause | 2,287 |
# Django settings for truedolist project.
import os, logging
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
logging.basicConfig(
level = logging.DEBUG,
format = '%(asctime)s %(levelname)s %(message)s',
)
logging.debug("Reading settings...")
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
DE... | nileshk/truedolist | truedolist/settings.py | Python | mit | 3,147 |
from __future__ import absolute_import
__copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
import wx
import os
import webbrowser
from Cura.gui import configBase
from Cura.gui import expertConfig
from Cura.gui import alterationPanel
from Cura.gui import pluginPanel
from Cura.g... | tinkerinestudio/Tinkerine-Suite | TinkerineSuite/Cura/gui/mainWindow.py | Python | agpl-3.0 | 25,384 |
# Copyright 2018 The Bazel 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 applicable la... | bazelbuild/rules_apple | tools/codesigningtool/codesigningtool.py | Python | apache-2.0 | 14,378 |
from openmc.mgxs.groups import EnergyGroups
from openmc.mgxs.library import Library
from openmc.mgxs.mgxs import *
from openmc.mgxs.mdgxs import *
| bhermanmit/openmc | openmc/mgxs/__init__.py | Python | mit | 147 |
#! /usr/bin/env python
# Sketch - A Python-based interactive drawing program
# Copyright (C) 2002, 2003 by Bernhard Herzog
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# ver... | shumik/skencil-c | skconvert.py | Python | gpl-2.0 | 1,731 |
from __future__ import absolute_import
import os
from django.conf import settings
from openapi_core import create_spec
from openapi_core.contrib.django import DjangoOpenAPIRequest, DjangoOpenAPIResponse
from openapi_core.validation.response.validators import ResponseValidator
from sentry.utils import json
from sentr... | beeftornado/sentry | tests/apidocs/util.py | Python | bsd-3-clause | 2,014 |
import os, sys, subprocess
from PySide import QtCore,QtGui
class ProcessThread(QtCore.QThread):
def __init__(self,program,path):
super(ProcessThread,self).__init__()
self.path = path
self.program = program
def run(self):
subprocess.call([self.program,self.path])
| Symphonia/Searcher | ProcessThread.py | Python | mit | 306 |
# protocol-server
#
# a reference implementation of the Web Annotation Protocol
#
# Developed by Benjamin Young (@bigbulehat) and Shane McCarron (@halindrome).
# Sponsored by Spec-Ops (https://spec-ops.io)
#
# Copyright (c) 2016 Spec-Ops
#
# for license information, see http://www.w3.org/Consortium/Legal/2008/04-testsu... | emilio/servo | tests/wpt/web-platform-tests/annotation-protocol/tools/protocol-server.py | Python | mpl-2.0 | 14,311 |
# -*- coding: utf-8 -*-
#
# test_connect_helpers.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the Li... | tobikausk/nest-simulator | pynest/nest/tests/test_connect_helpers.py | Python | gpl-2.0 | 17,177 |
#! /usr/bin/env python
#
# IM - Infrastructure Manager
# Copyright (C) 2011 - GRyCAP - Universitat Politecnica de Valencia
#
# 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 t... | grycap/im | test/unit/VirtualMachine.py | Python | gpl-3.0 | 6,635 |
# =============================================================================
# __init__.py
#
# M2M demo init file.
#
# December 2015
#
# Copyright (c) 2015 by cisco Systems, Inc.
# All rights reserved.
# =============================================================================
| cisco/xr-telemetry-m2m-web | src/m2m_demo/__init__.py | Python | apache-2.0 | 285 |
"""Module with functions for plotting IRT-related results."""
import os
from typing import List
import matplotlib.pyplot as plt
import numpy
from mpl_toolkits.mplot3d import Axes3D
from . import irt
from .simulation import Simulator
def __column(matrix, i):
"""Returns columns from a bidimensional Python list (... | douglasrizzo/catsim | catsim/plot.py | Python | lgpl-3.0 | 15,726 |
#!/usr/bin/env python
from random import randint
from time import sleep
def example_message(sender, recipients, greeting="Hello"):
message = """
{greeting} {recipient_name},
Soy {sender_name} y lorem ipssum.
{sender_name}
""".format(
sender_name=sender.name, recipient_name=recipients[0].name, greetin... | EuroPython/ep-tools | eptools/emails/send_emails.py | Python | mit | 857 |
# This file is part of python-diffrevision
# Copyright (C) 2011 Francois Savard
#
# python-diffrevision 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)... | fsav/diffrev | diffing/plaintext_line_diff.py | Python | gpl-3.0 | 2,629 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2020 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | The-Compiler/qutebrowser | tests/conftest.py | Python | gpl-3.0 | 9,653 |
import unittest
import sys
from inspect import getfullargspec
from wrapt import formatargspec
class TestFormatargspec38(unittest.TestCase):
def assertFormatEqual(self, func, ref):
formatted = formatargspec(*getfullargspec(func))
self.assertEqual(formatted, ref)
def test_formatargspec(self):
... | GrahamDumpleton/wrapt | tests/test_formatargspec_py38.py | Python | bsd-2-clause | 1,217 |
"""
errors and exceptions
"""
from distutils.version import LooseVersion
from pkg_resources import get_distribution
from werkzeug import exceptions
from six import text_type
werkzeug_version = get_distribution("werkzeug").version
if LooseVersion(werkzeug_version) < LooseVersion("0.9"): # pragma: no cover
# sorr... | joshfriend/flask-limiter | flask_limiter/errors.py | Python | mit | 921 |
import os
class Config(object):
DEBUG = False
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
class DevelopmentConfig(Config):
DEBUG = True
class TestConfig(DevelopmentConfig):
TESTING = True
| LandRegistry/ownership-alpha | config.py | Python | mit | 216 |
import socket
import time
class SensorStreamingTest(object):
def __init__(self):
"""
Test the streaming of ultrasonic data from raspberry pi
"""
self.server_socket = socket.socket()
self.server_socket.bind(('192.168.43.178', 8002))
self.server_socket.listen(0)
... | bmcivor/lego_autono | testing/ultrasonic_server_test.py | Python | mit | 980 |
from tools import blockWinner, donationParser
import os, glob
if __name__ == '__main__':
start = ''
end = ''
#Get latest file in download folder
list_of_files = glob.glob('C:\\Users\\tlsha\\Downloads\\*.csv')
latest_file = max(list_of_files, key=os.path.getctime)
donations = donationParser(lat... | tsheez/scaretocare2017 | BlockWinner.py | Python | mit | 386 |
%matplotlib inline
import scipy as sp
import scipy.ndimage as nd
import matplotlib.image as mpimg
import numpy as np
import matplotlib.pyplot as plt
img = nd.imread('results_L3.jpg', mode = 'L')
imgplot = plt.imshow(img, cmap='Greys_r') | anthonyanthonyanthony/Casimir-programming | bacteria.py | Python | mit | 237 |
from collections import namedtuple
import re
from couchdbkit import ResourceNotFound
from corehq.apps.app_manager.dbaccessors import get_app
from corehq.apps.app_manager.models import ApplicationBase
from corehq.apps.domain.auth import determine_authtype_from_request
from corehq.apps.receiverwrapper.exceptions import L... | qedsoftware/commcare-hq | corehq/apps/receiverwrapper/util.py | Python | bsd-3-clause | 6,725 |
###############################################################################
# DehnenBarPotential: Dehnen (2000)'s bar potential
###############################################################################
import numpy
from ..util import conversion
from .Potential import Potential
_degtorad= numpy.pi/180.
class... | jobovy/galpy | galpy/potential/DehnenBarPotential.py | Python | bsd-3-clause | 21,358 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of the Shiboken Python Bindings Generator project.
#
# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
#
# Contact: PySide team <contact@pyside.org>
#
# This program is free software; you can redistribute it and/or
# modify it under t... | codewarrior0/Shiboken | tests/samplebinding/enum_test.py | Python | gpl-2.0 | 6,334 |
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2010-2013 Emilien Klein <emilien _AT_ klein _DOT_ st>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program ... | e2jk/nautilus-image-manipulator | nautilus_image_manipulator/NautilusImageManipulatorDialog.py | Python | gpl-3.0 | 26,709 |
"""
Models used for robust grading.
Robust grading allows student scores to be saved per-subsection independent
of any changes that may occur to the course after the score is achieved.
We also persist students' course-level grades, and update them whenever
a student's score or the course grading policy changes. As the... | jolyonb/edx-platform | lms/djangoapps/grades/models.py | Python | agpl-3.0 | 30,297 |
# -*- 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 'Survey'
db.create_table('supersyncer_survey', (
('id', self.gf('django.db.models... | njncalub/hiddencloudserver | supersyncer/migrations/0010_auto__add_survey.py | Python | gpl-3.0 | 14,205 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | grap/server-tools | base_field_serialized/tests/__init__.py | Python | agpl-3.0 | 1,060 |
from app.config.cplog import CPLog
import cherrypy
from pynma import pynma
log = CPLog(__name__)
class NMA:
app_name = 'CouchPotato'
def __init__(self):
self.enabled = self.conf('enabled')
self.apikey = self.conf('apikey')
self.devkey = self.conf('devkey')
... | CouchPotato/CouchPotatoV1 | app/lib/nma.py | Python | gpl-3.0 | 1,419 |
#!/usr/bin/python
# Copyright 2011 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 appli... | fengyuanjs/catawampus | tr/soap.py | Python | apache-2.0 | 6,687 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-10 19:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('invoices', '0009_auto_20160110_1036'),
]
operations = [
migrations.AddField(... | samupl/simpleERP | apps/invoices/migrations/0010_auto_20160110_1945.py | Python | mit | 955 |
from messagebird.base import Base
from messagebird.webhook import Webhook
class CallData(Base):
def __init__(self):
self.id = None
self.status = None
self.source = None
self.destination = None
self._createdAt = None
self._updatedAt = None
self._endedAt = No... | messagebird/python-rest-api | messagebird/call_data.py | Python | bsd-2-clause | 1,599 |
# -*- coding: utf-8 -*-
"""
Raw Text Corpus manager
"""
# This code is a part of coolisf library: https://github.com/letuananh/intsem.fx
# :copyright: (c) 2014 Le Tuan Anh <tuananh.ke@gmail.com>
# :license: MIT, see LICENSE for more details.
import os
import json
from texttaglib.chirptext import FileHelper
from tex... | letuananh/intsem.fx | coolisf/dao/textcorpus.py | Python | mit | 5,974 |
from __future__ import absolute_import
from datetime import timedelta
from django.utils import timezone
from rest_framework.response import Response
from sentry.app import tsdb
from sentry.api.base import EnvironmentMixin
from sentry.api.bases.project import ProjectEndpoint
from sentry.api.exceptions import ResourceD... | mvaled/sentry | src/sentry/api/endpoints/project_user_stats.py | Python | bsd-3-clause | 1,034 |
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from .models import Student, User
class SubmissionForm(forms.Form):
file = forms.FileField()
class StudentProfileForm(forms.ModelForm):
class Meta:
model = Student
exclude = ('user', 'co... | mtarsel/Django-MOOC | student_portal/forms.py | Python | gpl-2.0 | 370 |
# ==============================================================================
# Copyright [2013] [Kevin Carter]
#
# 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/l... | cloudnull/transporter | imager/utils.py | Python | apache-2.0 | 1,972 |
#! /usr/bin/env python3
from db_test import DBDakTestCase, fixture
from daklib.dbconn import *
from daklib.contents import BinaryContentsWriter, BinaryContentsScanner, \
UnpackedSource, SourceContentsScanner, SourceContentsWriter
from os.path import normpath
from sqlalchemy.exc import IntegrityError
from sqlalch... | Debian/dak | tests/dbtest_contents.py | Python | gpl-2.0 | 6,985 |
# Copyright (C) 2010-2012 Red Hat, Inc.
# This work is licensed under the GNU GPLv2 or later.
# Test get domain memory stats
from libvirt import libvirtError
from libvirttestapi.src import sharedmod
from libvirttestapi.utils import utils
required_params = ('guestname', )
optional_params = {}
VIRSH = "virsh qemu-mon... | libvirt/libvirt-test-API | libvirttestapi/repos/domain/memory_stats.py | Python | gpl-2.0 | 1,860 |
import numpy as np
import gvar as gv
import lsqfit
import sys
import tee
import pylab as plt
import collections
# editing info:
# 1b.out - cut 16-87
# 1d.out - cut 4-end
# 1e.out - cut 4-end
MAKE_PLOTS = True # False
N = 91
STDOUT = sys.stdout
OUTDIR = ''
# OUTDIR = 'tmp/'
def main():
bad_analysis()
good_analysis(... | gplepage/lsqfit | doc/source/eg-appendix1.py | Python | gpl-3.0 | 3,960 |
# -*- coding: utf-8 -*-
"""
--------------------------------------------------------------------------
glmnetPlot.m: plot coefficients from a "glmnet" object
--------------------------------------------------------------------------
DESCRIPTION:
Produces a coefficient profile plot fo the coefficient paths for a
... | bbalasub1/glmnet_python | glmnet_python/glmnetPlot.py | Python | gpl-3.0 | 8,744 |
# Copyright 2018 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 agreed to in writing, ... | tensorflow/data-validation | tensorflow_data_validation/coders/csv_decoder.py | Python | apache-2.0 | 3,734 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019
#
# Author(s):
#
# Martin Raspaud <martin.raspaud@smhi.se>
# Panu Lahtinen <panu.lahtinen@fmi.fi>
#
# 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... | pytroll/pytroll-file-utils | trollmoves/tests/test_client.py | Python | lgpl-3.0 | 25,728 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from sqlalchemy import Column, ForeignKey, Integer, String, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, sessionmaker
if os.path.exists('test.db'):
os.remove('test.db')
# tworzymy instancję k... | koduj-z-klasa/python101 | bazy/orm/ormsa02.py | Python | mit | 1,096 |
from __future__ import division
from math import sqrt, pi
try:
# Python 2.6 with unittest2 installed
from unittest2 import TestCase, main
except:
# Python 2.7
from unittest import TestCase, main
from ..vec3 import (
EPSILON, NegXAxis, NegYAxis, NegZAxis, Vec3, XAxis, YAxis, ZAxis,
)
... | evuez/flyinghigh-opengl-from-python | flyinghigh/geometry/tests/testVec3.py | Python | bsd-3-clause | 6,547 |
# 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 Openslide(AutotoolsPackage):
"""OpenSlide reads whole slide image files."""
homepage ... | LLNL/spack | var/spack/repos/builtin/packages/openslide/package.py | Python | lgpl-2.1 | 803 |
#!/usr/bin/env python
# -- coding: utf-8 --
""" a module to extend the python json package functionality;
- decoding/encoding between the on-disk JSON structure
and in-memory nested dictionary structure, including:
- treating path structures, with nested directories
and multiple .json files, as a single... | chrisjsewell/jsonextended | jsonextended/__init__.py | Python | mit | 2,406 |
#!/usr/bin/python
#
# nfdump-tools - Inspecting the output of nfdump
#
# Copyright (C) 2011 CIRCL Computer Incident Response Center Luxembourg (smile gie)
# Copyright (C) 2011 Gerard Wagener
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... | CIRCL/lnf-tools | bin/klookupd.py | Python | gpl-3.0 | 22,362 |
from stl import StlAsciiImporter, StlBinImporter
from grslicer.util.progress import progress_log
ALL_IMPORTERS = [StlAsciiImporter, StlBinImporter]
class SlicerImportException(Exception):
pass
@progress_log('Importing file')
def import_file(file_path, settings, progress):
progress.set_size(4)
with op... | greginvm/grslicer | grslicer/importers/__init__.py | Python | mit | 1,054 |
#!/usr/bin/python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# 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
# not... | Zolertia/openthread | tests/scripts/thread-cert/Cert_9_2_09_PendingPartition.py | Python | bsd-3-clause | 6,426 |
# This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | XeCycle/indico | bin/maintenance/indexes/all_index_check.py | Python | gpl-3.0 | 1,331 |
from .snpset import *
from .snpreader import *
| MicrosoftGenomics/FaST-LMM | fastlmm/pyplink/__init__.py | Python | apache-2.0 | 49 |
from controllers.basehandler import BaseHandler
from models.drink import Drink
import json
import cherrypy
class Drinks(BaseHandler):
#@cherrypy.expose
def index(self):
drinks = Drink.list(cherrypy.request.db)
template = self.templateEnv.get_template('drinks/index.html')
return templ... | r4mp/mete_python_cherrypy_jinja2 | mete/controllers/drinks.py | Python | agpl-3.0 | 1,135 |
def main(request, response):
import simplejson as json
f = file('config.json')
source = f.read()
s = json.JSONDecoder().decode(source)
url1 = "http://" + s['host'] + ":" + str(s['ports']['http'][1])
response.headers.set("Content-Security-Policy", "default-src 'self' 'unsafe-inline'")
respons... | pk-sam/crosswalk-test-suite | webapi/tct-csp-w3c-tests/csp-py/csp_default-src_self_script.py | Python | bsd-3-clause | 2,991 |
import os
import py_compile
import fnmatch
import zipfile
import site
from osnap import python_folder, __application_name__, get_logger
import osnap.util
LOGGER = get_logger(__application_name__)
class OsnapInstaller:
def __init__(self,
python_version,
application_name,
appl... | jamesabel/osnap | osnap/installer_base.py | Python | mit | 3,066 |
import datetime
import pytz
from gengine.app.cache import clear_all_caches
from gengine.app.tests.base import BaseDBTest
from gengine.app.tests.helpers import create_user, create_achievement, create_variable, create_goals, create_achievement_user
from gengine.app.model import Achievement, Value
class TestAchievement... | ActiDoo/gamification-engine | gengine/app/tests_old/test_achievement_integration_tests.py | Python | mit | 24,066 |
import logging
import sys
ch = None
def redirect_logging_to_stdout():
global ch
root = logging.getLogger()
root.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch... | M4rtinK/tsubame | tests/__init__.py | Python | gpl-3.0 | 400 |
# Manually imported from:
# https://github.com/Rapptz/RoboDanny/blob/master/cogs/utils/paginator.py
# DATE IMPORTED: 2014-04-10
import asyncio
import discord
class CannotPaginate(Exception):
pass
class Pages:
"""Implements a paginator that queries the user for the
pagination interface.
Pages are 1-in... | Injabie3/Red-DiscordBot | cogs/utils/paginator.py | Python | gpl-3.0 | 8,075 |
#coding: utf-8
from __future__ import absolute_import
import sqlite3
import threading
from shelve import Shelf
from .shelf_with_hooks import ShelfWithHooks
class SqliteDict(object):
"A dictionary that stores its data in a table in sqlite3 database"
def __init__(self, filename=None, connection=None, table='sh... | kmike/pymorphy | pymorphy/backends/shelve_source/sqlite_shelve.py | Python | mit | 2,869 |
import json
from pydisque.client import Client
from daemonize import Daemonize
import httplib, urllib
import pymysql.cursors
import encyption
import datetime
import ub
import time
pid = "/tmp/test.pid"
def makeConnection(host = "localhost", user = "admin", pw = "admin", db = "ushare"):
#make an sql connection
... | dexkcd/ushare | process/processor_daemon.py | Python | gpl-3.0 | 11,874 |
import wx
#from wx.lib.embeddedimage import PyEmbeddedImage
from custWXUtil import *
from baseColourWidgets import BasePyControl,BaseLineCtrl
from embImages import RGBCubeImage,HSVWheelImage
class RGBCube(BasePyControl):
"""
Implements the drawing, mouse handling and sizing routines for the RGB
... | jeremywrnr/life-of-the-party | LED-control/software/gui/colourWidgets.py | Python | mit | 13,460 |
import string
import re
from nlpaug.util import Method
from nlpaug.util.text.tokenizer import Tokenizer
from nlpaug import Augmenter
from nlpaug.util import WarningException, WarningName, WarningCode, WarningMessage
class WordAugmenter(Augmenter):
def __init__(self, action, name='Word_Aug', aug_min=1, aug_max=10... | makcedward/nlpaug | nlpaug/augmenter/word/word_augmenter.py | Python | mit | 6,564 |
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class ButtonWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Button Demo")
self.set_border_width(10)
hbox = Gtk.Box(spacing=6)
self.add(hbox)
button = Gtk.Button.new_with_labe... | agomezgarcia/asdadf | v0.0.1/practica1.py | Python | gpl-3.0 | 1,375 |
# Copyright 2016 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 agree... | googleapis/artman | artman/pipelines/pipeline_factory.py | Python | apache-2.0 | 2,529 |
from Module import AbstractModule
class Module(AbstractModule):
def __init__(self):
AbstractModule.__init__(self)
def run(
self, network, antecedents, out_attributes, user_options, num_cores,
outfile):
import shutil
from genomicode import filelib
in_data = antec... | jefftc/changlab | Betsy/Betsy/modules/convert_impute_merge_rma.py | Python | mit | 841 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-11 00:44
from __future__ import unicode_literals
from django.db import migrations
import share.robot
class Migration(migrations.Migration):
dependencies = [
('share', '0001_initial'),
('djcelery', '0001_initial'),
]
operatio... | zamattiac/SHARE | bots/autocurate/person/migrations/0001_initial.py | Python | apache-2.0 | 676 |
"""Provide the device automations for Humidifier."""
from typing import Dict, List
import voluptuous as vol
from homeassistant.components.device_automation import toggle_entity
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_SUPPORTED_FEATURES,
CONF_CONDITION,
CONF_DEVICE_ID,
CONF_DOMAIN,
... | tboyce021/home-assistant | homeassistant/components/humidifier/device_condition.py | Python | apache-2.0 | 3,292 |
class A:
def __init__(self):
self.x = 3
def f(self, y):
return self.x + y
# python 2 -> unbound error
#print A.f(2)
# python 3
#print(A.f(2))
# takes two arguments
class A_mock:
def __init__(self):
self.x = 2
print(A.f(A_mock(), 2))
| krenzlin/python-testing | unbound.py | Python | gpl-2.0 | 285 |
#!/usr/bin/env python
from argparse import ArgumentParser
from ServerConfig import General
from ServerConfig import Storage
from ServerConfig import TellStore
from ServerConfig import Kudu
from ServerConfig import Hbase
from ServerConfig import Cassandra
from ServerConfig import Ramcloud
from ServerConfig import Mic... | tellproject/helper_scripts | expRunner.py | Python | apache-2.0 | 12,770 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
# Copyright (C) 2003-2011 Ulrich von Zadow
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# versi... | pararthshah/libavg-vaapi | src/test/camcfgs.py | Python | lgpl-2.1 | 5,262 |
from django.conf.urls.defaults import *
from django.conf import settings
import base
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^quotes/', include('quotes.foo.urls')),
# Uncomment the admin/doc line ... | finder/mako_base | urls.py | Python | mit | 770 |
#!/usr/bin/env python3
# content/src/replace_txt_chunks.py
# =============================================================================
# Usage:
# $ curl -sO http://rgolubtsov.github.io/srcs/replace_txt_chunks.py && \
# chmod 700 replace_txt_chunks.py && \
# ... | rgolubtsov/rgolubtsov.github.io | content/src/replace_txt_chunks.py | Python | mit | 2,862 |
"""
Illustrate the rec array utility funcitons by loading prices from a
csv file, computing the daily returns, appending the results to the
record arrays, joining on date
"""
import urllib
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
# grab the price data off yahoo
u1 = urllib.urlr... | lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/lib/mpl_examples/misc/longshort.py | Python | mit | 1,676 |
# coding: utf-8
"""
Salt Edge Account Information API
API Reference for services # noqa: E501
OpenAPI spec version: 5.0.0
Contact: support@saltedge.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagger_cl... | ltowarek/budget-supervisor | third_party/saltedge/test/test_report_result_monthly_average_transactions_count.py | Python | mit | 1,148 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import datetime, os
def loadFile(filename):
f = open(filename,'r')
r = f.read()
f.close()
return r
def saveFile(filename,data):
print "[FILE]" + filename
f = open(filename,'w')
f.write(data)
f.close()
def checkDirectoryExists(directory):
if no... | folkien/pyTatry | functions.py | Python | gpl-2.0 | 745 |
import os
import tempfile
import pytest
from pystachio.basic import *
from pystachio.composite import Default, Struct
from pystachio.container import List, Map
from pystachio.naming import Namable, Ref
def ref(address):
return Ref.from_address(address)
def test_basic_lists():
assert List(Integer)([]).check().o... | wickman/pystachio | tests/test_container_types.py | Python | mit | 7,761 |
#!/usr/bin/env python
# Copyright (c) 2016-2020, The Bifrost Authors. All rights reserved.
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistribut... | ledatelescope/bifrost | python/setup.py | Python | bsd-3-clause | 4,033 |
# Copyright 2010-2011 OpenStack Foundation
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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... | jay-lau/magnum | magnum/tests/base.py | Python | apache-2.0 | 4,270 |
import os
import sys
import time
import stat
import socket
import email
import email.message
import re
import shutil
import StringIO
import tempfile
from test import test_support
import unittest
import mailbox
import glob
try:
import fcntl
except ImportError:
pass
# Silence Py3k warning
rf... | 2uller/LotF | App/Lib/test/test_mailbox.py | Python | gpl-2.0 | 88,659 |
'''
django_keyval/tests
Copyright (C) 2013 Edwin van Opstal
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 version.
This progr... | EdwinvO/django_keyval | django_keyval/admin.py | Python | agpl-3.0 | 1,067 |
"""
Copyright (C) 2018 Xilinx, Inc
Author(s): Ryan Radjabi
Shivangi Agarwal
Sonal Santan
ctypes based Python binding for XRT
Licensed under the Apache License, Version 2.0 (the "License"). You may
not use this file except in compliance with the License. A copy of the
License is located at... | yunqu/PYNQ | pynq/_3rdparty/xrt.py | Python | bsd-3-clause | 45,739 |
#-*- coding:utf8 -*-
import sys
sys.path.append('..')
import unittest
import operator
from PDA_Transport.config import DMUS_2006_DATA, DMUS_2007_DATA,DMUS_2008_DATA,DMUS_2009_DATA
from PDA_Transport.config import DMUS_2010_DATA, DMUS_2011_DATA, DMUS_2012_DATA, DMUS_2013_DATA, DMUS_2014_DATA
from PDA_Transport.Data_Read... | gaufung/LMDI | test/Test_Lmdi_Transport.py | Python | mit | 4,409 |
#Highly divisible triangular number
#-Researched about triangular formula
def count(n):
return sum([1 for i in range(1, (n//2) + 1) if not n % i])
def triangle(i):
return int((i * (i+1))/2)
assert count(21) == 3
assert count(28) == 5
i = 1
while(count(triangle(i)) <= 500):
i += 1
print triangle(i)
| paolo215/problems | Euler/12.py | Python | mit | 315 |
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | EricssonResearch/cerbero | cerbero/bootstrap/linux.py | Python | lgpl-2.1 | 9,637 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : TopoViewer plugin for DB Manager
Description : Create a project to display topology schema on Qgis
Date : Sep 23, 2011
copyright : (C) 2011 by Giuseppe Suc... | mj10777/QGIS | python/plugins/db_manager/db_plugins/postgis/plugins/qgis_topoview/__init__.py | Python | gpl-2.0 | 11,572 |
from django.test import TestCase
from django.db.utils import DatabaseError
from django.db.models.fields import NOT_PROVIDED
from .testmodels import FieldsWithOptionsModel
from google.appengine.api.datastore import Get
from google.appengine.ext.db import Key
from google.appengine.api.datastore_types import Text, C... | rimbalinux/MSISDNArea | djangoappengine/tests/field_options.py | Python | bsd-3-clause | 3,870 |
# coding: utf-8
import json
import sys
import codecs
python3 = False
if sys.version_info[0] == 3: #Python 3
python3 = True
if not python3:
reload(sys)
sys.setdefaultencoding("utf-8")
input = raw_input
def parseHTML(file_path):
fo = codecs.open(file_path, encoding='utf-8', mode='r+')
origina... | gordon-zhao/Chrome_bookmarks_to_json | src/python/html2json.py | Python | mit | 4,599 |
#!/usr/bin/env python
"""A class to read process memory on macOS.
This code is based on the memorpy project:
https://github.com/n1nj4sec/memorpy
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import ctypes
import ctypes.util
from grr_response_clien... | dunkhong/grr | grr/client/grr_response_client/osx/process.py | Python | apache-2.0 | 6,423 |
import socket
import sys
HOST, PORT = "localhost", 4321
# data = " ".join(sys.argv[1:])
data = "Salut!! Le Avatar demande des données pour effectuer des movements!!"
# Create a socket (SOCK_STREAM means a TCP socket)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
# Connect to server and send data
... | davidriv90/MotionBodyGame | MotionBodyGameServer/PythonScripts/MySocketClient.py | Python | apache-2.0 | 587 |
import threading
import time, cPickle, math
from Queue import *
from RubikGui import main_gui as Gui
from RubikSolver import rubik_solver as Solver
from SimonSays import simon_says as Simon
from GearRatios import gear_ratios as Gears
from . import utils
from . import queue_common
from event import *
import sounds
Com... | RoboErik/RUBIK | Rubik/state_controller.py | Python | apache-2.0 | 16,887 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.