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 |
|---|---|---|---|---|---|
## Adding ./getresults to the Python path so that the modules in folder can be imported
import sys
sys.path.insert(0, './getresults')
import datetime
from flightsearch import flightsearch, flightresult
import os
import uuid
import time
from pprint import pprint
def main():
flyfrom = 'YYZ' #input("Enter departure ... | brahul90/cheapflights | cheapflights/main.py | Python | apache-2.0 | 1,721 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
gateway tests - Testing the gateway.getObject() and deleteObjects() methods
Copyright 2013-2014 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
pytest fixtures used as defined in conftest.py:
- gatewa... | emilroz/openmicroscopy | components/tools/OmeroPy/test/integration/gatewaytest/test_get_objects.py | Python | gpl-2.0 | 26,235 |
#!/usr/bin/env python
"""
Copyright (C) 2016 Elliott Mitchell <ehem+android@m5p.com>
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 late... | ehem/kdztools | libexec/gpt.py | Python | gpl-3.0 | 8,879 |
# encoding: utf-8
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
from urllib import quote_plus
from django.core.urlresolvers import reverse
from mock import patch
from openid import fetchers
from openid.consumer import consume... | miing/mci_migo | webui/tests/test_views_consumer.py | Python | agpl-3.0 | 13,544 |
from __future__ import absolute_import
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd.util import *
from autograd import grad
npr.seed(1)
def test_real_type():
fun = lambda x: np.sum(np.real(x))
df = grad(fun)
assert type(df(1.0)) == float
assert type(df(1.0j)) == complex... | kcarnold/autograd | tests/test_complex.py | Python | mit | 1,428 |
# -*- coding: utf-8 -*-
#
# synapsecollection.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 Licen... | SepehrMN/nest-simulator | pynest/examples/synapsecollection.py | Python | gpl-2.0 | 5,672 |
# -*- coding: utf-8 -*-
"""The LVM path specification resolver helper implementation."""
# This is necessary to prevent a circular import.
import dfvfs.file_io.lvm_file_io
import dfvfs.vfs.lvm_file_system
from dfvfs.lib import definitions
from dfvfs.resolver import resolver
from dfvfs.resolver import resolver_helper
... | dc3-plaso/dfvfs | dfvfs/resolver/lvm_resolver_helper.py | Python | apache-2.0 | 1,206 |
r'''A bridge of XML and python basic variable
Program can dump any variable of basic type to a xml file, or read variable
from xml file. It based on xml.etree.ElementTree module in standard. Beside
basic type, it can support other type defined as follow:
- datetime.datetime
'''
from lxml import etree
import os
im... | cvvnx1/xmlparse | xmlparse.py | Python | gpl-2.0 | 6,437 |
import os
import cfg
import fr_classes
import time
import fr_functions
import menu_main
# =========================
# PROJECTS
# =========================
def view_projects(name, item_index):
os.system("clear")
print("\n\nDate".ljust(15) + "Project Name".ljust(50) + "Sessions")
print("="*75)
f... | everybody-codes/Handle-My-Music-Business | menu_projects.py | Python | gpl-2.0 | 3,572 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2017 Vincent Noel (vincent.noel@butantan.gov.br)
#
# This file is part of libSigNetSim.
#
# libSigNetSim 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 Fou... | msreis/SigNetSim | signetsim/views/analyse/AnalyseBifurcationView.py | Python | agpl-3.0 | 4,521 |
#!/usr/bin/env python
import pycef
import json
from unittest import TestCase
LINE1_REF = dict(Name="Test pipe event 1", DeviceName="Test pipe event 1", field1="value1", field2="value2|more", field3="value3", DeviceVendor="pycef", CEFVersion="0", Severity="3", DeviceSeverity="3", DeviceEventClassID="2", DeviceProduct=... | DavidJBianco/pycef | tests/test_pipes.py | Python | mit | 809 |
#Modified verion of a library available here: https://github.com/sgraber/markdown.subscript
"""Subscript extension for Markdown.
To subscript something, place a tilde symbol, '~', before and after the
text that you would like in subscript: C~6~H~12~O~6~
The numbers in this example will be subscripted. See below for... | byohay/Remarkable | markdown/extensions/subscript.py | Python | mit | 1,497 |
# Copyright 2015 OpenStack Foundation.
#
# 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... | projectcalico/calico-neutron | neutron/agent/metadata/config.py | Python | apache-2.0 | 3,403 |
# -*- coding: utf-8 -*-
from bartendro import db
from sqlalchemy.orm import mapper, relationship
from sqlalchemy import Table, Column, Integer, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
class Dispenser(db.Model):
"""
Information about a dispenser
"""
__tablename__ = 'dispenser... | fivef/bartendro | ui/bartendro/model/dispenser.py | Python | gpl-2.0 | 907 |
import _plotly_utils.basevalidators
class RotationValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="rotation", parent_name="pie", **kwargs):
super(RotationValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/pie/_rotation.py | Python | mit | 522 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from twisted.internet import threads
from twisted.internet.threads import deferToThread
InThread = deferToThread.__get__
def deferToThread(f):... | Stibbons/Squirrel | backend/squirrel/common/thread.py | Python | gpl-3.0 | 1,014 |
from distutils.core import setup
setup(name="fs_uae_netplay_server",
version="1.2.1",
description="FS-UAE Netplay Server",
author="Frode Solheim",
author_email="fs-uae@fengestad.no",
url="http://www.fengestad.no/fs-uae",
packages=["fs_uae_netplay_server"],
scripts=["scripts/fs... | lunixbochs/fs-uae-gles | server/setup.py | Python | gpl-2.0 | 390 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Burglish Project
#
# 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 ... | thetnswe/zawgyi | burglish/build/burglish_gen.py | Python | gpl-2.0 | 4,685 |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 TurboCoin
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test resurrection of mined transactions when the blockchain is re-organized."""
from test_framework.blocktools import cr... | Phonemetra/TurboCoin | test/functional/mempool_resurrect.py | Python | mit | 2,895 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=2:sts=2:ts=2
import os
from os.path import basename
import time
import subprocess
import wx
#import wx.lib.langlistctrl
#from wx.lib.langlistctrl import GetWxIdentifierForLanguage
from wx.lib.mixins.listctrl import ListCtrlAutoWidthMixin
# on my box, I only get two versions of e... | mmclead/ffmpeg2theora | frontend/theoraenc/addSubtitlesDialog.py | Python | gpl-2.0 | 10,228 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-12 08:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('goals', '0003_auto_20170310_2039'),
]
operations = [
migrations.RemoveField... | triump0870/mysana | src/goals/migrations/0004_auto_20170312_0800.py | Python | mit | 624 |
# Tint: file sharing made much simpler
#
# This file is part of Tint.
#
# Copyright (C) 2017 Cole Webb
#
# 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 L... | colewebb/tint | tint.py | Python | gpl-3.0 | 4,163 |
import sys
sys.path.insert(0, ".")
from coalib.results.Diff import Diff
from coalib.results.PatchResult import PatchResult
import unittest
class PatchResultTest(unittest.TestCase):
def test_raises(self):
self.assertRaises(TypeError,
PatchResult,
origin=... | andreimacavei/coala | coalib/tests/results/PatchResultTest.py | Python | agpl-3.0 | 1,904 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Manage Coolmagic
~~~~~~~~~~~~~~~~
Manage the coolmagic example application.
:copyright: (c) 2009 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import os
from coolmagic import make_app
from werk... | jackTheRipper/iotrussia | web_server/lib/werkzeug-master/examples/manage-coolmagic.py | Python | gpl-2.0 | 500 |
"""Buffers for communication with high-level (cognitive) architectures, and possibly between modules.
A buffer can generally contain a single object. Bidirectional buffers are
special in that they keep two objects, one for *input* and one for *output*.
The interpretation of input and output depend who *owns* the buffe... | napratin/nap | nap/util/buffer.py | Python | mit | 2,961 |
from datapackage_pipelines.wrapper import ingest, spew
# this members have a problem with their names
# we can match them directly
KMMBR_IDS_DIRECT_MATCH_TO_PERSON_ID = {'000000431': 431}
def get_mk_individuals(resource, data):
data['mks'] = []
for mk in resource:
yield mk
knesset_nums = set... | OriHoch/knesset-data-pipelines | votes/join_kmmbr_mk_individuals.py | Python | mit | 4,007 |
import contextlib
import datetime as dt
import functools
import mock
from framework.auth import Auth
from django.utils import timezone
from google.cloud.storage import Client, Bucket, Blob
import blinker
from website.signals import ALL_SIGNALS
from website.archiver import ARCHIVER_SUCCESS
from website.archiver import... | felliott/osf.io | osf_tests/utils.py | Python | apache-2.0 | 7,147 |
# -*- coding: utf-8 -*-
"""
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.
This program is distributed in... | estaban/pyload | module/plugins/hoster/SpeedfileCz.py | Python | gpl-3.0 | 1,095 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Eric Beanland <eric.beanland@gmail.com>
# This file is part of RecordSheet
#
# RecordSheet 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, ... | ericbean/RecordSheet | test/test_jsonapp.py | Python | gpl-3.0 | 5,052 |
'''test_measureimageintensity.py Test the MeasureImageIntensity module
CellProfiler is distributed under the GNU General Public License.
See the accompanying file LICENSE for details.
Copyright (c) 2003-2009 Massachusetts Institute of Technology
Copyright (c) 2009-2015 Broad Institute
All rights reserved.
Please see... | sstoma/CellProfiler | cellprofiler/modules/tests/test_measureimageintensity.py | Python | gpl-2.0 | 21,220 |
def style(target, cssFile):
cssFile = open(cssFile, "r").read()
temp = open(target).read()
temp = "<div><style scoped>" + cssFile + "</style><div class = \"datagrid\">" + temp + "</div></div>"
final = open(target, "w")
final.write(temp)
| crazycat9x/spreadsheetToHtml | spreadsheetToHtml/styling/styling.py | Python | apache-2.0 | 257 |
"""
apiparse
Parse API and API groups from sources. List the API occurences from all
directories and sub directories
"""
# Main Routine
if __name__ == "__main__":
import calltree
f = calltree.calltree.calltree()
f.showtree()
f.showgraph()
| vadivelmurugank/calltree | calltree/__main__.py | Python | mit | 259 |
import unittest
import time
from mock import MagicMock, patch
import daemonocle
import threading
import sys
try:
import __builtin__ as builtins # pylint:disable=import-error
except ImportError:
import builtins # pylint:disable=import-error
from protector.daemon import ProtectorDaemon
from protector.config.l... | trivago/Protector | protector/tests/daemon_test/test_daemon.py | Python | bsd-3-clause | 3,324 |
""" Test email as username authentication """
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import ddt
from django.core.urlresolvers import reverse
from provider.constants import CONFIDENTIAL, PUBLIC
from .base import OAuth2TestCase
from .factories import ClientFactor... | edx/edx-oauth2-provider | edx_oauth2_provider/tests/test_credentials.py | Python | agpl-3.0 | 2,833 |
#!/usr/bin/python
#
# Copyright (c) 2008--2015 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should... | davidhrbac/spacewalk | backend/server/test/unit-test/rhnSQL/test_server_registration.py | Python | gpl-2.0 | 9,344 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import codecs
import os
import string
import find_git_repos
import git_util
def init_ignore(fname='.git_update_all_ignore'):
ignore_set = set(['.cache', '.git', '$RECYCLE.BIN',])
if os.path.exists(fname):
f = codecs.open(fname, 'r', encoding='utf8')
... | autodrive/utils | git_update_all.py | Python | apache-2.0 | 3,896 |
# -*- coding: utf-8 -*-
r"""
Helper function to assist my orgmode editing
============================================
"""
# Created Tue Sep 15 18:46:42 2015
# Author: Óscar Nájera
from __future__ import division, absolute_import, print_function
import sympy
def platex(*args, environment='equation', **settings):
... | Titan-C/helpful_scripts | pyutils/latex_print.py | Python | gpl-2.0 | 1,860 |
from .crawler import Crawler
from .tools import *
try:
from .config import pixbay as config
except ImportError:
print('Please config src/crawlers/config.py')
exit(1)
class pixabay(Crawler):
def __init__(self):
self.url = 'https://pixabay.com/en/photos/?orientation=&image_type=&cat=science&colo... | suensummit/sligen | src/crawlers/pixabay.py | Python | mit | 1,555 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_proximity_placement_groups_operations.py | Python | mit | 18,816 |
def fitness(f_t, n_g, n_tot):
return 0.6 * f_t + 0.3 * n_g + 0.1 * n_tot
| johnboyington/homework | ne860/3/bwr_optimization/test_cases/test1/fitness_function.py | Python | gpl-3.0 | 78 |
# Copyright 2015 Patrick Hilhorst
#
# This file is part of HyperJ.
#
# HyperJ 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.
#
# Hyper... | Synthetica9/HyperJ | dissecter/__init__.py | Python | gpl-3.0 | 3,878 |
#!/usr/bin/env python
import argparse
import os
import palette
import sys
import re
import moviepy.audio.fx.all as afx
import moviepy.video.fx.all as vfx
import moviepy.video.tools.drawing as drawing
import yaml
from PIL import Image, ImageDraw, ImageFilter
import numpy
from moviepy.editor import *
from unidecode impor... | Dennovin/videoscripts | edit.py | Python | mit | 23,855 |
recomputation_vm_memory = 2048
haskell_vm_memory = 4096
recomputation_vm_cpus = 2
vagrantfile_templates_dict = {
"python": "python/python.vagrantfile",
"node_js": "nodejs/nodejs.vagrantfile",
"cpp": "cpp/cpp.vagrantfile",
"c++": "cpp/cpp.vagrantfile",
"c": "cpp/cpp.vagrantfile",
"haskell": "has... | cjw-charleswu/Recompute | recompute/server/defaults.py | Python | mit | 1,175 |
from office365.directory.identities.api_connector import IdentityApiConnector
from office365.directory.identities.conditional_access_root import ConditionalAccessRoot
from office365.directory.identities.userflows.attribute import IdentityUserFlowAttribute
from office365.directory.identities.userflows.b2x.user_flow impo... | vgrem/Office365-REST-Python-Client | office365/directory/identities/identity_container.py | Python | mit | 3,252 |
# -*- coding: utf-8 -*-
from requests import (get, post, delete)
from .base import Base
class System(Base):
def __init__(self, host, secret, endpoint='/plugins/restapi/v1/system/properties'):
"""
:param host: Scheme://Host/ for API requests
:param secret: Shared secret key for API request... | etutionbd/openfire-restapi | ofrestapi/system.py | Python | gpl-3.0 | 1,675 |
import pyev
import os
import sys
import logging
import socket
import signal
import errno
from register import register, post, get
from connection import Connection
STOPSIGNALS = (signal.SIGINT, signal.SIGTERM)
NONBLOCKING = (errno.EAGAIN, errno.EWOULDBLOCK)
class Server(object):
def __init__(self, bind_host, ha... | USMediaConsulting/pywebev | server/server.py | Python | apache-2.0 | 3,141 |
#!/usr/bin/env python
from setuptools import setup, find_packages
# Little hack to make 'python setup.py test' work on py2.7
try:
import multiprocessing
import logging
assert logging
assert multiprocessing
except:
pass
setup(
name='pitipper',
version="0.1",
description="",
author=... | PiTip/PiTipper | setup.py | Python | bsd-3-clause | 1,261 |
# Copyright 2010 Google 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 limitation the rights to use, copy, modify, merge, publish, dis-
# trib... | lochiiconnectivity/boto | tests/integration/gs/cb_test_harness.py | Python | mit | 3,267 |
# Copyright 2019 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, ... | openthread/silk | silk/hw/hw_module.py | Python | apache-2.0 | 6,014 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import hashlib
from contextlib import contextmanager
from io import BytesIO
import pytest
from pex.compatibility import PY2
from pex.http import Context, RequestsContext, StreamFilelike,... | sixninetynine/pex | tests/test_http.py | Python | apache-2.0 | 6,615 |
#!/usr/bin/env python2.5
import unittest
import sys
import threading
import random
import time
import PcapPlayback
class ComplexBitTorrentTestCase(PcapPlayback.PcapPlayback):
def testScalability(self):
pcap1="pcaps/just-1-flow-local.pcap"
ip_in_pcap1="69.12.135.165"
pcap2="pcaps/just-1-flow-remote.pcap... | isislovecruft/switzerland | tests/Test1Flow.py | Python | gpl-3.0 | 1,013 |
import requests
from django.conf import settings
from django.views.generic import ListView, View
from haystack.views import SearchView
from source.articles.models import Article
from source.articles.views import ArticleList
from source.code.models import Code
from source.people.models import Organization, Person
from... | mozilla/source | source/base/views.py | Python | bsd-3-clause | 3,237 |
import argparse
import re
import requests
from constants import base_url, XFTOKEN_REGEX
def login(user, passw):
"""Tries to log in with a username and a password.
Returns a new active session and request data.
"""
#Create vars to return
s, data = None, None
#Begin a new session and conne... | nukeop/codexscripts | scripts/login.py | Python | gpl-3.0 | 1,504 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
##
## 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 Li... | salberin/libsigrokdecode | decoders/mlx90614/pd.py | Python | gpl-3.0 | 2,702 |
import nltk
from nltk.corpus import names
print(names.fileids())
cfd = nltk.ConditionalFreqDist(
(fileid, name.lower()[:1])
for fileid in names.fileids()
for name in names.words(fileid))
cfd.plot() | m-debnath/python-rookie | nlp_python/chapter2_ex8.py | Python | gpl-3.0 | 223 |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
from... | baroquebobcat/pants | src/python/pants/init/engine_initializer.py | Python | apache-2.0 | 10,211 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
scope = "Admin"
description = """
gGRC System Administrator with super-user privileges.
"""
permissions = {
"read": [],
"create": [],
"delete": [],
"__GGRC_ADMIN__": [
{
... | andrei-karalionak/ggrc-core | src/ggrc_basic_permissions/roles/gGRC_Admin.py | Python | apache-2.0 | 556 |
"""A quantum tic tac toe running in command line"""
from qiskit import Aer
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
from qiskit import CompositeGate
from qiskit import execute
import numpy as np
from composite_gates import cry,cnx,any_x,bus_or,x_bus
class Move():
def __init__(self,ind... | antoniomezzacapo/qiskit-tutorial | community/games/game_engines/q_tic_tac_toe.py | Python | apache-2.0 | 13,845 |
# -*- test-case-name: mamba.test.test_application mamba.test.test_mamba -*-
# Copyright (c) 2012 - Oscar Campos <oscar.campos@member.fsf.org>
# See LICENSE for more details
"""
.. module: app
:platform: Linux
:synopsis: Mamba Application Manager
.. moduleauthor:: Oscar Campos <oscar.campos@member.fsf.org>
"""... | DamnWidget/mamba | mamba/application/app.py | Python | gpl-3.0 | 7,315 |
# Copyright (c) 2010-2013 OpenStack Foundation
#
# 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 agree... | smerritt/swift | swift/common/request_helpers.py | Python | apache-2.0 | 28,424 |
import unittest
import os
from xml.etree import ElementTree
from fiveoneone.model import Model
from fiveoneone.exceptions import TransitServiceError, TokenRequired, InvalidToken, AgencyRequired, InvalidAgency, \
InvalidRouteIDF, RouteIDFRequired, StopCodeRequired
class TestAgency(unittest.TestCase):
def setUp(self... | rberrelleza/511-transit | tests/test_model.py | Python | mit | 2,810 |
import pytest
from tests.utils.targetdriver import TargetDriver, if_feature
from tests.utils.testdriver import TestDriver
def get_services():
return TargetDriver('rep1'), TestDriver('rep2')
@pytest.fixture(autouse=True)
def _(module_launcher_launch):
pass
@if_feature.copy_file_from_onitu
def test_driver_... | onitu/onitu | tests/functional/driver/test_driver_copy.py | Python | mit | 717 |
# -*- coding: utf-8 -*-
import {{ cookiecutter.py_module }}
"""
test_{{ cookiecutter.py_module }}
----------------------------------
Tests for `{{ cookiecutter.py_module }}` module.
"""
def test_metadata():
assert {{ cookiecutter.py_module }}.version
assert {{ cookiecutter.py_module }}.__about__.__license__
... | nicfit/nicfit.py | cookiecutter/{{cookiecutter.project_name}}/tests/test_{{cookiecutter.py_module}}.py | Python | mit | 772 |
from django.test import TestCase
from pizzaplace.models import PizzaPlace
from pizzaplace.presenter.pizza_place_presenter import PizzaPlacePresenter
from pizzaplace.services.parsed_yelp_response import ParsedYelpResponse
class TestPizzaPlacePresenter(TestCase):
def setUp(self):
self.pizza_place = PizzaPlace(... | nicole-a-tesla/meetup.pizza | pizzaplace/tests/test_pizza_place_presenter.py | Python | mit | 1,938 |
"""This component provides basic support for Foscam IP cameras."""
import asyncio
import logging
from libpyfoscam import FoscamCamera
import voluptuous as vol
from homeassistant.components.camera import PLATFORM_SCHEMA, SUPPORT_STREAM, Camera
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_NAME,
CO... | tboyce021/home-assistant | homeassistant/components/foscam/camera.py | Python | apache-2.0 | 6,889 |
# condicionales if else
# if clasico
nota = 10
if nota == 10:
print "Excelente"
# if-else
nota = 15
if nota >= 0 and nota <=10:
print "\n\n\tExcelente ",nota
else:
print "\n\n\n\t La nota no es valida",nota
print" "
#if-elif-else
nota = 2
if nota ==10:
print "Excelente"
elif nota == 9:
print "Sobresaliente"
el... | esteban18plus/Proyectos-Python | 09_BloquesCondicionales.py | Python | gpl-2.0 | 589 |
#!/usr/bin/env python3
"""LSTM data wrangler.
Prepare a fat traning / test split.
"""
######################################################################
# Copyright (C) 2017 Samuele Fiorini, Chiara Martini, Annalisa Barla
#
# GPL-3.0 License
######################################################################
fr... | samuelefiorini/cgm-tools | scripts/LSTM_data_wrangler.py | Python | gpl-3.0 | 1,008 |
import unittest
from unittest.mock import MagicMock
from utils import InputHandler
class TestInputHandler(unittest.TestCase):
def testReadsSingleIntegerLine(self):
self.setReadLineMock(["3"])
self.assertEqual(self.sut.loadSingleElementLine(), 3)
def testReadsSingleIntegerLineHugeNumber(self):... | maciejbaranowski/MyInputLoader | utils.test.py | Python | mit | 1,724 |
../../../../../share/pyshared/checkbox/lib/pci.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/checkbox/lib/pci.py | Python | gpl-3.0 | 49 |
# -*- encoding: utf8 -*-
import os
import pytest
import linguistica as lxa
from linguistica.datasets import brown as corpus_path
data_dir = os.path.join(os.path.dirname(__file__), 'data')
def test_phone_unigram_counter():
lxa_object = lxa.read_corpus(corpus_path, max_word_tokens=50000)
test_object = lxa_o... | jacksonllee/lxa5 | tests/test_phon.py | Python | mit | 2,039 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _, throw
from frappe.utils import flt, cint, add_days, cstr
import json
from erpnext.accounts.doctype.pricing_rule.pric... | VisheshHanda/production_backup | erpnext/stock/get_item_details.py | Python | gpl-3.0 | 19,315 |
#!/usr/bin/env python3
# This script simply downloads waf to the current directory
from __future__ import print_function
import os, sys, stat, hashlib, subprocess
WAFRELEASE = "waf-2.0.8"
WAFURLS = ["http://ftp.waf.io/pub/release/" + WAFRELEASE,
"http://www.freehackers.org/~tnagy/release/" + WAFRELE... | Vladec/matching-engine | bootstrap.py | Python | mit | 1,482 |
#!/usr/bin/env python
"""
Created by S1mplyCompl3x
https://github.com/S1mplyCompl3x
"""
import sys, os, webbrowser, requests, youtube_dl, argparse, time
from bs4 import BeautifulSoup
from urllib.parse import quote
class MyLogger(object):
def debug(self, msg):
pass
def warning(self, msg):
pass
... | S1mplyCompl3x/PyAssistant | easymp3.py | Python | gpl-3.0 | 3,357 |
#Embedded file name: ACEStream\Core\BitTornado\BT1\GetRightHTTPDownloader.pyo
import sys
import time
from random import randint
from urlparse import urlparse
from httplib import HTTPConnection
import urllib
from threading import Thread, currentThread, Lock, Event
from traceback import print_stack, print_exc
from ACEStr... | alesnav/p2ptv-pi | acestream/ACEStream/Core/BitTornado/BT1/GetRightHTTPDownloader.py | Python | mit | 61,308 |
import os
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.site.site_header = os.environ.get('{{cookiecutter.env_prefix}}_TITLE', '{{cookiecutter.project_name}} Admin')
urlpatterns = patterns(
'',
url(r'^admin/', include(admin.site.urls)),
url(r'^api/auth/',
... | westerncapelabs/django-wcl-skel | {{cookiecutter.repo_name}}/{{cookiecutter.project_name}}/urls.py | Python | bsd-3-clause | 536 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Story.extras'
db.add_column(u'core_story', 'extras',
self.gf('django.d... | pombredanne/1trillioneuros | webapp/core/migrations/0009_auto__add_field_story_extras.py | Python | gpl-3.0 | 3,281 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-12-08 21:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0021_auto_20161208_1214'),
]
operations = [
migrations.AlterField(
... | bomjacob/htxaarhuslan | main/migrations/0022_auto_20161208_2216.py | Python | mit | 679 |
# -*- coding: utf-8 -*-
'''
打开Chrome
开启Chrome时直接复制粘贴这段代码即可
'''
__author__ = 'lai yao (lake.lai)'
URL='https://chromedriver.storage.googleapis.com/index.html?'
def start():
##为了随时方便使用,写死几个路径
## #设置成用户自己的数据目录##注意退出当前的chrome
ChromeUserData='--user-data-dir=C:\\Users\\YAO\\AppData\\Local\\Google\\Chrome\\User Data\\'... | xiaoxiaoyao/MyApp | PythonApplication1/爬虫练习/chromedriver/OpenChrome.py | Python | unlicense | 2,095 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... | mtreinish/stestr | stestr/commands/failing.py | Python | apache-2.0 | 4,990 |
tutorial_title = u'ClustENMD'
tutorial_author = u'Burak Kaynak, Pemra Doruker'
tutorial_logo = u'' # default is ProDy logo
tutorial_version = u'' # default is latest ProDy version
# keep the following part as is
try:
execfile('../conf.py')
except NameError:
exec(open('../conf.py').read())
| prody/ProDy-website | tutorials/clustenmd_tutorial/conf.py | Python | mit | 316 |
from will.plugin import WillPlugin
from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings
import requests
class RandomTopicPlugin(WillPlugin):
@respond_to("new topic")
def give_us_somethin_to_talk_about(self, message):
"""new topic: set the room ... | fredsmith/will | will/plugins/friendly/random_topic.py | Python | mit | 540 |
# ----------------------------------------------------------------------------
# Copyright 2015 Nervana Systems Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | jfsantos/neon | neon/backends/tests/test_tensor.py | Python | apache-2.0 | 3,585 |
# Partname: ATmega8535
# generated automatically, do not edit
MCUREGS = {
'ADMUX': '&39',
'ADMUX_REFS': '$C0',
'ADMUX_ADLAR': '$20',
'ADMUX_MUX': '$1F',
'ADCSRA': '&38',
'ADCSRA_ADEN': '$80',
'ADCSRA_ADSC': '$40',
'ADCSRA_ADATE': '$20',
'ADCSRA_ADIF': '$10',
'ADCSRA_ADIE': '$08',
'ADCSRA_A... | lowfatcomputing/amforth | core/devices/atmega8535/device.py | Python | gpl-2.0 | 4,349 |
# -*- coding: utf-8 -*-
#
# PyEphem documentation build configuration file, created by
# sphinx-quickstart on Sat Jun 7 14:43:45 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't picklea... | bennettscience/PySky | pyephem-3.7.5.1/src/ephem/doc/conf.py | Python | mit | 5,465 |
#!/usr/bin/env python3
import sys
import datetime
import random
import numpy as np
import pandas as pd
from beehaviour.experiment import Experiment
np.random.seed(1)
def parse_experiment_numbers(experiment_numbers_str):
experiment_numbers_list_str = experiment_numbers_str.split(',')
experiment_numbers = [in... | jackbrucesimpson/DBee | src/analyse_db.py | Python | mit | 896 |
#!/usr/bin/env python
import optparse, sys, os, glob, re
import dbc.generator, dbc.db, dbc.parser, dbc.patch
def parse_wow_version(option, opt, value, parser):
parser.values.wowversion = 0
split = re.split('\.', value)
if len(split) != 3:
raise optparse.OptionValueError
mul = 10000
div = ... | eyeplum/simc | dbc_extract/dbc_extract.py | Python | gpl-3.0 | 13,680 |
# -*- coding: utf-8 -*-
"""
monotonic
~~~~~~~~~
This module provides a ``monotonic()`` function which returns the
value (in fractional seconds) of a clock which never goes backwards.
On Python 3.3 or newer, ``monotonic`` will be an alias of
``time.monotonic`` from the standard library. On older versions,
... | noam09/deluge-telegramer | telegramer/include/monotonic/__init__.py | Python | gpl-3.0 | 7,085 |
from django.shortcuts import render_to_response
from django.contrib import auth
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
from dormbase.core.models import Resident
from django.http import Http404
def profile(request):
return render_to_response('personal/p... | dormbase/dormbase | dormbase/personal/views.py | Python | gpl-3.0 | 948 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-02 16:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rdrf', '0050_registryform_applicability_condition'),
]
operations = [
migra... | muccg/rdrf | rdrf/rdrf/migrations/0051_auto_20170802_1630.py | Python | agpl-3.0 | 1,021 |
from argparse import ArgumentParser
from unittest.mock import Mock
import pytest
from baby_steps import given, then, when
from vedro.core import Dispatcher
from vedro.events import ArgParseEvent
from vedro.plugins.director import RichReporter
from vedro.plugins.director.rich.test_utils import console_, dispatcher, re... | nikitanovosibirsk/vedro | tests/plugins/director/rich/test_test_rich_reporter_arg_parse.py | Python | apache-2.0 | 797 |
#!/usr/bin/python
"""
This is the code to accompany the Lesson 1 (Naive Bayes) mini-project.
Use a Naive Bayes Classifier to identify emails by their authors
authors and labels:
Sara has label 0
Chris has label 1
"""
import sys
from time import time
sys.path.append("../tools/")
from em... | sa2812/udacity | ud120/naive_bayes/nb_author_id.py | Python | mit | 1,081 |
import sys
import sqlite
# The shared connection object
cx = None
def getCon():
# All code gets the connection object via this function
global cx
return cx
def createSchema():
# Create the schema and make sure we're not accessing an old, incompatible schema
cu = getCon().cursor()
cu.execute("... | sassoftware/conary | conary/pysqlite3/examples/dbapi_transactions.py | Python | apache-2.0 | 3,416 |
"""Test the module neighbourhood cleaning rule."""
# Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com>
# Christos Aridas
# License: MIT
import pytest
import numpy as np
from sklearn.utils._testing import assert_array_equal
from imblearn.under_sampling import NeighbourhoodCleaningRule
X = np.array(
[... | scikit-learn-contrib/imbalanced-learn | imblearn/under_sampling/_prototype_selection/tests/test_neighbourhood_cleaning_rule.py | Python | mit | 2,817 |
# Author: Jaakko Leppakangas <jaeilepp@student.jyu.fi>
# Joan Massich <mailsik@gmail.com>
#
# License: BSD-3-Clause
import os.path as op
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from mne import pick_types
from mne.datasets import testing
from mne.io.tests.test_raw import... | wmvanvliet/mne-python | mne/io/cnt/tests/test_cnt.py | Python | bsd-3-clause | 1,792 |
"""
Solve the orthogonal Procrustes problem.
"""
import numpy as np
from .decomp_svd import svd
__all__ = ['orthogonal_procrustes']
def orthogonal_procrustes(A, B, check_finite=True):
"""
Compute the matrix solution of the orthogonal Procrustes problem.
Given matrices A and B of equal shape, find an o... | WarrenWeckesser/scipy | scipy/linalg/_procrustes.py | Python | bsd-3-clause | 2,721 |
import _plotly_utils.basevalidators
class GridcolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="gridcolor", parent_name="layout.geo.lonaxis", **kwargs
):
super(GridcolorValidator, self).__init__(
plotly_name=plotly_name,
paren... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/geo/lonaxis/_gridcolor.py | Python | mit | 426 |
"""Elpy backend using the Jedi library.
This backend uses the Jedi library:
https://github.com/davidhalter/jedi
"""
import sys
import traceback
import jedi
from elpy import rpc
class JediBackend(object):
"""The Jedi backend class.
Implements the RPC calls we can pass on to Jedi.
Documentation: htt... | dspelaez/dspelaez.github.io | resources/dotfiles/dot.emacs.d.own/elpa/elpy-20170214.318/elpy/jedibackend.py | Python | mit | 12,322 |
from footyhints.question_plugins.any_goals_scored import AnyGoalsScored
from tests.footyhints.unit_test import UnitTest
class TestNilNil(UnitTest):
def setup(self):
super().setup()
self.plugin = AnyGoalsScored()
def test_nil_nil(self):
self.game.set_score(0, 0)
answer = self.... | pwnbus/footyhints | tests/footyhints/question_plugins/test_any_goals_scored.py | Python | gpl-3.0 | 520 |
import numpy as np
import uncertainties.unumpy as unp
from uncertainties import ufloat
from uncertainties.unumpy import nominal_values as noms
from uncertainties.unumpy import std_devs as stds
from uncertainties import correlated_values
import math as m
from scipy.constants import *
from scipy.optimize import curve_fit... | stefangri/s_s_productions | PHY341/V602_Roentgenemission/Messdaten/auswertung.py | Python | mit | 16,710 |
from osmapi import OsmApi
class OsmApiClient(object):
def __init__(self, username, password):
self.__connection = OsmApi(username=username, password=password, api=self.__api_endpoint)
__connection = None
__api_endpoint = "api.openstreetmap.org"
__default_comment = "Updated by osmhunter app."... | geoio/osmhunter-backend | app/models/OsmApiClient.py | Python | gpl-2.0 | 1,377 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.