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 numpy as npy
import struct
import os
from scipy import io as scio
from mxnet import io as mxio
def ReadFvecs(dataPath, dataFile, start=0, end=-1):
filePath=os.path.join(dataPath,dataFile)
with open(filePath,mode="rb") as fid:
buf=fid.read(4)
dimFeat=struct.unpack("i", buf[:4])
... | galad-loth/DescHash | DeepHash/common/data.py | Python | apache-2.0 | 3,986 |
#!/usr/bin/env python
# coding=utf-8
from webapp.web import BaseHandler
class SignoutHandler(BaseHandler):
def get(self):
self.clear_cookies()
self.session.kill()
return self.redirect("/")
def post(self):
self.get()
| vincentpc/yagra_for_wsgi | handlers/signout.py | Python | apache-2.0 | 261 |
#
# Copyright (C) 2016 Red Hat, 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... | openstack/networking-odl | networking_odl/tests/functional/test_ml2_drivers.py | Python | apache-2.0 | 4,872 |
# -*- coding: utf-8 -*-
# This file carries the module's version information which will be updated
# during execution of the installation script, setup.py. Distribution tarballs
# contain a pre-generated copy of this file.
__version__ = '0.2'
| EMS-TU-Ilmenau/fastmat | fastmat/version.py | Python | apache-2.0 | 245 |
# -*- coding:utf-8 -*-
#
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# SPDX-License-Identifier: Apache-2.0
import bandit
from bandit.core import test_properties as test
def get_bad_proto_versions(config):
return config['bad_protocol_versions']
def gen_config(name):
if name == 'ssl_with_bad... | sonntagsgesicht/regtest | .aux/venv/lib/python3.9/site-packages/bandit/plugins/insecure_ssl_tls.py | Python | apache-2.0 | 9,646 |
# -*- coding: utf-8 -*-
"""
Core application tasks
"""
from celery.decorators import task
from django.core.mail import EmailMessage
from atmosphere import settings
from threepio import celery_logger, email_logger
from core.models.status_type import get_status_type
@task(name="send_email")
def send_email(subject, ... | CCI-MOC/GUI-Backend | core/tasks.py | Python | apache-2.0 | 1,847 |
# -.- coding: utf8 -.-
import math, random
import matplotlib.pyplot as plt
class City:
Label = ""
X = 0
Y = 0
def __init__(self, x=None, y=None, label=''):
if x is None and y is None:
random.seed()
self.X = random.randint(-100,100)
self.Y = random.randint(-100,100)
else:
self.X = x
self.Y = y... | FelipeLimaM/sa-traveling-salesman | felipe-python/TS.py | Python | apache-2.0 | 3,690 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | 111pontes/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_aaa_aaacore_cfg.py | Python | apache-2.0 | 2,032 |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Herald Bluetooth transport implementation
:author: Luc Libralesso
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.0.3
:status: Alpha
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "Licen... | librallu/cohorte-herald | python/herald/transports/bluetooth/__init__.py | Python | apache-2.0 | 1,915 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | redhat-openstack/heat | heat/openstack/common/loopingcall.py | Python | apache-2.0 | 4,501 |
# -*- coding: utf-8 -*-
"""
Created on Thu May 04 19:53:03 2017
@author: ZechT
"""
import sys
import numpy as np
from PyQt5.QtWidgets import *
class AbstractHandler(QWidget):
def __init__(self,parent=None):
QWidget.__init__(self)
self.parent=parent
def main():
# ... | Kylskap/PloPo | skeletonWidget.py | Python | apache-2.0 | 728 |
# ------------------------------------------------
# IMPORTS ----------------------------------------
# ------------------------------------------------
#####
# Python dist and 3rd party libraries
#####
import os, requests, json, string, datetime, logging, time
from os.path import join, dirname
from weblogger import ad... | WASdev/sample.voice.gateway | soe/python/checkDTMF.py | Python | apache-2.0 | 1,293 |
# 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 ... | mtagle/airflow | airflow/configuration.py | Python | apache-2.0 | 29,594 |
#!/bin/env python
# Copyright 2021 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 agre... | google/CFU-Playground | proj/hps_accel/gateware/gen2/test_sysarray.py | Python | apache-2.0 | 3,730 |
import torch
from transformers import PreTrainedModel
from .custom_configuration import CustomConfig, NoSuperInitConfig
class CustomModel(PreTrainedModel):
config_class = CustomConfig
def __init__(self, config):
super().__init__(config)
self.linear = torch.nn.Linear(config.hidden_size, conf... | huggingface/transformers | utils/test_module/custom_modeling.py | Python | apache-2.0 | 772 |
#
# Copyright (c) SAS Institute 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 to in w... | fedora-conary/rmake-2 | rmake/worker/command.py | Python | apache-2.0 | 19,427 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-28 20:51
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.Cre... | EBI-Metagenomics/emgapi | emgapi/migrations/0001_initial.py | Python | apache-2.0 | 19,658 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
# Copyright 2012 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 NTT DOCOMO, INC.
# Copyright (c) 2011 University of Southern California / ISI
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
... | DirectXMan12/nova-hacking | nova/tests/virt/baremetal/test_driver.py | Python | apache-2.0 | 14,537 |
import re
from django import template
register = template.Library()
def user_dweet_to_link(m):
text = m.group('text')
dweet_id = m.group('dweet_id')
username = m.group('username')
if username is None:
url = 'd/' + dweet_id
else:
url = 'u/' + username
result = '<a href="/{0}"... | lionleaf/dwitter | dwitter/templatetags/insert_magic_links.py | Python | apache-2.0 | 2,048 |
from __future__ import unicode_literals
from django.apps import AppConfig
class ProvVoConfig(AppConfig):
name = 'prov_vo'
| kristinriebe/django-prov_vo | prov_vo/apps.py | Python | apache-2.0 | 129 |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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 later version.
T... | aplicatii-romanesti/allinclusive-kodi-pi | .kodi/addons/plugin.video.salts/service.py | Python | apache-2.0 | 5,535 |
#!/usr/bin/env python
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not
# use this file except in compliance with the License. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in... | awslabs/sockeye | sockeye_contrib/benchmark/benchmark_to_output.py | Python | apache-2.0 | 1,162 |
# Copyright 2019 Intel, 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 a... | openstack/nomad | cyborg/objects/attach_handle.py | Python | apache-2.0 | 3,799 |
import argparse
import numpy as np
import sys
def generate():
parser = argparse.ArgumentParser()
parser.add_argument('--vocab_file', default='vocab.txt', type=str)
parser.add_argument('--vectors_file', default='vectors.txt', type=str)
args = parser.parse_args()
with open(args.vocab_file, 'r') as f... | jileiwang/CJ-Glo | tools/distance.py | Python | apache-2.0 | 2,385 |
from JumpScale import j
class Disk:
def __init__(self, devname, node=None, disknr=None, screenname=None):
devname.replace("//", "/")
self.devname = devname
self.devnameshort = self.devname.split("/")[2]
self.mounted = False
self.mountpath = None
self.node = node
... | Jumpscale/jumpscale_core8 | lib/JumpScale/tools/perftesttools/Disk.py | Python | apache-2.0 | 2,097 |
from django.forms.models import modelform_factory
from django.views.generic import (
DetailView,
CreateView,
UpdateView,
DeleteView,
TemplateView
)
from django_tables2 import SingleTableView
from crudbuilder.registry import registry
from crudbuilder.mixins import (
CrudBuilderMixin,
BaseLis... | asifpy/django-crudbuilder | crudbuilder/views.py | Python | apache-2.0 | 8,139 |
# Copyright 2021 The Floq 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | google/floq-client | samples/jobs_queue.py | Python | apache-2.0 | 1,051 |
import urlparse
import random
import uuid
from xos.config import Config
from keystoneclient import service_catalog
has_openstack = True
random.seed(None)
def require_enabled(callable):
def wrapper(*args, **kwds):
if has_openstack:
return callable(*args, **kwds)
else:
retu... | wathsalav/xos | xos/openstack_noop/client.py | Python | apache-2.0 | 5,594 |
__author__ = 'Chris Lucian; Llewellyn Falco; Jim Counts'
| tdpreece/ApprovalTests.Python | tests/__init__.py | Python | apache-2.0 | 57 |
def mm_loops(X,Y,Z):
m = len(X)
n = len(Y)
for i in xrange(len(X)):
xi = X[i]
for j in xrange(len(Y)):
yj = Y[j]
total = 0
for k in xrange(len(yj)):
total += xi[k] * yj[k]
Z[i][j] = total
return Z
def make_matrix(m,n):
... | rjpower/falcon | benchmarks/old/matmult_int.py | Python | apache-2.0 | 511 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Collection of several utility functions."""
from __future__ import print_function
import sys
from math import floor, sqrt
import numpy as np
import pygimli as pg
class ProgressBar(object):
"""Animated text-based progressbar.
Animated text-based progressbar f... | gimli-org/gimli | pygimli/utils/utils.py | Python | apache-2.0 | 22,192 |
from multiprocessing import Process
import time
import sys
count = 1000 #Note!!!!!: This needs to be a multiple of env.numThreads, else tests will likely fail with the wrong count(s)
actionWaitTime = 5
class InfluxParaWrite(object):
def __init__(self,env):
self.env = env
self.count = count
... | hpcloud-mon/monasca-perf | influx_test/influxparawrite.py | Python | apache-2.0 | 1,308 |
# coding: utf-8
# Copyright 2013 Daniel Neuhäuser
#
# 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 a... | DasIch/argvard | argvard/signature.py | Python | apache-2.0 | 7,016 |
# Copyright 2016 Isotoma Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | yaybu/touchdown | touchdown/config/integer.py | Python | apache-2.0 | 1,092 |
# snapy - a python snmp library
#
# Copyright (C) 2009 ITA Software, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be ... | marineam/nagcat | python/snapy/netsnmp/unittests/__init__.py | Python | apache-2.0 | 6,157 |
# Copyright 2018 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... | DavidNorman/tensorflow | tensorflow/python/keras/engine/training_dataset_test.py | Python | apache-2.0 | 22,565 |
from superset import security, sm
from .base_tests import SupersetTestCase
def get_perm_tuples(role_name):
perm_set = set()
for perm in sm.find_role(role_name).permissions:
perm_set.add((perm.permission.name, perm.view_menu.name))
return perm_set
class RolePermissionTests(SupersetTestCase):
... | alanmcruickshank/superset-dev | tests/security_tests.py | Python | apache-2.0 | 7,916 |
# Copyright 2019 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... | tensorflow/tpu | models/official/efficientnet/eval_ckpt_main.py | Python | apache-2.0 | 4,717 |
from django.conf.urls import patterns, url
from django.views.generic.base import TemplateView
from general import views
urlpatterns = patterns('',
url(r'^geoloc/updateloc/$', views.UpdateLoc, name='updateloc'),
url(r'^geoloc/$', views.GeoLoc, name='geoloc'),
url(r'^geoloc/more$', views.AddGeoLoc, name='addgeo... | Crowdcomputer/CC | general/urls.py | Python | apache-2.0 | 853 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('jobs', '0006_auto_20151115_0609'),
]
operations = [
migrations.AlterModelOptions(
name='job',
option... | simeonf/sfpython | sfpython/jobs/migrations/0007_auto_20151115_0614.py | Python | apache-2.0 | 865 |
#!/usr/bin/env python
# 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 ... | googleads/google-ads-python | examples/reporting/get_keyword_stats.py | Python | apache-2.0 | 3,872 |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | googledatalab/pydatalab | solutionbox/structured_data/mltoolbox/_structured_data/prediction/predict.py | Python | apache-2.0 | 14,371 |
"""Legacy device tracker classes."""
from __future__ import annotations
import asyncio
from datetime import timedelta
import hashlib
from types import ModuleType
from typing import Any, Callable, Sequence, final
import attr
import voluptuous as vol
from homeassistant import util
from homeassistant.components import ... | w1ll1am23/home-assistant | homeassistant/components/device_tracker/legacy.py | Python | apache-2.0 | 27,443 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Date: 2016-07-18 15:53:21
@Author: King
@Desc:
"""
import re
from ..items import DealData
from scrapy.loader.processors import TakeFirst, Join
from scrapy import Selector
from scrapy.loader import ItemLoader
import scrapy
class DealItemLoader(ItemLoa... | leopard7777777/taobao_deal_history | taobao/spiders/spider1.py | Python | apache-2.0 | 2,267 |
##
# Copyright (c) 2013-2014 Apple 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... | trevor/calendarserver | txdav/common/idirectoryservice.py | Python | apache-2.0 | 2,527 |
# Copyright 2014 Abid Hasan Mujtaba
#
# 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 wri... | abid-mujtaba/BitcoinTracker-python | bitcoin/utilities/push_transactions.py | Python | apache-2.0 | 1,634 |
from scipy import signal
# Currently this filter uses numbers for boundaries defined in Oliver's matlab code.
# Shoaib pointed out that it should be 13 bands instead of 11 for original MFCC bands.
# Need to remove .62* later.
period16=16000
period8=8000
period4=4000
period2=2000
#why do we use different period value?
... | UWNetworksLab/GlimpseData | Visualizer/Filter.py | Python | apache-2.0 | 1,654 |
# Copyright (C) 2012 Yaco Sistemas (http://www.yaco.es)
#
# 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... | advisory/djangosaml2_tenant | djangosaml2/utils.py | Python | apache-2.0 | 1,490 |
import bpy
import datetime
from . properties import *
from . operators import *
from . sun_calc import Degrees, format_lat_long, degToRad, \
format_time, format_hms, Move_sun
#---------------------------------------------------------------------------
#
# Draw the Sun Panel, sliders, et. al.
... | yaricp/Sun_Power | ui_sun.py | Python | apache-2.0 | 27,597 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# OK anaconda2 + freeglut+pyopengl
# sous windows:
# - telecharger freeglut ici: http://freeglut.sourceforge.net/
# - renommer freeglut.dll en freeglut64.vc14.dll et la mettre dans le path
# en cas de non chargement regarder ce qui se passe dans C:\Python37\Lib\site-pac... | rboman/progs | sandbox/pyopengl/ball_glut.py | Python | apache-2.0 | 1,601 |
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
from datetime import datetime, date
from flask import Blueprint
from sqlalchemy i... | jmakov/ggrc-core | src/ggrc_workflows/__init__.py | Python | apache-2.0 | 34,934 |
#!/usr/bin/env python
# (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
"""
Test the Model constructors.
"""
import itertools
import pytest
import numpy as np
import tbmodels
def test_on_site_too_long(get_model):
"""
Check that error is raised when th... | Z2PackDev/TBmodels | tests/test_constructors.py | Python | apache-2.0 | 8,064 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the L... | cvandeplas/plaso | plaso/parsers/winprefetch_test.py | Python | apache-2.0 | 17,693 |
# 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... | chemelnucfin/tensorflow | tensorflow/contrib/distribute/python/keras_backward_compat_test.py | Python | apache-2.0 | 43,076 |
#########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | konradxyz/cloudify-manager | rest-service/manager_rest/test/test_provider_context.py | Python | apache-2.0 | 2,268 |
# Copyright 2015 Google 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 to in writing, ... | yafraorg/yafra-toroam | com.toroam.appengine2/tests/test_crud.py | Python | apache-2.0 | 3,076 |
# Script to register a new hypervisor provider in SPP
# Use registerhypervisor.py -h for help
# Example:
# python registerhypervisor.py --host="https://172.20.49.49" --user="admin" --pass="spppass" --hvtype="hyperv" --hvhost="my.host.name" --hvuser="hvdomain\hvuser" --hvpass="hvpassword"
import json
import logging
fro... | ibmspp/sppclient | samples/registerhypervisor.py | Python | apache-2.0 | 3,540 |
from flask.ext.sqlalchemy import SQLAlchemy
from flask import Flask
import os
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgres://jkrbnkekcosnxb:jOrPwurv94mnMu7acVpIX0W2sA@ec2-54-197-230-161.compute-1.amazonaws.com:5432/da79ahfav90021'
db = SQLAlchemy(app)
class Item(db.Model):
__tablenam... | hermaa02/cs330-final | db.py | Python | apache-2.0 | 5,927 |
# -*- 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-translate | samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_sync.py | Python | apache-2.0 | 1,480 |
from scipy.optimize import curve_fit
from numpy import log, isnan
class NotAModel(Exception):
pass
def chisq(self, result=None):
if result is None:
result = self.result
return ((self.data.cts(row=True)-result)**2/self.data.errors(row=True)**2).sum()
def cstat(self, result):
if result is No... | uperetz/AstroTools | fitter/_modeling.py | Python | apache-2.0 | 2,367 |
try:
# python 2.7
from urllib import quote
from urllib import urlencode
except ImportError:
# python 3.4
from urllib.parse import quote
from urllib.parse import urlencode
import sys
import re
import PyISY
class isy():
def __init__(self,config,logger,status,bridge):
s... | jimboca/ISYHelperHABridge | ihab/ISY.py | Python | apache-2.0 | 11,333 |
from __future__ import unicode_literals
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import glob
import os
from tags import tag_finder
import logging
from operator import itemgetter, attrgetter, methodcaller
def path_leaf(path):
"""
It gets the path final leaf
"""
head, tail = os.path.... | tex0l/JukeBox | parser.py | Python | apache-2.0 | 4,608 |
# Copyright (c) 2006-2015 Apple 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 law ... | red-hood/calendarserver | twistedcaldav/test/test_multiget.py | Python | apache-2.0 | 11,770 |
"""Support for Synology DSM cameras."""
from typing import Dict
from synology_dsm.api.surveillance_station import SynoSurveillanceStation
from homeassistant.components.camera import SUPPORT_STREAM, Camera
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
... | tchellomello/home-assistant | homeassistant/components/synology_dsm/camera.py | Python | apache-2.0 | 3,046 |
"""
A wrap python class of 'pbsnodes -N "note" node' command
The purpose of this class is to provide a simple API
to write some attribute and its value pairs to note attribute of cluster nodes.
"""
from __future__ import print_function
from sh import ssh
from ast import literal_eval
from types import *
from copy import... | rajpushkar83/cloudmesh | cloudmesh/pbs/pbs_note.py | Python | apache-2.0 | 4,485 |
# Copyright 2017 Huawei Technologies Co.,LTD.
# 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
#
# Unl... | openstack/nomad | cyborg/common/exception.py | Python | apache-2.0 | 10,839 |
# ====================================================================
# 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 re... | romanchyla/pylucene-trunk | samples/LuceneInAction/lia/advsearching/BooksLikeThis.py | Python | apache-2.0 | 3,039 |
# ******************************************************************************
# Copyright 2014-2018 Intel Corporation
#
# 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.apa... | NervanaSystems/neon | examples/video-c3d/network.py | Python | apache-2.0 | 2,289 |
#!/usr/bin/env python
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ _|_ _|
# | |) | (_) | | .` | (_) || | | _|| |) | | ... | joelsmith/openshift-tools | ansible/roles/lib_git/library/git_rebase.py | Python | apache-2.0 | 15,173 |
# -*- coding:utf-8 -*-
import sys
from datetime import datetime
from django.template.loader import get_template
from django.shortcuts import render,redirect
from django.http import HttpResponse
from .models import Post
reload(sys)
sys.setdefaultencoding('utf-8')
# Create your views here.
def homepage(request):
te... | LouisLinY/mblog | mainsite/views.py | Python | apache-2.0 | 1,203 |
# Copyright 2017-2018 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | deepmind/dm_control | dm_control/_render/executor/render_executor.py | Python | apache-2.0 | 6,153 |
#!/usr/bin/env python
# vim:fileencoding=utf-8
# License: Apache 2.0 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
from __future__ import absolute_import, division, print_function, unicode_literals
import codecs
import os
import re
import subprocess
import unittest
from html5_parser import check_bom, check_... | kovidgoyal/html5-parser | test/html5lib_adapter.py | Python | apache-2.0 | 10,101 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.chat.TTSCWhiteListTerminal
from otp.speedchat.SCTerminal import SCTerminal
from otp.otpbase.OTPLocalizer import SpeedChatStaticText
SCStaticTextMsgEvent = 'SCStaticTextMsg'
class TTSCWhiteListTerminal(SCTerminal):
def __init__(self, textId... | DedMemez/ODS-August-2017 | chat/TTSCWhiteListTerminal.py | Python | apache-2.0 | 874 |
from flask import Flask, Response, request
app = Flask(__name__)
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def user(path):
name = request.args.get('name')
return Response("Hello %s" % (name), mimetype='text/html')
| zeit/now-cli | packages/now-cli/test/dev/fixtures/python-flask/api/user.py | Python | apache-2.0 | 247 |
from .forms import RegistrationForm, LoginForm, SearchForm, CarForm
user_data = {'name': 'Jhon Doe', 'email': 'jhon@doe.com',
'password': 'jJdD', 'confirm': 'jJdD'}
car_data = {'year': '1938', 'manufacturer': 'Volkswagen',
'model': 'Beetle'}
"""
def test_registration_form():
form = Regis... | wiliamsouza/cars | cars/test_forms.py | Python | apache-2.0 | 837 |
# 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, print_function, unicode_literals
import http.server
import itertools
import json
import logging
import mimetypes
import os... | twitter/pants | src/python/pants/reporting/reporting_server.py | Python | apache-2.0 | 17,903 |
# -*- encoding: utf-8 -*-
from django.test import TestCase
from pay.management.commands import init_app_pay
class TestCommand(TestCase):
def test_init_app(self):
""" Test the management command """
command = init_app_pay.Command()
command.handle()
| pkimber/pay | pay/tests/test_management_command.py | Python | apache-2.0 | 280 |
import numpy as np
import random
import networkx as nx
from operator import itemgetter
import pandas as pd
import sys
import json
import optparse
###############################################################
#### CONCORDANCE, DISCORDANCE AND CREDIBILITY FUNCTIONS ######
#############################################... | enricopal/snowball_decision | decision_algorithm.py | Python | apache-2.0 | 25,944 |
# 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... | dmlc/tvm | python/tvm/relay/op/contrib/ethosn.py | Python | apache-2.0 | 10,270 |
# -*- coding: utf-8 -*-
#
# 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
... | OpringaoDoTurno/airflow | tests/utils/test_log_handlers.py | Python | apache-2.0 | 6,367 |
#!/usr/bin/env python
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | GoogleCloudPlatform/solutions-google-compute-engine-cluster-for-hadoop | sample/shortest-to-longest-reducer.py | Python | apache-2.0 | 2,023 |
# Copyright (c) 2011 OpenStack, LLC
# Copyright (c) 2015 Rushil Chugh
# Copyright (c) 2015 Clinton Knight
# 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
#
# ... | bswartz/manila | manila/tests/scheduler/test_host_manager.py | Python | apache-2.0 | 43,579 |
"""
Django settings for the admin project.
"""
import os
from urlparse import urlparse
from website import settings as osf_settings
from django.contrib import messages
from api.base.settings import * # noqa
# TODO ALL SETTINGS FROM API WILL BE IMPORTED AND WILL NEED TO BE OVERRRIDEN
# TODO THIS IS A STEP TOWARD INTEG... | caseyrollins/osf.io | admin/base/settings/defaults.py | Python | apache-2.0 | 7,533 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2017 Google 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 req... | chunfengh/seq2seq | bin/tools/generate_toy_data.py | Python | apache-2.0 | 5,150 |
# Copyright 2011 OpenStack Foundation.
# 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... | citrix-openstack-build/os-collect-config | os_collect_config/openstack/common/importutils.py | Python | apache-2.0 | 2,372 |
__all__ = [
"client",
"utils"
]
from . import * # noqa
| coursera/courseraresearchexports | courseraresearchexports/containers/__init__.py | Python | apache-2.0 | 65 |
import functools
class Solution:
def convert(self, s: str, numRows: int) -> str:
if numRows == 1:
return s
ret = [[] for _ in range(numRows)]
pattern = numRows*2 - 2
for i in range(len(s)):
if i % pattern < numRows:
ret[i % pattern].ap... | MingfeiPan/leetcode | string/6.py | Python | apache-2.0 | 526 |
import ephem
import numpy
import pytz
import datetime
from datetime import timedelta
from ..constants import ObjectTableLabels
class Objects:
def __init__(self, place):
self.place = place
def get_visible(self, conditions, start, stop, hours_margin=0, sort_by=[ObjectTableLabels.TRANSIT]):
visible = self.... | pozar87/apts | apts/objects/objects.py | Python | apache-2.0 | 1,992 |
#!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
'''
Analytical nuclear gradients of CASCI excited state.
'''
from pyscf import gto
from pyscf import scf
from pyscf import mcscf
from pyscf import lib
import inspect
mol = gto.M(
atom = [
["O" , (0. , 0. , 0.)],
[1 , (0. ... | sunqm/pyscf | examples/grad/12-excited_state_casscf_grad.py | Python | apache-2.0 | 3,547 |
# Copyright 2016 Google 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 to in writing, ... | daspecster/google-cloud-python | speech/google/cloud/speech/client.py | Python | apache-2.0 | 4,677 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import operator
import os
import platform
import sys
if "__PEX_UNVENDORED... | jsirois/pex | pex/vendor/_vendored/packaging/packaging/markers.py | Python | apache-2.0 | 9,913 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
dino.__main__
~~~~~~~~~~~~~~~~~~~~~
The main entry point for the command line interface.
Invoke as ``dino`` (if installed)
or ``python -m dino`` (no install required).
"""
from __future__ import absolute_import, unicode_literals
import logging
import sys
from dino.lo... | xandors/dino | dino/__main__.py | Python | apache-2.0 | 941 |
#!/usr/bin/env python
import os
import setuptools
def read_requires(base):
path = os.path.join('tools', base)
requires = []
if not os.path.isfile(path):
return requires
with open(path, 'rb') as h:
for line in h.read.splitlines():
line = line.strip()
if len(line... | JohnGarbutt/TaskFlow | setup.py | Python | apache-2.0 | 1,330 |
#!/usr/bin/env python
# coding: utf-8
#http://python-3-patterns-idioms-test.readthedocs.org/en/latest/Metaprogramming.html
class RegisterClasses(type):
def __init__(cls, name, bases, atts):
super(RegisterClasses, cls).__init__(name, bases, atts)
if not hasattr(cls, 'registry'):
... | heibanke/python_do_something | Code/Chapter5/meta_04.py | Python | apache-2.0 | 1,022 |
#!/usr/bin/env python2
#
# 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
# ... | andrwng/kudu | build-support/run_dist_test.py | Python | apache-2.0 | 5,863 |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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... | our-city-app/oca-backend | src/rogerthat/dal/activation.py | Python | apache-2.0 | 1,112 |
"""Stateful programmatic WWW navigation, after Perl's WWW::Mechanize.
Copyright 2003-2006 John J. Lee <jjl@pobox.com>
Copyright 2003 Andy Lester (original Perl code)
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD or ZPL 2.1 licenses (see the file COPYING.txt
included w... | Masood-M/yalih | mechanize/_mechanize.py | Python | apache-2.0 | 31,059 |
__author__ = 'ehiller@css.edu'
# Module to support custom teacher views in CourseBuilder dashboard
# Views include:
# Section Roster - list of students in section
# Sections - list of sections for current user
# Student Dashboard - view of a single student's performance in the course
# Teacher... | ehiller/mobilecsp-v18 | modules/teacher_dashboard/teacher_dashboard.py | Python | apache-2.0 | 21,342 |
#!/usr/bin/python
# vim: expandtab:tabstop=4:shiftwidth=4
# Disabling invalid-name because pylint doesn't like the naming convention we have.
# pylint: disable=invalid-name
''' Tool to detect haproxy processes that have been running longer than
the most recent haproxy process and have connection in CLOSE_WAIT stat... | joelsmith/openshift-tools | scripts/monitoring/cron-haproxy-close-wait.py | Python | apache-2.0 | 3,742 |
# pyOCD debugger
# Copyright (c) 2006-2013 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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... | mbedmicro/pyOCD | pyocd/target/builtin/target_lpc800.py | Python | apache-2.0 | 4,050 |