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
from setuptools import setup, find_packages
# get requirements.txt
with open('requirements.txt') as f:
required = f.read().splitlines()
setup(name='athos-core',
description = 'Athos project core',
url = 'https://github.com/AthosOrg/',
packages = find_packages(),
entry_points... | AthosOrg/athos-core | setup.py | Python | mit | 491 |
"""
Describes additional properties of cobbler fields otherwise
defined in item_*.py. These values are common to all versions
of the fields, so they don't have to be repeated in each file.
Copyright 2009, Red Hat, Inc
Michael DeHaan <mdehaan@redhat.com>
This program is free software; you can redistribute it and/or m... | ssalevan/cobbler | cobbler/field_info.py | Python | gpl-2.0 | 4,454 |
# -*- coding: utf-8 -*-
import re
from ..base.decrypter import BaseDecrypter
class UlozToFolder(BaseDecrypter):
__name__ = "UlozToFolder"
__type__ = "decrypter"
__version__ = "0.27"
__status__ = "testing"
__pattern__ = r"http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/... | vuolter/pyload | src/pyload/plugins/decrypters/UlozToFolder.py | Python | agpl-3.0 | 1,771 |
__author__ = 'Pat McClernan and Dan Weggman'
#input
#0 for rock
#1 for paper
#2 for scissors
# past move is array of numbers
# our move followed by their move
#Our strategy is to look at all past moves
#In a large number of games, you would expect
# each move to be seen an even amount of times
#So our strategy is ... | mccler89/RPS_Player | my_rps_player.py | Python | apache-2.0 | 1,272 |
#!/usr/bin/python
from datetime import datetime, timedelta
import httplib2
import os
import sys
import pandas as pd
from pprint import pprint as pp
from apiclient.discovery import build
from apiclient.errors import HttpError
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage... | facemelters/data-science | Atlas/test-youtube.py | Python | gpl-2.0 | 5,599 |
# (C) British Crown Copyright 2010 - 2016, Met Office
#
# This file is part of Iris.
#
# Iris 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 version 3 of the License, or
# (at your option) any l... | QuLogic/iris | docs/iris/example_tests/test_COP_maps.py | Python | gpl-3.0 | 1,504 |
# -*- coding: utf-8 -*-
"""Overlay / Underlay an image or a geo referenced map to mpl.axes"""
import os
import math
import random
import matplotlib.image as mpimg
import numpy as np
import urllib
class OverlayImageMPL(object):
"""What is this?"""
def __init__(self, imageFileName, axes):
self.axe... | KristoferHellman/gimli | python/pygimli/mplviewer/overlayimage.py | Python | gpl-3.0 | 8,769 |
from lxml.html import parse
from datetime import datetime, timedelta
from message import GoogleVoiceMessage
def messagesFromHTML(htmlfile):
""" parse the contents of the folder
return a list of GoogleVoiceMessage objects
"""
def classContent(parent, cls):
"""
find the element inside... | mglover/gvoice-python | parsers.py | Python | gpl-2.0 | 3,478 |
"""Helpers to help coordinate updates."""
import asyncio
from datetime import datetime, timedelta
import logging
from time import monotonic
from typing import Awaitable, Callable, Generic, List, Optional, TypeVar
import urllib.error
import aiohttp
import requests
from homeassistant.core import CALLBACK_TYPE, HomeAssi... | tchellomello/home-assistant | homeassistant/helpers/update_coordinator.py | Python | apache-2.0 | 7,578 |
#!/usr/bin/env python
import os
import sys
import time
import tweepy
from tweepy import Cursor
from tweepy.binder import bind_api
from config import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET
class SkippableAPI(tweepy.API):
"""Override the create_block function so that it accepts
the ... | AnthonyBriggs/Python-101 | bad_tweet/bad_tweet.py | Python | mit | 2,749 |
# -*- coding: utf-8 -*-
"""The Formatter Test Data model class."""
from plasoscaffolder.model import base_data_model
from plasoscaffolder.model import sql_query_model
class FormatterTestDataModel(base_data_model.BaseDataModel):
"""Class for the data for the formatter test template."""
def __init__(self,
... | ClaudiaSaxer/PlasoScaffolder | src/plasoscaffolder/model/formatter_test_data_model.py | Python | apache-2.0 | 640 |
{
'service_metadata': {
'service_name': 'iris',
'service_version': '0.1',
},
'dataset_loader_train': {
'!': 'palladium.R.DatasetLoader',
'scriptname': 'iris.R',
'funcname': 'dataset',
},
'dataset_loader_test': {
'!': 'palladium.R.DatasetLoader',
... | ottogroup/palladium | examples/R/config-iris.py | Python | apache-2.0 | 1,050 |
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public t... | TeXitoi/navitia | source/jormungandr/jormungandr/georef.py | Python | agpl-3.0 | 2,419 |
# Copyright (c) 2001-2019, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | pbougue/navitia | source/jormungandr/jormungandr/equipments/tests/equipment_provider_mock.py | Python | agpl-3.0 | 1,421 |
# PopGen 1.1 is A Synthetic Population Generator for Advanced
# Microsimulation Models of Travel Demand
# Copyright (C) 2009, Arizona State University
# See PopGen/License
import adjusting_pums_joint_distribution
import numpy
def ipf_config_run (db, synthesis_type, control_variables, dimensions, pumano, tract... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/synthesizer/command_line_algorithm/ipf.py | Python | gpl-2.0 | 1,792 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
from django.shortcuts import render, redirect
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.conf import settings
from workup.models import ClinicDate
from pttrack.models import Patient
def dashboar... | SaturdayNeighborhoodHealthClinic/osler | dashboard/views.py | Python | gpl-3.0 | 1,655 |
import json
from flickrapi import FlickrAPI
from djpcms.contrib.social import OAuthProvider
DEFAULT_FLICKR_PERMISSION = 'read'
class Flickr(OAuthProvider):
AUTHORIZATION_URL = 'http://www.flickr.com/services/auth/'
def extra_request_parameters(self):
perms = getattr(self.settings,'FLICKR_PERMI... | strogo/djpcms | djpcms/contrib/social/providers/flickr.py | Python | bsd-3-clause | 2,116 |
class Solution:
# @param num, a list of integer
# @return an integer
def findPeakElement(self, num):
size = len(num) - 1
if size == 0:
return 0
if num[0] > num[1]:
return 0
if num[size] > num[size-1]:
return size
return self.findPea... | Crayzero/LeetCodeProgramming | Solutions/Find Peak Element/FindPeakElement.py | Python | mit | 979 |
"""Module for unittesting dmidecode methods"""
import unittest
from hwinfo.host.cpuinfo import CPUInfoParser
DATA_DIR = 'hwinfo/host/tests/data'
class CPUInfoParserTests(unittest.TestCase):
DATA = """
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 30
model name : Intel(R) Xeon(R) CPU X... | Revolution1/ohei | ohei/utils/hwinfo/host/tests/test_cpuinfo.py | Python | mit | 3,733 |
# Copyright (c) 2009, 2010, 2011, 2016 Nicira, 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 o... | ejschiller/FLEX | ovs/python/ovs/ovsuuid.py | Python | gpl-3.0 | 1,929 |
#!/usr/bin/python
#
# 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 b... | richardfergie/googleads-python-lib | examples/dfp/v201502/product_service/update_products.py | Python | apache-2.0 | 2,221 |
#! /usr/bin/env python
########################################################################
# File : dirac-admin-kill-pilot
# Author : A.T.
########################################################################
"""
Kill the specified pilot
"""
__RCSID__ = "$Id$"
import DIRAC
from DIRAC.Core.Base import Scr... | andresailer/DIRAC | WorkloadManagementSystem/scripts/dirac-admin-kill-pilot.py | Python | gpl-3.0 | 937 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Posix Status Module.
Module that implements the Abstract Status class for the posix
archive backend type.
"""
from ..abstract.status import AbstractStatus
class PosixStatus(AbstractStatus):
"""Posix Status Class.
Class for handling posix status pieces
needs ... | dmlb2000/pacifica-archiveinterface | pacifica/archiveinterface/backends/posix/status.py | Python | lgpl-3.0 | 1,478 |
import base64
import imghdr
import six
import uuid
from django.core.files.base import ContentFile
from rest_framework import serializers
from .models import Scholar, Record
class ScholarSerializer(serializers.ModelSerializer):
class Meta:
model = Scholar
fields = (
'pk',
... | mxmaslin/Test-tasks | django_test_tasks/old_django_test_tasks/apps/playschool/serializers.py | Python | gpl-3.0 | 721 |
# -*- coding: utf-8 -*-
# This file is part of Invenio.
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2014 CERN.
#
# Invenio 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... | crepererum/invenio | invenio/ext/legacy/layout.py | Python | gpl-2.0 | 9,951 |
"""Test different accessory types: Fans."""
from pyhap.const import HAP_REPR_AID, HAP_REPR_CHARS, HAP_REPR_IID, HAP_REPR_VALUE
from homeassistant.components.fan import (
ATTR_DIRECTION,
ATTR_OSCILLATING,
ATTR_PERCENTAGE,
ATTR_PERCENTAGE_STEP,
ATTR_PRESET_MODE,
ATTR_PRESET_MODES,
DIRECTION_... | sander76/home-assistant | tests/components/homekit/test_type_fans.py | Python | apache-2.0 | 20,146 |
#-------------------------------------------------------------------------------
# Name: 濠碘槅鍨埀顒冩珪閸?
# Purpose:
#
# Author: zhx
#
# Created: 17/05/2016
# Copyright: (c) zhx 2016
# Licence: <your licence>
#-------------------------------------------------------------------------------
import openpy... | vimilimiv/weibo-popularity_judge-and-content_optimization | 数据处理/delete.py | Python | mit | 3,023 |
from time import perf_counter as clock
import numpy as np
import tables as tb
N = 1000 * 1000
rnd = np.random.randint(N, size=N)
for dtype1 in ('S6', 'b1',
'i1', 'i2', 'i4', 'i8',
'u1', 'u2', 'u4', 'u8', 'f4', 'f8'):
for dtype2 in ('u4', 'i8'):
print("dtype array1, array2-->... | avalentino/PyTables | bench/keysort.py | Python | bsd-3-clause | 886 |
from rest_framework import serializers
from simpleTODO.models import Tag, Todo
class AutoCreatedPrimaryKeyRelatedField(serializers.PrimaryKeyRelatedField):
def to_internal_value(self, data):
if self.pk_field is not None:
data = self.pk_field.to_internal_value(data)
try:
re... | BenjaminSchubert/HttpInfrastructure | dynamic-server/src/httpInfrastructure/simpleTODO/serializers.py | Python | mit | 965 |
import unittest
from simpledecorators.Cache import Cache, TimeCacheStorage
called = 0
class SafeTest(unittest.TestCase):
def test_AddToCache(self):
global called
called = 0
@Cache(cacheStorage=TimeCacheStorage(time_seconds=1, maxCount=1000))
def func1(a,b,c):
global cal... | shaddyx/simpleDecorators | tests/CacheTest.py | Python | mit | 1,515 |
__copyright__ = 'Copyright(c) Gordon Elliott 2017'
"""
"""
import logging.config
import yaml
import pkg_resources
from dotmap import DotMap
config_path = pkg_resources.resource_filename(__name__, 'config/dev.yaml')
with open(config_path, 'r') as ymlfile:
configuration = DotMap(yaml.full_load(ymlfile))
loggin... | gordon-elliott/glod | src/glod/configuration.py | Python | mit | 460 |
import sys
import pytest
from notifications_utils.serialised_model import (
SerialisedModel,
SerialisedModelCollection,
)
def test_cant_be_instatiated_with_abstract_properties():
class Custom(SerialisedModel):
pass
class CustomCollection(SerialisedModelCollection):
pass
with p... | alphagov/notifications-utils | tests/test_serialised_model.py | Python | mit | 5,193 |
import inspect
import re
from collections import Counter
import distance
import numpy as np
import zss
from munkres import Munkres
from ucca.textutil import break2sentences, extract_terminals
from ucca import evaluation
from ucca import layer0, layer1
def compare(n1, n2):
return bool(labels(n1) & labels(n2))
... | danielhers/ucca | scripts/distances/align.py | Python | gpl-3.0 | 23,754 |
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
# params for ShiTomasi corner detection
feature_params = dict( maxCorners = 100,
qualityLevel = 0.3,
minDistance = 7,
blockSize = 7 )
# Parameters for lucas kanade optical flow
lk_params = dic... | epson121/ComputerGraphics | project/motion_tracking.py | Python | mit | 1,639 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/tmp/tmpqVBIL1'
#
# Created by: PyQt5 UI code generator 5.5
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWin... | hehongyu1995/Dxf2GCode | dxf2gcode_ui5.py | Python | gpl-3.0 | 45,029 |
# Generated by Django 2.2.7 on 2020-02-07 20:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("enhydris", "0030_abolish_instruments"),
]
operations = [
migrations.AlterModelOptions(
name="unitofmeasurement", options={"ordering": ["... | openmeteo/enhydris | enhydris/migrations/0031_change_unitofmeasurement_meta.py | Python | agpl-3.0 | 347 |
import ldap
import ldif
from ldap.cidict import cidict
from io import StringIO
from uuid import UUID
class CustomCidict(cidict):
def __getitem__(self, key):
"""Override of the __getitem__ method to return an empty list if a key
does not exist (instead of raising an exception)
"""
if... | nanu2/ldappr | ldappr/ldapprobject.py | Python | isc | 2,946 |
"""
Django settings for cloudmesh_portal project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# B... | cloudmesh/portal | old/cloudmesh_portal/settings.py | Python | apache-2.0 | 6,893 |
#-*-coding:utf-8-*-
class _AssignMixinEvent(object):
def __init__(self, request, from_employee, to_employee):
self.request = request
self.from_employee = from_employee
self.to_employee = to_employee
class AssignRun(_AssignMixinEvent):
pass
| mazvv/travelcrm | travelcrm/lib/events/assigns.py | Python | gpl-3.0 | 275 |
from flask import Blueprint, render_template, flash
from flask_login import login_required
from general.models import Rest
server = Blueprint('server', __name__, url_prefix='/server')
@server.route("/")
@login_required
def server_list():
rest = Rest()
list_server = rest.get_with_token('/barman/list-server')... | emin100/barmanUI | barmanui/server/controllers.py | Python | gpl-3.0 | 1,807 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('oj_core', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='problem',
name='backg... | oj-development/oj-web | oj_core/migrations/0002_auto_20150821_0113.py | Python | mit | 1,625 |
# Copyright (C) 2011-2015 2ndQuadrant Italia (Devise.IT S.r.L.)
#
# This file is part of Barman.
#
# Barman 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... | xocolatl/pgbarman | barman/__init__.py | Python | gpl-3.0 | 838 |
from django.core import urlresolvers
from django.contrib import admin
from django.template import defaultfilters
from .. import models
# Helpers ##########
class ModelAdmin(admin.ModelAdmin):
""" deletion of top level objects is evil """
def has_delete_permission(self, request, obj=None):
return False... | rshorey/python-opencivicdata-django | opencivicdata/admin/__init__.py | Python | bsd-3-clause | 9,394 |
from __future__ import absolute_import
from django.http import Http404
from rest_framework.response import Response
from sentry.api.bases.project import ProjectEndpoint, ProjectSettingPermission
from sentry.api.serializers import serialize
from sentry.integrations.slack import tasks
from sentry.models import Rule, Ru... | beeftornado/sentry | src/sentry/api/endpoints/project_rule_task_details.py | Python | bsd-3-clause | 1,470 |
#-*- coding: utf-8 -*-
# Contains implementation of Wavefront .OBJ importer
# Copyright (c) 2014 Tomasz Kapuściński
import re
import modelformat
import geometry
class ObjFormat(modelformat.ModelFormat):
def __init__(self):
self.description = 'Wavefront .OBJ format'
def get_extension(self):
... | tomaszkax86/Colobot-Model-Converter | objformat.py | Python | bsd-2-clause | 9,215 |
import cPickle as pickle
import sys
def main():
numargs = len(sys.argv)
w = None
if numargs == 2:
fname = sys.argv[1]
else:
fname = "../wordnet/WNedges.csv"
relsSet = set()
with open (fname, "r") as f:
for idx, line in enumerate(f):
if idx == 0:
... | redsk/neo_wordnet | relsSet.py | Python | gpl-2.0 | 552 |
# drive APMrover2 in SITL
import util, pexpect, sys, time, math, shutil, os
from common import *
from pymavlink import mavutil
import random
# get location of scripts
testdir=os.path.dirname(os.path.realpath(__file__))
#HOME=mavutil.location(-35.362938,149.165085,584,270)
HOME=mavutil.location(40.071374969556928,-1... | flyngPig/APM_simulink | ardupilot/Tools/autotest/apmrover2.py | Python | gpl-3.0 | 5,678 |
#!/usr/bin/env python
"""
Tests the behaviour of filelog w.r.t. data starting with '\1\n'
"""
from mercurial import ui, hg
from mercurial.node import nullid, hex
myui = ui.ui()
repo = hg.repository(myui, path='.', create=True)
fl = repo.file('foobar')
def addrev(text, renamed=False):
if renamed:
# data d... | iaddict/mercurial.rb | vendor/mercurial/tests/test-filelog.py | Python | mit | 1,549 |
from ..broker import Broker
class CLICredentialBroker(Broker):
controller = "cli_credentials"
def index(self, **kwargs):
"""Lists the available cli credentials. Any of the inputs listed may be be used to narrow the list; other inputs will be ignored. Of the various ways to query lists, using this met... | infobloxopen/infoblox-netmri | infoblox_netmri/api/broker/v3_4_0/cli_credential_broker.py | Python | apache-2.0 | 56,135 |
"""fsa.py
This modules implements fine-structure analysis of undirected
graphs with (numeric) vertex attributes. It further contains
functionality to estimate the feature distribution using Gaussian
mixture models, or to build a Bag-of-Words representation from
a collection of feature vectors.
The idea of fine-struct... | rkwitt/pyfsa | core/fsa.py | Python | apache-2.0 | 15,682 |
"""
.. module:: dj-stripe.tests.test_integrations.test_sync
:synopsis: dj-stripe Sync Method Tests.
.. moduleauthor:: Alex Kavanaugh (@kavdev)
"""
import sys
from django.conf import settings
from django.test.testcases import TestCase
from django.contrib.auth import get_user_model
from djstripe.models import Cha... | mthornhill/dj-stripe | tests/test_integrations/test_sync.py | Python | bsd-3-clause | 2,774 |
# -*- coding: utf-8 -*-
# This file is part of PyBOSSA.
#
# PyBOSSA 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.
#
# PyBOSSA... | NaturalHistoryMuseum/pybossa-beetles | get_images.py | Python | agpl-3.0 | 2,353 |
#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
class NullSmarts(object):
def __init__(self, editor):
pass
... | sharad/calibre | src/calibre/gui2/tweak_book/editor/smart/__init__.py | Python | gpl-3.0 | 811 |
import sys
if sys.version_info[0] >= 3:
text_type = str
string_types = str,
iteritems = lambda o: o.items()
itervalues = lambda o: o.values()
izip = zip
else:
text_type = unicode
string_types = basestring,
iteritems = lambda o: o.iteritems()
itervalues = lambda o: o.itervalues()
... | xsleonard/wtforms | wtforms/compat.py | Python | bsd-3-clause | 430 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import uuid
from django.db import models
class TimestampedModelMixin(models.Model):
""" TimestampedModelMixin
An abstract base class model that provides self-managed "created" and
"updated" fields.
"""
created = models.DateTimeField(a... | hzlf/openbroadcast.ch | app/base/models/mixins.py | Python | gpl-3.0 | 755 |
#!/usr/bin/env python
"""
A Kestrel client library.
"""
from collections import defaultdict
import re
import memcache
class Client(object):
"""Kestrel queue client."""
def __init__(self, servers, queue):
"""Constructor.
:param servers: The list of servers to connect to, really should onl... | empower/pykestrel | kestrel/client.py | Python | bsd-3-clause | 8,431 |
"""
The application file for the package
"""
from flask import Flask, render_template, jsonify
from cube import cube
app = Flask(__name__, template_folder='server/templates')
@app.route("/")
def index():
template_data = {
'site_title' : '8x8x8 LED Cube Operations',
'page_title' : 'LED Cube Control Pa... | kamodev/8x8x8_RPi_Zero_LED_Cube | rpi_zero_ledcube/web_app.py | Python | mit | 779 |
from zirkon.program_config import ModuleConfig
CONF = ModuleConfig("""
opt0 = Int()
opt1 = Int()
opt2 = Bool(default=True)
""")
def get_opt0():
return CONF["opt0"]
def get_opt1():
return CONF["opt1"]
def get_opt2():
return CONF["opt2"]
| simone-campagna/daikon | test_zirkon/pack0/comp0/__init__.py | Python | apache-2.0 | 254 |
#!/usr/bin/env python
"""Create a "virtual" Python installation
"""
__version__ = "13.1.2"
virtualenv_version = __version__ # legacy
import base64
import sys
import os
import codecs
import optparse
import re
import shutil
import logging
import tempfile
import zlib
import errno
import glob
import distutils.sysconfig
... | yougov/yg-buildpack-python2-gulp | vendor/virtualenv-13.1.2/virtualenv.py | Python | mit | 99,421 |
"""Login and Registration pages (2)"""
from bok_choy.page_object import unguarded
from .login_and_register import CombinedLoginAndRegisterPage as EdXCombinedLoginAndRegisterPage
class CombinedLoginAndRegisterPage(EdXCombinedLoginAndRegisterPage):
"""
Interact with combined login and registration page.
""... | nttks/edx-platform | common/test/acceptance/pages/lms/ga_login_and_register.py | Python | agpl-3.0 | 797 |
from functools import partial
from keras import backend as K
def dice_coefficient(y_true, y_pred, smooth=1.):
y_true_f = K.flatten(y_true)
y_pred_f = K.flatten(y_pred)
intersection = K.sum(y_true_f * y_pred_f)
return (2. * intersection + smooth) / (K.sum(y_true_f) + K.sum(y_pred_f) + smooth)
def di... | ellisdg/3DUnetCNN | legacy/unet3dlegacy/metrics.py | Python | mit | 1,508 |
import uuid
import settings
import email
import logging
import string
import hashlib
import sys
import os
import traceback
from django.utils import simplejson
from random import choice
from datetime import datetime
from django.db import models
from django.db.models.signals import post_save
from django.utils.translatio... | icomms/wqmanager | apps/receiver/models.py | Python | bsd-3-clause | 16,638 |
"""Plugin for NPO: Nederlandse Publieke Omroep
Supports:
VODs: http://www.npo.nl/het-zandkasteel/POMS_S_NTR_059963
Live: http://www.npo.nl/live/nederland-1
"""
import re
import json
from livestreamer.compat import quote
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http
from livest... | charmander/livestreamer | src/livestreamer/plugins/npo.py | Python | bsd-2-clause | 3,412 |
from django.utils.functional import cached_property
from django.utils.html import escape
from wagtail.core.models import Page
from wagtail.core.rich_text import features as feature_registry
from wagtail.core.rich_text.rewriters import EmbedRewriter, LinkRewriter, MultiRuleRewriter
from wagtail.core.whitelist import Wh... | nealtodd/wagtail | wagtail/admin/rich_text/converters/editor_html.py | Python | bsd-3-clause | 6,370 |
import asyncio
from inspect import iscoroutinefunction
from pyplanet.contrib.command.params import ParameterParser
class Command:
"""
The command instance describes the command itself, the target to fire and all other related information, like
admin command or aliases.
Some examples of some commands:
.. code-... | PyPlanet/PyPlanet | pyplanet/contrib/command/command.py | Python | gpl-3.0 | 7,587 |
#package QCAnalysis::TagCount;
#use base 'QCAnalysis';
#use strict;
#no strict "refs";
#use IO::File;
values={}
def parse_file(*argv):
classname = argv[0]
filename = argv[1]
analysis = argv[2]
print "opening: " + filename
try:
fh=open(filename)
except IOError as err:
print "Cannot open file: ", filename
... | TGAC/statsdb | python/TagCount.py | Python | gpl-3.0 | 797 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2016 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... | halfwit/qutebrowser | tests/unit/commands/test_runners.py | Python | gpl-3.0 | 2,859 |
# Copyright 2012 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... | Juniper/tempest | tempest/api/compute/admin/test_quotas.py | Python | apache-2.0 | 8,672 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------
# Copyright (c) 2012 Vincent Gauthier.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to... | ComplexNetTSP/CooperativeNetworking | complex_systems/spatial/__init__.py | Python | mit | 1,304 |
# Unix SMB/CIFS implementation.
# backend code for provisioning DNS for a Samba4 server
#
# Copyright (C) Kai Blin <kai@samba.org> 2011
# Copyright (C) Amitay Isaacs <amitay@gmail.com> 2011
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as... | freenas/samba | python/samba/provision/sambadns.py | Python | gpl-3.0 | 46,997 |
#
# pysmsd.handler.print_handler.py
#
# Copyright 2010 Helsinki Institute for Information Technology
# and the authors.
#
# Authors: Jani Turunen <jani.turunen@hiit.fi>
# Konrad Markus <konrad.markus@hiit.fi>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software a... | sizzlelab/pysmsd | pysmsd/handlers/print_handler.py | Python | mit | 1,500 |
echo = """echo '%(s1)s'"""
bind_shell = [
"""python -c 'import pty,os,socket;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.bind(("", %(port)s));s.listen(1);(rem, addr) = s.accept();os.dup2(rem.fileno(),0);os.dup2(rem.fileno(),1);os.dup2(rem.fileno(),2);pty.spawn("%(shell)s");s.close()'""",
"""nc -l -p ... | SecHackLabs/WebHackSHL | modules/tplmap/plugins/languages/bash.py | Python | gpl-3.0 | 1,643 |
#!/usr/bin/env python
"""
A Simple wx example to test PyDev's event loop integration.
To run this:
1) Enable the PyDev GUI event loop integration for wx
2) do an execfile on this script
3) ensure you have a working GUI simultaneously with an
interactive console
Ref: Modified from wxPython source code wxP... | roscoeZA/GeoGigSync | pydev/tests_mainloop/gui-wx.py | Python | cc0-1.0 | 3,445 |
from django.core.management.base import NoArgsCommand
from django.conf import settings
from avatar.models import Avatar
from avatar.models import AUTO_GENERATE_AVATAR_SIZES
class Command(NoArgsCommand):
help = "Regenerates avatar thumbnails for the sizes specified in " + \
"settings.AUTO_GENERATE_AVATAR_S... | amarandon/smeuhsocial | apps/avatar/management/commands/rebuild_avatars.py | Python | mit | 594 |
"""
Interface to Constrained Optimization By Linear Approximation
Functions
---------
.. autosummary::
:toctree: generated/
fmin_cobyla
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy.lib.six import callable
from scipy.optimize import _cobyla
from .optimize... | Universal-Model-Converter/UMC3.0a | data/Python/x86/Lib/site-packages/scipy/optimize/cobyla.py | Python | mit | 8,871 |
##########################################################################
#
# Copyright (c) 2013-2014, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | goddardl/gaffer | python/GafferSceneUI/TransformUI.py | Python | bsd-3-clause | 2,347 |
"""Tests for the management commands `send_message_digest`."""
from django.core import mail
from django.core.management import call_command
from django.test import TestCase
from django.utils.timezone import now, timedelta
from mixer.backend.django import mixer
class SendMessageDigestTestCase(TestCase):
longMessa... | bitmazk/django-conversation | conversation/tests/management_tests.py | Python | mit | 1,199 |
# Copyright (c) 2015 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
import os, multiprocessing
import time
import bottle
import requests
import pytest
from pytest import raises
from jenkinsflow import jenkins_api
from .cfg import ApiType
from .framework i... | lechat/jenkinsflow | test/which_ci_server_test.py | Python | bsd-3-clause | 1,672 |
import os
import socket
import threading
import socketserver
SERVER_HOST = 'localhost'
SERVER_PORT = 0 # Tells kernel to pick port randomly
BUF_SIZE = 1024
ECHO_MSG = b'Hello echo Server!'
class ForkedClient():
def __init__(self, ip, port):
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM... | GreenJoey/My-Simple-Programs | python/Network Programming/echo_server.py | Python | gpl-2.0 | 1,974 |
from argparse import ArgumentParser
from typing import Any
from zerver.lib.management import CommandError, ZulipBaseCommand
from zerver.lib.rate_limiter import RateLimitedUser
from zerver.models import UserProfile, get_user_profile_by_api_key
class Command(ZulipBaseCommand):
help = """Manually block or unblock a... | brainwane/zulip | zerver/management/commands/rate_limit.py | Python | apache-2.0 | 2,937 |
"""Distributed XGBoost Rabit related API."""
import ctypes
from enum import IntEnum, unique
import pickle
from typing import Any, TypeVar, Callable, Optional, cast, List, Union
import numpy as np
from .core import _LIB, c_str, STRING_TYPES, _check_call
def _init_rabit() -> None:
"""internal library initializer.... | dmlc/xgboost | python-package/xgboost/rabit.py | Python | apache-2.0 | 6,139 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Get record tests."""
from __future__ import absolute_import, print_function
from... | inveniosoftware/invenio-records-rest | tests/test_views_item_get.py | Python | mit | 2,695 |
import unittest
import numpy as np
from waLBerla import field, createUniformBlockGrid, AABB
class BlockforestModuleTest(unittest.TestCase):
def testMemoryManagement1(self):
"""Testing correct reference counting of block data"""
blocks = createUniformBlockGrid(blocks=(1, 1, 1), cellsPerBlock=(2, 2... | lssfau/walberla | python/waLBerla_tests/test_blockforest.py | Python | gpl-3.0 | 3,743 |
#!/usr/bin/env python
import SocketServer
import time
import sys
class LoggerRequestHandler(SocketServer.BaseRequestHandler):
def setup(self):
print self.client_address, 'connected!'
def handle(self):
while 1:
time.sleep(0.01)
data = self.request.recv(1024)
... | avroshk/VRDAW | VRDAW_working/LogServer.py | Python | gpl-3.0 | 648 |
#!/usr/bin/env python
# encoding: utf-8
# Carlos Rafael Giani, 2006
"""
Unit tests run in the shutdown() method, and for c/c++ programs
One should NOT have to give parameters to programs to execute
In the shutdown method, add the following code:
>>> def shutdown():
... ut = UnitTest.unit_test()
... ut.run()
...... | jubos/meguro | tools/wafadmin/Tools/UnitTest.py | Python | mit | 9,155 |
# oracle/__init__.py
# Copyright (C) 2005-2011 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from sqlalchemy.dialects.oracle import base, cx_oracle, zxjdbc
base.dialect = cx_o... | eunchong/build | third_party/sqlalchemy_0_7_1/sqlalchemy/dialects/oracle/__init__.py | Python | bsd-3-clause | 785 |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | Southpaw-TACTIC/TACTIC | src/pyasm/application/flash/flash_builder.py | Python | epl-1.0 | 3,514 |
# The Hazard Library
# Copyright (C) 2012-2022 GEM 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 version.
#... | gem/oq-engine | openquake/hazardlib/tests/mfd/evenly_discretized_test.py | Python | agpl-3.0 | 4,199 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2010-2012 Elico Corp. All Rights Reserved.
# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
#
# This program is free software: you can red... | jmesteve/openerp | openerp/addons/delivery_routes/wizard/stock.py | Python | agpl-3.0 | 1,876 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 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... | DavidAndreev/indico | indico/web/forms/validators.py | Python | gpl-3.0 | 11,906 |
import re
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin
from cms.plugins.video import settings
from os.path import basename
class Video(CMSPlugin):
# player settings
movie = models.FileField(_('movie file'), upload_to=CMSPlugin.get_media_p... | dibaunaumh/tikal-corp-website | cms/plugins/video/models.py | Python | bsd-3-clause | 2,890 |
#!/usr/bin/env python
"""A class for determining HiC data quality."""
import os
import sys
from math import ceil, floor
import numpy
import h5py
from scipy.optimize import curve_fit
try:
from mpi4py import MPI
except:
pass
try:
from pyx import *
unit.set(defaultunit="cm")
text.set(mode="latex")
e... | bxlab/hifive | hifive/quasar.py | Python | mit | 62,263 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sphinx_py3doc_enhanced_theme
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.extlinks',
'sphinx.ext.ifconfig',
'sphinx.ext.napoleon',
'sphinx.e... | ionelmc/python-darkslide | docs/conf.py | Python | apache-2.0 | 1,275 |
# Copyright 2013 IBM Corp.
#
# 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 w... | rahulunair/nova | nova/api/openstack/compute/suspend_server.py | Python | apache-2.0 | 2,596 |
#!/usr/bin/env python
"""
Sample rest service for mod_log_rest
Author: Brendon Crawford <brendon@last.vc>
"""
import json
import logging
import uuid
from tornado.ioloop import IOLoop
from tornado.web import RequestHandler, Application
import settings
logging.basicConfig(level=logging.INFO)
def main():
"""
... | brendoncrawford/ejabberd_mod_log_rest | web/application.py | Python | lgpl-2.1 | 2,060 |
#!/usr/bin/env python
# Scans twitter for trending terms, populates a database with the results and
# then creates a json file showing trends based on the data
import CreateJson as j
import TwitterSearch as t
import KeywordSearch as k
import Log as l
import logging
ProcessResult = False
FN_NAME = "TrendingTermsSenti... | AdamDynamic/TwitterMetrics | TrendingTermsSentiment.py | Python | gpl-2.0 | 1,025 |
import warnings
# 2.3 compatibility
try:
set
except NameError:
import sets
set = sets.Set
import numpy as np
from matplotlib._delaunay import delaunay
from .interpolate import LinearInterpolator, NNInterpolator
__all__ = ['Triangulation', 'DuplicatePointWarning']
class DuplicatePointWarning(RuntimeWa... | alephu5/Soundbyte | environment/lib/python3.3/site-packages/matplotlib/delaunay/triangulate.py | Python | gpl-3.0 | 9,923 |
from collections import namedtuple
MyTup1 = namedtuple(<warning descr="Unexpected argument">bar=''</warning><warning descr="Parameter 'field_names' unfilled"><warning descr="Parameter 'typename' unfilled">)</warning></warning>
MyTup2 = namedtuple("MyTup2", "bar baz")
class MyTup3(namedtuple(<warning descr="Unexpect... | paplorinc/intellij-community | python/testData/inspections/PyArgumentListInspection/initializingCollectionsNamedTuple.py | Python | apache-2.0 | 1,506 |
#!/usr/bin/python
import time
from SimpleCV import *
def check_eyes(eyes):
return (eyes and len(eyes) >= 2)
def process_eyes(image, eyes):
dx, dy = eyes[-1].coordinates() - eyes[-2].coordinates()
if dx > 0:
right_eye = eyes[-2]
else:
dx = -1*dx
right_eye = eyes[-1]
if dx... | sightmachine/SimpleCV | SimpleCV/examples/detection/dealwithit.py | Python | bsd-3-clause | 1,525 |
#!/usr/bin/env python
from create import create_account
from login import login
from request import toto_request
from uuid import uuid4
def checkresponse(response):
if 'error' in response:
print response['error']
exit()
return response
def verify_count(response, n):
response = checkresponse(response)
... | JeremyOT/Toto | templates/toto/simple/scripts/test_server.py | Python | mit | 1,998 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.