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 2012-present Yunify, Inc.
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the Licens... | yunify/qingcloud-cli | qingcloud/cli/iaas_client/actions/s2/attach_to_s2_shared_target.py | Python | apache-2.0 | 2,022 |
"""Support for Honeywell Lyric climate platform."""
from __future__ import annotations
import logging
from time import localtime, strftime, time
from aiolyric.objects.device import LyricDevice
from aiolyric.objects.location import LyricLocation
import voluptuous as vol
from homeassistant.components.climate import Cl... | rohitranjan1991/home-assistant | homeassistant/components/lyric/climate.py | Python | mit | 10,847 |
from matplotlib import rc
from matplotlib import rcParams
font_size=14
rcParams["backend"] = "PDF"
rcParams["figure.figsize"] = (4, 3)
rcParams["font.family"] = "Serif"
rcParams["font.serif"] = ["Palatino"]
rcParams["font.size"] = font_size
rcParams["axes.labelsize"] = font_size
rcParams["xtick.labelsize"] = font_size... | johankaito/fufuka | graph-tool/doc/pyenv.py | Python | apache-2.0 | 1,258 |
# -*- coding: utf-8 -*-
import inspect
import itertools
import logging
import math
import re
import urlparse
import werkzeug
import werkzeug.exceptions
import werkzeug.utils
import werkzeug.wrappers
# optional python-slugify import (https://github.com/un33k/python-slugify)
try:
import slugify as slugify_lib
except... | browseinfo/odoo_saas3_nicolas | addons/website/models/website.py | Python | agpl-3.0 | 27,340 |
from __future__ import print_function
from builtins import range
from util import hook, http
import random
def card_search(name):
matching_cards = http.get_json(
"https://api.magicthegathering.io/v1/cards", name=name
)
for card in matching_cards["cards"]:
if card["name"].lower() == name.lo... | jmgao/skybot | plugins/mtg.py | Python | unlicense | 2,470 |
import subprocess
import sys
import setup_util
import os
def start(args, logfile, errfile):
try:
subprocess.check_call("mvn clean compile assembly:single", shell=True, cwd="grizzly-bm", stderr=errfile, stdout=logfile)
subprocess.Popen("java -Dorg.glassfish.grizzly.nio.transport.TCPNIOTransport.max-receive-bu... | seem-sky/FrameworkBenchmarks | grizzly-bm/setup.py | Python | bsd-3-clause | 904 |
#from django.test import TestCase
from django.test import TestCase
from submission.models import URL, Archive, Code, StudentSubmission, select_all_components, ALL_TYPE_CLASSES
from submission.models.code import SubmittedCode
from submission.forms import filetype
from grades.models import NumericActivity, Activity
from... | sfu-fas/coursys | submission/tests.py | Python | gpl-3.0 | 18,007 |
from flask import Response, render_template
from model import blog
from . import handlers
@handlers.route('/')
def index():
return render_template('index.html')
@handlers.route('/showcase')
def showcase():
return render_template('showcase.html')
@handlers.route('/picscan')
def picscan():
return render_temp... | codeka/website | handlers/main.py | Python | mit | 1,134 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-container | google/cloud/container_v1/services/cluster_manager/transports/base.py | Python | apache-2.0 | 22,997 |
#
# Copyright SAS Institute
#
# 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... | sassoftware/sas_kernel | sas_kernel/magics/prompt4var_magic.py | Python | apache-2.0 | 3,243 |
#
# This file is part of Dragonfly.
# (c) Copyright 2007, 2008 by Christo Butcher
# Licensed under the LGPL.
#
# Dragonfly is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the L... | wolfmanstout/dragonfly | dragonfly/engines/__init__.py | Python | lgpl-3.0 | 9,160 |
# Copyright (c) 2007 Enough Project.
# See LICENSE for details.
import pygame
import contextlib
import gui.draw
@contextlib.contextmanager
def pygame_display(*args, **kw):
pygame.init()
try:
yield gui.draw.set_mode(*args, **kw)
except:
import sys
sys.last_type, sys.last_value, sys.... | waldyrious/GraphUI | gui/main.py | Python | gpl-3.0 | 478 |
# -*- coding: utf-8 -*-
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Enumerates all Chrome OS packages that are marked as `hot`.
Dumps results as a list of package names to a JSON file. Hotness i... | endlessm/chromium-browser | third_party/chromite/scripts/enumerate_hot_packages.py | Python | bsd-3-clause | 3,585 |
#!/usr/bin/env python
#import sys and global var libraries, as well as option parser to make command line args
import os,sys
import glob
from optparse import OptionParser
#first, define system call with default retval for debugging
def mysystem(s,defaultretval=0):
#allows us to set effective debug flag
global... | vincentbetro/NACA-SIM | scripts/adaptationruns1.py | Python | gpl-2.0 | 9,065 |
import json
from sqlalchemy import Column, Integer, String
from geoalchemy2 import Geometry
from geoindex.extensions import db
import geoalchemy2.functions as geofunc
class Boundary(db.Model):
__tablename__ = 'boundary'
id = Column(Integer, primary_key=True)
name = Column(String)
code = Column(St... | openregister/geoindex | geoindex/frontend/models.py | Python | mit | 862 |
from flask import current_app
from flask_login import AnonymousUserMixin
from datetime import datetime, date
from decimal import Decimal
class SerializerMixin(object):
__public__ = None
"""Must be implemented by implementors"""
def _get_fields(self):
for f in self.__mapper__.iterate_properties:
... | certeu/do-portal | app/utils/mixins.py | Python | bsd-3-clause | 2,296 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'johnx'
__date__ = '11/18/13 1:11 PM'
from stalk.session import SessionManager
from stalk.util import make_client, run_command, CONFIG
from stalk.head_quarters import HeadQuarters, CommandNotImplemented
admin_email = CONFIG['admin_email']
command_lead = CON... | boyxuper/server_talk | script/server.py | Python | apache-2.0 | 1,195 |
from __future__ import absolute_import
from rest_framework.response import Response
from sentry import options
from sentry.api.bases.project import ProjectEndpoint
from sentry.models import ProjectKey
class ProjectDocsEndpoint(ProjectEndpoint):
def get(self, request, project):
data = options.get('sentry... | imankulov/sentry | src/sentry/api/endpoints/project_docs.py | Python | bsd-3-clause | 626 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'CultivosAnuales'
db.create_table(u'encuesta_cultivosanual... | CARocha/addac_fadcanic | encuesta/migrations/0005_auto__add_cultivosanuales__add_productoanimal__add_productoprocesado__.py | Python | gpl-3.0 | 26,202 |
"""
Tests for contentstore.views.preview.py
"""
import re
import ddt
import mock
from django.test.client import Client, RequestFactory
from xblock.core import XBlock, XBlockAside
from contentstore.utils import reverse_usage_url
from contentstore.views.preview import _preview_module_system, get_preview_fragment
from s... | angelapper/edx-platform | cms/djangoapps/contentstore/views/tests/test_preview.py | Python | agpl-3.0 | 7,455 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-12 10:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('db', '0050_auto_20161112_2133'),
]
operations = [
migrations.AlterField(
... | caw/curriculum | db/migrations/0051_auto_20161112_2140.py | Python | gpl-3.0 | 543 |
# -*- coding: utf-8 -*-
from unittest import TestCase
from app.crypto import CryptoKey
from app.database import Database
from app.hosts import Hosts
class BaseTestCase(TestCase):
def setUp(self):
self.db = Database('sqlite://', echo=False) # in memory database
self.db.create()
self.ck = C... | szatanszmatan/myrdp | tests/__init__.py | Python | gpl-2.0 | 424 |
#User
#Add User
AddUser="KKWebVideoDL_EventID_User_Add"
#Verify User
VefUser="KKWebVideoDL_EventID_User_VefUser"
#Disable User
DisableUser="KKWebVideoDL_EventID_User_Disable"
#Task
#Add
AddTask="KKWebVideoDL_EventID_Task_Add"
#File
#Create
CreateFile="KKWebVideoDL_EventID_File_Create"
#Achive
AchivedFile="KK... | xiaokangwang/KKWebVideoDL-X | eventID.py | Python | gpl-3.0 | 418 |
from splice.environment import Environment
# flask_restful doesn't allow multiple initializations
register_flask_restful = False
def setup_routes(app):
env = Environment.instance()
global register_flask_restful
if "signing" in env.config.ALLOWED_APPS:
import splice.web.api.content
splic... | ncloudioj/splice | splice/webapp.py | Python | mpl-2.0 | 1,502 |
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
# pygtail - a python "port" of logtail2
# Copyright (C) 2011 Brad Greenlee <brad@footle.org>
#
# Derived from logcheck <http://logcheck.org>
# Copyright (C) 2003 Jonathan Middleton <jjm@ixtab.org.uk>
# Copyright (C) 2001 Paul Slootman <paul@debian.org>
#
# This program is ... | mariodebian/server-stats-system-agent | sssa/pygtail.py | Python | gpl-2.0 | 6,429 |
from db import db
class ItemModel(db.Model):
__tablename__ = 'items'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
price = db.Column(db.Float(precision=2))
store_id = db.Column(db.Integer, db.ForeignKey('stores.id'))
store = db.relationship('StoreModel')
de... | ysabel31/Python | flask-06-SQL_Alchemy/code/models/item.py | Python | mit | 1,119 |
# -*- 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/extended_is_reachability/neighbors/neighbors_/subTLVs/subTLVs_/lan_adjacency_sid/sid/state/__init__.py | Python | apache-2.0 | 39,959 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleinterns/new-semantic-parsing | new_semantic_parsing/callbacks.py | Python | apache-2.0 | 1,597 |
"""
Example subclass of the Graph class.
"""
# Author: Aric Hagberg (hagberg@lanl.gov)
# Copyright (C) 2004-2016 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
#
__docformat__ = "restructuredtext en"
from ... | JFriel/honours_project | networkx/examples/subclass/printgraph.py | Python | gpl-3.0 | 4,152 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# git-agile documentation build configuration file, created by
# sphinx-quickstart on Sat Feb 6 13:21:38 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# ... | lsbardel/ccy | docs/conf.py | Python | bsd-3-clause | 9,576 |
# -*- coding: utf-8 -*-
from django.db import models
from django.utils import six
class ShowFieldBase(object):
""" base class for the ShowField... model mixins, does the work """
# cause nicer multiline PolymorphicQuery output:
polymorphic_query_multiline_output = True
polymorphic_showfield_type = ... | hobarrera/django-polymorphic-ng | polymorphic/showfields.py | Python | bsd-3-clause | 6,130 |
"""
Automator code
Functions to convert from a supercell dictionary (output from a Diffuser) into a tarball
that contains all of the input files in an organized directory structure to run the
atomic-scale transition state calculations. This includes:
1. All positions in POSCAR format (POSCAR files for states to relax... | DallasTrinkle/Onsager | onsager/automator.py | Python | mit | 11,559 |
# encoding: utf-8
from __future__ import absolute_import, unicode_literals
from datetime import datetime
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin import widgets
from django.contrib.admin.tests import AdminSeleniumWebDriverTestCase
from django... | dex4er/django | tests/admin_widgets/tests.py | Python | bsd-3-clause | 38,074 |
""" Class to handle VOTable
Created: 2005-05-31 by Shui Hung Kwok, shkwok at computer.org
See http://www.ivoa.net/Documents/latest/VOT.html .
"""
import sys
from types import *
import xml.sax
import xml.sax.handler
class VONode (object):
""" Class representing an XML node of a VOTable
"""
def __init__ (self, ... | wschoenell/chimera_imported_googlecode | src/chimera/util/votable.py | Python | gpl-2.0 | 9,275 |
from __future__ import unicode_literals
from six import ensure_text
from .node import NodeVisitor, ValueNode, ListNode, BinaryExpressionNode
from .parser import atoms, precedence
atom_names = {v: "@%s" % k for (k,v) in atoms.items()}
named_escapes = {"\a", "\b", "\f", "\n", "\r", "\t", "\v"}
def escape(string, extr... | asajeffrey/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/serializer.py | Python | mpl-2.0 | 4,498 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
map_permission = client.sync... | teoreteetik/api-snippets | sync/rest/map-permissions/retrieve-permission/retrieve-permission.6.x.py | Python | mit | 511 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: Exile
@date: 05-07-2016
@place: Cartagena - Colombia
@licence: Creative Common
"""
from django.contrib import admin
from exileui.admin import exileui
from import_export.formats import base_formats
from import_export.admin import ExportMixin, Imp... | exildev/AutoLavadox | operacion/informes/reports.py | Python | mit | 1,414 |
# 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... | wooga/airflow | airflow/providers/salesforce/sensors/tableau_job_status.py | Python | apache-2.0 | 2,992 |
# Copyright 2015-2019 Facundo Batista, Nicolás Demarchi
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WIT... | PyAr/fades | tests/test_cache/__init__.py | Python | gpl-3.0 | 979 |
"""
# urljoin tests
>>> UrlRewriter.urljoin('http://example.com/test/', '../file.html')
'http://example.com/file.html'
>>> UrlRewriter.urljoin('http://example.com/test/', '../path/../../../file.html')
'http://example.com/file.html'
>>> UrlRewriter.urljoin('http://example.com/test/', '/../file.html')
'http://example.... | pombredanne/pywb | pywb/rewrite/test/test_url_rewriter.py | Python | gpl-3.0 | 8,053 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from flask import Flask
from flask.ext.script import Manager
from app import create_app
app = Flask(__name__)
manage = Manager(create_app())
if __name__ == '__main__':
manage.run()
| hanks-zyh/fir-local | manage.py | Python | apache-2.0 | 234 |
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://etetoolkit.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# t... | sauloal/cnidaria | scripts/venv/lib/python2.7/site-packages/ete2/_ph.py | Python | mit | 4,356 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from gratipay.security import csrf
from gratipay.testing import Harness
class Tests(Harness):
# st - _sanitize_token
def test_st_passes_through_good_token(self):
token = 'ddddeeeeaaaaddddbbbbe... | gratipay/gratipay.com | tests/py/test_security_csrf.py | Python | mit | 1,670 |
'''
Created on Sep 15, 2012
@author: altay
'''
import unittest
from main.sigma import *
from numpy.lib.tests.test_format import assert_equal
import sys
sys.path.append("../")
class TestSigma(unittest.TestCase):
def setUp(self):
'''
Initializes the necessary resources for the tests.
''... | altay-oz/tech_market_simulations | src/test/test_sigma.py | Python | gpl-3.0 | 2,574 |
from webplot import p
p.use_doc('webplot example')
import numpy as np
import datetime
import time
x = np.arange(100) / 6.0
y = np.sin(x)
z = np.cos(x)
data_source = p.make_source(idx=range(100), x=x, y=y, z=z)
p.plot(x, y, 'orange')
p.figure()
p.plot('x', 'y', color='blue', data_source=data_source, title='sincos')
p.pl... | zrhans/python | exemplos/wakari/scripts-examples-webplot_example.py | Python | gpl-2.0 | 885 |
# -*- test-case-name: twisted.web.test.test_httpauth -*-
# Copyright (c) 2008 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
A guard implementation which supports HTTP header-based authentication
schemes.
If either no www-authenticate header is present in the request or the
supplied response is invalid a... | hortonworks/hortonworks-sandbox | desktop/core/ext-py/Twisted/twisted/web/_auth/wrapper.py | Python | apache-2.0 | 7,186 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Mike Voets, 2014, mike@samiverb.com
class SamiSfixAndSyntaxLibrary(object):
""" A tiny library for Sami suffixes and methods """
def __init__(self):
self.stageList = {"kŋ": "ŋ", "đđ": "đ", "ff": "f", "ll": "l", "hll": "hl",
"ljj": "lj", "mm": "m", "nn": "n",... | mikevoets/samiverb | src/SamiverbBundle/Resources/public/py/samisyntaxlib.py | Python | mit | 7,445 |
# coding=utf-8
"""
This module contains config objects needed by paypal.interface.PayPalInterface.
Most of this is transparent to the end developer, as the PayPalConfig object
is instantiated by the PayPalInterface object.
"""
import logging
import os
from pprint import pformat
from paypal.compat import basestring
fr... | eahneahn/free | lib/python2.7/site-packages/paypal/settings.py | Python | agpl-3.0 | 4,941 |
#!/usr/bin/env python
import os
import numpy as np
from ase.data import chemical_symbols
import matplotlib.pyplot as plt
from abipy.abilab import abiopen
from pyDFTutils.perovskite.perovskite_mode import label_zone_boundary, label_Gamma
from ase.units import Ha
from spglib import spglib
def displacement_cart_to_evec(... | mailhexu/pyDFTutils | pyDFTutils/phonon/parser.py | Python | lgpl-3.0 | 16,721 |
class AbstractPlugin(object):
@staticmethod
def read_from_file(stream):
raise NotImplementedError('read_to_file')
@staticmethod
def write_to_file(stream, data):
raise NotImplementedError('write_to_file')
| firemark/homework-parser | homework_parser/plugin.py | Python | mit | 239 |
# -*- coding: utf-8 -*-
"""
flask_jwt
~~~~~~~~~
Flask-JWT module
"""
from collections import OrderedDict
from datetime import datetime, timedelta
from functools import wraps
import jwt
from flask import current_app, request, jsonify, _request_ctx_stack
from flask.views import MethodView
from werkzeug.lo... | svenstaro/flask-jwt | flask_jwt/__init__.py | Python | mit | 7,241 |
from django.contrib.auth.models import User
from django.db import models
from .utils import create_slug
class BaseModel(models.Model):
created = models.DateTimeField(auto_now_add=True)
last_updated = models.DateTimeField(auto_now=True)
class Meta():
abstract = True
| makaimc/txt2react | core/models.py | Python | mit | 292 |
# -*- coding: utf-8 -*-
#
# This file is part of Karesansui.
#
# Copyright (C) 2009-2012 HDE, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without lim... | karesansui/karesansui | karesansui/gadget/guesttag.py | Python | mit | 2,641 |
# Copyright 2009 Carl Sverre
#
# This file is part of FlickrFortune.
#
# FlickrFortune 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.
... | carlsverre/FlickrFortune | flickrconfig_sample.py | Python | gpl-3.0 | 1,580 |
#!/usr/bin/env python
# encoding: utf-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import copy
import math
import sys
import time
from collections import namedtuple
from PIL import Image
def is_nude(path_or_io):
nude = Nude(path_or_io)
return... | fffy2366/image-processing | tests/python/nude.py | Python | mit | 16,501 |
# (C) British Crown Copyright 2014 - 2016, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | arulalant/UMRider | others/ncmrwfIRIS/_load_convert.py | Python | gpl-2.0 | 82,618 |
import numpy as np
from cytokine_settings import build_intracell_model, DEFAULT_CYTOKINE_MODEL, APP_FIELD_STRENGTH, RUNS_SUBDIR_CYTOKINES, BETA_CYTOKINE
from cytokine_simulate import cytokine_sim
from singlecell.singlecell_class import Cell
from singlecell.singlecell_constants import NUM_STEPS, BETA
from singlecell.s... | mattsmart/biomodels | celltypes/cytokine/cytokine_landscape.py | Python | mit | 2,172 |
from typing import List
class IO:
def mode(self) -> str: ...
def name(self) -> str: ...
def close(self) -> None: ...
def closed(self) -> bool: ...
def fileno(self) -> int: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def read(self, n: int = 0) -> str: ...
de... | caterinaurban/Typpete | typpete/src/stubs/libraries/sys.py | Python | mpl-2.0 | 958 |
#!/usr/bin/python
#
# Copyright (c) 2012 Joshua Hughes <kivhift@gmail.com>
#
import nose
nose.main()
| kivhift/pu | src/tests/run-em.py | Python | mit | 101 |
import django # this verifies local libraries can be packed into the egg
import additiondependency
def addition(first, second):
additiondependency.dependantMethod()
return first + second
def addition2(first, second, third):
additiondependency.dependantMethod()
return first + second + third
| Stratoscale/pyracktest | example_seeds/addition.py | Python | apache-2.0 | 312 |
import logging
import asyncio
import random
import sortedcontainers
import collections
from hailtop.utils import (
AsyncWorkerPool, WaitableSharedPool, retry_long_running, run_if_changed,
time_msecs, secret_alnum_string)
from hailtop import aiotools
from ..batch import schedule_job, unschedule_job, mark_job_c... | danking/hail | batch/batch/driver/scheduler.py | Python | mit | 17,953 |
from taskw import TaskWarriorShellout
class TwCurrent(object):
def __init__(self, file=None):
self.tw = TaskWarriorShellout()
self.tw.config_filename = file
def get_current(self):
tw = TaskWarriorShellout()
tw.config_filename = self.tw.config_filename
tasks = tw.filte... | DavidParkin/pomodoro-indicator | app/twcurrent.py | Python | gpl-3.0 | 986 |
import numpy as np
import gnumpy as gnp
import utils
from itertools import izip
class Hm():
def __init__(self, p_layers, q_layers, prior):
'''
p_net has all the generative layers starting from the one closest to the prior ending with the one closest to the data
q_net has all the approximat... | jackklys/reweightedwakesleep | hm_contrastq.py | Python | mit | 7,680 |
# -*- coding: ISO-8859-1 -*-
# Copyright 2010 Dirk Holtwick, holtwick.it
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | holtwick/xhtml2pdf | sx/pisa3/pisa_util.py | Python | apache-2.0 | 26,127 |
import sys
import eventlet
from eventlet import event
import logging
import msgpack
from .settings import BUF_LEN
LOG = logging.getLogger('Server')
class Server(object):
exit_event = event.Event()
def __init__(self, conf):
super(Server, self).__init__()
self._node_listen_ip = conf.get('se... | jason-ni/eventlet-raft | eventlet_raft/server.py | Python | apache-2.0 | 3,811 |
algorithm = "spawning_adiabatic"
#algorithm = "hagedorn"
potential = "eckart"
T = 70
dt = 0.005
eps = 0.0234218**0.5
basis_size = 300
parameters = [ (0.1935842258501978j, 5.1657101481699996, 0.0, 0.24788547371, -7.55890450883) ]
coefficients = [[(0, 1.0)]]
leading_component = 0
f = 9.0
ngn = 4096
write_nth = 20... | WaveBlocks/WaveBlocks | demos/demo_tunneling_spawning/demo_tunneling_spawn_propagation_norm_threshold.py | Python | bsd-3-clause | 517 |
"""Ray-triangle intersection."""
# pylint: disable=invalid-name
from cgmath.vector import cross, dot
# TODO
EPSILON = 0.000001
# Adapted from:
# en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm
def ray_triangle_intersect(ray, triangle):
"""Ray-triangle intersection.
ray: cgmath.ray... | nicholasbishop/bel | cgmath/ray_triangle_intersect.py | Python | gpl-3.0 | 1,661 |
# Copyright (c) 2010 Jonathan M. Lange. See LICENSE for details.
"""Tests for the evil Twisted reactor-spinning we do."""
import os
import signal
from testtools import (
skipIf,
TestCase,
)
from testtools.helpers import try_import
from testtools.matchers import (
Equals,
Is,
MatchesException,... | zarboz/XBMC-PVR-mac | tools/darwin/depends/samba/samba-3.6.6/lib/testtools/testtools/tests/test_spinner.py | Python | gpl-2.0 | 13,058 |
from collections import OrderedDict
import pytest
import numpy as np
from astropy import units as u
from astropy.tests.helper import assert_quantity_allclose
from astropy.modeling.functional_models import (Gaussian1D,
Sersic1D, Sine1D, Linear1D,
Loren... | bsipocz/astropy | astropy/modeling/tests/test_models_quantities.py | Python | bsd-3-clause | 13,621 |
"""유틸리티 함수와 클래스 모음"""
from importlib import import_module
__all__ = ['import_string']
UNDEFINED = type('Undefined', (object,),
{'__repr__': lambda self: 'UNDEFINED'})()
def import_string(import_name, package=None, default=UNDEFINED):
"""지정한 경로에 있는 파이썬 모듈이나 객체를 가져온다
.. code-block:: pycon
... | flask-kr/githubarium | githubarium/util.py | Python | mit | 1,545 |
import numpy
import linreg
from perceptron import Perceptron
from pocketperceptron import PocketPerceptron
from logitreg import LogisticRegression
######################PERCEPTRON
'''
perc = Perceptron(3)
for line in open('classification.txt', 'r'):
line = line.split(',')
row = [float(line[0]), float(line[1]),... | hakuliu/inf552 | hw4/hw4.py | Python | apache-2.0 | 2,592 |
# -*- coding: utf-8 -*-
from datetime import datetime
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models.managers import TitleManager
from cms.models.pagemodel import Page
from cms.utils.helpers import reversion_register
class Title(models.Model):
language = model... | hzlf/openbroadcast | website/cms/models/titlemodels.py | Python | gpl-3.0 | 2,944 |
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-i", "--IP",
action="store", type="float", dest="IP", default=5.0,
help="The first material's IP, default 5.0")
parser.add_option("-e", "--EA",
action="store", type="float", dest="E... | WMD-group/SMACT | examples/Practical_tutorial/Electronic/scan_energies.py | Python | mit | 1,910 |
from django.contrib import admin
from django.contrib.admin.widgets import AdminIntegerFieldWidget
from django.core.validators import MaxValueValidator, MinValueValidator
from modeltranslation.admin import TranslationAdmin
from django.urls import reverse
from django.utils import timezone as tz
from django.utils.html imp... | erudit/eruditorg | eruditorg/erudit/admin/journal.py | Python | gpl-3.0 | 8,218 |
from ase import Atoms
from ase.optimize import QuasiNewton
from gpaw import GPAW
a = 6
b = a / 2
mol = Atoms('H2O',
[(b, 0.7633 + b, -0.4876 + b),
(b, -0.7633 + b, -0.4876 + b),
(b, b, 0.1219 + b)],
cell=[a, a, a])
calc = GPAW(nbands=4,
h=0.2,
... | qsnake/gpaw | doc/documentation/lcao/lcao_h2o.py | Python | gpl-3.0 | 455 |
#!/usr/bin/python
from os import listdir,makedirs
from os.path import isfile, join, exists
import traceback,sys
def list_modules(folder):
types = []
for f in listdir(folder):
if isfile(join(folder,f)):
name, extension = f.split(".")
if extension == "py" and name != "__init__":
... | sondree/Master-thesis | Python EA/ea/utility.py | Python | gpl-3.0 | 1,009 |
# encoding: utf-8
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import unicode_literals
from typ... | klahnakoski/eideticker | util/struct.py | Python | mpl-2.0 | 15,880 |
# Authors: Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de>
#
# License: BSD (3-clause)
import numpy as np
from ..evoked import Evoked
from ..epochs import BaseEpochs
from ..io import BaseRaw
from ..event import find_events
from ..io.pick import _pick_data_channels
from ..utils import _check_preload, _check_option... | Teekuningas/mne-python | mne/preprocessing/stim.py | Python | bsd-3-clause | 4,333 |
import random,math
from MB import music as music
class Stub:
def __init__(self,client):
self.time=0.0
self.dt=0.01
self.engine=music.Engine(self.dt,self.callback)
self.bpm_average=60.0
self.freq=0.1
self.freq_depth=0.0
self.... | pauljohnleonard/MusicBox | src/ai/stub.py | Python | gpl-2.0 | 1,164 |
from collections.abc import Iterable
from difflib import get_close_matches
from numbers import Real
import itertools
import os
import re
import shutil
import tempfile
from warnings import warn
import numpy as np
import h5py
import openmc.checkvalue as cv
from openmc.mixin import EqualityMixin
from . import HDF5_VERSI... | johnnyliu27/openmc | openmc/data/thermal.py | Python | mit | 23,923 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from .base import * # noqa
from .django import * # noqa
| barseghyanartur/django-url-filter | url_filter/filtersets/__init__.py | Python | mit | 156 |
#!/usr/bin/env python
"""Build and write out the NGC-star-clusters.fits catalog.
"""
import os
import numpy as np
import numpy.ma as ma
from astropy.io import ascii
from astropy.table import Table, vstack
from astrometry.util.starutil_numpy import hmsstring2ra, dmsstring2dec
from astrometry.libkd.spherematch import m... | legacysurvey/pipeline | bin/build-cluster-catalog.py | Python | gpl-2.0 | 6,152 |
from btcommon import *
import socket
import struct
import threading
import os
import _widcomm
DEFAULT_MTU = 672
def dbg (*args):
return
sys.stdout.write (*args)
sys.stdout.write ("\n")
def BD_ADDR_to_str (bda):
return "%02X:%02X:%02X:%02X:%02X:%02X" % \
(ord(bda[0]), ord(bda[1]), ord(bda[... | Lh4cKg/sl4a | python-modules/pybluez/python/bluetooth/widcomm.py | Python | apache-2.0 | 28,737 |
# -*- coding: utf-8 -*-
# © 2016 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests import common
class TestL10nEsToponyms(common.TransactionCase):
def setUp(self):
super(TestL10nEsToponyms, self).setUp()
self.wi... | syci/l10n-spain | l10n_es_toponyms/tests/test_l10n_es_toponyms.py | Python | agpl-3.0 | 1,234 |
# Copyright (c) 2013 OpenStack, LLC.
#
# 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... | tylertian/Openstack | openstack F/python-cinderclient/cinderclient/tests/v2/test_auth.py | Python | apache-2.0 | 14,390 |
""" JobRunningMatchedRatioPolicy
Policy that calculates the efficiency following the formula::
( running ) / ( running + matched + received + checking )
if the denominator is smaller than 10, it does not take any decision.
"""
from DIRAC import S_OK
from DIRAC.ResourceStatusSystem.PolicySystem.PolicyBase im... | DIRACGrid/DIRAC | src/DIRAC/ResourceStatusSystem/Policy/JobRunningMatchedRatioPolicy.py | Python | gpl-3.0 | 2,249 |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
import os, os.path
import sys
sys.path.append('/home/will/PatientPicker/')
import LoadingTools
# <codecell>
import glob
import pandas as pd
files = glob.glob('/home/will/HIVReportGen/Data/PatientFasta/*LTR.fasta')
#redcap_data = LoadingTools.load_redc... | JudoWill/ResearchNotebooks | CheckNoLTR.py | Python | mit | 2,003 |
import LocalVault.Database as data
import hashlib
import json
import re
import pdb
class hm65Vault():
def __init__(self,dbName="hm65VaultTest.db"):
self.DATABASE_NAME = dbName
def addItem(self, vaultItem):
"""
Add vaultItem to the database. Either as a new item or an update
"""
db = self.g... | humanist1965/hm65Vault | LocalVault/Vault.py | Python | gpl-3.0 | 5,715 |
# Copyright (C) 2011 Google Inc. 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 list of conditions and the ... | you21979/phantomjs | src/qt/qtwebkit/Tools/Scripts/webkitpy/tool/steps/update_unittest.py | Python | bsd-3-clause | 2,746 |
# Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.
#
# get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.
# set(key, value) - Set or insert the value if the key is not alrea... | hujiaweibujidao/XSolutions | python/LRUCache.py | Python | apache-2.0 | 1,620 |
class Explanation(object):
def __init__(self, trees=[]):
'''
Constructor
'''
self._trees = [] # A list of the current trees
self._pendingSets = [] # A list of each tree's pending set
for tree in self._trees:
self._pendingSets.append(tree.getF... | ReuthMirsky/SPR | Source/Explanation.py | Python | gpl-3.0 | 5,291 |
#
# Walldo - A wallpaper downloader
# Copyright (C) 2012 Fernando Castillo
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later v... | skibyte/walldo | walldo/parsertestcase.py | Python | gpl-2.0 | 1,409 |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | StackStorm/st2 | contrib/chatops/actions/match_and_execute.py | Python | apache-2.0 | 2,668 |
"""Tests for CP2K calculator interface."""
import os
import numpy as np
import pytest
from phonopy.interface.cp2k import read_cp2k
from phonopy.interface.phonopy_yaml import read_cell_yaml
data_dir = os.path.dirname(os.path.abspath(__file__))
CP2K_INPUT_TOOLS_AVAILABLE = True
try:
import cp2k_input_tools # no... | atztogo/phonopy | test/interface/test_CP2K.py | Python | bsd-3-clause | 954 |
#
# Copyright (c) 2015 Autodesk 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 applicable l... | autodesk-cloud/ochonetes | images/zookeeper/resources/pod/pod.py | Python | apache-2.0 | 2,784 |
from __future__ import absolute_import
import warnings
from datetime import datetime
from pathlib import Path
import six
import netCDF4
import numpy as np
import pytest
import yaml
from click.testing import CliRunner
from affine import Affine
import datacube.scripts.cli_app
from datacube.model import GeoBox, CRS
fr... | ceos-seo/Data_Cube_v2 | agdc-v2/integration_tests/test_full_ingestion.py | Python | apache-2.0 | 5,552 |
# This file is part of Checkbox.
#
# Copyright 2013 Canonical Ltd.
# Written by:
# Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
#
# Checkbox 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 versio... | jds2001/ocp-checkbox | plainbox/plainbox/impl/providers/v1.py | Python | gpl-3.0 | 7,162 |
##############################################################################################
# Copyright 2014-2015 Cloud Media Sdn. Bhd.
#
# This file is part of Xuan Application Development SDK.
#
# Xuan Application Development SDK is free software: you can redistribute it and/or modify
# it under the terms of... | TheStackBox/xuansdk | SDKLibrary/com/cloudMedia/theKuroBox/sdk/paramTypes/kbxTime.py | Python | gpl-3.0 | 1,860 |
from elixir.models import *
from lxml import etree
import xml.etree.ElementTree as ET
from xml.sax.saxutils import escape
from rest_framework.decorators import renderer_classes
from django.views.decorators.csrf import csrf_exempt
from elixirapp import settings
from rest_framework.response import Response
from rest_fra... | bio-tools/biotoolsregistry | backend/elixir/sitemap.py | Python | gpl-3.0 | 1,660 |
from egasub.submission.submit import submittable_status, submit_dataset, perform_submission
from egasub.ega.entities.ega_enums import EgaEnums
import pytest
import os
import shutil
from egasub.submission.submittable import Unaligned, Variation, Alignment
#from mock import patch, Mock
import ftplib
def test_submittable... | icgc-dcc/egasub | tests/submission/test_submit.py | Python | gpl-3.0 | 3,186 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.