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 |
|---|---|---|---|---|---|---|
"""Testing of module config."""
# pylint: disable=no-self-use, invalid-name, redundant-unittest-assert
import unittest
from hamcrest import assert_that, equal_to, contains_string
from ddt import ddt, data
from spline.components.config import ShellConfig
@ddt
class TestShellConfig(unittest.TestCase):
"""Testing of... | Nachtfeuer/pipeline | tests/components/test_shell_config.py | Python | mit | 2,422 | 0.001652 |
from MCNPtools import Gen
# example usage of the module
# first you initialize the tally by defining the bins: segment (surface number), angle (cosine) and energy (MeV)
cos = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
seg = [666,667]
erg =[1.000E-10, 1.259E-10, 1.585E-10, 1.995E-10, 2.512E-10, 3.162E-10,
... | ipostuma/MCNPtools | WriteTally.py | Python | gpl-3.0 | 1,830 | 0.004372 |
# Copyright 2012, Tim Bielawa <tbielawa@redhat.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later... | 2ndQuadrant/ansible | lib/ansible/plugins/action/pause.py | Python | gpl-3.0 | 10,780 | 0.001299 |
# Copyright (c) 2011-2015 Rackspace US, 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
#
# Unle... | ryandub/simpl | simpl/exceptions.py | Python | apache-2.0 | 3,556 | 0.000281 |
from math import floor
def score_syntax_errors(program_lines):
points = {')': 3, ']': 57, '}': 1197, '>': 25137}
s = 0
scores_auto = []
for line in program_lines:
corrupted, stack = corrupted_character(line)
if corrupted:
s += points[corrupted]
else:
s... | matslindh/codingchallenges | adventofcode2021/day10.py | Python | mit | 2,156 | 0.000928 |
from flask import Blueprint, render_template, request, make_response, jsonify
import os
import vayu.core.local_utils as lutils
import vayu.core.fabric_scripts.utils as futils
from vayu.core.constants.model import machine_info
from vayu.core.VayuException import VayuException
import vayu.core.constants.local as constant... | akshayarora2009/vayu | vayu/routes/projects.py | Python | mit | 7,845 | 0.002549 |
"""
WSGI config for ciat_plaforma 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ciat_plataforma.settings")
from... | ErickMurillo/ciat_plataforma | ciat_plataforma/wsgi.py | Python | mit | 403 | 0.002481 |
import pytest
from dateutil.parser import parse
from django.urls import reverse
from adhocracy4.dashboard import components
from adhocracy4.test.helpers import assert_template_response
from adhocracy4.test.helpers import redirect_target
from adhocracy4.test.helpers import setup_phase
from meinberlin.apps.ideas.phases ... | liqd/a4-meinberlin | tests/offlineevents/dashboard_components/test_views_project_offlineevents.py | Python | agpl-3.0 | 3,388 | 0 |
# Copyright 2016 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 a... | aljim/deploymentmanager-samples | examples/v2/waiter/instance.py | Python | apache-2.0 | 2,634 | 0.004176 |
import json
import datetime
from reinforcepy.environments import ALEEnvironment
from reinforcepy.networks.dqn.tflow.nstep_a3c import NStepA3C
from reinforcepy.learners.dqn.asynchronous.q_thread_learner import QThreadLearner
from reinforcepy.learners.dqn.asynchronous.async_thread_host import AsyncThreadHost
def main(r... | Islandman93/reinforcepy | examples/ALE/DQN_Async/run_a3c.py | Python | gpl-3.0 | 1,478 | 0.00406 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | google-research/google-research | aloe/aloe/rfill/utils/program_struct.py | Python | apache-2.0 | 6,121 | 0.008822 |
#
# Copyright 2016 IBM
#
# 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, softw... | openstack/ceilometer | ceilometer/tests/unit/publisher/test_prometheus.py | Python | apache-2.0 | 4,934 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2009-2012 Zuza Software Foundation
#
# This file is part of Pootle.
#
# 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... | ttreeagency/PootleTypo3Org | pootle/apps/pootle_notifications/views.py | Python | gpl-2.0 | 8,843 | 0.000565 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from keras.datasets import mnist
from hyperemble.neural_net import VanillaNeuralNet
def test_vanilla_neural_net():
(X_train, y_train), (X_test, y_test) = mnist.load_data()
X_train = X_train.reshape(6... | hduongtrong/hyperemble | hyperemble/neural_net/tests/test_neural_net.py | Python | bsd-2-clause | 760 | 0 |
"""
The IRAF plugin implements a remote control interface for the Ginga FITS
viewer from an IRAF session. In particular it supports the use of the
IRAF 'display' and 'imexamine' commands.
Instructions for use:
Set the environment variable IMTDEV appropriately, e.g.
$ export IMTDEV=inet:45005 (or)
$ ... | eteq/ginga | ginga/misc/plugins/IRAF.py | Python | bsd-3-clause | 32,083 | 0.00106 |
"""
Openflow tests on an l2 table
"""
import sys
import os
import logging
from oftest import config
import oftest.base_tests as base_tests
import ofp
from oftest.testutils import *
from oftest.parse import parse_mac
import openflow_base_tests
sys.path.append(os.path.join(sys.path[0], '..', '..', '..', '..',
... | p4lang/p4factory | targets/l2_switch/tests/of-tests/openflow.py | Python | apache-2.0 | 7,004 | 0.004997 |
from sqlalchemy import (
Column,
Index,
Integer,
Text,
LargeBinary,
Unicode,
ForeignKey,
Table
)
from sqlalchemy.orm import relationship
from .meta import Base
class User(Base):
"""This class defines a User model."""
__tablename__ = 'users'
id = Column(Integer, primary_key... | PyListener/CF401-Project-1---PyListener | pylistener/models/mymodel.py | Python | mit | 1,872 | 0.001068 |
"""course_discovery URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
C... | cpennington/course-discovery | course_discovery/urls.py | Python | agpl-3.0 | 1,899 | 0.00158 |
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright 2014-2022 Mikhail Rachinskiy
import random
from typing import Optional
import bpy
from bpy.types import Object, Operator
from mathutils import Vector
def object_offset(obs: list[Object], offset: float) -> None:
for ob in obs:
x = random.uniform(-of... | mrachinskiy/booltron | lib.py | Python | gpl-3.0 | 1,452 | 0.001377 |
import json
import utils as tech
import numpy as np
cols_with_grades = [1,2,3]
pathologists = open('../data/rater-names','rb').read().splitlines()
contingency_tables = {}
possible_values = list(np.array(cols_with_grades)-1)
#No stains
f1 = '../data/no-stain.xls'
f2 = '../data/no-stain.xls'
contingency_tables['no-... | mac389/LVSI | src/main.py | Python | apache-2.0 | 885 | 0.035028 |
# -*- coding: utf-8 -*-
#
# Copyright 2015-2020 BigML
#
# 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 ... | mmerce/python | bigml/tests/read_statistical_tst_steps.py | Python | apache-2.0 | 923 | 0.002167 |
import binascii
import unittest
from pycoin.bloomfilter import filter_size_required, hash_function_count_required, BloomFilter, murmur3
from pycoin.symbols.btc import network
Spendable = network.tx.Spendable
h2b = binascii.unhexlify
class BloomFilterTest(unittest.TestCase):
def test_filter_size_required(self)... | richardkiss/pycoin | tests/bloomfilter_test.py | Python | mit | 2,635 | 0.004934 |
from rest_framework.decorators import list_route
from rest_framework.permissions import IsAuthenticated
from rest_framework import viewsets
from .models import User
from .serializers import UserSerializer
class UserViewSet(viewsets.ModelViewSet):
queryset = User.objects.all()
serializer_class = UserSerializer... | mnazim/django-rest-kickstart | users/views.py | Python | mit | 362 | 0 |
from __future__ import absolute_import
from datetime import timedelta
from django.utils import timezone
from rest_framework.response import Response
from sentry.app import tsdb
from sentry.api.base import EnvironmentMixin
from sentry.api.bases.project import ProjectEndpoint
from sentry.api.exceptions import ResourceD... | mvaled/sentry | src/sentry/api/endpoints/project_user_stats.py | Python | bsd-3-clause | 1,034 | 0.000967 |
import wx
class FitListBox(wx.ListBox):
def GetDropList(self, itemlist):
selections = [self.GetString(i) for i in self.GetSelections()]
drop_list = []
for i in itemlist:
if i not in selections:
drop_list.append(i)
return drop_list
def GetSelList(sel... | karthikdevel/fit | gui/wxpython/fitlistbox.py | Python | mit | 546 | 0.001832 |
"""
Synthesise a QA module into the B100 FPGA.
"""
import os
import shutil
import subprocess
from jinja2 import Environment, FileSystemLoader
from fpga_sdrlib import config
from fpga_sdrlib.config import uhddir, miscdir, fpgaimage_fn
b100dir = os.path.join(uhddir, 'fpga', 'usrp2', 'top', 'B100')
custom_src_dir = o... | benreynwar/fpga-sdrlib | python/fpga_sdrlib/b100.py | Python | mit | 3,118 | 0.002886 |
# -*- coding: utf-8 -*-
import argparse
def ngrams(input='', n_min=0, n_max=5):
input = input.split(' ')
output = {}
end = n_max
for n in range(n_min+1, end+n_min+1):
for i in range(len(input)-n+1):
token = " ".join(input[i:i+n])
# Count the ngram
output[toke... | jplusplus/wikileaks-cg-analyser | ngrams.py | Python | gpl-3.0 | 991 | 0.009082 |
import datetime
from django import template
from registration.models import RegistrationProfile
register = template.Library()
@register.simple_tag
def get_volunteer_number():
volunteers = RegistrationProfile.objects.all().count()
return volunteers
| koolfreak/volunteer_planner | scheduler/templatetags/number_registrations.py | Python | agpl-3.0 | 260 | 0 |
import nltk
import os
from random import shuffle
from nltk.classify.scikitlearn import SklearnClassifier
from sklearn.naive_bayes import MultinomialNB, BernoulliNB
from sklearn.linear_model import LogisticRegression, SGDClassifier
from sklearn.svm import SVC, LinearSVC, NuSVC
from datetime import datetime
from nltk imp... | jessefeinman/FintechHackathon | python-getting-started/nlp/classificationTools.py | Python | bsd-2-clause | 2,927 | 0.003075 |
#!/usr/bin/env python
"""
server config.
"""
from basinboa.system.loader import YamlLoader
class Config(object):
"""docstring for Config"""
def __init__(self, name):
super(Config, self).__init__()
self.name = name
self.items = 0
def __repr__(self):
return "Config: %s, item... | marlboromoo/basinboa | basinboa/system/config.py | Python | mit | 869 | 0.003452 |
from stock_up.settings.base import * | astrodsg/django-stock-up | stock_up/settings/__init__.py | Python | mit | 36 | 0.027778 |
from django.conf.urls import patterns, include, url
import views
urlpatterns = patterns('',
url(r'^$', views.TopicModelIndexView.as_view(), name='topics_models'),
url(r'^model/(?P<model_id>\d+)/$', views.TopicModelDetailView.as_view(), name='topics_model'),
url(r'^model/(?P<model_id>\d+)/topic/(?P<topic_i... | hds-lab/textvisdrg-prototype | textvis/topics/urls.py | Python | mit | 545 | 0.007339 |
#
# This file is part of pyasn1-modules software.
#
# Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com>
# License: http://pyasn1.sf.net/license.html
#
import sys
from pyasn1.codec.der import decoder as der_decoder
from pyasn1.codec.der import encoder as der_encoder
from pyasn1_modules import pem
from pyasn1_m... | catapult-project/catapult | third_party/gsutil/third_party/pyasn1-modules/tests/test_rfc2314.py | Python | bsd-3-clause | 2,078 | 0.000481 |
import stdutils, math
from stdutils import inputAsDict, cTheta, niceRoot, cApprox
vals = inputAsDict(('size',cTheta))
real = math.cos(vals[cTheta])
comp = math.sin(vals[cTheta])
#str1 = '{} ({} + i {})'.format(niceRoot(vals['size']).getString(),niceRoot(real).getString(),niceRoot(comp).getString())
str2 = '<{}, {}>'.... | meta1203/Trigonometry-Programlets | vector_dimensions.py | Python | apache-2.0 | 525 | 0.013333 |
# -*- coding: UTF-8 -*-
#------------------------------------------------------------------------------
# file: fields.py
# License: LICENSE.TXT
# Author: Ioannis Tziakos
#
# Copyright (c) 2011, Enthought, Inc.
# All rights reserved.
#------------------------------------------------------------------------------
i... | ContinuumIO/ashiba | enaml/docs/source/sphinxext/refactordoc/fields.py | Python | bsd-3-clause | 8,370 | 0.00359 |
import platform
import os
import getpass
import sys
import traceback
from crontab import CronTab
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session
from scrapebot.configuration import Configuration
from scrapebot.database import base, User, Instance
def main():
print('Wel... | MarHai/ScrapeBot | setup.py | Python | gpl-2.0 | 13,133 | 0.004797 |
"""fix opportunities model
Revision ID: 3de73bde77e
Revises: 22cc439cd89
Create Date: 2015-06-25 00:55:51.895965
"""
# revision identifiers, used by Alembic.
revision = '3de73bde77e'
down_revision = '22cc439cd89'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade(... | ajb/pittsburgh-purchasing-suite | migrations/versions/3de73bde77e_fix_opportunities_model.py | Python | bsd-3-clause | 4,373 | 0.009376 |
from django.test import TestCase
from webapp.forms import ItemForm
from webapp.models import User, Collection, CollectionPermission, Item, Accessor, OWNER, GUEST
from webapp.util import server_side_md
class ModelPermissionsTest(TestCase):
def setUp(self):
self.user1 = User.objects.create_user('a', 'a@a.c... | msipos/lasernotes | backend/webapp/tests.py | Python | agpl-3.0 | 3,156 | 0.001901 |
"""
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 this ... | zouzhberk/ambaridemo | demo-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/package/scripts/webhcat_server.py | Python | apache-2.0 | 1,523 | 0.009192 |
from core import FM
from core.FMOperation import FMOperation
class CopyFiles(FM.BaseAction):
def __init__(self, request, paths, session, target, overwrite, **kwargs):
super(CopyFiles, self).__init__(request=request, **kwargs)
self.paths = paths
self.session = session
self.target =... | LTD-Beget/sprutio | app/modules/webdav/actions/files/copy.py | Python | gpl-3.0 | 934 | 0.004283 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
class User(object):
def __init__(self, id, email, passwd, session, session_expire_time, ctime, rtime):
self.id = str(id)
self.email = email
self.passwd = passwd
self.session = session
self.session_expire_time = session_expire_time
... | liangsun/me | webapp/models/user.py | Python | mit | 573 | 0.001745 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pdb
import time
import cx_Oracle
import multiprocessing
ipList = ("192.168.7.121",
"192.168.7.122",
"192.168.7.123",
"192.168.7.124",
"192.168.7.125",
"192.168.7.126",
"192.168.7.127",
"192.168.7... | wbvalid/python2 | aioSqlQuery.py | Python | unlicense | 1,328 | 0 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bikes_prediction.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| cheer021/BikesPrediction_DP | bikes_prediction/manage.py | Python | mit | 259 | 0.003861 |
from base import GAETestCase
from config.template_middleware import TemplateResponse
from routes.courses import new
from tekton.gae.middleware.redirect import RedirectResponse
from student.student_model import Course
__author__ = 'samara'
class NewTeste(GAETestCase):
def test_sucesso(self):
resposta = ne... | SamaraCardoso27/eMakeup | backend/test/course_test.py | Python | mit | 950 | 0.012632 |
# (c) 2012, Daniel Hokka Zakrisson <daniel@hozac.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... | madj4ck/ansible | lib/ansible/plugins/lookup/file.py | Python | gpl-3.0 | 2,558 | 0.003518 |
# -*- coding: utf-8 -*-
# Copyright 2013 The Distro Tracker Developers
# See the COPYRIGHT file at the top-level directory of this distribution and
# at http://deb.li/DTAuthors
#
# This file is part of Distro Tracker. It is subject to the license terms
# in the LICENSE file found in the top-level directory of this
# d... | sa2ajj/DistroTracker | pts/mail/tests/tests_control.py | Python | gpl-2.0 | 90,050 | 0.000233 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | pkill-nine/qutebrowser | tests/unit/misc/test_readline.py | Python | gpl-3.0 | 11,925 | 0 |
from trueskill import TrueSkill, Rating, rate
import argparse
import requests
from datetime import datetime
#from pytba import api as tba
class FrcTrueSkill:
def __init__(self):
self.env = TrueSkill(draw_probability=0.02)
self.trueskills = {}
self.events = {}
self.get_previous_matc... | Ninjakow/TrueSkill | frc_trueskill.py | Python | gpl-3.0 | 3,512 | 0.005125 |
"""
[04/22/13] REMINDER: Week-Long Challenge #1 due today!
https://www.reddit.com/r/dailyprogrammer/comments/1cv8oo/042213_reminder_weeklong_challenge_1_due_today/
Hey r/DailyProgrammers,
As a friendly reminder, our first week-long challenge (making a (tiny) video game) concludes today, at midnight, here
in the Ameri... | DayGitH/Python-Challenges | DailyProgrammer/DP20130422.py | Python | mit | 818 | 0.00489 |
#
# This file is part of Mapnik (c++ mapping toolkit)
#
# Copyright (C) 2015 Artem Pavlenko
#
# Mapnik is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your op... | mapycz/mapnik | plugins/input/gdal/build.py | Python | lgpl-2.1 | 2,194 | 0.001823 |
#!/usr/bin/python3
from gi.repository import GLib
from gi.repository import OpenDCS
import sys
class DcsExample(object):
def __init__(self):
self.dcsobject = OpenDCS.Object()
self.dcsobject.set_property('id', 'test')
print("Object hash: ", self.dcsobject.get_property('hash'))
if __name__... | geoffjay/opendcs-core | examples/minimal.py | Python | lgpl-3.0 | 353 | 0.005666 |
# -*- 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/change_event_resource_type.py | Python | apache-2.0 | 1,596 | 0.000627 |
# -*- coding: utf-8 -*-
#
# This file is part of the jabber.at homepage (https://github.com/jabber-at/hp).
#
# This project 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 (... | debalance/hp | hp/blog/querysets.py | Python | gpl-3.0 | 1,576 | 0.003807 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
class W... | kleetus/bitcoin | qa/rpc-tests/wallet.py | Python | mit | 13,538 | 0.006943 |
import sys
print('The command line arguments are:')
for i in sys.argv:
print(i)
print('\n\nThe PYTHONPATH is',sys.path,'\n') | kido113/a-byte-of-python-learning-records | module_using_sys.py | Python | gpl-3.0 | 127 | 0.031496 |
import re
import base
import sam.models.nodes
from sam import errors
from sam import common
# This class is for getting the child nodes of all nodes in a node list, for the map
class Nodes(base.headless_post):
"""
The expected GET data includes:
'address': comma-seperated list of dotted-decimal IP ad... | JoePelz/SAM | sam/pages/nodes.py | Python | gpl-3.0 | 4,239 | 0.002359 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/gromacs/package.py | Python | lgpl-2.1 | 3,939 | 0.000254 |
# coding=utf-8
from collections import MutableMapping, Sequence
import copy
__version__ = '0.5.0'
class Hook(object):
def _before_add(self, key, item):
"""
before add a item to the object will call this method.
example: obj[key] = item
"""
def _after_add(self, key, item):
... | meng89/hooky | hooky.py | Python | mit | 6,757 | 0.000296 |
from cloudify import ctx
from cloudify.exceptions import NonRecoverableError
from cloudify.state import ctx_parameters as inputs
import subprocess
import os
import re
import sys
import time
import threading
import platform
from StringIO import StringIO
from cloudify_rest_client import CloudifyClient
from cloudify im... | alien4cloud/alien4cloud-cloudify3-provider | alien4cloud-cloudify3-provider/src/test/resources/outputs/blueprints/openstack/storage/wrapper/LinuxFileSystem_3/tosca.interfaces.node.lifecycle.Standard/start/_a4c_start.py | Python | apache-2.0 | 15,688 | 0.004717 |
from rest_framework import serializers
from .models import (
Provider,
OsFamily,
OperatingSystem,
Instance,
ServerPlan
)
class ProviderSerializer(serializers.ModelSerializer):
class Meta:
model = Provider
class OsFamilySerializer(serializers.ModelSerializer):
class Meta:
... | jcbalmeida/onecloud-store | store/computing/serializers.py | Python | mit | 816 | 0.002451 |
import roach as r
import struct
import numpy as np
import matplotlib.pyplot as plt
import threading
from time import sleep,time
from util import Time
import matplotlib.animation as animation
#set up threading
class AGC_Thread (threading.Thread):
def __init__(self, threadID):
threading.Thread.__... | dgary50/eovsa | adc_plot_og.py | Python | gpl-2.0 | 8,417 | 0.022573 |
import unittest
from juggling.notation import siteswap
class SiteswapUtilsTests(unittest.TestCase):
def test_siteswap_char_to_int(self):
self.assertEqual(siteswap.siteswap_char_to_int('0'), 0)
self.assertEqual(siteswap.siteswap_char_to_int('1'), 1)
self.assertEqual(siteswap.siteswap_char_... | PacketPerception/pyjuggling | tests/siteswap_tests.py | Python | mit | 2,919 | 0.001028 |
# coding=utf-8
import os, sys, shutil, unicodedata, re, types
from htmlentitydefs import name2codepoint
import xbmc, xbmcaddon, xbmcplugin, xbmcgui, xbmcvfs
import xml.etree.ElementTree as xmltree
import urllib
from unidecode import unidecode
from urlparse import parse_qs
from traceback import print_exc
if sys.versio... | zag2me/plugin.program.video.node.editor | addon.py | Python | gpl-2.0 | 42,963 | 0.035451 |
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class FoursquareAccount(ProviderAccount):
def get_profile_url(self):
return "https://foursquare.com/user/" + self.account.extra_data.get("id")
def get_avatar_url... | pennersr/django-allauth | allauth/socialaccount/providers/foursquare/provider.py | Python | mit | 967 | 0.001034 |
#!/usr/bin/env python
"""
refguide_check.py [OPTIONS] [-- ARGS]
Check for a Scipy submodule whether the objects in its __all__ dict
correspond to the objects included in the reference guide.
Example of usage::
$ python refguide_check.py optimize
Note that this is a helper script to be able to check if things ar... | e-q/scipy | tools/refguide_check.py | Python | bsd-3-clause | 32,497 | 0.001169 |
#!/usr/bin/python
#
# Copyright 2014 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 b... | cctaylor/googleads-python-lib | examples/adwords/v201409/extensions/add_site_links_using_feeds.py | Python | apache-2.0 | 9,573 | 0.00491 |
# coding: utf-8
"""
Gmail
Access Gmail mailboxes including sending user email.
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
fro... | CanopyIQ/gmail_client | gmail_client/apis/users_api.py | Python | mit | 459,442 | 0.003489 |
import abc
import json
import flask
class ApiBase(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def add_feature(self, feature_name, distribution, **kwargs):
return
@abc.abstractmethod
def remove_feature(self, feature_name, **kwargs):
return
@abc.abstractmethod
... | diogo149/simbo | simbo/base/api.py | Python | mit | 1,542 | 0 |
import random
import datetime
import pytest
from irc import schedule
def test_delayed_command_order():
"""
delayed commands should be sorted by delay time
"""
null = lambda: None
delays = [random.randint(0, 99) for x in range(5)]
cmds = sorted([
schedule.DelayedCommand.after(delay, null)
for delay in dela... | sim0629/irc | irc/tests/test_schedule.py | Python | lgpl-2.1 | 1,442 | 0.034674 |
# coding=utf-8
# Copyright 2022 The Edward2 Authors.
#
# 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 o... | google/edward2 | experimental/attentive_uncertainty/contextual_bandits/pretrain.py | Python | apache-2.0 | 9,412 | 0.007969 |
# Mustafa Hussain
# Digital Image Processing with Dr. Anas Salah Eddin
# FL Poly, Spring 2015
#
# Homework 3: Spatial Filtering
#
# USAGE NOTES:
#
# Written in Python 2.7
#
# Please ensure that the script is running as the same directory as the images
# directory!
import cv2
import copy
#import matplotlib.pyplot as p... | hmustafamail/digitalimageprocessing | HW 5 - Frequency Filtering/Spatial Filtering/spatialFiltering.py | Python | gpl-2.0 | 2,087 | 0.01677 |
from bears.hypertext.HTMLLintBear import HTMLLintBear
from coalib.testing.LocalBearTestHelper import verify_local_bear
test_file = """
<html>
<body>
<h1>Hello, world!</h1>
</body>
</html>
"""
HTMLLintBearTest = verify_local_bear(HTMLLintBear,
valid_files=(),
... | horczech/coala-bears | tests/hypertext/HTMLLintBearTest.py | Python | agpl-3.0 | 863 | 0 |
from genson.functions import GridGenerator
def test_extra_kwargs():
raised = False
try:
g = GridGenerator(1, 2, 3, spurious_kwarg=4)
except ValueError:
raised = True
assert(raised == True)
| davidcox/genson | test/test_extra_kwargs.py | Python | mit | 225 | 0.004444 |
# Copyright (c) 2016 Infoblox 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 require... | infobloxopen/heat-infoblox | heat_infoblox/resources/ospf.py | Python | apache-2.0 | 7,481 | 0 |
"""
This script is an example of how to use the random gaussian noise generator
module. |br|
In this example only one signal is generated.
Both the minimum and the maximum frequency component in the signal is regulated.
After the generation, spectrum fo the signal is analyzed with an Welch analysis
and ploted.
*... | JacekPierzchlewski/RxCS | examples/signals/gaussNoise_ex1.py | Python | bsd-2-clause | 1,774 | 0.002255 |
# -*- coding: utf-8 -*-
#
# 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
#... | artwr/airflow | tests/contrib/operators/test_gcp_sql_operator_system.py | Python | apache-2.0 | 2,927 | 0.002392 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | grap/OCB | addons/project/project.py | Python | agpl-3.0 | 77,400 | 0.005969 |
#!/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.
"""Generate java source files from protobuf files.
This is a helper file for the genproto_java action in protoc_java.gypi.
It per... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/build/protoc_java.py | Python | mit | 2,330 | 0.009013 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import traceback
import os
import threading
import time
import socket
import select
descriptors = list()
Desc_Skel = {}
_Worker_Thread = None
_Lock = threading.Lock() # synchronization lock
Debug = False
def dprint(f, *v):
if Debug:
print >>sys.s... | sdgdsffdsfff/monitor-core | gmond/python_modules/memcached/memcached.py | Python | bsd-3-clause | 13,648 | 0.010111 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""task 05"""
def defaults(my_required, my_optional=True):
"""1. ``my_optional`` which has a default value of True
2. ``my_required`` which is a required param and has no default value"""
return my_optional is my_required
| DannySapz/is210-week-04-warmup | task_05.py | Python | mpl-2.0 | 285 | 0 |
# (c) 2012, Jan-Piet Mens <jpmens(at)gmail.com>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
lookup: redis_kv
author: Jan-Piet M... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/plugins/lookup/redis_kv.py | Python | bsd-3-clause | 2,846 | 0.003514 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | ishay2b/tensorflow | tensorflow/python/kernel_tests/variable_scope_test.py | Python | apache-2.0 | 48,184 | 0.009298 |
from olympia import amo
import mkt
from mkt.webapps.models import AddonExcludedRegion
def run():
"""Unleash payments in USA."""
(AddonExcludedRegion.objects
.exclude(addon__premium_type=amo.ADDON_FREE)
.filter(region=mkt.regions.US.id).delete())
| harikishen/addons-server | src/olympia/migrations/532-unleash-payments-in-usa.py | Python | bsd-3-clause | 266 | 0 |
#!/usr/bin/env python
"""
A Stepper Motor Driver class for Replicape.
Author: Elias Bakken
email: elias(dot)bakken(at)gmail(dot)com
Website: http://www.thing-printer.com
License: GNU GPL v3: http://www.gnu.org/copyleft/gpl.html
Redeem is free software: you can redistribute it and/or modify
it under the terms of the... | intelligent-agent/redeem | redeem/Stepper.py | Python | gpl-3.0 | 15,869 | 0.01002 |
import wx
import wx.grid
class GenericTable(wx.grid.GridTableBase):
def __init__(self, data, rowLabels=None, colLabels=None):
wx.grid.GridTableBase.__init__(self)
self.data = data
self.rowLabels = rowLabels
self.colLabels = colLabels
def GetNumberRows(self):
return len... | joseamaita/guiprog-python | wxpython/files/generictable.py | Python | lgpl-3.0 | 787 | 0.001271 |
# -*- coding: utf-8 -*-
"""
Select2 Widgets based on https://github.com/applegrew/django-select2.
These components are responsible for rendering
the necessary HTML data markups. Since this whole
package is to render choices using Select2 JavaScript
library, hence these components are meant to be used
with choice field... | monouno/site | judge/widgets/select2.py | Python | agpl-3.0 | 7,832 | 0.001149 |
# coding: utf-8
from django.db import models
from django.utils.translation import ugettext_lazy as _, pgettext_lazy
class ContentBase(models.Model):
"""
Base class for models that share content attributes
The attributes added by this mixin are ``title``, ``description``,
``content`` and ``is_visible`... | artscoop/django-basemix | basemix/mixins/content/content.py | Python | bsd-3-clause | 1,190 | 0.002521 |
# -*- coding: utf-8 -*-
import docutils
from docutils import nodes
from docutils.parsers.rst import Directive, directives
from html import escape
from collections import Counter
import re
import os
from sphinx.directives.code import CodeBlock
from sphinx.errors import SphinxError
from sphinx.util.fileutil import copy_a... | Aalto-LeTech/a-plus-rst-tools | directives/annotated.py | Python | mit | 15,406 | 0.00767 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
import operator
import os
import platform
import sys
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from ...extern.p... | pybuilder/pybuilder | src/main/python/pybuilder/_vendor/pkg_resources/_vendor/packaging/markers.py | Python | apache-2.0 | 8,485 | 0.000236 |
# Author: Mathieu Blondel <mathieu@mblondel.org>
# Arnaud Joly <a.joly@ulg.ac.be>
# Maheshakya Wijewardena<maheshakya.10@cse.mrt.ac.lk>
# License: BSD 3 clause
from __future__ import division
import numpy as np
from .base import BaseEstimator, ClassifierMixin, RegressorMixin
from .externals.six.moves ... | eickenberg/scikit-learn | sklearn/dummy.py | Python | bsd-3-clause | 14,149 | 0 |
"""
LICENCE
-------
Copyright 2013 by Kitware, Inc. All Rights Reserved. Please refer to
KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.
"""
import os
import numpy as np
import json
thispath = os.path.dirname(os.path.abs... | anguoyang/SMQTK | OLD_ROOT/WebUI/QueryRecommend/query_recommend.py | Python | bsd-3-clause | 7,183 | 0.002088 |
import numpy
import pandas
import statsmodels.api as sm
def complex_heuristic(file_path):
'''
You are given a list of Titantic passengers and their associating
information. More information about the data can be seen at the link below:
http://www.kaggle.com/c/titanic-gettingStarted/data
For this e... | KellyChan/python-examples | python/data_science/Titanic/complexHeuristic.py | Python | mit | 2,546 | 0.007463 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012 W. Trevor King <wking@tremily.us>
#
# This file is part of pygrader.
#
# pygrader 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, o... | wking/pygrader | pygrader/email.py | Python | gpl-3.0 | 10,392 | 0.000771 |
#
# Copyright © 2012–2022 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... | nijel/weblate | weblate/addons/autotranslate.py | Python | gpl-3.0 | 2,345 | 0.000427 |
# 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 u... | szha/mxnet | python/mxnet/gluon/probability/distributions/cauchy.py | Python | apache-2.0 | 2,935 | 0.000681 |
import logging, sys, os, codecs
import requests, cache, csv
from bs4 import BeautifulSoup
BASE_URL = "http://www.nuforc.org/webreports/" # needed to reconstruct relative URLs
START_PAGE = "ndxshape.html" # uses shape page because least # requests to get all the data
BASE_DIR = os.path.dirname(os.path.abspath(... | kanarinka/UFOScraper | scrape.py | Python | gpl-2.0 | 3,948 | 0.007345 |
# Copyright 2013 OpenStack Foundation
#
# 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... | jumpstarter-io/keystone | keystone/tests/unit/test_v3_credential.py | Python | apache-2.0 | 16,723 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from services.user import UserService
import tornado.web
import tornado.gen
import tornado.escape
import json
import settings
from util.stmp import send_email
from views import BaseHandler
class LoginHandler(tornado.web.RequestHandler):
def get(self):
self.rend... | liuhong1happy/DockerConsoleApp | views/login.py | Python | apache-2.0 | 2,538 | 0.019429 |
import time
from copy import deepcopy
from decorator import decorator
from collections import Iterable
import inspect
import ethereum.blocks
from ethereum.utils import (is_numeric, is_string, int_to_big_endian, big_endian_to_int,
encode_hex, decode_hex, sha3, zpad)
import ethereum.slogging a... | heikoheiko/pyethapp | pyethapp/jsonrpc.py | Python | bsd-3-clause | 41,771 | 0.001077 |
#!/usr/bin/env python2
import sys
import json
import struct
import subprocess
import shlex
def getMessage():
rawLength = sys.stdin.read(4)
if len(rawLength) == 0:
sys.exit(0)
messageLength = struct.unpack('@I', rawLength)[0]
message = sys.stdin.read(messageLength)
return json.loads(messag... | vayan/external-video | app/mpv.py | Python | mit | 487 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.