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 |
|---|---|---|---|---|---|---|
"""
WSGI config for django_rest_test project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLI... | fqc/django_rest_test | django_rest_test/wsgi.py | Python | mit | 1,449 | 0.00069 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..registration import MeasureImageSimilarity
def test_MeasureImageSimilarity_inputs():
input_map = dict(args=dict(argstr='%s',
),
dimension=dict(argstr='--dimensionality %d',
position=1,
),
envir... | mick-d/nipype | nipype/interfaces/ants/tests/test_auto_MeasureImageSimilarity.py | Python | bsd-3-clause | 1,674 | 0.0227 |
import IMP
import IMP.test
import IMP.core
import IMP.atom
class Tests(IMP.test.TestCase):
def test_bonded(self):
"""Check close and destroy Hierarchy """
m = IMP.Model()
mh = IMP.atom.read_pdb(self.get_input_file_name("mini.pdb"), m)
nump = len(m.get_particle_indexes())
m... | shanot/imp | modules/atom/test/test_clone.py | Python | gpl-3.0 | 1,208 | 0.000828 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... | guillaume-philippon/aquilon | lib/aquilon/worker/commands/update_machine.py | Python | apache-2.0 | 16,386 | 0.000305 |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import array
import math
import os
import random
import sys
import subprocess
def create_graph(nodes, edges, verbose):
if verbose: print('Creating random graph with {} nodes and {} edges...'.format(nodes, edges))
n1 = [ random.randin... | chuckatkins/legion | language/examples/mssp/gen_graph.py | Python | apache-2.0 | 8,232 | 0.008017 |
#!/usr/bin/python
#
# Copyright 2015 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... | wubr2000/googleads-python-lib | examples/dfp/v201502/creative_template_service/get_all_creative_templates.py | Python | apache-2.0 | 1,984 | 0.008569 |
#!/usr/bin/python
"""
This example demonstrates several features of PyLaTeX.
It includes plain equations, tables, equations using numpy objects, tikz plots,
and figures.
.. :copyright: (c) 2014 by Jelte Fennema.
:license: MIT, see License for more details.
"""
# begin-doc-include
import numpy as np
from pylate... | bjodah/PyLaTeX | examples/full.py | Python | mit | 2,838 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from corehq.form_processor.models import CaseTransaction
from corehq.sql_db.operations import RawSQLMigration, HqRunSQL
migrator = RawSQLMigration(('corehq', 'sql_accessors', 'sql_templates'), {
'TRANSACTION_TYPE_FOR... | qedsoftware/commcare-hq | corehq/sql_accessors/migrations/0025_update_get_ledger_values_for_cases.py | Python | bsd-3-clause | 703 | 0 |
#!/usr/bin/python
import os
import psycopg2
import sys
import django_content_type_mapping
file = open("/home/" + os.getlogin() + "/.pgpass", "r")
pgpasses = []
for line in file:
pgpasses.append(line.rstrip("\n").split(":"))
file.close()
for pgpass in pgpasses:
#print str(pgpass)
if pgpass[0] == "54.236.235.110"... | DOE-NEPA/geonode_2.0_to_2.4_migration | migrate_documents_document_modified.py | Python | gpl-2.0 | 2,363 | 0.025815 |
#coding=utf-8
# Copyright (C) 2014 by Víctor Romero Blanco <info at playcircular dot com>.
# http://playcircular.com/
# It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
# You can get copies of the licenses here: http://www.affero.org/oagpl.html
# AFFERO GENERAL PUBLIC LICENSE is also incl... | PlayCircular/play_circular | apps/actividades/admin_views.py | Python | agpl-3.0 | 2,927 | 0.02188 |
"""Test the IPython.kernel public API
Authors
-------
* MinRK
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed ... | noslenfa/tdjangorest | uw/lib/python2.7/site-packages/IPython/kernel/tests/test_public_api.py | Python | apache-2.0 | 1,308 | 0.006881 |
"""
"""
from traceback import format_exc as debug
from vyapp.stdout import Stdout
from vyapp.tools import exec_quiet, set_status_msg
from vyapp.ask import *
import sys
def redirect_stdout(area):
try:
sys.stdout.remove(area)
except ValueError:
pass
sys.stdout.append(Stdout(area))
set_... | miku/vy | vyapp/plugins/box.py | Python | mit | 875 | 0.009143 |
import os
import sys
import codecs
from contextlib import contextmanager
from itertools import repeat
from functools import update_wrapper
from .types import convert_type, IntRange, BOOL
from .utils import make_str, make_default_short_help, echo
from .exceptions import ClickException, UsageError, BadParameter, Abort, ... | sourlows/rating-cruncher | src/lib/click/core.py | Python | apache-2.0 | 65,670 | 0.000091 |
try:
from xml.etree import cElementTree as etree
except ImportError:
from xml.etree import ElementTree as etree
import xml2nrn
# module names derived from the namespace. Add new tags in proper namespace
import neuroml
import metadata
import morphml
import biophysics
class FileWrapper:
def __init__(self, sou... | neurodebian/pkg-neuron | share/lib/python/neuron/neuroml/rdxml.py | Python | gpl-2.0 | 1,545 | 0.029126 |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Philippe Biondi <phil@secdev.org>
# This program is published under a GPLv2 license
"""
Aggregate top level objects from all Scapy modules.
"""
from scapy.base_classes import *
from scapy.config import *
from ... | gpotter2/scapy | scapy/all.py | Python | gpl-2.0 | 1,320 | 0 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.4.1)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x01\xf1\
\x00\
\x00\x09\x00\x78\x9c\xdd\x96\x51\x6f\x9b\x30\x10\xc7\xdf\xfb\x29\
\x3c\x1e\x9a\x4... | testmana2/test | Helpviewer/Bookmarks/DefaultBookmarks_rc.py | Python | gpl-3.0 | 2,920 | 0.001712 |
from __future__ import unicode_literals
import datetime
from boto.ec2.elb.attributes import (
LbAttributes,
ConnectionSettingAttribute,
ConnectionDrainingAttribute,
AccessLogAttribute,
CrossZoneLoadBalancingAttribute,
)
from boto.ec2.elb.policies import (
Policies,
OtherPolicy,
)
from moto.... | heddle317/moto | moto/elb/models.py | Python | apache-2.0 | 15,471 | 0.001357 |
from fbchat import GroupData, User
def test_group_from_graphql(session):
data = {
"name": "Group ABC",
"thread_key": {"thread_fbid": "11223344"},
"image": None,
"is_group_thread": True,
"all_participants": {
"nodes": [
{"messaging_actor": {"__typ... | carpedm20/fbchat | tests/threads/test_group.py | Python | bsd-3-clause | 1,493 | 0 |
/// <reference path="./testBlocks/enums.ts" />
enum EnumOfFlags {
W = 1,
X = 1 << 1,
Z = 1 << 3
}
let userDefinedTest7 = EnumOfFlags.W | switch-education/pxt | tests/pydecompile-test/baselines/enum_user_defined_bit_mask_bad_sequence.py | Python | mit | 148 | 0.027027 |
import itertools
import os
class TreeHasher():
"""uses BlockHasher recursively on a directory tree
Input and output generators are in the format: ( relative-filepath, chunk_nr, hexdigest)
"""
def __init__(self, block_hasher):
"""
:type block_hasher: BlockHasher
"""
... | psy0rz/zfs_autobackup | zfs_autobackup/TreeHasher.py | Python | gpl-3.0 | 2,011 | 0.015415 |
# Microcosmos: an antsy game
# Copyright (C) 2010 Cyril ADRIAN <cyril.adrian@gmail.com>
#
# 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 3 exclusively.
#
# This program is distrib... | cadrian/microcosmos | src/net/cadrian/microcosmos/model/bugs/__init__.py | Python | gpl-3.0 | 1,120 | 0.000893 |
import wx
import wiggler.ui.dialogs as dialogs
class ResourceManager(wx.Control):
def __init__(self, parent, resources, events):
wx.Control.__init__(self, parent)
self.parent = parent
self.events = events
self.resources = resources
self.events.subscribe(self, ['add_costum... | ProgrammaBol/wiggler | wiggler/ui/resources.py | Python | gpl-3.0 | 10,546 | 0 |
#!/usr/bin/env python
# Thu, 13 Mar 14 (PDT)
# bpf-filter.rb: Create a packet filter,
# use it to print udp records from a trace
# Copyright (C) 2015, Nevil Brownlee, U Auckland | WAND
from plt_testing import *
t = get_example_trace('anon-v4.pcap')
filter = plt.filter('udp port 53') # Only want DNS ... | nevil-brownlee/pypy-libtrace | test/pypy-test-cases/test-bpf-filter.py | Python | gpl-3.0 | 780 | 0.007692 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | runt18/nupic | src/nupic/algorithms/CLAClassifier.py | Python | agpl-3.0 | 25,671 | 0.006544 |
#
# 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 us... | charlesccychen/beam | sdks/python/apache_beam/transforms/window.py | Python | apache-2.0 | 18,027 | 0.007544 |
# Copyright (C) 2008, One Laptop Per Child
# Copyright (C) 2009, Tomeu Vizoso
#
# 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 v... | rparrapy/sugar | extensions/cpsection/updater/view.py | Python | gpl-2.0 | 16,181 | 0 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/loot/loot_schematic/shared_death_watch_mandalorian_belt_schematic.if... | obi-two/Rebelion | data/scripts/templates/object/tangible/loot/loot_schematic/shared_death_watch_mandalorian_belt_schematic.py | Python | mit | 509 | 0.043222 |
#
# Authors:
# Pavel Brezina <pbrezina@redhat.com>
#
# Copyright (C) 2017 Red Hat
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at yo... | fidencio/sssd | src/sbus/codegen/sbus_Introspection.py | Python | gpl-3.0 | 9,617 | 0 |
from src.platform.jboss.interfaces import JMXInterface
class FPrint(JMXInterface):
def __init__(self):
super(FPrint, self).__init__()
self.version = "5.0"
| GHubgenius/clusterd | src/platform/jboss/fingerprints/JBoss5JMX.py | Python | mit | 182 | 0.005495 |
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^profiles/', include('easy_profiles.urls')),
(r'^admin/', include(admin.site.urls)),
)
| pydanny/django-easy-profiles | test_project/urls.py | Python | mit | 223 | 0.004484 |
#-------------------------------------------------------------------------------
# Copyright (c) 2012 Gael Honorez.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0
# which accompanies this distribution, and is available at
# http://w... | HaraldWeber/client | src/modvault/utils.py | Python | gpl-3.0 | 15,457 | 0.012292 |
"""
series.py
:copyright: (c) 2014-2015 by Onni Software Ltd.
:license: New BSD License, see LICENSE for more details
This shows how to use **SeriesReader** to get the data in various ways
But you can use them with **Reader** class as well
"""
import os
from pyexcel.ext import ods3
from pyexcel import SeriesReader
fro... | lordakshaya/pyexcel | examples/example_usage_of_internal_apis/simple_usage/series.py | Python | bsd-3-clause | 2,753 | 0.006902 |
#!/usr/bin/env python
print("Hello world!")
| geography-munich/sciprog | material/sub/jrjohansson/scripts/hello-world.py | Python | apache-2.0 | 45 | 0 |
# Copyright 2014-2015 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 law or agreed to in w... | ep1cman/workload-automation | wlauto/devices/linux/odroidxu3_linux/__init__.py | Python | apache-2.0 | 1,073 | 0.001864 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('customers', '0009_recipient_type'),
]
operations = [
migrations.AlterModelOptions(
name='recipient',
... | davogler/POSTv3 | customers/migrations/0010_auto_20170124_2322.py | Python | mit | 412 | 0.002427 |
'''
Given: A positive integer N≤100000, a number x between 0 and 1, and a DNA string s of length at most 10 bp.
Return: The probability that if N random DNA strings having the same length as s are constructed with GC-content x
(see “Introduction to Random Strings”), then at least one of the strings equals s.
We allo... | jr55662003/My_Rosalind_solution | RSTR.py | Python | gpl-3.0 | 1,176 | 0.008547 |
#! /usr/bin/env python
"""Show file statistics by extension."""
import os
import sys
class Stats:
def __init__(self):
self.stats = {}
def statargs(self, args):
for arg in args:
if os.path.isdir(arg):
self.statdir(arg)
elif os.path.isfile(arg):
... | OS2World/APP-INTERNET-torpak_2 | Tools/scripts/byext.py | Python | mit | 3,894 | 0.002311 |
# Copyright (c) 2012 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | leeseuljeong/leeseulstack_neutron | neutron/api/v2/attributes.py | Python | apache-2.0 | 28,875 | 0.000035 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/food/shared_dish_cho_nor_hoola.iff"
result.attribute_templ... | obi-two/Rebelion | data/scripts/templates/object/draft_schematic/food/shared_dish_cho_nor_hoola.py | Python | mit | 452 | 0.04646 |
"""
A reader for corpora whose documents are in MTE format.
"""
import os
from functools import reduce
from nltk import compat
from nltk.corpus.reader import concat, TaggedCorpusReader
lxmlAvailable = False
try:
from lxml import etree
lxmlAvailable = True
except ImportError:
#first try c version of Element... | jwacalex/MULTEX-EAST-PoS-Tagger | mte.py | Python | lgpl-3.0 | 12,810 | 0.009446 |
#!/usr/bin/env python
from setuptools import setup
NAME = 'coinshot'
DESCRIPTION = 'simple python module for pushover.net'
VERSION = open('VERSION').read().strip()
LONG_DESC = open('README.rst').read()
LICENSE = "MIT License"
setup(
name=NAME,
version=VERSION,
author='Charles Thomas',
author_email='ch... | charlesthomas/coinshot | setup.py | Python | mit | 1,206 | 0.000829 |
import os
import tweepy
from query_db import query_db, send_user_queries_to_db, read_in_bb_file
from our_keys.twitter_keys import my_keys
from itertools import chain, repeat
u"""Reads in a file of cities and their bounding boxes. Queries the
database to get a list of all unique users who have tweeted from that
city. ... | lnhubbell/tweetTrack | streamScript/domain/get_tweets_by_user.py | Python | mit | 5,107 | 0.000196 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Agent that gets the local keyboard input in the act() function.
Applies safety classifier(s) to process user and par... | facebookresearch/ParlAI | parlai/agents/safe_local_human/safe_local_human.py | Python | mit | 4,597 | 0.00087 |
#!/usr/bin/env python
import roslib
roslib.load_manifest('human_model')
import rospy
import json
import tf
import numpy
from abc import ABCMeta,abstractmethod
from tf.transformations import quaternion_multiply as quatMult,quaternion_conjugate
from collections import deque,defaultdict,OrderedDict
"""Module for converti... | metu-kovan/human_model | src/animator.py | Python | gpl-3.0 | 8,441 | 0.050468 |
#!/usr/bin/env python3
#
# This file generates an estimation of window size for the
# two queues for _each_ sample. It will not be exact, and
# it's correctness will vary with the variation of queue delay
# in the queue.
#
# The results are saved to:
# - derived/window
# each line formatted as: <sample id> <window ec... | henrist/aqmt | aqmt/calc_window.py | Python | mit | 2,753 | 0.001453 |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
import copy
import json
import re
from svtplay_dl.error import ServiceError
from svtplay_dl.fetcher.hls import hlsparse
from svtplay_dl.fetcher.http import HTTP
from svtplay_dl.service import OpenGraphThumbMixin
from svtplay_dl.se... | spaam/svtplay-dl | lib/svtplay_dl/service/vimeo.py | Python | mit | 1,817 | 0.003302 |
# Copyright (c) 2013 eBay Inc.
# Copyright (c) 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/lice... | Thingee/cinder | cinder/scheduler/weights/capacity.py | Python | apache-2.0 | 3,311 | 0.000302 |
from PyQt4 import QtCore
import acq4.Manager
import acq4.util.imageAnalysis as imageAnalysis
run = True
man = acq4.Manager.getManager()
cam = man.getDevice('Camera')
frames = []
def collect(frame):
global frames
frames.append(frame)
cam.sigNewFrame.connect(collect)
def measure():
if len(frames)... | tropp/acq4 | acq4/analysis/scripts/beamProfiler.py | Python | mit | 976 | 0.009221 |
"""
This version of julian is currently in development and is not considered stable.
""" | ithinksw/philo | philo/contrib/julian/__init__.py | Python | isc | 89 | 0.033708 |
import timeit
import pyximport; pyximport.install()
from mod2 import cysum, cysum2
def pysum(start, step, count):
ret = start
for i in range(count):
ret += step
return ret
print('Python',
timeit.timeit('pysum(0, 1, 100)', 'from __main__ import pysum'))
print('Cython', timeit.timeit('cysum(0... | asvetlov/optimization-kaunas-2017 | 2.py | Python | apache-2.0 | 463 | 0.006479 |
# Copyright (C) 2008 LibreSoft
#
# 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 the ... | SoftwareIntrospectionLab/MininGit | pycvsanaly2/extensions/FileTypes.py | Python | gpl-2.0 | 6,480 | 0.00571 |
# Copyright (c) 2018 PaddlePaddle 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 app... | jacquesqiao/Paddle | python/paddle/fluid/tests/unittests/test_fake_quantize_op.py | Python | apache-2.0 | 1,823 | 0 |
# -*- coding: utf-8 -*-
import re
class StringParser(object):
@staticmethod
def removeCFU(stringToParse):
updatedString = re.sub('\s?[0-9] CFU.*', '', stringToParse)
return updatedString
@staticmethod
def startsWithUpper(stringToParse):
stringToParse = stringToParse[0].upper()+stringToParse[1:]
return strin... | Veeenz/Telegram-DMI-Bot | classes/StringParser.py | Python | gpl-3.0 | 328 | 0.036585 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-22 14:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('news', '0002_event'),
]
operations = [
migrations.AddField(
mod... | luisfer85/newspaper2 | newspaper2/newspaper2/news/migrations/0003_event_publish_date.py | Python | apache-2.0 | 520 | 0.001923 |
"""
This module provides classes to run and analyze boltztrap on pymatgen band
structure objects. Boltztrap is a software interpolating band structures and
computing materials properties from this band structure using Boltzmann
semi-classical transport theory.
Boltztrap has been developed by Georg Madsen.
http://www.... | vorwerkc/pymatgen | pymatgen/electronic_structure/boltztrap.py | Python | mit | 103,362 | 0.001887 |
from seth import versioning
from seth.tests import IntegrationTestBase
from seth.classy.rest import generics
class DefaultVersioningResource(generics.GenericApiView):
def get(self, **kwargs):
return {}
class NotShowVersionResource(generics.GenericApiView):
display_version = False
def get(self,... | jnosal/seth | seth/tests/test_versioning.py | Python | mit | 6,814 | 0.001761 |
"""CSS selector structure items."""
import copyreg
from collections.abc import Hashable, Mapping
__all__ = (
'Selector',
'SelectorNull',
'SelectorTag',
'SelectorAttribute',
'SelectorContains',
'SelectorNth',
'SelectorLang',
'SelectorList',
'Namespaces',
'CustomSele... | SickGear/SickGear | lib/soupsieve_py3/css_types.py | Python | gpl-3.0 | 8,916 | 0.001682 |
"""Tests for input validation functions"""
import warnings
from tempfile import NamedTemporaryFile
from itertools import product
import numpy as np
from numpy.testing import assert_array_equal, assert_warns
import scipy.sparse as sp
from nose.tools import assert_raises, assert_true, assert_false, assert_equal
from ... | danbob123/gplearn | gplearn/skutils/tests/test_validation.py | Python | bsd-3-clause | 14,136 | 0.000283 |
#!/usr/bin/env python
# Copyright (c) 2016 Orange and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# pylint: d... | mywulin/functest | functest/tests/unit/cli/test_cli_base.py | Python | apache-2.0 | 3,933 | 0 |
from pylayers.antprop.antenna import *
from pylayers.antprop.antvsh import *
import matplotlib.pylab as plt
from numpy import *
import pdb
"""
This test :
1 : loads a measured antenna
2 : applies an electrical delay obtained from data with getdelay method
3 : evaluate the antenna vsh coefficient with a down... | buguen/pylayers | pylayers/antprop/examples/ex_antenna5.py | Python | lgpl-3.0 | 2,472 | 0.029126 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015 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 Softwa... | Kingdread/qutebrowser | qutebrowser/browser/tabhistory.py | Python | gpl-3.0 | 5,900 | 0.003559 |
"""
@brief test tree node (time=50s)
"""
import sys
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, ExtTestCase
from pyquickhelper.pycode.venv_helper import create_virtual_env
class TestVenvHelper(ExtTestCase):
def test_venv_empty(self):... | sdpython/pyquickhelper | _unittests/ut_pycode/test_venv_helper.py | Python | mit | 902 | 0 |
# coding: utf-8
#
# This file is part of mpdav.
#
# mpdav 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.
#
# mpdav is distributed in t... | mprochnow/mpdav | mpdav/file_backend.py | Python | gpl-3.0 | 12,064 | 0.001078 |
# Copyright (c) 2012-2015 The GPy authors (see AUTHORS.txt)
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
import scipy
from ..util.univariate_Gaussian import std_norm_cdf, std_norm_pdf
import scipy as sp
from ..util.misc import safe_exp, safe_square, safe_cube, safe_quad, safe_three_ti... | befelix/GPy | GPy/likelihoods/link_functions.py | Python | bsd-3-clause | 4,850 | 0.008454 |
def dev_nav(active=None):
from uliweb import settings
out = "<span>"
for i in settings.MENUS_DEVELOP.nav:
if active!=i["name"]:
out += "<a href='%s'>%s<a> "%(i["link"],i["title"])
else:
out += "<strong>%s</strong> "%(i["title"])
out += "</span>"
return out
| limodou/uliweb | uliweb/contrib/develop/__init__.py | Python | bsd-2-clause | 318 | 0.012579 |
import os
from traits.api import HasTraits
from traitsui.api import View, Item
from enable.savage.trait_defs.ui.svg_button import SVGButton
pause_icon = os.path.join(os.path.dirname(__file__), 'player_pause.svg')
resume_icon = os.path.join(os.path.dirname(__file__), 'player_play.svg')
class SVGDemo(HasTraits):
... | tommy-u/enable | examples/savage/toggle_demo.py | Python | bsd-3-clause | 673 | 0.002972 |
"""RPC Implementation, originally written for the Python Idle IDE
For security reasons, GvR requested that Idle's Python execution server process
connect to the Idle process, which listens for the connection. Since Idle has
only one client per server, this was not a limitation.
+---------------------------------+... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/idlelib/rpc.py | Python | gpl-2.0 | 21,137 | 0.000899 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import easyiceconfig as EasyIce
import jderobotComm as comm
import sys, signal
sys.path.append('/usr/local/share/jderobot/python/visualHFSM_py')
import traceback, threading, time
from automatagui import AutomataGui, QtGui, GuiSubautomata
from jderobot import MotorsPrx
from jd... | okanasik/JdeRobot | src/tools/visualStates/samples/goforward/goforward.py | Python | gpl-3.0 | 4,201 | 0.035468 |
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "AWS IoT Analytics"
prefix = "iotanalytics"
class Action(BaseAction):
def __init__(self, action: str = None) -> None:
... | cloudtools/awacs | awacs/iotanalytics.py | Python | bsd-2-clause | 2,141 | 0.000467 |
INSTALLED_APPS= ["django_nose"]
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = [
'--with-xunit',
'--xunit-file=jenkins/nosetests.xml',
]
| BirkbeckCTP/janeway | jenkins/janeway_settings.py | Python | agpl-3.0 | 160 | 0.00625 |
import os
from anchore_engine.analyzers.syft.handlers.common import save_entry_to_findings
from anchore_engine.analyzers.utils import dig
def save_entry(findings, engine_entry, pkg_key=None):
if not pkg_key:
pkg_name = engine_entry.get("name", "")
pkg_version = engine_entry.get(
"vers... | anchore/anchore-engine | anchore_engine/analyzers/syft/handlers/python.py | Python | apache-2.0 | 2,570 | 0.002724 |
# Copyright 2014-2016 OpenMarket Ltd
#
# 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 w... | matrix-org/synapse | contrib/experiments/cursesio.py | Python | apache-2.0 | 4,229 | 0.000473 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
#
# A Jira shell (using the Jira XML-RPC API).
#
# <https://confluence.atlassian.com/display/JIRA042/Creating+a+XML-RPC+Client>
# <http://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/com/atlassian/jira/rpc/xmlrpc/XmlRpcService.html>
#
__version__ = "1.6.... | m42e/jirash | lib/jirashell.py | Python | mit | 48,170 | 0.003405 |
#!/usr/bin/env python
# runTests.py -- Portage Unit Test Functionality
# Copyright 2006-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import os, sys
import os.path as osp
import grp
import platform
import pwd
import signal
def debug_signal(signum, frame):
import pdb
pdb.s... | dol-sen/portage | repoman/pym/repoman/tests/runTests.py | Python | gpl-2.0 | 1,959 | 0.009188 |
import os
import py
import pytest
import numpy as np
import openpnm as op
from openpnm.models.misc import from_neighbor_pores
@pytest.mark.skip(reason="'netgen' is only available on conda")
class STLTest:
def setup_class(self):
np.random.seed(10)
self.net = op.network.Cubic(shape=[2, 2, 2])
... | PMEAL/OpenPNM | tests/unit/io/STLTest.py | Python | mit | 1,388 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2010 Anso Labs, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... | sorenh/cc | nova/__init__.py | Python | apache-2.0 | 1,336 | 0.000749 |
"""
EtcUdevRules - file ``/etc/udev/rules.d/``
==========================================
This module is similar to the :py:mod:`insights.parsers.udev_rules`
but parse .rules files under ``/etc/ude/rules.d/`` directory instead.
The parsers included in this module are:
UdevRules40Redhat - file ``/etc/udev/rules.d/40-... | RedHatInsights/insights-core | insights/parsers/etc_udev_rules.py | Python | apache-2.0 | 1,878 | 0.001065 |
import numpy as np
import theano
from theano import tensor as T
from generateTrainDataonText import createTrain
from neuralmodels.utils import permute
from neuralmodels.loadcheckpoint import *
from neuralmodels.costs import softmax_loss
from neuralmodels.models import *
from neuralmodels.predictions import OutputMaxPro... | avisingh599/NeuralModels | character-rnn/char-rnn.py | Python | mit | 1,663 | 0.048707 |
import getpass
import json
import getopt
from genericpath import isfile
from os.path import sep
from pingdumb.main_module import url_type
def read_config():
f_path = "." + sep + "pingdumb.json"
if not isfile(f_path):
f = open(f_path, 'w')
conf = {
"url": "jellyms.kr",
... | kyunooh/pingdumb | pingdumb/conf.py | Python | apache-2.0 | 2,422 | 0.002064 |
#!/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.
import cStringIO
import difflib
import os
import sys
import unittest
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
BUILD... | Jonekee/chromium.src | native_client_sdk/src/build_tools/tests/easy_template_test.py | Python | bsd-3-clause | 3,559 | 0.006182 |
"""
WSGI config for Tuteria-Application-Test project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WS... | Tuteria/Recruitment-test | config/wsgi.py | Python | mit | 1,461 | 0 |
from sklearn.cluster import KMeans
kmeans = KMeans(n_clusters=10)
clusters = kmeans.fit_predict(digits.data)
print kmeans.cluster_centers_.shape
#------------------------------------------------------------
# visualize the cluster centers
fig = plt.figure(figsize=(8, 3))
for i in range(10):
ax = fig.add_subplot(2... | ageek/confPyNotebooks | sklearn-scipy-2013/solutions/08B_digits_clustering.py | Python | gpl-2.0 | 767 | 0.003911 |
from typing import List
from collections import defaultdict, Counter
class Solution:
def shortestCompletingWordV1(self, licensePlate: str, words: List[str]) -> str:
# build the signature of licensePlate
sig = defaultdict(int)
for c in licensePlate.upper():
if c.isalpha():
... | l33tdaima/l33tdaima | p748e/shortest_completing_word.py | Python | mit | 2,378 | 0.009672 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-04-28 15:02
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0106_auto_20170428_1119'),
]
operations = [
... | uclouvain/OSIS-Louvain | base/migrations/0107_learningunit_learning_container.py | Python | agpl-3.0 | 577 | 0.001733 |
#
# 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... | nathanielvarona/airflow | airflow/utils/dag_processing.py | Python | apache-2.0 | 49,728 | 0.002413 |
import socket
import fcntl
import struct
def get_ip_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(
s.fileno(),
0x8915, # SIOCGIFADDR
struct.pack('256s', ifname[:15])
)[20:24])
>>> get_ip_address('lo')
'127.0.0.1'
>>> get... | ActiveState/code | recipes/Python/439094_get_IP_address_associated_network_interface/recipe-439094.py | Python | mit | 357 | 0.011204 |
# Copyright (c) 2011 Florian Mounier
# Copyright (c) 2012, 2014 Tycho Andersen
# Copyright (c) 2013 Craig Barnes
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014 Adi Sieker
# Copyright (c) 2014 Sebastien Blot
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and assoc... | de-vri-es/qtile | test/test_fakescreen.py | Python | mit | 15,532 | 0.000064 |
# Copyright (C) 2015 https://github.com/thof
#
# This file is part of decapromolist.
#
# decapromolist 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.
#... | thof/decapromolist | src/get_subcategories.py | Python | gpl-3.0 | 3,880 | 0.001804 |
from django.db.backends import BaseDatabaseIntrospection
class DatabaseIntrospection(BaseDatabaseIntrospection):
def get_table_list(self, cursor):
"Returns a list of table names in the current database."
cursor.execute("SHOW TABLES")
return [row[0] for row in cursor.fetchall()]
| ikeikeikeike/django-impala-backend | impala/introspection.py | Python | mit | 310 | 0 |
"""
2x2 plotting analysis for 2 datasets pluggin
| ------------- | ------------- |
| contours from | pcolor from |
| both datasets | dataset 1 |
| ------------- | ------------- |
| pcolor diff | pcolor from |
| both datasets | dataset 2 |
| ------------- | ------------- |
col... | jhamman/rasmlib | rasmlib/analysis/plugins/sample.py | Python | gpl-3.0 | 865 | 0.001156 |
# import logging
from ast.visit import visit as v
from ast.node import Node
from ast.body.methoddeclaration import MethodDeclaration
from ast.stmt.minrepeatstmt import MinrepeatStmt
class Desugar(object):
def __init__(self):
self._cur_mtd = None
@v.on("node")
def visit(self, node):
"""... | plum-umd/java-sketch | java_sk/rewrite/desugar.py | Python | mit | 1,242 | 0.002415 |
# -*- coding: utf-8 -*-
# Simple script to test sending UTF8 text with the GrowlNotifier class
import logging
logging.basicConfig(level=logging.DEBUG)
from gntp.notifier import GrowlNotifier
import platform
growl = GrowlNotifier(notifications=['Testing'],password='password',hostname='ayu')
growl.subscribe(platform.nod... | kfdm/gntp | test/subscribe.py | Python | mit | 347 | 0.020173 |
from __future__ import absolute_import
from unittest import TestCase, skip
from ..goodman_ccd import get_args, MainApp
class MainAppTest(TestCase):
def setUp(self):
self.main_app = MainApp()
def test___call__(self):
self.assertRaises(SystemExit, self.main_app)
def test___call___show_ve... | soar-telescope/goodman | goodman_pipeline/images/tests/test_goodman_ccd.py | Python | bsd-3-clause | 471 | 0 |
#!flask/bin/python
from gb import app
app.run(debug=True)
| mbiokyle29/geno-browser | runserver.py | Python | mit | 58 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016, 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | Jorge-Rodriguez/ansible | lib/ansible/modules/database/postgresql/postgresql_schema.py | Python | gpl-3.0 | 10,842 | 0.002583 |
#####################################################################################
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# Unless a separate license agreement exists between you and Crossbar.io GmbH (e.g.
# you have purchased a commercial license), the license terms below apply.
#
# Should you enter ... | NinjaMSP/crossbar | crossbar/controller/test/test_run.py | Python | agpl-3.0 | 42,995 | 0.000442 |
# Copyright 2017 Huawei Technologies Co.,LTD.
# 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
#
# Unl... | openstack/nomad | cyborg/api/controllers/base.py | Python | apache-2.0 | 2,260 | 0 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/space/chassis/shared_hutt_medium_s02.iff"
result.attribute... | obi-two/Rebelion | data/scripts/templates/object/draft_schematic/space/chassis/shared_hutt_medium_s02.py | Python | mit | 458 | 0.048035 |
# Copyright (C) 2015 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.
#
# ycmd... | rfguri/vimfiles | bundle/ycm/third_party/ycmd/ycmd/completers/javascript/tern_completer.py | Python | mit | 22,105 | 0.026646 |
import csv
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
from scipy.optimize import curve_fit
def countKey(key,listDataDicts):
outDict = {}
for row in listDataDicts:
try:
outDict[row[key]] += 1
except KeyError:
outDict[row[key]] = 1
... | cvanoort/USDrugUseAnalysis | Report1/Code/afu_use30.py | Python | isc | 2,851 | 0.020694 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.