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 |
|---|---|---|---|---|---|---|
'''
Created on 2013-05-16
@author: brian
'''
import pygame
from entity import Entity
from src.ai import task
from src.abilities import *
class Snake(Entity):
living = "snake"
dead = "gore"
def __init__(self, world):
Entity.__init__(self, world)
self.world = world
self.hostile = True
self.health = s... | Greymerk/python-rpg | src/entity/mobs/snake.py | Python | gpl-3.0 | 592 | 0.037162 |
#!/usr/bin/env python
from argparse import ArgumentParser
from collections import defaultdict
import sys
import os
from sonLib.bioio import cigarRead, cigarWrite, getTempFile, system
def getSequenceRanges(fa):
"""Get dict of (untrimmed header) -> [(start, non-inclusive end)] mappings
from a trimmed fasta."""
... | benedictpaten/cactus | src/cactus/blast/upconvertCoordinates.py | Python | mit | 4,797 | 0.001876 |
from lib import broker
__author__ = 'ehonlia'
import pika
import logging
logging.basicConfig()
connection = pika.BlockingConnection(pika.ConnectionParameters(host=broker.HOST))
channel = connection.channel()
channel.exchange_declare(exchange=broker.STREAM_EXCHANGE, type=broker.EXCHANGE_TYPE)
message = '''
{
"_i... | EricssonResearch/iot-framework-engine | semantic-adapter/test_pubsub/test_publisher.py | Python | apache-2.0 | 1,498 | 0.001335 |
###################################################################
#
# Copyright (c) 2014 Wi-Fi Alliance
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copi... | claudelee/Wi-FiTestSuite-UCC | python/myutils.py | Python | isc | 97,701 | 0.005466 |
import numpy as np
from numba import cuda, float32
from numba.cuda.testing import unittest, CUDATestCase
def generate_input(n):
A = np.array(np.arange(n * n).reshape(n, n), dtype=np.float32)
B = np.array(np.arange(n) + 0, dtype=A.dtype)
return A, B
class TestCudaNonDet(CUDATestCase):
def test_for_pr... | sklam/numba | numba/cuda/tests/cudapy/test_nondet.py | Python | bsd-2-clause | 1,378 | 0.001451 |
# -*- coding: utf-8 -*-
#
# Sphinx RTD theme demo documentation build configuration file, created by
# sphinx-quickstart on Sun Nov 3 11:56:36 2013.
#
# 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... | groovey/Documentation | sphinx/demo_docs/source/conf.py | Python | mit | 8,213 | 0.007062 |
#!/usr/bin/env python
# Copyright 2014 Rocket-Internet
# Luca Bruno <luca.bruno@rocket-internet.de>
#
# 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... | Netflix/security_monkey | scripts/secmonkey_role_setup.py | Python | apache-2.0 | 7,737 | 0.00517 |
# -*- coding: utf-8 -*-
"""
tests.templating
~~~~~~~~~~~~~~~~
Template functionality
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import pytest
import flask
import logging
from jinja2 import TemplateNotFound
def test_context_processing():
app = f... | iFighting/flask | tests/test_templating.py | Python | bsd-3-clause | 11,202 | 0.005981 |
# -*- coding: utf-8 -*-
"""
flaskbb.utils.decorators
~~~~~~~~~~~~~~~~~~~~~~~~
A place for our decorators.
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
from functools import wraps
from flask import abort
from flask_login import current_user
from opens... | USStateDept/FPA_Core | openspending/forum/utils/decorators.py | Python | agpl-3.0 | 1,481 | 0.002026 |
#!/usr/bin/env python
""" (Re)build the README.md file from README-template.md.
"""
# This file is part of Twempest. Copyright 2018 Dave Rogers <info@yukondude.com>. Licensed under the GNU General Public
# License, version 3. Refer to the attached LICENSE file or see <http://www.gnu.org/licenses/> for details.
import... | yukondude/Twempest | build-readme.py | Python | gpl-3.0 | 1,279 | 0.002346 |
# 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
# distrib... | openstack/python-heatclient | heatclient/osc/v1/resource_type.py | Python | apache-2.0 | 4,711 | 0 |
class M1(type):
def __iter__(self):
pass
class M2(type):
pass
class C1(object):
__metaclass__ = M1
class C2(object):
__metaclass__ = M2
class B1(C1):
pass
for x in C1:
pass
for y in <warning descr="Expected 'collections.Iterable', got 'C2' instead">C2</warning>:
pass
fo... | caot/intellij-community | python/testData/inspections/PyTypeCheckerInspection/MetaClassIteration.py | Python | apache-2.0 | 340 | 0.014706 |
from django.contrib import messages
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.core.urlresolvers import reverse
from django.shortcuts import render, redirect, get_object_or_404
from django.utils.translation import ugettext_lazy as _
from helpers.models import Helpers
from offe... | cpodlesny/lisbon | src/contacts/views.py | Python | mit | 6,745 | 0.000593 |
from django.conf import settings
from councilmatic_core.models import Bill, Organization, Action
from datetime import datetime
import pytz
app_timezone = pytz.timezone(settings.TIME_ZONE)
class NYCBill(Bill):
class Meta:
proxy = True
def __str__(self):
return self.friendly_name
# NYC CU... | datamade/nyc-councilmatic | nyc/models.py | Python | mit | 4,078 | 0.002946 |
#!/usr/bin/env/python
"""
Setup script for PuLP added by Stuart Mitchell 2007
Copyright 2007 Stuart Mitchell
"""
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
Description = open('README').read()
License = open('LICENSE').read()
Version = open('VERSION').read().strip()
setup(name=... | ruxkor/pulp-or | setup.py | Python | mit | 1,930 | 0.013472 |
# (c) Copyright 2008-2015 Synapse Wireless, Inc.
"""System Info IDs - used in 'getInfo()' and 'getStat()' calls"""
# Types
SI_TYPE_VENDOR = 0
SI_TYPE_RADIO = 1
SI_TYPE_CPU = 2
SI_TYPE_PLATFORM = 3
SI_TYPE_BUILD = 4
SI_TYPE_VERSION_MAJOR = ... | synapse-wireless/bulk-reprogramming | snappyImages/synapse/sysInfo.py | Python | apache-2.0 | 4,335 | 0.026298 |
from cement.utils.misc import init_defaults
from configparser import NoSectionError
from cli.Mcg import Mcg
from core.db.MongoDB import MongoDB
def main():
# Logging config (mcg section in file mcg.conf)
defaults = init_defaults('mcg', 'log.logging')
defaults['log.logging']['file'] = 'mcg.log'
with M... | BizarroSolutions/mcg | cli/init.py | Python | gpl-3.0 | 1,266 | 0.00079 |
# -*- coding: utf-8 -*-
"""
Simple tests for metrics and pseudometrics implemented in
the qutip.metrics module.
"""
# This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson.
# All rights reserved.
#
# Redistribution and use in source and... | zasdfgbnm/qutip | qutip/tests/test_metrics.py | Python | bsd-3-clause | 5,002 | 0.0002 |
# -*- coding: utf-8 -*-
"""
plnt.utils
~~~~~~~~~~
The planet utilities.
:copyright: (c) 2009 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD.
"""
import re
from os import path
from jinja2 import Environment, FileSystemLoader
from werkzeug import Response, Local, LocalManager, url... | qsnake/werkzeug | examples/plnt/utils.py | Python | bsd-3-clause | 3,618 | 0.000276 |
import LibreNMS
import json
import logging
import os
import pymysql
import subprocess
import threading
import sys
import time
from datetime import timedelta
from datetime import datetime
from logging import debug, info, warning, error, critical, exception
from platform import python_version
from time import sleep
fro... | arjitc/librenms | LibreNMS/service.py | Python | gpl-3.0 | 24,575 | 0.004557 |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test logic for setting nMinimumChainWork on command line.
Nodes don't consider themselves out of "init... | nlgcoin/guldencoin-official | test/functional/feature_minchainwork.py | Python | mit | 4,129 | 0.003875 |
import sys
print(sum(int(line.strip()) for line in sys.stdin))
| kornai/4lang | exp/corp/xsum.py | Python | mit | 63 | 0 |
# Do not edit this file, pipeline versioning is governed by git tags
__version__=0.0.0 | ecolell/aquire | version.py | Python | mit | 86 | 0.023256 |
from cherrypy.test import test
test.prefer_parent_path()
import cherrypy
script_names = ["", "/path/to/myapp"]
def setup_server():
# Set up site
cherrypy.config.update({
'environment': 'test_suite',
'tools.proxy.on': True,
'tools.proxy.base': 'www.mydomain.test',
... | cread/ec2id | cherrypy/test/test_proxy.py | Python | apache-2.0 | 4,957 | 0.006052 |
# 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... | nburn42/tensorflow | tensorflow/python/kernel_tests/identity_op_py_test.py | Python | apache-2.0 | 2,642 | 0.007949 |
import os
import views as pv
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# serve assets via django, during development
(r'^poll/assets/(?P<path>.*)$', "django.views.static.serve",
{"document_root": os.path.dirname(__file__) + "/assets"}),
# graphs are generated and stored to be v... | pivotaccess2007/RapidSMS-Rwanda | apps/poll/urls.py | Python | lgpl-3.0 | 992 | 0.027218 |
import MaKaC.webinterface.rh.categoryMod as categoryMod
def index(req, **params):
return categoryMod.RHCategoryConfCreationControl( req ).process( params )
def setCreateConferenceControl( req, **params ):
return categoryMod.RHCategorySetConfControl( req ).process( params )
def selectAllowedToCreateConf( req... | belokop-an/agenda-tools | code/htdocs/categoryConfCreationControl.py | Python | gpl-2.0 | 677 | 0.048744 |
import unittest
from collections import OrderedDict
from pypika import (
Array,
Field,
JSON,
QueryException,
Table,
)
from pypika.dialects import PostgreSQLQuery
class InsertTests(unittest.TestCase):
table_abc = Table("abc")
def test_array_keyword(self):
q = PostgreSQLQuery.into(... | kayak/pypika | pypika/tests/dialects/test_postgresql.py | Python | apache-2.0 | 9,532 | 0.003462 |
# import data_structures.binary_search_trees.rope as rope
import data_structures.binary_search_trees.set_range_sum as set_range_sum
import data_structures.binary_search_trees.tree_orders as tree_orders
import pytest
import os
import sys
import resource
CI = os.environ.get('CI') == 'true'
# Helpers
class BinarySearc... | chaicko/AlgorithmicToolbox | test/data_structures/test_binary_search_trees.py | Python | gpl-3.0 | 7,486 | 0.001336 |
'''tzinfo timezone information for America/Inuvik.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Inuvik(DstTzInfo):
'''America/Inuvik timezone definition. See datetime.tzinfo for details'''
zone = 'America/Inuvik'
... | newvem/pytz | pytz/zoneinfo/America/Inuvik.py | Python | mit | 5,554 | 0.206338 |
import unittest
from test.test_support import (check_syntax_error, _check_py3k_warnings,
check_warnings, run_unittest)
class ScopeTests(unittest.TestCase):
def testSimpleNesting(self):
def make_adder(x):
def adder(y):
return x + y
... | babyliynfg/cross | tools/project-creator/Python2.6.6/Lib/test/test_scope.py | Python | mit | 16,217 | 0.003761 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | iambocai/ansible | v2/test/errors/test_errors.py | Python | gpl-3.0 | 3,194 | 0.003444 |
from .unittests import *
| Ecotrust/forestplanner | lot/trees/tests/__init__.py | Python | bsd-3-clause | 25 | 0 |
# -*- coding: utf-8 -*-
"""
channel.py
:copyright: (c) 2015 by Fulfil.IO Inc.
:license: see LICENSE for more details.
"""
from trytond.pool import PoolMeta
from trytond.model import fields
__all__ = ['Channel']
__metaclass__ = PoolMeta
def submit_to_google(url, data):
import requests
import json... | prakashpp/trytond-google-merchant | channel.py | Python | bsd-3-clause | 797 | 0 |
from unittest import mock
from django.db import connections, models
from django.test import SimpleTestCase
from django.test.utils import isolate_apps, override_settings
class TestRouter:
"""
Routes to the 'other' database if the model name starts with 'Other'.
"""
def allow_migrate(self, db, app_labe... | elena/django | tests/check_framework/test_multi_db.py | Python | bsd-3-clause | 1,726 | 0.000579 |
from Screens.Screen import Screen
from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigText
from Components.ConfigList import ConfigListScreen
from Components.Label import Label
from Components.ActionMap import ActionMap
# for localized messages
from . import _
class LastFMConfigS... | popazerty/try | lib/python/Plugins/Extensions/IniLastFM/LastFMConfig.py | Python | gpl-2.0 | 3,064 | 0.014687 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Artem Feofanov <artem.feofanov@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of... | bjolivot/ansible | lib/ansible/modules/notification/telegram.py | Python | gpl-3.0 | 2,822 | 0.007087 |
import csv, os
def adding(lemma_noun, file_noun, tags_noun, lemma_verb, file_verb, tags_verb):
"""
Creates a file with final results: lemmas for unknown words and Zaliznyak's tags for them."""
outfile = open('predicted.csv', 'w', encoding = 'utf-8')
writer = csv.writer(outfile, lineterminator='\n... | azilya/Zaliznyak-s-grammatical-dictionary | gdictionary/getfinal.py | Python | lgpl-3.0 | 1,310 | 0.012977 |
# Copyright 2018 Red Hat, Inc. and others. 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 appli... | opendaylight/netvirt | resources/tools/odltools/odltools/cli_utils.py | Python | epl-1.0 | 1,857 | 0.000539 |
#=======================================================================
# bootstrap.py
#=======================================================================
from machine import State
from pydgin.utils import r_uint
#from pydgin.storage import Memory
EMULATE_GEM5 = False
EMULATE_SIMIT = True
# Currently... | cornell-brg/pydgin | arm/bootstrap.py | Python | bsd-3-clause | 8,853 | 0.029369 |
class VigenereCracker:
def __init__(self, language, minLen, maxLen):
self.LANGUAGE = language
#Key length could be from 1 to 13 bytes
self.KEYLENBOUNDS = range(minLen,maxLen)
self.SUMQPSQUARE = 0.065
self.KEYLENGTHFOUND = -1
self.KEY = []
... | JohnJakeChambers/break-the-vigenere | VigenereCracker.py | Python | gpl-3.0 | 3,920 | 0.009949 |
#
# 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
# ... | openstack/heat | heat/tests/test_stack_lock.py | Python | apache-2.0 | 12,477 | 0 |
# -*- coding: utf-8 -*-
import os
from inspector.utils.strings import render_template
def generate_graph_html(graph, filename):
"""
:type graph: networkx.Graph
:param str filename: path to save the generated html file
"""
params = {
'nodes': [],
'links': [],
}
ids... | amiraliakbari/static-inspector | inspector/utils/visualization/graph.py | Python | mit | 1,351 | 0.004441 |
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
from xmitgcm import open_mdsdataset
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
plt.ion()
dir1 = '/homedata/bderembl/runmit/test_southatlgyre'
ds1 = open_mdsdataset(dir1,prefix=['S'])
nt = 0
nz = 0
#... | Herpinemmanuel/Oceanography | Cas_1/Salinity/A_General_Salinity.py | Python | mit | 983 | 0.016277 |
# -*- coding: utf-8 -*-
"""
latexonhttp.resources.fetching
~~~~~~~~~~~~~~~~~~~~~
Fetchers for resources.
:copyright: (c) 2019 Yoan Tournade.
:license: AGPL, see LICENSE for more details.
"""
import base64
import requests
import logging
logger = logging.getLogger(__name__)
# ; # TODO Extract the f... | YtoTech/latex-on-http | latexonhttp/resources/fetching.py | Python | agpl-3.0 | 4,503 | 0.000666 |
#
# 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... | dcristoloveanu/qpid-proton | proton-c/env.py | Python | apache-2.0 | 2,444 | 0.003682 |
#
# Copyright 2014-2017 Red Hat, Inc.
#
# 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 ... | EdDev/vdsm | tests/vmapi_test.py | Python | gpl-2.0 | 3,422 | 0 |
import unittest
from mock import patch
from exporters.exporter_config import ExporterConfig
from exporters.persistence.base_persistence import BasePersistence
from exporters.persistence.pickle_persistence import PicklePersistence
from exporters.utils import remove_if_exists
from .utils import valid_config_with_updates... | scrapinghub/exporters | tests/test_persistence.py | Python | bsd-3-clause | 3,967 | 0.002017 |
from struct import pack, unpack
from datetime import datetime, date
import sys
from zkconst import *
def reverseHex(hexstr):
tmp = ''
for i in reversed( xrange( len(hexstr)/2 ) ):
tmp += hexstr[i*2:(i*2)+2]
return tmp
def zkRegevent(self):
"""register for live events"""
print "r... | AlSayedGamal/python_zklib | zklib/zkRegevent.py | Python | gpl-2.0 | 2,460 | 0.01748 |
import pytest
from unittest.mock import Mock
from ens.main import UnauthorizedError, AddressMismatch, UnownedName
'''
API at: https://github.com/carver/ens.py/issues/2
'''
@pytest.fixture
def ens2(ens, mocker, addr1, addr9, hash9):
mocker.patch.object(ens, '_setup_reverse')
mocker.patch.object(ens, 'addres... | carver/ens.py | tests/test_setup_name.py | Python | mit | 3,383 | 0.001478 |
"""
Sampling along tracks
---------------------
The :func:`pygmt.grdtrack` function samples a raster grid's value along specified
points. We will need to input a 2D raster to ``grid`` which can be an
:class:`xarray.DataArray`. The argument passed to the ``points`` parameter can be a
:class:`pandas.DataFrame` table whe... | GenericMappingTools/gmt-python | examples/gallery/images/track_sampling.py | Python | bsd-3-clause | 1,614 | 0.005576 |
#
# The Python Imaging Library.
# $Id$
#
# Binary input/output support routines.
#
# Copyright (c) 1997-2003 by Secret Labs AB
# Copyright (c) 1995-2003 by Fredrik Lundh
# Copyright (c) 2012 by Brian Crowell
#
# See the README file for information on usage and redistribution.
#
from struct import unpack, pack
if byte... | Microvellum/Fluid-Designer | win64-vc/2.78/Python/lib/site-packages/PIL/_binary.py | Python | gpl-3.0 | 1,855 | 0.001078 |
from app import db, GenericRecord
class Case(GenericRecord):
__collection__ = 'cases'
db.register([Case])
| michaelnetbiz/mistt-solution | app/models/cases.py | Python | mit | 114 | 0 |
# -*- coding: utf-8 -*-
#
# grissom - FOSS compliance tools
#
# Copyright (c) Eric Le Bihan <eric.le.bihan.dev@free.fr>
#
# 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 ... | elebihan/grissom | grissom/__init__.py | Python | gpl-3.0 | 909 | 0 |
# coding: utf-8
class Solution(object):
@staticmethod
def dfs(candidates, target, vis, res, cur_idx, sum):
if sum > target:
return
if sum == target:
ans = [candidates[i] for i in cur_idx if i >= 0]
res.append(ans)
return
if sum < target:
... | ShengRang/c4f | leetcode/combination-sum-ii.py | Python | gpl-3.0 | 1,342 | 0.007452 |
import unittest
from worldengine.drawing_functions import draw_ancientmap, gradient, draw_rivers_on_image
from worldengine.world import World
from tests.draw_test import TestBase, PixelCollector
class TestDrawingFunctions(TestBase):
def setUp(self):
super(TestDrawingFunctions, self).setUp()
self... | tmfoltz/worldengine | tests/drawing_functions_test.py | Python | mit | 1,681 | 0.004164 |
import py
from rpython.jit.metainterp.compile import ResumeGuardDescr
from rpython.jit.metainterp.history import (ConstInt, INT, REF,
FLOAT, VECTOR, TargetToken)
from rpython.jit.backend.llsupport.descr import (ArrayDescr, CallDescr,
unpack_arraydescr, unpack_fielddescr, unpack_interiorfielddescr)
from rpython.... | jptomo/rpython-lang-scheme | rpython/jit/backend/x86/vector_ext.py | Python | mit | 29,220 | 0.001711 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
CLI client for interacting with Freischutz RESTful APIs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:see: https://gitlab.com/tdely/freischutz/ Freischutz on GitLab
:author: Tobias Dély (tdely) <cleverhatcamouflage@gmail.com>
:copyright: (c) 2018-... | tdely/freischutz | tools/freischutz-client.py | Python | bsd-3-clause | 6,393 | 0.001252 |
"""
Example Sheepdog script with numpy.
We'll import and make global numpy inside our Sheepdog function,
and then any other function can also use it.
"""
import sheepdog
def f(a, b):
import numpy as np
global np
return g(a, b)
def g(a, b):
return np.mean(np.array((a, b)))
args = [(1, 1), (1, 2), (2... | adamgreig/sheepdog | examples/numpy_example.py | Python | mit | 531 | 0.00565 |
#!/usr/bin/env python
#Run the modularized application
from ufb import app, db
if __name__ == "__main__":
app.debug = True
db.create_all(app=app)
app.run(debug=True)
| mstrisoline/ufb | run.py | Python | gpl-2.0 | 181 | 0.01105 |
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2019 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 Public
# ... | fifengine/fifengine | engine/python/fife/extensions/loaders.py | Python | lgpl-2.1 | 2,646 | 0.015495 |
from django.contrib import admin
from responseTemplates.models import ResponseTemplate, Paragraph
class ParagraphInline(admin.StackedInline):
model = Paragraph
extra = 1
class ResponseTemplateAdmin(admin.ModelAdmin):
inlines = [ParagraphInline]
admin.site.register(ResponseTemplate, ResponseTemplateAd... | wispwisp/supportNotebook | responseTemplates/admin.py | Python | mit | 325 | 0 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/monitor/azure-monitor-query/azure/monitor/query/aio/__init__.py | Python | mit | 492 | 0.002033 |
import warnings
class Yaku:
yaku_id = None
tenhou_id = None
name = None
han_open = None
han_closed = None
is_yakuman = None
def __init__(self, yaku_id=None):
self.tenhou_id = None
self.yaku_id = yaku_id
self.set_attributes()
def __str__(self):
return ... | MahjongRepository/mahjong | mahjong/hand_calculating/yaku.py | Python | mit | 1,121 | 0.001784 |
#!/usr/bin/env python
#
# Copyright 2015 Airbus
# Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
#
# 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
#
# ... | ipa-led/airbus_coop | airbus_plugins/airbus_plugin_log_manager/setup.py | Python | apache-2.0 | 888 | 0.003378 |
#!/usr/bin/env python
# encoding: utf-8
## stdlib imports
import os
from glob import glob
## 3rd party
from . import pkgconf
from . import envmunge
from . import features as featmod
from . import util
## waf imports
import waflib.Logs as msg
import waflib.Context as context
# NOT from the waf book. The waf book ex... | hwaf/hwaf | py-hwaftools/orch/waffuncs.py | Python | bsd-3-clause | 4,382 | 0.006846 |
"""Assess transcript abundance in RNA-seq experiments using Cufflinks.
http://cufflinks.cbcb.umd.edu/manual.html
"""
import os
import shutil
import tempfile
import pandas as pd
from bcbio import bam
from bcbio.utils import get_in, file_exists, safe_makedir
from bcbio.distributed.transaction import file_transaction
fro... | vladsaveliev/bcbio-nextgen | bcbio/rnaseq/cufflinks.py | Python | mit | 10,844 | 0.000738 |
import warnings
from pathlib import Path
from typing import Union
try:
import xlwings as xw
except ImportError:
xw = None
from larray.util.misc import _positive_integer
from larray.core.group import _translate_sheet_name
from larray.core.array import asarray, zip_array_items
from larray.example import load_ex... | liam2/larray | larray/inout/xw_reporting.py | Python | gpl-3.0 | 35,378 | 0.003307 |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2016 Mervin <mofei2816@gmail.com>
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... | mofei2816/mervinz | blog/apps.py | Python | mit | 1,239 | 0 |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.WGL import _types as _cs
# End users want this...
from OpenGL.raw.WGL._types import *
from OpenGL.raw.WGL import _errors
from OpenGL.constant import Constant as _C
import ctype... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/raw/WGL/EXT/pbuffer.py | Python | lgpl-3.0 | 1,629 | 0.031921 |
import sync
import ui
import features
import functools
import save as _save
from freeciv.dropbox import get_download_path
def _impl_save(name, path):
def _do():
data = open(path, 'rb').read()
sync.request_with_sid('/sync/upload_save',
name=name,
... | eric-stanley/freeciv-android | lib/freeciv/dropbox_civsync.py | Python | gpl-2.0 | 1,258 | 0.007154 |
# Copyright 2015 David Wang. All rights reserved.
# Use of this source code is governed by MIT license.
# Please see LICENSE file
# WebSpark
# Spark web service demo
# version 0.2
# use REPL or define sc SparkContext
import urllib2, urllib
import math
import time
import traceback
# Spark Web Application demo wi... | mdavid8/WebSpark | spark_webservice_demo.py | Python | mit | 1,997 | 0.031047 |
from django.conf.urls import include, url
urlpatterns = [
url(r"^account/", include("account.urls")),
url(r"^", include("pinax.teams.urls", namespace="pinax_teams")),
]
| pinax/pinax-teams | pinax/teams/tests/urls.py | Python | mit | 178 | 0 |
# Set modules to be exported with "from oaxmlapi import *"
__all__ = ['commands', 'connections', 'datatypes', 'utilities']
| derekperry/oaxmlapi | oaxmlapi/__init__.py | Python | mit | 123 | 0 |
try:
# Python 3
from http.client import HTTPResponse, IncompleteRead
str_cls = str
except (ImportError):
# Python 2
from httplib import HTTPResponse, IncompleteRead
str_cls = unicode
from ..console_write import console_write
class DebuggableHTTPResponse(HTTPResponse):
"""
A custom HT... | herove/dotfiles | sublime/Packages/Package Control/package_control/http/debuggable_http_response.py | Python | mit | 2,329 | 0.000429 |
from django.conf.urls import url
from ..views import collections as views
urlpatterns = [
url('^create/$', views.Create.as_view(), name='create'),
url('^c:(?P<slug>[-\w]+)/$', views.Detail.as_view(), name='detail'),
url('^$', views.List.as_view(), name='list'),
]
| kennethlove/django_bookmarks | dj_bookmarks/bookmarks/urls/collections.py | Python | bsd-3-clause | 278 | 0.003597 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2017 F5 Networks Inc.
#
# 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
# ... | mryanlam/f5-ansible | library/iworkflow_service.py | Python | gpl-3.0 | 14,907 | 0.001006 |
import unittest
import tempfile
import os
from os.path import join
import zipfile
from git import *
from shutil import rmtree
from gitbranchhealth.branchhealth import BranchHealthConfig
class GitRepoTest(unittest.TestCase):
def setUp(self):
self.__mOriginTempDir = tempfile.mkdtemp(prefix='gitBranchHealthTest')
... | jwir3/gitbranchhealth | tests/testutil.py | Python | mpl-2.0 | 2,053 | 0.006332 |
from __future__ import unicode_literals
__VERSION__ = '0.1.1'
| dvdmgl/django-pg-fts | pg_fts/__init__.py | Python | bsd-2-clause | 63 | 0 |
#!/usr/bin/env python
from rdflib import Graph, BNode, Literal, URIRef
from rdflib.namespace import FOAF
from flask import Flask
import flask_rdf
import random
app = Flask(__name__)
# set up a custom formatter to return turtle in text/plain to browsers
custom_formatter = flask_rdf.FormatSelector()
custom_formatter.w... | hufman/flask_rdf | examples/browser_default.py | Python | bsd-2-clause | 751 | 0.002663 |
#-----------------------------------------------------------------------------------------------------------------------
#Introdução a Programação de Computadores - IPC
#Universidade do Estado do Amazonas - UEA
#Prof. Jucimar Jr.
#Alexandre Marques Uchôa 1715310028
#Jandinne Duarte de Oliveira 1... | jucimarjr/IPC_2017-1 | lista02/lista02_exercicio01_questao06.py | Python | apache-2.0 | 781 | 0.019481 |
"""CMS apphook for the django-outlets app."""
from django.utils.translation import ugettext_lazy as _
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from . import menu
class OutletsApphook(CMSApp):
name = _("Outlets Apphook")
urls = ["outlets.urls"]
menus = [menu.OutletsMenu]
... | bitmazk/cmsplugin-django-outlets | cmsplugin_outlets/cms_app.py | Python | mit | 360 | 0 |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publis... | KhronosGroup/COLLADA-CTS | StandardDataSets/collada/library_cameras/camera/optics/orthographic/optics_orthographic_zfar/optics_orthographic_zfar.py | Python | mit | 4,007 | 0.009234 |
"""
This example loads the pre-trained SentenceTransformer model 'nli-distilroberta-base-v2' from the server.
It then fine-tunes this model for some epochs on the STS benchmark dataset.
Note: In this example, you must specify a SentenceTransformer model.
If you want to fine-tune a huggingface/transformers model like b... | UKPLab/sentence-transformers | examples/training/sts/training_stsbenchmark_continue_training.py | Python | apache-2.0 | 3,514 | 0.005407 |
from unittest import TestCase
from dirty_validators.basic import (BaseValidator, EqualTo, NotEqualTo, StringNotContaining, Length, NumberRange,
Regexp, Email, IPAddress, MacAddress, URL, UUID, AnyOf, NoneOf,
IsEmpty, NotEmpty, NotEmptyString, IsNon... | alfred82santa/dirty-validators | tests/dirty_validators/tests_basic.py | Python | mit | 26,469 | 0.002909 |
# -*- coding: utf-8 -*-
#from pykt import *
from pykt import KyotoTycoon as kt1
from kyototycoon import DB as kt2
from pykt_emu import KyotoTycoon as kt3
import timeit
from cPickle import dumps, loads
key = "A" * 12
val = "B" * 1024
def bench_set(Impl):
db = Impl()
db.open()
ret = db.set(key, val)
assert ret ==... | beschulz/kyototycoon | bench/benchmark.py | Python | gpl-2.0 | 3,361 | 0.046712 |
"""
Plots the Histogram
"""
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import matplotlib.cm as cm
import PVReadWeights as rw
import PVConversions as conv
from pylab import save
import math
import random
if len(sys.argv) < 3:
print "usage: hamming filename ... | dpaiton/OpenPV | pv-core/analysis/python/plot_hamming.py | Python | epl-1.0 | 3,742 | 0.031267 |
"""VeSync integration."""
import logging
from pyvesync import VeSync
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.dispatcher import async_dispatcher_send
from .common import async_process_devices
from .cons... | home-assistant/home-assistant | homeassistant/components/vesync/__init__.py | Python | apache-2.0 | 4,023 | 0.000746 |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread 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:
# 1. Redistributions of source code must retain the above copyright
# notic... | erja-gp/openthread | tools/harness-automation/cases/sed_9_2_13.py | Python | bsd-3-clause | 1,871 | 0.001603 |
import scipy as sp
import matplotlib
import matplotlib.pyplot as plt
def simple_log_qqplot(quantiles_list, png_file=None, pdf_file=None, quantile_labels=None, line_colors=None,
max_val=5, title=None, text=None, plot_label=None, ax=None, **kwargs):
storeFig = False
if ax is None:
f = plt.fig... | timeu/PyGWAS | pygwas/core/plot.py | Python | mit | 4,855 | 0.006591 |
#!/usr/bin/env python
# -*- Mode: Python; tab-width: 4 -*-
#
# Netfarm Mail Archiver - release 2
#
# Copyright (C) 2005-2007 Gianluigi Tiesi <sherpya@netfarm.it>
# Copyright (C) 2005-2007 NetFarm S.r.l. [http://www.netfarm.it]
#
# This program is free software; you can redistribute it and/or modify
# it under the term... | sherpya/archiver | backend_xmlrpc.py | Python | gpl-2.0 | 2,693 | 0.00557 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import zmq
import threading
import logging
import logging.handlers
import util
class Logger(threading.Thread):
"""logger for all messages and events"""
def __init__(self, stop_logging, filename='bus.log'):
super(Logger, self).__init__()
self.filename = filename
se... | ross128/pybus | bus.py | Python | agpl-3.0 | 2,629 | 0.030049 |
"""Normalize whitespace and Unicode forms in Python 3.
Functions:
normalize_space() -- collapse whitespace and trim
normalize_unicode() -- return specified Unicode normal form
"""
__author__ = 'Tom Elliott'
__copyright__ = 'Copyright ©️ 2017 New York University'
__license__ = 'See LICENSE.txt'
__version__ = '0.3'
im... | isawnyu/textnorm | textnorm/__init__.py | Python | agpl-3.0 | 4,388 | 0.000228 |
Plot the forecasted temperatures of Miami in Celsius. You'll need to use the "<a href='#'>create empty list</a>" and "<a href='#'>append</a>" blocks to create a new list of Celsius temperatures from the forecasted temperatures in Blacksburg, and then plot these new temperatures against the old ones.
#####
import weath... | RealTimeWeb/Blockpy-Server | static/programs/temperatures.py | Python | mit | 634 | 0.012618 |
"""
==================
Prediction Latency
==================
This is an example showing the prediction latency of various scikit-learn
estimators.
The goal is to measure the latency one can expect when doing predictions
either in bulk or atomic (i.e. one by one) mode.
The plots represent the distribution of the pred... | chenyyx/scikit-learn-doc-zh | examples/zh/applications/plot_prediction_latency.py | Python | gpl-3.0 | 11,475 | 0 |
#! /usr/bin/env python
"""
Simple application to send APDUs to a card.
__author__ = "http://www.gemalto.com"
Copyright 2001-2010 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the terms ... | 12019/pyscard | smartcard/Examples/wx/apdumanager/apdumanager.py | Python | lgpl-2.1 | 1,988 | 0.004527 |
"""
byceps.signals.shop
~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from blinker import Namespace
shop_signals = Namespace()
order_placed = shop_signals.signal('order-placed')
order_canceled = shop_signals.signal('order-canceled')
order... | homeworkprod/byceps | byceps/signals/shop.py | Python | bsd-3-clause | 362 | 0 |
'''
Copyright 2016, EMC, Inc.
Author(s):
George Paulos
'''
import os
import sys
import subprocess
# set path to common libraries
sys.path.append(subprocess.check_output("git rev-parse --show-toplevel", shell=True).rstrip("\n") + "/test/common")
import fit_common
# Select test group here using @attr
from nose.plugin... | tldavies/RackHD | test/tests/rackhd20/test_rackhd20_api_files.py | Python | apache-2.0 | 3,026 | 0.00727 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import struct
from layer1 import VarLenMessage, VarLenSocket
class TagMessage:
"""
TagMessage contains a string tag and string data.
Paramters
---------
tag: string
The type of the message. Currently supported tags are "json" and
"asyn... | pfederl/CARTAvis | carta/scriptedClient/layer2.py | Python | gpl-2.0 | 2,551 | 0.001176 |
#!/usr/bin/python
#
# 08-buttonTurnsOnLed.py: when the button is pressed, turn on the led
# -------------------------------------------------------------------
#
import mraa
import time
LOW = 0
HIGH = 1
digitalInPin = 8
digitalInGpio = mraa.Gpio( digitalInPin )
ledOutPin = 3
ledOutGpio = mraa.Gpio( ledOutPin )
ledOu... | tomwhartung/edison_python | my_examples/02.Digital/08-buttonTurnsOnLed.py | Python | gpl-3.0 | 672 | 0.040179 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.