code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright 2022 The MT3 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | magenta/mt3 | mt3/note_sequences_test.py | Python | apache-2.0 | 19,150 |
#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import re
from lxml import etree
from cssutils.css import CSSRule
from cssse... | sharad/calibre | src/calibre/ebooks/oeb/polish/css.py | Python | gpl-3.0 | 14,234 |
**********Region Growing Code**********
//Step 0: Initialization
i = 0
G = {g|vertices in Graph}
V = [] //Growing tree
for each element g in G: ... | ikangan/NetworkPartition | RG_Pseudocode.py | Python | gpl-3.0 | 2,212 |
"""
There are two types of functions:
1) defined function like exp or sin that has a name and body
(in the sense that function can be evaluated).
e = exp
2) undefined function with a name but no body. Undefined
functions can be defined using a Function class as follows:
f = Function('f')
(the result... | srjoglekar246/sympy | sympy/core/function.py | Python | bsd-3-clause | 72,630 |
# -*- coding: utf-8 -*-
__author__ = 'puras'
from django.conf.urls import patterns, include, url
from django.views.static import serve
from django.conf import settings
from bbs.views import index
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'moobo.... | puras/moobo | moobo/urls.py | Python | mit | 758 |
import logging
import sys
from PIL import Image
from compat import BytesIO
from django.contrib.admin.options import BaseModelAdmin
from django.core.files.base import ContentFile
from django.core.files.uploadedfile import InMemoryUploadedFile
from spacelaunchnow import config
def get_launch_status(status):
switc... | ItsCalebJones/SpaceLaunchNow-Server | api/utils/utilities.py | Python | apache-2.0 | 6,505 |
import json
import requests
class Building():
"""Building Client."""
# Service Setup
config = {
'schema': 'http',
'host': 'localhost',
'port': '9202',
'endpoint': 'api/v1/buildings'
}
@classmethod
def base_url(cls):
"""Form the base url for the service... | Foris/darwined-core-python-clients | darwined_core_python_clients/physical/buildings.py | Python | mit | 2,117 |
#
# 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
# distributed under t... | openstack/heat | heat/tests/openstack/senlin/test_receiver.py | Python | apache-2.0 | 4,412 |
p=['h','e','l','l','o']
q=p
q[0]='y'
p=[0,0]
print p+q | robertstepp/Clara-Oswin-Oswald | test.py | Python | apache-2.0 | 54 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Ticket'
db.create_table('articletrack_ticket', (
... | jamilatta/scielo-manager | scielomanager/articletrack/migrations/0002_auto__add_ticket__add_comment__add_article__del_field_checkin_issue_la.py | Python | bsd-2-clause | 29,739 |
from lxml import etree
class Model:
def __init__(self, fn):
self._modelTree = etree.parse(fn)
class Document:
def __init__(self, model):
self._model = model
self._nextItemNumber = 1
self._items = []
def addItem(self, item):
"""
Add an item to this document... | synbiomine/synbiomine-tools | modules/python/intermyne/model.py | Python | apache-2.0 | 3,151 |
# -*- coding: iso-8859-1 -*-
# mp_laplace.py
# laplace.py with mpmath
# appropriate for high precision
# Talbot suggested that the Bromwich line be deformed into a contour that begins
# and ends in the left half plane, i.e., z \to \infty at both ends.
# Due to the exponential factor the integrand decays rapidly
# o... | ActiveState/code | recipes/Python/576964_Pricing_Asioptions_using_mpmath_automatic/recipe-576964.py | Python | mit | 8,391 |
import os
import unittest
from vsg import vhdlFile
from vsg.tests import utils
sLrmUnit = 'process_statement'
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(os.path.dirname(__file__), sLrmUnit,'classification_test_input.vhd'))
oFile = vhdlFile.vhdlFile(lFile)
class test_token(unittest.TestCase):
d... | jeremiah-c-leary/vhdl-style-guide | vsg/tests/vhdlFile/test_process_statement.py | Python | gpl-3.0 | 709 |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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... | USGSDenverPychron/pychron | pychron/spectrometer/tasks/spectrometer_preferences.py | Python | apache-2.0 | 4,917 |
import os
from .private import (
DEBUG, SECRET_KEY, DB_NAME, DB_HOST, DB_PASS, DB_PORT, DB_USER, SERVER
)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ALLOWED_HOSTS = ['127.0.0.1', 'localhost', SERVER]
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.c... | dstarod/brotherhood | brotherhood/settings.py | Python | gpl-3.0 | 2,527 |
import numpy as np
from .._common import lhs, messages, optimizer, selection_sync
from .._helpers import OptimizeResult, register
__all__ = [
"minimize",
]
def minimize(
fun,
bounds,
x0=None,
args=(),
maxiter=100,
popsize=10,
nrperc=0.5,
seed=None,
xtol=1.0e-8,
ftol=1.0e-... | keurfonluu/StochOPy | stochopy/optimize/na/_na.py | Python | mit | 8,787 |
from csamtools import *
from ctabix import *
import csamtools
import ctabix
import Pileup
import sys
import os
class SamtoolsError( Exception ):
'''exception raised in case of an error incurred in the samtools library.'''
def __init__(self, value):
self.value = value
def __str__(self):
ret... | genome-vendor/chimerascan | chimerascan/pysam/__init__.py | Python | gpl-3.0 | 3,804 |
from dvc.main import main
def test_root(tmp_dir, dvc, capsys):
assert main(["root"]) == 0
assert "." in capsys.readouterr()[0]
def test_root_locked(tmp_dir, dvc, capsys):
# NOTE: check that `dvc root` is not blocked with dvc lock
with dvc.lock:
assert main(["root"]) == 0
assert "." in ca... | dmpetrov/dataversioncontrol | tests/func/test_root.py | Python | apache-2.0 | 341 |
# pylint: disable=C0111,R0903
"""Displays the current song being played in DeaDBeeF and provides
some media control bindings.
Left click toggles pause, scroll up skips the current song, scroll
down returns to the previous song.
Parameters:
* deadbeef.format: Format string (defaults to '{artist} - {title}')
... | tobi-wan-kenobi/bumblebee-status | bumblebee_status/modules/contrib/deadbeef.py | Python | mit | 5,484 |
#
# Copyright (C) 2015 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 is distributed in the hope that it will be... | jsilhan/dnf-plugins-core | plugins/migrate.py | Python | gpl-2.0 | 13,023 |
from concurrent import futures
from itertools import product
import numpy as np
import nifty
import nifty.graph.rag as nrag
def mask_corners(input_, halo):
ndim = input_.ndim
shape = input_.shape
corners = ndim * [[0, 1]]
corners = product(*corners)
for corner in corners:
corner_bb = tu... | DerThorsten/nifty | two_pass_agglomeration.py | Python | mit | 6,832 |
from queue import Queue
import os.path
from coalib.settings.Section import Section
from coalib.results.Result import Result
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
from coalib.testing.LocalBearTestHelper import (
LocalBearTestHelper, verify_local_bear)
from bears.python.BanditBear import Bandit... | refeed/coala-bears | tests/python/BanditBearTest.py | Python | agpl-3.0 | 4,632 |
#!/usr/bin/python
import sys, os, yaml, pickle, subprocess, time
try:
from PyQt4 import QtCore, QtGui
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
except ImportError:
try:
from PySide import QtCore, QtGui
QtCore.QString = str
except ImportError:
raise Impo... | Chuban/moose | gui/utils/GenSyntax.py | Python | lgpl-2.1 | 5,514 |
# TODO:
# - handle UTF-8 inputs correctly
from pylab import *
from collections import Counter,defaultdict
import glob,re,heapq,os
import codecs
def method(cls):
"""Adds the function as a method to the given class."""
import new
def _wrap(f):
cls.__dict__[f.func_name] = new.instancemethod(f,None,cl... | brobertson/ocropus-bgr | ocropy/ocrolib/ngraphs.py | Python | apache-2.0 | 7,345 |
"""
Implementation of the RESTful endpoints for the Course About API.
"""
from rest_framework.throttling import UserRateThrottle
from rest_framework.views import APIView
from course_about import api
from rest_framework import status
from rest_framework.response import Response
from course_about.errors import CourseNot... | olexiim/edx-platform | common/djangoapps/course_about/views.py | Python | agpl-3.0 | 2,124 |
import copy
import json
import github
from groundstation.gref import Tip
from groundstation.protocols.github import _identifier_, AbstractGithubAdaptor
from groundstation.objects.root_object import RootObject
from groundstation.objects.update_object import UpdateObject
from groundstation import logger
log = logger.... | richo/groundstation | groundstation/protocols/github/write_adaptor.py | Python | mit | 3,653 |
import botologist.plugin
class QlredditPlugin(botologist.plugin.Plugin):
"""#qlreddit plugin."""
@botologist.plugin.reply()
def opa_opa(self, msg):
if 'opa opa' in msg.message.lower():
return 'https://www.youtube.com/watch?v=Dqzrofdwi-g'
@botologist.plugin.reply()
def locomotion(self, msg):
if 'locomoti... | x89/botologist | plugins/qlreddit.py | Python | mit | 408 |
from structure import *
from ark import *
| facepalm/kivy-colony-game | structures/__init__.py | Python | gpl-3.0 | 43 |
import sys
class ORFFinder:
"""Find the longest ORF in a given sequence
"seq" is a string, if "start" is not provided any codon can be the start of
and ORF. If muliple ORFs have the longest length the first one encountered
is printed
"""
def __init__(self, seq):
self.seq = seq.upper()
self... | parlar/calls2xls | external/CrossMap/usr/lib64/python2.7/site-packages/cmmodule/orf.py | Python | mit | 2,870 |
# coding: utf-8
# Copyright (C) 2018-Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'CAE - Project Module',
'version': '8.0.1.0.0',
'category': 'CAE',
'summary': 'Manage Coope... | grap/odoo-addons-cis | project_fiscal_company/__openerp__.py | Python | gpl-3.0 | 793 |
#!/usr/bin/env python
# encoding: utf-8
from collections import OrderedDict
import sys, os
import waflib
from waflib import Utils
from waflib.Configure import conf
_board_classes = {}
_board = None
class BoardMeta(type):
def __init__(cls, name, bases, dct):
super(BoardMeta, cls).__init__(name, bases, dc... | ethomas997/ardupilot | Tools/ardupilotwaf/boards.py | Python | gpl-3.0 | 24,527 |
# Copyright (C) 2004, 2005 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND... | liyongyue/dnsspider | dns/rdtypes/ANY/DNSKEY.py | Python | isc | 881 |
from peewee import *
db = SqliteDatabase("tracker.db")
class Coach(Model):
username = CharField()
password = CharField()
f_name = CharField()
class Meta:
database = db # This means this model uses the "coach.db" database
class Athlete(Model):
grade = IntegerField()
f_name = Ch... | Acais/Tracker | models.py | Python | gpl-3.0 | 395 |
#!/usr/bin/python
#
# Copyright 2014 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... | vanant/googleads-dfa-reporting-samples | python/v2.0/get_ads.py | Python | apache-2.0 | 2,080 |
#!/usr/bin/env python
#
# parser.py
# Where the magic happens
#
#
# Zack Marotta (c)
from PIL import Image#, ImageDraw
import numpy as np
import random as rnd
import colorsys
#from collections import OrderedDict
from user import *
from ops import Ops
from fns import Fns
from libpyparsing.pyparsing import * #TODO... | Sir-Fancy/AlgArt | libalgart/parser.py | Python | artistic-2.0 | 13,424 |
'''Module for the contacts pageset'''
from datetime import datetime
from murmeli.pages.base import PageSet, Bean
from murmeli.pagetemplate import PageTemplate
from murmeli import dbutils
from murmeli.fingerprints import FingerprintChecker
from murmeli.contactmgr import ContactManager
from murmeli import cryptoutils
... | activityworkshop/Murmeli | murmeli/pages/contacts.py | Python | gpl-2.0 | 16,404 |
default_app_config = 'waldur_mastermind.google.apps.GoogleConfig'
| opennode/nodeconductor-assembly-waldur | src/waldur_mastermind/google/__init__.py | Python | mit | 66 |
"""
11-19-15
Uses Kivy to present an interactive visualization of the DNA chain structure.
"""
from kivy.app import runTouchApp
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.properties import ListProperty, NumericProperty
from kivy.lang import Builder
from dna_chain import DNANode
fr... | mrhubbs/dna | dna_vis.py | Python | gpl-3.0 | 3,495 |
"""Test for the new detector file"""
import sys
import pathlib
import zipfile
import io
import pytest
import serpentTools
from serpentTools.data import getFile
import serpentTools.next
BWR_FILE = getFile("bwr_det0.m")
HEX_FILE = getFile("hexplot_det0.m")
@pytest.fixture(scope="module")
def previousBWR():
return... | CORE-GATECH-GROUP/serpent-tools | tests/test_next_detector.py | Python | mit | 3,247 |
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
"""
INFO lastFM_user Dez 14 17:35:27 Got new sessionid: '1488f34a1cbed7c9f4232f8fd563c3bd' (coherence/backends/lastfm_storage.py:60)
DEBUG lastFM_stream Dez 14 17:35:53 render <GET /da525474-5357-4d1b-a89... | coherence-project/Coherence | coherence/backends/lastfm_storage.py | Python | mit | 14,194 |
import unittest
from charm.toolbox.symcrypto import SymmetricCryptoAbstraction,AuthenticatedCryptoAbstraction, MessageAuthenticator
from charm.toolbox.pairinggroup import PairingGroup,GT
from charm.core.math.pairing import hashPair as sha1
class SymmetricCryptoAbstractionTest(unittest.TestCase):
def testAESCB... | lferr/charm | charm/test/toolbox/symcrypto_test.py | Python | lgpl-3.0 | 4,362 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright 2016 sadikovi
#
# 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 requir... | sadikovi/queue | src/scheduler.py | Python | apache-2.0 | 35,429 |
# https://www.codewars.com/kata/permutations/train/python
def permutations(text):
import itertools
# Get all permutations, saved as a list
perms = list(itertools.permutations(text))
# Remove duplicates
perms = set(perms)
# Merge elements in each permutation to a string
perm_list = [''.join(p) for p in perms]... | pcampese/codewars | permutations.py | Python | gpl-3.0 | 339 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'maxim'
import copy
import numbers
from six import iteritems
import numpy as np
from .nodes import BaseNode, AcceptsInputNode, JointNode
class ParsedSpec(object):
"""
Responsible for parsing the spec and constructing a tree.
When the spec is parse... | maxim5/hyper-engine | hyperengine/spec/parsed_spec.py | Python | apache-2.0 | 4,009 |
import OSIsoft.AF as AF
CURRENT_SERVER = None
# change from pi period to pandas frequency
FREQUENCY = {'1s': 'S', '1h': 'H', '1d': 'D'}
| raphaeltimbo/PI | PI/config.py | Python | apache-2.0 | 139 |
#!/usr/bin/python
# cutIT.py
# Example cat seqs.fastq | cutIT.py
# By Simon H. Rasmussen
# Bioinformatics Centre
# University of Copenhagen
from types import *
def clearFile(fn):
import os
import sys
cwd = os.getcwd()
if fn != "":
file1 = open(cwd + "/" + fn,'r')
sin =... | simras/CLAP | scripts/cutIT.py | Python | mit | 4,899 |
import pytest
import cv2
from plantcv.plantcv.morphology import segment_combine
def test_segment_combine(morphology_test_data):
"""Test for PlantCV."""
skel = cv2.imread(morphology_test_data.skel_img, -1)
edges = morphology_test_data.load_segments(morphology_test_data.segments_file, "edges")
# Test wi... | danforthcenter/plantcv | tests/plantcv/morphology/test_segment_combine.py | Python | mit | 1,237 |
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2015, ARM Limited and contributors.
#
# 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
#
# ... | JaviMerino/lisa | libs/utils/analysis_register.py | Python | apache-2.0 | 2,476 |
"""Allows setting the time a Status object was last updated.
Revision ID: 58441c58e37e
Revises: 2db48f0c89c7
Create Date: 2014-03-09 15:17:01.996769
"""
# revision identifiers, used by Alembic.
revision = '58441c58e37e'
down_revision = '2db48f0c89c7'
from alembic import op
import sqlalchemy as sa
def upgrade():
... | lae/simplemona | migrations/versions/58441c58e37e_.py | Python | mit | 646 |
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-batch/azure/batch/models/task_scheduling_policy.py | Python | mit | 1,137 |
# Copyright 2008-2010 WebDriver committers
# Copyright 2008-2010 Google 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
#
# Un... | leighpauls/k2cro4 | third_party/webdriver/pylib/selenium/__init__.py | Python | bsd-3-clause | 698 |
"""
WSGI config for baldys_testbed 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_APPLICA... | jmuharsky/baldys-secret-underground-lair | baldys_testbed/wsgi.py | Python | mit | 1,443 |
from django.utils.translation import ugettext_lazy as _
from django.http import HttpResponse
from django.template import loader
from cyclope.core import frontend
from cyclope.apps.newsletter.models import Newsletter
from cyclope.core.collections.models import Category, Categorization
class NewsletterContentTeasers(fr... | CodigoSur/cyclope | cyclope/apps/newsletter/frontend_views.py | Python | gpl-3.0 | 2,122 |
'''
Author: Rajmani Arya
TicTacToe Game System vs. Player
using Min Max Algorithm
Graphical User Interface Implemented in Python Tk
'''
from Tkinter import Tk, Label, Frame, Canvas, Button, ALL
def min_max_move(instance, marker):
bestmove = None
bestscore = None
if marker == 2:
... | rajmani1995/TicTacToe-Automated | AutoTicTacToe.py | Python | mit | 5,548 |
# -*- coding: utf-8 -*-
from shellstreaming import api
from shellstreaming.istream import RandInt
from shellstreaming.operator import CountWindow, Sort
from shellstreaming.ostream import LocalFile
OUTPUT_FILE = '/tmp/04_Sort.txt'
NUM_RECORDS = 10000
def main():
randint_stream = api.IStream(RandInt, 0, 100, max_... | laysakura/shellstreaming | example/04_Sort.py | Python | apache-2.0 | 1,067 |
#!/usr/bin/python2
'''
genPOI.py
Scans regionsets for TileEntities and Entities, filters them, and writes out
POI/marker info.
A markerSet is list of POIs to display on a tileset. It has a display name,
and a group name.
markersDB.js holds a list of POIs in each group
markers.js holds a list of which markerSets ar... | eminence/Minecraft-Overviewer | overviewer_core/aux_files/genPOI.py | Python | gpl-3.0 | 10,189 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, fields, api, SUPERUSER... | ingadhoc/odoo-etl | etl/action.py | Python | agpl-3.0 | 31,818 |
# Copyright 2015 Mirantis, 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 by a... | VTabolin/networking-vsphere | networking_vsphere/agent/firewalls/dvs_securitygroup_rpc.py | Python | apache-2.0 | 2,782 |
# Copyright (C) 2013 Kai Willadsen <kai.willadsen@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or (at
# your option) any later version.
#
# This ... | Spitfire1900/meld | meld/settings.py | Python | gpl-2.0 | 4,587 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2017-01-28 14:45
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import shopifier.admin.models
class Migration(migrations.Migration):
dependencies = [
('shopifier_admin', '0016_auto_2... | vkuryachenko/Django-Shopy | shopifier/admin/migrations/0017_auto_20170128_2045.py | Python | bsd-3-clause | 1,063 |
IMAGES = [{
'accountId': 1234,
'blockDevices': [],
'createDate': '2013-12-05T21:53:03-06:00',
'globalIdentifier': '0B5DEAF4-643D-46CA-A695-CECBE8832C9D',
'id': 100,
'name': 'test_image',
'parentId': '',
'publicFlag': True,
}, {
'accountId': 1234,
'blockDevices': [],
'createDa... | skraghu/softlayer-python | SoftLayer/fixtures/SoftLayer_Virtual_Guest_Block_Device_Template_Group.py | Python | mit | 820 |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 1 14:27:42 2016
@author: xunil
"""
import Simulation as s
s.sim_normal([1000]) | xunilrj/sandbox | courses/course-edx-dat2031x/main.py | Python | apache-2.0 | 128 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/libev/package.py | Python | lgpl-2.1 | 1,956 |
#!/usr/bin/env python
import unittest
import sys
import os
import socket
sys.path.append("..")
import test_helpers
from hook_script_test_case import hook_script_test_case
class test_script_ping_url(hook_script_test_case):
def test_notification(self):
test_helpers.deployHookKit('test_script_ping_url_con... | jesper/hookkit | tests/test_script_ping_url.py | Python | gpl-2.0 | 1,312 |
#!/usr/bin/env python
import numpy as np
import os
import pyhdf.SD
import tempfile
from nose.tools import eq_
from pyhdf.SD import SDC
def test_long_varname():
sds_name = 'a'*255
_, path = tempfile.mkstemp(suffix='.hdf', prefix='pyhdf_')
try:
# create a file with a long variable name
sd =... | ryfeus/lambda-packs | HDF4_H5_NETCDF/source2.7/pyhdf/test_SD.py | Python | mit | 752 |
# -*- coding: utf-8 -*-
"""Read data from 'Harvard Library Open Metadata'.
Records: ~12 Million
Size: 12.8 GigaByte (Unpacked)
Info: http://library.harvard.edu/open-metadata
Data: https://s3.amazonaws.com/hlom/harvard.tar.gz
Instructions:
Download datafile and run `tar xvf harvard.tar.gz` to extract marc21 files.... | coblo/isccbench | iscc_bench/readers/harvard.py | Python | bsd-2-clause | 2,886 |
#!/usr/bin/python
# Copyright (c) 2014-2017 Ansible Project
# Copyright (c) 2017, 2018 Will Thames
# Copyright (c) 2017, 2018 Michael De La Rue
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'co... | thaim/ansible | lib/ansible/modules/cloud/amazon/rds_snapshot_info.py | Python | mit | 12,675 |
"""
Django forms for accounts
"""
from django import forms
from django.core.exceptions import ValidationError
class RetirementQueueDeletionForm(forms.Form):
"""
Admin form to facilitate learner retirement cancellation
"""
cancel_retirement = forms.BooleanField(required=True)
def save(self, retir... | ahmedaljazzar/edx-platform | openedx/core/djangoapps/user_api/accounts/forms.py | Python | agpl-3.0 | 1,596 |
import sys
import argparse
from builder.args import addLoggingParams, addEarlyStop, addSupDataParams
from builder.profiler import setupLogging
import numpy as np
'''This is a simple batch generator for lenet5Trainer.py. All tweak-able values
in lenet5Trainer have min, max and step here. This generates a dense matr... | mbojrab/playbox | trunk/projects/supervised/genBatchRun.py | Python | mit | 3,724 |
#
# ParamSet.py -- Groups of widgets holding parameters
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
from ginga.misc import Widgets, Callback, Bunch
class ParamSe... | bsipocz/ginga | ginga/misc/ParamSet.py | Python | bsd-3-clause | 2,493 |
from sos.plugins import DebianPlugin
from sos.policies import PackageManager, LinuxPolicy
import os
class DebianPolicy(LinuxPolicy):
distro = "Debian"
vendor = "the Debian project"
vendor_url = "http://www.debian.org/"
report_name = ""
ticket_number = ""
package_manager = PackageManager(
... | alexandrujuncu/sos | sos/policies/debian.py | Python | gpl-2.0 | 1,429 |
"""
Object model and helper classes used in the generation of classes from
an OME XML (http://www.ome-xml.org) XSD document.
"""
#
# Copyright (C) 2009 - 2016 Open Microscopy Environment. All rights reserved.
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU ... | imunro/bioformats | components/xsd-fu/python/ome/modeltools/model.py | Python | gpl-2.0 | 13,488 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Functions for working with the Inventory service
"""
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import os
import re
from marshmallow import Schema, fields
import requests
import dgpars... | DeskGen/dgcli | dgcli/inventory.py | Python | gpl-2.0 | 2,921 |
# Elpy, the Emacs Lisp Python Environment
# Copyright (C) 2013 Jorgen Schaefer
# Author: Jorgen Schaefer <contact@jorgenschaefer.de>
# URL: http://github.com/jorgenschaefer/elpy
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as publishe... | ProfessorX/Emacs-Laptop | elpa/elpy-20140810.7/elpy/__init__.py | Python | gpl-2.0 | 1,388 |
try:
from future_builtins import filter
except ImportError:
pass
from copy import deepcopy
###{standalone
from collections import OrderedDict
class Meta:
def __init__(self):
self.empty = True
class Tree(object):
"""The main tree class.
Creates a new tree, and stores "data" and "child... | erezsh/lark | lark/tree.py | Python | mit | 6,212 |
import os, glob, sys, argparse
import intf_tools as it
#converts from digitizer units to V/m
Epd = -30./2**15
#threhold for identifying flashes
Thresh = 1 #V/m
#slack on either side to process
Slack = 50 #ms
parser = argparse.ArgumentParser(description="Plot processed DITF data")
parser.add_argument('--version',... | mikestock/intf-tools | intf_find_flashes.py | Python | gpl-2.0 | 997 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2010 OpenStack Foundation
#
# 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/LICE... | TieWei/nova | nova/tests/virt/test_virt_drivers.py | Python | apache-2.0 | 27,963 |
import datetime
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
MIN_PHOTO_DIMENSION = 5
MAX_PHOTO_DI... | rawwell/django | django/contrib/comments/models.py | Python | bsd-3-clause | 12,879 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... | h4wkmoon/shinken | shinken/objects/realm.py | Python | agpl-3.0 | 13,987 |
import math
from typing import List, Optional, Callable
import numpy as np
import stp.play as play
import stp.role as role
import stp.role.constraint as constraint
import stp.role.cost as cost
import stp.skill as skill
import stp.tactic as tactic
import stp.testing as testing
from stp import action as action
from stp.... | RoboJackets/robocup-software | rj_gameplay/tests/stp/role/test_naive_assignment.py | Python | apache-2.0 | 24,116 |
#!/usr/bin/env python3
import json
import os
import unittest
from npoapi import Pages
from npoapi.data.api import PagesForm, PagesSearchType, TextMatcherListType, TextMatcherType
ENV = "acc"
CONFIG_DIR=os.path.dirname(os.path.dirname(__file__))
DEBUG=False
class PagesTest(unittest.TestCase):
def test_search(sel... | npo-poms/pyapi | tests/integration/npoapi_pages_test.py | Python | gpl-3.0 | 864 |
# coding=utf-8
'''
###########################################
思路:
第一步:实现数据报欺骗:我需要不断的向公网广播自己的arp应答包,把应答包中的目的地址的Mac发过去
arp_attack.py 使用一个进程去完成 可以开一个进程去做
第二步:实现对欺骗过来的数据报文的处理:对于所有流入网卡的数据包,
检查源地址和目的地址,不匹配ip则进行发送
#############################################
'''
import socket
import multi_process_test
from... | Great-Li-Xin/PythonDev | ViolentPython/FKTCT/macOS&&LinuxPlatform/start.py | Python | mit | 926 |
#!/usr/bin/env python3
import os
import sys
import argparse
import ctypes
import pandas
# These are hardcoded from fsti_type in fsti-defs.h
LONG = 8
DBL = 13
STR = 15
# These are defined in fsti-pythoncalls.c
NEW = 0
REPLACE = 1
NEW_REPLACE = 2
class Value(ctypes.Union):
_fields_ = [
("longint", ctypes... | nathangeffen/faststi | scripts/faststi.py | Python | gpl-3.0 | 6,539 |
# Microsoft Azure Linux Agent
#
# Copyright 2014 Microsoft 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 b... | nathanleclaire/WALinuxAgent | azurelinuxagent/utils/textutil.py | Python | apache-2.0 | 6,454 |
# -*- coding: utf-8 -*-
import os
import threading
import types
import time # used to eval time.strftime expressions
from datetime import datetime, timedelta
import logging
from copy import deepcopy
import openerp.pooler as pooler
import openerp.sql_db as sql_db
import misc
from config import config
import yaml_tag
im... | camptocamp/ngo-addons-backport | openerp/tools/yaml_import.py | Python | agpl-3.0 | 42,846 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
from . import data_utils, FairseqDataset
def collate(samples, pad_idx, eos_idx):
if len(samples) == 0:
... | hfp/libxsmm | samples/deeplearning/sparse_training/fairseq/fairseq/data/monolingual_dataset.py | Python | bsd-3-clause | 7,469 |
#! /usr/bin/env python
import os
import sys
def run_tests():
import django
from django.conf import settings
settings.configure(
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
},
},
)
sys.path.append(os.path.abspath(__file_... | MattBlack85/django-query-logger | runtests.py | Python | mit | 644 |
import pygame
from pygame.locals import * # pour les constantes touches...
from constantes import *
from fichiers import *
from general import *
from aide import *
def edit(screen, levelNumber ,mode, lang, langu, levelFinal):
motionX = 0
motionY = 0
alsoMario = 0
carte = [[int for lgn in range(NB_BLO... | litzler/marioSokoBan | edit.py | Python | gpl-3.0 | 8,847 |
# -*- coding: utf-8 -*-
def test(list1, list2):
"""
Returns True if list1 is a permutation of list2
"""
result = (len(list1) == len(list2))
if result is True:
for item in list1:
if not item in list2:
result = False
break
return resu... | collective/ECSpooler | backends/python/permTest.py | Python | gpl-2.0 | 322 |
# Copyright 2018-2019 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 in... | nirs/vdsm | tests/network/integration/dns_test.py | Python | gpl-2.0 | 1,198 |
#!/usr/bin/env python
"""
Simple plots for the recurrence model
"""
import numpy as np
import matplotlib.pyplot as plt
from openquake.hmtk.plotting.seismicity.catalogue_plots import \
(get_completeness_adjusted_table, _save_image)
from openquake.hmtk.seismicity.occurrence.utils import get_completeness_counts
... | gem/oq-hazardlib | openquake/hmtk/plotting/seismicity/occurrence/recurrence_plot.py | Python | agpl-3.0 | 4,871 |
from unittest import TestCase
from wtforms.fields import TextField
from wtforms.ext.csrf import SecureForm
from wtforms.ext.csrf.session import SessionSecureForm
import hashlib
import hmac
class DummyPostData(dict):
def getlist(self, key):
v = self[key]
if not isinstance(v, (list, tuple)):
... | mfa/wtforms-clone | tests/ext_csrf.py | Python | bsd-3-clause | 3,530 |
"""Make a mapping from body part words to categories.
Make mapping <body part word> -> [historic words] based on Inger Leemans'
clustering.
Usage: python make_body_part_mapping.py
Requires files body_part_clusters_renaissance.csv,
body_part_clusters_classisism.csv, and body_part_clusters_enlightenment.csv to
be in t... | NLeSC/embodied-emotions-scripts | embem/bodyparts/make_body_part_mapping.py | Python | apache-2.0 | 2,023 |
#!/usr/bin/env python
################################################################################
#
# make_aims.py
#
# Creates a standard control.in template file using a specified geometry.in
# and species directory.
#
################################################################################
#
# Copyright... | kaneod/physics | python/make_aims.py | Python | gpl-3.0 | 2,885 |
# hgversion.py - Version information for Mercurial
#
# Copyright 2009 Steve Borho <steve@borho.org>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2, incorporated herein by reference.
import re
try:
# post 1.1.2
from mercurial import util
h... | seewindcn/tortoisehg | src/tortoisehg/util/hgversion.py | Python | gpl-2.0 | 1,003 |
"""SCons.Platform.win32
Platform-specific initialization for Win32 systems.
There normally shouldn't be any need to import this module directly. It
will usually be imported through the generic SCons.Platform.Platform()
selection method.
"""
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby... | xiaohaidao007/pandoraBox-SDK-mt7620 | staging_dir/host/lib/scons-2.5.0/SCons/Platform/win32.py | Python | gpl-2.0 | 14,950 |
# Copyright 2010-2017, The University of Melbourne
# Copyright 2010-2017, Brian May
#
# This file is part of Karaage.
#
# Karaage 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... | brianmay/karaage | karaage/plugins/kgapplications/templatetags/applications.py | Python | gpl-3.0 | 3,713 |
from functools import wraps
from django.core.exceptions import PermissionDenied
from django.views.decorators.csrf import csrf_exempt
from canvas import util, knobs, browse
from canvas.api_decorators import json_service
from canvas.exceptions import ServiceError
from canvas.metrics import Metrics
from canvas.redis_mod... | canvasnetworks/canvas | website/apps/public_api/util.py | Python | bsd-3-clause | 1,688 |
# Copyright (C) 2003 by Martin Pool <mbp@samba.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 Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is... | sathieu/samba | python/samba/tests/unicodenames.py | Python | gpl-3.0 | 1,100 |
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | VisTrails/VisTrails | vistrails/db/versions/v1_0_3/persistence/__init__.py | Python | bsd-3-clause | 21,040 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.