code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import json
import logging
import re
from urllib.parse import unquote_plus
from streamlink.plugin import Plugin, PluginError
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
log = logging.getLogger(__name__)
QUALITY_WEIGHTS = {
"src": 1080,
}
class DLive(Plugin):
_re_url ... | beardypig/streamlink | src/streamlink/plugins/dlive.py | Python | bsd-2-clause | 3,485 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0005_waypoint_event_dependency'),
]
operations = [
migrations.AlterField(
model_name='events',
... | flipjack/misrutas | project/app/migrations/0006_auto_20151006_1038.py | Python | mit | 973 |
"""OpenID 2.0 - Requesting Authentication
Ref: https://openid.net/specs/openid-authentication-2_0.html#requesting_authentication
"""
from urllib.parse import urlencode
from uuid import uuid4
from datetime import datetime, timezone
from requests import get
from .utils import create_return_to
class Authentication:
... | mac-developer/openid-wargaming | openid_wargaming/authentication.py | Python | mit | 3,304 |
def test_salt_contrib_installed(File):
grains = File('/srv/salt/_grains')
assert grains.exists
assert grains.is_symlink
contrib_repo = File('/etc/salt/contrib')
assert contrib_repo.exists
assert contrib_repo.is_directory
| mitodl/salt-ops | tests/test_salt_contrib.py | Python | bsd-3-clause | 245 |
import googlemaps
from google_accounts import accounts
app = accounts["torino"]
gmaps = googlemaps.Client(key=app["api_key"])
reverse_result = gmaps.reverse_geocode((40.6413111,-73.77813909999999))
for result in reverse_result:
print(result["types"], result["formatted_address"]) | bmtgoncalves/TorinoCourse | Lecture IV/google_reverse_geocode.py | Python | mit | 283 |
"""
Tests for `bx.align.score`.
"""
import bx.align.score
import bx.align.maf
import StringIO
import unittest
import sys
from numpy import array, cumsum, allclose
aligns = [ ( "CCACTAGTTTTTAAATAATCTACTATCAAATAAAAGATTTGTTAATAATAAATTTTAAATCATTAACACTT",
"CCATTTGGGTTCAAAAATTGATCTATCA----------TGGTGGATTATTAT... | dnanexus/rseqc | rseqc/lib/bx/align/score_tests.py | Python | gpl-3.0 | 4,010 |
# -*- coding: utf-8 -*-
#
# gmtasks documentation build configuration file, created by
# sphinx-quickstart on Thu Jan 19 17:32:25 2012.
#
# 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
# autogenerated file.
#
# All... | ex-nerd/gmtasks | doc/source/conf.py | Python | bsd-3-clause | 8,027 |
from flask import render_template, redirect, request, url_for, flash
from flask.ext.login import login_user, logout_user, login_required, current_user
from . import auth
from .. import db
from ..models import User
from ..email import send_email
from .forms import LoginForm, RegistrationForm, ChangePasswordForm,\
Pa... | Lirean/Elibrary | app/auth/views.py | Python | gpl-3.0 | 6,011 |
#!/usr/bin/env python
"""
tests for mozfile.load
"""
import mozhttpd
import os
import tempfile
import unittest
from mozfile import load
class TestLoad(unittest.TestCase):
"""test the load function"""
def test_http(self):
"""test with mozhttpd and a http:// URL"""
def example(request):
... | vladikoff/fxa-mochitest | tests/mozbase/mozfile/tests/test_load.py | Python | mpl-2.0 | 1,783 |
###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# mod... | nielsbuwen/ilastik | ilastik/utility/globals.py | Python | gpl-3.0 | 1,249 |
from DisplayTarget import DisplayTarget
from layout import Unit
from utils.DOM import DOM
from utils.datatypes import *
from utils import dialog
from utils import vfs
import utils
import gtk
try:
from utils import svg
except ImportError:
import sys
log("Could not import svg module!")
sys.exit(1)
#
#... | RaumZeit/gdesklets-core | display/TargetCanvas.py | Python | gpl-2.0 | 7,277 |
# coding: utf-8
import os,logging
from flask import send_from_directory, current_app, request,redirect,url_for,abort,flash
from flask_menu.classy import register_flaskview
from flask_menu import MenuEntryMixin,current_menu
from flask_classful import FlaskView,route
from flask_security import roles_accepted,current_use... | Spotipo/spotipo | unifispot/ext/routes.py | Python | agpl-3.0 | 4,225 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('tasks', '0005_auto_20170228_0037'),
]
operations = [
migrations.AlterUniqueTogether(
name='persondeduplication',... | dchaplinsky/pep.org.ua | pepdb/tasks/migrations/0006_auto_20170228_0051.py | Python | mit | 403 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set expandtab:ts=4:sw=4:setfiletype python
import os
import stat
from waflib import Context
from waflib.Build import BuildContext
import atexit
def options(self):
pass
packages = [
# "Pillow==2.2.1",
# "docutils==0.11",
# "actdiag==0.5.0",
# "nwdia... | socrocket/pysc | waf/shell.py | Python | lgpl-3.0 | 3,376 |
import _plotly_utils.basevalidators
class XaxisValidator(_plotly_utils.basevalidators.SubplotidValidator):
def __init__(self, plotly_name="xaxis", parent_name="waterfall", **kwargs):
super(XaxisValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/waterfall/_xaxis.py | Python | mit | 452 |
def statustype():
errors = ('EXPNEEDED', 'NOERROR', 'WARNING', 'EXITERROR')
return errors
def errortype():
return {} # TODO
class RadarStatus(): # TODO finish the class when we determine how to log and what information
# from the driver that we would like to pass back to the experiment / user.
... | SuperDARNCanada/borealis | radar_status/radar_status.py | Python | gpl-3.0 | 1,108 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 João Pedro Rodrigues
#
# 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... | JoaoRodrigues/pdb-tools | pdbtools/pdb_keepcoord.py | Python | apache-2.0 | 3,212 |
from scipy.stats import betabinom, hypergeom, bernoulli, boltzmann
import numpy as np
from numpy.testing import assert_almost_equal, assert_equal, assert_allclose
def test_hypergeom_logpmf():
# symmetries test
# f(k,N,K,n) = f(n-k,N,N-K,n) = f(K-k,N,K,N-n) = f(k,N,n,K)
k = 5
N = 50
K = 10
n = ... | pizzathief/scipy | scipy/stats/tests/test_discrete_distns.py | Python | bsd-3-clause | 1,955 |
# -*- coding: utf-8 -*-
# pylint: disable-msg=E1101, E0102, E0202
"""
Created on Mon Feb 27 12:08:29 2012
Module with definition of classes to work with annotations in the MIT format.
@author: T. Teijeiro
"""
import struct
class MITAnnotation(object):
"""
This class represents an annotation in the MIT format... | citiususc/construe | construe/utils/MIT/MITAnnotation.py | Python | agpl-3.0 | 6,004 |
import unittest
import ray
import ray.rllib.agents.ppo as ppo
from ray.rllib.policy.policy import LEARNER_STATS_KEY
from ray.rllib.policy.sample_batch import DEFAULT_POLICY_ID
from ray.rllib.utils.test_utils import check_compute_single_action, \
framework_iterator
class TestDDPPO(unittest.TestCase):
@classme... | pcmoritz/ray-1 | rllib/agents/ppo/tests/test_ddppo.py | Python | apache-2.0 | 1,760 |
import os
from kolekto.db import MoviesMetadata
class Command(object):
"""
Base class for all commands.
:cvar help: the help for the command
"""
help = ''
def __init__(self, name, profile, aparser_subs):
self._aparser = aparser_subs.add_parser(name, help=self.help)
self._p... | NaPs/Kolekto | kolekto/commands/__init__.py | Python | mit | 1,232 |
from blueman.services.meta import NetworkService
from blueman.Sdp import GN_SVCLASS_ID
class GroupNetwork(NetworkService):
__svclass_id__ = GN_SVCLASS_ID
__icon__ = "network-wireless"
__priority__ = 80
| blueman-project/blueman | blueman/services/GroupNetwork.py | Python | gpl-3.0 | 216 |
# -*- coding: utf-8 -*-
# Copyright 2015 Mirantis, 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 requir... | xarses/fuel-library | utils/fuel-tasklib/tasklib/graph.py | Python | apache-2.0 | 2,428 |
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 16 10:33:52 2015
@author: anderson
"""
import numpy as np
import time
from pyhfo.core import EventList
def find_max(data, thr=None):
'''
return the index of the local maximum
'''
value = (np.diff(np.sign(np.diff(data))) < 0).nonzero()[0] + 1
if thr is... | britodasilva/pyhfo | pyhfo/core/aux_func.py | Python | mit | 1,885 |
# Copyright (C) 2013 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 ... | endlessm/chromium-browser | third_party/blink/renderer/build/scripts/name_utilities.py | Python | bsd-3-clause | 2,778 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
r_li_pielou_ascii.py
--------------------
Date : February 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
******************... | stevenmizuno/QGIS | python/plugins/processing/algs/grass7/ext/r_li_pielou_ascii.py | Python | gpl-2.0 | 1,510 |
import unittest2 as unittest
from config import *
from tweepy import API, OAuthHandler
class TweepyAuthTests(unittest.TestCase):
def testoauth(self):
auth = OAuthHandler(oauth_consumer_key, oauth_consumer_secret)
# test getting access token
auth_url = auth.get_authorization_url()
... | abhishekgahlot/tweepy | tests/test_auth.py | Python | mit | 717 |
from django.conf.urls import url
from timeline import views
urlpatterns = [
url(r'^$', views.timelines, name='timelines'),
] | fredwulei/fredsneverland | fredsneverland/timeline/urls.py | Python | mit | 130 |
# Embedded file name: /usr/lib/enigma2/python/Components/Converter/TunerInfo.py
from Components.Sources.TunerInfo import TunerInfo as TunerInfoSource
from Components.Converter.Converter import Converter
from Components.Element import cached
class TunerInfo(Converter, object):
def __init__(self, type):
... | kingvuplus/boom2 | lib/python/Components/Converter/TunerInfo.py | Python | gpl-2.0 | 1,171 |
#!/usr/bin/env python
"""ngo-admin で呼ばれる管理用コマンドモジュール."""
import os
import sys
from ngo.backends import NgoTemplate
def startproject(project_name):
"""ngoプロジェクトを作成する."""
import ngo
top_dir = os.getcwd()
origin_project_path = os.path.join(ngo.__path__[0], 'project_template')
# manaeg.p... | naritotakizawa/ngo | ngo/admin.py | Python | mit | 1,524 |
from sympy.physics.mechanics import (dynamicsymbols, ReferenceFrame, Point,
RigidBody, LagrangesMethod, Particle,
inertia, Lagrangian)
from sympy import symbols, pi, sin, cos, tan, simplify, Function, \
Derivative, Matrix
def test_disc_on... | grevutiu-gabriel/sympy | sympy/physics/mechanics/tests/test_lagrange.py | Python | bsd-3-clause | 9,351 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | v-iam/azure-sdk-for-python | azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/operation_entity.py | Python | mit | 1,487 |
from __future__ import print_function, division
from imgaug import augmenters as iaa
from scipy import misc, ndimage
import numpy as np
from skimage import data
import cv2
from itertools import cycle
POINT_SIZE = 5
DEG_PER_STEP = 1
TIME_PER_STEP = 10
def main():
image = data.astronaut()
cv2.namedWindow("aug"... | nektor211/imgaug | tests/check_directed_edge_detect.py | Python | mit | 1,184 |
class TextrankRuntimeError(RuntimeError):
pass | summanlp/textrank | summa/exception/textrank_runtime_error.py | Python | mit | 50 |
# Copyright (c) 2016 Mirantis 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 writ... | shakamunyi/sahara | sahara/plugins/cdh/v5_11_0/plugin_utils.py | Python | apache-2.0 | 819 |
#----------------------------------------------------------------
# Author: Jason Gors <jasonDOTgorsATgmail>
# Creation Date: 09-20-2013
# Purpose: this is the point of call from the bep script.
# License: BSD
#----------------------------------------------------------------
import sys
pyversion = float(sys.version[... | b-e-p/bep | Bep/__init__.py | Python | bsd-3-clause | 487 |
# -*- coding: utf-8 -*-
import os.path
import sys
try:
import secret
except ImportError:
sys.stderr.write(""">> You should create secret.py next to config.py to define the secret key:
# -*- coding: utf-8 -*-
SECRET_KEY = 'qwerty123456'
""")
raise
LANGUAGES = ['fr', 'en', 'zh']
BABEL_DEFAULT_LOCALE = 'fr'
... | FrenchTech-Shanghai/ces-asia | ces_asia/config.py | Python | bsd-3-clause | 579 |
# -*- coding: utf-8 -*-
#
# Sibyl: A modular Python chat bot framework
# Copyright (c) 2015-2017 Joshua Haas <jahschwa.com>
#
# This file is part of Sibyl.
#
# Sibyl 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 Foundat... | jfrederickson/sibyl | protocols/sibyl_email.py | Python | gpl-3.0 | 13,650 |
##########################################################################
#
# Copyright (c) 2016, Image Engine Design 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:
#
# * Redistrib... | hradec/gaffer | python/GafferSceneUI/ShaderBallUI.py | Python | bsd-3-clause | 2,328 |
from __future__ import print_function, division
import matplotlib
import logging
from sys import stdout
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import (Net, RealApplianceSource,
BLSTMLayer, DimshuffleLayer,
Bidirectiona... | mmottahedi/neuralnilm_prototype | scripts/e475.py | Python | mit | 7,035 |
# Copyright (C) 2013 Midokura PTE 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 requ... | virtualopensystems/neutron | neutron/plugins/midonet/agent/midonet_driver.py | Python | apache-2.0 | 1,689 |
# 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... | jbedorf/tensorflow | tensorflow/contrib/distribute/python/step_fn_test.py | Python | apache-2.0 | 2,626 |
from django import forms
from crispy_forms.helper import FormHelper, Layout
from crispy_forms.layout import Field, Div, Row, HTML
from crispy_forms.bootstrap import FormActions, TabHolder, Tab
from ..models import UnidadMedida
from django.utils.translation import ugettext_lazy as _
from apps.utils.forms import smtSave,... | upeu-jul-20161-epis-ads2/MedicFast | apps/atencion/forms/UnidadMedidaForm.py | Python | bsd-3-clause | 851 |
#+
# Distutils script to build and install Pycairo. To avoid ending
# up with files in this directory belonging to root instead of
# the current user, do the build/install in two steps. First, as
# an ordinary user:
#
# python3 setup.py build
#
# then:
#
# sudo python3 setup.py install
#
# To get rid of build pr... | ldo/pycairo | setup.py | Python | gpl-3.0 | 6,235 |
# ------------------------------------------------------------------------------
# This file is part of Appy, a framework for building applications in the Python
# language. Copyright (C) 2007 Gaetan Delannay
# Appy is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public ... | Eveler/libs | __Python__/ufms_blanks/appy3/fields/integer.py | Python | gpl-3.0 | 3,493 |
# Copyright 2013 Thierry Carrez <thierry@openstack.org>
# 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
... | Konovalov-Nik/storyboard | storyboard/projects/views.py | Python | apache-2.0 | 6,194 |
"""
Common interface(s) to Attelo classifiers.
"""
from abc import ABCMeta, abstractmethod
from six import with_metaclass
class AttachClassifier(with_metaclass(ABCMeta, object)):
'''
An attachment classfier associates samples with attachment
probabilities. Attachment classifiers are agnostic to
wheth... | kowey/attelo | attelo/learning/interface.py | Python | gpl-3.0 | 3,346 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ar'
import json
import keras
from keras.layers import Convolution1D, Convolution2D, Convolution3D
from keras.layers import MaxPooling1D, MaxPooling2D, MaxPooling3D,\
AveragePooling1D, AveragePooling2D, AveragePooling3D
from keras.layers import UpSampling1D, U... | SummaLabs/DLS | app/backend/core/models/flow_parser_v2_helper_bk.py | Python | mit | 7,298 |
# -*- coding: utf-8 -*-
# Copyright (C) 2006-2008 Vodafone España, S.A.
# Copyright (C) 2008-2009 Warp Networks, S.L.
# Author: Pablo Martí
#
# 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; e... | andrewbird/wader | test/test_encoding.py | Python | gpl-2.0 | 7,859 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""code generator for GLES2 command buffers."""
import itertools
import os
import os.path
import sys
import re
import platform
fro... | SaschaMester/delicium | gpu/command_buffer/build_gles2_cmd_buffer.py | Python | bsd-3-clause | 350,071 |
"""
=============================================
Compute MxNE with time-frequency sparse prior
=============================================
The TF-MxNE solver is a distributed inverse method (like dSPM or sLORETA)
that promotes focal (sparse) sources (such as dipole fitting techniques).
The benefit of this approach ... | mne-tools/mne-tools.github.io | 0.12/_downloads/plot_time_frequency_mixed_norm_inverse.py | Python | bsd-3-clause | 4,959 |
# Copyright 2014 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 agr... | tvansteenburgh/PerfKitBenchmarker | perfkitbenchmarker/aws/aws_network.py | Python | apache-2.0 | 12,866 |
##
# Copyright 2013-2017 Ghent University
#
# This file is triple-licensed under GPLv2 (see below), MIT, and
# BSD three-clause licenses.
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the... | ULHPC/easybuild-framework | easybuild/toolchains/gmvolf.py | Python | gpl-2.0 | 1,741 |
from .dev import * # noqa
INSTALLED_APPS.append('wagtail_pgsearchbackend') # noqa: F405
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'postgres',
'USER': 'postgres',
'HOST': 'db',
'PORT': '5432',
}
}
WAGTAILSEARCH_BACKENDS = ... | kinaklub/next.filmfest.by | filmfest/settings/docker.py | Python | unlicense | 491 |
# Copyright 2013 NetApp
# 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 applic... | vponomaryov/manila | manila/api/v1/shares.py | Python | apache-2.0 | 18,956 |
#!/usr/bin/env python
# example togglebutton.py
import pygtk
pygtk.require('2.0')
import gtk
class ToggleButton:
# Our callback.
# The data passed to this method is printed to stdout
def callback(self, widget, data=None):
print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
... | certik/pyjamas | pygtkweb/demos/008-togglebutton.py | Python | apache-2.0 | 2,249 |
# Copyright (C) 2020 Renato Lima - Akretion <renato.lima@akretion.com.br>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
ISSQN_ELIGIBILITY = [
('1', 'Exigível'),
('2', 'Não incidência'),
('3', 'Isenção'),
('4', 'Exportação'),
('5', 'Imunidade'),
('6', 'Exigibilidade Suspensa ... | kmee/l10n-brazil | l10n_br_fiscal/constants/issqn.py | Python | agpl-3.0 | 545 |
import json
import sys
from typing import TYPE_CHECKING
from vnpy.api.rest import Request, RestClient
if TYPE_CHECKING:
from vnpy.gateway.oanda import OandaGateway
_ = lambda x: x # noqa
class OandaApiBase(RestClient):
"""
Oanda Base API
"""
def __init__(self, gateway: "OandaGateway"):
... | msincenselee/vnpy | vnpy/gateway/oanda/oanda_api_base.py | Python | mit | 1,465 |
"""Implementations of assessment abstract base class managers."""
# pylint: disable=invalid-name
# Method names comply with OSID specification.
# pylint: disable=no-init
# Abstract classes do not define __init__.
# pylint: disable=too-few-public-methods
# Some interfaces are specified as 'markers' and inclu... | mitsei/dlkit | dlkit/abstract_osid/assessment/managers.py | Python | mit | 156,558 |
# Copyright (c) 2014 Cisco Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | CiscoSystems/nova-solver-scheduler | nova/tests/scheduler/solvers/constraints/test_active_hosts_constraint.py | Python | apache-2.0 | 2,639 |
#!/usr/bin/env python
"""
Regex-based word tokenizers.
Note that small/full/half-width character variants are *not* covered.
If a text were to contains such characters, normalize it first.
"""
from __future__ import absolute_import, unicode_literals
import codecs
try:
from html import unescape
except ImportError:
... | ethancaballero/neural-engineers-first-attempt | load_d2c_data/segtok/tokenizer.py | Python | mit | 15,681 |
"""Domain models for the application."""
from .move import Move, Moves
from .turn import Turn
from .player import Player, Players
from .board import Board
from .game import Game
| jacebrowning/gridcommand | gridcommand/domain/__init__.py | Python | lgpl-3.0 | 179 |
# -*- coding: utf-8 -*-
# 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 o... | googleapis/python-api-common-protos | google/api/source_info_pb2.py | Python | apache-2.0 | 2,292 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
import os
import logging
logger = logging.getLogger(__name__)
def create_directory(path):
"""
Creates a directory if it doesn't already exist.
"""
# Check if path is a file_path or a dir_path. Di... | NejcZupec/ggrc-core | test/selenium/src/lib/file_ops.py | Python | apache-2.0 | 886 |
# Copyright 2012 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 requ... | afaheem88/tempest_neutron | tempest/manager.py | Python | apache-2.0 | 2,462 |
l = int(input())
h = int(input())
t = str(input())
alphabet = [str(input()) for i in range(h)]
for i in range(h):
for char in t.lower():
if char >= 'a' and char <= 'z':
x = ord(char) - ord('a')
else:
x = ord('z') - ord('a') + 1
print(alphabet[i][x*l : x*l+l], end='... | izanbf1803/Codingame-medium-solutions | easy/ASCII Art.py | Python | mit | 367 |
#@PydevCodeAnalysisIgnore
from django.utils.translation import ugettext_lazy as _
from django.conf.urls import patterns, url
urlpatterns = patterns('onlinejudge.views',
url(_(r"^$"), "index", {}, "index"),
url(_(r"^challenge/(?P<slug>[-\w]+)... | darbula/django-onlinejudge | onlinejudge/urls.py | Python | bsd-3-clause | 1,275 |
# -*- coding: UTF-8 -*-
"""
This module contains functions for calculating evaluation metrics for the generated service recommendations.
"""
import numpy
import pandas
runtime_metrics = ["Training time", "Overall testing time", "Individual testing time"]
quality_metrics = ["Recall", "Precision", "F1", "# of recommend... | krasch/smart-assistants | evaluation/metrics.py | Python | mit | 13,611 |
# 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
# ... | redhat-openstack/heat | heat/db/sqlalchemy/migrate_repo/versions/042_software_deployment_domain_project.py | Python | apache-2.0 | 1,204 |
import uuid
from datetime import datetime
from django.test import TestCase
from casexml.apps.case.mock import CaseBlock, IndexAttrs
from pillowtop.es_utils import initialize_index_and_mapping
from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.es.case_search import CaseSearchES
from corehq.apps.e... | dimagi/commcare-hq | corehq/apps/hqcase/tests/test_serialization.py | Python | bsd-3-clause | 4,423 |
import os
import multiprocessing
bind = '0.0.0.0:5000'
backlog = 2048
worker_class = 'gevent'
workers = 2
threads = 1
worker_connections = 1000
timeout = 30
keepalive = 2
max_requests = 1000
max_requests_jitter = 50
spew = False
daemon = False
pidfile = None
umask = 666
user = os.getenv('USER')
group = os.getenv('U... | benlaken/EEMiniService | python_app/gunicorn.py | Python | mit | 2,032 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-06 08:14
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('subscriptions', '0004_auto_20160923_0900'),
('subscriptions', '0005_filter'),
]
ope... | stadtgestalten/stadtgestalten | grouprise/features/subscriptions/migrations/0006_merge_20161006_1014.py | Python | agpl-3.0 | 338 |
"""Classes for handling connection to StatusDB."""
import couchdb
import logging
from datetime import datetime
logger = logging.getLogger(__name__)
class StatusdbSession(object):
"""Wrapper class for couchdb."""
def __init__(self, config, db=None):
user = config.get('username')
password = con... | SciLifeLab/TACA | taca/utils/statusdb.py | Python | mit | 5,182 |
# Tai Sakuma <tai.sakuma@gmail.com>
import itertools
import operator
import numpy as np
##__________________________________________________________________||
class DeltaR(object):
def __init__(self,
obj1_eta_phi_names=('eta', 'phi'),
obj2_eta_phi_names=('eta', 'phi')
):
... | TaiSakuma/scribblers | scribblers/match.py | Python | bsd-3-clause | 6,247 |
'''
from flask.ext.wtf import Form, TextField, BooleanField
from flask.ext.wtf import Required
class LoginForm(Form):
username = TextField('username', validators = [Required()])
password = TextField('password', validators = [Required()])
'''
| matthewhughes/really-scrapable-web-app | app/forms.py | Python | mit | 255 |
# Copyright 2014 Google Inc. All Rights Reserved.
"""Helper methods for record-set transactions."""
import os
from dns import rdatatype
import yaml
from googlecloudapis.dns.v1 import dns_v1_messages as messages
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.core.util import resource_printer
from... | wemanuel/smry | smry/server-auth/ls/google-cloud-sdk/lib/googlecloudsdk/dns/lib/transaction_util.py | Python | apache-2.0 | 3,899 |
#!/usr/bin/env python
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
__license__ = 'GPL v3'
import json, os, traceback
from PyQt4.Qt import (Qt, QDialog, QDialogButtonBox, QSyntaxHighlighter, QFont,
QRegExp, QApplication, QTextCharFormat, QColor,... | pra85/calibre | src/calibre/gui2/dialogs/template_dialog.py | Python | gpl-3.0 | 16,701 |
# -*- coding: utf-8 -*-
"""Markov Decision Process (MDP) Toolbox: ``example`` module
=========================================================
The ``example`` module provides functions to generate valid MDP transition and
reward matrices.
Available functions
-------------------
:func:`~mdptoolbox.example.forest`
... | McCabeJM/pymdptoolbox | src/mdptoolbox/example.py | Python | bsd-3-clause | 15,234 |
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.core.urlresolvers import reverse
from openbudgets.apps.pages import factories
class PageTestCase(TestCase):
"""Tests for pages.Page objects and their related views. urls, etc."""
def setUp(self):
self.page = factories.Page.create()... | shaib/openbudgets | openbudgets/apps/pages/tests.py | Python | bsd-3-clause | 771 |
#coding=utf-8
import time
import logging
import os
class BasePage():
'''页面基础类'''
# 初始化
def __init__(self,selenium_driver,base_url):
self.driver = selenium_driver
self.base_url = base_url
#self.pagetitle = pagetitle
self.timeout = 10
# 打开不同的子页面
def _open(self, url)... | gtla6224422/atx_script | page_object/BasePage.py | Python | apache-2.0 | 1,539 |
"""Function-like object creating triclinic lattices.
The following lattice creator is defined:
Triclinic
"""
from ase.lattice.bravais import Bravais
import numpy as np
from ase.data import reference_states as _refstate
class TriclinicFactory(Bravais):
"A factory for creating triclinic lattices."
# The n... | grhawk/ASE | tools/ase/lattice/triclinic.py | Python | gpl-2.0 | 3,214 |
from flask import Flask, request, redirect, render_template, session, flash
from mysqlconnection import MySQLConnector
import re
app = Flask(__name__)
mysql = MySQLConnector(app, 'emailval')
app.secret_key = 'secret'
EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$')
@app.route('/')
def validat... | jiobert/python | Smith_Ben/Assignments/email_validation/emai.py | Python | mit | 1,552 |
import argparse
import pandas
import os
import numpy as np
import matplotlib.pyplot as plt
import functools
from collections import Counter
import math
import random
def accuracy(decision_vector):
ok = len([s[2] for s in decision_vector if confusion_matrix_label(s) in ['TP', 'TN']])
return float(ok) / len(dec... | aquemy/HCBR | script/biais.py | Python | mit | 3,235 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | punalpatel/st2 | st2stream/st2stream/cmd/api.py | Python | apache-2.0 | 3,288 |
#!/usr/bin/env python
import sys
import re
import getopt
from feed_maker_util import IO
def main():
state = 0
url_prefix = "https://spring.io"
result_list = []
num_of_recent_feeds = 1000
optlist, _ = getopt.getopt(sys.argv[1:], "n:")
for o, a in optlist:
if o == '-n':
nu... | terzeron/FeedMakerApplications | study/_spring/capture_item_link_title.py | Python | gpl-2.0 | 1,528 |
from __future__ import division, print_function
"""
Scripts to automate running the DEIMOS spec1d pipeline (in IDL)
"""
import os
import sys
import time
invoke_spec2d_templ = "et_domask,'{planfn}'\nexit\n"
def invoke_spec2d(path, maskname):
"""
Runs spec2d in the given path, assuming there's a {maskname}.p... | eteq/erikutils | erikutils/spec2d_runner.py | Python | mit | 3,998 |
from django.core import urlresolvers
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import timesince, floatformat
from horizon import tables
from horizon.templatetags.sizeformat import mbformat
class CSVSummary(tables.LinkAction):
name = "csv_summary"
verbose_name... | MKTCloud/MKTCloud | openstack_dashboard/usage/tables.py | Python | apache-2.0 | 2,531 |
# Copyright (c) 2011-2015 Rackspace US, 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... | samstav/simpl | simpl/incubator/rest.py | Python | apache-2.0 | 7,797 |
class InitDefaulter():
_init_defaults = {}
def __init__(self, *args, **kwargs):
for name, value in self._init_defaults.items():
if name not in kwargs:
kwargs[name] = value
super().__init__(*args, **kwargs)
| gitaarik/jazzchords | apps/core/helpers/init_defaulter.py | Python | gpl-3.0 | 262 |
import numpy as np
from .shared import StaticContainerStore, StaticContainer
import mdtraj
from openpathsampling.netcdfplus import WeakLRUCache
variables = ['statics']
lazy = ['statics']
storables = ['statics']
dimensions = ['n_atoms', 'n_spatial']
def netcdfplus_init(store):
static_store = StaticContainerStor... | jhprinz/openpathsampling | openpathsampling/engines/features/statics.py | Python | lgpl-2.1 | 2,708 |
#source : http://code.activestate.com/recipes/439094-get-the-ip-address-associated-with-a-network-inter/
#!/usr/bin/python
# -*- coding: utf-8 -*-
import socket
import fcntl
import struct
import sl_metro
import time
def param(ifname):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
retu... | DiamondOhana/jphacks | rpi_main/sonilab/get_ip.py | Python | mit | 806 |
from enum import Enum
#####################################################################################
# This file is generated by Json2Class (https://github.com/DragonSpawn/Json2Class) #
# Modifications to this file will be lost the next time you run the tool. #
# ... | HenrikPoulsen/Json2Class | test/SampleProjects/PySample/Generated/gender.py | Python | mit | 522 |
#!/usr/bin/env python
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2016 NIWA
#
# 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 yo... | benfitzpatrick/cylc | lib/cylc/job_file.py | Python | gpl-3.0 | 16,967 |
# -*- coding: utf8 -*-
#
# Copyright (C) 2014 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License,... | ndp-systemes/odoo-addons | stock_auto_move/__openerp__.py | Python | agpl-3.0 | 1,664 |
#!/usr/bin/env python
import os,sys,time
definepath=os.getcwd()
sys.path.append("%s/bin/ftsrc/" % (definepath))
import include
try:
import psyco
psyco.full()
except ImportError:
pass
definepath=os.getcwd()
while 1==1:
include.print_banner()
menu=raw_input("""
Microsoft SQL Attack Tools
1. MSSQL Injec... | goofwear/raspberry_pwn | src/pentest/fasttrack/bin/menu/mssqlattacks.py | Python | gpl-3.0 | 1,202 |
config = {
"interfaces": {
"google.cloud.dataproc.v1beta2.WorkflowTemplateService": {
"retry_codes": {
"idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
"non_idempotent": []
},
"retry_params": {
"default": {
... | jonparrott/google-cloud-python | dataproc/google/cloud/dataproc_v1beta2/gapic/workflow_template_service_client_config.py | Python | apache-2.0 | 2,053 |
import argparse,fileinput,os,sys,subprocess
import os
import random
import cPickle
#caffe_root = '../../caffe/' #PATH TO CAFFE ROOT
#sys.path.insert(0,caffe_root + 'python')
#import caffe
#caffe.set_device(0)
#caffe.set_mode_gpu()
#Parse the arguments
def ParseInputArguments():
parser = argparse.ArgumentParser()... | MikeMpapa/CNNs-Speech-Music-Discrimination | trainCNN.py | Python | mit | 7,063 |
"""
@author: Maneesh D
@email: maneeshd77@gmail.com
"""
def is_prime(num):
limit = int(num ** 0.5) + 1
for i in range(2, limit):
if num % i == 0:
return False
return True
def sum_primes(upto_num):
total = 2
for num in range(3, upto_num+1, 2):
if is_prime(num):
... | maneeshd/PyTutorial | Advanced/Multi-Threading & Processing/threading/primes_single_thread.py | Python | mit | 647 |
#%%
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
import matplotlib.cm as cm
from tqdm import trange, tqdm
from sklearn.metrics import adjusted_rand_score, f1_score
from argparse import ArgumentParser
from util.config_parser import ConfigParser_with_eval
import warnings... | EmergentSystemLabStudent/NPB_DAA | sample/summary_and_plot.py | Python | mit | 7,089 |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 17 15:48:31 2015
@author: thomas.douenne
"""
# L'objectif est de décrire l'évolution des montants des accises de la TICPE depuis 1993
# Import de fonctions spécifiques à Openfisca Indirect Taxation
from openfisca_france_indirect_taxation.examples.utils_example import gr... | benjello/openfisca-france-indirect-taxation | openfisca_france_indirect_taxation/examples/transports/plot_legislation/plot_ticpe_accises.py | Python | agpl-3.0 | 865 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.