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 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
#
# Mocha documentation build configuration file, created by
# sphinx-quickstart on Thu Nov 13 00:43:40 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.
#
# All... | dplarson/Mocha.jl | docs/conf.py | Python | mit | 8,570 | 0.006301 |
"""
PSET-4
Word Game Part 9: You and your Computer
"""
PROMPT_STR = "Enter n to deal a new hand, r to replay the last hand, or e to end game: "
NO_REPL_AVAIL_STR = "You have not played a hand yet. Please play a new hand first!"
INVALID_CMD = "Invalid command."
CHOOSE_PLAYER_STR = "Enter u to have yourself play, c to h... | CptDemocracy/Python | MITx-6.00.1x-EDX-Introduction-to-Computer-Science/Week-4/PSET-4/game.py | Python | mit | 2,366 | 0.005917 |
import dis
import sys
from cStringIO import StringIO
import unittest
def disassemble(func):
f = StringIO()
tmp = sys.stdout
sys.stdout = f
dis.dis(func)
sys.stdout = tmp
result = f.getvalue()
f.close()
return result
def dis_single(line):
return disassemble(compile(l... | j5shi/Thruster | pylibs/test/test_peepholer.py | Python | gpl-2.0 | 9,096 | 0.001539 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# seriesly - XBMC Plugin
# Conector para nowdownload
# http://blog.tvalacarta.info/plugin-xbmc/seriesly/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
from core import scra... | conejoninja/xbmc-seriesly | servers/nowdownload.py | Python | gpl-3.0 | 2,851 | 0.025614 |
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.oeid import OETestID
class DfTest(OERuntimeTestCase):
@OETestID(234)
@OETestDepends(['ssh.SSHTest.test_ssh'])
def test_df(self):
cmd = "df / | sed -n '2p' | awk '{print $4... | schleichdi2/OPENNFR-6.1-CORE | opennfr-openembedded-core/meta/lib/oeqa/runtime/cases/df.py | Python | gpl-2.0 | 493 | 0.006085 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use th... | thomasem/nova | nova/virt/netutils.py | Python | apache-2.0 | 6,132 | 0.000163 |
# Copyright (C) 2011 Nippon Telegraph and Telephone Corporation.
#
# 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 appli... | fp7-netide/Engine | tests/of13-parallel-priority-3firewalls/firewall_13-3.py | Python | epl-1.0 | 5,948 | 0.003362 |
from __future__ import print_function
import operator
import functools
import collections
import ifc2x3_schema as schema
import prefixes
import rdflib.plugins.sparql as sparql
from rdflib.namespace import RDF, XSD
from rdflib.term import Variable, Literal, URIRef, BNode
from rdflib.paths import Path, SequencePath, M... | aothms/hdf5_bim_sparql_query | src/query.py | Python | gpl-3.0 | 22,647 | 0.00892 |
from django.conf import settings
from rest_framework.settings import import_from_string
from .mixins import FileContentMixin, DocStringContentMixin, MarkupProcessMixin, NoProcessMixin, SafeProcessMixin
APIDOC_DEFAULT_DOCUMENTER_CLASSES = getattr(
settings,
'APIDOC_DEFAULT_DOCUMENTER_CLASSES',
['rest_fra... | jespino/django-rest-framework-apidoc | rest_framework_apidoc/apidoc.py | Python | bsd-3-clause | 2,342 | 0.002989 |
# logging.py
# DNF Logging Subsystem.
#
# Copyright (C) 2013-2016 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program ... | dmach/dnf | dnf/logging.py | Python | gpl-2.0 | 7,178 | 0.002786 |
class User(object):
def __init__(self, name):
self.name = name
| epronk/pyfit2 | examples/chat/User.py | Python | gpl-2.0 | 75 | 0 |
#! /usr/bin/env python
###############################################################################
# This file is part of openWNS (open Wireless Network Simulator)
# _____________________________________________________________________________
#
# Copyright (C) 2004-2007
# Chair of Communication Networks (ComNets)
... | openwns/wrowser | openwns/wrowser/playgroundPlugins/SimulationCampaign/simcontrol.py | Python | gpl-2.0 | 23,950 | 0.013946 |
#!/usr/bin/env python
"""
For the moment we're not using this, but it would be nice to do so
at some point. It isn't really relevant to the researcher RDF export, the
idea would be to export details of a web-presence, to compile a complete directory
of websites in the Medical Sciences Division.
"""
... | envycontent/msd.rdfexport | msd/rdfexport/researcher/helper/webpresence.py | Python | gpl-2.0 | 1,575 | 0.013333 |
import logging
import re
import asyncio
from functools import partial
import aiohttp
from pandas.io.html import read_html
from elude import config
logger = logging.getLogger(__name__)
class Proxy(object):
test_semaphore = None
def __init__(self, ip=None, port=None, country=None, source=None):
self... | leonth/elude | elude/proxy.py | Python | mit | 3,517 | 0.004834 |
import unittest
from mock import Mock, call
from malcolm.modules.scanning.hooks import (
AbortHook,
PauseHook,
PostRunReadyHook,
PreRunHook,
)
from malcolm.modules.scanning.parts import AttributePreRunPart
class TestAttributePreRunPartConstructor(unittest.TestCase):
def setUp(self):
self... | dls-controls/pymalcolm | tests/test_modules/test_scanning/test_attributeprerunpart.py | Python | apache-2.0 | 3,395 | 0.001473 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Layman is a complete library for the operation and maintainance
on all gentoo repositories and overlays
"""
import sys
try:
from layman.api import LaymanAPI
from layman.config import BareConfig
from layman.output import Message
except ImportError:
sys.stde... | jmesmon/layman | layman/__init__.py | Python | gpl-2.0 | 1,585 | 0.005047 |
from particle import RandomParticle
import numpy as np
import matplotlib.pyplot as plt
from time import time
t0 = time()
num_of_paths = (50, 500, 5000)
max_num_of_collisions = 1000
particle = RandomParticle(1)
rms = np.zeros((3, max_num_of_collisions))
for n in range(3):
path = num_of_paths[n]
data = np.ze... | Jokiva/Computational-Physics | lecture 15/1a_init.py | Python | gpl-3.0 | 927 | 0.005394 |
from ez_setup import use_setuptools # https://pypi.python.org/pypi/setuptools
use_setuptools()
from setuptools import setup, find_packages
from packager import __version__
# Get the long description from the README file.
def get_long_description():
from codecs import open
from os import path
here = path.a... | csdms/packagebuilder | setup.py | Python | mit | 1,488 | 0.004032 |
# mapper/util.py
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Michael Bayer
# mike_mp@zzzcomputing.com
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import sqlalchemy.exceptions as sa_exc
from sqlalchemy import sql, util
from sql... | dbbhattacharya/kitsune | vendor/packages/sqlalchemy/lib/sqlalchemy/orm/util.py | Python | bsd-3-clause | 23,666 | 0.003085 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding unique constraint on 'Cat', fields ['slug']
db.create_unique('punns_cat', ['slug'])
# Addi... | carquois/blobon | blobon/punns/migrations/0028_auto__add_unique_cat_slug__add_field_punn_publish_on_facebook.py | Python | mit | 8,119 | 0.008006 |
import numpy as np
from cs231n.layers import *
from cs231n.rnn_layers import *
class CaptioningRNN(object):
"""
A CaptioningRNN produces captions from image features using a recurrent
neural network.
The RNN receives input vectors of size D, has a vocab size of V, works on
sequences of length T, has an RN... | watsonyanghx/CS231n | assignment3/cs231n/classifiers/rnn.py | Python | mit | 13,249 | 0.008378 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2014 Dariusz Suchojad <dsuch at zato.io>
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
from httplib import FORBIDDEN, INTERNAL_SERVER_ERROR, OK
from json impor... | alirizakeles/zato | code/zato-server/src/zato/server/service/internal/pubsub/__init__.py | Python | gpl-3.0 | 12,954 | 0.004477 |
# 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... | Canpio/Paddle | python/paddle/fluid/tests/unittests/test_smooth_l1_loss_op.py | Python | apache-2.0 | 3,483 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, with_statement
import contextlib
import sys
import textwrap
from pytest import deprecated_call, raises
from korean import *
@contextlib.contextmanager
def disable_imports(*names):
"""Stolen from Attest."""
import __builtin__
import_ = __bu... | lqez/korean | koreantests.py | Python | bsd-3-clause | 20,731 | 0.000232 |
p=[0.2,0.2,0.2,0.2,0.2]
world=['green', 'red', 'red', 'green', 'green']
measurements = ['red','green']
Z = 'red'
pHit = 0.6
pMiss = 0.2
def sense(p, Z):
q=[]
for i in range(len(p)):
hit = (Z == world[i]) #hit return zero if false
q.append(p[i] * (hit * pHit + (1-hit) * pMiss)) #if hi... | napjon/moocs_solution | robotics-udacity/1.3.py | Python | mit | 626 | 0.036741 |
from django import forms
from .models import Question, Answer, Categories, Customuser
from django.contrib import auth
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
class add_Question_Form(forms.ModelForm): # just a regular form
question_text = forms.CharField(l... | aadithyamd/QandA | QA/forms.py | Python | mit | 4,443 | 0.011479 |
import re
s = open("neurolab/tool.py", "r").read()
s = re.sub('^([ \t\r\f\v]*)(.+?)\.shape = (.*?), (.*?)$', '\g<1>\g<2> = \g<2>.reshape((\g<3>, \g<4>,)) #replacement for \"\\g<0>\"', s, flags=re.MULTILINE)
s = re.sub('^([ \t\r\f\v]*)(.+?)\.shape = (\S+?)$', '\g<1>\g<2> = \g<2>.reshape(\g<3>) #replacement for \"\\g<0>... | inferrna/neurolabcl | replacer.py | Python | lgpl-3.0 | 407 | 0.034398 |
#!/usr/bin/env python2
# Copyright (c) 2014 The Dobbscoin 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 import DobbscoinTestFramework
from dobbscoinrpc.authproxy import AuthServiceProxy, JSONR... | dobbscoin/dobbscoin-source | qa/rpc-tests/getblocktemplate_proposals.py | Python | mit | 6,302 | 0.004919 |
# Linktastic Module
# - A python2/3 compatible module that can create hardlinks/symlinks on windows-based systems
#
# Linktastic is distributed under the MIT License. The follow are the terms and conditions of using Linktastic.
#
# The MIT License (MIT)
# Copyright (c) 2012 Solipsis Development
#
# Permission is here... | roderickvd/nzbToMedia | nzbtomedia/linktastic/linktastic.py | Python | gpl-3.0 | 4,080 | 0.004902 |
import re
import unittest
import salesforce_oauth_request
from salesforce_bulk import SalesforceBulk
class SalesforceBulkTest(unittest.TestCase):
def __init__(self, testName, endpoint, sessionId):
super(SalesforceBulkTest, self).__init__(testName)
self.endpoint = endpoint
self.sessionId =... | pelucid/salesforce_bulk | test_salesforce_bulk.py | Python | mit | 4,845 | 0.008462 |
import sys
import tensorflow as tf
from vahun.Text import Text
import numpy as np
from vahun.tools import Timer
from vahun.tools import explog
from vahun.autoencoder import Autoencoder_ffnn
from vahun.variational_autoencoder import Variational_autoencoder
from vahun.genetic import evolution
from vahun.genetic import ex... | evelkey/vahun | experiment_FINAL.py | Python | apache-2.0 | 4,608 | 0.021267 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_v1_generated_job_service_delete_model_deployment_monitoring_job_async.py | Python | apache-2.0 | 1,687 | 0.001778 |
# Copyright (c) 2013 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 ... | nikesh-mahalka/cinder | cinder/tests/unit/api/contrib/test_availability_zones.py | Python | apache-2.0 | 2,932 | 0 |
# pylint: disable=missing-docstring
def func():
"""Test that a variable defined in a finally clause does not trigger a false positive"""
try:
variable = 1
yield variable
finally:
variable = 2
yield variable
| ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/u/use/used_before_assignment_488.py | Python | mit | 251 | 0.003984 |
'''
A tool to annotate and print variants in tabular format.
Author: Khalid Mahmood (khalid.mahmood@unimelb.edu.au).
Copyright: 2015
'''
#!/usr/bin/python
#from utils import findlist
import sys
import os
import argparse
import getopt
#import vcf
import array
import pysam
#class Error(Exception):
# """Base-class... | khalidm/ExAC_genes | src/annotations.py | Python | mit | 3,862 | 0.009063 |
import os
import subprocess
SSH_OPTIONS = ['-o', 'StrictHostKeyChecking=no', '-o', 'PreferredAuthentications=publickey', '-o', 'PubkeyAuthentication=yes']
def rsync_get_file(uri_from, uri_to, user, host, port, key):
cmd = [
'rsync',
'-e',
'ssh -i {} -p {} {}'.format(key, port, ' '.join(SS... | galaxyproject/pulsar | pulsar/client/transport/ssh.py | Python | apache-2.0 | 1,799 | 0.000556 |
"""
Test paginator for trampoline.
"""
from elasticsearch_dsl import Index
from elasticsearch_dsl import Search
from trampoline.paginator import ESSearchPaginator
from tests.base import BaseTestCase
from tests.models import Token
from tests.views import PaginatedContentView
class TestPaginator(BaseTestCase):
d... | simion/django-trampoline | tests/test_paginator.py | Python | mit | 2,454 | 0 |
# -*- coding: utf-8 -*-
import re
import requests
import base64
import struct
import random
from sklearn.cluster import KMeans
from sklearn.preprocessing import scale
from dateutil.parser import parse
class Tweet(object):
def __init__(self, status):
self.screen_name = status['screen_name']
self.tex... | uwekamper/flutterspark | flutterbrain_web/mapview/clustering.py | Python | mit | 3,178 | 0.003776 |
from django.apps import AppConfig
from django.utils.module_loading import autodiscover_modules
class PagesAppConfig(AppConfig):
name = 'pages'
def ready(self):
# Walk over all views-modules to discover views
autodiscover_modules('views')
| bpeschier/reek-pages | pages/apps.py | Python | mit | 265 | 0 |
import bpy
from . import tree_info
from mathutils import Vector
from . utils.nodes import idToSocket
from . sockets.info import toBaseIdName, isList
from . tree_info import getAllDataLinkIDs, getDirectlyLinkedSocket
def correctForbiddenNodeLinks():
for dataOrigin, target in iterLinksThatNeedToBeCorrectedOrRemoved(... | Thortoise/Super-Snake | Blender/animation_nodes-master/node_link_conversion.py | Python | gpl-3.0 | 11,610 | 0.008183 |
class Test(object):
@property
def something(self):
return 12
@something.setter
def something(self, value):
self.other = value
t = Test()
print t.something
t.something = 123
print t.other
| marcusmoller/pyorpg-client | src/pgu/gui/test.py | Python | mit | 226 | 0.00885 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import os.path
from django import template
FMT = 'JPEG'
EXT = 'jpg'
QUAL = 75
register = template.Library()
def resized_path(path, size, method):
"Returns the path for the resized image."
dir, name = os.path.split(path)
image_name, ext = name.rsplit('.', 1)... | dw9694/django_blog | blog/templatetags/image_tags.py | Python | gpl-3.0 | 2,209 | 0.000453 |
"""
read_cell_by_cell.py
:copyright: (c) 2014-2015 by Onni Software Ltd.
:license: New BSD License, see LICENSE for more details
This shows how to use **Reader** class to go through a single
page spreadsheet, The output is::
1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
9.0
"""
import os
import... | lordakshaya/pyexcel | examples/basics/read_cell_by_cell.py | Python | bsd-3-clause | 1,031 | 0.00291 |
import random
from os import environ, urandom
from os.path import exists
from functools import partial
from twisted.internet.defer import inlineCallbacks
from autobahn.twisted.util import sleep
from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner
from autobahn.wamp import cryptosign
from autobahn.... | crossbario/crossbarexamples | exclude_subscribers/carol.py | Python | apache-2.0 | 2,561 | 0.000781 |
# Copyright (C) 2008 Valmantas Paliksa <walmis at balticum-tv dot lt>
#
# Licensed under the GNU General Public License Version 3
#
# 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... | namili/blueman | blueman/gui/MessageArea.py | Python | gpl-3.0 | 5,072 | 0.043573 |
from controller.component.component import Component
from controller.component.graphics_component import GraphicsComponent
from controller.component.movement_component import MovementComponent
from controller.component.input_component import InputComponent
from controller.component.player_input_component import PlayerI... | monodokimes/pythonmon | controller/component/__init__.py | Python | gpl-3.0 | 403 | 0 |
"""
This is the Python implementation for the Java package "jdk.management.resource.internal", compiled by Pava.
"""
import pava
from pava import nan, inf
pava_classes = {}
pava.module(__name__)
import internal
| laffra/pava | pava/implementation/natives/jdk/management/resource/__init__.py | Python | mit | 215 | 0.009302 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2016
# Leandro Toledo de Souza <devs@python-telegram-bot.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
... | franciscod/python-telegram-bot | tests/test_inlinequeryresultvideo.py | Python | gpl-2.0 | 3,826 | 0.001307 |
import hashlib
import os
import zipfile
from base64 import b64decode, b64encode
from django.db import transaction
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.core.exceptions import ObjectDoesNotExist
from django.utils.encoding import force_bytes, force... | psiinon/addons-server | src/olympia/lib/crypto/signing.py | Python | bsd-3-clause | 9,286 | 0 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import copy
import os
import sys
from argparse import Namespace
from mock import patch
from six import StringIO, text_type
from tzlocal import get_localzone
import six
from djangocms_installer import config
from djangocm... | Venturi/oldcms | env/lib/python2.7/site-packages/tests/config.py | Python | apache-2.0 | 31,993 | 0.00175 |
from steamweb.actions_base import PlayerAction
from steamweb.db_utils import get_tender, get_tile, get_resource
from steamweb.utils import InsufficientFunds, get_capacity
from steamweb.database import db_session
from steamweb.models import *
class BidAction(PlayerAction):
def resolution(self, game, player, argum... | PiotrZakrzewski/steamweb | steamweb/actions/auction_actions.py | Python | mit | 4,727 | 0.003385 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('merchants', '0006_classfy'),
]
operations = [
migrations.CreateModel(
name='RegionItem',
fields=[
... | myhearter/dianping | ddp/app/merchants/migrations/0007_auto_20171119_0852.py | Python | mit | 807 | 0.001239 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
# Copyright 2012 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 NTT DOCOMO, INC.
# Copyright (c) 2011 University of Southern California / ISI
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
... | DirectXMan12/nova-hacking | nova/tests/virt/baremetal/test_driver.py | Python | apache-2.0 | 14,537 | 0.001376 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | dims/heat | heat/engine/resources/openstack/keystone/user.py | Python | apache-2.0 | 9,242 | 0 |
#
# 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... | shaneknapp/spark | python/pyspark/tests/test_context.py | Python | apache-2.0 | 13,901 | 0.001511 |
"""
@file
@brief Buffer as a logging function.
"""
from io import StringIO
class BufferedPrint:
"""
Buffered display. Relies on :epkg:`*py:io:StringIO`.
Use it as follows:
.. runpython::
:showcode:
def do_something(fLOG=None):
if fLOG:
fLOG("Did something.... | sdpython/pyquickhelper | src/pyquickhelper/loghelper/buffered_flog.py | Python | mit | 844 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.auth.models
import django.utils.timezone
from django.conf import settings
import django.core.validators
import forum.models
class Migration(migrations.Migration):
dependencies = [
... | michaelyou/One-piece-forum | forum/migrations/0001_initial.py | Python | mit | 12,680 | 0.005205 |
'''Test the analysis.signal module.'''
from __future__ import absolute_import, print_function, division
import pytest
import numpy as np
import gridcells.analysis.signal as asignal
from gridcells.analysis.signal import (local_extrema, local_maxima,
local_minima, ExtremumTypes,
... | lsolanka/gridcells | tests/unit/test_analysis_signal.py | Python | gpl-3.0 | 10,163 | 0.000197 |
TESTS = {
"Level_1": [
{
"input": [1, 2, 3],
"answer": 2,
"explanation": "3-1=2"
},
{
"input": [5, -5],
"answer": 10,
"explanation": "5-(-5)=10"
},
{
"input": [10.2, -2.2, 0, 1.1, 0.5],
... | Empire-of-Code-Puzzles/checkio-empire-most-numbers | verification/src/tests.py | Python | gpl-2.0 | 2,790 | 0.001792 |
# Copyright 2021 Google. All Rights Reserved.
# Copyright 2019 IBM. 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
#
#... | CODAIT/graph_def_editor | tests/function_graph_test.py | Python | apache-2.0 | 6,316 | 0.006966 |
# coding=utf-8
import sys
import struct
import unittest
from test_000_config import TestConfig
from test_001_connection import TestConnection
from gi.repository import Midgard
from gi.repository import GObject
class TestQuerySelect(unittest.TestCase):
mgd = None
def setUp(self):
if self.mgd == None:
s... | piotras/midgard-core | tests/GIR/test_query_select.py | Python | lgpl-2.1 | 9,821 | 0.020772 |
"""
Text files to Pandas
"""
import pandas
def txt_to_pandas(csvFile, _delimiter, encoding_='utf8'):
"""
Text file to Pandas Dataframe
"""
return pandas.read_csv(
csvFile, sep=_delimiter, low_memory=False,
#encoding=encoding_
)
| JoaquimPatriarca/senpy-for-gis | gasp/fromtxt/pnd.py | Python | gpl-3.0 | 272 | 0.014706 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2010 Prof. William H. Green (whgreen@mit.edu) and the
# RMG Team (rmg_dev@mit.edu)
#
# Permission is hereby granted, free of c... | comocheng/RMG-Py | rmgpy/rmg/input.py | Python | mit | 22,111 | 0.007281 |
class Solution(object):
def strangePrinter(self, s):
"""
:type s: str
:rtype: int
"""
n = len(s)
dp = [[0] * n for i in xrange(n + 1)]
for i in xrange(n):
dp[i][i] = 1
for l in xrange(1, n):
for i in xrange(n-l):
... | zqfan/leetcode | algorithms/664. Strange Printer/solution.py | Python | gpl-3.0 | 657 | 0.001522 |
#reversing the words in a string
s = raw_input('enter the string:')
print ' '.join(s.split(' ')[::-1])
| ganesh-95/python-programs | thoughtworks/strrev.py | Python | mit | 109 | 0.036697 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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 version.
#... | supertom/ansible-modules-core | cloud/digital_ocean/digital_ocean_block_storage.py | Python | gpl-3.0 | 11,293 | 0.00487 |
from collections import Iterable
from django.conf import settings
from django.contrib.auth.decorators import REDIRECT_FIELD_NAME
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ImproperlyConfigured
from django.core.exceptions import PermissionDenied
from guardian.utils... | hfeeki/django-guardian | guardian/mixins.py | Python | bsd-2-clause | 6,473 | 0.002935 |
# 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... | kobejean/tensorflow | tensorflow/python/framework/random_seed.py | Python | apache-2.0 | 5,902 | 0.003219 |
from charm.schemes.dabe_aw11 import Dabe
from charm.adapters.dabenc_adapt_hybrid import HybridABEncMA
from charm.toolbox.pairinggroup import PairingGroup, GT
import unittest
debug = False
class DabeTest(unittest.TestCase):
def testDabe(self):
groupObj = PairingGroup('SS512')
dabe = Dabe(groupObj)... | lferr/charm | charm/test/schemes/dabenc_test.py | Python | lgpl-3.0 | 3,191 | 0.015042 |
"""
-------------------------------------------------------
Simulator
a package that helps simulate a baseball game based on
previous batting history
-------------------------------------------------------
Author: Dallas Fraser
ID: 110242560
Email: fras2560@mylaurier.ca
Version: 2014-09-11
-----------... | fras2560/Baseball-Simulator | simulator/__init__.py | Python | apache-2.0 | 5,251 | 0.003047 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-26 12:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('marketplace', '0010_packageresource_recommended'),
]
operations = [
migrati... | MOOCworkbench/MOOCworkbench | marketplace/migrations/0011_auto_20170526_1215.py | Python | mit | 462 | 0 |
# -*- coding: utf-8 -*-
"""Class to represent binary data as hexadecimal."""
class Hexdump(object):
"""Class that defines a hexadecimal representation formatter (hexdump)."""
@classmethod
def _FormatDataLine(cls, data, data_offset, data_size):
"""Formats binary data in a single line of hexadecimal represen... | ostree/plaso | plaso/cli/hexdump.py | Python | apache-2.0 | 2,539 | 0.006302 |
from setuptools import setup, find_packages
setup(
name="yamldown",
version="0.1.8",
packages=["yamldown"],
author="edouglass",
author_email="edouglass@lbl.gov",
url="https://github.com/dougli1sqrd/yamldown",
download_url="https://github.com/dougli1sqrd/yamldown/archive/0.1.8.tar.gz",
d... | dougli1sqrd/yamldown | setup.py | Python | bsd-3-clause | 555 | 0.003604 |
from django.http import HttpResponse, Http404
from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import render, get_object_or_404
from django.core.urlresolvers import reverse
from django.utils.xmlutils import SimplerXMLGenerator
from models import Place, Region
from models import Locality
from ... | uq-eresearch/uqam | location/views.py | Python | bsd-3-clause | 4,790 | 0.003549 |
from select_multiple_field.models import SelectMultipleField
class CommaSeparatedCharField(SelectMultipleField):
def contribute_to_class(self, cls, name, **kwargs):
"""Contribute to the Model subclass.
We just set our custom get_FIELD_display(),
which returns a comma-separated list of di... | Lcaracol/ideasbox.lan | ideasbox/fields.py | Python | mit | 778 | 0 |
# -*- coding: utf-8 -*-
"""
hyper/common/headers
~~~~~~~~~~~~~~~~~~~~~
Contains hyper's structures for storing and working with HTTP headers.
"""
import collections
from hyper.common.util import to_bytestring, to_bytestring_tuple
class HTTPHeaderMap(collections.MutableMapping):
"""
A structure that contains... | paulrouget/servo | tests/wpt/web-platform-tests/tools/third_party/hyper/hyper/common/headers.py | Python | mpl-2.0 | 8,888 | 0 |
# -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | frankrousseau/weboob | modules/allocine/module.py | Python | agpl-3.0 | 8,218 | 0.001583 |
from taggit.forms import TagField as TaggitTagField
from taggit.models import Tag
from wagtail.admin.widgets import AdminTagWidget
class TagField(TaggitTagField):
"""
Extends taggit's TagField with the option to prevent creating tags that do not already exist
"""
widget = AdminTagWidget
def __in... | zerolab/wagtail | wagtail/admin/forms/tags.py | Python | bsd-3-clause | 1,354 | 0.001477 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | pgmillon/ansible | lib/ansible/module_utils/network/common/network.py | Python | gpl-3.0 | 8,128 | 0.002461 |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... | lmazuel/azure-sdk-for-python | azure-mgmt-compute/setup.py | Python | mit | 2,784 | 0.001078 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016-2018, Cumulus Networks <ce-ceng@cumulusnetworks.com>
# 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_v... | thaim/ansible | lib/ansible/modules/network/cumulus/nclu.py | Python | mit | 7,641 | 0.001309 |
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import base_wizard_mixin
from . import document_cancel_wizard
from . import document_correction_wizard
from . import document_status_wizard
from . import invalidate_number_wizard
| OCA/l10n-brazil | l10n_br_fiscal/wizards/__init__.py | Python | agpl-3.0 | 252 | 0 |
# Copyright (c) 2013 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 ... | vijayendrabvs/ssl-neutron | neutron/plugins/ml2/plugin.py | Python | apache-2.0 | 35,120 | 0.000028 |
# Copyright 2014 Cloudbase Solutions Srl
# Copyright 2012 Mirantis 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://www.apache.org/licenses/LICENSE-2.0
#
# ... | CropCircleSys/bsd-cloudinit | cloudbaseinit/metadata/services/ec2service.py | Python | apache-2.0 | 3,464 | 0 |
from copy import deepcopy
from django.test import TestCase
from django.core.exceptions import ValidationError
from django.core import management
from avocado.query import oldparsers as parsers
from avocado.models import DataConcept, DataField, DataConceptField
from ....models import Employee
class DataContextParserTe... | murphyke/avocado | tests/cases/query/tests/parsers.py | Python | bsd-2-clause | 19,203 | 0 |
from pyccel.stdlib.internal.blas import dgemv
from numpy import zeros
n = 4
m = 5
a = zeros((n,m), 'double')
x = zeros(m, 'double')
y = zeros(n, 'double')
# ...
a[0,0] = 1.0
a[1,0] = 6.0
a[2,0] = 11.0
a[3,0] = 16.0
a[0,1] = 2.0
a[1,1] = 7.0
a[2,1] = 12.0
a[3,1] = 17.0
a[0,2] = 3.0
a[1,2] = 8.0
a[2,2] = 13.0
a[3,2]... | ratnania/pyccel | tests/internal/scripts/blas/ex2.py | Python | mit | 611 | 0.036007 |
# Import tests from each test file.
# e.g. if we have tests/sources.py, then "from sources import *"
from sources import *
from tasks import *
| DevangS/CoralNet | images/tests/__init__.py | Python | bsd-2-clause | 144 | 0 |
"""
Utilities for view tests.
"""
from __future__ import absolute_import
import json
from contentstore.tests.utils import CourseTestCase
from contentstore.views.helpers import xblock_studio_url
from xmodule.modulestore.tests.factories import ItemFactory
class StudioPageTestCase(CourseTestCase):
"""
Base cl... | ESOedX/edx-platform | cms/djangoapps/contentstore/views/tests/utils.py | Python | agpl-3.0 | 3,337 | 0.004195 |
import sys
from geopy import Point
from django.apps import apps as django_apps
from django.core.exceptions import ImproperlyConfigured
from django.core.management.color import color_style
from .geo_mixin import GeoMixin
LANDMARK_NAME = 0
LATITUDE = 2
LETTERS = list(map(chr, range(65, 91)))
LONGITUDE = 1
style = co... | botswana-harvard/edc-map | edc_map/mapper.py | Python | gpl-2.0 | 2,309 | 0.000433 |
# From python2.6/_abcoll.py
# Bug was wrong code for "comp_for" giving
# "for in x" instead of: "for x in y"
chain = (e for s in (self, other) for x in y)
| moagstar/python-uncompyle6 | test/simple_source/bug26/04_comp_for.py | Python | mit | 156 | 0 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/xnl_2_0/TitleElement.py | Python | gpl-3.0 | 946 | 0.001057 |
import pytest
from api.base.settings.defaults import API_BASE
from osf.models import MetaSchema
from osf_tests.factories import (
AuthUserFactory,
)
from website.project.metadata.schemas import LATEST_SCHEMA_VERSION
@pytest.mark.django_db
class TestMetaSchemaDetail:
def test_metaschemas_detail_visibility(se... | aaxelb/osf.io | api_tests/metaschemas/views/test_metaschemas_detail.py | Python | apache-2.0 | 2,170 | 0.004608 |
from __future__ import unicode_literals
"""
Core HamlPy filters.
The implementation of these should match https://github.com/haml/haml/blob/master/lib/haml/filters.rb as closely as
possible. Where we differ is that we don't compile Stylus, Coffeescript etc into CSS or Javascript - but place the
content into suitable <... | Psycojoker/HamlPy | hamlpy/parser/filters.py | Python | mit | 5,088 | 0.001769 |
from collections import OrderedDict
class SerializableModel(object):
def _asdict(self):
result = OrderedDict()
for key in self.__mapper__.c.keys():
result[key] = getattr(self, key)
return result
| taras1k/finance | server/utils.py | Python | gpl-2.0 | 237 | 0.004219 |
'''
This script shows an example of working with the output of the GetJobTasks subcommand.
The script takes a single argument, which is the JobID of the job. When calculating the elapsed time for
rendering tasks, the script does not account for daylight savings time differences or time zone differences.
Elapsed ... | ThinkboxSoftware/Deadline | Examples/DeadlineCommand/JobTaskTimes/GetJobTaskTimes.py | Python | apache-2.0 | 6,747 | 0.006966 |
#*****************************************************************************
# Copyright 2004-2008 Steve Menard
#
# 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... | ktan2020/jpype | jpype/_jcollection.py | Python | apache-2.0 | 8,284 | 0.003621 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | h4ck3rm1k3/ansible | lib/ansible/module_utils/basic.py | Python | gpl-3.0 | 60,500 | 0.004496 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | ericmjl/bokeh | tests/unit/bokeh/util/test_version.py | Python | bsd-3-clause | 3,274 | 0.00733 |
# Simple class SimgleList
class SingleList:
"""Documentation for SingleList
"""
def __init__(self, initial_list=None):
self.__list = []
if initial_list:
for value in initial_list:
if value not in self.__list:
self.__list.append(value)
... | r-castro/Python | NewList.py | Python | gpl-3.0 | 1,219 | 0.001641 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import sale_order_dates
| vileopratama/vitech | src/addons/sale_order_dates/__init__.py | Python | mit | 124 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.