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 John Reid 2008
#
"""
Code to build single gap PSSM models using HMMs.
"""
import hmm
class MotifModelPositionMap(object):
"""
Maps between positions in a motif and positions in a model representing the motif.
"""
def __init__(self, K):
"""
@arg K: The length of the motif... | JohnReid/biopsy | Python/hmm/pssm/single_gap.py | Python | mit | 10,682 |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic list exercises
# D. Given a list of numbers, return a list where
# al... | g-sobral/google-python-exercises | basic/list2.py | Python | apache-2.0 | 2,495 |
from setuptools import setup, find_packages
readme = open('README.rst').read()
changes = open('CHANGES.rst').read()
setup(
name='pydocker-tools',
version='0.0.1',
description='pydocker-tools is a set of tools to work around lengthy or piped command line tools for docker',
license='MIT',
url='https... | jojees/pydocker-tools | setup.py | Python | mit | 1,691 |
#!/usr/bin/env python
import sys, os
from stat import *
from distutils.core import setup
from distutils.command.install import install as _install
INSTALLED_FILES = '.installed_files'
#stolen from ccsm
class install (_install):
def run (self):
_install.run(self)
outputs = self.get_outputs()
data = '\n'.join... | smolleyes/Ushare-gui | setup.py | Python | gpl-2.0 | 2,609 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function
import os
import sys
import glob
import yaml
import argparse
import tempfile
import logging
import re
import shutil
import pprint
from fermipy.utils import mkdir
from fermipy.batch import su... | fermiPy/fermipy | fermipy/scripts/validate.py | Python | bsd-3-clause | 3,711 |
# -*- coding: utf-8 -*-
__title__ = 'djangorestframework-jsonapi'
__version__ = '2.1.1'
__author__ = ''
__license__ = 'MIT'
__copyright__ = ''
# Version synonym
VERSION = __version__
| Instawork/django-rest-framework-json-api | rest_framework_json_api/__init__.py | Python | bsd-2-clause | 185 |
from gi.repository import Gtk
from toga.interface import SplitContainer as SplitContainerInterface
from ..container import Container
from .base import WidgetMixin
class SplitContainer(SplitContainerInterface, WidgetMixin):
_CONTAINER_CLASS = Container
def __init__(self, id=None, style=None, direction=Split... | pybee/toga-gtk | toga_gtk/widgets/splitcontainer.py | Python | bsd-3-clause | 2,284 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp.osv import osv, fields
# class workfl... | jorsea/odoo-addons | workflow_view/workflow.py | Python | agpl-3.0 | 629 |
"""The philharmonic simulator.
Traces geotemporal input data, asks the scheduler to determine actions
and simulates the outcome of the schedule.
(_)(_)
/ \ ssssssimulator
/ | /
/ \ * |
... | philharmonic/philharmonic | philharmonic/simulator/simulator.py | Python | gpl-3.0 | 12,350 |
import os
import numpy as np
from . import noise
from . import support
from . import circle
def generate_diff(config):
solid_unit = make_3D_duck(shape = config['sample']['shape'])
Solid_unit = np.fft.fftn(solid_unit, config['detector']['shape'])
solid_unit_expanded = np.fft.ifftn(Solid_unit)
diff... | andyofmelbourne/crappy-crystals | utils/phasing_3d/utils/duck.py | Python | gpl-3.0 | 3,322 |
"""
Tests for the threading module.
"""
import test.support
from test.support import verbose, strip_python_stderr, import_module, cpython_only
from test.support.script_helper import assert_python_ok, assert_python_failure
import random
import re
import sys
_thread = import_module('_thread')
threading = import_module(... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/test/test_threading.py | Python | gpl-3.0 | 39,157 |
import argparse
import os
import logging
import numpy as np
import glyph.application
import glyph.assessment
from glyph.utils.argparse import (
positive_int,
non_negative_int,
np_infinity_int,
readable_file,
readable_yaml_file,
)
logger = logging.getLogger(__name__)
try:
import gooey
fro... | Ambrosys/glyph | glyph/cli/_parser.py | Python | lgpl-3.0 | 9,875 |
"""Platform for beewi_smartclim integration."""
from __future__ import annotations
from beewi_smartclim import BeewiSmartClimPoller # pylint: disable=import-error
import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorDeviceClass,
SensorEntity,
)
from homeassistant.... | rohitranjan1991/home-assistant | homeassistant/components/beewi_smartclim/sensor.py | Python | mit | 2,783 |
#! python
import arcrest.admin
arcrest.admin.cmdline.convertcachestorageformat()
| jasonbot/arcrest | cmdline/convertcachestorageformat.py | Python | apache-2.0 | 82 |
# pylint: disable=E1101,E1103,W0232
from datetime import datetime, timedelta
import numpy as np
import pandas.tseries.frequencies as frequencies
from pandas.tseries.frequencies import get_freq_code as _gfc
from pandas.tseries.index import DatetimeIndex, Int64Index, Index
from pandas.tseries.base import DatelikeOps, Dat... | BigDataforYou/movie_recommendation_workshop_1 | big_data_4_you_demo_1/venv/lib/python2.7/site-packages/pandas/tseries/period.py | Python | mit | 38,437 |
from django.conf import settings
from django.core.urlresolvers import reverse, NoReverseMatch
from django.shortcuts import render as dj_render
from .. import site
from ..auth import is_admin_session, update_admin_session
from .auth import login
__ALL__ = ['get_protected_namespace', 'render', 'protected_admin_view']
... | 1905410/Misago | misago/admin/views/__init__.py | Python | gpl-2.0 | 2,051 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 GRNET S.A.
#
# 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 ... | grnet/synnefo | snf-cyclades-gtools/setup.py | Python | gpl-3.0 | 2,033 |
import json
json_data=open('raw.json').read()
data = json.loads(json_data)
elements = {}
for elt in data['PERIODIC_TABLE']['ATOM']:
symbol = elt['SYMBOL']
Z = elt['ATOMIC_NUMBER']
elements[symbol] = {'Z': Z}
f = open('elements.json', 'w')
f.write(json.dumps(elements)) | GRIFFINCollaboration/beamCompanionExplorer | munging/elements/munge.py | Python | mit | 279 |
# -*- coding: utf-8 -*-
"""
Tests for the user interface elements of Mu.
"""
from PyQt5.QtWidgets import QApplication, QMessageBox, QLabel
from PyQt5.QtChart import QChart, QLineSeries, QValueAxis
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QTextCursor
from unittest import mock
import sys
import os
import signa... | stestagg/mu | tests/interface/test_panes.py | Python | gpl-3.0 | 89,147 |
# test basic capability to start a new thread
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
try:
import utime as time
except ImportError:
import time
import _thread
def foo():
pass
def thread_entry(n):
for i in range(n):
foo()
_thread.start_new_thread(thread_ent... | AriZuu/micropython | tests/thread/thread_start1.py | Python | mit | 435 |
from os.path import join
from pythonforandroid.recipe import PythonRecipe
class ZBarRecipe(PythonRecipe):
version = '0.10'
# For some reason the version 0.10 on PyPI is not the same as the ones
# in sourceforge and GitHub. The one in PyPI has a setup.py.
# url = 'https://github.com/ZBar/ZBar/archive... | germn/python-for-android | pythonforandroid/recipes/zbar/__init__.py | Python | mit | 1,172 |
#!/usr/bin/env python3
#import pkg_resources
#pkg_resources.require("requests>=2.10.0")
import sys
sys.path.insert(0, "/usr/local/lib/python3.4/dist-packages/")
import os, sys, json, pymongo, requests, ephem, datetime, math
from housepy import config, log, util, geo
from mongo import db
SOURCE = "server"
try:
... | biomearts/swale_api | server_sensors.py | Python | gpl-3.0 | 3,056 |
#!/usr/bin/python
import os
import subprocess
from exceptions import YBError
READ = object() # read from
WRITE = object() # write to
#-----------------------------------------------------------------------------
def check_error(cmd, code):
if code < 0:
raise YBError('"%s" got signal %d', cmd, -code, exit = 1... | dozzie/yumbootstrap | lib/yumbootstrap/sh.py | Python | gpl-3.0 | 2,741 |
#vim: set encoding=utf-8
import os
import shutil
import tempfile
from unittest import TestCase
from lxml import etree
from regparser.notice import build, changes
from regparser.notice.diff import DesignateAmendment, Amendment
from regparser.tree.struct import Node
import settings
class NoticeBuildTest(TestCase):
... | adderall/regulations-parser | tests/notice_build_tests.py | Python | cc0-1.0 | 30,845 |
# 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... | ghchinoy/tensorflow | tensorflow/python/keras/layers/serialization_test.py | Python | apache-2.0 | 5,547 |
from django.contrib import admin
from aspc.mentalhealth.models import (Insurance, Qualification, Specialty, Tag, Gender, Identity, SexualOrientation,
Ethnicity, Therapist, MentalHealthReview)
admin.site.register(Insurance)
admin.site.register(Qualification)
admin.site.register(Sp... | aspc/mainsite | aspc/mentalhealth/admin.py | Python | mit | 552 |
# -*- coding: utf-8 -*-
"""
forms.render_wtform_without_syntaxerr
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Render WTForm fields with html attributes that cause TemplateSyntaxErrors
http://flask.pocoo.org/snippets/107/
"""
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dir... | fengsp/flask-snippets | forms/render_wtform_without_syntaxerr.py | Python | bsd-3-clause | 1,222 |
# WORK IN PROGRESS
#run_batch_command.topo_flag_options = dict(c = "print '**Running 1-simple.py example**'",
# p = ('non_param1=None', "non_param2='Non-existant'"))
#if isinstance(tasklauncher, QLauncher):
# tasklauncher.qsub_flag_options.update(dict(pe=['OpenMP', '4... | ioam/svn-history | dispatch/examples/topographica/2-intermediate.py | Python | bsd-3-clause | 325 |
from .appointment import Appointment
__all__ = ('Appointment',)
| TwilioDevEd/appointment-reminders-flask | models/__init__.py | Python | mit | 65 |
# 50. Product of Array Exclude Itself
# Description
# Notes
# Testcase
# Judge
# Given an integers array A.
#
# Define B[i] = A[0] * ... * A[i-1] * A[i+1] * ... * A[n-1], calculate B WITHOUT divide operation.
#
# Have you met this question in a real interview? Yes
# Example
# For A = [1, 2, 3], return [6, 3, 2].... | shawncaojob/LC | LINTCODE/50_product_of_array_exclude_itself.py | Python | gpl-3.0 | 944 |
from math import log
def sort(a_list, base):
"""Sort the input list with the specified base, using Radix sort.
This implementation assumes that the input list does not contain negative
numbers. This algorithm is inspired from the Wikipedia implmentation of
Radix sort.
"""
passes = int(log(ma... | isubuz/zahlen | algorithms/sorting/radix_sort.py | Python | mit | 805 |
import lcm
import forseti2
import settings
import LCMNode
import time
# def handle_all(channel, data):
# print "received on %s:" % channel
# print " %s" % str(forseti2.Time.decode(data))
# class TestNode(LCMNode.LCMNode):
# def __init__(self, lc):
# self.lc = lc
# self.start_thread()
... | pioneers/forseti2 | src/status_lights_tester.py | Python | apache-2.0 | 1,278 |
import os
import os.path
import sys
import logging
import platform
import time
import signals
import jsonHelper
import globalSignals
from EditorModule import EditorModule, EditorModuleManager
from Project import Project
# from package import PackageManager
from MainModulePath import getMainModulePath
... | cloudteampro/juma-editor | editor/lib/juma/core/EditorApp.py | Python | mit | 8,429 |
# Generated from tnsnames.g4 by ANTLR 4.5.1
# encoding: utf-8
from io import StringIO
from antlr4 import *
def serializedATN():
with StringIO() as buf:
buf.write("\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3P")
buf.write("\u02dc\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
bu... | erget/tnsmaster | tnsnames/tnsnamesParser.py | Python | mit | 212,500 |
"""
Confirmation screen for peer calibration and grading.
"""
from bok_choy.page_object import PageObject
class PeerConfirmPage(PageObject):
"""
Confirmation for peer calibration and grading.
"""
url = None
def is_browser_on_page(self):
return self.is_css_present('section.calibration-in... | pku9104038/edx-platform | common/test/acceptance/pages/lms/peer_confirm.py | Python | agpl-3.0 | 761 |
from django.contrib import admin
from .models import Job
# Register your models here.
admin.site.register(Job)
| WilliamQLiu/job-waffle | employer/admin.py | Python | apache-2.0 | 113 |
import os
import numpy as np
import ctypes as C
from obspy.signal.headers import clibevresp
from obspy.core.util.base import NamedTemporaryFile
from obspy.signal.invsim import cornFreq2Paz, pazToFreqResp, c_sac_taper
from miic.core.miic_utils import nextpow2
def evalresp(t_samp, nfft, filename, date, station='*', c... | miic-sw/miic | miic.core/src/miic/core/response_correction.py | Python | gpl-3.0 | 8,071 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
title = "Bednets"
tab_link = "/bednets"
a = "Alpha"
b = "Beta"
| takinbo/rapidsms-borno | apps/bednets/config.py | Python | lgpl-3.0 | 122 |
"""Tests for the WLED config flow."""
from unittest.mock import MagicMock
from wled import WLEDConnectionError
from homeassistant.components import zeroconf
from homeassistant.components.wled.const import CONF_KEEP_MASTER_LIGHT, DOMAIN
from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF
from homeass... | mezz64/home-assistant | tests/components/wled/test_config_flow.py | Python | apache-2.0 | 6,761 |
# -*- coding: utf-8 -*-
from openerp.osv import osv,fields
from openerp import SUPERUSER_ID
class product_product(osv.Model):
_inherit = 'product.product'
def generate_ean13(self, cr, uid, ids, context=None):
if context is None: context = {}
generate_context = context.copy()
product_i... | germanponce/pos-addons | product_barcode_generator_custom/models.py | Python | lgpl-3.0 | 1,215 |
# -*- coding: utf-8 -*-
from datetime import date
import scrapy
from ..db import ads_db
from ..items import AdvertisementItem
class TipmotoSpider(scrapy.Spider):
name = "tipmoto"
allowed_domains = ["www.tipmoto.com", "www.motoinzerce.cz"]
start_urls = (
'http://www.motoinzerce.cz/hledat.php?cenao... | sairon/motoscrape | motoscrape/spiders/tipmoto.py | Python | unlicense | 2,002 |
#!/usr/bin/python
from __future__ import print_function
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import CPULimitedHost
from mininet.link import TCLink
from mininet.util import dumpNodeConnections
from mininet.log import setLogLevel
from sys import argv
from time import sleep
c... | fpaxos/fpaxos-test | deploy_mininet.py | Python | mit | 2,771 |
#!/usr/bin/python3
# coding: utf-8
# data_content.py
import os
class DataContent(object):
"""
Class to identify a column or table based on its content.
It will use a reference table to specify known content types
such as
transactions CONTAINS [ date col, amount col, desc, customer]
... | acutesoftware/AIKIF | aikif/dataTools/cls_data_content.py | Python | gpl-3.0 | 482 |
# -*- 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 unique constraint on 'Task', fields ['name', 'description', 'course']
... | HackBulgaria/Odin | courses/south_migrations/0023_auto__add_unique_task_name_description_course.py | Python | agpl-3.0 | 11,628 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding M2M table for field receiving_user on 'Activity'
db.create_table(u'activity_receiving_users',... | samhoo/askbot-realworld | askbot/migrations/0010_add_receiving_user_to_activity_model.py | Python | gpl-3.0 | 30,800 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-09-14 16:02
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... | wenxiaomao1023/wenxiaomao | gallery/migrations/0001_initial.py | Python | mit | 1,203 |
"Utilities for loading models and the modules that contain them."
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.datastructures import SortedDict
from django.utils.importlib import import_module
from django.utils.module_loading import module_has_submodule
im... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/db/models/loading.py | Python | bsd-3-clause | 9,755 |
from collections import namedtuple
import math
import itertools
inf = float('inf')
def area(polygon, signed=False):
L = len(polygon)
a = 0.5 * sum(
p[0] * q[1] - q[0] * p[1]
for p, q in edges(polygon)
)
if not signed:
a = abs(a)
return a
def centroid(polygon):
m = 1... | kcsaff/maze-builder | maze_builder/meshes/geometry.py | Python | mit | 6,785 |
anon = lambda -> qqq[None]: None
def f(): return 1 # this line should not break
anon : source.python
: source.python
= : keyword.operator.assignment.python, source.python
: source.python
lambda : meta.lambda-function.python, source.python, storage.type.function... | MagicStack/MagicPython | test/functions/lambda5.py | Python | mit | 1,823 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from django.http import HttpResponse
from rapidsms.webui.utils import render_to_response
#from apps.messaging.models import *
#from apps.messaging.utils import *
def index(req):
return render_to_response(req,
"messaging/index.html")
| takinbo/rapidsms-borno | apps/messaging/views.py | Python | lgpl-3.0 | 298 |
#
# libtcod 1.6.0 python wrapper
# Copyright (c) 2008,2009,2010,2012,2013 Jice & Mingos
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above... | AnthonyDiGirolamo/heliopause | libtcodpy.py | Python | mit | 61,827 |
#!/usr/bin/env python
"""Configuration parameters for the test subsystem."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from grr_response_core.lib import config_lib
# Default for running in the current directory
config_lib.DEFINE_constant_string(
... | dunkhong/grr | grr/core/grr_response_core/config/test.py | Python | apache-2.0 | 1,537 |
import mxnet as mx
import logging
import os
import time
def _get_lr_scheduler(args, kv):
if 'lr_factor' not in args or args.lr_factor >= 1:
return (args.lr, None)
epoch_size = args.num_examples / args.batch_size
if 'dist' in args.kv_store:
epoch_size /= kv.num_workers
begin_epoch = args... | linmajia/dlbench | tools/mxnet/common/fit.py | Python | mit | 7,649 |
"""Constants for Glances component."""
from __future__ import annotations
from dataclasses import dataclass
import sys
from homeassistant.components.sensor import SensorDeviceClass, SensorEntityDescription
from homeassistant.const import DATA_GIBIBYTES, DATA_MEBIBYTES, PERCENTAGE, TEMP_CELSIUS
DOMAIN = "glances"
CON... | home-assistant/home-assistant | homeassistant/components/glances/const.py | Python | apache-2.0 | 5,680 |
import signal
import sys
from threading import Event
def GetInterruptEvent():
e = Event()
def signal_handler(signal, frame):
print('You pressed Ctrl+C!')
e.set()
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
return e
| rickbassham/videoencode | interrupt.py | Python | mit | 302 |
"""This script creates a new demo based on an existing demo. It copies
across all the source files to a new directory, and creates a .vcproj
file in the build directory. This should be run from the scripts directory.
Usage:
new_demo.py base_demo new_demo
base_demo: the demo to copy, including the chapt... | idmillington/aicore | scripts/new_demo.py | Python | mit | 3,017 |
"""Production settings and globals."""
from .base import *
########## HOST CONFIGURATION
# See: https://docs.djangoproject.com/en/1.5/releases/1.5/#allowed-hosts-required-in-production
ALLOWED_HOSTS = []
########## END HOST CONFIGURATION
########## EMAIL CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/re... | archen/mantistrack | mantistrack/mantistrack/settings/production.py | Python | mit | 2,542 |
#!/usr/bin/env python
#------------------------------------------------------------------------------
#
# sensor metadata-extraction profiles - spot6 ortho-product
#
# Project: XML Metadata Handling
# Authors: Martin Paces <martin.paces@eox.at>
#
#-----------------------------------------------------------------------... | DREAM-ODA-OS/tools | metadata/profiles/pleiades1_ortho.py | Python | mit | 1,661 |
admin.autodiscover()
flatpages.register()
urlpatterns += [ url(r'^admin/', include(admin.site.urls)), ] | bane138/nonhumanuser | nonhumanuser/admin.py | Python | mit | 103 |
# Copyright (c) 2008 Mikeal Rogers
#
# 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 agre... | carsongee/edx-platform | common/djangoapps/edxmako/__init__.py | Python | agpl-3.0 | 676 |
#
# Copyright (c) 2009-2020 Tom Keffer <tkeffer@gmail.com>
#
# See the file LICENSE.txt for your full rights.
#
"""Engine for generating reports"""
from __future__ import absolute_import
# System imports:
import datetime
import ftplib
import glob
import logging
import os.path
import threading
import time
import... | hes19073/hesweewx | bin/weewx/reportengine.py | Python | gpl-3.0 | 33,225 |
# -*- coding: utf-8 -*-
#
# Cipher/DES.py : DES
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, perpetual, royalty-free,
# n... | mchristopher/PokemonGo-DesktopMap | app/pylibs/osx64/Cryptodome/Cipher/DES.py | Python | mit | 7,176 |
#!/usr/bin/env python3
"""tests.test_io.test_read_gfa.py: tests for exfi.io.read_gfa.py"""
from unittest import TestCase, main
from exfi.io.read_gfa import read_gfa1
from tests.io.gfa1 import \
HEADER, \
SEGMENTS_EMPTY, SEGMENTS_SIMPLE, SEGMENTS_COMPLEX, \
SEGMENTS_COMPLEX_SOFT, SEGMENTS_COMPLEX_HARD, ... | jlanga/exfi | tests/test_io/test_read_gfa.py | Python | mit | 2,975 |
from django.utils.translation import ugettext as _
from django.db.models import F
from forum.models.action import ActionProxy, DummyActionProxy
from forum.models import Vote, Flag
from forum import settings
class VoteAction(ActionProxy):
def update_node_score(self, inc):
self.node.score = F('score'... | CLLKazan/iCQA | qa-engine/forum/actions/meta.py | Python | gpl-3.0 | 7,499 |
# ----------------------------------------------------------------------------
# Copyright 2015 Nervana Systems 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.o... | nhynes/neon | tests/test_optimizer.py | Python | apache-2.0 | 6,823 |
'''
Random Breakout AI player
@author: Victor Mayoral Vilches <victor@erlerobotics.com>
'''
import gym
import numpy
import random
import pandas
if __name__ == '__main__':
env = gym.make('Breakout-v0')
env.monitor.start('/tmp/breakout-experiment-1', force=True)
# video_callable=lambda count: count ... | vmayoral/basic_reinforcement_learning | tutorial8/gym/breakout/breakout.py | Python | gpl-3.0 | 1,469 |
from answer import Answer
from question import Question
class JsonHelper:
@staticmethod
def event_to_json(event=None, questions = False):
response = {
'id': event.id,
'start_time_text': event.start_time.strftime('%Y-%m-%d %H:%M'),
'title': e... | citruspi/relier-api | relier/models/json_help.py | Python | unlicense | 1,609 |
# 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/v2020_03_01/aio/operations/_route_tables_operations.py | Python | mit | 26,791 |
from app.config.cplog import CPLog
import ConfigParser
log = CPLog(__name__)
class configApp():
s = ['Sabnzbd', 'TheMovieDB', 'NZBsorg', 'Renamer', 'IMDB', 'Intervals']
bool = {'true':True, 'false':False}
def __init__(self, file):
self.file = file
self.p = ConfigParser.RawConfigParser()... | CouchPotato/CouchPotatoV1 | app/config/configApp.py | Python | gpl-3.0 | 11,038 |
import re
from cfme.common.provider import BaseProvider
from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import (
Region, Form, AngularSelect, form_buttons, Input, Quadicon
)
from cfme.web_ui.menu import nav
from utils.db import cfmedb
from utils.varmeth import variable
from . import cfg_btn, mon_b... | akrzos/cfme_tests | cfme/middleware/provider.py | Python | gpl-2.0 | 6,224 |
from sandglass.time.api import API
from sandglass.time.api import ApiDescribeResource
class ApiV1DescribeResource(ApiDescribeResource):
"""
Resource to describe API version 1.
"""
version = "v1"
def describe(self):
resource_info_list = []
for resource in self.resources:
... | sanglass/sandglass.time | sandglass/time/api/v1/__init__.py | Python | bsd-3-clause | 1,317 |
### clustering.py
#Copyright 2005-2008 J. David Gladstone Institutes, San Francisco California
#Author Nathan Salomonis - nsalomonis@gmail.com
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software ... | wuxue/altanalyze | clustering.py | Python | apache-2.0 | 233,205 |
#! /usr/bin/env python
# Copyright (c) 2018 Cloudera, 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
#
# Unless required by applicable la... | cloudera/director-scripts | tls/update-tls.d6.py | Python | apache-2.0 | 6,333 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2018-04-20 22:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0003_auto_20180420_2157'),
]
operations = [
migrations.AlterField... | ytsapras/robonet_site | events/migrations/0004_auto_20180420_2204.py | Python | gpl-2.0 | 518 |
import requests # pip install requests to get it
import urllib
import json
from django.http import HttpResponse
#from members.models import User
import logging
log = logging.getLogger("api_client")
# Get the token using a POST request and a code
from django.conf import settings
SCOPE = "names relatives introducti... | jsbrava/intro23andme | api/client.py | Python | mit | 7,958 |
# SPDX-License-Identifier: AGPL-3.0-or-later
# lint: pylint
"""Google (Scholar)
For detailed description of the *REST-full* API see: `Query Parameter
Definitions`_.
.. _Query Parameter Definitions:
https://developers.google.com/custom-search/docs/xml_results#WebSearch_Query_Parameter_Definitions
"""
# pylint: dis... | dalf/searx | searx/engines/google_scholar.py | Python | agpl-3.0 | 4,416 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Guillaume Delpierre <gde@llew.me>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version':... | dagwieers/ansible | lib/ansible/modules/crypto/openssl_pkcs12.py | Python | gpl-3.0 | 11,535 |
import hvac
from st2actions.runners.pythonrunner import Action
class VaultBaseAction(Action):
def __init__(self, config):
super(VaultBaseAction, self).__init__(config)
self.vault = self._get_client()
def _get_client(self):
url = self.config['url']
token = self.config['token']... | pidah/st2contrib | packs/vault/actions/lib/action.py | Python | apache-2.0 | 495 |
import cherrypy
# 這是 MAN 類別的定義
'''
# 在 application 中導入子模組
import programs.cdag30.man as cdag30_man
# 加入 cdag30 模組下的 man.py 且以子模組 man 對應其 MAN() 類別
root.cdag30.man = cdag30_man.MAN()
# 完成設定後, 可以利用
/cdag30/man/assembly
# 呼叫 man.py 中 MAN 類別的 assembly 方法
'''
class MAN(object):
# 各組利用 index 引導隨後的程式執行
@cherrypy.exp... | xindus40223115/w16b_test | man2.py | Python | gpl-3.0 | 11,962 |
from ajenti.ui import *
from ajenti.plugins.dashboard.api import *
from ajenti.com import implements, Plugin
from api import *
class NetworkWidget(Plugin):
implements(IDashboardWidget)
title = 'Networking'
def get_ui(self):
cfg = self.app.get_backend(INetworkConfig)
w = UI.LayoutTable... | DmZ/ajenti | plugins/network/widget.py | Python | lgpl-3.0 | 699 |
""" some image manipulation functions like scaling, rotating, etc...
"""
from __future__ import print_function, unicode_literals, absolute_import, division
import numpy as np
from gputools import map_coordinates
from scipy import ndimage
import pytest
def create_shape(shape=(100, 110, 120)):
d = np.zeros(shape,... | maweigert/gputools | tests/transforms/test_map_coordinates.py | Python | bsd-3-clause | 1,538 |
# -*- coding: ISO-8859-15 -*-
# =============================================================================
# Copyright (c) 2008 Tom Kralidis
#
# Authors : Tom Kralidis <tomkralidis@gmail.com>
#
# Contact email: tomkralidis@gmail.com
# =============================================================================
imp... | kalxas/OWSLib | owslib/util.py | Python | bsd-3-clause | 30,793 |
'''
Created on 7 Oct 2009
@author: pnorton
'''
import re
import joj.lib.utils as utils
import joj.lib.config_file_parser as config_file_parser
from ConfigParser import NoOptionError, NoSectionError
from joj.lib.base import config
import logging
log = logging.getLogger(__name__)
class StatusBuilder(object):
'''
... | NERC-CEH/jules-jasmin | majic/joj/lib/status_builder.py | Python | gpl-2.0 | 8,747 |
from flask import request
from flask_restplus import Resource
from skf.api.security import security_headers, validate_privilege
from skf.api.code.business import update_code_item
from skf.api.code.serializers import code_properties, message
from skf.api.code.parsers import authorization
from skf.api.restplus import ap... | blabla1337/skf-flask | skf/api/code/endpoints/code_item_update.py | Python | agpl-3.0 | 1,148 |
import unittest
import math
from kivy3 import Vector3, Vector4, Vector2
# good values for vector 3, 4, 12, 84
class Vector3Test(unittest.TestCase):
def test_create(self):
v = Vector3(1, 2, 3)
self.assertEquals(v[0], 1)
self.assertEquals(v[1], 2)
self.assertEquals(v[2], 3)
... | nskrypnik/kivy3 | tests/test_vectors.py | Python | mit | 3,833 |
"""
We want to see how accurate the derivatives are as we increase the number of samples.
"""
import numpy
import logging
import sys
from sandbox.recommendation.MaxLocalAUCCython import derivativeUi, derivativeUiApprox
from sandbox.util.SparseUtils import SparseUtils
from sandbox.util.SparseUtilsCython import Sparse... | charanpald/wallhack | wallhack/rankingexp/DerivativeExp.py | Python | gpl-3.0 | 1,658 |
# Copyright (c) 2018-2019, NVIDIA 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 by a... | mlperf/training_results_v0.7 | NVIDIA/benchmarks/ssd/implementations/pytorch/ssd300.py | Python | apache-2.0 | 8,862 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2020 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
# Support for fake joystick/gamepad during development
# if no 'real' joystick/gamepad is ... | psychopy/versions | psychopy/experiment/components/joystick/virtualJoystick.py | Python | gpl-3.0 | 1,433 |
import numpy as np
import active
import config
def compute_accuracy(w, X_testing, Y_testing):
size = X_testing.shape[0]
predictions = active.linear_predictor(X_testing, w)
results = predictions == Y_testing
correct = np.count_nonzero(results)
accuracy = correct/size
return accuracy
def wei... | alasdairtran/mclearn | projects/david/lab/experiment.py | Python | bsd-3-clause | 1,510 |
# IVLE - Informatics Virtual Learning Environment
# Copyright (C) 2007-2009 The University of Melbourne
#
# 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
# (a... | dcoles/ivle | ivle/webapp/admin/publishing.py | Python | gpl-2.0 | 3,626 |
from PyQt4 import QtCore, QtGui
from MainWindow import *
from MorphogenesisImageData import MorphogenesisImageData
import sys, os, time
class WorkerThread ( QtCore.QThread ):
def __init__(self, controller, texture, maxIterations):
QtCore.QThread.__init__(self)
self.controller = controller
... | thomasdeniau/pyfauxfur | Controller.py | Python | bsd-3-clause | 5,163 |
import os.path
import json,codecs
import unreal_engine as ue
from unreal_engine import FVector,FRotator
from unreal_engine.classes import Actor, Pawn, Character, ProjectileMovementComponent, PawnSensingComponent, StaticMesh
from unreal_engine.classes import StaticMeshComponent, StaticMeshActor, PointLightComponent
cl... | meahmadi/ThreeDHighway | Content/Scripts/ObjectLoader.py | Python | apache-2.0 | 1,690 |
import json
import unittest
import ipuz
class IPUZBaseTestCase(unittest.TestCase):
def validate_puzzle(self, json_data, expected_exception, **kwargs):
with self.assertRaises(ipuz.IPUZException) as cm:
ipuz.read(json.dumps(json_data), **kwargs)
self.assertEqual(str(cm.exception), expe... | svisser/ipuz | tests/test_ipuz.py | Python | mit | 10,700 |
"""
This is the model that stimulates the behavior
of bacterias according to toxin and nutrients level.
"""
import sys
from random import randint
from indra.agent import Agent
from indra.composite import Composite
from indra.display_methods import BLUE, GREEN, RED
from indra.env import Env
from registry.registry impo... | gcallah/Indra | models/bacteria.py | Python | gpl-3.0 | 5,141 |
try:
import simplejson as json
except ImportError:
import json
import urllib2, socket
import cPickle as pickle
from time import strftime, localtime, time
def postRequest(obj):
#print obj
request = urllib2.Request("http://127.0.0.1/zabbix/api_jsonrpc.php")
request.add_header('Content-Type' , 'appli... | drbartz/zabbix_api | zabbix_api.py | Python | apache-2.0 | 22,095 |
DATE_FORMAT = 'Y-m-d'
DATETIME_FORMAT = 'Y-m-d H:i:s'
TIME_FORMAT = 'H:i'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'F j'
SHORT_DATE_FORMAT = 'Y-m-d'
SHORT_DATETIME_FORMAT = 'Y-m-d H:i:s'
#DECIMAL_SEPARATOR = ','
#THOUSAND_SEPARATOR = ' '
#NUMBER_GROUPING = 3 | ConnorMac/stokvel.io | src/config/formats/en-za/formats.py | Python | mit | 263 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... | EmanueleCannizzaro/scons | test/update-release-info/update-release-info.py | Python | mit | 7,356 |
from arena_sync import *
from stats import *
| siggame/webserver | webserver/hermes/tasks/__init__.py | Python | bsd-3-clause | 45 |
"""CPStats, a package for collecting and reporting on program statistics.
Overview
========
Statistics about program operation are an invaluable monitoring and debugging
tool. Unfortunately, the gathering and reporting of these critical values is
usually ad-hoc. This package aims to add a centralized place for gather... | paolodoz/timesheet | cherrypy/lib/cpstats.py | Python | gpl-2.0 | 22,573 |
# -*- coding: utf-8 -*-
"""Null device output module."""
from plaso.output import interface
from plaso.output import manager
class NullOutputModule(interface.OutputModule):
"""Null device output module."""
NAME = 'null'
DESCRIPTION = 'Output module that does not output anything.'
# pylint: disable=unused-a... | joachimmetz/plaso | plaso/output/null.py | Python | apache-2.0 | 711 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.