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 -*-
import os, sys
sys.path.insert(1, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from spectrocrunch.materials.compoundfromformula import compoundfromformula
from spectrocrunch.materials.compoundfromname import compoundfromname
from spectrocrunch.materials.mixture import mixture
... | woutdenolf/spectrocrunch | scraps/ffnoisesimul.py | Python | mit | 9,053 | 0.00232 |
# -*- coding:utf-8 -*-
from werkzeug.routing import Map, Submount
import libcloud
from libcloud_rest.api.handlers import app_handler
from libcloud_rest.api.handlers.compute import compute_handler
from libcloud_rest.api.handlers.dns import dns_handler
from libcloud_rest.api.handlers.loadbalancer import lb_handler
from ... | islamgulov/libcloud.rest | libcloud_rest/api/urls.py | Python | apache-2.0 | 704 | 0 |
from models.pusher import push
print repr(push("Bazinga..."))
| uniite/pyirc | test_msg.py | Python | mit | 63 | 0 |
# $Id$
# -*- coding: utf8 -*-
# Authors: David Goodger <goodger@python.org>; Ueli Schlaepfer; Günter Milde
# Maintainer: docutils-develop@lists.sourceforge.net
# Copyright: This module has been placed in the public domain.
"""
Transforms needed by most or all documents:
- `Decorations`: Generate a document's header &... | Lyleo/OmniMarkupPreviewer | OmniMarkupLib/Renderers/libs/python3/docutils/transforms/universal.py | Python | mit | 10,307 | 0.001067 |
# Authors: Tomas Babej <tbabej@redhat.com>
#
# Copyright (C) 2013 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 ... | tbabej/freeipa | ipaserver/install/otpdinstance.py | Python | gpl-3.0 | 948 | 0 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 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 the REST API."""
from test_framework.test_framework import BitcoinTestFramework
from test_framewo... | StarbuckBG/BTCGPU | test/functional/rest.py | Python | mit | 15,085 | 0.00822 |
# Original topological sort code written by Ofer Faigon (www.bitformation.com) and used with permission
# Permission is hereby granted to copy, modify and use this source code for any purpose as long as the above comment line is included with it.
"""
Loop detection and depth calculation added by Zhenlei Cai (c) 2010... | jerryzhenleicai/lattice | lattice/topo_sort.py | Python | apache-2.0 | 3,768 | 0.00345 |
"""holds locking functionality that works across processes"""
from __future__ import absolute_import, unicode_literals
from contextlib import contextmanager
import py
from filelock import FileLock, Timeout
from tox.reporter import verbosity1
@contextmanager
def hold_lock(lock_file, reporter=verbosity1):
py.pat... | tox-dev/tox | src/tox/util/lock.py | Python | mit | 1,295 | 0.002317 |
__all__ = ['stack']
| Sriee/epi | data_structures/lib/__init__.py | Python | gpl-3.0 | 21 | 0 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 CERN.
##
## Invenio 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 ... | egabancho/invenio | invenio/modules/sequencegenerator/backend.py | Python | gpl-2.0 | 2,606 | 0.00614 |
def exgcd(a, b):
"""Uses the extended Euclidean algorithm to return
the gcd as well as the solutions to Bézout's identity:
coefficients x and y such that ax + by = gcd(a, b)."""
x, y = 0, 1
u, v = 1, 0
while a != 0:
quo = b // a
rem = b % a
m = x - (quo * u)
n = y... | aelk/loga | math/exgcd.py | Python | mit | 429 | 0 |
#!/usr/bin/env python
"""
@package mi.dataset.driver.wc_wm.cspp
@file mi/dataset/driver/wc_wm/cspp/wc_wm_cspp_telemetered_driver.py
@author Jeff Roy
@brief Driver for the wc_wm_cspp instrument
Release notes:
Initial Release
"""
from mi.dataset.dataset_parser import DataSetDriverConfigKeys
from mi.dataset.dataset_dr... | janeen666/mi-instrument | mi/dataset/driver/wc_wm/cspp/wc_wm_cspp_telemetered_driver.py | Python | bsd-2-clause | 1,972 | 0.002535 |
import os
from angular_flask import app
from flask.ext.restless import APIManager
from flask.ext.mongoengine import MongoEngine
app.config["MONGODB_SETTINGS"] = {'DB':os.environ.get('MONGODB_DB'),"host":os.environ.get('MONGODB_URI')}
mongo_db = MongoEngine(app)
api_manager = APIManager(app)
| ascension/angular-flask-mongo | angular_flask/core.py | Python | mit | 298 | 0.013423 |
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2009 by the FIFE team
# http://www.fifengine.de
# 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
# ... | parpg/parpg | tools/map_editor/scripts/gui/input.py | Python | gpl-3.0 | 1,824 | 0.016447 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def Action(vim, *args, **kwargs):
'''This data object type defines the action initiated b... | xuru/pyvisdk | pyvisdk/do/action.py | Python | mit | 1,144 | 0.009615 |
# Copyright 2012 Pedro Navarro Perez
# Copyright 2013 Cloudbase Solutions Srl
# 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... | openstack/compute-hyperv | compute_hyperv/nova/volumeops.py | Python | apache-2.0 | 33,067 | 0 |
"""
ABP analyzer and graphics tests
"""
cases = [
('Run Pymodel Graphics to generate dot file from FSM model, no need use pma',
'pmg.py ABP'),
('Generate SVG file from dot',
'dotsvg ABP'),
# Now display ABP.dot in browser
('Run PyModel Analyzer to generate FSM from original FSM, should be ... | nfredrik/pyModelStuff | samples/abp/test_graphics.py | Python | bsd-3-clause | 613 | 0.004894 |
from string import digits, ascii_letters
valid_values = list(digits + ascii_letters) # приводим строку к списку
radix = len(valid_values) #основание
def convert(number):
result =[] #будем сюда складывать остатки от деления
while number:
result.insert(0,valid_values[number % radix])
number //=... | ksigorodetskaya/Python_Ifmo | Part1/url-shorter/url_shorter/converter.py | Python | apache-2.0 | 675 | 0.017483 |
###############################################################################
#cyn.in is an open source Collaborative Knowledge Management Appliance that
#enables teams to seamlessly work together on files, documents and content in
#a secure central environment.
#
#cyn.in v2 an open source appliance is distribut... | cynapse/cynin | src/ubify.viewlets/ubify/viewlets/browser/sitetitle.py | Python | gpl-3.0 | 2,433 | 0.011919 |
'''
PIL: PIL image loader
'''
__all__ = ('ImageLoaderPIL', )
try:
from PIL import Image as PILImage
except:
import Image as PILImage
from kivy.logger import Logger
from kivy.core.image import ImageLoaderBase, ImageData, ImageLoader
class ImageLoaderPIL(ImageLoaderBase):
'''Image loader based on the PIL... | niavlys/kivy | kivy/core/image/img_pil.py | Python | mit | 3,319 | 0.000904 |
from guardian.shortcuts import get_perms
from rest_framework import serializers as ser
from rest_framework.exceptions import ValidationError
from reviews.workflow import Workflows
from api.actions.serializers import ReviewableCountsRelationshipField
from api.base.utils import absolute_reverse, get_user_auth
from api.... | aaxelb/osf.io | api/preprint_providers/serializers.py | Python | apache-2.0 | 5,102 | 0.001176 |
# -*- 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 model 'Problem'
db.create_table(u'game_problem', (
(u'id', self.gf('django.db.models.fi... | hackcyprus/junior | game/migrations/0001_initial.py | Python | mit | 4,851 | 0.007627 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# kOS-C documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 4 18:06:04 2017.
#
# 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
# auto... | fatho/kos-c | docs/source/conf.py | Python | bsd-3-clause | 4,828 | 0.000621 |
# (c) 2019 Red Hat 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
# (at your option) any later version.
#
# Ansible is dis... | roadmapper/ansible | test/units/modules/network/cloudengine/test_ce_is_is_instance.py | Python | gpl-3.0 | 2,883 | 0.001041 |
#!env/bin/python
from app import app
import sys
port = 5000
debug = True
if len(sys.argv) == 3:
debug = sys.argv[1] == 'debug'
port = int(sys.argv[2])
app.run(debug = debug, port = port)
| BamX/dota2-matches-statistic | run.py | Python | mit | 191 | 0.031414 |
from .todict import *
from .toxml import *
class Dyslexml:
def __init__(self):
self.toDict = todict.parse
self.toXml = toxml.translate
| ccubed/Dyslexml | dyslexml/__init__.py | Python | mit | 157 | 0 |
# Copyright 2016 Huawei Technologies India Pvt. 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... | dims/neutron | neutron/tests/unit/api/rpc/agentnotifiers/test_bgp_dr_rpc_agent_api.py | Python | apache-2.0 | 3,575 | 0 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2017 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import re
f... | mugurrus/superdesk-core | superdesk/text_utils.py | Python | agpl-3.0 | 5,251 | 0.001905 |
# -*- coding: utf-8 -*-
from shutil import rmtree
from tempfile import mkdtemp
from omdbapi import OMDbAPI
from scrusubtitles import ScruSubtitles
from scrusubtitles import ScruSubtitlesListener
from scrusubtitles import ScruSubtitlesLogger
class TestService(ScruSubtitlesListener, ScruSubtitlesLogger):
def __in... | systemcrash/service.subtitles.subs_com_ru | resources/lib/scrutest.py | Python | gpl-2.0 | 2,013 | 0.000994 |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Band(models.Model):
name = models.CharField(max_length=100)
class Meta:
ordering = ('name',)
def __str__(self):
return self.name
| openhatch/new-mini-tasks | vendor/packages/Django/tests/regressiontests/middleware/models.py | Python | apache-2.0 | 287 | 0 |
# -*- coding: utf-8 -*-
import sys
import tokenizer
import os
import re
import helpers.io as io
# just tokenizes the file
def simple(filepath):
tok = tokenizer.Tokenizer(filepath)
results = tok.full_tokenize()
return tokenizer.compress_tokens(results)
# smartly tokenizes a function for modified token edi... | JonathanPierce/Algae | preprocessors/tokenizer/main.py | Python | mit | 1,473 | 0.007468 |
import urllib.request
import pickle
import sys
import ast
try:
import variables as v
except:
class var():
def __init__(self):
self.screen = None
v = var()
import pygame as py
class textLabel(py.sprite.Sprite):
def __init__(self, text, pos, colour, font, size, variable ... | lightopa/Aiopa-Battles | updater.py | Python | mit | 9,215 | 0.007271 |
from flask import Blueprint
from flask import flash
from flask import make_response, render_template
from flask_login import current_user
from markupsafe import Markup
from app.helpers.data_getter import DataGetter
from app.helpers.auth import AuthManager
from app.helpers.exporters.ical import ICalExporter
from app.he... | gaeun/open-event-orga-server | app/views/users/export.py | Python | gpl-3.0 | 2,211 | 0.003166 |
from .working_gif import working_encoded
from .splash import SplashScreen, Spinner, CheckProcessor
from .multilistbox import MultiListbox
from .utils import set_widget_state, set_binding, set_button_action, set_tab_order
from .tooltip import ToolTip
| rutherford/tikitiki | tikitiki/__init__.py | Python | bsd-3-clause | 255 | 0.003922 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2013 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 L... | cbeck88/fifengine | tests/extension_tests/loaders_tests.py | Python | lgpl-2.1 | 2,394 | 0.012949 |
"""
Created on Thu May 05 20:02:00 2011
@author: Tillsten
"""
import numpy as np
from scipy.linalg import qr
eps = np.finfo(float).eps
def mls(B, v, umin, umax, Wv=None, Wu=None, ud=None, u=None, W=None, imax=100):
"""
mls - Control allocation using minimal least squares.
[u,W,iter] = mls_alloc(... | treverhines/ModEst | modest/pymls/init.py | Python | mit | 7,780 | 0.002571 |
"""Functionality for autorenewal and associated juggling of configurations"""
from __future__ import print_function
import copy
import glob
import logging
import os
import traceback
import six
import zope.component
import OpenSSL
from letsencrypt import configuration
from letsencrypt import cli
from letsencrypt impo... | mitnk/letsencrypt | letsencrypt/renewal.py | Python | apache-2.0 | 15,711 | 0.000827 |
# -*- coding: utf-8 -*-
# Copyright (c) 2011 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing the rebase extension interface.
"""
from __future__ import unicode_literals
import os
from PyQt5.QtWidgets import QDialog
from ..HgExtension import HgExtension
from ..HgDialog import HgDialog
... | testmana2/test | Plugins/VcsPlugins/vcsMercurial/RebaseExtension/rebase.py | Python | gpl-3.0 | 4,473 | 0.00313 |
"""The tests for the Tasmota sensor platform."""
import copy
import datetime
from datetime import timedelta
import json
from unittest.mock import Mock, patch
import hatasmota
from hatasmota.utils import (
get_topic_stat_status,
get_topic_tele_sensor,
get_topic_tele_will,
)
import pytest
from homeassistant... | aronsky/home-assistant | tests/components/tasmota/test_sensor.py | Python | apache-2.0 | 33,360 | 0.0006 |
import os
import time
from six.moves import reload_module
from flask import request
from mock import patch
from redash import models, settings
from redash.authentication import (api_key_load_user_from_request,
get_login_url, hmac_load_user_from_request,
... | chriszs/redash | tests/test_authentication.py | Python | bsd-2-clause | 13,446 | 0.002157 |
import unittest
from katas.kyu_7.complementary_dna import DNA_strand
class DNAStrandTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(DNA_strand('AAAA'), 'TTTT')
def test_equals_2(self):
self.assertEqual(DNA_strand('ATTGC'), 'TAACG')
def test_equals_3(self):
s... | the-zebulan/CodeWars | tests/kyu_7_tests/test_complementary_dna.py | Python | mit | 364 | 0 |
# Tic Tac Toe
# Tic Tac Toe
import random
def drawBoard(board):
# This function prints out the board that it was passed.
# "board" is a list of 10 strings representing the board (ignore index 0)
print(' | |')
print(' ' + board[7] + ' | ' + board[8] + ' | ' + board[9])
print(' | |')
p... | pathway27/games-prac | python3/tictactoe.py | Python | mit | 6,138 | 0.006028 |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Monkey-patching to add multiprocessing support for coverage.py"""
import multiprocessing
import multiprocessing.process
import os
from coverage import env
from... | blueyed/coveragepy | coverage/multiproc.py | Python | apache-2.0 | 3,478 | 0.00115 |
# -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*-
#
# Copyright (C) 2009 John Iacona
#
# 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, or (at your optio... | dardevelin/rhythmbox-shuffle | plugins/context/ArtistTab.py | Python | gpl-2.0 | 13,087 | 0.015741 |
# -*- coding: utf-8 -*-
from PyQt5.QtCore import Qt, QLocale, QSettings, QMargins
from PyQt5.QtWidgets import *
import OpenNumismat
from OpenNumismat.EditCoinDialog.FormItems import NumberEdit
from OpenNumismat.Collection.CollectionFields import CollectionFieldsBase
from OpenNumismat.Reports import Report
from OpenNu... | kurtrr/open-numismat | OpenNumismat/Settings.py | Python | gpl-3.0 | 14,504 | 0.000622 |
# Copyright (C) 2014 Adam Schubert <adam.schubert@sg1-game.net>
#
# 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 your option) any later version.
#
# Th... | Salamek/DwaPython | tests/AllTests.py | Python | gpl-3.0 | 973 | 0.00925 |
from yoyo.connections import parse_uri, unparse_uri
def _test_parse_uri(connection_string, expected_uri_tuple):
uri_tuple = parse_uri(connection_string)
assert isinstance(uri_tuple, tuple)
assert (uri_tuple == expected_uri_tuple)
def _test_unparse_uri(uri_tuple, expected_connection_string):
connecti... | xlvector/yoyo-migrations | yoyo/tests/test_parse_uri.py | Python | bsd-3-clause | 1,061 | 0.001885 |
import argparse
import json
import datetime
import os
import sys
from codecs import open
def run(cohort_id, threshold, period, course_range):
from django.contrib.auth.models import User
from django.db.models import Sum, Max, Min, Avg
from django.utils.html import strip_tags
from oppia.mode... | DigitalCampus/oppia-data-scripts-hews-2015 | scripts/hews-quiz-progress-threshold.py | Python | gpl-3.0 | 5,647 | 0.022844 |
import random
from base64 import b64encode, b64decode
import mock
from six.moves.urllib.parse import parse_qs, urlparse
from pyramid.httpexceptions import HTTPBadRequest
from kinto.core.utils import json
from . import BaseTest
class PaginationTest(BaseTest):
def setUp(self):
super(PaginationTest, self)... | monikagrabowska/osf.io | kinto/tests/core/resource/test_pagination.py | Python | apache-2.0 | 10,656 | 0 |
#!/usr/bin/env python
"""Main Django renderer."""
import os
import pdb
import time
from django import http
from django import shortcuts
from django import template
from django.views.decorators import csrf
import logging
from grr import gui
from grr.gui import renderers
from grr.gui import webauth
from grr.lib impo... | simsong/grr-insider | gui/views.py | Python | apache-2.0 | 7,359 | 0.009512 |
# yselect - An RPM/Yum package handling frontend.
# Copyright (C) 2006 James Bowes <jbowes@redhat.com>
# Copyright (C) 2006 Devan Goodwin <dg@fnordia.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fr... | jbowes/yselect | test/fakes/repository.py | Python | gpl-2.0 | 1,532 | 0.001305 |
# (c) 2015, Alice Ferrazzi <alice.ferrazzi@gmail.com>
#
# This file is part of Eisen
#
# Eisen 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 v... | eisen-dev/eisen_engine | core/mysql_config.py | Python | gpl-3.0 | 1,454 | 0.003439 |
import PyOrgMode
import time
import unittest
class TestClockElement(unittest.TestCase):
def test_duration_format(self):
"""Durations are formatted identically to org-mode"""
for hour in '0', '1', '5', '10', '12', '13', '19', '23':
for minute in '00', '01', '29', '40', '59':
... | elationfoundation/PyOrgMode | build/lib/PyOrgMode/test_clock.py | Python | gpl-3.0 | 593 | 0.003373 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility functions for Windows builds.
These functions are executed via gyp-win-tool when using the ninja generator.
"""
from ctypes imp... | nikste/visualizationDemo | zeppelin-web/node/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py | Python | apache-2.0 | 6,979 | 0.006018 |
"""
Created on 5 Sep 2016
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
in /boot/config.txt
# RPi...
# Uncomment for i2c-0 & i2c-3 access (EEPROM programming)
# dtparam=i2c_vc=on
dtoverlay i2c-gpio i2c_gpio_sda=0 i2c_gpio_scl=1
"""
import time
from scs_core.sys.eeprom_image import EEPROMImage
from s... | south-coast-science/scs_dfe_eng | src/scs_dfe/interface/component/cat24c32.py | Python | mit | 2,699 | 0.005187 |
"""
A mechanize browser that redirects specified HTTP connections to a WSGI
object.
"""
from httplib import HTTP
from mechanize import Browser as MechanizeBrowser
from wsgi_intercept.urllib2_intercept import install_opener, uninstall_opener
try:
from mechanize import HTTPHandler
except ImportError:
# pre mecha... | NGSegovia/wsgi-intercept | wsgi_intercept/mechanize_intercept/wsgi_browser.py | Python | mit | 1,068 | 0.005618 |
"""
WSGI config for mothra 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_APPLICATION`` s... | xflows/textflows | mothra/wsgi.py | Python | mit | 1,305 | 0.002299 |
'''
Hom family of models based on: [Drukker2013]_
Following: [Anselin2011]_
'''
__author__ = "Luc Anselin luc.anselin@asu.edu, Daniel Arribas-Bel darribas@asu.edu"
from scipy import sparse as SP
import numpy as np
from numpy import linalg as la
import ols as OLS
from pysal import lag_spatial
from utils import power... | ljwolf/pysal | pysal/spreg/error_sp_hom.py | Python | bsd-3-clause | 57,745 | 0.001039 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import print_function
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
# REF [site] >> https://machinelearningmastery.com/how-to-visualize-filters-and-feature-maps-in-convolutional-neural-networks/
def visualize_filters_in_CNN():... | sangwook236/general-development-and-testing | sw_dev/python/rnd/test/machine_learning/keras/keras_visualization.py | Python | gpl-2.0 | 3,637 | 0.02887 |
import os
import libtaxii
project = u'libtaxii'
copyright = u'2014, The MITRE Corporation'
version = libtaxii.__version__
release = version
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.ifconfig',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinxcontrib.napoleo... | stkyle/libtaxii | docs/conf.py | Python | bsd-3-clause | 945 | 0 |
__author__ = 'jatwood'
import sys
import numpy as np
from sklearn.metrics import f1_score, accuracy_score
from sklearn.linear_model import LogisticRegression
import data
import util
import kernel
import structured
from baseline_graph_experiment import GraphDecompositionModel
def graph_proportion_baseline_experiment... | jcatw/scnn | scnn/graph_proportion_baseline_experiment.py | Python | mit | 6,889 | 0.019016 |
"""CS 234 Assignment 2 Question 1a - Testing assumptions: Stock.py
"""
class Stock:
"""
A data type representing a single stock
Fields: name - str: the company name as a string
symbol - str: a string uniquely identifying the stock
price - non-negative float: last/current price
... | bcso/CS_234_Assignments | Assignment 2/Stock.py | Python | apache-2.0 | 3,006 | 0.024285 |
#!/usr/bin/env python
"""
DragonPy - base memory info
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:created: 2013 by Jens Diemer - www.jensdiemer.de
:copyleft: 2013 by the MC6809 team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
import sys
class BaseMemoryInfo... | 6809/MC6809 | MC6809/core/memory_info.py | Python | gpl-3.0 | 1,835 | 0 |
import datetime
import json
import pickle
import re
import time
import traceback
import uuid
from functools import wraps
from huey.backends.dummy import DummySchedule
from huey.exceptions import DataStoreGetException
from huey.exceptions import DataStorePutException
from huey.exceptions import DataStoreTimeout
from hu... | charleswhchan/huey | huey/api.py | Python | mit | 16,245 | 0.000616 |
import datetime
import gzip
import os
import sys
import tempfile
import time
from importlib import reload
from subprocess import Popen
import numpy as np
import pytest
from owslib.fes import PropertyIsEqualTo
import pydov
from pydov.search.boring import BoringSearch
from pydov.search.grondwaterfilter import Grondwate... | DOV-Vlaanderen/pydov | tests/test_error_path.py | Python | mit | 12,376 | 0 |
#!/usr/bin/env python3
from AbstractAPIReader import AbstractAPIReader
from Smartvel import Smartvel
from smartvel_auth import TOKEN
class APIReaderSmartvel(AbstractAPIReader):
def __init__(self, token=TOKEN, endpoint='events'):
self._token = token
self._endpoint = endpoint
def get_iterable... | Pysellus/streaming-api-test | api-reader/APIReaderSmartvel.py | Python | mit | 381 | 0.005249 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from os.path import splitext
import yaml
def build_plan(discovery_result, config=None):
""" Extract content and determine which checks need to be run
Checks are assigned in the following order:
1. <filename>.fval
2. <dir>.fval
3. d... | jonhadfield/fval | fval/plan.py | Python | mit | 3,930 | 0.002036 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate... | agry/NGECore2 | scripts/mobiles/yavin4/hooded_crystal_snake.py | Python | lgpl-3.0 | 1,650 | 0.026667 |
from sympy.core import (S, pi, oo, Symbol, symbols, Rational, Integer,
GoldenRatio, EulerGamma, Catalan, Lambda, Dummy, Eq)
from sympy.functions import (Piecewise, sin, cos, Abs, exp, ceiling, sqrt,
gamma, sign, Max, Min, factorial, beta)
from sympy.sets import Range... | wxgeo/geophar | wxgeometrie/sympy/printing/tests/test_rcode.py | Python | gpl-2.0 | 14,177 | 0.003597 |
from corrdb.common.models import UserModel
from corrdb.common.models import ProfileModel
from corrdb.common import get_or_create
import hashlib
import datetime
import simplejson as json
import os
import re
def password_check(password):
"""
Verify the strength of 'password'
Returns a dict indicating the wro... | usnistgov/corr | corr-cloud/cloud/views/admin_generation.py | Python | mit | 3,973 | 0.004782 |
"""
Copyright (c) 2012-2020 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | phillxnet/rockstor-core | src/rockstor/cli/iscsi_console.py | Python | gpl-3.0 | 1,794 | 0 |
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@no_debug_info_test
def test(self):
self.build()
self.dbg.CreateTarget(self.getBuildArtifact("a.... | google/llvm-propeller | lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py | Python | apache-2.0 | 473 | 0.004228 |
#!/usr/bin/env python
'''
headderTemplate: an immutale tuple listing, in order, the expected headders
'''
headderTemplate = (
"Payee Name: ",
"Payee ID: ",
"Payee Site: ",
"Payment Number: ",
"Payment Date: ",
)
'''
headderConverters: a dictionary key'd on the Headder title. the valu... | dkelsey/payment-remittance-processor | scripts/verifyHeader.py | Python | apache-2.0 | 2,156 | 0.014842 |
from Foundation import *
from PyObjCTools.TestSupport import *
class TestNSXMLNodeOptions (TestCase):
def testConstants(self):
self.assertEqual(NSXMLNodeOptionsNone, 0)
self.assertEqual(NSXMLNodeIsCDATA, 1 << 0)
self.assertEqual(NSXMLNodeExpandEmptyElement, 1 << 1)
self.assertEqual(... | albertz/music-player | mac/pyobjc-framework-Cocoa/PyObjCTest/test_nsxmlnodeoptions.py | Python | bsd-2-clause | 2,358 | 0.001272 |
from contextlib import contextmanager
import json
import mock
# Mock tastypi API.
class ProjectData(object):
def get(self):
return dict()
def mock_version(repo):
class MockVersion(object):
def __init__(self, x=None):
pass
def put(self, x=None):
return x
... | GovReady/readthedocs.org | readthedocs/rtd_tests/mocks/mock_api.py | Python | mit | 2,893 | 0 |
from django.conf.urls.defaults import patterns, url
from snippets.base import views
urlpatterns = patterns('',
url(r'^$', views.index, name='base.index'),
url(r'^(?P<startpage_version>[^/]+)/(?P<name>[^/]+)/(?P<version>[^/]+)/'
'(?P<appbuildid>[^/]+)/(?P<build_target>[^/]+)/(?P<locale>[^/]+)/'
... | Osmose/snippets-service-prototype | snippets/base/urls.py | Python | bsd-3-clause | 836 | 0.001196 |
def check_vivado(args):
vivado_path = get_command("vivado")
if vivado_path == None:
# Look for the default Vivado install directory
if os.name == 'nt':
base_dir = r"C:\Xilinx\Vivado"
else:
base_dir = "/opt/Xilinx/Vivado"
if os.path.exists(base_dir):
... | litex-hub/lxbe-tool | lxbe_tool/providers/tool/fpga/xilinx/vivado.py | Python | apache-2.0 | 844 | 0.004739 |
#! /usr/bin/env vpython3
# Copyright 2017 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.
# pylint: disable=protected-access
import tempfile
import shutil
import unittest
from pylib.base import output_manager
from pylib.... | ric2b/Vivaldi-browser | chromium/build/android/pylib/output/local_output_manager_test.py | Python | bsd-3-clause | 930 | 0.004301 |
''' Various kinds of layout components.
'''
from __future__ import absolute_import
import logging
logger = logging.getLogger(__name__)
from ..core.enums import SizingMode
from ..core.has_props import abstract
from ..core.properties import Bool, Enum, Int, Instance, List, Seq, String
from ..core.validation import war... | dennisobrien/bokeh | bokeh/models/layouts.py | Python | bsd-3-clause | 6,846 | 0.003944 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import logging
import os
import shutil
from pants.backend.jvm.subsystems.scoverage_platform import ScoveragePlatform
from pants.backend.jvm.tasks.coverage.cobertura import Cobertura
from ... | tdyas/pants | src/python/pants/backend/jvm/tasks/coverage/manager.py | Python | apache-2.0 | 6,621 | 0.002568 |
from importlib import import_module
import math
import os
from PIL import Image, ImageDraw, ImageColor, ImageFont, ImageFilter
from misago.conf import settings
from misago.users.avatars import store
def set_avatar(user):
name_bits = settings.MISAGO_DYNAMIC_AVATAR_DRAWER.split('.')
drawer_module = '.'.join... | 390910131/Misago | misago/users/avatars/dynamic.py | Python | gpl-2.0 | 2,147 | 0.000466 |
from concurrent.futures import ThreadPoolExecutor
class SingletonThreadPoolExecutor(ThreadPoolExecutor):
"""
该类不要直接实例化
"""
def __new__(cls, max_workers=None, thread_name_prefix=None):
if cls is SingletonThreadPoolExecutor:
raise NotImplementedError
if getattr(cls, '_object... | skyoo/jumpserver | apps/common/thread_pools.py | Python | gpl-2.0 | 538 | 0 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2016 Twitter. 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... | lucperkins/heron | heron/shell/src/python/handlers/pmaphandler.py | Python | apache-2.0 | 1,144 | 0.004371 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt2
from numpy import *
from scipy import interpolate
from matplotlib import rcParams, rcParamsDefault
import argparse
from nema_common import *
outputformat = ""
def plot_rates(geometry,float_activity,N_true,... | JPETTomography/j-pet-gate-tools | examples/python_scripts/plot_sf_and_necr.py | Python | apache-2.0 | 7,141 | 0.028567 |
version = 0x105016
tools = [{'tool': 'ar', 'tooldir': None, 'funs': None}, {'tool': 'cc', 'tooldir': None, 'funs': None}, {'tool': 'gcc', 'tooldir': None, 'funs': None}, {'tool': 'compiler_cc', 'tooldir': None, 'funs': None}, {'tool': 'cxx', 'tooldir': None, 'funs': None}, {'tool': 'gxx', 'tooldir': None, 'funs': None}... | thetomcraig/redwood | web/node_modules/hiredis/build/c4che/build.config.py | Python | isc | 434 | 0.002304 |
__author__ = 'Bohdan Mushkevych'
import json
from synergy.db.model.freerun_process_entry import FreerunProcessEntry
from synergy.db.dao.freerun_process_dao import FreerunProcessDao
from synergy.mx.base_request_handler import valid_action_request
from synergy.mx.abstract_action_handler import AbstractActionHandler
fro... | mushkevych/scheduler | synergy/mx/freerun_action_handler.py | Python | bsd-3-clause | 4,312 | 0.001623 |
#Calculen el área de un rectángulo (alineado con los ejes x e y) dadas sus coordenadas x1,x2,y1,y2.
from math import pi
print 'Ejercicio 6'
print '-'*60
x1 = float(raw_input('Introduce x1: '))
x2 = float(raw_input('Introduce x2: '))
y1 = float(raw_input('Introduce y1: '))
y2 = float(raw_input('Introduce y2: '))
base=... | txtbits/daw-python | primeros ejercicios/Ejercicios entradasalida/ejercicio6.py | Python | mit | 445 | 0.008989 |
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn import tree
from subprocess import call
# https://archive.ics.uci.edu/ml/machine-learning-databases/mushroom/agaricus-lepiota.names
#
# TODO: Load up the mushroom dataset into dataframe 'X'
# Verify you did it ... | Wittlich/DAT210x-Python | Module6/assignment5.py | Python | mit | 2,871 | 0.00418 |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.core import management
from django.test import TestCase
from django.utils.six import StringIO
from .models import (
Car, CarDriver, Driver, Group, Membership, Person, UserMembership,
)
class M2MThroughTes... | yephper/django | tests/m2m_through_regress/tests.py | Python | bsd-3-clause | 10,746 | 0.00214 |
from config import configs
from onelove import create_app
config = configs['development']
app = create_app(config)
| one-love/api | devel.py | Python | gpl-3.0 | 116 | 0 |
# -*- coding: utf-8 -*-
import logging
from flask import Flask, redirect, request, jsonify, render_template, session
import requests
import fbvoting.pagebuilders.buildhome
import fbvoting.pagebuilders.buildoverview
import fbvoting.pagebuilders.buildprofile
import fbvoting.pagebuilders.buildfriends
import fbvoting.pag... | corradomonti/fbvoting | fbvoting/__main__.py | Python | mit | 5,860 | 0.008191 |
#
# Copyright (C) 2007, One Laptop Per Child
#
# 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.
#
# Thi... | lucian1900/Webified | messenger.py | Python | gpl-2.0 | 5,665 | 0.005296 |
#
# Copyright 2013/2015 Matthew Nottingham
#
# This file is part of GroundStation
#
# GroundStation 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, or (at your option)
# any later version.
#
... | darkstar007/GroundStation | src/ReceiverEvent.py | Python | gpl-3.0 | 1,854 | 0.002157 |
from discord.ext import commands
from math import floor
from datetime import datetime
from util.arguments import Arguments
from shlex import split
class Vorago:
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=['rago'],
description='Shows the current rotation o... | duke605/RunePy | commands/vorago.py | Python | mit | 3,188 | 0.001882 |
## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more informations
## Copyright (C) Philippe Biondi <phil@secdev.org>
## This program is published under a GPLv2 license
import re
from dadict import DADict
from error import log_loading
############
## Consts ##
############
ETHER_ANY = "\... | isislovecruft/switzerland | switzerland/lib/shrunk_scapy/data.py | Python | gpl-3.0 | 5,617 | 0.016023 |
import numpy as np
import scipy.spatial.distance as dist
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
import matplotlib.lines as mplines
import scipy.cluster.hierarchy as clust
import os
def kabsch(coord, ref,app):
C = np.dot(np.transpose(coord), ref)
V, S, W = np.linalg.svd(C... | jEschweiler/Urease | urease_software/cluster.py | Python | gpl-3.0 | 5,877 | 0.052408 |
# -*- coding: utf-8 -*-
from collections import defaultdict
import subprocess
import os
import bisect
import re
from .common import log_fmt
class GitProcess():
GIT_BIN = None
def __init__(self, repoDir, args, text=None):
startupinfo = None
if os.name == "nt":
startupinfo = sub... | timxx/gitc | qgitc/gitutils.py | Python | apache-2.0 | 14,220 | 0 |
# Copyright 2020 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | google/pigweed | pw_protobuf/py/pw_protobuf/codegen_pwpb.py | Python | apache-2.0 | 25,350 | 0.000118 |
#!/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/adwords/v201502/campaign_management/set_criterion_bid_modifier.py | Python | apache-2.0 | 2,408 | 0.007475 |
# -*- coding: utf-8 -*-
##############################################################################
#
# This program 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 L... | Eficent/odoomrp-wip | mrp_project_link_mto/models/stock_move.py | Python | agpl-3.0 | 1,072 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.