code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with ... | yangdw/PyRepo | src/annotation/haven/haven/autoreload.py | Python | mit | 5,900 |
"""Failover an inaccessible block volume to its available replicant volume."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
@click.command(epilog="""Failover an inaccessible... | allmightyspiff/softlayer-python | SoftLayer/CLI/block/replication/disaster_recovery_failover.py | Python | mit | 1,954 |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 9 15:39:28 2014
@author: ibackus
"""
import numpy as np
import pynbody
SimArray = pynbody.array.SimArray
import isaac
import subprocess
import os
import glob
import time
def v_xy(f, param, changbin=None, nr=50, min_per_bin=100):
"""
Attempts to calculate the... | dflemin3/ICgen | backup03/calc_velocity.py | Python | mit | 6,220 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0048_articlepage_interview'),
]
operations = [
migrations.AddField(
model_name='articlelistpage',
... | CIGIHub/greyjay | greyjay/articles/migrations/0049_articlelistpage_filter_for_interviews.py | Python | mit | 431 |
# -*- coding: utf-8 -*-
from django.shortcuts import render_to_response, render, redirect
from django.http import HttpResponseRedirect
from django.contrib import auth
from django.contrib.auth import authenticate, login, logout
def user_login(request):
return render(request,
'user/login.html',
... | chyla/pat-lms | web/slas-web/web/views.py | Python | mit | 912 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/furniture/all/shared_frn_all_lamp_candlestick_tbl_s03.iff"
result.a... | anhstudios/swganh | data/scripts/templates/object/tangible/furniture/all/shared_frn_all_lamp_candlestick_tbl_s03.py | Python | mit | 483 |
#!/usr/bin/env python
__author__ = "Mari Wahl"
__copyright__ = "Copyright 2014, The Cogent Project"
__credits__ = ["Mari Wahl"]
__license__ = "GPL"
__version__ = "4.1"
__maintainer__ = "Mari Wahl"
__email__ = "marina.w4hl@gmail.com"
from helpers import running, constants
# change here for type of net:
NETWORK_FIL... | bt3gl/NetAna-Complex-Network-Analysis | src/calculate_features_advanced/auto.py | Python | mit | 604 |
import sys
import argparse
import pkg_resources
from playback import __version__
def get_parser():
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description='OpenStack provisioning and orchestration library with command-line tools'
)
parser.add... | jiasir/playback | playback/cli/cli.py | Python | mit | 2,192 |
def sum_args(*args):
return sum(args)
| the-zebulan/CodeWars | katas/kyu_7/sum_of_all_arguments.py | Python | mit | 42 |
bs = u'Bernie Sanders'
hc = u'Hillary Clinton'
jb = u'Jeb Bush'
rp = u'Rand Paul'
candidates = [bs, hc, jb, rp]
| COOLMASON/arrows | arrows/candidates.py | Python | mit | 113 |
from django.conf.urls import patterns, url
urlpatterns = patterns(
'',
url(r'^$', 'refiner.views.index'),
url(r'^refine-data$', 'refiner.views.refine_data'),
url(r'^create-table$', 'refiner.views.create_table')
)
| datahuborg/datahub | src/apps/refiner/urls.py | Python | mit | 230 |
# The MIT License (MIT)
# Copyright (c) 2016 Massachusetts Institute of Technology
#
# Authors: Cody Rude, Guillaume Rongier
# This software has been created in projects supported by the US National
# Science Foundation and NASA (PI: Pankratius)
#
# Permission is hereby granted, free of charge, to any person obtaining ... | skdaccess/skdaccess | skdaccess/geo/srtm/cache/data_fetcher.py | Python | mit | 10,677 |
"""Various useful tools."""
import copy
import datetime
import logging
# FIXME: temporary backward compatibility
from eaf.core import Vec3 as Point
LOG_FORMAT = (
"[%(asctime)s] %(levelname)-8s %(name)s[%(funcName)s]:%(lineno)s: "
"%(message)s"
)
"""Log message format string."""
TIME_FORMAT = "%H:%M:%S,%03... | pankshok/xoinvader | xoinvader/utils.py | Python | mit | 3,433 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/wearables/ithorian/shared_ith_backpack_s01.iff"
result.attribute_te... | anhstudios/swganh | data/scripts/templates/object/tangible/wearables/ithorian/shared_ith_backpack_s01.py | Python | mit | 470 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from . import db
from datetime import datetime
class User(db.Model):
__table_args__ = {
'mysql_engine': 'InnoDB',
'mysql_charset': 'utf8mb4'
}
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
openid = db.Column(db.String(3... | 15klli/WeChat-Clone | main/models/user.py | Python | mit | 1,617 |
# -*- coding: utf-8 -*-
"""Module to determine the pywikibot version (tag, revision and date)."""
#
# (C) Merlijn 'valhallasw' van Deen, 2007-2014
# (C) xqt, 2010-2015
# (C) Pywikibot team, 2007-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__versi... | darthbhyrava/pywikibot-local | pywikibot/version.py | Python | mit | 18,495 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-19 15:17
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... | StepanBakshayev/funrun | src/funrun/match/migrations/0001_initial.py | Python | mit | 3,592 |
"""
SoftLayer.tests.CLI.modules.sshkey_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
import json
import os.path
import tempfile
import mock
from SoftLayer import testing
class SshKeyTests(testing.TestCase):
def test_add_by_option(self):
ser... | skraghu/softlayer-python | tests/CLI/modules/sshkey_tests.py | Python | mit | 4,214 |
"""
Views for PatreonProvider
https://www.patreon.com/platform/documentation/oauth
"""
import requests
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter,
OAuth2CallbackView,
OAuth2LoginView,
)
from .provider import API_URL, USE_API_V2, PatreonProvider
class PatreonOAuth2Adapter(O... | pennersr/django-allauth | allauth/socialaccount/providers/patreon/views.py | Python | mit | 2,047 |
#
# Example file for variables
# (For Python 3.x, be sure to use the ExampleSnippets3.txt file)
# Declare a variable and initialize it
f = 0;
print f
# re-declaring the variable works
f = "abc"
print f
# ERROR: variables of different types cannot be combined
#print "string type " + 123
print "string type " + str(12... | thatguyandy27/python-sandbox | learning-python/Ch2/variables_finished.py | Python | mit | 460 |
def main():
print("Hello, World!")
main()
| WebClub-NITK/Hacktoberfest-2k17 | Python/bharm1.py | Python | mit | 47 |
#!/usr/bin/env python3
# Copyright (c) 2016-2019 The Starwels developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test Hierarchical Deterministic wallet function."""
from test_framework.test_framework import StarwelsTest... | starwels/starwels | test/functional/wallet_hd.py | Python | mit | 5,199 |
import sys
import logging
from playback.api import NovaCompute
from cliff.command import Command
def make_target(args):
try:
target = NovaCompute(user=args.user, hosts=args.hosts.split(','), key_filename=args.key_filename,
password=args.password)
except AttributeError:
... | jiasir/playback | playback/cli/nova_compute.py | Python | mit | 4,590 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/loot/simple_kit/shared_tumble_blender.iff"
result.attribute_templat... | anhstudios/swganh | data/scripts/templates/object/tangible/loot/simple_kit/shared_tumble_blender.py | Python | mit | 455 |
import pygame, sys
from pygame.locals import *
# --- Functions ---
def distance(speed, time):
distance = time * speed
return distance
# --- Classes ---
class Character(object):
def __init__(self, position, direction, sprite):
self.position = position
self.direction = direction
self... | Pietdagamer/Lanseloet | Old/2.py | Python | mit | 4,586 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Post',
fields=[
('id', models.AutoField(verbose... | theworldbright/mainsite | aspc/blog/migrations/0001_initial.py | Python | mit | 736 |
__author__ = 'fahadadeel'
import jpype
import os.path
from WorkingWithText import ReplaceText
asposeapispath = os.path.join(os.path.abspath("../../../"), "lib")
print "You need to put your Aspose.Slides for Java APIs .jars in this folder:\n"+asposeapispath
jpype.startJVM(jpype.getDefaultJVMPath(), "-Djava.ext.dirs=%... | asposeslides/Aspose_Slides_Java | Plugins/Aspose-Slides-Java-for-Python/tests/WorkingWithText/ReplaceText/ReplaceText.py | Python | mit | 393 |
print("Now comes the language constructions tests.")
# function
def test_func():
def test_sub_func():
print("test_function")
test_sub_func()
# closure
def test_closure(msg):
def make_closure():
print(msg)
return make_closure
# exception
def test_exception():
try:
raise ... | trezor/micropython | tests/misc/sys_settrace_subdir/trace_generic.py | Python | mit | 1,552 |
# Encoding: utf-8
import sys
import time
from flask import Flask
app = Flask(__name__)
def kitchen_work():
time.sleep(5)
@app.route('/')
def fast_food_host():
print 'Order sent to the kitchen, waiting...'
sys.stdout.flush()
kitchen_work()
print 'Burger received from kitchen!'
sys.stdout.... | ygravrand/pyconfr2015 | breizhcamp2016/ex2_multi_process/fast_food.py | Python | mit | 429 |
from .logic import LogicAdapter
class NoKnowledgeAdapter(LogicAdapter):
"""
This is a system adapter that is automatically added
to the list of logic adapters durring initialization.
This adapter is placed at the beginning of the list
to be given the highest priority.
"""
def process(self... | imminent-tuba/thesis | server/chatterbot/chatterbot/adapters/logic/no_knowledge_adapter.py | Python | mit | 659 |
from django.shortcuts import redirect
class RedirectFirstSubpageMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
# One-time configuration and initialization.
def __call__(self, request):
# Code to be executed for each request before
# the... | bnzk/djangocms-misc | djangocms_misc/basic/middleware/redirect_subpage.py | Python | mit | 1,271 |
"""
WSGI config for example_project project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLIC... | yetty/django-embed-video | example_project/example_project/wsgi.py | Python | mit | 1,447 |
"""
Mango Python Library Resources
"""
import pymango
from .client import req
from .error import InvalidApiKey
class Resource():
"""Mango Resource base class"""
name = None
def __init__(self):
if not pymango.api_key:
raise InvalidApiKey
@classmethod
def get_endpoint(cls):
... | Mango/mango-python | pymango/resources.py | Python | mit | 4,129 |
from .pdffont import PDFUnicodeNotDefined
from . import utils
## PDFDevice
##
class PDFDevice(object):
def __init__(self, rsrcmgr):
self.rsrcmgr = rsrcmgr
self.ctm = None
return
def __repr__(self):
return '<PDFDevice>'
def close(self):
return
def set_ctm(s... | tiffanyjaya/kai | vendors/pdfminer.six/pdfminer/pdfdevice.py | Python | mit | 5,469 |
import facebook
from functools import update_wrapper, wraps
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseBadRequest
from django.utils.decorators import available_attrs
from django.utils.http import urlquote
from django.conf import settings
... | srijanmishra/django-facebook | django_facebook/decorators.py | Python | mit | 2,793 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/compute/v2015_06_15/operations/virtual_machines_operations.py | Python | mit | 48,648 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
use leaf alogrithm to remove redundancy
this algorithm is published in this following paper
1. Bull, S. C., Muldoon, M. R. & Doig, A. J. Maximising the Size of Non-Redundant Protein Datasets Using Graph Theory. PLoS One 8, (2013).
Simon Bull gives an implementation for ... | lituan/tools | leaf/leaf.py | Python | cc0-1.0 | 6,618 |
import json
import mock
from django.test import SimpleTestCase, override_settings
from regulations.views import comment
@override_settings(
ATTACHMENT_BUCKET='test-bucket',
ATTACHMENT_ACCESS_KEY_ID='test-access-key',
ATTACHMENT_SECRET_ACCESS_KEY='test-secret-key',
ATTACHMENT_MAX_SIZE=42,
)
class Tes... | tadhg-ohiggins/regulations-site | regulations/tests/views_comment_tests.py | Python | cc0-1.0 | 2,705 |
###########################################################
#
# 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/install/service/win32_service.py | Python | epl-1.0 | 2,526 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2017 Sambhav Kothari
# Copyright (C) 2018 Wieland Hoffmann
# Copyright (C) 2018, 2020-2021 Laurent Monin
# Copyright (C) 2019-2022 Philipp Wolfer
#
# This program is free software; you can redistribute it and/or
# modify it und... | metabrainz/picard | test/test_api_helpers.py | Python | gpl-2.0 | 11,729 |
# TypeSubjectFromRIFCS.py takes input xml in RIFCS format and outputs subjectType and subjectText to .csv file per line as:
# subjectType|subjectText
#
#
#Usage: TypeSubjectFromRIFCS.py [options] arg1
#
#Options:
# -h, --help show this help message and exit
# --input_xml=INPUT_XML
# ... | mlwbarlow/scripts-as-required | python/TypeSubjectFromRIFCS.py | Python | gpl-2.0 | 1,871 |
# -*- coding: utf-8 -*-
#
# AWL simulator - labels
#
# Copyright 2012-2014 Michael Buesch <m@bues.ch>
#
# 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 2 of the License, or
# (at ... | gion86/awlsim | awlsim/core/labels.py | Python | gpl-2.0 | 2,248 |
# !/usr/bin/python
# Copyright (c) 2007 Randal Barlow <im.tehk at gmail.com>
#
# 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
# version 2 of the License, or (at your option) any ... | p12tic/awn-extras | shared/python/awnmediaplayers.py | Python | gpl-2.0 | 28,094 |
# OeQ autogenerated correlation for 'Window/Wall Ratio East in Correlation to the Building Age'
import math
import numpy as np
from . import oeqCorrelation as oeq
def get(*xin):
# OeQ autogenerated correlation for 'Window to Wall Ratio in Eastern Direction'
A_WIN_E_BY_AW= oeq.correlation(
const= -6820.103... | UdK-VPT/Open_eQuarter | mole3/stat_corr/window_wall_ratio_east_SDH_by_building_age_correlation.py | Python | gpl-2.0 | 520 |
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
import os
import tests
from . import lib
#############################################
# UI tests for details storage media change #
#############################################
def testMediaChange(app):
v... | virt-manager/virt-manager | tests/uitests/test_mediachange.py | Python | gpl-2.0 | 3,727 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
all_variables = []
specification = {}
specification = {
#"_definition_": all_variables,
-2:{
"equation_ids":(1, 2), # 1:accepted; 2:una... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/psrc_parcel/estimation/dppcm_specification.py | Python | gpl-2.0 | 3,072 |
#coding:utf-8
#调用飞信
import urllib2
import urllib
class Fetion:
msisdn = ''
passwd = ''
baseurl = 'http://quanapi.sinaapp.com/fetion.php'
#设置登陆用户
def setuser(self,msisdn,passwd):
self.msisdn = msisdn
self.passwd = passwd
#发送短信
def sendsms(self,recmsisdn,content):
... | hankjin/monitor | fetion.py | Python | gpl-2.0 | 1,221 |
# Copyright (C) 2008 Canonical Ltd
#
# 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in ... | Distrotech/bzr | bzrlib/tests/per_repository/test_get_parent_map.py | Python | gpl-2.0 | 2,809 |
# $Id: version.py 148 2006-09-22 01:30:23Z quarl $
import subprocess
def pipefrom(cmd):
return subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
# TODO: get this from config file or vice versa, but don't hard-code both.
version = '1.1.0'
| prokoudine/gimp-deskew-plugin | admin/version.py | Python | gpl-2.0 | 258 |
# Copyright (C) 2007, 2009, 2010 Canonical Ltd
#
# 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 2 of the License, or
# (at your option) any later version.
#
# This program is dis... | stewartsmith/bzr | bzrlib/tests/commands/test_cat.py | Python | gpl-2.0 | 1,932 |
from math import pi, sin, cos, tan, sqrt
from recordclass import recordclass
import numpy as np
import scipy.signal as signal
import matplotlib.pyplot as plt
from functools import reduce
def db2a(db):
return np.power(10, (db / 20.0))
def a2db(a):
return 20 * np.log10(a)
def series_coeffs(c):
return redu... | reuk/waveguide | scripts/python/boundary_modelling.py | Python | gpl-2.0 | 3,922 |
# Twisted, the Framework of Your Internet
# Copyright (C) 2001 Matthew W. Lefkowitz
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in th... | fxia22/ASM_xf | PythonD/site_python/twisted/test/test_http.py | Python | gpl-2.0 | 11,674 |
import logging
from functools import wraps
from collections import Sequence, namedtuple, Iterator
from miasm2.jitter.csts import *
from miasm2.core.utils import *
from miasm2.core.bin_stream import bin_stream_vm
from miasm2.core.interval import interval
from miasm2.jitter.emulatedsymbexec import EmulatedSymbExec
from... | chubbymaggie/miasm | miasm2/jitter/jitload.py | Python | gpl-2.0 | 15,894 |
"""
This module defines the BasePackageManager Class which provides an
implementation of the packaging system API providing methods to fetch,
upload and remove packages. Site specific extensions to any of these methods
should inherit this class.
"""
import fcntl
import logging
import os
import re
import shutil
from au... | lmr/autotest | client/shared/base_packages.py | Python | gpl-2.0 | 45,844 |
#!/usr/bin/env python
'''
Concepts keep track of their number of words. Or, they should.
'''
from csc.util.batch import queryset_foreach
from csc.conceptnet4.models import Concept
from django.db.models.query import Q
def fix_concept_counts():
def fix_concept(concept):
if concept.words: return
con... | commonsense/conceptnet | maint/fix_concept_counts.py | Python | gpl-2.0 | 546 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated Sun Jul 5 15:10:21 2015 by generateDS.py version 2.16a.
#
import sys
import re as re_
import base64
import datetime as datetime_
import warnings as warnings_
from lxml import etree as etree_
Validate_simpletypes_ = True
def parsexml_(infile, parser=None... | sam-m888/addons-source | lxml/superclasses.py | Python | gpl-2.0 | 655,543 |
_mini_logo = [
"24 24 431 2",
" c None",
". c #EDEDED",
"+ c #ECEBEB",
"@ c #EBE7E7",
"# c #F2FBFB",
"$ c #F4FFFF",
"% c #F3FFFF",
"& c #EEF2F2",
"* c #EAE5E5",
"= c #ECE9E9",
"- c #F0F6F6",
"; c #E7DDDD",
"> c #C18383",
", c #9F4A4A",
"' c #8E2E2E",
") c #953636",
"! c #B06262",
"~ c #D8ACAC",
"{ c... | melviso/phycpp | beatle/app/resources/_mini_logo.py | Python | gpl-2.0 | 8,170 |
import pymoresane.iuwt_convolution
import unittest
class TestIuwtConvolution(unittest.TestCase):
pass | ratt-ru/PyMORESANE | tests/test_iuwt_convolution.py | Python | gpl-2.0 | 107 |
from enigma import eActionMap
class ActionMap:
def __init__(self, contexts = [ ], actions = { }, prio=0):
self.actions = actions
self.contexts = contexts
self.prio = prio
self.p = eActionMap.getInstance()
self.bound = False
self.exec_active = False
self.enabled = True
def setEnabled(self, enabled):
... | fairbird/OpenPLI-BlackHole | lib/python/Components/ActionMap.py | Python | gpl-2.0 | 2,554 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) Grigoriy A. Armeev, 2015
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as·
# published by the Free Software Foundation.
#
# This program is distributed in the hope th... | satary/fretty | image_widget.py | Python | gpl-2.0 | 4,816 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2006-2008 Adolfo González Blázquez <code@infinicode.org>
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 2
of the License, or (at your option... | SteveRyherd/pyRenamer | src/pyrenamer_menu_cb.py | Python | gpl-2.0 | 2,231 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ModelerParameterDefinitionDialog.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
******... | myarjunar/QGIS | python/plugins/processing/modeler/ModelerParameterDefinitionDialog.py | Python | gpl-2.0 | 18,376 |
import sys
sys.path.insert(0, '..')
import settings
from util import queryset_foreach
from events.models import Event
from voting.models import Vote
from datetime import datetime
from conceptnet4.models import Rating
def rating_to_vote(r):
obj = r.sentence or r.raw_assertion or r.assertion
score = 0
if r.s... | riseofthetigers/conceptnet | maint/ratings_to_votes_to_events.py | Python | gpl-2.0 | 627 |
from __future__ import print_function, division, absolute_import
from .core import (DataFrame, Series, Index, _Frame, map_partitions,
repartition, to_delayed, to_datetime, to_timedelta)
from .groupby import Aggregation
from .io import (from_array, from_pandas, from_bcolz,
from_dask_... | TNT-Samuel/Coding-Projects | DNS Server/Source/Lib/site-packages/dask/dataframe/__init__.py | Python | gpl-3.0 | 848 |
# -*- encoding: utf-8 -*-
from abjad import *
def test_pitchtools_NamedIntervalClass_from_pitch_carriers_01():
r'''Ascending intervals greater than an octave.
'''
mcpi = pitchtools.NamedIntervalClass.from_pitch_carriers(
NamedPitch(-3), NamedPitch(12))
assert mcpi == pitchtools.NamedIntervalC... | mscuthbert/abjad | abjad/tools/pitchtools/test/test_pitchtools_NamedIntervalClass_from_pitch_carriers.py | Python | gpl-3.0 | 3,312 |
"""
=====================================================================
Core functionalities and shared exception objects (:mod:`medpy.core`)
=====================================================================
.. currentmodule:: medpy.core
This package collect the packages core functionalities, such as an
event Lo... | loli/medpy | medpy/core/__init__.py | Python | gpl-3.0 | 1,978 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016 Canonical Ltd
#
# 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 is distributed in the h... | tsdgeos/snapcraft | snapcraft/plugins/python.py | Python | gpl-3.0 | 13,115 |
# Copyright (C) 2009, 2010, 2011 Rickard Lindberg, Roger Lindberg
#
# This file is part of Timeline.
#
# Timeline 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... | ezequielpereira/Time-Line | autopilot/autopilotlib/wrappers/messagedialog.py | Python | gpl-3.0 | 1,500 |
""" This is a test of the chain
FileCatalogClient -> FileCatalogHandler -> FileCatalogDB
It supposes that the DB is present, and that the service is running
"""
import unittest
import time
from DIRAC.Core.Base.Script import parseCommandLine
parseCommandLine()
from DIRAC.Resources.Catalog.FileCatalogClient ... | Andrew-McNab-UK/DIRAC | tests/Integration/DataManagementSystem/Test_Client_DFC.py | Python | gpl-3.0 | 34,217 |
# 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 | indico/MaKaC/webinterface/pages/abstracts.py | Python | gpl-3.0 | 69,950 |
from __future__ import absolute_import
from abc import ABCMeta, abstractmethod
import weakref
import functools
# Decorator to target specific messages.
def targets(target_messages, no_first=False):
if isinstance(target_messages, str):
target_messages = [target_messages]
def wrapper(f):
@funct... | terhorst/psmcpp | smcpp/observe.py | Python | gpl-3.0 | 1,330 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
... | jsternberg/ansible-modules-core | cloud/amazon/ec2_group.py | Python | gpl-3.0 | 17,973 |
from PyQt5.QtCore import QObject, pyqtSignal
class Player(QObject):
updated = pyqtSignal(object, object)
newCurrentGame = pyqtSignal(object, object, object)
"""
Represents a player the client knows about.
"""
def __init__(self,
id_,
login,
gl... | GrotheFAF/client | src/model/player.py | Python | gpl-3.0 | 4,660 |
import socket
from time import gmtime, strftime
from simess.assets import server_strings
class SiMessServer():
def __init__(self, host="127.0.0.1", port=5000, buffer_size=4096, waiting_list=10):
self.host, self.port = host, port
self.buffer_size = buffer_size
self.waiting_list = waiting_... | anaumidis/SiMess | simess/server.py | Python | gpl-3.0 | 5,206 |
# Copyright (C) 2013 Adobe Systems Incorporated. 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 notice, this list of con... | geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_parser_unittest.py | Python | gpl-3.0 | 10,336 |
# 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 | indico/core/index/event.py | Python | gpl-3.0 | 3,751 |
import numpy as np
import random
import json
import os
import cv2
import itertools
from scipy.misc import imread, imresize
import tensorflow as tf
from data_utils import (annotation_jitter, annotation_to_h5)
from utils.annolist import AnnotationLib as al
from rect import Rect
from utils import tf_concat
def rescale_b... | bethesirius/ChosunTruck | linux/tensorbox/utils/train_utils.py | Python | gpl-3.0 | 10,836 |
#
# Copyright © 2012–2022 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... | nijel/weblate | weblate/utils/requests.py | Python | gpl-3.0 | 2,265 |
#!/usr/bin/env python
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Merge the PGC files generated during the profiling step to the PGD database.
This is required to workaround a flakyness in pgomgr.e... | Passw/gn_GFW | build/win/merge_pgc_files.py | Python | gpl-3.0 | 5,397 |
# browsershots.org - Test your web design in different browsers
# Copyright (C) 2007 Johann C. Rocholl <johann@browsershots.org>
#
# Browsershots 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 ... | mintuhouse/shotfactory | shotfactory04/gui/linux/navigator.py | Python | gpl-3.0 | 2,507 |
#-------------------------------------------------------------------------------
# . File : ParseScans.py
# . Program : MolarisTools
# . Copyright : USC, Mikolaj Feliks (2015-2018)
# . License : GNU GPL v3.0 (http://www.gnu.org/licenses/gpl-3.0.en.html)
#--------------------------------------------------... | mfx9/molaris-tools | MolarisTools/Scripts/ParseScans.py | Python | gpl-3.0 | 8,470 |
# encoding: utf-8
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'MEP.stg_office'
db.delete_column('meps_mep', 'stg_office')
def backwards(self, orm):
# User chose to not deal... | alirizakeles/memopol-core | memopol/meps/migrations/0017_auto__del_field_mep_stg_office.py | Python | gpl-3.0 | 12,677 |
# -*- coding: utf-8 -*-
import system_tests
@system_tests.CopyFiles("$data_path/exiv2-bug1202.jpg")
class CheckFocusContinuous(metaclass=system_tests.CaseMeta):
url = "http://dev.exiv2.org/issues/1202"
filename = "$data_path/exiv2-bug1202_copy.jpg"
commands = [
"""$exiv2 -M"set Exif.CanonCs.Focu... | AlienCowEatCake/ImageViewer | src/ThirdParty/Exiv2/exiv2-0.27.5-Source/tests/bugfixes/redmine/test_issue_1202.py | Python | gpl-3.0 | 1,550 |
# computational geometry | 2D line intersecton | Python
def parallel_int(verticeX,verticeY):
k = (verticeY[2]-verticeY[0])*(verticeX[1]-verticeX[0]) - (verticeX[2]-verticeX[0])*(verticeY[1]-verticeY[0])
if k==0:
return "infinite"
else:
return "no"
def line_int(verticeX,verticeY):
x12 = verticeX[0]-verticeX[1]
... | Walt280/cosmos | code/computational_geometry/2d_line_intersection/line.py | Python | gpl-3.0 | 1,392 |
def mean(vals):
if vals:
return sum(vals, 0.0) / len(vals)
else:
return 0.0
def trim(vals, trim=0.25):
if trim > 0.0:
trim = float(trim)
size = len(vals)
size_diff = int(size * trim)
vals = vals[size_diff:-size_diff]
return vals
def median(vals):
if ... | mahmoud/womp | womp/stats.py | Python | gpl-3.0 | 2,081 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
########################################################################
# Solves problem 76 from projectEuler.net.
# Finds the number of different ways that 100 can be written as sum of
# 2 positive integers.
# Copyright (C) 2010 Santiago Alessandri
#
# This p... | salessandri/programming-contests | project-euler/problem076.py | Python | gpl-3.0 | 1,376 |
metadata = {
'name': 'Delaware',
'abbreviation': 'de',
'legislature_name': 'Delaware General Assembly',
'legislature_url': 'http://legis.delaware.gov/',
'capitol_timezone': 'America/New_York',
'chambers': {
'upper': {'name': 'Senate', 'title': 'Senator'},
'lower': {'name': 'Hous... | cliftonmcintosh/openstates | billy_metadata/de.py | Python | gpl-3.0 | 3,486 |
import copy
import numbers
from collections import Hashable
from functools import partial
from bson import ObjectId, json_util
from bson.dbref import DBRef
from bson.son import SON
import pymongo
import six
from mongoengine import signals
from mongoengine.base.common import get_document
from mongoengine.base.datastru... | Pablo126/SSBW | Tarea4/tarea4/lib/python3.5/site-packages/mongoengine/base/document.py | Python | gpl-3.0 | 41,762 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.test.runner import DiscoverRunner
from pipeline.conf import settings as pipeline_settings
class TestSuiteRunner(DiscoverRunner):
def __init__(self, *args, **kwargs):
settings.TESTING_ENVIRONMENT = True
super(TestSuiteRunner, sel... | tomka/CATMAID | django/lib/custom_testrunner.py | Python | gpl-3.0 | 635 |
# -*- 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 field 'WriteItInstance.notify_owner_when_new_answer'
db.add_column(u'nuntium_writeitinstance', 'not... | TEDICpy/write-it | nuntium/migrations/0035_auto__add_field_writeitinstance_notify_owner_when_new_answer.py | Python | gpl-3.0 | 16,208 |
# encoding: 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/.
#
# Contact: Kyle Lahnakoski (klahnakoski@mozilla.com)
from __future__ import division
from __future... | klahnakoski/TestLog-ETL | activedata_etl/imports/file_mapper.py | Python | mpl-2.0 | 11,865 |
from celery.exceptions import SoftTimeLimitExceeded, TimeLimitExceeded
from urllib.parse import urlparse
from httpobs.conf import (RETRIEVER_CONNECT_TIMEOUT,
RETRIEVER_CORS_ORIGIN,
RETRIEVER_READ_TIMEOUT,
RETRIEVER_USER_AGENT)
from httpobs.s... | april/http-observatory | httpobs/scanner/retriever/retriever.py | Python | mpl-2.0 | 7,939 |
import os
import shutil
import tempfile
from nose.tools import eq_, ok_
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User, Permission
from django.core.files import File
from crashstats.tokens.models import Token
from crashstats.crashstats.tests.test_views import BaseTestViews
f... | bsmedberg/socorro | webapp-django/crashstats/symbols/tests/test_views.py | Python | mpl-2.0 | 15,401 |
# coding: utf-8
import math
try:
long_int = long
except NameError:
long_int = int
def rshift(val, n):
if val >= 0:
val2 = val >> n
else:
val2 = val + 0x100000000 >> n
return val2
def str_to_longs(e):
t = []
pad = len(e) % 4
if pad != 0:
e = e + (4 - pad) * '... | zejn/prometapi | prometapi/encoders.py | Python | agpl-3.0 | 2,113 |
############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core bu... | uclouvain/OSIS-Louvain | base/tests/views/learning_units/external/test_update.py | Python | agpl-3.0 | 4,921 |
from bears.java.InferBear import InferBear
from tests.LocalBearTestHelper import verify_local_bear
good_file = """
class InferGood {
int test() {
String s = null;
return s == null ? 0 : s.length();
}
}
"""
bad_file = """
class InferBad {
int test() {
String s = null;
retur... | sounak98/coala-bears | tests/java/InferBearTest.py | Python | agpl-3.0 | 585 |
import json
import requests
import base64
from . import check_input_attribute, checking_error, standard_error_message
from pymisp import MISPEvent, MISPObject
from urllib.parse import quote
moduleinfo = {'version': '1.0',
'author': 'Ben Verschaeren',
'description': 'SOPHOSLabs Intelix Integ... | VirusTotal/misp-modules | misp_modules/modules/expansion/sophoslabs_intelix.py | Python | agpl-3.0 | 6,396 |
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from datetime import datetime
import errno
import socket
import ssl
import gunicorn.http as http
import gunicorn.http.wsgi as wsgi
import gunicorn.util as util
import gunicorn.workers.base as... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/gunicorn/workers/async.py | Python | agpl-3.0 | 4,307 |
# Copyright (C) 2014 SEE AUTHORS FILE
#
# 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 program is distr... | pombredanne/re-core | test/test_utils.py | Python | agpl-3.0 | 3,251 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import os
from django.core.exceptions import ImproperlyConfigured
... | shoopio/shoop | shuup_workbench/settings/__init__.py | Python | agpl-3.0 | 1,411 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.