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 |
|---|---|---|---|---|---|
"""
Form components for working with trees.
"""
from __future__ import unicode_literals
from django import forms
from django.forms.forms import NON_FIELD_ERRORS
from django.forms.util import ErrorList
try:
from django.utils.encoding import smart_text
except ImportError:
from django.utils.encoding import smart_u... | holachek/ecosense | app/mptt/forms.py | Python | mit | 7,159 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... | googleads/google-ads-python | google/ads/googleads/v9/enums/types/click_type.py | Python | apache-2.0 | 2,994 |
from setuptools import setup, Extension
from os.path import join as pjoin
from os.path import dirname
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in bel... | pombredanne/or-tools | tools/setup_py3.py | Python | apache-2.0 | 2,291 |
import random
from direct.directnotify import DirectNotifyGlobal
from otp.otpbase import OTPLocalizer
from toontown.toonbase import TTLocalizer
notify = DirectNotifyGlobal.directNotify.newCategory('SuitDialog')
def getBrushOffIndex(suitName):
if SuitBrushOffs.has_key(suitName):
brushoffs = SuitBrushOffs[su... | ksmit799/Toontown-Source | toontown/suit/SuitDialog.py | Python | mit | 892 |
from instal.firstprinciples.TestEngine import InstalSingleShotTestRunner, InstalTestCase
from instal.instalexceptions import InstalTestNotImplemented
class InstalTraceText(InstalTestCase):
def test_trace_text_runs(self):
raise InstalTestNotImplemented
| cblop/tropic | instal-linux/instal/firstprinciples/tracers/TestInstalTraceText.py | Python | epl-1.0 | 266 |
# Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | pombredanne/catawampus | tr/cwmpdate.py | Python | apache-2.0 | 1,898 |
'''
Suport for materials
'''
from material import *
| andykee/pyoptools | pyoptools/raytrace/mat_lib/__init__.py | Python | bsd-3-clause | 52 |
import logging
from yatcobot.plugins.notifiers import NotifierABC
logger = logging.getLogger(__name__)
class NotificationService:
def __init__(self):
self.active_notifiers = NotifierABC.get_enabled()
def send_notification(self, title, message):
"""Sends a message to all enabled notifiers""... | buluba89/Yatcobot | yatcobot/notifier.py | Python | gpl-2.0 | 577 |
# -*- coding: utf-8 -*-
"""
sphinx.ext.autosummary
~~~~~~~~~~~~~~~~~~~~~~
Sphinx extension that adds an autosummary:: directive, which can be
used to generate function/method/attribute/etc. summary lists, similar
to those output eg. by Epydoc and other API doc generation tools.
An :autolink: r... | shadowmint/nwidget | lib/pyglet-1.4.4/doc/ext/autosummary/__init__.py | Python | apache-2.0 | 17,735 |
# -*- coding: utf-8 -*-
import unittest
from dialogue_system.language_understanding.attribute_extraction.rule_based_extractor import RuleBasedAttributeExtractor
class AttributeExtractorTest(unittest.TestCase):
def setUp(self):
self.extractor = RuleBasedAttributeExtractor()
def tearDown(self):
... | syugoing/communication | tests/language_understanding/attribute_extraction/extractor_test.py | Python | mit | 868 |
# Copyright 2016 Casey Jaymes
# This file is part of Expatriate.
#
# Expatriate is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.... | cjaymes/expatriate | src/expatriate/model/xs/DayTimeDurationType.py | Python | lgpl-3.0 | 1,473 |
"""
============================================================
Reconstruction of the diffusion signal with the Tensor model
============================================================
The diffusion tensor model is a model that describes the diffusion within a
voxel. First proposed by Basser and colleagues [Basser1... | StongeEtienne/dipy | doc/examples/reconst_dti.py | Python | bsd-3-clause | 9,303 |
from enigma import eEPGCache
from Components.Converter.Converter import Converter
from Components.Element import cached
from Components.Converter.genre import getGenreStringSub
class EventName(Converter, object):
NAME = 0
SHORT_DESCRIPTION = 1
EXTENDED_DESCRIPTION = 2
FULL_DESCRIPTION = 3
ID = 4
NAME_NOW = 5
... | mrnamingo/vix4-34-enigma2-bcm | lib/python/Components/Converter/EventName.py | Python | gpl-2.0 | 6,169 |
from .models import Experiment
from django.test import TestCase
class ExperimentTest(TestCase):
def setUp(self):
self.experiment = Experiment.objects.create(
name = 'Example Experiment',
slug = 'example')
self.event_1 = self.experiment.event_set.create(
extra_d... | mysociety/pombola | pombola/experiments/tests.py | Python | agpl-3.0 | 737 |
import ew
class Include(ew.Widget):
template='jinja:allura:templates/widgets/include.html'
params=['artifact', 'attrs']
artifact=None
attrs = {
'style':'width:270px;float:right;background-color:#ccc'
}
class DownloadButton(ew.Widget):
template='jinja:allura:templates/widgets/downlo... | Bitergia/allura | Allura/allura/lib/widgets/macros.py | Python | apache-2.0 | 574 |
# -*- coding: utf-8 -*-
__author__ = 'eso'
import sys
sys.path.append('../../')
from tools.petscan import PetScan
import re
import requests
import pywikibot
test_sites = ['Edda',
'Edda/Erläuterungen/Anmerkungen']
sites = ['Edda/Erläuterungen/Einleitung',
'Edda/Register',
'Edda/Snorra-E... | the-it/WS_THEbotIT | archive/online/2015/150810_Edda_delete.py | Python | mit | 2,429 |
"""
LandmarkTransformationTool (TransformationTool)
:Authors:
Berend Klein Haneveld
"""
from Landmark import Landmark
from TransformationTool import TransformationTool
from ui.widgets.PointsWidget import PointsWidget
from ui.widgets.StatusWidget import StatusWidget
from ui.transformations.TwoStepPicker import TwoStep... | berendkleinhaneveld/Registrationshop | ui/transformations/LandmarkTransformationTool.py | Python | mit | 13,675 |
"""
Solve the catalysis problem using mcmc.
Author:
Ilias Bilionis
Date:
6/26/2014
"""
import matplotlib
matplotlib.use('Agg')
import numpy as np
import mpi4py.MPI as mpi
import pymc as pm
import pysmc as ps
import sys
import warnings
warnings.filterwarnings('ignore')
sys.path.insert(0,'.')
sys.path.insert(... | ebilionis/variational-reformulation-of-inverse-problems | unittests/mcmc_catalysis_dmnl.py | Python | gpl-2.0 | 1,449 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import frappe, erpnext
from frappe.utils import cint, cstr, formatdate, flt, getdate, nowdate, get_link_to_form
from frappe impo... | ESS-LLP/erpnext | erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py | Python | gpl-3.0 | 50,618 |
# coding: utf-8
from __future__ import unicode_literals
import datetime
from decimal import Decimal
from hashlib import sha1
from time import time
from uuid import UUID
from django.contrib.postgres.functions import TransactionNow
from django.db import connections
from django.db.models import QuerySet, Subquery, Exist... | BertrandBordage/django-cachalot | cachalot/utils.py | Python | bsd-3-clause | 6,617 |
# This file is part of jenkins-epo
#
# jenkins-epo 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 any later version.
#
# jenkins-epo is distributed in the hope that it will... | novafloss/jenkins-github-poller | jenkins_epo/extensions/jenkins.py | Python | gpl-3.0 | 15,293 |
###############################################################################
##
## Copyright (c) Crossbar.io Technologies GmbH
##
## 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... | tavendo/AutobahnTestSuite | autobahntestsuite/autobahntestsuite/case/case5_2.py | Python | apache-2.0 | 1,372 |
# -*- coding: utf-8 -*-
"""
conpaas.core.expose
===================
ConPaaS core: expose http methods.
:copyright: (C) 2010-2013 by Contrail Consortium.
"""
exposed_functions = {}
def expose(http_method):
"""
Exposes http methods methods.
:param func: Function to be exposed
:ty... | mihaisoloi/conpaas | conpaas-services/src/conpaas/core/expose.py | Python | bsd-3-clause | 715 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
# Url Patterns from the root.
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^aboutme/', 'blog.views.aboutme'),
url(r'^contact/', 'blog.views.contact'),
url(r'^$', 'blog.views.index'),
... | vikrampriya/portfolio | portfolio/urls.py | Python | mit | 372 |
"""
Utils.
"""
import copy
from collections import OrderedDict
import inflection
from django.conf import settings
from django.utils import six
from django.utils.module_loading import import_string as import_class_from_dotted_path
from django.utils.translation import ugettext_lazy as _
from rest_framework.exceptions im... | leo-naeka/django-rest-framework-json-api | rest_framework_json_api/utils.py | Python | bsd-2-clause | 8,634 |
from django.db import models
from django.utils import timezone
# For teammate manager and modification of Django's base user auth system
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager
# Manager class that instantiates the creation of a new teammate
# source (i think): http:/... | ethanperez/t4k-rms | riders/models.py | Python | mit | 4,366 |
def main():
pass
def handle_result(args, result, target_window_id, boss):
boss.active_tab.neighboring_window(args[1])
handle_result.no_ui = True
| sethwoodworth/XDG_CONFIG_HOME | kitty/neighboring_window.py | Python | gpl-2.0 | 157 |
import sys
from csv_data import Data
from csv_utilities import readIntegerCSV
from csv_utilities import convertToZeroOne
from statistics import mean
from math import log
def dotProduct( arr1, arr2 ):
return sum( [ arr1[idx] * arr2[idx] for idx in range( len( arr1 ) ) ] )
#
def dataSubsetWithY( data, y ):
return [ r... | CKPalk/MachineLearning | Assignment3/Naive_Bayes/nb.py | Python | mit | 2,586 |
#!/usr/bin/env python3
import os
import unittest
import logging
from rdflib import URIRef
from dipper import curie_map
from dipper.graph.RDFGraph import RDFGraph
from dipper.utils.CurieUtil import CurieUtil
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
class RDFGraphTestCase(unittest... | TomConlin/dipper | tests/test_rdfgraph.py | Python | bsd-3-clause | 7,490 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-securitycenter | samples/generated_samples/securitycenter_v1_generated_security_center_create_source_async.py | Python | apache-2.0 | 1,502 |
# Copyright (C) 2013 ABRT Team
# Copyright (C) 2013 Red Hat, Inc.
#
# This file is part of faf.
#
# faf 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) ... | patriczek/faf | src/pyfaf/repos/__init__.py | Python | gpl-3.0 | 1,798 |
import json
import string
import random
from proxy.request import send_request, Request
from proxy.response import Response
from resources.base import Resource
class SSPRResource(Resource):
def __init__(self, service):
super().__init__(service)
self.service = service
def multiple_sspr_random... | MicroFocus/CX | middle_tier/plugins/sspr/password.py | Python | mit | 1,409 |
from __future__ import print_function
import numpy as np
import plfit
import pylab as plt
nel = 2000
alpha = 2.5
xmin = 1.0
data_prob = np.random.rand(nel)
data = plfit.plexp_inv(data_prob, xmin, alpha)
inds = np.argsort(data)
data_prob = data_prob[inds]
data = data[inds]
xdata = np.logspace(-2,2,10000)
plt.figure(1... | giserh/plfit | plfit/tests/distribution_sanity_check.py | Python | mit | 1,762 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | SKIRT/PTS | core/launch/launcher.py | Python | agpl-3.0 | 37,871 |
__all__ = ['Tick']
class Tick(object):
'''Tick Class.
A new Tick object is instantiated every tick by BehaviorTree. It is passed
as parameter to the nodes through the tree during the traversal.
The role of the Tick class is to store the instances of tree, debug, target
and blackboard. So, all nod... | renatopp/behavior3py | b3/core/tick.py | Python | mit | 2,005 |
import numpy as np
import pytest
from pandas.core.dtypes.dtypes import PeriodDtype
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import period_array
@pytest.mark.parametrize("dtype", [int, np.int32, np.int64, "uint32", "uint64"])
def test_astype(dtype):
# We choose to ignore the sign ... | rs2/pandas | pandas/tests/arrays/period/test_astype.py | Python | bsd-3-clause | 2,421 |
"""
Testing join operations.
"""
import unittest
class TestJoin(unittest.TestCase):
def __init__(self, methodName='runTest'):
unittest.TestCase.__init__(self, methodName)
`Foo(int a, int b).
Bar(int a, int b).`
`Foo(a,b) :- a=$range(0, 5), b=$range(0,3).`
# Foo(a,b) = ... | ofermend/medicare-demo | socialite/test/test_joins.py | Python | apache-2.0 | 7,084 |
#bolttools - a framework for creation of part libraries
#Copyright (C) 2013 Johannes Reinhardt <jreinhardt@ist-dein-freund.de>
#
#This library is free software; you can redistribute it and/or
#modify it under the terms of the GNU Lesser General Public
#License as published by the Free Software Foundation; either
#versi... | berndhahnebach/BOLTS | backends/solidworks.py | Python | gpl-3.0 | 3,874 |
# coding:utf-8
import json
import socket
import datetime
import redis
from logger.log import crawler
from config.conf import (
get_redis_args,
get_share_host_count,
get_running_mode,
get_cookie_expire_time
)
mode = get_running_mode()
redis_args = get_redis_args()
share_host_count = get_share_host_coun... | Danceiny/HackGirlfriend | Spider/WeiboSpider/db/redis_db.py | Python | apache-2.0 | 6,338 |
# Licensed to the Apache Software Foundation (ASF) 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 ... | apache/libcloud | libcloud/dns/drivers/auroradns.py | Python | apache-2.0 | 21,120 |
"""Document class, read document, clean document, get terms."""
import uuid
import string
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
from collections import Counter
class Document(object):
def __init__(self, path, r_d, r_p):
print path
self.path = path
self._... | bwanglzu/inverted-index.py | inverted_index/document.py | Python | mit | 2,490 |
#!/usr/bin/python
#============================ adjust path =====================================
import sys
import os
if __name__ == "__main__":
here = sys.path[0]
sys.path.insert(0, os.path.join(here, '..', '..','libs'))
sys.path.insert(0, os.path.join(here, '..', '..','external_libs'))
#==============... | realms-team/basestation-fw | libs/smartmeshsdk-REL-1.3.0.1/app/PublishToWeb/PublishToWeb.py | Python | bsd-3-clause | 4,295 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name="index"),
url(r'^signin/$', views.signin, name='signin'),
url(r'^create_user/(?P<user_id>[0-9]+)/(?P<user_class>\
([a-z])+)$', views.create_new_user, \
name='new_user'),
url(r'^time... | meain/bridge | docs/report/urls.py | Python | mit | 1,263 |
"""PID Fetchers."""
from collections import namedtuple
from ..providers.docid import DocUUIDProvider
FetchedPID = namedtuple('FetchedPID', ['provider', 'pid_type', 'pid_value'])
def cernopendata_docid_fetcher(record_uuid, data):
"""Fetch a article's identifiers."""
return FetchedPID(
provider=DocUU... | tiborsimko/opendata.cern.ch | cernopendata/modules/records/fetchers/docid.py | Python | gpl-2.0 | 423 |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.admin.utils import quote
from django.contrib.contenttypes.models import ContentType
try:
from django.urls import NoReverseMatch, reverse
except ImportError:
from django.core.urlresolvers import NoReverseMatch, reverse... | shtalinberg/django-actions-logger | actionslog/models.py | Python | mit | 10,371 |
# Copyright (C) 2005, Todd Whiteman
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in... | toddw-as/pySIM | pySIMskin.py | Python | gpl-3.0 | 6,174 |
while True:
phase = int(input("주사위 면의 개수를 입력하세요 : "))
if phase in [4, 6, 8, 12, 20]:
박세훈 = 2
while 박세훈 >= 0:
if 박세훈 == 2:
dice1 = int(input("플레이어가 던질 주사위의 개수를 입력하세요 : "))
a=[]
while dice1 > 0:
a.append(random.randint(1,int(phase)))
dice1 = dice1-1
print("플레이어가 주사위를 던진 결과의 리스트 : "+str(... | imn00133/pythonSeminar17 | exercise/dicegame/Sehun/08_21_dicegame1-4.py | Python | mit | 1,144 |
#!/usr/bin/env python
#
# 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.
"""Process Android library resources to generate R.java and crunched images."""
import optparse
import os
import subprocess
BU... | matsumoto-r/synciga | src/build/android/process_resources.py | Python | bsd-3-clause | 3,264 |
#!/usr/bin/python
# (c) 2012, Elliott Foster <elliott@fourkitchens.com>
# Sponsored by Four Kitchens http://fourkitchens.com.
# (c) 2014, Epic Games, Inc.
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__m... | maxamillion/ansible | test/support/integration/plugins/modules/mongodb_user.py | Python | gpl-3.0 | 16,253 |
import core.job
import core.implant
import uuid
class EnableRDesktopJob(core.job.Job):
def done(self):
self.display()
def display(self):
pass
#self.shell.print_plain(str(self.errno))
class EnableRDesktopImplant(core.implant.Implant):
NAME = "Enable Remote Desktop"
DESCRIPTION... | TheNaterz/koadic | modules/implant/manage/enable_rdesktop.py | Python | apache-2.0 | 1,013 |
import os.path
link_download2="http://www.nyaa.se/?page=download&tid=540649"
rss_anime_koi="http://www.nyaa.se/?page=rss&user=176350"
#using feedparser
import feedparser
import urllib2
#unziped the gziped torrent
import gzip,urllib2,StringIO
#open rss of dengkun
d = feedparser.parse(rss_anime_koi)
#save path to... | weric/NyaaSeParser | get_copy.py | Python | apache-2.0 | 3,870 |
#!/bin/python3
import sys
import itertools
def is_beautiful(s):
"""
Are the splits in `s` beautiful?
"""
leading_zeros = [d[0] == '0' for d in s]
increasing = [int(s[i - 1]) + 1 == int(s[i]) for i in range(1, len(s))]
res = not any(leading_zeros) and all(increasing)
if res: # match, look ... | JuanCTorres/interview-prep-solutions | hackerrank/src/algorithms/strings/separate_the_numbers.py | Python | mit | 2,395 |
"""
Manage ECM Accounts.
"""
import collections
import shellish
from . import base
class Formatter(object):
terse_table_fields = (
(lambda x: x['name'], 'Name'),
(lambda x: x['id'], 'ID'),
(lambda x: len(x['groups']), 'Groups'),
(lambda x: x['customer']['customer_name'], 'Custome... | mayfield/ecmcli | ecmcli/commands/accounts.py | Python | mit | 10,177 |
from django.template import RequestContext
from django.utils.timezone import now
from django.views.decorators.cache import cache_control
from bulbs.content.views import ContentListView
class RSSView(ContentListView):
"""Really simply, this syndicates Content."""
template_name = "feeds/rss.xml"
paginate_b... | pombredanne/django-bulbs | bulbs/feeds/views.py | Python | mit | 1,729 |
#!/usr/bin/env python
# Copyright (C) 2009-2010:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
# This file is part of Shinken.
#
# Shinken 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 F... | rledisez/shinken | test/test_snapshot.py | Python | agpl-3.0 | 2,317 |
"""
Set up the plot figures, axes, and items to be done for each frame.
This module is imported by the plotting routines and then the
function setplot is called to set the plot parameters.
"""
#--------------------------
def setplot(plotdata):
#--------------------------
"""
Specify what is to be plott... | torrilhon/MyClawpack | examples/stokes_2d_drivencavity/setplot.py | Python | gpl-3.0 | 3,642 |
from typing import cast
from hedgehog.utils import protobuf
from ..proto import hedgehog_pb2
__all__ = ['Message', 'SimpleMessage', 'ContainerMessage', 'RequestMsg', 'ReplyMsg']
class Message(protobuf.Message):
is_async = False
@classmethod
def msg_name(cls):
module, name = cls.__module__, cls.... | PRIArobotics/HedgehogProtocol | hedgehog/protocol/messages/__init__.py | Python | agpl-3.0 | 1,018 |
# 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
# d... | openstack/os-vif | os_vif/plugin.py | Python | apache-2.0 | 3,032 |
import mock, pytest, requests
from pytest_mock import mocker
from holiday_bot import nlp, slackbot_settings
def test_attempts_request(mocker):
mocker.patch('requests.get')
nlp.query(3, 'Text to parse...')
requests.get.assert_called_once_with('https://api.api.ai/api/query', headers={'Authorization': 'Beare... | gytdau/holiday-thingy | tests/test_nlp.py | Python | mit | 440 |
# 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... | dtroyer/python-openstacksdk | openstack/cloud/openstackcloud.py | Python | apache-2.0 | 31,888 |
from diktya.random_search import fmin
import numpy as np
def quadratic_function(x):
return (x - 2) ** 2
def space_function():
return np.random.uniform(-2, 4)
def test_fmin():
results = fmin(quadratic_function, space_function, n=50, verbose=1)
val, space = results[0]
print(val, space)
asser... | BioroboticsLab/diktya | tests/test_random_search.py | Python | apache-2.0 | 333 |
"""
Interface between pybedtools and the R package VennDiagram.
Rather than depend on the user to have rpy2 installed, this simply writes an
R script that can be edited and tweaked by the user before being run in R.
"""
import os
import string
import pybedtools
from pybedtools import helpers
import subprocess
from col... | jos4uke/getSeqFlankBlatHit | lib/python2.7/site-packages/pybedtools/contrib/venn_maker.py | Python | gpl-2.0 | 7,663 |
#
# Created by: Pearu Peterson, March 2002
#
""" Test functions for scipy.linalg.matfuncs module
"""
from __future__ import division, print_function, absolute_import
import math
import numpy as np
from numpy import array, eye, exp, random
from numpy.linalg import matrix_power
from numpy.testing import (
asse... | Eric89GXL/scipy | scipy/sparse/linalg/tests/test_matfuncs.py | Python | bsd-3-clause | 20,275 |
# -*- encoding: utf-8 -*-
# Copyright (c) 2016 Intel Corp
#
# Authors: Prudhvi Rao Shedimbi <prudhvi.rao.shedimbi@intel.com>
#
# 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.apa... | openstack/watcher | watcher/conf/neutron_client.py | Python | apache-2.0 | 1,608 |
from shopify_service import ShopifyService
from shop_service import ShopService
from config_service import ConfigService
from plan_service import PlanService | BootstrapHeroes/django-shopify | django_shopify/shopify_app/services/__init__.py | Python | gpl-3.0 | 157 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generate-plugin.py - pluma plugin skeletton generator
# This file is part of pluma
#
# Copyright (C) 2006 - Steve Frécinaux
#
# pluma 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... | sc0w/pluma | tools/generate-plugin.py | Python | gpl-2.0 | 5,946 |
# Generated by Django 2.2.4 on 2019-10-29 04:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tagging', '0007_auto_20191029_0434'),
]
operations = [
migrations.AlterModelOptions(
name='category',
options={'orde... | jeromecc/doctoctocbot | src/tagging/migrations/0008_auto_20191029_0518.py | Python | mpl-2.0 | 557 |
import logging
# https://github.com/jedie/pathlib_revised/
from pathlib_revised import Path2
# https://github.com/jedie/PyHardLinkBackup
from pyhardlinkbackup.backup_app.models import BackupEntry
from pyhardlinkbackup.phlb.config import phlb_config
from pyhardlinkbackup.phlb.path_helper import rename2temp
log = logg... | jedie/PyHardlinkBackup | pyhardlinkbackup/phlb/deduplicate.py | Python | gpl-3.0 | 2,979 |
from django.contrib import admin
from blog.forms import EntryAdminForm
from blog.models import Entry
class EntryAdmin(admin.ModelAdmin):
list_display = ('title', 'created_at', 'created_by', 'status', 'is_micro')
list_display_links = ('created_at', 'title')
list_filter = ('status', 'created_at')
form = EntryAdminF... | SushiTee/teerace | teerace/blog/admin.py | Python | bsd-3-clause | 1,115 |
""" URL definitions for the verify_student app. """
from django.conf import settings
from django.conf.urls import patterns, url
from lms.djangoapps.verify_student import views
urlpatterns = patterns(
'',
# The user is starting the verification / payment process,
# most likely after enrolling in a course... | miptliot/edx-platform | lms/djangoapps/verify_student/urls.py | Python | agpl-3.0 | 4,037 |
import discord
import csv
from discord.ext import commands
from tabulate import tabulate
from models.character import Character
from models.server_settings import ServerSettings
from utils import *
class General(commands.Cog):
"""General commands."""
def __init__(self, bot):
self.bot = bot
@com... | pachev/gsbot | cogs/general.py | Python | mit | 4,517 |
import time
time.sleep(0.25)
contents = clipboard.get_selection()
if len(contents) > 20:
title = contents[0:17] + "..."
else:
title = contents
folder = engine.get_folder("My Phrases")
engine.create_phrase(folder, title, contents) | andresgomezvidal/autokey_scripts | data/Scripts/Sample_Scripts/Phrase from selection.py | Python | mit | 237 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2013 Dariusz Suchojad <dsuch at zato.io>
Licensed under the BSD 3-clause license, see LICENSE.txt for terms and conditions.
"""
#
# * Django-like Redis pagination - a drop-in replacement except for the __init__ method.
#
# * Originally part of Zato - ESB, SOA and cloud integ... | zatosource/zato-redis-paginator | src/zato/redis_paginator/__init__.py | Python | bsd-3-clause | 4,457 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is a skeleton file that can serve as a starting point for a Python
console script. To run this script uncomment the following line in the
entry_points section in setup.cfg:
console_scripts =
fibonacci = openchat.skeleton:run
Then run `python setup.py ins... | totalgood/twote | openchat/skeleton.py | Python | mit | 2,865 |
from . import db
class Service(db.Model):
__tablename__ = 'service'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False, unique=True)
def __init__(self, name):
self.name = name
def __repr__(self):
return '<Service %r>' % self.name
def __s... | gaeun/open-event-orga-server | app/models/service.py | Python | gpl-3.0 | 430 |
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
### BEGIN LICENSE
# Copyright (C) 2010-2012 Kevin Mehall <km@kevinmehall.net>
#This program is free software: you can redistribute it and/or modify it
#under the terms of the GNU General Public License version 3, as published
#by the Free Software Foundati... | kyleshrader/pithos | pithos/plugins/mediakeys.py | Python | gpl-3.0 | 3,626 |
import numpy as np
data = np.loadtxt('ecoli.csv', delimiter=',')
t_experiment = data[:,0]
N_experiment = data[:,1]
def error(p):
r = p[0]
T = 1200 # cell can divide after T sec
t_max = 5*T # 5 generations in experiment
t = np.linspace(0, t_max, len(t_experiment))
dt = (t[1] - t[0])
N = np... | CompPhysics/MachineLearning | doc/src/How2ReadData/src/ecoli_inverse.py | Python | cc0-1.0 | 659 |
from collections import defaultdict, namedtuple
AclPermission = namedtuple('AclPermission', 'app, action')
# Null rule. Only useful in tests really as no access group should have this.
NONE = AclPermission('None', 'None')
# A special wildcard permission to use when checking if someone has access to
# any admin, or... | bqbn/addons-server | src/olympia/constants/permissions.py | Python | bsd-3-clause | 10,108 |
# -*- coding: utf-8 -*-
"""
.. _tut-artifact-overview:
Overview of artifact detection
==============================
This tutorial covers the basics of artifact detection, and introduces the
artifact detection tools available in MNE-Python.
.. contents:: Page contents
:local:
:depth: 2
We begin as always by i... | Teekuningas/mne-python | tutorials/preprocessing/plot_10_preprocessing_overview.py | Python | bsd-3-clause | 11,726 |
# coding=utf-8
from .tokenizer import tokenize
from collections import defaultdict, Counter
from operator import attrgetter
import sys
from tqdm import tqdm
class keydefaultdict(defaultdict):
def __missing__(self, key):
ret = self[key] = self.default_factory(key)
return ret
class Utterance:
... | jekbradbury/revtok | revtok/subwords.py | Python | mit | 5,913 |
# Copyright 2016 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 ctypes
import ctypes.util
import logging
import os
import platform
import sys
import time
import threading
GET_TICK_COUNT_LAST_NOW = 0
# If GET_TICK... | SummerLW/Perf-Insight-Report | tools/py_trace_event/py_trace_event/trace_time.py | Python | bsd-3-clause | 6,948 |
"""
Python Zendesk is wrapper for the Zendesk API. This library provides an
easy and flexible way for developers to communicate with their Zendesk
account in their application.
Notes:
API THROTTLE is not handled in this library:
From Zendesk: The throttle will be applied once an API consume... | concordusapps/zendesk-python3 | zendesk/zendesk.py | Python | mit | 9,282 |
import sys
from setuptools import setup
__version__ = ''
with open('streak_client/__init__.py') as inp:
for line in inp:
if (line.startswith('__version__')):
exec(line.strip())
break
setup( name='streak_client',
version= __version__,
description='simple flat client class for streak.com... | mehmetg/streak_client | setup.py | Python | mit | 1,702 |
class ToolkitTask(object):
'''
A base class for provisioning and configuration operations that
should be executed by the task service.
To support pause and resume workflow, every ToolkitTask should
provide a serializable 'params' dict which contains all the details
it requires to execute w... | pathbreak/linode-cluster-toolkit | lct/tasks/toolkit_task.py | Python | mit | 2,022 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from scrapy.exceptions import DropItem
class PrecioPipeline(object):
impuesto = 18.0
def process_item(self, item, spider):
if item['precio']:
if item['precio_sin_tasa']:
item['precio'] = item['precio'] * self.impuesto
... | francrodriguez/scrapy-FrancRodriguez | ejemplos/pipeline.py | Python | lgpl-3.0 | 429 |
import errno
import os
import sys
import time
import traceback
import types
import warnings
from eventlet.green import BaseHTTPServer
from eventlet.green import socket
from eventlet.green import urllib
from eventlet import greenio
from eventlet import greenpool
from eventlet import support
from eventlet.support import... | sbadia/pkg-python-eventlet | eventlet/wsgi.py | Python | mit | 32,722 |
# Copyright 2013 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.
"""Setup for instrumentation host-driven tests."""
import logging
import os
import sys
import types
from pylib.host_driven import test_case
from pylib.host... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/build/android/pylib/host_driven/setup.py | Python | mit | 6,378 |
#!/usr/bin/python
import sys
from qpid.messaging import *
#global vars
broker_local = "localhost:5672"
addr_control = "agie_inbound/agie_inbound_data"
def broker_conn():
# create connection to local broker
lb_connection = Connection(broker_local)
try:
lb_connection.open()
... | jkirklan/agietst | sandbox/get_data_net1.py | Python | gpl-3.0 | 662 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any... | quantifiedcode-bot/invenio-base | invenio_base/bundles.py | Python | gpl-2.0 | 5,259 |
# coding=utf-8
import unittest
"""210. Course Schedule II
https://leetcode.com/problems/course-schedule-ii/description/
There are a total of _n_ courses you have to take, labeled from `0` to `n-1`.
Some courses may have prerequisites, for example to take course 0 you have to
first take course 1, which is expressed a... | openqt/algorithms | leetcode/python/lc210-course-schedule-ii.py | Python | gpl-3.0 | 2,198 |
# Copyright (C) 2016 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 Software Foundation; either version 2 of the License, or
# ... | veusz/veusz | veusz/datasets/plugin.py | Python | gpl-2.0 | 6,627 |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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... | UManPychron/pychron | pychron/social/email/tasks/plugin.py | Python | apache-2.0 | 2,813 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pyscada', '0010_auto_20160115_0918'),
('modbus', '0003_auto_20160115_0918'),
]
operations = [
migrations.RenameField... | trombastic/PyScada | pyscada/modbus/migrations/0004_auto_20160115_0920.py | Python | gpl-3.0 | 454 |
from .logger import *
| pkenway/caver | py/caverlib/logging/__init__.py | Python | gpl-3.0 | 22 |
from django.conf.urls import patterns, url
from django.views.generic import ListView, DetailView
from django.views.generic.dates import ArchiveIndexView
from apps.podcast.models import Episode, Contributor
from apps.podcast.views import canonical_redirect, PodcastFeed
urlpatterns = patterns('',
url(r'^$', ArchiveI... | stickwithjosh/hypodrical | apps/podcast/urls.py | Python | mit | 878 |
from unittest import TestCase as Base
from memoize.core import *
from memoize.time import time, sleep
from memoize import Memoizer
class TestCase(Base):
memo_kwargs = {}
def setUp(self):
self.store = {}
self.records = []
self.memo = Memoizer(self.store, **self.memo_kwargs)
def ... | mikeboers/PyMemoize | tests/common.py | Python | bsd-3-clause | 434 |
# -*- encoding: utf-8 -*-
#
# Copyright 2013 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://www.apache.org/licenses/LICENSE-2.0
#
# ... | MDSLab/s4t-iotronic | iotronic/db/sqlalchemy/api.py | Python | apache-2.0 | 23,917 |
""" Placeholder admin module is currently empty.
Purpose: placeholder for if and when we want to implement an admin module
Author: (none)
Date: Summer, 2018.
Copyright: (c) 2018 Tom W. Hartung, Groja.com, and JooMoo Websites LLC.
Reference:
Copied from seeourminds.com on 2018-08-20
"""
### from django.contrib impor... | tomwhartung/tomhartung.com | Site/content/admin.py | Python | gpl-2.0 | 476 |
class BitVector(object):
"""docstring for BitVector"""
"""infinite array of bits is present in bitvector"""
def __init__(self):
self.BitNum=0
self.length=0
def set(self,i):
self.BitNum=self.BitNum | 1 << i
self.length=self.BitNum.bit_length()
def reset(self,i):
resetValue=1<<i
self.BitNum=self.BitNum ... | Seenivasanseeni/PyDaS | PDaS/BitVector.py | Python | mit | 595 |
handlers = {}
def handle_event(event, callback):
if event in handlers:
handlers[event].append(callback)
else:
handlers[event] = [callback]
def trigger(event):
for callback in handlers.get(event, []):
callback()
| Turbasen/turbasen.py | turbasen/events.py | Python | mit | 249 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.