code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from haystack import indexes
from base.models import *
class MediaPropertyIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.MultiValueField(document=True)
def get_model(self):
return Media
class SubjectPropertyIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.MultiValueFie... | sashafr/uronline | base/search_indexes.py | Python | bsd-3-clause | 1,515 |
'''
This module defines a context object which holds on to all global state.
'''
import os.path
import sys
import time
import socket
import getpass
import weakref
import linecache
import threading
import cmd
from weakref import WeakKeyDictionary
from collections import defaultdict, deque
from multiprocessing import cp... | paypal/support | support/context.py | Python | bsd-3-clause | 19,121 |
import gzip
import logging
import os
import re
import urllib2
import urlparse
try:
from urlparse import parse_qs
except ImportError:
# (copied to urlparse from cgi in 2.6)
from cgi import parse_qs
from heapq import heappush, heappop
try:
from cStringIO import StringIO
except ImportError:
from String... | emacsway/django-oembed | oembed/core.py | Python | bsd-3-clause | 9,024 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013, LCI Technology Group
# 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, thi... | averagesecurityguy/AWSlab | aws/instance.py | Python | bsd-3-clause | 5,773 |
#
# Ruler.py -- Ruler plugin for Ginga reference viewer
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
from ginga import GingaPlugin
from ginga.misc import Widgets, C... | sosey/ginga | ginga/misc/plugins/Ruler.py | Python | bsd-3-clause | 5,258 |
import json
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
from .forms import TableForm
from .models import Table
from .utils import static_url
class TablePlugin(CMSPluginBase):
model = Table
form = TableForm
name... | freelancersunion/djangocms-table | djangocms_table/cms_plugins.py | Python | bsd-3-clause | 1,365 |
"""
Unittests for tinysort.tinysort
"""
import io
import itertools as it
import os
import pytest
import random
import six
import tinysort
import tinysort.io
from tinysort import tools
from tinysort import _sort
def test_delete_files(tmpdir):
base = tmpdir.mkdir('test_delete_files')
paths = [str(base.join... | geowurster/tinysort | tests/test_sort.py | Python | bsd-3-clause | 5,009 |
import unittest
from pyalgs.data_structures.commons.binary_search_tree import BinarySearchTree
class BinarySearchTreeUnitTest(unittest.TestCase):
def test_binarySearchTree(self):
bst = BinarySearchTree.create()
bst.put("one", 1)
bst.put("two", 2)
bst.put("three", 3)
bst.p... | chen0040/pyalgs | tests/data_structures/commons/binary_search_tree_unit_test.py | Python | bsd-3-clause | 2,643 |
from django.test import RequestFactory
from test_plus.test import TestCase
from ..views import PeriodCreate, PeriodUpdate
class BaseUserTestCase(TestCase):
def setUp(self):
self.user = self.make_user()
self.factory = RequestFactory
class TestPeriodCreateView(BaseUserTestCase):
def setUp(se... | Guin-/Fem_Stats | femstats/fertility/tests/test_views.py | Python | bsd-3-clause | 795 |
import json
from docker import Client
_cli = None
def getClient():
global _cli
if _cli is None:
_cli = Client(version='auto', timeout=15)
return _cli
def _checkOutput(out):
for line in out.splitlines():
try:
l = json.loads(line)
if 'error' in l.keys():
... | tsadm/desktop | lib/tsdesktop/dockman/__init__.py | Python | bsd-3-clause | 1,696 |
import os
import random
import re
import time
from datetime import datetime
from django import dispatch, forms
from django.conf import settings
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
from django.core import validators
from django.db import models
from django.utils import timezone
from... | harikishen/addons-server | src/olympia/users/models.py | Python | bsd-3-clause | 17,323 |
# -*- coding: utf-8 -*-
from __future__ import division
import inspect
from decimal import ROUND_DOWN, Decimal
from django import VERSION
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.db import models
from django.db.models import F, Field
from dj... | rescale/django-money | djmoney/models/fields.py | Python | bsd-3-clause | 16,709 |
from eda.components.Micrel import *
| 32bitmicro/EDA | python/eda/eda/components/Micrel/__init__.py | Python | bsd-3-clause | 36 |
def extractNakimushi(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
if 'Teasers' in item['tags']:
return None
if 'Renai Kakumei Onii-chan' in item['tags']:
return buildReleaseMessageW... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractNakimushi.py | Python | bsd-3-clause | 1,021 |
import ctypes
from ctypes import wintypes
import windows.generated_def as gdef
from ..apiproxy import ApiProxy, NeededParameter, is_implemented
from ..error import WinproxyError, result_is_error_code
CFGMGR32_ERRORS = gdef.FlagMapper(
gdef.CR_SUCCESS,
gdef.CR_DEFAULT,
gdef.CR_OUT_OF_MEMORY,
gdef.CR_IN... | hakril/PythonForWindows | windows/winproxy/apis/cfgmgr32.py | Python | bsd-3-clause | 4,490 |
from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup
HERE = path.dirname(path.abspath(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, 'datadog_checks', 'aqua', '__about__.py')) as f:
exec(f.read(), ABOUT)
# Get the long description from the ... | DataDog/integrations-extras | aqua/setup.py | Python | bsd-3-clause | 1,862 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [Extension('fsdt_donnell_bc1_nonlinear',
['fsdt_donnell_bc1_nonlinear.pyx'],
extra_compile_args=['/openmp',
'/O2', '/favor:IN... | albertoferna/compmech | compmech/conecyl/fsdt/setup_fsdt_donnell_bc1_nonlinear.py | Python | bsd-3-clause | 517 |
def extractLonahora(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if "Earth's Core" in item['tags']:
return buildReleaseMessageWithType(item, "Earth's Core", vol, chp, frag=frag, postfix=postfix, ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractLonahora.py | Python | bsd-3-clause | 348 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "labelsite.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| vanda/DigitalLabels | manage.py | Python | bsd-3-clause | 252 |
# coding=utf-8
from difflib import get_close_matches
from collections import namedtuple
import re
import datetime
#import pyfribidi
from util import flatten
from textutil import reverse_numbers, asblocks, fix_superscripts
from pdftools import pdftotext, pdfinfo
def readable(txt):
if isinstance(txt, list):
... | livni/old-OK | src/knesset/simple/management/commands/parse_government_bill_pdf/parse_government_bill_pdf.py | Python | bsd-3-clause | 10,847 |
#!/usr/bin/env python3
import mysql.connector
databaseUsername = ''
databasePassword = ''
for line in open('../.database-username', 'r'):
databaseUsername = line.strip()
break
for line in open('../.database-password', 'r'):
databasePassword = line.strip()
break
cnx = mysql.connector.connect(user=databaseUsername... | OpenTaal/database-tools | flexies-met-ongekeurd-basiswoord.py | Python | bsd-3-clause | 977 |
"""A compact GUI application for optical distortion calibration of endoscopes.
See:
https://github.com/gift-surg/endocal
"""
from setuptools import setup
# To use a consistent encoding
from codecs import open
from os import path
doc_dir = path.abspath(path.join(path.dirname(__file__), 'doc'))
# Get the summary
summ... | gift-surg/endocal | setup.py | Python | bsd-3-clause | 4,008 |
"""
OEShape color utilities.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
from openeye.oechem import *
from openeye.oeshape import *
class ColorForceField(OEColorForceField):
"""
Color force field wrapper with additional utility methods... | skearnes/color-features | oe_utils/shape/color.py | Python | bsd-3-clause | 2,551 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
"""
Release logic:
1. Bump the __version__.
2. git add shop_wspay/__init__.py
3. git commit -m 'Bump to <version>'
4. git push
5. Make sure all tests pass on https://travis-ci.org/dinoperovic/djangoshop-wspay
6. git tag <version>
7... | dinoperovic/djangoshop-wspay | shop_wspay/__init__.py | Python | bsd-3-clause | 456 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 30, transform = "None", sigma = 0.0, exog_count = 100, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_None/trend_MovingAverage/cycle_30/ar_/test_artificial_128_None_MovingAverage_30__100.py | Python | bsd-3-clause | 265 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Handles the "LaTeX" unit format.
"""
import numpy as np
from . import base, core, utils
class Latex(base.Base):
"""
Output LaTeX to display the unit based on IAU style guidelines.
Attempts to follow the `IAU Style Manual
<https:/... | bsipocz/astropy | astropy/units/format/latex.py | Python | bsd-3-clause | 3,922 |
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
__all__ = (
'InlineValidationError', 'InlineSyntaxError',
'create_verbose_inline_errors',)
class InlineValidationError(ValidationError):
def __init__(self, lineno, *args, **kwargs):
self.li... | mikeurbanski/django-inlines | django_inlines/errors.py | Python | bsd-3-clause | 1,240 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['ConstantTrend'] , ['Seasonal_Hour'] , ['SVR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_None/model_control_one_enabled_None_ConstantTrend_Seasonal_Hour_SVR.py | Python | bsd-3-clause | 155 |
'''
multi-threading (python3 version)
https://docs.python.org/3/library/threading.html
'''
from time import clock
from time import sleep
THREADS=2
Checked = []int()
Primes = []int()
## TODO, fix `if item in vec` syntax
#@transaction.safe
def in_vector( vec:[]int, find:int ) ->bool:
with atomic:
for item in vec:
... | secureosv/pythia | regtests/bench/thread_shared_vector-typed.py | Python | bsd-3-clause | 1,504 |
import sys
from django.conf.urls import patterns, include, url
import okstereotype.views
import settings
# from multiprocessing import Process, cpu_count
import atexit
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
import os
from queue.rpc_server import initialize
# Uncomment the next two lines to... | lqdc/okstereotype | okstereotype/urls.py | Python | bsd-3-clause | 1,720 |
from django.test import TestCase
from django.core.urlresolvers import reverse
from .models import Event
from django import template
class EventTestCase(TestCase):
def setUp(self):
self.tes1 = Event.objects.get_or_create(
date='2002-12-12',
time="12:00:00",
title="This i... | ilendl2/chrisdev-cookiecutter | {{cookiecutter.repo_name}}/{{cookiecutter.project_name}}/events/tests.py | Python | bsd-3-clause | 2,385 |
import json
import logging
import os
import re
import requests
import traceback
from django.conf import settings
from django.contrib.auth.models import Permission
from django.http import HttpResponse
from django.utils.translation import trans_real
from translate.filters import checks
from translate.storage import base... | Osmose/pontoon | pontoon/base/utils.py | Python | bsd-3-clause | 12,294 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.0.0.11832 on 2017-03-22.
# 2017, SMART Health IT.
import io
import json
import os
import unittest
from . import valueset
from .fhirdate import FHIRDate
class ValueSetTests(unittest.TestCase):
def instantiate_from(self, filename):
... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_3_0_0/models/valueset_tests.py | Python | bsd-3-clause | 19,400 |
"""
PureExpressions detects functions without side-effects.
"""
from pythran.analyses.aliases import Aliases
from pythran.analyses.argument_effects import ArgumentEffects
from pythran.analyses.global_effects import GlobalEffects
from pythran.passmanager import ModuleAnalysis
from pythran.intrinsic import Intrinsic
im... | pbrunet/pythran | pythran/analyses/pure_expressions.py | Python | bsd-3-clause | 2,661 |
from go.contacts.parsers.base import ContactFileParser, ContactParserException
__all__ = ['ContactParserException', 'ContactFileParser']
| praekelt/vumi-go | go/contacts/parsers/__init__.py | Python | bsd-3-clause | 138 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'core.views.home', name='home'),
url(r'^cryptocoin/', include('django_cryptocoin.urls')),
)
| quantum13/django-crypto-paid-chat | cryptochat/urls.py | Python | bsd-3-clause | 302 |
# -*- coding: utf-8 -*-
"""
This module holds some types we'll have use for along the way.
It's your job to implement the Closure and Environment types.
The LispError class you can have for free :)
"""
class LispError(Exception):
"""General lisp error class."""
pass
class Closure:
def __init__(self, e... | fatso83/diy-lisp | diylisp/types.py | Python | bsd-3-clause | 1,147 |
import graphene
from django.core.exceptions import ValidationError
from ....order import OrderStatus, models
from ...core.mutations import ModelBulkDeleteMutation
class DraftOrderBulkDelete(ModelBulkDeleteMutation):
class Arguments:
ids = graphene.List(
graphene.ID,
required=True,... | UITools/saleor | saleor/graphql/order/bulk_mutations/draft_orders.py | Python | bsd-3-clause | 1,301 |
"""
Form generation utilities for App Engine's ``db.Model`` class.
The goal of ``model_form()`` is to provide a clean, explicit and predictable
way to create forms based on ``db.Model`` classes. No malabarism or black
magic should be necessary to generate a form for models, and to add custom
non-model related fields: ... | mobyle2-legacy/WTForms | wtforms/ext/appengine/db.py | Python | bsd-3-clause | 18,213 |
from ietf.ipr.models import IprDetail
class _IprDetailManager(object):
def queue_ipr(self):
# qq{select document_title, ipr_id, submitted_date,status from ipr_detail where status = 0 order by submitted_date desc};
return IprDetail.objects.filter(status=0).order_by('-submitted_date')
def generic... | mcr/ietfdb | ietf/secr/ipradmin/managers.py | Python | bsd-3-clause | 2,136 |
__author__ = 'shabou'
import logging
from kaggler.core import submit
class Submission(submit.BaseSubmission):
def __init__(self):
super(Submission, self).__init__()
def run(self):
logging.info("submit")
| aymen82/kaggler-competitions-scripts | kaggler/competitions/bike/shabou/submit.py | Python | bsd-3-clause | 232 |
# -*- coding: utf-8 -*-
from django.contrib.auth import get_user_model
from django.db.models.signals import post_syncdb
def add_super_admin(*args, **kwargs):
""" Add super user on first syncdb """
User = get_user_model()
if not User.objects.filter(is_staff=True).exists():
User.objects.create_super... | arkanister/djangocmstemplate | project_name/__init__.py | Python | bsd-3-clause | 507 |
import collections
from datetime import datetime
import json
from urlparse import urlparse
from django.conf import settings
from django.core import mail
from django.core.cache import cache
from django.contrib.auth.tokens import default_token_generator
from django.forms.models import model_to_dict
from django.utils.htt... | anaran/olympia | apps/users/tests/test_views.py | Python | bsd-3-clause | 59,576 |
from __future__ import print_function
import numpy as np
import sympy as sy
from bokeh.client import push_session
from bokeh.document import Document
from bokeh.models.glyphs import Line
from bokeh.models import Plot, Range1d, LinearAxis, ColumnDataSource, Grid, Legend
from bokeh.models.widgets import Slider, TextInp... | phobson/bokeh | examples/models/taylor_server.py | Python | bsd-3-clause | 2,879 |
"""
pyshtools Legendre Functions.
This submodule of pyshtools defines the following functions:
"Geodesy" 4-pi normalized
-----------------------
PlmBar Compute all the geodesy-normalized associated Legendre functions.
PlmBar_d1 Compute all the geodesy-normalized associated Legendre functions
... | heroxbd/SHTOOLS | pyshtools/legendre.py | Python | bsd-3-clause | 2,836 |
#!/usr/bin/python
# filename: msa.py
import subprocess
from Bio import AlignIO
from StringIO import StringIO
def alignment(input):
print "Performing the multiple sequence alignment with Mafft..."
# set up the Mafft command line stuff.
# "--thread -1" means Mafft will use all available cores for multiprocessin... | briney/env-analysis | glycans/msa.py | Python | mit | 1,510 |
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
''' IMPORTS '''
from socket import gaierror
def results_return(command, thingtoreturn):
for item in thingtoreturn:
description = ''
ip_reputation = {
'indicator': item['Address'],
}
... | demisto/content | Packs/Spamcop/Integrations/Spamcop/Spamcop.py | Python | mit | 3,351 |
#!/opt/conda/bin/python
#coding :utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2021 yutiansut/QUANTAXIS
#
# 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, includ... | yutiansut/QUANTAXIS | docker/qa-community-rust/update_all.py | Python | mit | 2,839 |
# -*- coding: utf-8 -*-
import random
from lxml import etree
from odoo import http
from odoo.http import request
from .common import SubsonicREST
def _uniquify_list(seq):
seen = set()
return [x for x in seq if x not in seen and not seen.add(x)]
class MusicSubsonicListing(http.Controller):
@http.rout... | nicolasmartinelli/oomusic | controllers/subsonic/listing.py | Python | mit | 17,817 |
#!/usr/bin/env python
import glob, os, itertools
libs = map(lambda lib: (os.path.basename(lib), lib), glob.glob('./build/Products/Release-iphone*/libPods*.a'))
first = lambda iterable: iterable[0]
last = lambda iterable: iterable[1]
for key, group in itertools.groupby(sorted(libs, key=first), first):
target = 'b... | hiroara/TiMessagesTableViewController | build_fat_lib.py | Python | mit | 556 |
"""Adds a new load_balancer service."""
# :license: MIT, see LICENSE for more details.
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import loadbal
import click
@click.command()
@click.argument('identifier')
@click.option('--allocation',
required=True,
type=cl... | briancline/softlayer-python | SoftLayer/CLI/loadbal/group_add.py | Python | mit | 1,257 |
import sys
import pylab as pl
LDAMODEL = 'provi_reseg_lemmatized_tfidf.ldamodel'
usage = """python src/plot_topics_distrib.py < all_1min_doc_topics_reseg_lemmatized.txt"""
topics_distrib = {}
for line in sys.stdin:
tuples = line.split('[')[1].split(')')
tuples = tuples[:-1]
for t in tuples:
tmp =... | SnippyHolloW/contextual_word_segmentation | src/plot_topics_distribs.py | Python | mit | 990 |
"""
WSGI config for project_card 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_... | michelerana/card-project | project_card/wsgi.py | Python | mit | 401 |
#!/usr/bin/env python
# encoding: utf-8
"""
mygis.py
Series of routines for reading / writing various GIS formats
(added as I need them)
Requires GDAL and netCDF4 (both the libraries and the Python bindings)
if GDAL is not available it will still import, but libraries that require gdal will raise an import e... | gutmann/icar | helpers/lib/mygis.py | Python | mit | 21,405 |
#### 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/hair/bothan/shared_hair_bothan_female_s03.iff"
result.attribute_tem... | obi-two/Rebelion | data/scripts/templates/object/tangible/hair/bothan/shared_hair_bothan_female_s03.py | Python | mit | 452 |
"""
:copyright: 2010-2015 by Ronny Pfannschmidt
:license: MIT
"""
import os
import sys
from .utils import trace
from .version import format_version
from .discover import find_matching_entrypoint
TEMPLATES = {
'.py': """\
# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version con... | ionelmc/setuptools_scm | setuptools_scm/__init__.py | Python | mit | 2,150 |
from django.contrib.auth.models import User
from django.test import TestCase
from django.test.client import Client
from profiles.models import Profile
from protocols.models import Protocol, Step, Action, Component
from organization.models import Organization, Membership
from workflow.models import Workflow
from exper... | Bionetbook/bionetbook | bnbapp/workflow/tests/test_views.py | Python | mit | 4,638 |
#!/usr/bin/env python
# encoding:utf-8
import os
import sys
import requests
import MySQLdb
from bs4 import BeautifulSoup
from bs4 import SoupStrainer
from config import *
base_url = 'http://download.kaoyan.com'
status = []
def get_soup(url, parse_only=None):
content = requests.get(url).content
return Beau... | ripples-alive/Crawler | kaoyan/crawl_post.py | Python | mit | 2,301 |
# Generated by Django 2.2.13 on 2020-10-25 11:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('extrequests', '0023_auto_20200818_1758'),
]
operations = [
migrations.AlterField(
model_name='selforganisedsubmission',
... | pbanaszkiewicz/amy | amy/extrequests/migrations/0024_auto_20201025_1113.py | Python | mit | 1,774 |
import sys
from setuptools import find_packages
from setuptools import setup
requirements = ['six']
if sys.version_info[0] < 3 or (sys.version_info[0] == 3 and sys.version_info[1] < 3):
requirements.append('ipaddress')
def get_long_description():
with open('README.md') as readme_file:
return readme_... | socialwifi/RouterOS-api | setup.py | Python | mit | 1,349 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ImportShardError'
db.create_table(u'osmosis_importsharderror', (
(u'id', self.gf... | potatolondon/osmosis | osmosis/migrations/0003_auto__add_importsharderror__add_field_importshard_error_csv_written.py | Python | mit | 3,540 |
"""Adds a simulated sensor."""
from __future__ import annotations
from datetime import datetime
import math
from random import Random
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import CONF_NAME
from homeassistant.core import HomeAssista... | rohitranjan1991/home-assistant | homeassistant/components/simulated/sensor.py | Python | mit | 4,845 |
#pyplot
import matplotlib.pyplot as plt
import numpy as np
x=np.arange(0,10,1)
y=np.random.randn(len(x))
plt.plot(x,y)
plt.title('pyplot')
plt.show()
#pylab
from pylab import *
x=arange(0,10,1)
y=randn(len(x))
plot(x,y)
title('random numbers')
show()
#Object Oriented
import matplotlib.pyplot as plt
import numpy as ... | csunny/blog_project | source/libs/analysis/src/10_面向对象 VS Matlab Style/lesson10.py | Python | mit | 472 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# tree2test.py - turn a directory tree into TestSCons code
#
# A quick script for importing directory hierarchies containing test
# cases that people supply (typically in a .zip or .tar.gz file) into a
# TestSCons.py script. No error checking or options yet, it just walks
# th... | datalogics/scons | bin/import-test.py | Python | mit | 2,574 |
# getbracket.py
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Jonathan Miller
#
# 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... | monocledsardine/challonge-bracket-sort | getbracket.py | Python | mit | 5,104 |
#! /usr/bin/env python
from openturns import *
TESTPREAMBLE()
RandomGenerator.SetSeed(0)
try:
# Default dimension parameter to evaluate the model
defaultDimension = 1
# Amplitude values
amplitude = NumericalPoint(defaultDimension, 1.0)
# Scale values
scale = NumericalPoint(defaultDimension,... | sofianehaddad/ot-svn | python/test/t_CauchyModel_std.py | Python | mit | 1,985 |
import unittest
from queen_attack import Queen
# Tests adapted from `problem-specifications//canonical-data.json`
class QueenAttackTest(unittest.TestCase):
# Test creation of Queens with valid and invalid positions
def test_queen_with_a_valid_position(self):
Queen(2, 2)
def test_queen_must_have... | TGITS/programming-workouts | exercism/python/queen-attack/queen_attack_test.py | Python | mit | 2,017 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 15 23:05:21 2016
@author: SISQUAKE
"""
import numpy as np
from time import time
from operator import itemgetter
from scipy.stats import randint as sp_randint
from sklearn.grid_search import RandomizedSearchCV
from sklearn.ensemble import RandomForestClassifier
from sklea... | BrakeValve/dataflow | model/random-forest-model.py | Python | mit | 2,977 |
from chainer import utils
class Initializer(object):
"""Initializes array.
It initializes the given array.
Attributes:
dtype: Data type specifier. It is for type check in ``__call__``
function.
"""
def __init__(self, dtype=None):
self.dtype = dtype
def __call__... | jnishi/chainer | chainer/initializer.py | Python | mit | 1,288 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/cinderclient/tests/unit/v1/test_auth.py | Python | mit | 12,502 |
#!/usr/bin/env python3
"""
This is an example of how the pytradfri-library can be used async.
To run the script, do the following:
$ pip3 install pytradfri
$ Download this file (example_async.py)
$ python3 example_async.py <IP>
Where <IP> is the address to your IKEA gateway. The first time
running you will be asked t... | rubenbe/pytradfri | examples/example_async.py | Python | mit | 5,158 |
"""Test the module edited nearest neighbour."""
# Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com>
# Christos Aridas
# License: MIT
import pytest
import numpy as np
from sklearn.utils._testing import assert_array_equal
from sklearn.datasets import make_classification
from sklearn.neighbors import Neares... | fmfn/UnbalancedDataset | imblearn/under_sampling/_prototype_selection/tests/test_edited_nearest_neighbours.py | Python | mit | 4,413 |
-
def aaa(bbb):
# ...
-
| chris-j-tang/GLS | test/integration/FunctionStart/one parameter return void.py | Python | mit | 28 |
#!/bin/python
# Copyright (c) 2015, Yaroslav Ganin (yaroslav.ganin@gmail.com)
# 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 ... | chen1474147/Deep3DPose-1-skel | 5-caffe/examples/adaptation/scripts/prepare_dirs.py | Python | mit | 5,464 |
import heapq
import numpy
from chainer import cuda
from chainer import flag
class Variable(object):
"""Array with a structure to keep track of computation.
Every variable holds a data array of type either :class:`numpy.ndarray` or
:class:`cupy.ndarray`.
A Variable object may be constructed in two... | truongdq/chainer | chainer/variable.py | Python | mit | 13,080 |
import CoolProp
import pandas
import six
grouping = dict()
grouping2 = []
# Group aliases
for parameter in CoolProp.get('parameter_list').split(','):
index = CoolProp.CoolProp.get_parameter_index(parameter)
units = CoolProp.CoolProp.get_parameter_information(index, 'units').replace('-', ' ')
IO = CoolProp.... | henningjp/CoolProp | Web/scripts/coolprop.parametric_table.py | Python | mit | 1,765 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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 License, or
# (at your option) any later version.
#
# This progra... | 0vercl0k/rp | src/third_party/beaengine/tests/0f3896.py | Python | mit | 4,295 |
# -*- coding: utf-8 -*-
import os
import sys
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt # noqa: E402
def style(s, style):
return style + s + '\033[0m'
def green(s):
return style(s, '\033[92m')
def blue(s):
return... | ccxt/ccxt | examples/py/arbitrage-pairs.py | Python | mit | 3,562 |
## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# fetch values from package.xml
setup_args = generate_distutils_setup(
packages=['sensor_stick'],
package_dir={'': 'src'})
setup(**se... | squared9/Robotics | Robotic_PR2_3D_Perception_Pick_And_Place/sensor_stick/setup.py | Python | mit | 330 |
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.paginator import (
EmptyPage,
Paginator,
)
from django.core.urlresolvers import reverse
from django.db.models import Count
from django.shortcuts import (
... | makyo/honeycomb | submissions/folder_views.py | Python | mit | 9,948 |
import datetime
import redis
import time
import urlparse
import beaver.transport
from beaver.transport import TransportException
class RedisTransport(beaver.transport.Transport):
def __init__(self, beaver_config, file_config, logger=None):
super(RedisTransport, self).__init__(beaver_config, file_config,... | Appdynamics/beaver | beaver/redis_transport.py | Python | mit | 1,705 |
#!/usr/env python3
from setuptools import setup, find_packages
setup(
) | JShadowMan/package | python/setup.py | Python | mit | 84 |
# sqlalchemy/__init__.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
import inspect
import sys
import sqlalchemy.exc as exceptions
from sqlalchemy... | aurofable/medhack-server | venv/lib/python2.7/site-packages/sqlalchemy/__init__.py | Python | mit | 2,015 |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
# class Solution(object):
# def reverseKGroup(self, head, k):
# """
# :type head: ListNode
# :type k: int
# :rtype: ListNode
# """
cl... | qiyuangong/leetcode | python/025_Reverse_Nodes_i_ k-Group.py | Python | mit | 1,145 |
"""
Evaluating derivatives.
"""
# TODO:
# Include error estimates for each method?
def forward_difference(f, x, h):
"""
Evaluates the first derivative at x, with step size h, using a forward
difference scheme.
@type f: function
@param f: function to differentiate
@type x: number
@par... | pauljxtan/mathsci | souffle/math/derivative.py | Python | mit | 3,298 |
#### 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 = Static()
result.template = "object/static/item/shared_wp_mle_axe_vibroax.iff"
result.attribute_template_id = -1
... | anhstudios/swganh | data/scripts/templates/object/static/item/shared_wp_mle_axe_vibroax.py | Python | mit | 443 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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 License, or
# (at your option) any later version.
#
# This progra... | 0vercl0k/rp | src/third_party/beaengine/tests/0ffc.py | Python | mit | 4,010 |
"""
Functions for triggering and responding to server side events
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.conf import settings
from django.db import transaction
from django.db.models.signals import post_save, post_delete
from django.dispatch.dispatcher import re... | inventree/InvenTree | InvenTree/plugin/events.py | Python | mit | 4,555 |
import sys
import unittest
from samplify import si
from samplify import imperial
class ImperialTest(unittest.TestCase):
def setUp(self):
self.foot = imperial.ImperialDistance(feet = 1)
self.foot_in_cm = si.Measure(30.48, 'c',si.BaseUnits.m)
self.foot_in_inches = imperial.ImperialDistance(inches = 12)
self.fo... | BennettRand/Measurements | samplify/test/imperial.py | Python | mit | 1,617 |
class Tile:
def describe(self):
print("You push through the undergrowth - "
"the path is overgrown but continues on...")
def action(self, player, do):
# Nothing to do here yet.
print("Sorry, I don't understand")
def leave(self, player, direction):
restricted... | jantuomi/weatbag | weatbag/tiles/s1.py | Python | mit | 710 |
# 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-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/backup_protected_items_operations.py | Python | mit | 5,112 |
"""
Test program for Data Bootcamp course @ NYU Stern
"""
def pocket_change(P, N, D, Q):
value = .01*P + .05*N + .1*D + .25*Q
return value
change = pocket_change(1, 2, 3, 4)
print (change)
| NYUDataBootcamp/Materials | Code/Python/messing_around.py | Python | mit | 198 |
#!/usr/bin/env python
"""
Let's teach the Robots to distinguish words and numbers.
You are given a string with words and numbers separated by whitespaces (one space). The words contains only letters.
You should check if the string contains three words in succession. For example, the string "start 5 one two three 7
en... | marshallhumble/Euler_Groovy | CheckIO/Elementary/8_Three_Words.py | Python | mit | 1,297 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('lan', '0002_auto_20150107_2031'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
... | CasualGaming/studlan | apps/seating/migrations/0001_initial.py | Python | mit | 1,936 |
# file openpyxl/shared/__init__.py
# Copyright (c) 2010-2011 openpyxl
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use,... | Jian-Zhan/customarrayformatter | openpyxl/shared/__init__.py | Python | mit | 1,662 |
#!/usr/bin/python
import urllib
import sys
from HTMLParser import HTMLParser
import logging
def get_cp(txtCommune,cdep=None):
params = urllib.urlencode({'txtCommune':txtCommune, 'selCritere':'CP'})
f = urllib.urlopen('http://www.laposte.fr/sna/rubrique.php3?id_rubrique=59&recalcul=oui', params)
reponse ... | Symfomany/Horus | py/insee.py | Python | mit | 1,729 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'State'
db.create_table(u'countylimits_state', (
... | fna/owning-a-home-api | countylimits/migrations/0001_initial.py | Python | cc0-1.0 | 3,719 |
'''
Example of a spike generator (only outputs spikes)
In this example spikes are generated and sent through UDP packages. At the end of the simulation a raster plot of the
spikes is created.
'''
from brian import *
import numpy
from brian_multiprocess_udp import BrianConnectUDP
def main_NeuronGroup(input_Neuron_... | ricardodeazambuja/BrianConnectUDP | examples/InputNeuronGroup_multi_v3.py | Python | cc0-1.0 | 2,026 |
#
# Copyright 2007-2010 Zuza Software Foundation
#
# This file is part of the Translate Toolkit.
#
# 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 ... | nijel/translate | translate/storage/wordfast.py | Python | gpl-2.0 | 15,188 |
import os
import time
import random
from boxbranding import getMachineBrand, getMachineName
from enigma import iPlayableService, eTimer, eServiceCenter, iServiceInformation, ePicLoad, eServiceReference
from ServiceReference import ServiceReference
from Screens.Screen import Screen
from Screens.HelpMenu import Helpabl... | sklnet/openatv-enigma2 | lib/python/Plugins/Extensions/MediaPlayer/plugin.py | Python | gpl-2.0 | 43,649 |