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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 31 21:48:40 2017
@author: Alexander
"""
import pandas as pd
import numpy as np
import random
#Super Bowl Simulator
#Using Negative Binomial Disribution
#Alexander Booth
#January 31, 2017
#define data
pats_off = np.array([23, 31, 27, 0, 33, 35, 27, 41... | ABoothInTheWild/baseball-research | pats_falcons_simulator_python.py | Python | gpl-3.0 | 3,034 |
"""
This page is in the table of contents.
The xml.py script is an import translator plugin to get a carving from an xml file.
An import plugin is a script in the interpret_plugins folder which has the function getCarving. It is meant to be run from the interpret tool. To ensure that the plugin works on platforms wh... | Pointedstick/ReplicatorG | skein_engines/skeinforge-44/fabmetheus_utilities/fabmetheus_tools/interpret_plugins/xml.py | Python | gpl-2.0 | 5,903 |
import sys
import limix
from limix.core.covar import LowRankCov
from limix.core.covar import FixedCov
from limix.core.covar import FreeFormCov
from limix.core.covar import CategoricalLR
from limix.core.mean import MeanBase
from limix.core.gp import GP
import scipy as sp
import scipy.stats as st
from limix.mtSet.core.i... | PMBio/limix | limix/iSet/mvSetInc.py | Python | apache-2.0 | 9,524 |
"""
:mod:`website`
==============
"""
from copy import copy
from datetime import datetime, timezone
import os
import string
from urllib.parse import quote
from aspen.request_processor import RequestProcessor
from aspen.simplates.simplate import Simplate
from state_chain import StateChain
from . import body_parsers
f... | gratipay/aspen.py | pando/website.py | Python | mit | 9,310 |
# -*- coding: utf-8 -*-
# © 2014 Elico Corp (https://www.elico-corp.com)
# Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html)
import stock_to_date
| Elico-Corp/openerp-7.0 | wms/wizard/__init__.py | Python | agpl-3.0 | 165 |
#!/usr/bin/python
#The MIT License (MIT)
#
#Copyright (c) 2015 Stephen P. Smith
#
#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... | jwalthour/sensors | Pi/Python/max31865.py | Python | mit | 7,725 |
import numpy as np
from scipy.spatial.transform import Rotation
from pysisyphus.helpers import align_coords, geom_loader
from pysisyphus.interpolate import interpolate
def get_geoms(translate=0., euler=None):
geom = geom_loader("lib:benzene.xyz")
geom_mod = geom.copy()
geom_mod.coords += translate
m... | eljost/pysisyphus | tests/test_helpers/test_helpers.py | Python | gpl-3.0 | 1,842 |
""" Read ID3 tags from a file.
Ned Batchelder, http://nedbatchelder.com/code/modules/id3reader.html
http://nedbatchelder.com/code/modules/id3reader.py
* original code modified by ccpizza: added code to main method to rename
files in current folder from ID3 tags,
e.g. 'Track_01.mp3' >> '01 - Cha... | ActiveState/code | recipes/Python/576811_Rename_MP3_files_ID3_tags_does_not_require/recipe-576811.py | Python | mit | 26,410 |
# -*- coding: utf-8 -*-
"""
Run cross-validation analysis
@author: Yuriy Sverchkov (yuriy.sverchkov@wisc.edu)
"""
from sys import argv
from pandas import read_csv
from analysis_pipeline import run_analysis_pipeline
if __name__ == '__main__':
training_filename = argv[1]
panel_size = int(argv[2])
pickled_... | sverchkov/ivancic-panel-selection | python/run_cv_analysis.py | Python | mit | 531 |
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^media/(?P<path>.*)$', 'django.vie... | trcm/sacerdos | sacerdos/urls.py | Python | mit | 557 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: type_Params.py
from types import *
class Params:
def __init__(self):
self.__dict__['maxPorts'] = 500
self.__dict__['memory'] = ... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/mca/network/cmd/portmap/type_Params.py | Python | unlicense | 1,640 |
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | punalpatel/st2 | st2reactor/tests/unit/test_timer.py | Python | apache-2.0 | 3,837 |
# Copyright (C) 2015 by
# Alessandro Luongo
# BSD license.
"""Functions for computing the harmonic centrality of a graph."""
from __future__ import division
import networkx as nx
__author__ = "\n".join(['Alessandro Luongo (alessandro.luongo@studenti.unimi.it'])
__all__ = ['harmonic_centrality']
def harmoni... | cmtm/networkx | networkx/algorithms/centrality/harmonic.py | Python | bsd-3-clause | 1,825 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from copy import deepcopy
from django.utils.translation import ugettext as _
from opentreemap.util import json_from_request
from treemap.models import Species
from treema... | maurizi/otm-core | opentreemap/manage_treemap/views/fields.py | Python | agpl-3.0 | 8,599 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
#... | fengkaicnic/traffic | traffic/utils.py | Python | apache-2.0 | 44,222 |
"""
Custom-written pure c# meterpreter/reverse_http stager.
Uses basic variable renaming obfuscation.
Module built by @harmj0y
"""
from modules.common import helpers
from modules.common import encryption
import random
class Payload:
def __init__(self):
# required options
self.description =... | codercold/Veil-Evasion | modules/payloads/cs/meterpreter/rev_http.py | Python | gpl-3.0 | 6,639 |
import string, copy
def joinHeaders(first, second, joined, on):
joined.headers = first.headers[:]
mappedHeaders = {}
for header in second.headers:
if header == on:
continue
i = 0
newHeader = header
while newHeader in first.headers:
newHeader = '{0}_{1}'.format(newHeader, i)
i += 1
if i > 0:
ma... | dwilmer/rcpsp-testing-framework | dataset.py | Python | mit | 3,291 |
# Copyright (C) 2010 Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | leighpauls/k2cro4 | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_results.py | Python | bsd-3-clause | 2,739 |
import numpy as np
from arthur import constants
def grid(U, V, C, duv, size):
G = np.zeros((size, size), np.complex64)
G.fill(0)
for a1 in range(constants.NUM_ANTS):
for a2 in range(constants.NUM_ANTS):
p = 1.0
if a1 == a2:
p = 0.5
u = U[a1, a2]... | transientskp/aartfaac-arthur | arthur/gridding.py | Python | gpl-3.0 | 1,118 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012, 2014, 2015 Martin Raspaud
# Author(s):
# Martin Raspaud <martin.raspaud@smhi.se>
# 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 Fou... | pytroll/pytroll-db | trolldb/version.py | Python | gpl-3.0 | 832 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2020-04-15 08:10
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depend... | Etxea/gestioneide | gestioneide/migrations/0066_anotaciongrupo.py | Python | gpl-3.0 | 1,119 |
#!/usr/bin/env python
"""Test that syntax highlighting for USD files works correctly."""
import textwrap
import unittest
from pygments.lexers import UsdLexer
from pygments.token import Name, String, Whitespace
class _Common(unittest.TestCase):
"""A basic class that makes it easier to write unittests."""
d... | dscorbett/pygments | tests/test_usd.py | Python | bsd-2-clause | 1,953 |
# -*- coding: utf-8 -*-
"""
Webhook signals
"""
#
# Required for reading files
#
import sys;
reload(sys);
sys.setdefaultencoding("utf8")
from django.core.files import File
from django.core.cache import cache
from django.dispatch import receiver
from django.test import TestCase, Client
from django.core.urlresolvers impo... | rosscdh/django-crocodoc | dj_crocodoc/tests/signals.py | Python | gpl-2.0 | 8,364 |
"""Interpolation algorithms using piecewise cubic polynomials."""
import numpy as np
from . import PPoly
from .polyint import _isscalar
from scipy.linalg import solve_banded, solve
__all__ = ["CubicHermiteSpline", "PchipInterpolator", "pchip_interpolate",
"Akima1DInterpolator", "CubicSpline"]
def prepa... | WarrenWeckesser/scipy | scipy/interpolate/_cubic.py | Python | bsd-3-clause | 33,069 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | MeteorKepler/RICGA | ricga/evaluate.py | Python | apache-2.0 | 7,364 |
# Copyright (c) 2012 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.
import json
import os
import sys
import webgl_conformance_expectations
from telemetry import test as test_module
from telemetry.core import util
from te... | aospx-kitkat/platform_external_chromium_org | content/test/gpu/gpu_tests/webgl_conformance.py | Python | bsd-3-clause | 4,067 |
"""
Cache middleware. If enabled, each Django-powered page will be cached based on
URL. The canonical way to enable cache middleware is to set
``UpdateCacheMiddleware`` as your first piece of middleware, and
``FetchFromCacheMiddleware`` as the last::
MIDDLEWARE_CLASSES = [
'django.middleware.cache.UpdateCa... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.3/django/middleware/cache.py | Python | bsd-3-clause | 9,078 |
import operator
from flask import url_for
import pytest
from talkoohakemisto import serializers
from talkoohakemisto.extensions import db
from tests import factories
@pytest.mark.usefixtures('request_ctx', 'database')
class TestMunicipalityIndex(object):
@pytest.fixture
def municipalities(self):
mun... | talkoopaiva/talkoohakemisto-api | tests/views/test_municipalities.py | Python | mit | 3,372 |
#!/usr/bin/env python
###########################################################
# WARNING: Generated code! #
# ************************** #
# Manual changes may get lost if file is generated again. #
# Only code inside the [MANUAL] tags will be kept. ... | team-vigir/vigir_behaviors | behaviors/vigir_behavior_trigger_cutting_tool/src/vigir_behavior_trigger_cutting_tool/trigger_cutting_tool_sm.py | Python | bsd-3-clause | 17,004 |
#!/usr/bin/python
# coding=utf-8
# pylint: disable=I0011,C0103,E1101,R0201,R0903
"""
S.H.I.V.A. - Social network History & Information Vault & Analyser
Application entry point
"""
import jinja2
import cherrypy
import platform
from pymongo import MongoClient
from pymongo import ReadPreference
from engine.tools impo... | LifeDJIK/S.H.I.V.A. | containers/shiva/S.H.I.V.A..py | Python | mit | 2,694 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-10 07:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0001_initial'),
]
operations = [
migrations.AddField(
m... | itucsProject2/Proje1 | home/migrations/0002_users_usermail.py | Python | unlicense | 465 |
#!/usr/bin/env python
# Copyright (c) 2014 The Diamond Core developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Exercise the listreceivedbyaddress API
from test_framework import DiamondTestFramework
from diamondrpc.a... | TGDiamond/Diamond | qa/rpc-tests/receivedby.py | Python | mit | 7,275 |
import abc
import socket
import struct
import logging
import msgpack
import scipy.misc
import gym
from gym import error, spaces, utils
from gym.utils import seeding
from gym.envs.classic_control import rendering
import numpy as np
def _receive_data(sock):
# `sock` is the TCP socket connected to the client
d... | akashin/HSE_AI_Labs | Lab_5/Content/Scripts/remote_env.py | Python | mit | 8,942 |
"""
========
numpydoc
========
Sphinx extension that handles docstrings in the Numpy standard format. [1]
It will:
- Convert Parameters etc. sections to field lists.
- Convert See Also section to a See also entry.
- Renumber references.
- Extract the signature from the docstring, if it can't be determined otherwise.... | mpld3/mpld3 | doc/sphinxext/numpy_ext/numpydoc.py | Python | bsd-3-clause | 5,575 |
# Copyright (c) 2020 Dell Inc. or its subsidiaries.
#
# 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... | ciarams87/PyU4V | PyU4V/utils/console.py | Python | mit | 1,468 |
import collections
import json
import datetime
def dict_from(json_string):
return JSONUtil(json_string).to_odict()
class JSONUtil(object):
def __init__(self, json_input):
self.json_input = json_input
def to_odict(self, raise_exception=False):
if raise_exception:
if not ... | eyalev/jsonapp | jsonapp/utils/json_util.py | Python | mit | 1,282 |
from __future__ import division, absolute_import, print_function
import platform
import numpy as np
from numpy import uint16, float16, float32, float64
from numpy.testing import run_module_suite, assert_, assert_equal, dec
def assert_raises_fpe(strmatch, callable, *args, **kwargs):
try:
callable(*args, ... | Ziqi-Li/bknqgis | numpy/numpy/core/tests/test_half.py | Python | gpl-2.0 | 18,627 |
# 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 pytest
from decimal import Decimal
from django.test import override_settings
from ... | shoopio/shoop | shuup_tests/campaigns/test_multiple_campaigns.py | Python | agpl-3.0 | 4,185 |
import sys
import os
sys.path.append(os.path.abspath(".."))
from termux2d import Canvas, line
import curses
import math
from time import sleep
import locale
locale.setlocale(locale.LC_ALL,"")
stdscr = curses.initscr()
stdscr.refresh()
class Point3D:
def __init__(self, x = 0, y = 0, z = 0):
self.x, self.... | ericmux/termux2d | examples/rotating_cube.py | Python | mit | 3,438 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
AddGridRef
A QGIS plugin
Adds British or Irish grid references to layers
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
... | burkmarr/QGIS-Biological-Recording-Tools | add_grid_ref_algorithm.py | Python | gpl-3.0 | 12,593 |
import sys
from optparse import make_option
from django.conf import settings
from django.db import connections, router, transaction, models, DEFAULT_DB_ALIAS
from django.core.management import call_command
from django.core.management.base import NoArgsCommand, CommandError
from django.core.management.color import no_s... | postrational/django | django/core/management/commands/flush.py | Python | bsd-3-clause | 4,312 |
#!/usr/bin/env python
# coding: utf-8
#
# Copyright (c) 2019-2021, chys <admin@CHYS.INFO>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright notice, t... | chys87/scripts | daemon-run.py | Python | bsd-3-clause | 6,814 |
# -*- coding: utf-8 -*-
"""The tg2 package"""
| fedora-infra/fedmsg_middleware | examples/tg2/tg2/__init__.py | Python | lgpl-2.1 | 46 |
# Copyright 2010-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import tempfile
from portage import os
from portage import shutil
from portage.const import EBUILD_PHASES
from portage.elog import elog_process
from portage.package.ebuild.config import config
from portage.packa... | clickbeetle/portage-cb | pym/portage/package/ebuild/_spawn_nofetch.py | Python | gpl-2.0 | 3,357 |
#!/usr/bin/env python
r"""Script for computing the error due to a non-well-balanced method"""
import os
import numpy
import clawpack.pyclaw.solution as solution
# Parameters
sea_level = 0.0
def compute_error(q, aux, eta, rho, norm=1):
r"""Compute the steady state error where eta are the surfaces"""
num_c... | mandli/multilayer-examples | 1d/well_balancing_comparison.py | Python | mit | 2,579 |
"""
Pipeline steps for Third Party Auth to support tahoe-auth0 package.
"""
import logging
import beeline
import tahoe_sites.api
from . import course_roles
TAHOE_AUTH0_BACKEND_NAME = 'tahoe-auth0'
log = logging.getLogger(__name__)
@beeline.traced(name='tpa_pipeline.set_roles_from_auth0_roles')
def set_roles_from_a... | appsembler/edx-platform | openedx/core/djangoapps/appsembler/auth/tahoe_auth0_pipeline.py | Python | agpl-3.0 | 1,624 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# beta.1 Dailymotion
# Version 0.1 (10.12.2014)
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
# Gracias a la librería plugintools de Jesús (www.mimediacenter.in... | iptvgratis/TUPLAY | resources/tools/dailymotion.py | Python | gpl-3.0 | 4,151 |
"""
Menu utilities.
"""
import types
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
from django.core.urlresolvers import reverse
def _get_menu_cls(menu_cls, context):
if type(menu_cls) is types.DictType:
curr_url ... | liberation/django-admin-tools | admin_tools/menu/utils.py | Python | mit | 1,331 |
from bravado_core.spec import Spec
import mock
from pyramid.config import Configurator
from pyramid.registry import Registry
import pytest
from swagger_spec_validator.common import SwaggerValidationError
import pyramid_swagger
from pyramid_swagger.model import SwaggerSchema
@mock.patch('pyramid_swagger.register_api_... | analogue/pyramid_swagger | tests/includeme_test.py | Python | bsd-3-clause | 3,308 |
"""
WSGI config for dj_bookmarks project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | kennethlove/django_bookmarks | dj_bookmarks/dj_bookmarks/wsgi.py | Python | bsd-3-clause | 402 |
__author__ = 'tan'
import os
import boto
from boto.s3.key import Key
from juliabox.cloud import JBPluginCloud
class JBoxS3(JBPluginCloud):
provides = [JBPluginCloud.JBP_BUCKETSTORE, JBPluginCloud.JBP_BUCKETSTORE_S3]
CONN = None
BUCKETS = dict()
@staticmethod
def connect():
if JBoxS3.CON... | tanmaykm/JuliaBox | engine/src/juliabox/plugins/bucket_s3/impl_s3.py | Python | mit | 2,198 |
import asyncio
import uvloop
from aioactor.transports import NatsTransport
from aioactor.service import Service
from aioactor.broker import ServiceBroker
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
# TODO ADD possible actions list!
# TODO ADD abstractions to Message Handler!
# MessageHandler must be able t... | iZonex/aioactor | examples/accounts/app.py | Python | apache-2.0 | 1,531 |
#!/usr/bin/env python
#
# GrovePi Example for using the Grove Chainable RGB LED (http://www.seeedstudio.com/wiki/Grove_-_Chainable_RGB_LED)
#
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
#
# Have a question about this example... | gerald-yang/ubuntu-iotivity-demo | snappy/grovepi/pygrovepi/grove_chainable_rgb_led.py | Python | apache-2.0 | 10,250 |
def find_child(tag, value_to_pos, parent_value = None, child_separator = ':'):
"""
Find or create a nested PartOfSpeech and returns it.
"""
from beard import pos
chain = tag.split(child_separator, 1)
parent = chain[0]
if len(chain) > 1:
parent_val = value_to_pos.setdefault(pare... | YuukanOO/beard | beard/swissknife.py | Python | mit | 812 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2017-09-14 23:53
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('organization', '0004_teacher_image'),
('courses', '0... | LennonChin/Django-Practices | MxOnline/apps/courses/migrations/0007_course_teacher.py | Python | apache-2.0 | 640 |
groups = {}
| drscream/teamvault | bundlewrap/groups.py | Python | gpl-3.0 | 12 |
from datetime import datetime
from whylog.config.filename_matchers import WildCardFilenameMatcher
from whylog.config.investigation_plan import Clue, InvestigationPlan, InvestigationStep, LineSource
from whylog.config.log_type import LogType
from whylog.config.parser_subset import ConcatenatedRegexParser
from whylog.co... | andrzejgorski/whylog | whylog/config/mocked_investigation_plan.py | Python | bsd-3-clause | 2,019 |
"""jass URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... | SRGSSR/jass | project/urls.py | Python | mit | 817 |
import numpy as np
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QGraphicsPixmapItem, QApplication
from urh.signalprocessing.Spectrogram import Spectrogram
from urh.ui.painting.SceneManager import SceneManager
from urh.ui.painting.SpectrogramScene import SpectrogramScene
class SpectrogramSceneManager(S... | jopohl/urh | src/urh/ui/painting/SpectrogramSceneManager.py | Python | gpl-3.0 | 2,529 |
from django.db import models
from confess.models import Post
# Create your models here.
VOTE_CHOICES=(
(+1,'+1'),
(-1,'-1'),
(0,'0'),
)
class Like (models.Model):
post = models.ForeignKey(Post)
user_token = models.CharField(max_length=100)
vote = models.SmallIntegerField(choices=VOTE_CHOICES)
date = models... | amartinez1/confessions | likes/models.py | Python | mit | 552 |
import sys, copy
from itertools import *
import benchbase
from benchbase import (with_attributes, with_text, onlylib,
serialized, children, nochange)
############################################################
# Benchmarks
############################################################
class Ben... | mhnatiuk/phd_sociology_of_religion | scrapper/build/lxml/benchmark/bench_objectify.py | Python | gpl-2.0 | 3,322 |
# plotwindow.py
# the main window for showing plots
# Copyright (C) 2004 Jeremy S. Sanders
# Email: Jeremy Sanders <jeremy@jeremysanders.net>
#
# 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 Softwa... | mythsmith/veusz | veusz/windows/plotwindow.py | Python | gpl-2.0 | 47,229 |
from .version import *
from .lib import (
show,
setup,
register_plugins,
add_to_filemenu,
)
| pyblish/pyblish-nukestudio | pyblish_nukestudio/__init__.py | Python | lgpl-3.0 | 108 |
class NoCache(object):
def process_response(self, request, response):
"""
set the "Cache-Control" header to "must-revalidate, no-cache"
"""
print "Check for serving static file: %s" % request.path
if request.path.startswith('/static/'):
print "Serving static file:... | moteloquito/final-project | final/middleware/nocache.py | Python | gpl-3.0 | 442 |
''' pydevd - a debugging daemon
This is the daemon you launch for python remote debugging.
Protocol:
each command has a format:
id\tsequence-num\ttext
id: protocol command number
sequence-num: each request has a sequence number. Sequence numbers
originating at the debugger are odd, sequence numbers ori... | suncycheng/intellij-community | python/helpers/pydev/_pydevd_bundle/pydevd_comm.py | Python | apache-2.0 | 60,914 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('hiscores', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='skill... | RaghavPro/Runescape-Hiscores | hiscores/migrations/0002_skills_creation_time.py | Python | gpl-2.0 | 450 |
#
# AtHomePowerlineServer - networked server for CM11/CM11A/XTB-232 X10 controllers
# Copyright (C) 2014 Dave Hocker
#
# 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, version 3 of the Lic... | dhocker/athomepowerlineserver | database/__init__.py | Python | gpl-3.0 | 387 |
import sys
try:
import wx
WX_VERSION = int(wx.version()[0])
hasWx = True
except Exception as e:
hasWx = False
WX_VERSION = 0
if hasWx:
import wx.xrc
from wx.lib.buttons import GenBitmapTextButton
from pubsub import pub
import wx.adv
import os
import time
import math
import rando... | mad-lab/transit | src/pytransit/analysis/griffin.py | Python | gpl-3.0 | 10,076 |
from demobrowser import db
from datetime import datetime
import re
from sqlalchemy import or_, and_
import math
class Demo(db.Model):
id = db.Column(db.Integer, primary_key=True)
logfile = db.Column(db.String(10))
size = db.Column(db.String(12))
path = db.Column(db.String(512))
name = db.Column(db.... | FernFerret/demobrowser | demobrowser/models.py | Python | mit | 6,463 |
#!/usr/bin/python
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
setup(
name='django-sizefield',
version='0.10.ceda',
author='Mathieu Leplatre',
author_email='contact@mathieu-leplatre.info',
url='https://github.com/leplatrem/django-sizefield... | cedadev/django-sizefield | setup.py | Python | lgpl-3.0 | 1,205 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-05-15 16:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sonetworks', '0033_auto_20170514_2158'),
]
operations = [
migrations.AlterF... | semitki/semitki | api/sonetworks/migrations/0034_auto_20170515_1642.py | Python | mit | 461 |
version = (0, 0, 1)
version_str = ".".join(str(x) for x in version)
| veltzer/demos-python | config/version.py | Python | gpl-3.0 | 68 |
from django import forms
import django_filters as filters
from tasks.models import Task
from projects.models import Project
from django.contrib.auth.models import User
from milestones.models import Milestone
from django.contrib.contenttypes.models import ContentType
from django.utils.safestring import SafeString
cla... | hbussell/pinax-tracker | apps/tasks/filters.py | Python | mit | 4,235 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016, Ben Doherty <bendohmv@gmail.com>
# Sponsored by Oomph, Inc. http://www.oomphinc.com
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_impor... | 2ndQuadrant/ansible | lib/ansible/modules/files/archive.py | Python | gpl-3.0 | 21,483 |
'''
STK-Unit Command line tool
Copyright (C) 2013 Giacomo Picchiarelli
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 opt... | gpicchiarelli/mirror-stk | stkLayer.py | Python | agpl-3.0 | 860 |
# Copyright 2001-2009 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.1/Lib/logging/__init__.py | Python | mit | 55,162 |
# 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/modules/categories/views.py | Python | gpl-3.0 | 1,629 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | anilmuthineni/tensorflow | tensorflow/python/layers/normalization.py | Python | apache-2.0 | 13,621 |
try:
from urlparse import urlparse, parse_qs
except ImportError:
from urllib.parse import urlparse, parse_qs
from oauthlib.common import add_params_to_uri
def slack_compliance_fix(session):
def _non_compliant_param_name(url, headers, data):
# If the user has already specified the token, either in... | singingwolfboy/requests-oauthlib | requests_oauthlib/compliance_fixes/slack.py | Python | isc | 1,453 |
import random
import urllib
from os import path, makedirs
from faker import Faker
from django.conf import settings # import the settings file
from django.core.management.base import BaseCommand
from Lagerregal import utils
from devices.models import Building, Room, Manufacturer, Device, Picture, Lending
from device... | vIiRuS/Lagerregal | main/management/commands/populate.py | Python | bsd-3-clause | 7,197 |
__author__ = 'zhu'
| epokmedia/redmine-cli | redminecli/server/__init__.py | Python | mit | 19 |
# -*- coding: utf-8 -*-
import re
from django.core.management.base import NoArgsCommand, BaseCommand
# import commonware.log
# log = commonware.log.getLogger('bedrock')
from bedrock.mocotw.utils import newsletter_subscribe
email_re = re.compile('^[_A-z0-9-]+(\.[_A-z0-9-]+)*@[A-z0-9-]+(\.[A-z0-9-]+)*(\.[A-z]{2,4})$')
... | elin-moco/bedrock | bedrock/mocotw/management/commands/import_subscriptions.py | Python | mpl-2.0 | 1,106 |
"""
byceps.services.ticketing.category_service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from typing import Dict, Optional, Sequence
from ...database import db
from ...typing import PartyID
from .models.category import ... | m-ober/byceps | byceps/services/ticketing/category_service.py | Python | bsd-3-clause | 2,371 |
import copy
from threading import Lock
import uuid
from naman.core.pypelib.persistence import PersistenceEngine
from naman.core.pypelib.resolver.Resolver import Resolver
from naman.core.pypelib.utils import Logger
from naman.core.pypelib.parsing.ParseEngine import ParseEngine
try:
import cPickle as pickle
except... | jpardobl/naman | naman/core/pypelib/RuleTable.py | Python | bsd-3-clause | 8,323 |
import unittest
from python_digits import HexDigit
class TestHexDigits(unittest.TestCase):
def test_hd_instantiate(self):
d = HexDigit(0x1)
self.assertEqual(d, 0x1)
def test_hd_instantiate_f(self):
d = HexDigit(0xf)
self.assertEqual(d, 0xf)
def test_hd_instantiate_int(sel... | dsandersAzure/python_digits | python_digits/tests/TestHexDigit.py | Python | apache-2.0 | 1,131 |
from unittest import TestCase
import pygame
from ..config import BRICK_IMAGES, START_LEVEL, BLIP
from .. import asset
class TestAsset(TestCase):
def setUp(self):
pygame.init()
def test_load_image(self):
img = asset.load_image(BRICK_IMAGES['red'])
self.assertTrue(False)
def test... | Oisota/Breakout | breakout/tests/test_asset.py | Python | gpl-3.0 | 994 |
import _plotly_utils.basevalidators
class ArrayValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="array", parent_name="bar.error_x", **kwargs):
super(ArrayValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/bar/error_x/_array.py | Python | mit | 442 |
class InvalidTracebackError(Exception):
def __init__(self, linenum=-1):
self.linenum = linenum
super(self.__class__, self).__init__()
def __str__(self):
details = ": at line %d" % self.linenum if self.linenum > 0 else ""
return "InvalidTracebackError" + details
| kde713/python-tbparser | tbparser/exceptions.py | Python | apache-2.0 | 303 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
slopearea_multi.py
---------------------
Date : March 2015
Copyright : (C) 2015 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
***********... | siliconsmiley/QGIS | python/plugins/processing/algs/taudem/slopearea_multi.py | Python | gpl-2.0 | 3,833 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'MyUI/MyWidgetUI.ui'
#
# Created: Tue Apr 1 09:44:10 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
excep... | DTUWindEnergy/Python4WindEnergy | lesson 6/results/ebra/MyUI/MyWidgetUI.py | Python | apache-2.0 | 2,193 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.desk.notifications import delete_notification_count_for
from frappe.core.doctype.user.user import STANDARD_USERS
from frappe.utils import cint
from frapp... | mbauskar/frappe | frappe/desk/page/chat/chat.py | Python | mit | 4,437 |
# -*- coding: utf-8 -*-
class HTTPException( Exception ):
"""
Base-Class for all Exceptions that should match to an http error-code
"""
def __init__( self, status, name, descr ):
"""
:param status: The desired http error-code (404, 500, ...)
:type status: int
:param name: Name as of RFC 2616
:type nam... | viur-framework/server | errors.py | Python | lgpl-3.0 | 6,008 |
# Description: Demonstrates the use of logistic regression
# Category: classification, logistic regression
# Classes: LogRegLearner
# Uses: titanic.tab
import orange
import orngLR
data = orange.ExampleTable("titanic")
lr = orngLR.LogRegLearner(data)
correct = 0
for ex in data:
if lr(ex) == ex.getc... | yzl0083/orange | Orange/testing/regression/tests_20/modules_logreg1.py | Python | gpl-3.0 | 431 |
# -*- coding: utf-8 -*-
'''
Management of Linux logical volumes
===================================
A state module to manage LVMs
.. code-block:: yaml
/dev/sda:
lvm.pv_present
my_vg:
lvm.vg_present:
- devices: /dev/sda
lvroot:
lvm.lv_present:
- vgname: my_vg
- ... | CSSCorp/openstack-automation | file_root/_states/lvm.py | Python | gpl-2.0 | 8,799 |
#!/usr/bin/env python
"""This script demonstrates how the amazonproduct API can be used to look up
the price of an item.
The amazon product API is available from here:
https://bitbucket.org/basti/python-amazon-product-api/
"""
import time
import amazonproduct
api = amazonproduct.API(locale='us')
def lookup_item(... | moshekaplan/lookup_amazon_prices | lookup_prices.py | Python | mit | 1,202 |
from flask import (Flask, render_template, request, flash)
import RPi.GPIO as GPIO
import os
import time
import threading
import thread
from threading import Thread
app = Flask(__name__)
GPIO.setmode(GPIO.BCM)
##PINS
coil_A_1_pin = 17
coil_A_2_pin = 22
coil_B_1_pin = 24
coil_B_2_pin = 23
pin_butto... | nigh7fox/MT-MuseumBoerhaave | interface.py | Python | gpl-3.0 | 5,456 |
from setuptools import setup
setup(name='facebook_downloader',
version='0.1',
description='API wrapper and crawler to download page posts from the Facebook Graph API',
url='http://github.com/coej/facebook_downloader',
author='Chris Jenkins',
author_email='chrisoej@gmail.com',
licens... | coej/facebook-downloader | setup.py | Python | mit | 729 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import js2xml
import os
TEST_DIR = os.path.dirname(__file__)
files = [
os.path.join(TEST_DIR, "samples/fullcalendar.js"),
os.path.join(TEST_DIR, "samples/fullcalendar.min.js"),
os.path.join(TEST_DIR, "samples/jquery.min.js"),
]
for filename in files:
with... | redapple/js2xml | tests/profile.py | Python | mit | 397 |
import logging
import hashlib
from pylons import request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to, etag_cache
from pylons.decorators import jsonify
from pylons.i18n.translation import _
from wurdig.lib.base import BaseController, render
log = logging.getLogger(__nam... | leveille/blog.v1 | wurdig/controllers/js.py | Python | mit | 1,892 |
from rest_framework import serializers
from recipemaster.recipes.models import Recipe, Tag
class TagSerializer(serializers.ModelSerializer):
class Meta:
model = Tag
fields = ('title', 'slug', 'color')
class RecipeSerializer(serializers.ModelSerializer):
tags = TagSerializer(many=True, read_... | agnethesoraa/recipemaster | recipemaster/recipes/serializers.py | Python | mit | 413 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.