code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
import os
import random
import pygame
import sys
from util import utils
from time import sleep
square_l = 10
pacman_r, pacman_c = None, None
food_r, food_c = None, None
r,c = None, None
visited = []
fPath = []
def dfs(grid, start, end, path = []):
#print(start)
global visited
global fPath... | 5agado/intro-ai | src/test/mazeOfPacman.py | Python | apache-2.0 | 6,740 |
import sys
import time
import numpy as np
try:
import serial
except:
import pip
pip.main(['install','pyserial'])
import serial
from serial.tools import list_ports
class TCLab(object):
def __init__(self, port=None, baud=9600):
port = self.findPort()
print('Ope... | APMonitor/arduino | 0_Test_Device/Python/tclab/tclab.py | Python | apache-2.0 | 4,881 |
class ObjectXEDA:
kind= -1
name= ''
posX= 0
posY= 0
centerX= 0
centerY= 0
w= 0
h= 0
angle= 0
selected= False
mirrored= False
locked= False
glow= False
dragging= False
def is_over(self, x, y):
'''responde se a coordenada indicado esta sobre esse o... | xgvargas/xeda | sw/objects.py | Python | apache-2.0 | 2,224 |
from appkit.api.v0_2_8 import App
app = App(__name__)
@app.route("/")
def home():
return '<a href="#" target="_blank">Clique</a>'
app.run()
| diogocs1/facebookexplorer | teste.py | Python | apache-2.0 | 144 |
import sys
import traceback
from catalyst.errors import ZiplineError
def silent_except_hook(exctype, excvalue, exctraceback):
if exctype in [PricingDataBeforeTradingError, PricingDataNotLoadedError,
SymbolNotFoundOnExchange, NoDataAvailableOnExchange,
ExchangeAuthEmpty]:
... | enigmampc/catalyst | catalyst/exchange/exchange_errors.py | Python | apache-2.0 | 10,006 |
from gitcd.interface.cli.abstract import BaseCommand
from gitcd.git.branch import Branch
from gitcd.app.clean import Clean as CleanHelper
class Clean(BaseCommand):
updateRemote = True
def run(self, branch: Branch):
helper = CleanHelper()
branchesToDelete = helper.getBranchesToDelete()
... | claudio-walser/gitcd | gitcd/interface/cli/clean.py | Python | apache-2.0 | 1,028 |
# Copyright 2006 James Tauber and contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | lovelysystems/pyjamas | library/pyjamas/ui/CheckBox.py | Python | apache-2.0 | 3,250 |
"""Support for RESTful API sensors."""
import json
import logging
from xml.parsers.expat import ExpatError
import httpx
from jsonpath import jsonpath
import voluptuous as vol
import xmltodict
from homeassistant.components.sensor import DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA
from homeassistant.const import (
CONF_... | balloob/home-assistant | homeassistant/components/rest/sensor.py | Python | apache-2.0 | 9,072 |
"""Utility functions for FAUCET."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2018 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this ... | wackerly/faucet | faucet/valve_util.py | Python | apache-2.0 | 6,228 |
# -*- coding:utf-8 -*-
# Modified from https://github.com/tylerneylon/explacy
import io
from collections import defaultdict
from pprint import pprint
from phrasetree.tree import Tree
def make_table(rows, insert_header=False):
col_widths = [max(len(s) for s in col) for col in zip(*rows[1:])]
rows[0] = [x[:l] ... | hankcs/HanLP | plugins/hanlp_common/hanlp_common/visualization.py | Python | apache-2.0 | 10,303 |
from ..remote import RemoteModel
class SnmpMibRemote(RemoteModel):
"""
| ``id:`` none
| ``attribute type:`` string
| ``mib:`` none
| ``attribute type:`` string
| ``version:`` none
| ``attribute type:`` string
| ``source:`` none
| ``attribute type:`` string
| ``v... | infobloxopen/infoblox-netmri | infoblox_netmri/api/remote/models/snmp_mib_remote.py | Python | apache-2.0 | 532 |
#
# Copyright 2009 Facebook
#
# 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, s... | NoyaInRain/tornado | tornado/web.py | Python | apache-2.0 | 138,158 |
# Copyright 2014-2020 The PySCF Developers. 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 appl... | sunqm/pyscf | pyscf/agf2/test/test_c_agf2.py | Python | apache-2.0 | 4,413 |
import requests
from PIL import Image
from course import *
from utils import is_on_time, get_week
from io import BytesIO
url_course = 'https://wx.idsbllp.cn/redapi2/api/kebiao'
url_stu_info = 'https://we.cqu.pt/api/others/student.php?key='
url_photo = 'https://we.cqu.pt/api/others/photos.php?id='
data... | simonla/cyxbs_bot | network.py | Python | apache-2.0 | 1,669 |
''' Computes feature representations '''
from __future__ import division, print_function
from hscom import __common__
(print, print_, print_on, print_off,
rrr, profile) = __common__.init(__name__, '[fc2]')
# scientific
import numpy as np
# python
from os.path import join
# hotspotter
from hscom import helpers as util
... | Erotemic/hotspotter | hotspotter/feature_compute2.py | Python | apache-2.0 | 7,452 |
##############
# Standard #
##############
import io
import logging
import tempfile
##############
# External #
##############
import pytest
##############
# Module #
##############
import powermate
#Enable the logging level to be set from the command line
def pytest_addoption(parser):
parser.addoption('... | teddyrendahl/powermate | tests/conftest.py | Python | apache-2.0 | 1,119 |
# Copyright 2020 Google LLC
#
# 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, s... | PAIR-code/lit | lit_nlp/components/scrambler.py | Python | apache-2.0 | 2,899 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# 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... | kaneawk/shadowsocksr | shadowsocks/udprelay.py | Python | apache-2.0 | 25,937 |
import logging
from ..directives import directives_by_section
logger = logging.getLogger(__name__)
class Stanza(object):
"""
Subclass for config file stanzas.
In an HAProxy config file, a stanza is in the form of::
stanza header
directive
directive
directive
S... | wglass/lighthouse | lighthouse/haproxy/stanzas/stanza.py | Python | apache-2.0 | 2,087 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
from... | digwanderlust/pants | src/python/pants/backend/codegen/targets/java_wire_library.py | Python | apache-2.0 | 2,200 |
""" a custom layer for 'power', maybe we should implement this in standard way.
more info can be found here: http://caffe.berkeleyvision.org/tutorial/layers/power.html
"""
from .register import register
def power_shape(input_shape, shape=None):
""" calculate the output shape of this layer using input shape
... | kuke/models | fluid/PaddleCV/caffe2fluid/kaffe/custom_layers/power.py | Python | apache-2.0 | 1,292 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | adsorensen/girder | plugins/terms/server/__init__.py | Python | apache-2.0 | 3,937 |
import abc
from typing import Dict, List
class State(metaclass=abc.ABCMeta):
"""Base class for inheritable state objects, such as would represent an
input element's attributes."""
@abc.abstractproperty
def replacements(self) -> Dict[str, str]:
"""Return a dictionary mapping template replace... | jeff-allen-mongo/mut | mut/state.py | Python | apache-2.0 | 1,173 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | wolverineav/horizon-bsn | horizon_bsn/bsndashboard/networktemplate/panel.py | Python | apache-2.0 | 817 |
"""
Copyright 2020 Google LLC
Copyright 2020 PerfectVIPs 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 law or agreed t... | google/riscv-dv | pygen/pygen_src/isa/rv64f_instr.py | Python | apache-2.0 | 1,363 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | mbohlool/client-python | kubernetes/client/models/v1_group_version_for_discovery.py | Python | apache-2.0 | 4,487 |
# 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
# d... | noironetworks/group-based-policy | gbpservice/neutron/tests/unit/services/grouppolicy/test_extension_driver_api.py | Python | apache-2.0 | 19,823 |
''' get_snmp_name_desc.py '''
from snmp_helper import snmp_get_oid,snmp_extract
PORT=161
COMMUNITY='galileo'
rtrs={'pynet-rtr1':'184.105.247.70', 'pynet-rtr2':'184.105.247.71'}
oids={'sysName':'1.3.6.1.2.1.1.5.0', 'sysDescr':'1.3.6.1.2.1.1.1.0'}
for rtr in rtrs.keys():
print rtr
for oid in oids.keys():
... | dnsbob/pynet_testz | SNMP/get_snmp_name_desc.py | Python | apache-2.0 | 418 |
# -*- 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/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/afi_safis/afi_safi/l2vpn_evpn/prefix_limit/config/__init__.py | Python | apache-2.0 | 38,585 |
# -*- 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/network_instances/network_instance/protocols/protocol/isis/levels/level/link_state_database/lsp/tlvs/tlv/is_reachability/neighbors/neighbors_/delay_metric/state/__init__.py | Python | apache-2.0 | 23,483 |
from .helper import *
import open_cp.gui.predictors.sepp2 as sepp2
import open_cp.gui.predictors.predictor
#import datetime
@pytest.fixture
def analysis_model2(analysis_model):
analysis_model.time_range = (datetime.datetime(2017,5,21,12,30),
datetime.datetime(2017,5,21,13,30), Non... | QuantCrimAtLeeds/PredictCode | tests/gui/predictors/sepp2_test.py | Python | artistic-2.0 | 2,313 |
# TempConv.py
# Celcius to Fahreinheit
def Fahreinheit(temp):
temp = float(temp)
temp = (temp*9/5)+32
return temp
# Fahreinheit to Celcius
def Celcius(temp):
temp = float(temp)
temp = (temp-32)*5/9
return temp
| megatharun/basic-python-for-researcher | TempConv.py | Python | artistic-2.0 | 243 |
import os
import logging
import claripy
from ..errors import (
AngrSimOSError,
TracerEnvironmentError,
SimSegfaultException,
SimUnsupportedError,
SimZeroDivisionException,
)
from .. import sim_options as o
from ..tablespecs import StringTableSpec
from ..procedures import SIM_LIBRARIES as L
from .... | f-prettyland/angr | angr/simos/windows.py | Python | bsd-2-clause | 20,273 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sleeptomusicweb.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| beddit/sleep-musicalization-web | manage.py | Python | bsd-2-clause | 258 |
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "AWS Budget Service"
prefix = "budgets"
class Action(BaseAction):
def __init__(self, action: str = None) -> None:
... | cloudtools/awacs | awacs/budgets.py | Python | bsd-2-clause | 1,133 |
from tests import tests
def test_toggle():
temporary = tests.toggled_seats
assert temporary == [[1, 1, 1], [1, 1, 1], [1, 1, 1]] | kevindiltinero/seass3 | tests/test_toggle.py | Python | bsd-2-clause | 137 |
# Copyright (c) 2013-2021, Freja Nordsiek
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions ... | frejanordsiek/hdf5storage | tests/test_hdf5_filters.py | Python | bsd-2-clause | 7,723 |
'''The script reads in a list of genes from an output from DAVID and reads in
expression data from a text file containing corresponding genes and report
an expression level of each gene in DAVID list to standard output.
Both gene expression and DAVID files should be in a comma-delimited format.
'''
import sys
david... | likit/BioUtils | david2expr.py | Python | bsd-2-clause | 851 |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, 2015, Stephan Rave
# 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 copyright notice, this
#... | sdrave/simdb | simdb/db.py | Python | bsd-2-clause | 14,333 |
import numpy as np
import ctypes
import numpy.ctypeslib as npct
# For more information see:
# https://scipy-lectures.github.io/advanced/interfacing_with_c/interfacing_with_c.html#id5
numpy2go = npct.load_library("numpy2go", ".")
array_1d_double = npct.ndpointer(dtype=np.double, ndim=1, flags='CONTIGUOUS')
numpy... | ryanbressler/numpy2go | numpy2go.py | Python | bsd-2-clause | 496 |
import logging
import pandas as pd
import matplotlib.pyplot as plt
def running_total_comparison(df1, window=15):
fig_size = [12,12]
xlim = [0,365]
ylim = [0,max(df1.Pages)]
years = df1.Year.unique()[-window:].tolist()
y = years.pop(0)
_df = df1.loc[df1.Year == y]
ax = _df.plot("Day", "Page... | DrSkippy/php_books_database | tools/bookdbtool/visualizations.py | Python | bsd-2-clause | 1,064 |
"""
@package mi.dataset.driver.optaa_dj.cspp
@file mi-dataset/mi/dataset/driver/optaa_dj/cspp/optaa_dj_cspp_telemetered_driver.py
@author Joe Padula
@brief Telemetered driver for the optaa_dj_cspp instrument
Release notes:
Initial Release
"""
__author__ = 'jpadula'
from mi.dataset.dataset_driver import SimpleDatase... | JeffRoy/mi-dataset | mi/dataset/driver/optaa_dj/cspp/optaa_dj_cspp_telemetered_driver.py | Python | bsd-2-clause | 2,238 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Run GMAP/GSNAP commands. GMAP/GSNAP manual:
<http://research-pub.gene.com/gmap/src/README>
"""
import os.path as op
import sys
import logging
from jcvi.formats.sam import get_prefix
from jcvi.apps.base import OptionParser, ActionDispatcher, need_update, sh, \
... | sgordon007/jcvi_062915 | apps/gmap.py | Python | bsd-2-clause | 5,206 |
# coding: utf-8
# Copyright (c) 2012, SciELO <scielo-dev@googlegroups.com>
# 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 copyright not... | scieloorg/scielo-django-extensions | scielo_extensions/formfields.py | Python | bsd-2-clause | 1,891 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
An auto-reloading standalone wiki server, useful for development.
"""
import hatta
import werkzeug
if __name__=="__main__":
config = hatta.WikiConfig()
config.parse_args()
# config.parse_files()
application = hatta.Wiki(config).application
host = ... | thuydang/djagazin | docs/9_tmp/hatta-wiki-1.5.3/dev.py | Python | bsd-2-clause | 466 |
def _iter(target, method, key):
iterable = target if method is None else getattr(target, method)()
iterator = iter(iterable)
if key is None:
return iterator
if not callable(key):
raise TypeError('{!r} is not callable'.format(type(key).__name__))
return (each for each in iterator i... | aguerra/python-stuff | stuff/collections.py | Python | bsd-2-clause | 604 |
from orangecontrib.recommendation.tests.coverage.base_tests \
import TestRatingModels, TestRankingModels | salvacarrion/orange3-recommendation | orangecontrib/recommendation/tests/coverage/__init__.py | Python | bsd-2-clause | 108 |
# -*- coding: utf-8 -*-
import re
from datetime import datetime
from markdown import Markdown
from flask import render_template, redirect, request, g, url_for, Markup, abort, flash, escape
from flask.ext.lastuser import LastUser
from flask.ext.lastuser.sqlalchemy import UserManager
from coaster.views import get_next_... | piyushroshan/fossmeet | views.py | Python | bsd-2-clause | 27,799 |
#from interface.services.icontainer_agent import ContainerAgentClient
#from pyon.ion.endpoint import ProcessRPCClient
from pyon.public import Container, log, IonObject
from pyon.util.containers import DotDict
from pyon.util.int_test import IonIntegrationTestCase
from interface.services.coi.iresource_registry_service i... | ooici/coi-services | ion/services/sa/observatory/test/test_observatory_negotiation.py | Python | bsd-2-clause | 2,839 |
def add(x, y):
"""Add two numbers"""
return x + y
| computationalmodelling/python-package-template | package_template/arith.py | Python | bsd-2-clause | 58 |
from PyQt4 import QtCore
import numpy
from ilastik.core import dataImpex
import shlex
from ilastik.core.listOfNDArraysAsNDArray import ListOfNDArraysAsNDArray
from ilastik.core.overlays.selectionOverlay import SelectionAccessor
from subprocess import Popen, PIPE
import h5py
# this is the core replacement of the guiThr... | ilastik/ilastik-0.5 | ilastik/core/testThread.py | Python | bsd-2-clause | 6,464 |
from ticdat import TicDatFactory, Model, utils
from ticdat.model import cplex, gurobi, xpress
from ticdat.testing.ticdattestutils import dietSolver, nearlySame, netflowSolver
from ticdat.testing.ticdattestutils import fail_to_debugger, flagged_as_run_alone
import unittest
import os
import inspect
def _codeFile() :
... | opalytics/opalytics-ticdat | ticdat/testing/testmodel.py | Python | bsd-2-clause | 10,941 |
from __future__ import absolute_import, print_function, division
import numpy as np
from matplotlib.colors import LinearSegmentedColormap,ListedColormap
import sys
__author__ = "Juhyeong Kang "
__email__ = "jhkang@astro.snu.ac.kr"
def create_cdict(r, g, b):
i = np.linspace(0, 1, 256)
cdict = dict(
... | SNU-sunday/fisspy | fisspy/cm.py | Python | bsd-2-clause | 19,011 |
"""
System services
===============
This module provides low-level tools for managing system services,
using the ``service`` command. It supports both `upstart`_ services
and traditional SysV-style ``/etc/init.d/`` scripts.
.. _upstart: http://upstart.ubuntu.com/
"""
from __future__ import with_statement
from fabri... | pahaz/fabtools | fabtools/service.py | Python | bsd-2-clause | 2,235 |
from pylab import *
t1 = arange(0.0, 5.0, 0.1)
t2 = arange(0.0, 5.0, 0.02)
t3 = arange(0.0, 2.0, 0.01)
subplot(211)
plot(t1, cos(2*pi*t1)*exp(-t1), 'bo', t2, cos(2*pi*t2)*exp(-t2), 'k')
grid(True)
title('A tale of 2 subplots')
ylabel('Damped')
subplot(212)
plot(t3, cos(2*pi*t3), 'r--')
grid(True)
xlabel('time (s)')... | sniemi/SamPy | sandbox/src1/subplot_demo.py | Python | bsd-2-clause | 349 |
OperandLookupTable = b''.join([
b'\x81\xbd\x81\xbd\x41\x7d\x00\x00\x81\xbd\x81\xbd\x41\x7d\x00\x00'
b'\x81\xbd\x81\xbd\x41\x7d\x00\x00\x81\xbd\x81\xbd\x41\x7d\x00\x00'
b'\x81\xbd\x81\xbd\x41\x7d\x00\x00\x81\xbd\x81\xbd\x41\x7d\x00\x00'
b'\x81\xbd\x81\xbd\x41\x7d\x00\x00\x81\xbd\x81\xbd\x41\x7d\x00\x00'
... | arizvisa/syringe | lib/ia32/_optable.py | Python | bsd-2-clause | 2,339 |
import numpy as np
# f(x) = a*x*x*x + b*x*x + c*x + d
# f'(x) = 3*a*x*x + 2*b*x + c
#
# d = x0
# c = dx0
# a + b + c + d = x1
# 3*a + 2*b + c = dx1
#
# a + b + dx0 + x0 = x1
# a + b = x1 - x0 - dx0
# a = x1 - x0 - dx0 - b
#
# 3*a + 2*b + dx0 = dx1
# 3*a + 2*b = dx1 - dx0
# 3*(x1 - x0 - dx0 - b) + 2*b = dx1 - dx0
# -3... | dyf/primopt | spline.py | Python | bsd-2-clause | 1,314 |
import sys, unittest, struct, math, ctypes
from binascii import hexlify
from ctypes import *
def bin(s):
return hexlify(memoryview(s)).decode().upper()
# Each *simple* type that supports different byte orders has an
# __ctype_be__ attribute that specifies the same type in BIG ENDIAN
# byte order, and a... | Suwmlee/XX-Net | Python3/lib/ctypes/test/test_byteswap.py | Python | bsd-2-clause | 11,726 |
# -*- coding: UTF-8 -*-
# Copyright 2008-2018 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
"""Database models for this plugin.
"""
from __future__ import unicode_literals, print_function
import six
from builtins import str
import logging
logger = logging.getLogger(__name__)
import datetime
from d... | khchine5/xl | lino_xl/lib/ledger/models.py | Python | bsd-2-clause | 32,456 |
from __future__ import print_function, division
import sys,os
qspin_path = os.path.join(os.getcwd(),"../")
sys.path.insert(0,qspin_path)
#
from quspin.operators import hamiltonian # Hamiltonians and operators
from quspin.basis import spin_basis_1d # Hilbert space spin basis
from quspin.tools.measurements import mean_l... | weinbe58/QuSpin | tests/mean_level_spacing_test.py | Python | bsd-3-clause | 1,223 |
from django.contrib import admin
from puzzle_captcha.models import Puzzle, PuzzlePiece
class PuzzlePieceInline(admin.StackedInline):
model = PuzzlePiece
readonly_fields = ('key', 'image', 'order')
can_delete = False
extra = 0
class PuzzleAdmin(admin.ModelAdmin):
list_display = ('key', 'rows', 'col... | MegaMark16/django-puzzle-captcha | puzzle_captcha/admin.py | Python | bsd-3-clause | 505 |
# proxy module
from __future__ import absolute_import
from apptools.type_manager.hook import *
| enthought/etsproxy | enthought/type_manager/hook.py | Python | bsd-3-clause | 95 |
# This file is part of the ISIS IBEX application.
# Copyright (C) 2012-2016 Science & Technology Facilities Council.
# All rights reserved.
#
# This program is distributed in the hope that it will be useful.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License... | ISISComputingGroup/EPICS-inst_servers | BlockServer/test_modules/test_active_config_holder.py | Python | bsd-3-clause | 26,201 |
# Copyright (c) 2015, Simone Margaritelli <evilsocket at gmail dot com>
# 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 copyright notic... | evilsocket/arminject | trace_pid.py | Python | bsd-3-clause | 2,396 |
def extractMtllightnovelCom(item):
'''
Parser for 'mtllightnovel.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('devil\'s son-in-law', 'Devil\'s Son-in-Law', 'tra... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractMtllightnovelCom.py | Python | bsd-3-clause | 635 |
#!/usr/bin/env python
# Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project
# All rights reserved.
#
# This file is part of NeuroM <https://github.com/BlueBrain/NeuroM>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fol... | BlueBrain/NeuroM | examples/plot_somas.py | Python | bsd-3-clause | 2,929 |
from holodeck.settings import *
import os
import sys
# Django settings for Holodeck project.
PATH = os.path.split(os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]))))[0]
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
# Local time zone for t... | shaunsephton/holodeck | holodeck/django_settings.py | Python | bsd-3-clause | 5,258 |
# project.py
import signac
def classify(job):
yield 'init'
if 'V' in job.document:
yield 'volume-computed'
def next_operation(job):
if 'volume-computed' not in classify(job):
return 'compute_volume'
if __name__ == '__main__':
project = signac.get_project()
print(project)
for ... | csadorf/signac | examples/ideal_gas_project/project.py | Python | bsd-3-clause | 472 |
from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper
from crispy_forms.layout import ButtonHolder, Div, Fieldset, HTML, Layout, Submit
from django import forms
from django.core.validators import EmailValidator, email_re
from django.core.urlresolvers import reverse
from django.forms.... | gmimano/commcaretest | corehq/apps/users/forms.py | Python | bsd-3-clause | 11,739 |
import os, os.path
import pexpect
import subprocess
from astropy.io import fits
import numpy as np
from optparse import OptionParser
import sys
import tempfile
from ftplib import FTP
import shutil
_ERASESTR= " "
def get_agetables(args,opti... | jobovy/apogee-maps | py/get_agetables.py | Python | bsd-3-clause | 3,237 |
import collections
import hashlib
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from corehq.util.soft_assert import soft_assert
from corehq import privileges, toggles
from corehq.apps.hqwebapp.templatetags.hq_shared_tags import toggle_enabled
from corehq.apps.userreports.con... | qedsoftware/commcare-hq | corehq/apps/userreports/util.py | Python | bsd-3-clause | 5,418 |
# coding: utf-8
from hyper import hyper
from numba import jit
@jit(nopython=True)
def hyp_battin(x):
return hyper.hyp2f1(3, 1, 5/2, x)
if __name__ == '__main__':
print(hyp_battin(0.5))
| Pybonacci/cffi_test | examples/example_numba.py | Python | bsd-3-clause | 197 |
import sys
import inspect
import os
import numpy as np
import time
import timeit
import collections
import subprocess
from qtools.qtpy import QtCore, QtGui
from qtools.utils import get_application, show_window
from functools import wraps
from galry import log_debug, log_info, log_warn
from collections import OrderedDic... | rossant/galry | galry/tools.py | Python | bsd-3-clause | 4,093 |
from model_utils import Choices
SPONSOR_TYPES = Choices(
('diamond', 'DIAMOND', 'Diamond Sponsor'),
('lanyard', 'LANYARD', 'Lanyard Sponsor'),
('track', 'TRACK', 'Track Sponsor'),
('foodanddrinks', 'FOOD_AND_DRINKS', 'Food & Drinks Sponsor'),
('lounge', 'LOUNGE', 'Lounge Sponsor'),
('standard',... | WebCampZg/conference-web | sponsors/choices.py | Python | bsd-3-clause | 548 |
from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup
HERE = path.dirname(path.abspath(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, 'datadog_checks', 'riak_repl', '__about__.py')) as f:
exec(f.read(), ABOUT)
# Get the long description from... | DataDog/integrations-extras | riak_repl/setup.py | Python | bsd-3-clause | 2,385 |
from __future__ import unicode_literals
import datetime
import re
import warnings
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.models.loading import get_model
from django.utils import six
import haystack
from haystack.backends import BaseEngine, BaseSearchBacke... | zhangtianyi1234/django-haystack | haystack/backends/elasticsearch_backend.py | Python | bsd-3-clause | 37,888 |
from casexml.apps.case.xform import get_case_ids_from_form
from corehq.apps.change_feed import topics
from corehq.apps.change_feed.producer import producer
from corehq.apps.change_feed import data_sources
from corehq.form_processor.interfaces.dbaccessors import FormAccessors, CaseAccessors
from corehq.form_processor.si... | qedsoftware/commcare-hq | corehq/form_processor/change_publishers.py | Python | bsd-3-clause | 4,539 |
# last modified 10.3.2009
class StatsError(Exception):
"""
Exception raised for errors resulting from collection
of statistical information about the grid.
Attributes:
expression -- input expression in which error occurred
message -- explanation of error
"""
def __init__(self... | placiflury/gridmonitor-infocache | infocache/errors/stats.py | Python | bsd-3-clause | 593 |
# -*- coding: utf-8 -*-
"""
banner
Description goes here...
:copyright: (c) 2014 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
import unittest
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException... | arpitprogressive/arpittest | intergration_test/banner.py | Python | bsd-3-clause | 18,254 |
""" Computes the Control Flow Graph of a function. """
from pythran.passmanager import FunctionAnalysis
import ast
import networkx as nx
class CFG(FunctionAnalysis):
"""
Computes the Control Flow Graph of a function.
The processing of a node yields a pair containing
* the OUT nodes, to be linked wi... | artas360/pythran | pythran/analyses/cfg.py | Python | bsd-3-clause | 4,991 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include
from django.conf.urls import url
from django.contrib import admin
from django.views.i18n import JavaScriptCatalog
from demo.apps.app import application
js_info_dict = {
'package... | reinbach/django-machina | example_projects/demo/demo_project/urls.py | Python | bsd-3-clause | 1,208 |
from django import forms
from order.models import Pizza, Bread, Customer
class PizzaForm(forms.ModelForm):
class Meta:
model = Pizza
fields = ('size', 'toppings', 'crust')
widgets = {
'size': forms.RadioSelect(),
'crust': forms.RadioSelect(),
'toppings': forms.C... | ajpocus/pizzeria | order/forms.py | Python | bsd-3-clause | 1,411 |
from unittest import mock
from .. import *
from bfg9000.tools.ld import LdLinker
from bfg9000.path import abspath
from bfg9000.versioning import Version
def mock_execute(args, **kwargs):
return 'SEARCH_DIR("/dir1")\nSEARCH_DIR("=/dir2")\n'
class TestLdLinker(CrossPlatformTestCase):
def __init__(self, *arg... | jimporter/bfg9000 | test/unit/tools/test_ld.py | Python | bsd-3-clause | 2,557 |
VERSION = (0, 1, 5)
__version__ = '.'.join(map(str, VERSION))
| briandailey/django-pyres | django_pyres/__init__.py | Python | bsd-3-clause | 63 |
# -*- coding: utf-8 -*-
from setuptools import find_packages, setup
with open('README.rst') as r:
readme = r.read()
with open('AUTHORS.txt') as a:
# reSt-ify the authors list
authors = ''
for author in a.read().split('\n'):
authors += '| '+author+'\n'
with open('LICENSE.txt') as l:
licen... | ShopRunner/jupyter-notify | setup.py | Python | bsd-3-clause | 1,019 |
import soco
from collections import namedtuple
SonosTrack = namedtuple('SonosTrack', [
'title', 'artist', 'album', 'album_art_uri', 'position',
'playlist_position', 'duration', 'uri', 'resources', 'album_art',
'metadata'
])
SonosTrack.__new__.__defaults__ = (None,) * len(SonosTrack._fields)
class Track(S... | andpe/minos | minos/sonos/__init__.py | Python | bsd-3-clause | 3,903 |
from distutils.core import setup
setup(
name='Korail',
packages=['korail'],
version='0.0.3',
description='An unoffical API for Korail.',
long_description=open('README.rst').read(),
license='BSD License',
author='Su Yeol Jeon',
author_email='devxoul@gmail.com',
url='https://github.co... | devxoul/korail | setup.py | Python | bsd-3-clause | 460 |
import unittest
import os
from pprint import pprint
import pym_elfinder.exceptions as exc
from .. import lib
from .. import lib_localfilesystem as lfs
class TestCmdRm(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.finder = lib.create_finder()
cls.fixt = lib.CMD_FIXT['cmd_rm.txt']... | dmdm/Pym-elFinder | pym_elfinder_tests/t002_functional/test_3080_cmd_rm.py | Python | bsd-3-clause | 1,935 |
import time
from subprocess import *
PATH = "/home/richie_rich/OSProj/redis-OS-project/src/redis-cli"
p1 = Popen([PATH], shell=True, stdin=PIPE)
p1.communicate(input="FLUSHALL")
strength = 1000000
rangeVal = strength + 1
string = "set key"
string1 = ""
count = 0
for i in xrange(1,rangeVal):
count = count + 1
... | richasinha/redis-OS-project | src/setRedis.py | Python | bsd-3-clause | 595 |
import unittest
from TASSELpy.TASSELbridge import TASSELbridge
from TASSELpy.test.net.maizegenetics.analysis.association.FixedEffectLMPlugin import easy_GLMTest
class associationTestSuite(unittest.TestSuite):
def __init__(self):
super(associationTestSuite, self).__init__()
self.addTest(unittest.mak... | er432/TASSELpy | TASSELpy/test/net/maizegenetics/analysis/association/associationTestSuite.py | Python | bsd-3-clause | 472 |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Copyright (c) 2019 The ungoogled-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.
"""
Module for the downloading, checking, and unpacking of necessary files into the source tree.... | Eloston/ungoogled-chromium | utils/downloads.py | Python | bsd-3-clause | 17,917 |
from skimage.data import coffee, camera
from sklearn_theano.feature_extraction.caffe.googlenet import (
GoogLeNetTransformer, GoogLeNetClassifier)
import numpy as np
from nose import SkipTest
import os
co = coffee().astype(np.float32)
ca = camera().astype(np.float32)[:, :, np.newaxis] * np.ones((1, 1, 3),
... | kastnerkyle/sklearn-theano | sklearn_theano/feature_extraction/caffe/tests/test_googlenet.py | Python | bsd-3-clause | 908 |
import logging
import os.path
import shutil
import sys
import tempfile
import fiona
def test_options(tmpdir=None):
"""Test that setting CPL_DEBUG=ON works"""
if tmpdir is None:
tempdir = tempfile.mkdtemp()
logfile = os.path.join(tempdir, 'example.log')
else:
logfile = str(tmpdir.j... | johanvdw/Fiona | tests/test_drivers.py | Python | bsd-3-clause | 760 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
requirements = [
# TODO: put package requirements here
]
test_requi... | Carreau/sphinx_numfig | setup.py | Python | bsd-3-clause | 1,529 |
# -*- coding: utf-8 -*-
# Copyright 2012 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
class CookiesTest(object):
def test_create_and_access_a_cookie(self):
"should be able to create and access a cookie"
... | nikolas/splinter | tests/cookies.py | Python | bsd-3-clause | 3,162 |
try:
import simplejson
except ImportError:
import json as simplejson
from .meta import DocumentMeta, BaseDocumentSession
json_objects = []
class JSONDocument(object):
"""
JSON Document base class
"""
__metaclass__ = DocumentMeta
def __init__(self, **kwargs):
json_objects.appe... | bossiernesto/onyx | persistance/documents/json_doc.py | Python | bsd-3-clause | 703 |
from __future__ import absolute_import, print_function
from django.db import models
from django.utils import timezone
from sentry.db.models import FlexibleForeignKey, Model, sane_repr
from sentry.models.search_common import SearchType
class SavedSearch(Model):
"""
A saved search query.
"""
__core__... | beeftornado/sentry | src/sentry/models/savedsearch.py | Python | bsd-3-clause | 2,419 |
import re, datetime
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.http import Http404
from django.views.generic import date_based, list_detail
from basic.events.models import *
def event_list(request, page=0):
return list_detail.object_l... | sedden/django-basic-apps | basic/events/views.py | Python | bsd-3-clause | 1,774 |
import learn
import inject
import project
from build_surrogate import build_surrogate
from ActiveSubspace import ActiveSubspace
| aerialhedgehog/VyPy | trunk/VyPy/regression/active_subspace/__init__.py | Python | bsd-3-clause | 139 |
# -*- coding: utf-8 -*-
"""
:copyright: (c) 2014 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
from trytond.model import ModelSQL, ModelView, fields
from trytond.pool import PoolMeta, Pool
from trytond.pyson import Eval, Bool
from trytond.transaction import T... | openlabs/trytond-carrier-zone | carrier.py | Python | bsd-3-clause | 4,654 |