text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#!/usr/bin/python
AGO_SCHEDULER_VERSION = '0.0.1'
############################################
"""
Basic class for device and device group schedule
"""
__author__ = "Joakim Lindbom"
__copyright__ = "Copyright 2017, Joakim Lindbom"
__date__ = "2017-01-27"
__credits__ = ["Joakim Lindbom", "The ago control ... | JoakimLindbom/ago | scheduler/scheduler.py | Python | gpl-3.0 | 7,085 | 0.005222 |
import sys
import os
import re
import time
import datetime
from contextlib import closing
# ---------------------------------------------------
# Settings
# ---------------------------------------------------
# IMPORTANT: In the standard case (sqlite3) just point this to your own MyVideos database.
DATABA... | nharrer/kodi-update-movie-dateadded | update_movie_dateadded.py | Python | mit | 5,104 | 0.005094 |
#!/usr/local/bin/python3
class TestClass(object):
def foo():
doc = "The foo property."
def fget(self):
return self._foo
def fset(self, value):
self._foo = value
def fdel(self):
del self._foo
return locals()
foo = property(**foo())
... | Etzeitet/pythonjournal | pythonjournal/proptest.py | Python | gpl-2.0 | 953 | 0.012592 |
from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification
log = CPLog(__name__)
class Trakt(Notification):
urls = {
'base': 'http://api.trakt.tv/%s',
'library': 'movie/library/%s',
'unwatchlist': 'movie/unwatchlist/%s',
}
listen_to = [... | rooi/CouchPotatoServer | couchpotato/core/notifications/trakt/main.py | Python | gpl-3.0 | 1,553 | 0.010947 |
"""
Uses a folder full of SMOS *.dbl files, converts them with the ESA snap command
line tool pconvert.exe to IMG
Uses then arcpy to to convert IMG to GeoTIFF
and crops them in the process to a specified extent and compresses them
"""
import os, subprocess, shutil
import arcpy
from arcpy import env
from arcpy.sa i... | jdegene/ArcGIS-scripts | SMOS.py | Python | mit | 2,615 | 0.008413 |
# -*- coding: utf-8 -*-
import unittest
from copy import deepcopy
from openprocurement.api.tests.base import snitch
from openprocurement.tender.belowthreshold.adapters import TenderBelowThersholdConfigurator
from openprocurement.tender.belowthreshold.tests.base import (
TenderContentWebTest,
test_bids,
tes... | openprocurement/openprocurement.tender.belowthreshold | openprocurement/tender/belowthreshold/tests/award.py | Python | apache-2.0 | 14,334 | 0.003084 |
import os
from setuptools import find_packages, setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
install_requires = [
'requests==2.8.1... | technoarch-softwares/linkedin-auth | setup.py | Python | bsd-2-clause | 1,410 | 0.002128 |
# Process the attendance data by adding fields for day of week and school year and reoder the fields
# so that they match the enrollment file: date, lasid, status (ABS), day, school year
# also, clean the bad data. Many absence records are on days not in the calendar. Check the date
# of the absence against the cale... | ebraunkeller/kerouac-bobblehead | ProcessAttendance.py | Python | mit | 1,977 | 0.02782 |
'''
SVG rasterization transform.
'''
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
import os, re
from urlparse import urldefrag
from lxml import etree
from PyQt5.Qt import (
Qt, QByteArray, QBuffer, QIODevice, QColor, QImage, QPa... | sharad/calibre | src/calibre/ebooks/oeb/transforms/rasterize.py | Python | gpl-3.0 | 9,021 | 0.002771 |
'''OpenGL extension EXT.separate_shader_objects
This module customises the behaviour of the
OpenGL.raw.GL.EXT.separate_shader_objects to provide a more
Python-friendly API
Overview (from the spec)
Prior to this extension, GLSL requires multiple shader domains
(vertex, fragment, geometry) to be linked into a sin... | D4wN/brickv | src/build_data/windows/OpenGL/GL/EXT/separate_shader_objects.py | Python | gpl-2.0 | 2,874 | 0.022617 |
"""
WSGI config for server_proj 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_APPLICATIO... | uw-it-aca/scout-vagrant | provisioning/templates/sample.wsgi.py | Python | apache-2.0 | 1,364 | 0.002199 |
import pystache
def render(source, values):
print pystache.render(source, values)
render(
"{{ # # foo }} {{ oi }} {{ / # foo }}",
{'# foo': [{'oi': 'OI!'}]}) # OI!
render(
"{{ #foo }} {{ oi }} {{ /foo }}",
{'foo': [{'oi': 'OI!'}]}) # OI!
render(
"{{{ #foo }}} {{{ /foo }}}",
{'#foo': 1, '/foo': 2}) # 1 2
ren... | MikeMitterer/dart-mdl-mustache | test/no_spec/whitespace.py | Python | bsd-2-clause | 760 | 0.040789 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of t... | imajes/Sick-Beard | sickbeard/nzbget.py | Python | gpl-3.0 | 6,926 | 0.00361 |
#!/usr/bin/env python
"""This module contains a set of default tools that are
deployed with jip
"""
import jip
@jip.tool("cleanup")
class cleanup(object):
"""\
The cleanup tool removes ALL the defined output
files of its dependencies. If you have a set of intermediate jobs,
you can put this as a final... | thasso/pyjip | jip/scripts/__init__.py | Python | bsd-3-clause | 1,603 | 0 |
'''
mid
此例展示带参数的装饰器如何装饰带参数的函数
此时,装饰器的参数,被装饰的函数,被装饰函数的参数都有确定的传递位置
'''
def d(argDec): #1) 装饰器的参数
def _d(funcDecored): #2) 被装饰函数
def __d(*arg, **karg): #3) 被装饰函数的参数
print (argDec)
print("do sth before decored func..")
r= funcDecored(*arg,... | UpSea/midProjects | BasicOperations/00_Python/00_Python_05_Deco01.py | Python | mit | 772 | 0.032051 |
# Create the data.
from numpy import pi, sin, cos, mgrid
dphi, dtheta = pi/250.0, pi/250.0
[phi,theta] = mgrid[0:pi+dphi*1.5:dphi,0:2*pi+dtheta*1.5:dtheta]
m0 = 4; m1 = 3; m2 = 2; m3 = 3; m4 = 6; m5 = 2; m6 = 6; m7 = 4;
r = sin(m0*phi)**m1 + cos(m2*phi)**m3 + sin(m4*theta)**m5 + cos(m6*theta)**m7
x = r*sin(phi)*cos(the... | Robbie1977/NRRDtools | test.py | Python | mit | 436 | 0.025229 |
from __future__ import with_statement
import pytest
from redis import exceptions
from redis._compat import b
multiply_script = """
local value = redis.call('GET', KEYS[1])
value = tonumber(value)
return value * ARGV[1]"""
class TestScripting(object):
@pytest.fixture(autouse=True)
def reset_scripts(self, r):... | katakumpo/niceredis | tests/test_scripting.py | Python | mit | 2,723 | 0 |
# -*- coding: utf-8 -*-
"""
Discussion XBlock
"""
import logging
import six
from six.moves import urllib
from six.moves.urllib.parse import urlparse # pylint: disable=import-error
from django.contrib.staticfiles.storage import staticfiles_storage
from django.urls import reverse
from django.utils.translation import ge... | edx-solutions/edx-platform | openedx/core/lib/xblock_builtin/xblock_discussion/xblock_discussion/__init__.py | Python | agpl-3.0 | 12,281 | 0.002931 |
from qcrash._dialogs.review import DlgReview
def test_review(qtbot):
dlg = DlgReview('some content', 'log content', None, None)
assert dlg.ui.edit_main.toPlainText() == 'some content'
assert dlg.ui.edit_log.toPlainText() == 'log content'
qtbot.keyPress(dlg.ui.edit_main, 'A')
assert dlg.ui.edit_mai... | ColinDuquesnoy/QCrash | tests/test_dialogs/test_review.py | Python | mit | 455 | 0 |
# django imports
from django.db import models
from django.utils.translation import ugettext_lazy as _
# lfs imports
from lfs.catalog.models import Product
from lfs.order.models import Order
class Topseller(models.Model):
"""Selected products are in any case among topsellers.
"""
product = models.ForeignK... | lichong012245/django-lfs-0.7.8 | lfs/marketing/models.py | Python | bsd-3-clause | 1,567 | 0 |
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plot
import matplotlib.pylab
from matplotlib.backends.backend_pdf import PdfPages
import re
def drawPlots(data,plotObj,name,yLabel,position):
drawing = plotObj.add_subplot(position,1,position)
drawing.set_ylabel(yLabel, font... | nachiketkarmarkar/XtremPerfProbe | generatePlots.py | Python | mit | 6,181 | 0.015046 |
# encoding: utf-8
"""
Enumerations that describe click action settings
"""
from __future__ import absolute_import
from .base import alias, Enumeration, EnumMember
@alias("PP_ACTION")
class PP_ACTION_TYPE(Enumeration):
"""
Specifies the type of a mouse action (click or hover action).
Alias: ``PP_ACTION... | scanny/python-pptx | pptx/enum/action.py | Python | mit | 1,548 | 0.000646 |
# Python test set -- part 2, opcodes
from test.support import run_unittest
import unittest
class OpcodeTest(unittest.TestCase):
def test_try_inside_for_loop(self):
n = 0
for i in range(10):
n = n+i
try: 1/0
except NameError: pass
except... | Orav/kbengine | kbe/src/lib/python/Lib/test/test_opcodes.py | Python | lgpl-3.0 | 2,787 | 0.011123 |
#! /usr/bin/env python
# Copyright 2011, 2013-2014 OpenStack Foundation
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://... | Tesora/tesora-project-config | tools/check_irc_access.py | Python | apache-2.0 | 5,790 | 0.000173 |
from . elasticfactor import ElasticFactor
from ... environment import cfg
from elasticsearch import Elasticsearch
def run(node):
id_a, id_b = node.get('id_a', '63166071_1'), node.get('id_b', '63166071_2')
es = Elasticsearch()
data_a = es.get(index="factor_state2016", doc_type='factor_network', id=i... | qadium-memex/linkalytics | linkalytics/factor/constructor/merge.py | Python | apache-2.0 | 603 | 0.014925 |
"""
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | antivirtel/Flexget | flexget/_version.py | Python | mit | 453 | 0.004415 |
#!/usr/bin/python
import feedparser
import os
import pickle
import logging
from episode import Episode
log = logging.getLogger()
class Feed:
""" Class representing a single podcast feed """
def __init__(
self,
name,
url,
destPath,
episodes,
... | obmarg/pypod | feed.py | Python | bsd-2-clause | 6,209 | 0.015139 |
from dashboard_app import views
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import RedirectView
admin.autodiscover()
urlpatterns = [
## primary app urls...
url( r'^info/$', views.info, name='info_url' ),
url( r'^widgets/$', views.widgets_redire... | birkin/dashboard | config/urls.py | Python | mit | 1,021 | 0.026445 |
from flask_wtf import Form
from wtforms import HiddenField, StringField
from wtforms.validators import InputRequired, EqualTo
from flask_login import current_user, abort, login_required
from flask import request, flash, redirect, render_template
import random
import bcrypt
from models.user_model import User
from .. im... | JunctionAt/JunctionWWW | blueprints/player_profiles/views/admin_reset.py | Python | agpl-3.0 | 1,619 | 0.002471 |
import media
import fresh_tomatoes
toy_story=media.Movie(
"Toy Story",
"A story of a boy and his toys that come to life",
"http://upload.wikimedia.org/wikipedia/en/1/13/Toy_Story.jpg",
"https://www.youtube.com/watch?v=vwyZH85NQC4")
#print (toy_story.storyline)
avatar=media.Movie(
"Avatar",
"A marine on an alien... | pinakinathc/python_code | movies/entertainment_center.py | Python | gpl-3.0 | 1,497 | 0.028724 |
import json
from django.test.utils import override_settings
import pytest
from pyquery import PyQuery
from fjord.base import views
from fjord.base.tests import (
LocalizingClient,
TestCase,
AnalyzerProfileFactory,
reverse
)
from fjord.base.views import IntentionalException
from fjord.search.tests imp... | Ritsyy/fjord | fjord/base/tests/test_views.py | Python | bsd-3-clause | 5,907 | 0 |
from django.conf.urls import url, include
from . import views
urlpatterns = [
url(r'^$', views.index, name = 'index'),
url(r'^contact/$', views.contact, name = 'contact'),
]
| rayhu-osu/vcube | crowdshipping/urls.py | Python | mit | 178 | 0.039326 |
"""
Created on May 17, 2012
@author: nmvdewie
"""
import unittest
import rmgpy.qm.qmtp as qm
import os
import rmgpy.qm.qmverifier as verif
import rmgpy.molecule as mol
class Test(unittest.TestCase):
def testVerifierDoesNotExist(self):
molecule = mol.Molecule()
name = 'UMRZSTCPUPJPOJ-UHFFFAOYSA'
... | faribas/RMG-Py | unittest/qm/qmverifierTest.py | Python | mit | 1,393 | 0.015793 |
"""
sentry.runner.commands.dsym
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import uuid
import json
import click
import six
import warnings
import threading
from sentry.runne... | JamesMura/sentry | src/sentry/runner/commands/dsym.py | Python | bsd-3-clause | 6,651 | 0 |
#!/usr/bin/python
## ################################################################################
## the package and lib that must install:
##
## OpenIPMI
## yum install OpenIPMI-python
##
## Pexpect:Version 3.3 or higher
## caution: a lower version will cause some error like "timeout nonblocking() in read" when... | OpenDeployment/openstack-cloud-management | tools/checkOs_InstallStatus.py | Python | apache-2.0 | 6,462 | 0.023367 |
#!/usr/bin/env python
# Source: https://gist.github.com/jtriley/1108174
import os
import shlex
import struct
import platform
import subprocess
class TerminalSize:
def get_terminal_size(self):
""" getTerminalSize()
- get width and height of console
- works on linux,os x,windows,cygwin(wind... | DigitalArtsNetworkMelbourne/huemovie | lib/terminalsize.py | Python | mit | 2,958 | 0.003719 |
# -*-coding:Utf-8 -*
import Adafruit_BBIO.GPIO as GPIO
import Adafruit_BBIO.ADC as ADC
import Adafruit_BBIO.PWM as PWM
import time
from math import *
class Motor :
"""Classe définissant un moteur, caractérisé par :
- le rapport de cycle de son PWM
- la pin de son PWM
- son sens de rotation
- la pin de ... | 7Robot/BeagleBone-Black | PROJETS/2013/FiveAxesArm/asserv/Motor.py | Python | gpl-2.0 | 3,370 | 0.026237 |
# -*- coding: utf-8 -*-
## begin license ##
#
# "Digitale Collectie ErfGeo Enrichment" is a service that attempts to automatically create
# geographical enrichments for records in "Digitale Collectie" (http://digitalecollectie.nl)
# by querying the ErfGeo search API (https://erfgeo.nl/search).
# "Digitale Collectie Erf... | seecr/dc-erfgeo-enrich | digitalecollectie/erfgeo/pittoannotation.py | Python | gpl-2.0 | 7,137 | 0.004063 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2016 Hewlett Packard Enterprise Development LP
#
# 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
... | HPENetworking/topology_docker | lib/topology_docker/shell.py | Python | apache-2.0 | 2,063 | 0 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
DsgTools
A QGIS plugin
Brazilian Army Cartographic Production Tools
-------------------
begin : 2019-01-04
git sha ... | lcoandrade/DsgTools | core/DSGToolsProcessingAlgs/Algs/OtherAlgs/fileInventoryAlgorithm.py | Python | gpl-2.0 | 8,002 | 0.0015 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of captlog.
#
# captlog - The Captain's Log (secret diary and notes application)
#
# Written in 2013 by Ricardo Garcia <r@rg3.name>
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to... | rg3/captlog | setup.py | Python | cc0-1.0 | 1,110 | 0.000901 |
from peewee import *
from playhouse.sqlite_ext import SqliteExtDatabase
db = SqliteExtDatabase('store/virus_manager.db',
threadlocals=True)
class BaseModel(Model):
class Meta:
database = db
class ManagedMachine(BaseModel):
image_name = TextField(unique=True)
reference_image = TextField()
... | nsgomez/vboxmanager | models.py | Python | mit | 539 | 0.007421 |
from django.shortcuts import render
from rest_framework import viewsets
from basin.models import Task
from basin.serializers import TaskSerializer
def index(request):
context = {}
return render(request, 'index.html', context)
def display(request):
state = 'active'
if request.method == 'POST':
... | Pringley/basinweb | basin/views.py | Python | mit | 1,780 | 0.004494 |
#!/usr/bin/env python
#
# ascii converter for shellcoding-lab at hack4
# ~dash in 2014
#
import sys
import binascii
text = sys.argv[1]
def usage():
print "./%s <string2convert>" % (sys.argv[0])
if len(sys.argv)<2:
usage()
exit()
val = binascii.hexlify(text[::-1])
print "Stringlen: %d" % len(text)
print "String:... | your-favorite-hacker/shellcode | x86_32/Example_Code/ascii_converter.py | Python | gpl-3.0 | 331 | 0.018127 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 12, transform = "Logit", sigma = 0.0, exog_count = 0, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Logit/trend_MovingMedian/cycle_12/ar_/test_artificial_1024_Logit_MovingMedian_12__0.py | Python | bsd-3-clause | 264 | 0.087121 |
from django.apps import AppConfig
class AttachmentsConfig(AppConfig):
verbose_name = 'Attachments'
| iamsteadman/bambu-attachments | bambu_attachments/apps.py | Python | apache-2.0 | 104 | 0.009615 |
def suma(a, b):
return a+b
def resta(a, b):
return a+b
| LeonRave/Tarea_Git | a.py | Python | mit | 66 | 0.075758 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | bijaydev/Implementation-of-Explicit-congestion-notification-ECN-in-TCP-over-wireless-network-in-ns-3 | src/flow-monitor/bindings/modulegen__gcc_ILP32.py | Python | gpl-2.0 | 454,665 | 0.015106 |
#!/usr/local/bin/python
#
# Created on July 10, 2000
# by Keith Cherkauer
#
# This python script computes several standard statistics on arrays
# of values
#
# Functions include:
# get_mean
# get_median
# get_var
# get_stdev
# get_skew
# get_sum
# get_min
# get_max
# get_count_over_threshold
# get_quantile
#... | OpenDA-Association/OpenDA | model_bmi/java/test/org/openda/model_bmi/testData/wflow_bin/wflow/stats.py | Python | lgpl-3.0 | 24,590 | 0.019113 |
# encoding: 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 'Poll.detailed_chart'
db.add_column('polls_poll', 'detailed_chart', self.gf('django.db.mode... | tracfm/tracfm | tracfm/polls/migrations/0010_auto__add_field_poll_detailed_chart.py | Python | agpl-3.0 | 13,004 | 0.008151 |
"""Support for EcoNet products."""
from datetime import timedelta
import logging
from aiohttp.client_exceptions import ClientError
from pyeconet import EcoNetApiInterface
from pyeconet.equipment import EquipmentType
from pyeconet.errors import (
GenericHTTPError,
InvalidCredentialsError,
InvalidResponseFor... | rohitranjan1991/home-assistant | homeassistant/components/econet/__init__.py | Python | mit | 5,194 | 0.000963 |
API_XML_NSMAP = {
"csw": "http://www.opengis.net/cat/csw/2.0.2",
"dc": "http://purl.org/dc/elements/1.1/",
"dct": "http://purl.org/dc/terms/",
"geonet": "http://www.fao.org/geonetwork",
"xsi": "http://www.w3.org/2001/XMLSchema-instance",
}
LINKED_XML_NSMAP = {
"csw": "http://www.opengis.net/cat... | opendatatrentino/opendata-harvester | harvester_odt/pat_geocatalogo/constants.py | Python | bsd-2-clause | 669 | 0 |
from followthemoney import model
from ingestors.ingestor import Ingestor
class DirectoryIngestor(Ingestor):
"""Traverse the entries in a directory."""
MIME_TYPE = "inode/directory"
SKIP_ENTRIES = [".git", ".hg", "__MACOSX", ".gitignore"]
def ingest(self, file_path, entity):
"""Ingestor imp... | alephdata/ingestors | ingestors/directory.py | Python | mit | 1,551 | 0 |
import torch
import pickle
import logging
from .baseclasses import ScalarMonitor
from .meta import Regurgitate
class Saver(ScalarMonitor):
def __init__(self, save_monitor, model_file, settings_file, **kwargs):
self.saved = False
self.save_monitor = save_monitor
self.model_file = model_file
... | isaachenrion/jets | src/monitors/saver.py | Python | bsd-3-clause | 985 | 0.001015 |
import pcbnew
import wx
import wx.aui
# get the path of this script. Will need it to load the png later.
import inspect
import os
filename = inspect.getframeinfo(inspect.currentframe()).filename
path = os.path.dirname(os.path.abspath(filename))
print("running {} from {}".format(filename, path))
def findPcbnewWind... | mmccoo/kicad_mmccoo | menus_and_buttons/menus_and_buttons.py | Python | apache-2.0 | 2,271 | 0.005284 |
import asyncio
import warnings
import psycopg2
from .log import logger
class Cursor:
def __init__(self, conn, impl, timeout, echo):
self._conn = conn
self._impl = impl
self._timeout = timeout
self._echo = echo
@property
def echo(self):
"""Return echo mode status... | nerandell/aiopg | aiopg/cursor.py | Python | bsd-2-clause | 11,747 | 0.00017 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='User',
... | WimpyAnalytics/django-andablog | demo/common/migrations/0001_initial.py | Python | bsd-2-clause | 2,365 | 0.004651 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.base.depr... | peiyuwang/pants | src/python/pants/backend/codegen/tasks/simple_codegen_task.py | Python | apache-2.0 | 531 | 0.001883 |
# sqlite/base.py
# Copyright (C) 2005-2012 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
"""
.. dialect:: sqlite
:name: SQLite
Date and Time Types
-------------------
SQ... | fredericmohr/mitro | mitro-mail/build/venv/lib/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.py | Python | gpl-3.0 | 34,783 | 0.001265 |
import json
import logging
from flask import jsonify
def construct_response(message, payload, status):
body = {}
if status == 500:
body['message'] = (
'Something went wrong constructing response. '
'Is your payload valid JSON?'
)
body['request_payload'] = str(p... | spulec/PyQS | example/api/helpers.py | Python | mit | 545 | 0 |
import tensorflow as tf
m1 = tf.constant([[1., 2.]])
m2 = tf.constant([[1],
[2]])
m3 = tf.constant([ [[1,2],
[3,4],
[5,6]],
[[7,8],
[9,10],
[11,12]] ])
print(m1)
print(m2)
print(m3)
# 500 x 500 tensor
print(tf.o... | saramic/learning | data/tensorflow/src/2_4_creating_tensors.py | Python | unlicense | 405 | 0.032099 |
# -*- coding: utf-8 -*-
"""Colour class.
This module contains a class implementing an RGB colour.
"""
__author__ = 'Florian Krause <florian@expyriment.org>, \
Oliver Lindemann <oliver@expyriment.org>'
__version__ = ''
__revision__ = ''
__date__ = ''
import colorsys
from . import round
# The named colours are th... | expyriment/expyriment | expyriment/misc/_colour.py | Python | gpl-3.0 | 15,022 | 0.000466 |
import pygame
import sys
from shellswitch_lib import ShellSwitchGameGrid
DISPLAY_WIDTH = 512
DISPLAY_HEIGHT = 384
class ShellSwitcher:
def __init__(self):
pygame.mixer.pre_init(44100, -16, 1, 512)
pygame.init()
self.screen = pygame.display.set_mode((DISPLAY_WIDTH, DISPLAY_HEIG... | mattop101/ShellSwitch | shellswitch.py | Python | mit | 5,372 | 0.003351 |
import nltk
from nltk.corpus import state_union
from nltk.tokenize import PunktSentenceTokenizer
train_text = state_union.raw("2005-GWBush.txt")
sample_text = state_union.raw("2006-GWBush.txt")
custom_sent_tokenizer = PunktSentenceTokenizer(train_text)
tokenized = custom_sent_tokenizer.tokenize(sample_text)
def pro... | abhishekjiitr/my-nltk | examples/ex6.py | Python | mit | 762 | 0.003937 |
import os
import popen2
HOME = '/home/conversy'
#TEST_SUITE_DIR = HOME+'/Archives/svgtests'
TEST_SUITE_DIR = HOME+'/Archives/svgtoolkit-20001010/samples'
lfiles = os.listdir(TEST_SUITE_DIR)
tmpfile = '/tmp/conversysvgtest'
excludes = ['SVGAnimat', 'SVGSVGElement::xmlns', 'SVGTitleElement::content', 'SVGDescElement... | rev22/svgl | scripts/test_suite.py | Python | lgpl-2.1 | 767 | 0.009126 |
import random
from pathlib import Path
from dmprsim.topologies.randomized import RandomTopology
from dmprsim.topologies.utils import ffmpeg
SIMU_TIME = 300
def main(args, results_dir: Path, scenario_dir: Path):
sim = RandomTopology(
simulation_time=getattr(args, 'simulation_time', 300),
num_rout... | reisub-de/dmpr-simulator | dmprsim/analyze/random_network.py | Python | mit | 809 | 0 |
import sys, mapper
def h(sig, id, f, timetag):
try:
print sig.name, f
except:
print 'exception'
print sig, f
def setup(d):
sig = d.add_input("/freq", 1, 'i', "Hz", None, None, h)
print 'inputs',d.num_inputs
print 'minimum',sig.minimum
sig.minimum = 34.0
print 'mini... | davidhernon/libmapper | swig/test.py | Python | lgpl-2.1 | 3,790 | 0.018997 |
# 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... | leeseuljeong/leeseulstack_neutron | neutron/agent/linux/ip_lib.py | Python | apache-2.0 | 20,419 | 0.000392 |
import _plotly_utils.basevalidators
class TickfontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="tickfont", parent_name="layout.ternary.aaxis", **kwargs
):
super(TickfontValidator, self).__init__(
plotly_name=plotly_name,
par... | plotly/python-api | packages/python/plotly/plotly/validators/layout/ternary/aaxis/_tickfont.py | Python | mit | 1,549 | 0.000646 |
from distutils.core import setup
setup(name='zencoder',
version='0.4',
description='Integration library for Zencoder',
author='Alex Schworer',
author_email='alex.schworer@gmail.com',
url='http://github.com/schworer/zencoder-py',
license="MIT License",
install_requires=['httpl... | torchbox/zencoder-py | setup.py | Python | mit | 363 | 0.00551 |
"""
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>centeredOrigin</key>
<false/>
<key>currentResolution</key>
<integer>0</integer>
<key>currentSequenceId</key>
<integer>0</integer>
<ke... | twenty0ne/CocosBuilder-wxPython | CCBDocument.py | Python | mit | 26,533 | 0.043078 |
#!/usr/bin/env python3
###############################################################################
# #
# Copyright 2019. Triad National Security, LLC. All rights reserved. #
# This program was produced under U.S. Government contrac... | CSD-Public/stonix | src/tests/rules/unit_tests/zzzTestRulePreventXListen.py | Python | gpl-2.0 | 4,504 | 0.00222 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy.testing import assert_allclose
from .. import bayesian_blocks, RegularEvents
def test_single_change_point(rseed=0):
rng = np.random.RandomState(rseed)
x = np.concatenate([rng.rand(100),
... | funbaker/astropy | astropy/stats/tests/test_bayesian_blocks.py | Python | bsd-3-clause | 4,205 | 0 |
"""ParameterConfig wraps ParameterConfig and ParameterSpec protos."""
import collections
import copy
import enum
import math
from typing import Generator, List, Optional, Sequence, Tuple, Union
from absl import logging
import attr
from vizier.pyvizier.shared import trial
class ParameterType(enum.IntEnum):
"""Val... | google/vizier | vizier/pyvizier/shared/parameter_config.py | Python | apache-2.0 | 21,349 | 0.007494 |
from __future__ import absolute_import, unicode_literals
import pytest
from virtualenv.seed.wheels.embed import MAX, get_embed_wheel
from virtualenv.seed.wheels.util import Wheel
def test_wheel_support_no_python_requires(mocker):
wheel = get_embed_wheel("setuptools", for_py_version=None)
zip_mock = mocker.M... | pypa/virtualenv | tests/unit/seed/wheels/test_wheels_util.py | Python | mit | 901 | 0 |
#!/usr/bin/env python
import sys
def fix_terminator(tokens):
if not tokens:
return
last = tokens[-1]
if last not in ('.', '?', '!') and last.endswith('.'):
tokens[-1] = last[:-1]
tokens.append('.')
def balance_quotes(tokens):
count = tokens.count("'")
if not count:
return
processed = 0
... | TeamSPoon/logicmoo_workspace | packs_sys/logicmoo_nlu/ext/candc/src/lib/tokeniser/fixes.py | Python | mit | 820 | 0.023171 |
# eliteReconBonusRadarStrength2
#
# Used by:
# Ship: Chameleon
# Ship: Falcon
# Ship: Rook
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "ECM",
"scanRadarStrengthBonus", ship.getModifiedItemAttr("eliteBonusRecon... | Ebag333/Pyfa | eos/effects/elitereconbonusradarstrength2.py | Python | gpl-3.0 | 384 | 0.002604 |
from ckan.controllers.package import PackageController
from ckan.plugins import toolkit as tk
from ckan.common import request
import ckan.model as model
import ckan.logic as logic
import logging
import requests
import ConfigParser
import os
import json
log = logging.getLogger(__name__)
config = ConfigParser.ConfigPar... | memaldi/ckanext-sparql | ckanext/sparql/controller.py | Python | agpl-3.0 | 2,273 | 0 |
# -*- coding: utf-8 -*-
from openerp import fields, models, api
import re
class res_partner(models.Model):
_inherit = 'res.partner'
#def _get_default_tp_type(self):
# return self.env.ref('l10n_cl_invoice.res_IVARI').id
# todo: pasar los valores por defecto a un nuevo módulo
# por ejemplo "l10n... | odoo-chile/l10n_cl_invoice | models/partner.py | Python | agpl-3.0 | 2,394 | 0.006268 |
from .. import db
class ApiParameterLink(db.Model):
__tablename__ = 'api_parameter_link'
api_id = db.Column(db.Integer, db.ForeignKey('apis.id'), primary_key=True)
parameter_id = db.Column(db.Integer, db.ForeignKey('parameters.id'), primary_key=True)
parameter_description = db.Column(db.String(128))
... | hack4impact/legal-checkup | app/models/api.py | Python | mit | 2,549 | 0.003531 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 Smile (<http://www.smile.fr>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under th... | ovnicraft/odoo_addons | smile_base/models/ir_values.py | Python | agpl-3.0 | 4,447 | 0.002474 |
from toontown.safezone.DLSafeZoneLoader import DLSafeZoneLoader
from toontown.town.DLTownLoader import DLTownLoader
from toontown.toonbase import ToontownGlobals
from toontown.hood.ToonHood import ToonHood
class DLHood(ToonHood):
notify = directNotify.newCategory('DLHood')
ID = ToontownGlobals.DonaldsDreamla... | Spiderlover/Toontown | toontown/hood/DLHood.py | Python | mit | 1,237 | 0.00485 |
#!/usr/bin/python
# Copyright (c) 2013 The Native Client 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 argparse
import collections
import datetime
import email.mime.text
import getpass
import os
import re
import smtplib
import... | wilsonianb/nacl_contracts | build/update_pnacl_tool_revisions.py | Python | bsd-3-clause | 16,688 | 0.00797 |
import _plotly_utils.basevalidators
class SizeValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="size", parent_name="scatterternary.selected.marker", **kwargs
):
super(SizeValidator, self).__init__(
plotly_name=plotly_name,
parent_... | plotly/python-api | packages/python/plotly/plotly/validators/scatterternary/selected/marker/_size.py | Python | mit | 509 | 0.001965 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 theo crevon
#
# See the file LICENSE for copying permission.
import install
import config
import service
from fabric.api import env, task
env.hosts = ['localhost']
@task
def bootstrap():
"""Deploy, configure, and start Fridge on hosts"""
install.bootstrap()
... | oleiade/Fridge | fabfile/__init__.py | Python | mit | 365 | 0 |
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2012-2013 IBM Corp.
# 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/li... | theanalyst/cinder | cinder/openstack/common/db/sqlalchemy/test_migrations.py | Python | apache-2.0 | 11,078 | 0 |
# Support for the GeoRSS format
# Copyright 2010-2015 Kurt McKee <contactme@kurtmckee.org>
# Copyright 2002-2008 Mark Pilgrim
# All rights reserved.
#
# This file is a part of feedparser.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following con... | terbolous/SickRage | lib/feedparser/namespaces/georss.py | Python | gpl-3.0 | 11,117 | 0.003868 |
"""
Header Unit Class
"""
### INCLUDES ###
import logging
from gate.conversions import round_int
from variable import HeaderVariable
from common import MIN_ALARM, MAX_ALARM
### CONSTANTS ###
## Logger ##
LOGGER = logging.getLogger(__name__)
# LOGGER.setLevel(logging.DEBUG)
### CLASSES ###
class HeaderUnit(Header... | Barmaley13/BA-Software | gate/sleepy_mesh/node/headers/header/unit.py | Python | gpl-3.0 | 5,361 | 0.003917 |
import networkx as nx
import sys
from cnfformula import CNF
from cnfformula import SubsetCardinalityFormula
from . import TestCNFBase
from .test_commandline_helper import TestCommandline
from .test_graph_helper import complete_bipartite_graph_proper
class TestSubsetCardinality(TestCNFBase):
def test_empty(self)... | elffersj/cnfgen | tests/test_subsetcardinality.py | Python | gpl-3.0 | 2,350 | 0.00766 |
# Copyright (C) 2013-2014 Fox Wilson, Peter Foley, Srijay Kasturi, Samuel Damashek, James Forcier and Reed Koser
#
# 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 Licen... | sckasturi/saltlake | commands/score.py | Python | gpl-2.0 | 3,127 | 0.002558 |
# -*- encoding: utf-8 -*-
from abjad import *
from abjad.tools import tonalanalysistools
def test_tonalanalysistools_ChordSuspension___eq___01():
chord_suspension = tonalanalysistools.ChordSuspension(4, 3)
u = tonalanalysistools.ChordSuspension(4, 3)
voice = tonalanalysistools.ChordSuspension(2, 1)
... | mscuthbert/abjad | abjad/tools/tonalanalysistools/test/test_tonalanalysistools_ChordSuspension___eq__.py | Python | gpl-3.0 | 634 | 0.009464 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# PyMDstat
# ...
#
# Copyright (C) 2014 Nicolargo <nicolas@nicolargo.com>
__appname__ = "PyMDstat"
__version__ = "0.4.2"
__author__ = "Nicolas Hennion <nicolas@nicolargo.com>"
__licence__ = "MIT"
__all__ = ['MdStat']
from .pymdstat import MdStat
| nicolargo/pymdstat | pymdstat/__init__.py | Python | mit | 297 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# tools/modelbase.py
#
#
# MODEL DEFINITION:
# 1. create a subclass.
# 2. set each definitions as below in the subclass.
#
# __structure__ = {} # define keys and the data type
# __required_fields__ = [] # lists required keys
# __default_values__ = {} # set def... | kazukiotsuka/mongobase | mongobase/modelbase.py | Python | mit | 5,018 | 0.000598 |
"""Map Comprehensions"""
def inverse_filter_dict(dictionary, keys):
"""Filter a dictionary by any keys not given.
Args:
dictionary (dict): Dictionary.
keys (iterable): Iterable containing data type(s) for valid dict key.
Return:
dict: Filtered dictionary.
"""
return {key:... | joeflack4/jflack | joeutils/data_structures/comprehensions/maps/__init__.py | Python | mit | 883 | 0 |
"""
kombu.transport.pyamqp
======================
pure python amqp transport.
"""
from __future__ import absolute_import, unicode_literals
import amqp
from kombu.five import items
from kombu.utils.amq_manager import get_manager
from kombu.utils.text import version_string_as_tuple
from . import base
DEFAULT_PORT =... | Elastica/kombu | kombu/transport/pyamqp.py | Python | bsd-3-clause | 5,262 | 0.00019 |
from sympy.core import pi, oo, symbols, Function, Rational, Integer, GoldenRatio, EulerGamma, Catalan, Lambda, Dummy, Eq
from sympy.functions import Piecewise, sin, cos, Abs, exp, ceiling, sqrt, gamma
from sympy.utilities.pytest import raises
from sympy.printing.ccode import CCodePrinter
from sympy.utilities.lambdify i... | wdv4758h/ZipPy | edu.uci.python.benchmark/src/benchmarks/sympy/sympy/printing/tests/test_ccode.py | Python | bsd-3-clause | 10,134 | 0.001875 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... | ProjectSWGCore/NGECore2 | scripts/mobiles/naboo/narglatch_sick.py | Python | lgpl-3.0 | 1,632 | 0.026961 |
import datetime, time
from src import ModuleManager, utils
TIMESTAMP_BOUNDS = [
[0, 59],
[0, 23],
[1, 31],
[1, 12],
[0, 6],
]
class Module(ModuleManager.BaseModule):
def on_load(self):
now = datetime.datetime.utcnow()
next_minute = now.replace(second=0, microsecond=0)
n... | jesopo/bitbot | src/core_modules/cron.py | Python | gpl-2.0 | 2,510 | 0.00239 |
"""
This module converts requested URLs to callback view functions.
RegexURLResolver is the main class here. Its resolve() method takes a URL (as
a string) and returns a tuple in this format:
(view_function, function_args, function_kwargs)
"""
from __future__ import unicode_literals
from importlib import import_... | archen/django | django/core/urlresolvers.py | Python | bsd-3-clause | 22,195 | 0.001532 |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import wx
from .common import update_class
class Separator(wx.StaticLine):
def __init__(self, parent):
wx.StaticLine.__init__(self, parent.get_container(), -1,
wx.Defau... | lunixbochs/fs-uae-gles | launcher/fs_uae_launcher/fsui/wx/separator.py | Python | gpl-2.0 | 394 | 0.010152 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.