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 |
|---|---|---|---|---|---|---|
import json
from django.db import models
from django.conf import settings
from django.utils.six import with_metaclass, text_type
from django.utils.translation import ugettext_lazy as _
from . import SirTrevorContent
from .forms import SirTrevorFormField
class SirTrevorField(with_metaclass(models.SubfieldBase, models.... | zerc/django-sirtrevor | sirtrevor/fields.py | Python | mit | 974 | 0.00308 |
import sys
from resources.datatables import WeaponType
def setup(core, object):
object.setStfFilename('static_item_n')
object.setStfName('weapon_pistol_trader_roadmap_01_02')
object.setDetailFilename('static_item_d')
object.setDetailName('weapon_pistol_trader_roadmap_01_02')
object.setStringAttribute('class_requi... | ProjectSWGCore/NGECore2 | scripts/object/weapon/ranged/pistol/weapon_pistol_trader_roadmap_01_02.py | Python | lgpl-3.0 | 580 | 0.037931 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
warnings.warn("the ``irsa_dust`` module has been moved to "
"astroquery.ipac.irsa.irsa_dust, "
"please update your imports.", DeprecationWarning, stacklevel=2)
from astroquery.ipac.irsa.irsa_dust import *
| ceb8/astroquery | astroquery/irsa_dust/__init__.py | Python | bsd-3-clause | 317 | 0.003155 |
"""
Unit tests over SQLite backend for Crash Database
"""
from apport.report import Report
import os
from unittest import TestCase
from sqlite import CrashDatabase
class CrashDatabaseTestCase(TestCase):
def setUp(self):
self.crash_base = os.path.sep + 'tmp'
self.crash_base_url = 'file://' + self.... | icandigitbaby/openchange | script/bug-analysis/test_sqlite.py | Python | gpl-3.0 | 9,687 | 0.002684 |
# Copyright (c) 2012 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/LICENSE-2.0
#
# Unless required by applicable... | huaweiswitch/neutron | neutron/tests/unit/linuxbridge/test_lb_neutron_agent.py | Python | apache-2.0 | 48,351 | 0.000041 |
import sys
import logging
import time
import requests
from biokbase.AbstractHandle.Client import AbstractHandle
def getStderrLogger(name, level=logging.INFO):
logger = logging.getLogger(name)
logger.setLevel(level)
# send messages to sys.stderr
streamHandler = logging.StreamHandler(sys.__stderr... | realmarcin/transform | lib/biokbase/Transform/script_utils.py | Python | mit | 3,187 | 0.011923 |
#!/usr/bin/env python
import fileinput
import re
import sys
refs = {}
complete_file = ""
for line in open(sys.argv[1], 'r'):
complete_file += line
for m in re.findall('\[\[(.+)\]\]\n=+ ([^\n]+)', complete_file):
ref, title = m
refs["<<" + ref + ">>"] = "<<" + ref + ", " + title + ">>"
def translate(match):
try... | tgraf/libnl | doc/resolve-asciidoc-refs.py | Python | lgpl-2.1 | 521 | 0.026871 |
'''
import csv
from collections import Counter
counts = Counter()
with open ('zoo.csv') as fin:
cin = csv.reader(fin)
for num, row in enumerate(cin):
if num > 0:
counts[row[0]] += int (row[-1])
for animal, hush in counts.items():
print("%10s %10s" % (animal, hush))
'''
... | serggrom/python-projects | Aplication_B.py | Python | gpl-3.0 | 1,409 | 0.003549 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from holmes.validators.base import Validator
from holmes.utils import _
class ImageAltValidator(Validator):
@classmethod
def get_without_alt_parsed_value(cls, value):
result = []
for src, name in value:
data = '<a href="%s" target="_blank"... | holmes-app/holmes-api | holmes/validators/image_alt.py | Python | mit | 3,935 | 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.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2018_10_01/aio/operations/_network_interface_load_balancers_operations.py | Python | mit | 5,732 | 0.004187 |
# -*- coding: utf-8 -*-
# this default value is just for testing in a fake.
# pylint: disable=dangerous-default-value
"""Fake Module containing helper functions for the SQLite plugin"""
from plasoscaffolder.bll.services import base_sqlite_plugin_helper
from plasoscaffolder.bll.services import base_sqlite_plugin_path_he... | ClaudiaSaxer/PlasoScaffolder | src/tests/fake/fake_sqlite_plugin_helper.py | Python | apache-2.0 | 7,987 | 0.004132 |
#!/usr/bin/env python3
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgp... | nuclear-wizard/moose | python/MooseDocs/test/extensions/test_core.py | Python | lgpl-2.1 | 3,665 | 0.004093 |
"""Fixer that changes raw_input(...) into input(...)."""
# Author: Andre Roberge
# Local imports
from .. import fixer_base
from ..fixer_util import Name
class FixRawInput(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
power< name='raw_input' trailer< '(' [any] ')' > any* >
... | Orav/kbengine | kbe/src/lib/python/Lib/lib2to3/fixes/fix_raw_input.py | Python | lgpl-3.0 | 471 | 0.002123 |
#!/usr/bin/env python3
""" 2018 AOC Day 09 """
import argparse
import typing
import unittest
class Node(object):
''' Class representing node in cyclic linked list '''
def __init__(self, prev: 'Node', next: 'Node', value: int):
''' Create a node with explicit parameters '''
self._prev = prev
... | devonhollowood/adventofcode | 2018/day09.py | Python | mit | 3,328 | 0.0003 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | antgonza/qp-shotgun | qp_shogun/sortmerna/sortmerna.py | Python | bsd-3-clause | 6,980 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2018-2022 F4PGA 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
#
# Unl... | SymbiFlow/fpga-tool-perf | utils/utils.py | Python | isc | 5,117 | 0.000391 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2013 by Erwin Marsi and TST-Centrale
#
# This file is part of the DAESO Framework.
#
# The DAESO Framework is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Softwa... | emsrc/timbl-tools | setup.py | Python | gpl-3.0 | 3,905 | 0.014597 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/__init__.py | Python | mit | 1,314 | 0.001522 |
from extract_feature_lib import *
from sys import argv
from dga_model_eval import *
from __init__ import *
def clear_cache(index, cache):
print "clear cache", index
for tmp in cache:
client[db_name][coll_name_list[index]+"_matrix"].insert(cache[tmp])
def extract_domain_feature(index):
#cursor = ... | whodewho/FluxEnder | src/extract_feature.py | Python | gpl-2.0 | 3,943 | 0.003297 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2011 OpenERP Italian Community (<http://www.openerp-italia.org>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gener... | luca-vercelli/l10n-italy | l10n_it_invoice_report/invoice.py | Python | agpl-3.0 | 1,213 | 0.004122 |
# Copyright (c) 2016 Lee Cannon
# Licensed under the MIT License, see included LICENSE File
import click
import os
import re
from datetime import datetime
def _is_file_modnet(file_name: str) -> bool:
"""Returns True if the filename contains Modnet.
:param file_name: The filename to check.
:type file_nam... | leecannon/trending | trending/command_line.py | Python | mit | 5,764 | 0.002255 |
from testmodule import *
import sys
class TestWrites(TestRunner):
def __init__(self):
super().__init__()
def mthd(self):
import pysharkbite
securityOps = super().getSecurityOperations()
securityOps.create_user("testUser","password")
## validate that we DON'T see the permissions
assert( Fals... | phrocker/sharkbite | test/python/TestSecurityOperations.py | Python | apache-2.0 | 3,290 | 0.061398 |
#!/usr/bin/env python
# encoding: utf-8
def run(whatweb, pluginname):
whatweb.recog_from_header(pluginname, "X-Cache")
| cflq3/getcms | plugins/jiasule_cloudsec.py | Python | mit | 126 | 0.007937 |
# -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @tantrumdev wrote this file. As long as you retain this notice you
# can do whatever you want wit... | felipenaselva/felipe.repository | script.module.placenta/lib/resources/lib/sources/en/to_be_fixed/sitedown/savaze.py | Python | gpl-2.0 | 4,194 | 0.010491 |
#
# Copyright (C) 2013-2014 Emerson Max de Medeiros Silva
#
# This file is part of ippl.
#
# ippl 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 late... | emersonmx/ippl | ippl/test/render.py | Python | gpl-3.0 | 1,381 | 0.003621 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Linter to verify that all flags reported by GHC's --show-options mode
are documented in the user's guide.
"""
import sys
import subprocess
from typing import Set
from pathlib import Path
# A list of known-undocumented flags. This should be considered to be a to-do
# ... | sdiehl/ghc | docs/users_guide/compare-flags.py | Python | bsd-3-clause | 2,799 | 0.002145 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
=========================================================================
Program: Visualization Toolkit
Module: TestNamedColorsIntegration.py
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or ... | hlzz/dotfiles | graphics/VTK-7.0.0/Imaging/Core/Testing/Python/reconstructSurface.py | Python | bsd-3-clause | 3,635 | 0.001926 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-01 11:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('profiles', '0006_add_show_security_question_field'),
]
operations = [
migrat... | praekelt/molo.profiles | molo/profiles/migrations/0007_add_password_recovery_retries.py | Python | bsd-2-clause | 845 | 0.002367 |
from flask import render_template, redirect, url_for, request
from flask.views import MethodView
from nastradini import mongo, utils
from positionform import PositionForm
class Position(MethodView):
methods = ['GET', 'POST']
def get(self):
form = PositionForm()
return render_template('positio... | assemblio/project-nastradin | nastradini/views/forms/position.py | Python | gpl-2.0 | 700 | 0 |
#!/usr/bin/env python
# Copyright 2014 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.
"""Given the output of -t commands from a ninja build for a gyp and GN generated
build, report on differences between the command line... | M4sse/chromium.src | tools/gn/bin/gyp_flag_compare.py | Python | bsd-3-clause | 7,719 | 0.010882 |
from sender import *
if __name__ == '__main__':
connection = Connection().initialize()
connection.send('Default exchange message!')
connection.destroy()
| harunyasar/rabbitmq_playground | default_exchange_sender.py | Python | gpl-3.0 | 166 | 0 |
import base64
import collections
import errno
import gevent
import os
import socket
import sys
import traceback
from azure import WindowsAzureMissingResourceError
from azure.storage import BlobService
from . import calling_format
from hashlib import md5
from urlparse import urlparse
from wal_e import log_help
from wa... | modulexcite/wal-e | wal_e/blobstore/wabs/wabs_util.py | Python | bsd-3-clause | 9,211 | 0 |
from django.urls import path
from . import dashboard_views
app_name = 'exam'
urlpatterns = [
path('assignment/new/', dashboard_views.MakeAssignmentView.as_view(),
name='assignment_new'),
path('assignment/success/',
dashboard_views.MakeAssignmentSuccess.as_view(),
name='assignment_su... | d120/pyophase | exam/dashboard_urls.py | Python | agpl-3.0 | 483 | 0 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/networking/requests/messages/release_pokemon_message.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _... | bellowsj/aiopogo | aiopogo/pogoprotos/networking/requests/messages/release_pokemon_message_pb2.py | Python | mit | 2,798 | 0.007505 |
import os
import sys
import textwrap
from collections import OrderedDict
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from faice.tools.run.__main__ import main as run_main
from faice.tools.run.__main__ import DESCRIPTION as RUN_DESCRIPTION
from faice.tools.vagrant.__main__ import main as vagrant_ma... | curious-containers/faice | faice/__main__.py | Python | gpl-3.0 | 1,622 | 0.003083 |
from django.contrib.gis.db import models
# Create your models here.
class GeoWaterUse(models.Model):
id = models.AutoField(primary_key=True)
geometry = models.PointField()
api = models.CharField(max_length=20, null=False)
well_name = models.CharField(max_length=100, null=True)
frac_date = models.Da... | tcqiuyu/aquam | aquam/apps/geoanalytics/models.py | Python | mit | 1,526 | 0.003277 |
# 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 the... | vitan/openrave | sandbox/debugkinbody.py | Python | lgpl-3.0 | 4,041 | 0.022272 |
# -*- coding: utf-8 -*-
#
# codimension - graphics python two-way code editor and analyzer
# Copyright (C) 2010-2017 Sergey Satskiy <sergey.satskiy@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 Softw... | SergeySatskiy/codimension | codimension/utils/config.py | Python | gpl-3.0 | 1,187 | 0 |
q1_start = 0
q1_end = 1
N_q1 = 128
q2_start = 0
q2_end = 1
N_q2 = 3
p1_start = -4
p1_end = 4
N_p1 = 4
p2_start = -0.5
p2_end = 0.5
N_p2 = 1
p3_start = -0.5
p3_end = 0.5
N_p3 = 1
N_ghost = 3
| ShyamSS-95/Bolt | example_problems/nonrelativistic_boltzmann/beam_test/1D/domain.py | Python | gpl-3.0 | 225 | 0.044444 |
from ..provider.constants import Provider, string_to_provider
from ..services.base import Service
from .context import DisconnectOnException
from .errors import (
AlreadyConnectedException,
ClusterError,
MultipleClustersConnectionError,
NotConnectedError,
PleaseDisconnectError,
)
class ClusterService(Servic... | sigopt/sigopt-python | sigopt/orchestrate/cluster/service.py | Python | mit | 5,588 | 0.0102 |
import numpy as np
from scipy.integrate import odeint
from scipy.integrate import ode
import matplotlib.pylab as plt
import csv
import time
endpoint = 1000000000; # integration range
dx = 10.0; # step size
lam0 = 0.845258; # in unit of omegam, omegam = 3.66619*10^-17
dellam = np.array([0.00003588645221954444, 0.06486... | NeuPhysics/codebase | ipynb/matter/py-server/save-data-on-site.py | Python | mit | 2,819 | 0.023058 |
#!/usr/bin/env python
# Usage parse_shear sequences.fna a2t.txt emb_output.b6
import sys
import csv
from collections import Counter, defaultdict
sequences = sys.argv[1]
accession2taxonomy = sys.argv[2]
alignment = sys.argv[3]
with open(accession2taxonomy) as inf:
next(inf)
csv_inf = csv.reader(inf... | knights-lab/analysis_SHOGUN | scripts/parse_shear.py | Python | mit | 2,010 | 0.000498 |
#!/usr/bin/env python
#coding:utf-8
"""
Author: --<v1ll4n>
Purpose: Provide some useful thread utils
Created: 2016/10/29
"""
import unittest
#import multiprocessing
from pprint import pprint
from time import sleep
try:
from Queue import Full, Empty, Queue
except:
from queue import Full, ... | VillanCh/g3ar | g3ar/threadutils/thread_pool.py | Python | bsd-2-clause | 9,669 | 0.005378 |
import spade
import time
class MyAgent(spade.Agent.Agent):
class ReceiveBehav(spade.Behaviour.Behaviour):
"""This behaviour will receive all kind of messages"""
def _process(self):
self.msg = None
# Blocking receive for 10 seconds
self.msg = self._receive(True... | vportascarta/UQAC-8INF844-SPHERO | agents/ExempleAgentReceveur.py | Python | gpl-3.0 | 789 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-09-20 15:04
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('meinberlin_plans', '0017_rename_cost_field'),
]
operations = ... | liqd/a4-meinberlin | meinberlin/apps/plans/migrations/0018_point_label_required.py | Python | agpl-3.0 | 621 | 0.00161 |
from unittest.mock import Mock
from django.db.models import QuerySet
from datagrowth.resources import HttpResource
from core.tests.mocks.requests import MockRequests
MockErrorQuerySet = Mock(QuerySet)
MockErrorQuerySet.count = Mock(return_value=0)
class HttpResourceMock(HttpResource):
URI_TEMPLATE = "http://... | fako/datascope | src/core/tests/mocks/http.py | Python | gpl-3.0 | 3,044 | 0 |
from pymol.cgo import *
from pymol import cmd
from pymol.vfont import plain
# create the axes object, draw axes with cylinders coloured red, green,
#blue for X, Y and Z
obj = [
CYLINDER, 0., 0., 0., 10., 0., 0., 0.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.,
CYLINDER, 0., 0., 0., 0., 10., 0., 0.2, 1.0, 1.0, 1.0, 0., 1.0, 0.... | weitzner/Dotfiles | pymol_scripts/axes_cyl.py | Python | mit | 853 | 0.078546 |
import multiprocessing
import warnings
import six
from chainer.backends import cuda
from chainer.dataset import convert
from chainer import reporter
from chainer.training.updaters import standard_updater
try:
from cupy.cuda import nccl
_available = True
except ImportError:
_available = False
import num... | aonotas/chainer | chainer/training/updaters/multiprocess_parallel_updater.py | Python | mit | 15,115 | 0 |
#Ret Samys, creator of this program, can be found at RetSamys.deviantArt.com
#Please feel free to change anything or to correct me or to make requests... I'm a really bad coder. =)
#Watch Andrew Huang's video here: https://www.youtube.com/watch?v=4IAZY7JdSHU
changecounter=0
path="for_elise_by_beethoven.mid"
prin... | RetSamys/midiflip | midiflip.py | Python | gpl-3.0 | 5,501 | 0.028722 |
# -*- coding: utf-8 -*-
# Copyright 2014, 2015 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | illicitonion/synapse | synapse/events/validator.py | Python | apache-2.0 | 2,913 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# RawSpeed documentation build configuration file, created by
# sphinx-quickstart on Mon Aug 14 18:30:09 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
# a... | aferrero2707/PhotoFlow | src/external/rawspeed/docs/conf.py | Python | gpl-3.0 | 3,214 | 0 |
"""
Functions for calculating statistics and handling uncertainties.
(c) Oscar Branson : https://github.com/oscarbranson
"""
import numpy as np
import uncertainties.unumpy as un
import scipy.interpolate as interp
from scipy.stats import pearsonr
def nan_pearsonr(x, y):
xy = np.vstack([x, y])
xy = xy[:, ~np.a... | oscarbranson/latools | latools/helpers/stat_fns.py | Python | mit | 7,150 | 0.002238 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2013-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | poiesisconsulting/openerp-restaurant | portal_project_issue/tests/test_access_rights.py | Python | agpl-3.0 | 10,548 | 0.004645 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Proprietary and confidential.
# Copyright 2011 Perfect Search Corporation.
# All rights reserved.
#
import sys
sys.dont_write_bytecode = True
#import clientplugin
import fastbranches
import serverplugin
| perfectsearch/sandman | code/bzr-plugins/__init__.py | Python | mit | 254 | 0.015748 |
#
# 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... | cernops/ceilometer | ceilometer/meter/notifications.py | Python | apache-2.0 | 12,538 | 0 |
# -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... | FireBladeNooT/Medusa_1_6 | lib/github/tests/Issue54.py | Python | gpl-3.0 | 2,437 | 0.010259 |
import notify2
import os
from time import *
start_time = time()
notify2.init('')
r = notify2.Notification('', '')
while True:
for i in [ ('TO DO', 'Write JavaScript'),
('TO DO', 'Write Python'),
('Thought of the Day', 'Support Open Source'),
('Learn. . .', 'Use Linux... | OpenC-IIIT/scriptonia | notif.py | Python | mit | 695 | 0.021583 |
import statsmodels.tsa.stattools as st
import matplotlib.pylab as plt
import numpy as np
import pandas as pd
df = pd.read_csv('gld_uso.csv')
cols = ['GLD','USO']
df['hedgeRatio'] = df['USO'] / df['GLD']
data_mean = pd.rolling_mean(df['hedgeRatio'], window=20)
data_std = pd.rolling_std(df['hedgeRatio'], window=20)
df... | burakbayramli/quant_at | book/Ratio.py | Python | gpl-3.0 | 750 | 0.008 |
#*************************************************************************
#* Dionaea
#* - catches bugs -
#*
#*
#*
# Copyright (c) 2009 Markus Koetter
# Copyright (c) 2001-2007 Twisted Matrix Laboratories.
# Copyright (c) 2001-2009
#
# Allen Short
# Andrew Bennett... | GovCERT-CZ/dionaea | modules/python/scripts/ftp.py | Python | gpl-2.0 | 32,082 | 0.005143 |
import collections
import numpy as np
import sympy
from sym2num import function, var
def reload_all():
"""Reload modules for testing."""
import imp
for m in (var, function):
imp.reload(m)
if __name__ == '__main__':
reload_all()
g = var.UnivariateCallable('g')
h = var.Univariat... | dimasad/sym2num | examples/function_example.py | Python | mit | 896 | 0.007813 |
#!/usr/bin/python
#======================================================================
#
# Project : hpp_IOStressTest
# File : IOST_WRun_CTRL.py
# Date : Oct 25, 2016
# Author : HuuHoang Nguyen
# Contact : hhnguyen@apm.com
# : hoangnh.hpp@gmail.com
# License : MIT License
# Copyright : 2016
# ... | HPPTECH/hpp_IOSTressTest | Refer/IOST_OLD_SRC/IOST_0.17/Libs/IOST_WRun_CTRL.py | Python | mit | 2,555 | 0.009785 |
#!/usr/bin/env jython
from __future__ import with_statement
from contextlib import contextmanager
import logging
from plugins import __all__
log = logging.getLogger('kahuna')
class PluginManager:
""" Manages available plugins """
def __init__(self):
""" Initialize the plugin list """
self.__... | nacx/kahuna | kahuna/pluginmanager.py | Python | mit | 2,347 | 0.000852 |
# -*- coding: utf-8 -*-
# Copyright 2016, 2017 Kevin Reid and the ShinySDR contributors
#
# This file is part of ShinySDR.
#
# ShinySDR 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... | kpreid/shinysdr | shinysdr/units.py | Python | gpl-3.0 | 1,966 | 0.004585 |
# -*- coding: utf-8 -*-
'''
CloudStack Cloud Module
=======================
The CloudStack cloud module is used to control access to a CloudStack based
Public Cloud.
:depends: libcloud >= 0.15
Use of this module requires the ``apikey``, ``secretkey``, ``host`` and
``path`` parameters.
.. code-block:: yaml
my-c... | smallyear/linuxLearn | salt/salt/cloud/clouds/cloudstack.py | Python | apache-2.0 | 16,091 | 0.000559 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- Author: ClarkYAN -*-
from get_connection import *
from get_key import *
import Tkinter
import tkMessageBox
class mainFrame:
def __init__(self):
self.root = Tkinter.Tk()
self.root.title('Secure Protocol Systems')
self.root.geometry('600x3... | ClarkYan/msc-thesis | code/data_owner_1/interface.py | Python | apache-2.0 | 2,180 | 0.002752 |
from os.path import join, dirname
from setuptools import setup
setup(
name = 'xmppgcm',
packages = ['xmppgcm'], # this must be the same as the name above
version = '0.2.3',
description = 'Client Library for Firebase Cloud Messaging using XMPP',
long_description = open(join(dirname(__file__), 'README.txt')).r... | gamikun/xmppgcm | setup.py | Python | apache-2.0 | 574 | 0.04007 |
#!/usr/bin/env python
"""
Service Subpackage
"""
from . import test
from . import detect
from . import device
from . import object
from . import cov
from . import file
| JoelBender/bacpypes | py34/bacpypes/service/__init__.py | Python | mit | 171 | 0 |
#Pizza please
import pyaudiogame
from pyaudiogame import storage
spk = pyaudiogame.speak
MyApp = pyaudiogame.App("Pizza Please")
storage.screen = ["start"]
storage.toppings = ["cheese", "olives", "mushrooms", "Pepperoni", "french fries"]
storage.your_toppings = ["cheese"]
storage.did_run = False
def is_number(number,... | frastlin/PyAudioGame | examples/basic_tutorial/ex6.py | Python | mit | 2,789 | 0.023664 |
from __future__ import unicode_literals
from django.db import models
from modpacks.models.modpack import Modpack
class Server(models.Model):
""" Minecraft Server details for display on the server page """
name = models.CharField(verbose_name='Server Name',
max_length=200)
desc = models.TextFi... | Jonpro03/Minecrunch_Web | src/servers/models.py | Python | mit | 921 | 0.008686 |
#!/usr/bin/python3
# Copyright (c) 2018-2021 Dell Inc. or its subsidiaries.
#
# 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 requ... | dsp-jetpack/JetPack | src/pilot/dell_nfv_edge.py | Python | apache-2.0 | 6,869 | 0.000728 |
from sqlalchemy import *
from test.lib import *
class FoundRowsTest(fixtures.TestBase, AssertsExecutionResults):
"""tests rowcount functionality"""
__requires__ = ('sane_rowcount', )
@classmethod
def setup_class(cls):
global employees_table, metadata
metadata = MetaData(testing.db)
... | ioram7/keystone-federado-pgid2013 | build/sqlalchemy/test/sql/test_rowcount.py | Python | apache-2.0 | 2,260 | 0.00531 |
#!/usr/bin/python
import RPi.GPIO as GPIO
import signal
import time
from on_off import *
class keypad():
def __init__(self, columnCount = 3):
GPIO.setmode(GPIO.BCM)
# CONSTANTS
if columnCount is 3:
self.KEYPAD = [
[1,2,3],
... | gacosta1/CATS | Software/src/keypad.py | Python | gpl-3.0 | 3,522 | 0.012777 |
from __future__ import print_function
from builtins import range
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
import random
import os
def javapredict_dynamic_data():
# Generate random dataset
dataset_params = {}
dataset_params['rows'] = random.sample(list(range(5000,150... | YzPaul3/h2o-3 | h2o-py/tests/testdir_javapredict/pyunit_javapredict_dynamic_data_paramsKmeans.py | Python | apache-2.0 | 2,376 | 0.020202 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
VetEpiGIS-Stat
A QGIS plugin
Spatial functions for vet epidemiology
-------------------
begin : 2016-01-06
git sha : $Format:%H$
... | IZSVenezie/VetEpiGIS-Stat | plugin/globalt.py | Python | gpl-3.0 | 21,379 | 0.005052 |
def mm_loops(X,Y,Z):
m = len(X)
n = len(Y)
for i in xrange(len(X)):
xi = X[i]
for j in xrange(len(Y)):
yj = Y[j]
total = 0
for k in xrange(len(yj)):
total += xi[k] * yj[k]
Z[i][j] = total
return Z
def make_matrix(m,n):
... | rjpower/falcon | benchmarks/old/matmult_int.py | Python | apache-2.0 | 511 | 0.029354 |
from __future__ import with_statement
from collections import defaultdict, namedtuple
from functools import partial
from operator import methodcaller
import os
import re
import sys
import copy
import platform
from pytest import raises, mark
from schema import (Schema, Use, And, Or, Regex, Optional, Const,
... | bcaudell95/schema | test_schema.py | Python | mit | 21,259 | 0.002493 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | iemejia/incubator-beam | sdks/python/apache_beam/runners/interactive/pipeline_fragment.py | Python | apache-2.0 | 9,582 | 0.005844 |
"""This test checks for correct wait4() behavior.
"""
import os
import time
from test.fork_wait import ForkWait
from test.test_support import run_unittest, reap_children, get_attribute
# If either of these do not exist, skip this test.
get_attribute(os, 'fork')
get_attribute(os, 'wait4')
class Wait4Test(ForkWait):
... | teeple/pns_server | work/install/Python-2.7.4/Lib/test/test_wait4.py | Python | gpl-2.0 | 940 | 0.005319 |
from flask import render_template
from app import app, db, models
import json
@app.route('/')
@app.route('/index')
def index():
# obtain today's words
# words = models.Words.query.all()
# words = list((str(word[0]), word[1]) for word in db.session.query(models.Words, db.func.count(models.Words.id).label("t... | matbra/radio_fearit | app/views.py | Python | gpl-3.0 | 670 | 0.008955 |
import galaxyxml.tool.parameters as gxtp
from collections import Counter
from pydoc import locate
class ArgparseGalaxyTranslation(object):
def __gxtp_param_from_type(self, param, flag, label, num_dashes, gxparam_extra_kwargs, default=None):
from argparse import FileType
"""Based on a type, conver... | erasche/argparse2tool | argparse2tool/dropins/argparse/argparse_galaxy_translation.py | Python | apache-2.0 | 10,696 | 0.00215 |
from model import Event
from geo.geomodel import geotypes
def get(handler, response):
lat = handler.request.get('lat')
lon = handler.request.get('lng')
response.events = Event.proximity_fetch(
Event.all(),
geotypes.Point(float(lat),float(lon)),
)
| globalspin/haemapod | haemapod/handlers/events/proximity.py | Python | mit | 264 | 0.018939 |
# Copyright (c) 2015-2016 Cisco Systems, Inc.
#
# 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 the
# rights to use, copy, modify, merge... | rgreinho/molecule | molecule/command/dependency.py | Python | mit | 2,997 | 0 |
import save
import client
def start():
def callback():
client.client.chat('/novice')
found_nations = [ (name, style, id) for name, style, id in client.get_nations() if name == 'Poles' ]
if found_nations:
name, style, id = found_nations[0]
print 'change nation to', na... | eric-stanley/freeciv-android | lib/freeciv/tutorial.py | Python | gpl-2.0 | 497 | 0.008048 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import os
import pytest
from translate.fil... | unho/pootle | tests/models/translationproject.py | Python | gpl-3.0 | 5,854 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pytest
import numpy as np
import torch.nn as nn
import torch as T
from torch.autograd import Variable as var
import torch.nn.functional as F
from torch.nn.utils import clip_grad_norm_
import torch.optim as optim
import numpy as np
import sys
import os
import mat... | ixaxaar/pytorch-dnc | test/test_rnn.py | Python | mit | 4,532 | 0.02714 |
from collections import defaultdict
import fileinput
mem = defaultdict(int)
s1 = -100000
s2 = -100000
def condition(line):
global mem
l = line[-3:]
if l[1] == "==":
if mem[l[0]] == int(l[2]): return True
else: return False
elif l[1] == "<":
if mem[l[0]] < int(l[2]): return Tru... | zigapk/adventofcode | 2017/8/main.py | Python | mit | 1,081 | 0.014801 |
import numpy, sys
import scipy.linalg, scipy.special
'''
VBLinRegARD: Linear basis regression with automatic relevance priors
using Variational Bayes.
For more details on the algorithm see Apprendix of
Roberts, McQuillan, Reece & Aigrain, 2013, MNRAS, 354, 3639.
History:
2011: Translated by Thomas Evans from origina... | saigrain/CBVshrink | src/VBLinRegARD.py | Python | gpl-2.0 | 3,845 | 0.008583 |
import matplotlib, numpy
import CoolProp
Props = CoolProp.CoolProp.Props
from scipy.optimize import newton
def SimpleCycle(Ref,Te,Tc,DTsh,DTsc,eta_a,Ts_Ph='Ph',skipPlot=False,axis=None):
"""
This function plots a simple four-component cycle, on the current axis, or that given by the optional parameter *axis*
... | ibell/coolprop | wrappers/Python/CoolProp/Plots/SimpleCycles.py | Python | mit | 13,341 | 0.069935 |
# -*- coding: utf-8 -*-
import datetime
from django.db import models
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'NodeGroup.maas_url'
db.add_column(u'maasserver_nodegroup', 'maas_url',
... | cloudbase/maas | src/maasserver/migrations/0046_add_nodegroup_maas_url.py | Python | agpl-3.0 | 15,514 | 0.007413 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('freebasics', '0005_remove_selected_template_field'),
]
operations = [
migrations.AlterField(
model_name='freebas... | praekeltfoundation/mc2-freebasics | freebasics/migrations/0006_change_site_url_field_type.py | Python | bsd-2-clause | 477 | 0.002096 |
#!/usr/bin/env python
import os
import sys
sys.path.insert(
0,
os.path.join(
os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', 'common',
'security-features', 'tools'))
import generate
class ReferrerPolicyConfig(object):
def __init__(self):
self.selection_pattern = \
... | notriddle/servo | tests/wpt/web-platform-tests/referrer-policy/generic/tools/generate.py | Python | mpl-2.0 | 1,383 | 0.001446 |
import os.path
import shutil
import zipfile
import click
from pros.config import ConfigNotFoundException
from .depot import Depot
from ..templates import BaseTemplate, Template, ExternalTemplate
from pros.common.utils import logger
class LocalDepot(Depot):
def fetch_template(self, template: BaseTemplate, destin... | purduesigbots/pros-cli | pros/conductor/depots/local_depot.py | Python | mpl-2.0 | 2,366 | 0.003381 |
import numpy as np
def array_generator():
array = np.array([(1, 2, 3, 4, 5), (10, 20, 30, 40, 50)])
return array
def multiply_by_number(array, number):
print(array)
multiplied = array * number
print(multiplied)
return multiplied
def divide_by_number(array, number):
# Either the numer or the elements of the a... | arcyfelix/Courses | 17-06-05-Machine-Learning-For-Trading/25_arithmetic operations.py | Python | apache-2.0 | 1,058 | 0.040643 |
"""
calc.py
>>> import calc
>>> s='2+4+8+7-5+3-1'
>>> calc.calc(s)
18
>>> calc.calc('2*3+4-5*4')
-10
"""
import re
from operator import concat
operator_function_table = { '+' : lambda x, y: x + y,
'-' : lambda x, y: x - y,
'*' : lambda x, y: x ... | clemfeelsgood/hackathontools | code_challenges/mopub/calc.py | Python | mit | 1,320 | 0.012121 |
#!/usr/bin/env python
def main():
import sys
raw_data = load_csv(sys.argv[1])
create_table(raw_data)
def get_stencil_num(k):
# add the stencil operator
if k['Stencil Kernel coefficients'] in 'constant':
if int(k['Stencil Kernel semi-bandwidth'])==4:
stencil = 0
else:
... | tareqmalas/girih | scripts/sisc/paper_bytes_requirement_analysis.py | Python | bsd-3-clause | 6,160 | 0.010714 |
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | AccelAI/accel.ai | flask-aws/lib/python2.7/site-packages/ebcli/operations/scaleops.py | Python | mit | 2,296 | 0.001742 |
#!/usr/bin/python
# Copyright 2014 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Script for generating the Android framework's version of Skia from gyp
files.
"""
import android_framework_gyp
import os
import shutil
import sys
import tempfile
... | llluiop/skia | platform_tools/android/bin/gyp_to_android.py | Python | bsd-3-clause | 6,621 | 0.00589 |
"""
Code : Remove the dependency for Kodak Bank, default excel parser macros and just GNU/Linux to acheive it.
Authors : Ramaseshan, Anandhamoorthy , Engineers, Fractalio Data Pvt Ltd, Magadi, Karnataka.
Licence : GNU GPL v3.
Code Repo URL : https://github.com/ramaseshan/kodak_bank_excel_parser
"""
import pyexcel as ... | AnandMoorthy/kodak_bank_excel_parser | kodak_excel_parser.py | Python | gpl-3.0 | 1,376 | 0.025436 |
from py4j.java_gateway import JavaGateway, GatewayParameters
gateway = JavaGateway(gateway_parameters=GatewayParameters(port=25333))
doc1 = gateway.jvm.gate.Factory.newDocument("initial text")
print(doc1.getContent().toString())
doc2 = gateway.jvm.gate.plugin.python.PythonSlave.loadDocument("docs/doc... | GateNLP/gateplugin-python | examples/pythonSlaveMaster.py | Python | lgpl-3.0 | 469 | 0.002132 |
from django.http import HttpResponse,HttpResponseRedirect
from django.shortcuts import render_to_response
from django import forms
from django.forms import ModelForm
from django.db.models import F
from django.db import connection
from django.utils import simplejson
from django.contrib import messages
from django.contri... | yejia/osl_notebook | scraps/views.py | Python | mit | 5,990 | 0.018364 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.