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 |
|---|---|---|---|---|---|---|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2010 OpenStack 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... | sileht/deb-openstack-nova | nova/tests/test_virt_drivers.py | Python | apache-2.0 | 19,029 | 0 |
from django.shortcuts import render
from django.http import HttpResponse
from django.utils import simplejson as json
import ner
def index(request):
params = {'current': 'home'}
return render(request, 'index.html', params)
def name_entity_recognition(request):
if request.method == 'GET':
#Get the ... | smouzakitis/molly | molly/views.py | Python | apache-2.0 | 711 | 0.014104 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import logging
log = logging.getLogger(__name__)
from .trajectories import Trajectories
try: # pragma: no cover
from . import draw
__a... | bnoi/scikit-tracker | sktracker/trajectories/__init__.py | Python | bsd-3-clause | 533 | 0.001876 |
import mraa
import time
from multiprocessing import Queue,Process
import move_avge
CO2_BYTE = 9
NUM_INCOME_BYTE = 13
S8_message = b"\xFE\x04\x00\x00\x00\x04\xE5\xC6"
class sensor(Process):
def __init__(self, q):
Process.__init__(self)
self.q = q
self.u=mraa.Uart(1)
self.u.setBaudRate(9600)
self.u.setMod... | cclljj/AnySense_7688 | lib/gas_co2_s8.py | Python | gpl-3.0 | 1,189 | 0.044575 |
from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass... | rubendibattista/python-ransac-library | pyransac/features.py | Python | bsd-3-clause | 6,919 | 0.021246 |
# Copyright 2018-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 versio... | chrislit/abydos | abydos/distance/_upholt.py | Python | gpl-3.0 | 4,479 | 0 |
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye 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.
#
#... | porolakka/motioneye-jp | src/update.py | Python | gpl-3.0 | 1,486 | 0.007402 |
""" Encapsulate here the logic for matching jobs
Utilities and classes here are used by MatcherHandler
"""
__RCSID__ = "$Id"
import time
from DIRAC import gLogger
from DIRAC.FrameworkSystem.Client.MonitoringClient import gMonitor
from DIRAC.Core.Utilities.PrettyPrint import printDict
from DIRAC.Core.Security i... | fstagni/DIRAC | WorkloadManagementSystem/Client/Matcher.py | Python | gpl-3.0 | 14,961 | 0.008689 |
#!/usr/bin/env python
# encoding: utf-8
"""
setup.py
Created by Cody Brocious on 2006-12-21.
Copyright (c) 2006 Falling Leaf Systems. All rights reserved.
"""
from distutils.core import setup
import py2app
setup(
app = ['Convert.py'],
options = dict(
py2app=dict(
argv_emulation=True
)
)
)
| callen/Alky-Reborn | Convertor/setup.py | Python | lgpl-3.0 | 303 | 0.033003 |
#!usr/bin/env python
#-*- coding:utf-8 -*-
"""
@author: James Zhang
@date:
"""
import numpy as np
import theano
import theano.tensor as T
from theano.ifelse import ifelse
from theano.tensor.shared_randomstreams import RandomStreams
from collections import OrderedDict
import copy
import sys
sys.setrecursionlimit(10000... | jfzhang95/lightML | SupervisedLearning/Neural Layers/methods.py | Python | mit | 3,801 | 0.006969 |
from django.test import TestCase
from builds.models import Version
from projects.models import Project
class RedirectTests(TestCase):
fixtures = ["eric", "test_data"]
def setUp(self):
self.client.login(username='eric', password='test')
r = self.client.post(
'/dashboard/import/',
... | ojii/readthedocs.org | readthedocs/rtd_tests/tests/test_redirects.py | Python | mit | 3,374 | 0.005039 |
HTML_OUTPUTS = {
'simple': (
b'<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><body>'
b'<div id="impress"><div class="step step-level-1" step="0" '
b'data-rotate-x="0" data-rotate-y="0" data-rotate-z="0" '
b'data-scale="1" data-x="0" data-y="0" data-z="0"><h1 '
b'... | alexAubin/hovercraft | hovercraft/tests/test_data/__init__.py | Python | mit | 17,298 | 0 |
from castle.cms.behaviors.search import ISearch
from castle.cms.social import COUNT_ANNOTATION_KEY
from collective.elasticsearch import mapping
from collective.elasticsearch import query
from collective.elasticsearch.interfaces import IAdditionalIndexDataProvider
from plone import api
from zope.annotation.interfaces im... | castlecms/castle.cms | castle/cms/search.py | Python | gpl-2.0 | 5,355 | 0.000747 |
"""
Train low-data Tox21 models with graph-convolution. Test last fold only.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import numpy as np
np.random.seed(123)
import tensorflow as tf
tf.set_random_seed(123)
import deepchem as dc
from datasets impor... | Agent007/deepchem | examples/low_data/tox_graph_conv_one_fold.py | Python | mit | 2,851 | 0.009821 |
from p2pool.util import forest, math
class WeightsSkipList(forest.TrackerSkipList):
# share_count, weights, total_weight
def get_delta(self, element):
from p2pool.bitcoin import data as bitcoin_data
share = self.tracker.shares[element]
att = bitcoin_data.target_to_average_attempts(... | sje397/p2pool | p2pool/skiplists.py | Python | gpl-3.0 | 2,559 | 0.007034 |
# This package will contain the spiders of your Scrapy project
#
# Please refer to the documentation for information on how to create and manage
# your spiders.
import json
from urllib import urlencode
from scrapy import log
from scrapy.http import Request
from scrapy.selector import Selector
from scrapy.contrib.load... | Answeror/torabot | torabot/mods/bilibili/spy/bilibili/spiders/__init__.py | Python | mit | 6,671 | 0.0006 |
class Solution(object):
def numTrees(self, n):
"""
:type n: int
:rtype: int
"""
if n <= 1: return 1
nt = [0] * (n+1)
nt[0] = 1
nt[1] = 1
for i in xrange(2, n+1):
# i numbers
total = 0
for k in xrange(i):
# let kth number be the root, left has k numbers, right has i-k-1 numbers
total... | xiaonanln/myleetcode-python | src/96. Unique Binary Search Trees.py | Python | apache-2.0 | 560 | 0.05 |
#! /usr/bin/env python
"""
based on https://github.com/tomchristie/django-rest-framework/blob/master/runtests.py
"""
from __future__ import print_function
import pytest
import sys
import os
import subprocess
PYTEST_ARGS = {
'default': ['tests'],
'fast': ['tests', '-q'],
}
FLAKE8_ARGS = ['rest_framework_frie... | FutureMind/drf-friendly-errors | runtests.py | Python | mit | 2,452 | 0.001223 |
# -*- coding=utf-8 -*-
import os
from setuptools import setup, find_packages
from version import get_version
version = get_version()
setup(name='edem.content.logo',
version=version,
description="Logos for forums.e-democracy.org",
long_description=open("README.txt").read() + "\n" +
op... | e-democracy/edem.content.logo | setup.py | Python | gpl-3.0 | 1,382 | 0.014472 |
"""
MUSE -- A Multi-algorithm-collaborative Universal Structure-prediction Environment
Copyright (C) 2010-2017 by Zhong-Li Liu
This program is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software Foundation
version 2 of t... | zhongliliu/muse | muse/Calculators/DirectOpt.py | Python | gpl-2.0 | 2,930 | 0.021843 |
# This file is part of Korman.
#
# Korman 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.
#
# Korman is distributed i... | dpogue/korman | korman/ui/ui_toolbox.py | Python | gpl-3.0 | 2,031 | 0.003447 |
import unittest
from tweetMining import TweetMining, TweetProxy, TestProxy, HttpProxy
import nltk
class TweetMiningTestCase(unittest.TestCase):
def setUp(self):
self.tweetMining = TweetMining(proxy='test')
self.search = self.tweetMining.search(q="twitter")
self.userInfoResponse = self.tweet... | domenicosolazzo/TweetMining | tests/test_tweetMining.py | Python | mit | 13,682 | 0.007528 |
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2010 by the FIFE team
# http://www.fifengine.net
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General ... | mgeorgehansen/FIFE_Technomage | demos/shooter/scripts/common/baseobject.py | Python | lgpl-2.1 | 7,040 | 0.035938 |
import unittest
import docker
from .. import helpers
from .base import TEST_API_VERSION
class ServiceTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
client = docker.from_env(version=TEST_API_VERSION)
helpers.force_leave_swarm(client)
client.swarm.init('127.0.0.1', listen_a... | vpetersson/docker-py | tests/integration/models_services_test.py | Python | apache-2.0 | 7,604 | 0 |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Basic string exercises
# Fill in the code for the functions below. main() is already se... | hone5t/pyquick | basic/string1.py | Python | apache-2.0 | 3,606 | 0.013588 |
from sqlalchemy.testing import eq_, assert_raises, assert_raises_message
import operator
from sqlalchemy import *
from sqlalchemy import exc as sa_exc, util
from sqlalchemy.sql import compiler, table, column
from sqlalchemy.engine import default
from sqlalchemy.orm import *
from sqlalchemy.orm import attributes
from s... | alex/sqlalchemy | test/orm/test_froms.py | Python | mit | 95,771 | 0.010076 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
SagaAlgorithm.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*************************... | dwadler/QGIS | python/plugins/processing/algs/saga/SagaAlgorithm.py | Python | gpl-2.0 | 20,651 | 0.003099 |
import sys, os
import pygsl
import pygsl.sf
while "python" not in os.listdir("."):
os.chdir("..")
sys.path.append("python")
import spidir
from rasmus.common import *
from rasmus.bio import phylo
from test import *
if os.system("which xpdf 2>/dev/null") != 0:
rplot_set_viewer("display")
def exc_default(f... | mdrasmus/spimap | test/all_terms.py | Python | gpl-2.0 | 4,112 | 0.009971 |
#!/usr/bin/env python
import StringIO
from InventoryFilter import InventoryFilter
class OpenstackInventory(InventoryFilter):
def get_host_ips(self, topo):
host_public_ips = []
for group in topo['os_server_res']:
grp = group.get('openstack', [])
if isinstance(grp, list):
... | agharibi/linchpin | linchpin/provision/InventoryFilters/OpenstackInventory.py | Python | gpl-3.0 | 1,255 | 0 |
__author__ = 'oglebrandon'
import logging as logger
import types
from ib.ext.EWrapper import EWrapper
def showmessage(message, mapping):
try:
del(mapping['self'])
except (KeyError, ):
pass
items = mapping.items()
items.sort()
print '### %s' % (message, )
for k, v in items:
... | CarterBain/Medici | ib/client/msg_wrapper.py | Python | bsd-3-clause | 6,312 | 0.003961 |
# Copyright (c) 2010-2014 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, copy, modify, merge, publish, distr... | quisas/albus | cli_tools/openpyxl/tests/test_named_range.py | Python | agpl-3.0 | 6,909 | 0.002461 |
import nltk
import random
import pickle
from nltk.classify.scikitlearn import SklearnClassifier
from sklearn.naive_bayes import MultinomialNB, BernoulliNB
from sklearn.svm import LinearSVC
from sklearn.linear_model import LogisticRegression, SGDClassifier
from nltk.classify import ClassifierI
from statistics im... | everAspiring/Sentiment-Analysis | PickleAlgos.py | Python | gpl-3.0 | 5,592 | 0.007332 |
import os
import os.path
import random
import recipe_generator
import subprocess
import shutil
#Comparing all recipes, which uses the fewest ingredients? ...kinda hacky
def fewest_ingredients(path):
""" Takes a path and returns the recipe txt file with the fewest ingredients
in the tree specified by that p... | ScriptingBeyondCS/CS-35 | week_0_to_2/tree_analysis/recipe_analysis_examples.py | Python | mit | 4,728 | 0.006768 |
from unittest import TestCase
from safeurl.core import getRealURL
class MainTestCase(TestCase):
def test_decodeUrl(self):
self.assertEqual(getRealURL('http://bit.ly/1gaiW96'),
'https://www.yandex.ru/')
def test_decodeUrlArray(self):
self.assertEqual(
getRe... | FrodoTheTrue/safeurl | tests/tests.py | Python | mit | 1,050 | 0 |
# Copyright (C) 2014-2020 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd 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.
#
#... | Valloric/ycmd | ycmd/identifier_utils.py | Python | gpl-3.0 | 8,517 | 0.019493 |
from submitify.tests import (
TestCase,
# CallMixin,
# GuidelineMixin,
# NotificationMixin,
# ReviewMixin,
# SubmissionMixin,
# UserMixin,
)
class TestListCalls(TestCase):
def test_lists_open_calls(self):
self.assertTrue(True)
def test_lists_other_calls_if_asked(self):
... | OpenFurry/submitify | submitify/views/test_calls.py | Python | mit | 1,704 | 0 |
''' Present a plot updating according to a set of fixed timeout
intervals.
Use the ``bokeh serve`` command to run the example by executing:
bokeh serve timeout.py
at your command prompt. Then navigate to the URL
http://localhost:5006/timeout
in your browser.
'''
import numpy as np
from bokeh.palettes im... | justacec/bokeh | examples/app/timeout.py | Python | bsd-3-clause | 1,560 | 0.001923 |
# -*- coding: utf-8 -*-
"""Scheduling Block Instance List API resource."""
import logging
from http import HTTPStatus
from random import choice
from flask import Blueprint, request
from .utils import add_scheduling_block, get_root_url, missing_db_response
from ..db.client import ConfigDb
BP = Blueprint("scheduling-... | SKA-ScienceDataProcessor/integration-prototype | sip/examples/flask_processing_controller/app/api/scheduling_block_list.py | Python | bsd-3-clause | 2,351 | 0 |
#-*- encoding: utf-8 -*-
from django.contrib.auth import authenticate, login, logout
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response, RequestContext, render
from membro_profile.forms import MembroForm, MembroProfileForm, EditProfileForm
from django.contrib.aut... | pixies/academic | membro_profile/views.py | Python | gpl-3.0 | 4,644 | 0.004741 |
import Image
import argparse
from StringIO import StringIO
from urlparse import urlparse
from threading import Thread
import httplib, sys
from Queue import Queue
import numpy as np
from scipy import misc
import os
def doWork():
while True:
task_data = q.get()
print task_data
url = task_dat... | hudvin/brighteye | facenet_experiments/vgg_utils/vgg_downloader.py | Python | apache-2.0 | 2,983 | 0.004358 |
from nose.tools import eq_, ok_
from django.test import TestCase
from airmozilla.comments.templatetags.jinja_helpers import (
gravatar_src,
obscure_email,
)
class TestHelpers(TestCase):
def test_gravatar_src_http(self):
email = 'peterbe@mozilla.com'
result = gravatar_src(email, False)
... | blossomica/airmozilla | airmozilla/comments/tests/test_jinja_helpers.py | Python | bsd-3-clause | 1,016 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from preggy import expect
import click
from click.testing import CliRunner
from terrible.run import compile_template
from tests.base import TestCase
import os
class CompileTemplateTestCase(TestCase):
def test_compile_template(self):
base_dir = os.path.dirnam... | RobotsAndPencils/terrible | tests/test_run.py | Python | bsd-3-clause | 3,415 | 0.000586 |
import datetime
import re
import sys
from contextlib import contextmanager
from unittest import SkipTest, skipIf
from xml.dom.minidom import parseString
try:
import zoneinfo
except ImportError:
from backports import zoneinfo
try:
import pytz
except ImportError:
pytz = None
from django.contrib.auth.mo... | ar4s/django | tests/timezones/tests.py | Python | bsd-3-clause | 58,810 | 0.002041 |
# This file is part of thermotools.
#
# Copyright 2015, 2016 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# thermotools 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... | markovmodel/thermotools | test/test_callback.py | Python | lgpl-3.0 | 2,723 | 0.002203 |
#!/usr/bin/env python
# encoding: utf-8
"""
instrumentation.py
This file defines the various 'events' that can happen in the simlir system. Every
time an object in the simulation does something significant, it sends a message
to a global instrumentation object, which currently has a mild wrapping around them
for textu... | niallrmurphy/simlir | instrumentation.py | Python | gpl-2.0 | 8,970 | 0.014939 |
# coding: utf-8
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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
... | detiber/lib_openshift | test/test_v1_project.py | Python | apache-2.0 | 1,236 | 0.003236 |
from model.contact import Contact
import random
def test_delete_some_contact(app, db, check_ui):
if len(db.get_contact_list()) == 0:
app.contact.add(Contact(firstname="test"))
old_contacts = db.get_contact_list()
contact = random.choice(old_contacts)
app.contact.delete_contact_by_id(contact.i... | AndreyBalabanov/python_training | test/test_del_contact.py | Python | apache-2.0 | 633 | 0.00316 |
"""Test overloaded method resolution in VTK-Python
The wrappers should call overloaded C++ methods using similar
overload resolution rules as C++. Python itself does not have
method overloading.
Created on Feb 15, 2015 by David Gobbi
"""
import sys
import vtk
from vtk.test import Testing
class TestOverloads(Testi... | HopeFOAM/HopeFOAM | ThirdParty-0.1/ParaView-5.0.1/VTK/Common/Core/Testing/Python/TestOverloads.py | Python | gpl-3.0 | 2,562 | 0.005074 |
# -*- coding: utf-8 -*-
# Copyright: See the LICENSE file.
"""Helper to test circular factory dependencies."""
import factory
class TreeElement(object):
def __init__(self, name, parent):
self.parent = parent
self.name = name
class TreeElementFactory(factory.Factory):
class Meta:
mo... | rbarrois/factory_boy | tests/cyclic/self_ref.py | Python | mit | 467 | 0 |
"""
A simple file-system like interface that supports
both the regular filesystem and zipfiles
"""
__all__ = ('FileIO', 'ReadOnlyIO')
import os, time, zipfile
class FileIO (object):
"""
A simple interface that makes it possible
to write simple filesystem structures using
the interface that's exposed b... | kamitchell/py2app | py2app/simpleio.py | Python | mit | 5,394 | 0.002225 |
from datetime import datetime
from django.db.models import Count
import olympia.core.logger
from olympia.amo.celery import task
from olympia.amo.decorators import use_primary_db
from .models import Collection, CollectionAddon
log = olympia.core.logger.getLogger('z.task')
@task
@use_primary_db
def collection_met... | bqbn/addons-server | src/olympia/bandwagon/tasks.py | Python | bsd-3-clause | 1,228 | 0.002443 |
import os
from unipath import Path
from django.core.exceptions import ImproperlyConfigured
import dj_database_url
def env_var(var_name):
"""Get the environment variable var_name or return an exception."""
try:
return os.environ[var_name]
except KeyError:
msg = "Please set the environment ... | rskwan/mt | mt/mt/settings/base.py | Python | apache-2.0 | 2,992 | 0.003008 |
# Copyright (C) 2009 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | klim-iv/phantomjs-qt5 | src/webkit/Tools/Scripts/webkitpy/tool/steps/suggestreviewers_unittest.py | Python | bsd-3-clause | 2,415 | 0.001656 |
#!/usr/bin/env python
#
# Copyright 2012 the V8 project authors. 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
# noti... | teeple/pns_server | work/install/node-v0.10.25/deps/v8/tools/run-tests.py | Python | gpl-2.0 | 13,499 | 0.010371 |
# 主要是为了使用中文显示 app 于 admin 界面
default_app_config = 'bespeak_meal.apps.Bespeak_meal_config'
| zhengxinxing/bespeak_meal | __init__.py | Python | mit | 120 | 0.01087 |
# Copyright (c) 2016 Jiocloud.com, Inc. or its affiliates. All Rights Reserved
#
# 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 right... | jiocloudservices/jcsclient | src/jcsclient/compute_api/instance.py | Python | apache-2.0 | 7,005 | 0.001713 |
import copy
max_pro = 0
def find(list_foot_pmt, max_pmt):
max_pmtn = max_pmt
a = list_foot_pmt.pop(0)
for i in range(0, len(list_foot_pmt)):
max_pmt = max_pmtn
list_foot_pmt1 = copy.deepcopy(list_foot_pmt)
b =list_foot_pmt1.pop(i)
max_pmt += pro_matrix[a][b]
... | IT-SeanWANG/CodeJam | 2017_2nd/Q2_Refer2.py | Python | apache-2.0 | 1,200 | 0.003333 |
# -*- coding: utf-8 -*-
# PEP8:OK, LINT:OK, PY3:OK
#############################################################################
## This file may be used under the terms of the GNU General Public
## License version 2.0 or 3.0 as published by the Free Software Foundation
## and appearing in the file LICENSE.GPL includ... | juancarlospaco/vagrant | main.py | Python | gpl-3.0 | 23,005 | 0.005651 |
"""
Database API
(part of web.py)
"""
__all__ = [
"UnknownParamstyle", "UnknownDB", "TransactionError",
"sqllist", "sqlors", "reparam", "sqlquote",
"SQLQuery", "SQLParam", "sqlparam",
"SQLLiteral", "sqlliteral",
"database", 'DB',
]
import time
try:
import datetime
except ImportError:
datetime = Non... | pankajn17/intern | web/db.py | Python | gpl-3.0 | 40,670 | 0.007303 |
import unittest
from .connected_graph import Node
class TestConnectedGraph(unittest.TestCase):
def test_acyclic_graph(self):
"""Example graph from https://upload.wikimedia.org/wikipedia/commons/0/03/Directed_acyclic_graph_2.svg"""
n9 = Node(9)
n10 = Node(10)
n8 = Node(8, [n9])
... | intenthq/code-challenges | python/connected_graph/test_connected_graph.py | Python | mit | 910 | 0.002198 |
import pygraph.algorithms.generators as gen
import pygraph.algorithms.accessibility as acc
import pygraph.algorithms.minmax as minmax
graph = gen.generate(5000, 10000, weight_range=(50, 2000))
components = acc.connected_components(graph)
nodes = [g for g in graph if components[g] == 1]
print "GRAPH NODES"
for n in g... | kentya6/swift | utils/benchmark/Graph/generate-data.py | Python | apache-2.0 | 748 | 0.002674 |
EC2_INSTANCE_TYPES = [
't2.micro',
't2.small',
't2.medium'
]
RDS_INSTANCE_TYPES = [
'db.t2.micro'
]
ELASTICACHE_INSTANCE_TYPES = [
'cache.t2.micro'
]
ALLOW_ALL_CIDR = '0.0.0.0/0'
VPC_CIDR = '10.0.0.0/16'
GRAPHITE = 2003
GRAPHITE_WEB = 8080
HTTP = 80
HTTPS = 443
KIBANA = 5601
POSTGRESQL = 5432
RE... | mmcfarland/model-my-watershed | deployment/cfn/utils/constants.py | Python | apache-2.0 | 369 | 0 |
#!/usr/bin/python
import time
import datetime
import logging
import os
import syslog
#from os import path, access, R_OK
from time import sleep
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
# 22 = Relay 1, 27 = Relay 2, 17 = Relay 3
GPIO.setup(27, GPIO.OUT)
GPIO.setup(27, False)
sleep(2)
GPIO.setup(27, Tru... | tommybobbins/pipoegusca | test2.py | Python | gpl-2.0 | 347 | 0.002882 |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in"
" the directory containing %r. It appears you've customized "
"things.\n... | liveaverage/baruwa | src/baruwa/manage.py | Python | gpl-2.0 | 575 | 0.006957 |
"""Stateful programmatic WWW navigation, after Perl's WWW::Mechanize.
Copyright 2003-2006 John J. Lee <jjl@pobox.com>
Copyright 2003 Andy Lester (original Perl code)
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD or ZPL 2.1 licenses (see the file COPYING.txt
included w... | Masood-M/yalih | mechanize/_mechanize.py | Python | apache-2.0 | 31,059 | 0 |
import json
import django
from django.db import models
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.core.serializers.json import DjangoJSONEncoder
from django.d... | marguslaak/django-xadmin | xadmin/models.py | Python | bsd-3-clause | 4,934 | 0.001216 |
from helper.readtempsocket import ReadTempSocket
class asd:
def __init__(self):
r = ReadTempSocket()
r.run()
asd()
| braubar/braubar-pi | test/testReadTempSocket.py | Python | gpl-3.0 | 139 | 0.021583 |
import re
import sys
# Write the config.c file
never = ['marshal', '__main__', '__builtin__', 'sys', 'exceptions', '_warnings']
def makeconfig(infp, outfp, modules, with_ifdef=0):
m1 = re.compile('-- ADDMODULE MARKER 1 --')
m2 = re.compile('-- ADDMODULE MARKER 2 --')
while 1:
line = infp.readline... | teeple/pns_server | work/install/Python-2.7.4/Tools/freeze/makeconfig.py | Python | gpl-2.0 | 1,676 | 0.002983 |
#!/usr/bin/env python
"""
Hiveary
https://hiveary.com
Licensed under Simplified BSD License (see LICENSE)
(C) Hiveary, Inc. 2013-2014 all rights reserved
"""
import platform
import sys
from hiveary import __version__ as version
current_platform = platform.system()
FROZEN_NAME = 'hiveary-agent'
AUTHOR = "Hiveary"... | hiveary/hiveary-agent | setup.py | Python | bsd-3-clause | 3,550 | 0.010986 |
#!/usr/bin/env python
import ast
import os
import re
from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand
ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__)))
init = os.path.join(ROOT, 'src', 'concurrency', '__init__.py')
_version_re = re.compile(r'__version... | saxix/django-concurrency | setup.py | Python | mit | 2,485 | 0.000805 |
from __future__ import unicode_literals
from copy import copy, deepcopy
from datetime import datetime
import logging
import sys
from time import mktime
import traceback
import warnings
from wsgiref.handlers import format_date_time
import django
from django.conf import settings
from django.conf.urls import url
from dj... | Perkville/django-tastypie | tastypie/resources.py | Python | bsd-3-clause | 100,856 | 0.001874 |
# _*_ coding:utf-8 _*_
__author__ = 'Y-ling'
__date__ = '2017/9/15 11:11'
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
import unittest
import os
import time
import copy
import utils
from elements_path import LOGIN_FORM, TOP_BAR, CENTER, CENTER_PERSONAL, CENTER_RESET_PA... | cyllyq/nutsbp-test | test_case/demo.py | Python | gpl-2.0 | 407 | 0.004914 |
#!/usr/bin/python
# Test tool to disassemble MC files. By Nguyen Anh Quynh, 2017
import array, os.path, sys
from capstone import *
# convert all hex numbers to decimal numbers in a text
def normalize_hex(a):
while(True):
i = a.find('0x')
if i == -1: # no more hex number
break
h... | bSr43/capstone | suite/disasm_mc.py | Python | bsd-3-clause | 7,561 | 0.003835 |
#!/usr/bin/python
__author__ = 'Martin Samsula'
__email__ = '<martin@falanxia.com>'
import sys
import glob
import math
import xml.etree.ElementTree
import os
import os.path
try:
import simplejson
except:
import json
simplejson = json
def ds(data): return simplejson.dumps(data, indent=4, default=str)
fro... | falanxia/tileset_baker | merge.py | Python | mit | 9,760 | 0.003381 |
# -*- coding: utf-8 -*-
import io
from odoo import models
from odoo.tools.pdf import OdooPdfFileReader, OdooPdfFileWriter
class IrActionsReport(models.Model):
_inherit = 'ir.actions.report'
def _post_pdf(self, save_in_attachment, pdf_content=None, res_ids=None):
# OVERRIDE to embed some EDI documen... | jeremiahyan/odoo | addons/account_edi/models/ir_actions_report.py | Python | gpl-3.0 | 1,420 | 0.002113 |
# -*- coding:utf-8 -*-
#
# Copyright (C) 2008 The Android Open Source Project
#
# 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 re... | lewixliu/git-repo | subcmds/init.py | Python | apache-2.0 | 20,047 | 0.007333 |
# -*- test-case-name: twisted.test.test_strcred -*-
#
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Cred plugin for anonymous logins.
"""
from zope.interface import implementer
from twisted import plugin
from twisted.cred.checkers import AllowAnonymousAccess
from twisted.cred.strcred im... | bdh1011/wau | venv/lib/python2.7/site-packages/twisted/plugins/cred_anonymous.py | Python | mit | 968 | 0.003099 |
# 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... | Huyuwei/tvm | topi/python/topi/nn/sparse.py | Python | apache-2.0 | 7,132 | 0.00028 |
from guardian.compat import url, patterns
urlpatterns = patterns('posts.views',
url(r'^$', view='post_list', name='posts_post_list'),
url(r'^(?P<slug>[-\w]+)/$', view='post_detail', name='posts_post_detail'),
)
| jasonballensky/django-guardian | example_project/posts/urls.py | Python | bsd-2-clause | 222 | 0.009009 |
__author__ = 'Matteo'
__doc__='''This could be made into a handy mutagenesis library if I had time.'''
from Bio.Seq import Seq,MutableSeq
from Bio import SeqIO
from Bio.Alphabet import IUPAC
from difflib import Differ
def Gthg01471():
ori=Seq("ATGAGCATAAGTTTATCGGTTCCAAAATGGTTATTAACAGTTTTATCAATTTTATCTTTAGTCGTAGCAT... | matteoferla/Geobacillus | geo_mutagenesis.py | Python | gpl-2.0 | 2,769 | 0.015529 |
#!/usr/bin/env python
# standard library imports
import signal
# third party related imports
import boto.sqs
import ujson
# local library imports
from mobile_push.config import setting
from mobile_push.logger import logger
from mobile_push.message_router import MessageRouter
keep_running = True
def sigterm_handl... | theKono/mobile-push | bin/competing_consumer.py | Python | apache-2.0 | 1,384 | 0 |
'''
This script analyzes the Boston housing dataset available via scikit-learn. It
generates a textual report and a set of plot images into the 'report' directory.
'''
import logging
import matplotlib
# non-interactive plotting - just outputs the images and doesn't open the window
matplotlib.use('Agg')
import matplotl... | bzamecnik/ml-playground | ml-playground/boston_dataset_exploration/data_analysis.py | Python | mit | 6,084 | 0.006903 |
# Copyright (c) 2013, Bob Van Zant <bob@veznat.com>
# All rights reserved.
#
# See LICENSE file for full license.
import warnings
from . import AWSHelperFn, AWSObject, AWSProperty, Tags
from .validators import boolean, positive_integer, s3_bucket_name
from .validators import s3_transfer_acceleration_status
try:
f... | pas256/troposphere | troposphere/s3.py | Python | bsd-2-clause | 11,735 | 0 |
#!/usr/bin/env python
# Copyright (c) 2011 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.
"""Makes sure that files include headers from allowed directories.
Checks DEPS files in the source tree for rules, and applies tho... | rogerwang/chromium | tools/checkdeps/checkdeps.py | Python | bsd-3-clause | 17,591 | 0.008925 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2010-2012 Asidev s.r.l.
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... | asidev/aybu-manager | tests/test_activity_log.py | Python | apache-2.0 | 7,363 | 0.001087 |
import cPickle
import numpy as np
import cv2
def unpickle(file):
fo = open(file, 'rb')
dict = cPickle.load(fo)
fo.close()
return dict
files = ['../../datasets/svhn/cifar-10-batches-py/data_batch_1']
dict = unpickle(files[0])
images = dict['data'].reshape(-1, 3, 32, 32)
labels = np.array(dict['label... | penny4860/SVHN-deep-digit-detector | tests/cifar_loader.py | Python | mit | 487 | 0.008214 |
# -*- coding: utf-8 -*-
#
# traceview documentation build configuration file, created by
# sphinx-quickstart on Fri May 2 20:12:10 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | danriti/python-traceview | docs/conf.py | Python | mit | 8,222 | 0.006324 |
# coding: utf-8
#!/usr/bin/env python
from setuptools import setup, find_packages
readme = open('README.rst').read()
setup(
name='wecha',
version='${version}',
description='',
long_description=readme,
author='the5fire',
author_email='thefivefire@gmail.com',
url='http://chat.the5fire.com',... | the5fire/wechat | setup.py | Python | apache-2.0 | 542 | 0.009225 |
#!/usr/bin/env python
# Copyright 2015-2017 ARM Limited
#
# 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... | arm-hpc/allinea_json_analysis | PR_JSON_Scripts/plot_pr_bar.py | Python | apache-2.0 | 5,284 | 0.005678 |
'''
Created on Oct 20, 2015
@author: Dallas
'''
| fras2560/graph-helper | algorithms/critical.py | Python | apache-2.0 | 49 | 0 |
# Generated by Django 3.0.7 on 2020-09-09 22:30
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('daphne_context', '0007_auto_20191111_1756'),
('AT', '0015_auto_20200909_1334'),
]
operations = [
mi... | seakers/daphne_brain | AT/migrations/0016_auto_20200909_1730.py | Python | mit | 1,470 | 0.001361 |
from django.db import models
from django_crypto_fields.fields import EncryptedTextField
from edc_base.model.models import BaseUuidModel
try:
from edc_sync.mixins import SyncMixin
except ImportError:
SyncMixin = type('SyncMixin', (object, ), {})
from ..managers import CallLogManager
class CallLog (SyncMixin... | botswana-harvard/edc-contact | edc_contact/models/call_log.py | Python | gpl-2.0 | 1,199 | 0 |
from .api.api import Api
from .api.bot_configuration import BotConfiguration
from .version import __version__
__all__ = ['Api', 'BotConfiguration']
__version__ = __version__ | Feduch/pyMessengerBotApi | messengerbot/__init__.py | Python | gpl-3.0 | 174 | 0.005747 |
"""
This module provides a :class:`~xblock.field_data.FieldData` implementation
which wraps an other `FieldData` object and provides overrides based on the
user. The use of providers allows for overrides that are arbitrarily
extensible. One provider is found in `lms.djangoapps.courseware.student_field_overrides`
whic... | philanthropy-u/edx-platform | lms/djangoapps/courseware/field_overrides.py | Python | agpl-3.0 | 11,496 | 0.001131 |
"""Provides a class for managing BIG-IP L7 Rule Action resources."""
# coding=utf-8
#
# Copyright (c) 2017-2021 F5 Networks, Inc.
#
# 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:/... | f5devcentral/f5-cccl | f5_cccl/resource/ltm/policy/action.py | Python | apache-2.0 | 5,095 | 0.000196 |
from .taylor_nonlinear_hillslope_flux import TaylorNonLinearDiffuser
__all__ = ["TaylorNonLinearDiffuser"]
| cmshobe/landlab | landlab/components/taylor_nonlinear_hillslope_flux/__init__.py | Python | mit | 108 | 0 |
#! /usr/bin/env python
"""pandoc-fignos: a pandoc filter that inserts figure nos. and refs."""
# Copyright 2015, 2016 Thomas J. Duck.
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Softwa... | alexin-ivan/zfs-doc | filters/pandoc_fignos.py | Python | mit | 11,034 | 0.002991 |
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django_comment_common.models import Role
from django.contrib.auth.models import User
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--remove',
ac... | louyihua/edx-platform | lms/djangoapps/django_comment_client/management/commands/assign_role.py | Python | agpl-3.0 | 1,144 | 0 |
"""Selenium tests for netmap"""
def test_netmap_index_should_not_have_syntax_errors(selenium, base_url):
selenium.get("{}/netmap/".format(base_url))
log = selenium.get_log("browser")
syntax_errors = [
line
for line in log
if "syntaxerror" in line.get("message", "").lower()
... | hmpf/nav | tests/functional/netmap_test.py | Python | gpl-3.0 | 394 | 0 |
# -*- test-case-name: twisted.pb.test.test_promise -*-
from twisted.python import util, failure
from twisted.internet import defer
id = util.unsignedID
EVENTUAL, FULFILLED, BROKEN = range(3)
class Promise:
"""I am a promise of a future result. I am a lot like a Deferred, except
that my promised result is us... | tquilian/exelearningTest | twisted/pb/promise.py | Python | gpl-2.0 | 3,532 | 0.001133 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.