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 |
|---|---|---|---|---|---|
import re, iso8601, traceback, logging
import xml.sax
from xml.sax.handler import ContentHandler, ErrorHandler
from shrub.file import S3File
from shrub.response.sax.object import ObjectParser
class Parser(ContentHandler):
pass
class BucketParser(Parser):
"""
SAX parser for ListBucketResult response.
<ListBu... | gabriel/shrub | shrub/response/sax/bucket.py | Python | mit | 3,872 |
from __future__ import print_function
from keras.models import Sequential, load_model
from keras.layers import Dense, Activation
from keras.layers import LSTM
from keras.optimizers import RMSprop
from keras.utils.data_utils import get_file
import numpy as np
import random
import sys
import string
import luigi
class ... | Alexander-Minyushkin/aistreamer | worker/lstm.py | Python | apache-2.0 | 6,356 |
#!/usr/bin/env python
# Lucas Walter
# July 2014
# GPLv3
import ast
import sys
import string
import rospy
from ast import literal_eval
# TBD have to import all message types with single data fields?
from std_msgs.msg import *
#from std_msgs.msg import Float32
class TopicOp:
def __init__(self, params, expr, top... | lucasw/topic_op_ros | scripts/topic_op.py | Python | gpl-3.0 | 3,390 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
... | buzzsurfr/f5-ansible | library/bigip_gtm_wide_ip.py | Python | apache-2.0 | 5,176 |
#!/bin/python
'''
Author: Matt Strader Date: March 6,2013
This program takes previously created photon lists (customized crab aperture lists with empty columns for timing information) and feeds them through tempo2 to fill the jd,bjd,pulseNumber,totalPhase, and phase columns. It then creates an index in the PLs... | bmazin/ARCONS-pipeline | examples/Pal2012-crab/timeCrabLists.py | Python | gpl-2.0 | 8,892 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Copyright (c) 2013-present SMHI, Swedish Meteorological and Hydrological Institute
# License: MIT License (see LICENSE.txt or http://opensource.org/licenses/mit).
import sharkdata_core
@sharkdata_core.singleton
class Datasets(object):
""" Singleton object used to ... | sharkdata/sharkdata | sharkdata_core/datasets/datasets.py | Python | mit | 973 |
""" Normalize :class:`~pySPACE.resources.data_types.feature_vector.FeatureVector`
"""
import os
import cPickle
import scipy.stats
import numpy
from collections import defaultdict
from pySPACE.missions.nodes.base_node import BaseNode
from pySPACE.resources.data_types.feature_vector import FeatureVector
from pySPACE.... | MMKrell/pyspace | pySPACE/missions/nodes/postprocessing/feature_normalization.py | Python | gpl-3.0 | 16,837 |
import configurator
p = configurator.start_it_up(getBundlePath(), "collider_cylinder.blend")
try:
wait("3dview_collider_cylinder.png", 5)
click("locator_centered_op.png"); find("3dview_collider_cylinder_centered.png")
click("collider_cylinder_diameter.png"); type("1" + Key.ENTER); find("3dview_collider_cyli... | SCSSoftware/BlenderTools | test/sikuli/tests/unit/locators/collider/05_modify_cylinder.sikuli/05_modify_cylinder.py | Python | gpl-2.0 | 668 |
input = """
edb(0). edb(1).
a(X) | na(X) :- edb(X).
%:- a(X). [X:X]
"""
output = """
edb(0). edb(1).
a(X) | na(X) :- edb(X).
%:- a(X). [X:X]
"""
| veltri/DLV2 | tests/parser/bug.75.test.py | Python | apache-2.0 | 155 |
from common_fixtures import * # NOQA
def test_link_instance_stop_start(super_client, client, context):
target1 = context.create_container(ports=['180', '122/udp'])
target2 = context.create_container(ports=['280', '222/udp'])
c = context.create_container(instanceLinks={
'target1_link': target1.id... | Cerfoglg/cattle | tests/integration/cattletest/core/test_link.py | Python | apache-2.0 | 4,582 |
# -*- coding: utf-8 -*-
# (c) 2019 Acysos S.L.
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
import logging
from odoo import api, models
from requests import Session
_logger = logging.getLogger(__name__)
try:
from zeep import Client
from zeep.transports import Transport
from zeep.plugin... | factorlibre/l10n-spain | l10n_es_aeat_soap/models/aeat_soap.py | Python | agpl-3.0 | 1,693 |
# Copyright 2010 by Dana Larose
# This file is part of crashRun.
# crashRun 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.
... | DanaL/crashRun | src/ca_cave.py | Python | gpl-3.0 | 7,973 |
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np
from datos import data
d=data('mtcars')
win = pg.GraphicsWindow()
win.resize(800,500)
win.setWindowTitle('Bubble Chart')
plt= win.addPlot(title="Scatterplots by Milles per Gallon and Car Weigh")
plt.plot(d.wt,d.mpg, pen=None, symbol='o',... | cimat/data-visualization-patterns | display-patterns/correlations/Pruebas/A12Bubble_Chart_Pyqtgraph.py | Python | cc0-1.0 | 663 |
#!/usr/bin/env python3
from gi.repository import Gtk
class Menu(Gtk.MenuBar):
def __init__(self):
Gtk.MenuBar.__init__(self)
menuitem = Gtk.MenuItem(label='_File')
menuitem.set_use_underline(True)
self.add(menuitem)
menu = Gtk.Menu()
menuitem.set_submenu(menu)
... | steeleyuk/alaska | menu.py | Python | gpl-3.0 | 1,037 |
def format_change_kind(kind):
return {
('new'): '已上架',
('notice'): '可预定',
}[kind]
| Answeror/torabot | torabot/mods/tora/views/ut.py | Python | mit | 118 |
# 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.
"""URL endpoint to add new histograms to the datastore."""
import json
import sys
# TODO(eakuefner): Move these helpers so we don't have to import add_poin... | benschmaus/catapult | dashboard/dashboard/add_histograms_queue.py | Python | bsd-3-clause | 7,684 |
# -*- coding: utf-8 -*-
from django import template
from django.utils.safestring import mark_safe
from appliances.models import Appliance
register = template.Library()
@register.filter(is_safe=True)
def progress(value):
if isinstance(value, float):
p = int(value * 100.0)
else:
p = value
r... | kzvyahin/cfme_tests | sprout/appliances/templatetags/appliances_extras.py | Python | gpl-2.0 | 1,207 |
# flake8: noqa
from .version import __version__
default_app_config = 'lazysignup.apps.LazySignupConfig'
| danfairs/django-lazysignup | lazysignup/__init__.py | Python | bsd-3-clause | 105 |
"""office URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | individual-it/office-traffic-light | office/urls.py | Python | gpl-3.0 | 1,130 |
import asyncio
import json
import logging
import os
from typing import Optional
import pkgpanda
import ssh.utils
from dcos_installer.constants import BOOTSTRAP_DIR, CHECK_RUNNER_CMD, CLUSTER_PACKAGES_PATH, SERVE_DIR, SSH_KEY_PATH
from ssh.runner import Node
REMOTE_TEMP_DIR = '/opt/dcos_install_tmp'
log = logging.ge... | BenWhitehead/dcos | dcos_installer/action_lib.py | Python | apache-2.0 | 16,375 |
#!/usr/bin/env python
import sys
if (len(sys.argv) != 3):
print "usage: TopHitOnly.py in.sam out.sam"
sys.exit(1)
inName = sys.argv[1]
outName = sys.argv[2]
inFile = open(inName, 'r')
outFile =open(outName, 'w')
prevAlign = ""
for line in inFile:
if (len(line) > 0):
if (line[0] == '@'):
... | yunlongliukm/chm1_scripts | TopHitOnly.py | Python | mit | 520 |
# ----------------------------------------------------------------------
# Copyright (C) 2014-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/... | MauricioRoman/NAB | nab/labeler.py | Python | agpl-3.0 | 15,012 |
import sys
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
def getDate(x):
month, year = x.split(' ')
return [months.index(month), int(year)]
lines = open(sys.argv[1], 'r')
for line in lines:
line = line.replace('\n', '').replace('\r', '')
if l... | AstrorEnales/CodeEval | Easy/Working Experience/main.py | Python | mit | 869 |
from pylm.servers import Master
server = Master(name='server',
pull_address='tcp://127.0.0.1:5555',
pub_address='tcp://127.0.0.1:5556',
worker_pull_address='tcp://127.0.0.1:5557',
worker_push_address='tcp://127.0.0.1:5558',
db_address='tcp... | nfqsolutions/pylm | examples/cache/master.py | Python | agpl-3.0 | 387 |
import os
import textwrap
import pytest
from pip._internal.status_codes import ERROR
from tests.lib.path import Path
def fake_wheel(data, wheel_path):
data.packages.join(
'simple.dist-0.1-py2.py3-none-any.whl'
).copy(data.packages.join(wheel_path))
@pytest.mark.network
def test_download_if_request... | zvezdan/pip | tests/functional/test_download.py | Python | mit | 17,722 |
#!/usr/bin/python
#
# Copyright 2011 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 by... | google/ashier | ashierlib/test/utils_test.py | Python | apache-2.0 | 2,733 |
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_alm... | chrsrds/scikit-learn | sklearn/covariance/tests/test_covariance.py | Python | bsd-3-clause | 12,136 |
# -*- coding: utf-8 -*-
from django.conf.urls import url
app_path = 'appls.points.views.'
urlpatterns = [
# place
url(r'^add/$', app_path+'place.add_place', name='add'),
url(r'^remove/$',
app_path+'place.remove_place', name='remove'),
url(r'^place-list/$',
app_path+'place.pla... | pasha369/Points | points/appls/points/urls.py | Python | mit | 2,296 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para pelismagnet
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
# ------------------------------------------------------------
import re
from core import jsontools
from core import log... | ChopChopKodi/pelisalacarta | python/main-classic/channels/pelismagnet.py | Python | gpl-3.0 | 9,400 |
#!/usr/bin/env python
from fauxmo.fauxmo import poller,upnp_broadcast_responder,fauxmo
import os
import time
# Name of computer playin music. This should be the host name
# in the .ssh config file. Also there should be an identity file
# set up so that ssh can send command without a password.
HOST_NAME = 'quinn'
#... | markveillette/smarthome | pianobar.py | Python | mit | 1,108 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2009-2020 Andrew Kershaw
# This file is part of sitecheck.
# Sitecheck 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 Licen... | arkershaw/sitecheck | domaincheck.py | Python | gpl-3.0 | 13,805 |
from cms import sitemaps
from cms.apps.pages.models import ContentBase
from cms.models import HtmlField, PageBase
from django.db import models
from historylinks import shortcuts as historylinks
class Faqs(ContentBase):
classifier = 'apps'
urlconf = '{{ project_name }}.apps.faqs.urls'
per_page = models.P... | onespacemedia/cms-faqs | apps/faqs/models.py | Python | mit | 1,520 |
from marshmallow import fields
from ._resource_io import ResourceSchema
class ImmutableTypeResourceSchema(ResourceSchema):
label = fields.String()
doc = fields.String()
| artPlusPlus/elemental-backend | elemental_backend/serialization/_immutable_type_resource_io.py | Python | mpl-2.0 | 180 |
# Copyright 2015 NEC Corporation. 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... | mikalstill/nova | nova/api/openstack/compute/schemas/tenant_networks.py | Python | apache-2.0 | 1,613 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
# author: bambooom
'''
MyDiary Web Application
Open web browser and access http://localhost:8255/mydiary
You can read the old diary and input new diary
'''
from bottle import request, route, run, template
from time import localtime, strftime
def read_diary():
f = open('d... | bambooom/OMOOC2py | _src/om2py4w/4wex0/main.py | Python | mit | 899 |
from __future__ import absolute_import
import re
import os.path
import sourcemap
from six.moves import map
class SourceMap(object):
'''Map (line, column) pairs from generated to source file.'''
def __init__(self, sourcemap_dir):
self._dir = sourcemap_dir
self._indices = {}
def _index_fo... | atomic-labs/zulip | zerver/lib/unminify.py | Python | apache-2.0 | 1,693 |
from file_util import *
from walk import walk
from listdir import listdir,filterdirs
from distutils.dir_util import copy_tree
from manip import link,symlink,first_exists
def makedirs(*elements):
import os
from os.path import exists, join
dirs = join(*elements)
if not exists(dirs):
os.makedirs(d... | thepian/thepian-lib | fs/__init__.py | Python | gpl-3.0 | 784 |
import json
import logging
import os
from keychainitementry import KeychainItemEntry, Designation
logger = logging.getLogger('PassPy.KeychainItem')
class KeychainItem(object):
def __init__(self, keychain, identifier, type, name, entryConfig):
self.keychain = keychain
self.vault = keychain.vault
... | tanwald/passpy | keychain/keychainitem.py | Python | gpl-3.0 | 4,617 |
from twisted.python import failure
from twisted.internet import reactor, protocol, address, error
from twisted.test import testutils
from twisted.trial import unittest
from StringIO import StringIO
class FakeTransport(protocol.FileWrapper):
disconnecting = False
disconnect_done = False
def __init__(self, ... | antong/ldaptor | ldaptor/test/util.py | Python | lgpl-2.1 | 4,431 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import sys
import pytest
import numpy as np
from numpy.testing import assert_equal
from astropy import units as u
from astropy.time import Time
from astropy.utils.exceptions import AstropyUserWarning
from astropy.timeseries.sampled import TimeSeries
fr... | mhvk/astropy | astropy/timeseries/tests/test_downsample.py | Python | bsd-3-clause | 8,752 |
import re
import math
import numpy as np
import tensorflow as tf
import tensorflow.contrib as tc
from utils import *
def cal_conv_size(size, stride):
return int(math.ceil(float(size)/float(stride)))
class discriminator(object):
def __init__(self, data_name='MNIST'):
self.data_name = data_name
... | tshi04/machine-learning-codes | GAN-tf-ff/dc_dis.py | Python | gpl-3.0 | 2,076 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import time
# !! This is the configuration of Nikola. !!#
# !! You should edit it to your liking. !!#
# ! Some settings can be different in different languages.
# ! A comment stating (translatable) is used to denote those.
# ! There are two ways to s... | s2hc-johan/nikola | tests/data/translated_titles/conf.py | Python | mit | 27,281 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json, random
class truefalse:
def __init__(self, json_filename, random_order=False):
self.questions = []
self.question_index = 0
self.questions_count = 0
self.quiz_caption = ""
self.background_image = ""
json_data = ... | ale3andro/mouse-training | truefalse.py | Python | gpl-3.0 | 1,454 |
# -*- coding: utf-8 -*-
"""
=========
Constants
=========
.. currentmodule:: numpy
NumPy includes several constants:
%(constant_list)s
"""
#
# Note: the docstring is autogenerated.
#
from __future__ import division, absolute_import, print_function
import textwrap, re
# Maintain same format as in numpy.add_newdocs
... | jorisvandenbossche/numpy | numpy/doc/constants.py | Python | bsd-3-clause | 9,291 |
## This file is part of Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 2 of the
## License, ... | pombredanne/invenio | modules/websubmit/lib/functions/Print_Success_MBI.py | Python | gpl-2.0 | 1,587 |
import subprocess
import sys
import matplotlib.pyplot as plt
import matplotlib.backends.backend_tkagg
import tkinter
import tkinter.filedialog
import os
import spc
def open_folder(location):
if sys.platform.startswith('linux'):
subprocess.call(["xdg-open", location])
else:
os.startfile(locati... | Troogle/spc_image | process_spc.py | Python | gpl-3.0 | 2,956 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | alsrgv/tensorflow | tensorflow/python/keras/applications/__init__.py | Python | apache-2.0 | 3,053 |
"""
hello_ga4gh.py
This script shows the basics of accessing a remote web service.
"""
# The requests module handles the HTTP layer so that our script
# can communicate with a distant web server.
import requests
# JavaScript Object Notation (JSON) is how the data passed
# between the client and server is d... | Kusdhill/bioapi-examples | python_scripts/find_nonreference_samples_for_variant.py | Python | apache-2.0 | 5,414 |
from itertools import groupby
from operator import attrgetter
from typing import Dict, List, Type
from pkg_resources import iter_entry_points
from . import AuthPlugin, ConverterPlugin, FormatterPlugin
from .base import BasePlugin, TransportPlugin
ENTRY_POINT_NAMES = [
'httpie.plugins.auth.v1',
'httpie.plugi... | jkbrzt/httpie | httpie/plugins/manager.py | Python | bsd-3-clause | 2,168 |
"""
Video player in the courseware.
"""
import logging
from bok_choy.javascript import js_defined, wait_for_js
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise # lint-amnesty, pylint: disable=unused-import
log = logging.getLogger('VideoPage')
VIDEO_BUTTONS = {
'transcript'... | edx/edx-platform | common/test/acceptance/pages/lms/video/video.py | Python | agpl-3.0 | 7,517 |
import pandas as pd
import datetime
def predict(predictor, data_train, y, data_test, cv_score=None):
predictor.fit(data_train, y)
prediction = predictor.predict(data_test)
print_prediction(predictor, prediction, data_test.index, cv_score)
def print_prediction(predictor, prediction, index, cv_score=None)... | astarostin/ALTA-2016-Challenge | prediction.py | Python | gpl-3.0 | 993 |
import numpy as np
import matplotlib.pyplot as plt
def pl_ad_test(gs, plot_style, flag_ad_test, ad_cl, ad_fr, id_kinem):
"""
"""
if flag_ad_test:
def adPlot(ax, d1, d2, s):
ax.set_title('(' + s + ')')
ax.axes.yaxis.set_ticklabels([])
plt.xlabel("A-D test (log)... | asteca/ASteCA | packages/out/mp_AD_test_DEPRECATED.py | Python | gpl-3.0 | 4,515 |
"""
Support for WeMo device discovery.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/wemo/
"""
import logging
from blumate.components import discovery
from blumate.const import EVENT_BLUMATE_STOP
REQUIREMENTS = ['pywemo==0.4.3']
DOMAIN = 'wemo'
DISC... | bdfoster/blumate | blumate/components/wemo.py | Python | mit | 3,068 |
import cx_Freeze
executables = [cx_Freeze.Executable("Watch.pyw", base = "Win32GUI")]
cx_Freeze.setup(
name="Watch",
options={"build_exe": {"packages":["pygame"],
"include_files":["10.png", "11.png", "12.png", "13.png", "14.png", "15.png", "16.png", "17.png", "18.png", "19.png", "20.png", "21.png", "cursor.png", "... | WorkingRobot/PygameWatch | Source/cx_freeze-Setup.py | Python | mit | 472 |
class RBaseObject(object):
wrapClass = None
def _init(self, wrap=None):
if wrap is None and self.wrapClass is not None:
wrap = self.wrapClass()
if wrap is not None:
self._wrapped = wrap
def naked(self):
if hasattr(self, "_wrapped"):
return self.... | robofab-developers/fontParts | Lib/fontParts/fontshell/base.py | Python | mit | 349 |
import numpy as np
import theano
import theano.tensor as T
# test for theano tensor.maximum
data = theano.shared(np.eye(50, dtype=theano.config.floatX), name="testdata")
bias = theano.shared(np.zeros(50, dtype=theano.config.floatX), name="bias", strict=False, allow_downcast=None)
init_W = np.zeros((50,50),dtype=the... | lzamparo/SdA_reduce | theano_models/dA/test_maximum.py | Python | bsd-3-clause | 1,407 |
from django.conf.urls import patterns
from django.conf import settings
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
( r'^$', 'statserver.stats.views.browse' ),
( r'^stats/addnode$', 'statserver.stats.views.addnode' ),
( ... | JuliBakagianni/META-SHARE | misc/tools/statserver/urls.py | Python | bsd-3-clause | 418 |
__all__ = ['ttypes', 'constants', 'WieraToLocalInstanceIface']
| dcsg-umn/wiera | wieracentral/gen-py/WieraToLocalInstanceIface/__init__.py | Python | apache-2.0 | 63 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/interfaces/interface/subinterfaces/subinterface/ipv4/unnumbered/interface_ref/__init__.py | Python | apache-2.0 | 9,237 |
# pylint: disable=R0903
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=256)
description = models.CharField(max_length=256)
category = models.CharField(max_length=256)
version = models.CharField(max_length=32)
author = models.CharField(max_length=128)
... | Turupawn/website | tosec/models.py | Python | agpl-3.0 | 1,158 |
#########################################################################################
#
# author: Richard Neher
# email: richard.neher@tuebingen.mpg.de
#
# Reference: Richard A. Neher, Colin A Russell, Boris I Shraiman.
# "Predicting evolution from the shape of genealogical trees"
#
####################... | rneher/FitnessInference | prediction_src/ancestral.py | Python | mit | 9,286 |
# Copyright (C) 2017 Greenweaves Software Pty Ltd
# This 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 software is distribut... | weka511/bioinformatics | BA8B.py | Python | gpl-3.0 | 1,434 |
# Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... | deepmind/open_spiel | open_spiel/higc/bots/test_bot_first_action.py | Python | apache-2.0 | 1,766 |
import sys
from bottle import run, install
from terms.robots.robot import TermsPlugin
from terms.core.utils import get_config
def main():
config = get_config()
tplugin = TermsPlugin(config)
install(tplugin)
host = 'http_host' in config and config['http_host'] or 'localhost'
port = 'http_port' in co... | enriquepablo/terms.server | terms/server/scripts/serve.py | Python | gpl-3.0 | 470 |
import _plotly_utils.basevalidators
class ZValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="z", parent_name="mesh3d", **kwargs):
super(ZValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=kwar... | plotly/python-api | packages/python/plotly/plotly/validators/mesh3d/_z.py | Python | mit | 440 |
"""Paragraph wrapping and filling.
"""
# Copyright (C) 2013 Ecometrica.
# Written by Simon Law <sfllaw@sfllaw.ca>
from functools import partial
import re
import textwrap
__all__ = ['ParagraphWrapper', 'split', 'wrap', 'fill']
class ParagraphWrapper(textwrap.TextWrapper):
parasep_re = re.compile(r'\n' # Newl... | ecometrica/parawrap | parawrap.py | Python | apache-2.0 | 2,806 |
from django.http import HttpResponse
from django.conf import settings
tracer = settings.OPENTRACING_TRACER
def index(request):
return HttpResponse("index")
@tracer.trace('path', 'scheme', 'fake_setting')
def traced_func_with_attrs(request):
currentSpanCount = len(settings.OPENTRACING_TRACER._current_spans)
... | kcamenzind/django_opentracing | tests/test_site/views.py | Python | bsd-3-clause | 823 |
# Copyright (C) 2016 Swift Navigation Inc.
#
# Contact: Valeri Atamaniouk <valeri@swiftnav.com>
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF A... | swift-nav/peregrine | tests/test_iqgen_tcxo.py | Python | gpl-3.0 | 5,023 |
from flask import render_template, flash, redirect, session, url_for, request, g, jsonify
from flask.ext.login import login_user, logout_user, current_user, login_required
from flask.ext.sqlalchemy import get_debug_queries
from flask.ext.babel import gettext
from app import app, db, lm, oid, babel
from forms import Log... | Pballer/prayer | app/views.py | Python | bsd-3-clause | 24,350 |
import matplotlib.cm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.optimize as op
from adjustText import adjust_text
from scipy.stats.kde import gaussian_kde
import chainplot.core.style as plot_style
from chainplot.utils.dict_tools import replace_dict, split_kwargs, britishdict, c... | Torvaney/chainplot | chainplot/core/plot.py | Python | mit | 28,899 |
#
# 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... | bolkedebruin/airflow | airflow/providers/amazon/aws/hooks/s3.py | Python | apache-2.0 | 31,892 |
from argparse import ArgumentParser as ap
parser = ap(description='This script divides a tab separated file containing a sentence and its score.')
parser.add_argument("-f", help="Input file name (complete democratic)", metavar="input_file", required=True)
parser.add_argument("-F", help="Output file name (scores comple... | iarroyof/nlp-pipeline | dem_splitter.py | Python | gpl-3.0 | 518 |
from elasticsearch import Elasticsearch
import json
class Search:
""" API Doc for Python Elasticsearch Client
http://elasticsearch-py.readthedocs.org/en/master/
"""
es = Elasticsearch()
params = {}
def __init__(self, **kargs):
#: highlight some result field
self.params['b... | dbbbit/ninja-search | search/search.py | Python | mit | 1,194 |
'''
notebookutils.py
2012 Brandon Mechtley
Arizona State University
A few helpful routines for using IPython notebook.
'''
from IPython.core.pylabtools import print_figure
from IPython.core.display import display, HTML, Math, Latex
from sympy import Matrix, latex
import numpy as np
def limitprec(m, prec=3):
''... | plant/barycentric | notebookutils.py | Python | mit | 2,235 |
"""
https://webdocs.cs.ualberta.ca/~sutton/MountainCar/MountainCar1.cp
"""
import math
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
class MountainCarEnv(gym.Env):
metadata = {
'render.modes': ['human', 'rgb_array'],
'video.frames_per_second': 30
}
def... | xpharry/Udacity-DLFoudation | tutorials/reinforcement/gym/gym/envs/classic_control/mountain_car.py | Python | mit | 4,262 |
# An APEv2 tag reader
#
# Copyright 2005 Joe Wreschnig
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# $Id: apev2.py 4008 2007-04-21 04:02:07Z piman $
"""APEv2 reading and writi... | berdario/mutagen | mutagen/apev2.py | Python | gpl-2.0 | 16,090 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2021 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 boto3
from ... | petrjasek/superdesk-core | superdesk/publish/transmitters/amazon_sqs_fifo.py | Python | agpl-3.0 | 2,282 |
#! -*- coding: utf-8 -*-
#
# Copyright 2016 Robert Clark (clark@exiter.com)
#
# 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
#
# U... | rjclark/zoneminder-slack-bot | zonebot/bot.py | Python | apache-2.0 | 7,006 |
"""
Based on an input, trained classifier configuration, classify a number of media
files, whose descriptor is computed by the configured descriptor generator.
Input files that classify as the given label are then output to standard out.
Thus, this script acts like a filter.
"""
import glob
import json
import logging
i... | Purg/SMQTK | python/smqtk/bin/classifyFiles.py | Python | bsd-3-clause | 5,843 |
import pygame
from random import randint
from gameconfig import GameConfig
from sprite import SpriteManager
class Prisoner(pygame.sprite.Sprite):
def __init__(self, start_position):
pygame.sprite.Sprite.__init__(self)
self.image = self.get_image()
self.rect = self.image.get_rect()
... | ismael-liceras/php-invaders | prisoner.py | Python | mit | 916 |
# 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 u... | Laurawly/tvm-1 | vta/python/vta/top/bitpack.py | Python | apache-2.0 | 2,886 |
# -*- coding: utf-8 -*-
from django.db import models
class User(models.Model):
hobbies = models.ManyToManyField('Hobby', related_name='users')
class Pet(models.Model):
user = models.ForeignKey('User', on_delete=models.CASCADE)
class Allergy(models.Model):
pets = models.ManyToManyField('Pet')
class ... | jmcarp/nplusone | tests/testapp/testapp/models.py | Python | mit | 606 |
from flask import request, g, jsonify, current_app, url_for
from . import api
from .errors import forbidden
from .decorators import permission_required
from .. import db
from ..models import Post, Permission
# 发表文章
@api.route('/posts/', methods=['POST'])
@permission_required(Permission.WRITE_ARTICLES)
def new_post():... | Widiot/simpleblog | simple/api_1_0/posts.py | Python | mit | 1,809 |
"""
GpuCorrMM-based convolutional layers
"""
import theano
from .. import init
from .. import nonlinearities
from .base import Layer
from .conv import conv_output_length
from theano.sandbox.cuda.basic_ops import gpu_contiguous
from theano.sandbox.cuda.blas import GpuCorrMM
__all__ = [
"MMLayer",
"Conv2DM... | takacsg84/Lasagne | lasagne/layers/corrmm.py | Python | mit | 4,504 |
class Solution:
def merge(self, nums1, m, nums2, n):
"""
:type nums1: List[int]
:type m: int
:type nums2: List[int]
:type n: int
:rtype: void Do not return anything, modify nums1 in-place instead.
"""
n1, n2 = m - 1, n - 1
length = len(nums1)
... | sonymoon/algorithm | src/main/python/leetcode-python/easy/mergeSortedArray.py | Python | apache-2.0 | 1,859 |
from quark_runtime import *
def call_main(): import sys; main(_List(sys.argv[1:]))
def main(args):
a = 2;
b = 2;
_println(_toString((a) + (b)));
| bozzzzo/quark | quarkc/test/emit/expected/py/numbers/numbers/__init__.py | Python | apache-2.0 | 159 |
import copy
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.models import User, Group
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client impo... | pipoket/django-guardian | guardian/tests/admin_test.py | Python | bsd-2-clause | 14,793 |
import os
import re
import string
import logging
import tempfile
import importlib
import subprocess
import requests
import boto.s3.key
from billy.scrape.utils import convert_pdf
from billy.core import settings, s3bucket
_log = logging.getLogger('billy.utils.fulltext')
def pdfdata_to_text(data):
with tempfile.... | loandy/billy | billy/utils/fulltext.py | Python | bsd-3-clause | 4,290 |
class Cache(object):
def has(self,key):
pass
def get(self,key):
pass
def put(self,key,value):
pass
def get_cachedata(self, key, lazyeval):
try:
v = self.get(key)
except KeyError:
v = lazyeval()
self.put(key,v)
retur... | mizuy/mizwiki | mizwiki/cache.py | Python | mit | 2,601 |
from Core import TreeClass as tc
import pandas as pd
file_original = open('input/test.txt', 'r')
file_predicted = open('input/full_hid25_re0-0007-test.txt', 'r')
original_temp = []
predicted_temp = []
for line in file_original:
original_tree = tc.ScoreTree(line)
for node in original_tree.allNodes():
... | Nacturne/CoreNLP_copy | python_tools/lexical/stats_gen.py | Python | gpl-2.0 | 1,460 |
"""
launch getfile client with a reusable GUI form class;
os.chdir to target local dir if input (getfile stores in cwd);
to do: use threads, show download status and getfile prints;
"""
from form import Form
from tkinter import Tk, mainloop
from tkinter.messagebox import showinfo
import getfile, os
class G... | simontakite/sysadmin | pythonscripts/programmingpython/Internet/Sockets/getfilegui.py | Python | gpl-2.0 | 1,198 |
"""
Module to read MODFLOW binary output files. The module contains three
important classes that can be accessed by the user.
* HeadFile (Binary head file. Can also be used for drawdown)
* UcnFile (Binary concentration file from MT3DMS)
* CellBudgetFile (Binary cell-by-cell flow file)
"""
from __future_... | mjasher/gac | GAC/flopy/utils/binaryfile.py | Python | gpl-2.0 | 31,403 |
h = float(input("Enter the height of the tower: "))
t = float(input("Enter the time interval: "))
s = 9.81*t**2/2
print("The height of the ball is",h-s,"meters")
| KiMiralles/Python-Learning | Computational Physics Newman/Book Resources/dropped.py | Python | gpl-3.0 | 164 |
import numpy as np
import pandas as pd
from typing import Tuple, List
from queryexpander.semantic_similarity import CppSemanticSimilarity
class QueryExpander:
def __init__(self, vocabulary_path: str, vocabulary_length: int, centroids_file_path: str, idfs_cache_file: str):
self._words: List[str] = pd.read... | konraddysput/BioDocumentAnalysis | queryexpander/expansion.py | Python | mit | 1,268 |
# -*- coding: utf-8 -*-
"""
@see https://waffle.io/QualiSystems/vCenterShell/cards/5666b2aa0c076d2300052216 for initial info
@see https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.DistributedVirtualSwitch.html
"""
from pyVmomi import vim
from cloudshell.cp.vcenter.common.vcenter.vm_location... | QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/disconnect_dvswitch.py | Python | apache-2.0 | 6,077 |
#
# Copyright 2017 National Renewable Energy Laboratory
#
# 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 la... | OpenFAST/OpenFAST | reg_tests/executeHydrodynRegressionCase.py | Python | apache-2.0 | 7,015 |
#@+leo-ver=5-thin
#@+node:2014fall.20141212095015.1775: * @file wsgi.py
# coding=utf-8
# 上面的程式內容編碼必須在程式的第一或者第二行才會有作用
################# (1) 模組導入區
# 導入 cherrypy 模組, 為了在 OpenShift 平台上使用 cherrypy 模組, 必須透過 setup.py 安裝
#@@language python
#@@tabwidth -4
#@+<<declarations>>
#@+node:2014fall.20141212095015.1776: ** <<declar... | 40123148/2015cdb_40123148 | wsgi.py | Python | gpl-3.0 | 34,518 |
import unittest
import sys
import os
sys.path.append(os.path.join('..\..', 'src'))
from backend.menus.score import Score
class ScoreTest(unittest.TestCase):
def setUp(self):
self.player_name = "Test"
self.points = 10
self.score = Score(self.player_name, self.points)
self.score_id ... | tsvetelina-aleksandrova/Spacekatz | test/menus/score_test.py | Python | mit | 1,541 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Created by xixijun
# Date: 15-5-12
# Blog: morningchen.com
import requests
payload = {"key1": "value1", "key2": "value2"}
r = requests.post("http://httpbin.org/post")
r1 = requests.post("http://httpbin.org/post", data=payload)
| chen2aaron/SnirteneCodes | StarterLearningPython/228-post.py | Python | gpl-2.0 | 276 |
#!/usr/bin/python
# Copyright 2014 Nervana Systems 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 req... | phvu/nervanagpu | benchmarks/minibatch_layout_diff.py | Python | apache-2.0 | 3,364 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.