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 |
|---|---|---|---|---|---|
# coding=utf8
"""
Copyright 2015 Luna Project
"""
from . import Data
from luna.clients import http
sso = Data()
sso.success = [
{
"username": "demo",
"password": "1234"
}
]
def test_login_01():
http.get('sso/login', json=sso.success[0]) | docloud/sso | tests/test_sso.py | Python | mit | 268 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
EliminateSelection.py
---------------------
Date : January 2017
Copyright : (C) 2017 by Bernhard Ströbl
Email : bernhard.stroebl@jena.de
*******************... | olivierdalang/QGIS | python/plugins/processing/algs/qgis/EliminateSelection.py | Python | gpl-2.0 | 9,055 |
from TestBase import BaseClass
class ContractBase(BaseClass):
def add_contract(self):
wd = self.wd
wd.find_element_by_link_text("add new").click()
wd.find_element_by_name("email").click()
wd.find_element_by_name("email").clear()
wd.find_element_by_name("email").send_keys()
... | werbk/task-2.1 | tests_contract/contract_lib.py | Python | apache-2.0 | 5,896 |
__author__ = 'opabinia'
| cyberbikepunk/m5.legacy | tests/__init__.py | Python | lgpl-3.0 | 24 |
# -*- coding: utf-8 -*-
""" Sahana Eden Staff Module Automated Tests
@copyright: 2011-2012 (c) Sahana Software Foundation
@license: MIT
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... | waidyanatha/sambro-eden | modules/tests/staff/staff_import.py | Python | mit | 2,325 |
# -*- coding: utf-8 -*-
#
# django-restraint documentation build configuration file
import inspect
import os
import re
# -- Django configuration -------------------------------------------------
import sys
sys.path.insert(0, os.path.abspath('..'))
from settings import configure_settings
configure_settings()
PY2 = sy... | ambitioninc/django-restraint | docs/conf.py | Python | mit | 6,277 |
from benchfunk import functions
from benchfunk.core import run_stack
from collections import OrderedDict
import itertools
import jug
import numpy as np
nreps = 5
@jug.TaskGenerator
def experiment(func, sn2, niter, seed):
"""Example experiment. Testing the uniform random sampling strategy."""
# setup objectiv... | mwhoffman/benchfunk | examples/example.py | Python | bsd-2-clause | 1,396 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.db import models
from dj... | janusnic/shoop | shoop/core/models/shops.py | Python | agpl-3.0 | 1,191 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This package is an overarching package for modules performing various analyses
of materials data.
"""
| gVallverdu/pymatgen | pymatgen/analysis/__init__.py | Python | mit | 216 |
"""Tests for the Device Registry."""
import asyncio
from unittest.mock import patch
import asynctest
import pytest
from homeassistant.core import callback
from homeassistant.helpers import device_registry
from tests.common import mock_device_registry, flush_store
@pytest.fixture
def registry(hass):
"""Return an... | aequitas/home-assistant | tests/helpers/test_device_registry.py | Python | apache-2.0 | 14,532 |
# stdlib imports
import functools
# third-party imports
import pytest
from click.testing import CliRunner
# local imports
from shpkpr.cli.entrypoint import cli
@pytest.fixture
def runner():
runner = CliRunner()
return functools.partial(runner.invoke, cli)
| shopkeep/shpkpr | tests/commands/conftest.py | Python | mit | 268 |
#!/usr/bin/env python
import unittest
import youtubeAuthenticate
import argparse
import youtubeup as yup
import simplejson as json
import re
import tbapy
class MyTests(unittest.TestCase):
def test_get_hashtag(self):
self.assertEqual("frc" + re.search('\D+', "2016arc").group(), "frcarc")
def test_pa... | akilan98/FRC-YouTube-Uploader | test.py | Python | gpl-3.0 | 4,756 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ModeofPay(Document):
pass
| shitolepriya/Saloon_erp | erpnext/accounts/doctype/mode_of_pay/mode_of_pay.py | Python | agpl-3.0 | 275 |
from types import FunctionType, MethodType
from sqlalchemy import and_, or_
from sqlalchemy.ext.associationproxy import AssociationProxy
from sqlalchemy.sql.annotation import AnnotatedSelect
from sqlalchemy.sql.sqltypes import Text
from sqlalchemy.orm import RelationshipProperty
from database.types import ScalarSet
f... | reimandlab/Visualistion-Framework-for-Genome-Mutations | website/helpers/filters/sqlalchemy_filter.py | Python | lgpl-2.1 | 4,341 |
# Copyright 2015, A10 Networks
#
# 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... | a10networks/a10-horizon | a10_horizon/dashboard/a10networks/a10appliances/urls.py | Python | apache-2.0 | 1,056 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'PurpleRobotAlert'
db.create_table(u'purple_robot_app_purp... | cbitstech/Purple-Robot-Django | migrations/0022_auto__add_purplerobotalert.py | Python | gpl-3.0 | 9,673 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import sys
import unittest
sys.path.append('..')
from hecatoncheir.exception import DriverError, InternalError, QueryError, QueryTimeout
from hecatoncheir.oracle import OraDriver
class TestOraDriver(unittest.TestCase):
dbuser = "scott"
dbpass = "tiger"
de... | snaga/Hecatoncheir | tests/testOracleDriver.py | Python | apache-2.0 | 3,275 |
############################################################
#
# Copyright (c) 2011, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way witho... | Southpaw-TACTIC/TACTIC | src/tactic/ui/sync/sync_filter.py | Python | epl-1.0 | 3,596 |
#coding=utf-8
import urllib
import urllib2
import os
cover='http://cover.acfunwiki.org/cover.php'
face='http://cover.acfunwiki.org/face.php'
now=1
local=os.getcwd()+'\\download\\'
url_1=face#设置来源
exist=0
success=0
fail=0
all=0
def download(num,yes):
global now
global exist
global success
global fail
... | zhihaofans/adao_cover_img_down | adao_cover_img_down.py | Python | apache-2.0 | 1,714 |
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, 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... | WangRobo/rosbridge_suite | rosbridge_library/src/rosbridge_library/protocol.py | Python | bsd-3-clause | 15,943 |
from __future__ import absolute_import
import socket
import struct
from nsq import protocol
class SyncConn(object):
def __init__(self, timeout=1.0):
self.buffer = ''
self.timeout = timeout
self.s = None
def connect(self, host, port):
assert isinstance(host, (str, unicode))
... | goller/pynsq | nsq/sync.py | Python | mit | 1,076 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | openstack/watcher | watcher/db/sqlalchemy/migration.py | Python | apache-2.0 | 3,676 |
# -*- coding: utf-8 -*-
import pymongo
import sys
sys.path.append('../')
from worker.data_fusion import data_fusion
DEV_MONGO_CONFIG = {
'host': '172.18.19.219',
'port': 27017,
'db': 'crs'
}
class Dev_MongodbConnection(object):
"""
MongoDB连接类
"""
def __init__(self):
... | Svolcano/python_exercise | dianhua/test/data_fusion_test.py | Python | mit | 3,452 |
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Joe H. Rahme <joe.hakim.rahme@enovance.com>
#
# 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... | Vaidyanath/tempest | tempest/api/object_storage/test_healthcheck.py | Python | apache-2.0 | 1,735 |
import imp
import pkgutil
import re
import sys
import traceback
from . import plugins, __version__
from .compat import urlparse, is_win32
from .exceptions import NoPluginError, PluginError
from .logger import Logger
from .options import Options
from .plugin import api
def print_small_exception(start_after):
type... | guymakam/Kodi-Israel | plugin.video.israelive/resources/lib/livestreamer/session.py | Python | gpl-2.0 | 12,833 |
import os
from lib import uimodules
settings = dict(
template_path = os.path.join(os.path.dirname(__file__), 'template'),
static_path = os.path.join(os.path.dirname(__file__), 'static/'),
upload_path = os.path.join(os.path.dirname(__file__), 'static/upload'),
... | ptphp/PtPy | pttornado/src/config.py | Python | bsd-3-clause | 681 |
import nengo
import numpy as np
model = nengo.Network()
with model:
input = nengo.Node(lambda t: np.sin(6*t))
a = nengo.Ensemble(n_neurons=100, dimensions=1)
nengo.Connection(input, a)
pIn = nengo.Probe(input)
pA = nengo.Probe(a)
pA_spikes = nengo.Probe(a, 'spikes')
sim = nengo.Simulator(model... | tcstewar/nengo_plot | nengo_plot/examples/basic_time.py | Python | gpl-2.0 | 738 |
from datetime import datetime
import math
import os
import numpy as np
import sys
from perceptchoice.utils import mdm_outliers
LEFT=180
RIGHT=0
coherences=[0.0320, 0.0640, 0.1280, 0.2560, 0.5120]
stim_conditions=['ShamPreCathode','Cathode','ShamPreAnode','Anode']
isi_conditions=['low','high']
subject_sessions={
... | jbonaiuto/perceptual-choice-hysteresis | src/python/perceptchoice/experiment/subject_info.py | Python | gpl-3.0 | 12,519 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 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 appl... | openstack/swift | test/unit/common/middleware/test_bulk.py | Python | apache-2.0 | 48,832 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Markus Weber'
def main():
pass
if __name__ == "__main__":
main() | Fellfalla/Thermoberry | Klassen/__init__.py | Python | gpl-2.0 | 136 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists o... | pkdevbox/trac | trac/dist.py | Python | bsd-3-clause | 22,240 |
#!/usr/bin/python
# This file generated by a program. do not edit.
import pycopia.XML.POM
attribName_1485147577566348721 = pycopia.XML.POM.XMLAttribute(u'name', 1, 12, None)
attribCdataimp_4401878107967355625 = pycopia.XML.POM.XMLAttribute(u'cdataimp', 1, 12, None)
attribIdval_2261477458681828209 = pycopia.XML.... | kdart/pycopia | XML/pycopia/dtds/pomtest.py | Python | apache-2.0 | 2,442 |
# /usr/bin/python
# coding=utf-8
import logging
import os
import threading
import time
from contextlib import closing
import BeautifulSoup
import requests
import threadpool as threadpool
from settings import *
from tools import ProgressBar
logger = logging.getLogger(__name__)
class MavenTool(object):
# 创建线程池
... | HustedLeo/maven-tools | maven-tools/maven.py | Python | apache-2.0 | 4,049 |
from setuptools import setup
setup(name='eupy',
version='1.2',
description='An API to interact with the chatrooms at euphoria.io',
author='Justin Chadwell',
author_email='jedevc@gmail.com',
url='https://github.com/jedevc/euphoria-python',
license='MIT',
packages=... | ArkaneMoose/EuPy | setup.py | Python | mit | 382 |
# -*- 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 'BucketFile.updated_on'
db.add_column(u'bucket_bucketfile', 'updated_on',
... | CommonsDev/dataserver | bucket/migrations/0002_auto__add_field_bucketfile_updated_on__add_field_bucketfile_filename__.py | Python | agpl-3.0 | 8,037 |
# -*- coding: utf-8 -*-
# Copyright Martin Manns
# Distributed under the terms of the GNU General Public License
# --------------------------------------------------------------------
# pyspread is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published... | manns/pyspread | pyspread/lib/typechecks.py | Python | gpl-3.0 | 2,740 |
# Copyright 2016 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | andrewalexander/cloud-custodian | tools/c7n_mailer/c7n_mailer/deploy.py | Python | apache-2.0 | 2,788 |
# -*- coding: utf-8 -*-
"""
(c) 2012-2021 Martin Wendt; see https://github.com/mar10/pyftpsync
Licensed under the MIT license: https://www.opensource.org/licenses/mit-license.php
"""
import configparser
import getpass
import logging
import netrc
import os
import sys
from datetime import datetime
_logger = None
PYTHO... | mar10/pyftpsync | ftpsync/util.py | Python | mit | 15,293 |
# Sample 1
import socket
import sys
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except socket.error as msg:
print('Failed to create socket!')
print('Error code: ' + str(msg[0]) + ', error message: ' + msg[1])
sys.exit()
print('Socked created successfully.') | jessicayuen/cmput410-lab2 | sample1.py | Python | gpl-3.0 | 278 |
#!/usr/bin/env python3
# Copyright (C) 2017 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import os
import sys
from testrunner import run
# on real hardware, this test... | x3ro/RIOT | tests/pkg_libcose/tests/01-run.py | Python | lgpl-2.1 | 673 |
import os
from datetime import datetime
from urllib.parse import urljoin
from django.conf import settings
from django.core.exceptions import SuspiciousFileOperation
from django.core.files import File, locks
from django.core.files.move import file_move_safe
from django.core.signals import setting_changed
from django.ut... | frankvdp/django | django/core/files/storage.py | Python | bsd-3-clause | 14,596 |
from django import forms
class MarkItUpWidget(forms.Textarea):
def __init__(self, *args, **kwargs):
super(MarkItUpWidget, self).__init__(attrs={'class': 'markitup'}, *args, **kwargs)
class Media:
js = (
'js/src/jquery-1.3.2.min.js',
'js/markitup/jquery.markitup.pack... | boar/boar | boar/articles/widgets.py | Python | bsd-3-clause | 594 |
import pygame
import os
from pygame.locals import *
def levelOne():
winWidth = 960
winHeight = 540
halfWidth = int(winWidth / 2)
halfHeight = int(winHeight / 2)
displaySize = (winWidth, winHeight)
cameraSlack = 30
fps = 30
fpsTime = pygame.time.Clock()
pygame.mixer.music.load(os.pa... | whimsicalstudios/a-bit-of-an-adventure | levels/levelone.py | Python | gpl-3.0 | 10,163 |
# Copyright 2013 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.
import collections
import json
import logging
from telemetry.core import exceptions
from telemetry.value import histogram_util
from telemetry.value import s... | axinging/chromium-crosswalk | tools/perf/metrics/startup_metric.py | Python | bsd-3-clause | 5,062 |
import psycopg2
import sys
# Se define el string de conexion
conn_string = "host='localhost' dbname='cmsb' user='postgres' password='postgres'"
# Se conecta a la BD
try:
conn = psycopg2.connect(conn_string)
except:
print "No se pudo conectar a la BD"
# conn.cursor regresa un cursor object que permite realizar quer... | figueira/Orinoco-Urgencias | BD/migracion/loadEnfermedades.py | Python | gpl-3.0 | 494 |
#
# Copyright (c) 2008-2015 Citrix 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/ns/nspbr_args.py | Python | apache-2.0 | 1,045 |
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2008-2010, James Vega
# 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 c... | raboof/supybot | plugins/RSS/plugin.py | Python | bsd-3-clause | 18,759 |
# -*- encoding: utf-8 -*-
from supriya.tools.ugentools.BufInfoUGenBase import BufInfoUGenBase
class BufFrames(BufInfoUGenBase):
r'''A buffer frame count info unit generator.
::
>>> ugentools.BufFrames.kr(buffer_id=0)
BufFrames.kr()
'''
### CLASS VARIABLES ###
__documentation_s... | andrewyoung1991/supriya | supriya/tools/ugentools/BufFrames.py | Python | mit | 1,101 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Choice',
fields=[
('id', models.AutoField(auto_... | wenduowang/git_home | python/django/tutorial/polls/migrations/0001_initial.py | Python | gpl-3.0 | 1,083 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
import os
import sys
i... | jmlong1027/multiscanner | modules/Metadata/ExifToolsScan.py | Python | mpl-2.0 | 3,516 |
'''
Non-original introduction script, added solely for the sake of familiarizing
myself with Tensorflow. I, Evan Kirsch, do not claim credit whatsoever for this
code. It is taken directly from https://www.tensorflow.org/
'''
import tensorflow as tf
import numpy as np
# Create 100 phony x, y data points in NumPy, y = ... | etkirsch/Tensorflow-Learn | introduction.py | Python | gpl-2.0 | 1,175 |
# -*- coding: utf-8 -*-
"""
babel.messages.pofile
~~~~~~~~~~~~~~~~~~~~~
Reading and writing of files in the ``gettext`` PO (portable object)
format.
:copyright: (c) 2013 by the Babel Team.
:license: BSD, see LICENSE for more details.
"""
import os
import re
from babel.messages.catalog import... | st4lk/babel | babel/messages/pofile.py | Python | bsd-3-clause | 16,324 |
from django.apps import AppConfig
class ClothingConfig(AppConfig):
name = 'clothing'
| c-pari22/dressme | dressme/clothing/apps.py | Python | gpl-3.0 | 91 |
###########################################
## Python 2. Uses multi-key-dict module. ##
###########################################
from multi_key_dict import multi_key_dict
two = three = four = five = six = seven = eight = nine = multi_key_dict()
two['A', 'B', 'C'] = '2'
three['D', 'E', 'F'] = '3'
four['G', 'H', 'I... | FreddieV4/DailyProgrammerChallenges | Easy Challenges/Challenge 0018 Easy/solutions/solution2.py | Python | mit | 841 |
import vaex
def test_from_dict():
data = {'A': [1, 2, 3], 'B': ['a', 'b', 'c']}
ds = vaex.from_dict(data)
assert 'A' in ds.get_column_names()
assert ds['A'].values[0] == 1
assert ds['B'].values[2] == 'c'
| maartenbreddels/vaex | tests/from_dict_test.py | Python | mit | 226 |
from .evolution_engine import EvolutionEngine
from .generational import GenerationalEvolutionEngine
| Eyjafjallajokull/pyga | pyga/evolution_engine/__init__.py | Python | mit | 100 |
IOJS_VERSION = 'latest'
IOJS_PLATFORM = 'linux-x64'
IOJS_PORT = 3000
| evilchili/cotton | settings/iojs.py | Python | mit | 69 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import subprocess
from subprocess import PIPE, Popen
from setuptools import setup, find_packages
from glob import glob
import json
import codecs
import sys
import os
import platform
if sys.argv[1] in ('build', 'bdist_msi', 'bdist_mac', 'bdist_dmg'):
from cx_Freeze imp... | bsmr-Bitcraze/crazyflie-clients-python | setup.py | Python | gpl-2.0 | 5,615 |
# 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... | apark263/tensorflow | tensorflow/contrib/distribute/python/keras_optimizer_v2_test.py | Python | apache-2.0 | 6,801 |
"""The tests for the input_boolean component."""
# pylint: disable=protected-access
import logging
from unittest.mock import patch
import pytest
from homeassistant.components.input_boolean import CONF_INITIAL, DOMAIN, is_on
from homeassistant.const import (
ATTR_EDITABLE,
ATTR_ENTITY_ID,
ATTR_FRIENDLY_NAM... | Teagan42/home-assistant | tests/components/input_boolean/test_init.py | Python | apache-2.0 | 10,706 |
###########################################################################
## PyBot ##
## Copyright (C) 2015, Kyle Repinski ##
## Copyright (C) 2015, Andres Preciado (Glitch) ##
## ... | EliteTK/PyBot | Commands/condom/condom.py | Python | gpl-3.0 | 1,725 |
# coding: utf-8
# vim: set ts=4 sw=4 et:
""" This file contains some utils for connecting to Logentries
as well as storing logs in a queue and sending them."""
VERSION = '2.0.7'
from logentries import helpers as le_helpers
import logging
import threading
import socket
import random
import time
import sys
import... | logentries/le_python | logentries/utils.py | Python | mit | 6,861 |
import tarfile
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cross_validation import StratifiedKFold
from sklearn.naive_bayes import MultinomialNB
from sklearn.metrics import precision_recall_fscore_support
import nltk.stem
#load emails
print "loading emails"
ham_gzip = ta... | iamshang1/Projects | Basic_ML/Spam_Detection/spam_detection.py | Python | mit | 2,548 |
import tensorflow as tf
import numpy as np
import opening as op
import boardchange_km as bc
import itertools
import random
import sys
def weight(shape):
initial = tf.truncated_normal(shape, stddev=0.01)
return tf.Variable(initial)
def bias(shape):
initial = tf.constant(0.01, shape=shape)
return tf.Var... | b2ogeyman/MyBranchGoAI | play_against_itself.py | Python | gpl-3.0 | 7,259 |
import bz2
un = b'BZh91AY&SYA\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x02\x00 \x00!\x9ah3M\x07<]\xc9\x14\xe1BA\x06\xbe\x084'
pw = b'BZh91AY&SY\x94$|\x0e\x00\x00\x00\x81\x00\x03$ \x00!\x9ah3M\x13<]\xc9\x14\xe1BBP\x91\xf08'
print (bz2.decompress(un))
print (bz2.decompress(pw)) | fahrrad/pythonchallenge | 9.py | Python | gpl-2.0 | 275 |
from abc import ABC, abstractmethod
from collections import namedtuple
Customer = namedtuple('Customer', 'name fidelity')
class LineItem:
def __init__(self, product, quantity, price):
self.product = product
self.quantity = quantity
self.price = price
def total(self):
return s... | stoneflyop1/fluent_py | ch06/strategyclass.py | Python | mit | 2,690 |
from ..base import ViewProviderBase
class ViewProviderSystem(ViewProviderBase):
def claimChildren(self):
try:
return self.obj.Object.InList + [self.obj.Object.Frequency]
except AttributeError:
return []
| python-acoustics/Sea | Sea/adapter/system/ViewProviderSystem.py | Python | bsd-3-clause | 262 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Partially based on AboutMessagePassing in the Ruby Koans
#
from runner.koan import *
class AboutAttributeAccess(Koan):
class TypicalObject(object):
pass
def test_calling_undefined_functions_normally_results_in_errors(self):
typical = self.T... | ChristianAA/python_koans_solutions | python2/koans/about_attribute_access.py | Python | mit | 7,379 |
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl,
# K.U. Leuven. All rights reserved.
# Copyright (C) 2011-2014 Greg Horn
#
# CasADi is free software; you can... | ghorn/casadi | test/internal/test_py.py | Python | lgpl-3.0 | 1,974 |
############################################################################
#
# Program: GDCM (Grassroots DICOM). A DICOM library
#
# Copyright (c) 2006-2011 Mathieu Malaterre
# All rights reserved.
# See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
#
# This software is distributed ... | gbook/nidb | src/gdcm/Examples/Python/ConvertPIL.py | Python | gpl-3.0 | 3,015 |
#!/usr/bin/python
# -*-coding:UTF-8 -*-
import os
cmd = './dalitek/src'
print cmd
os.chdir(cmd)
cmd1 = 'rm *.o'
print cmd1
os.system(cmd1)
cmd2 = '../../bestomgw/src'
print cmd2
os.chdir(cmd2)
cmd3 = 'rm *.o'
print cmd3
os.system(cmd3)
#cmd2_1 = '../../sql_operate/src'
#print cmd2_1
#os.chdir(cmd2_1)
#cmd3_1 = 'rm *.... | 196510921/openwrt-mtk | package/usr_app/src/bestomgw/src/build.py | Python | gpl-2.0 | 1,527 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from distutils.core import setup
version = {}
with open("src/minimalkb/__init__.py") as fp:
exec(fp.read(), version)
def readme():
with open("README-pypi.rst") as f:
return f.read()
setup(
name="minimalKB",
version=version["__version_... | severin-lemaignan/minimalkb | setup.py | Python | bsd-3-clause | 1,117 |
class LinkedListNode:
def __init__(self, value):
self.value = value
self.next = None
def reverseLinkedList(head):
originalPointer = head
newHead = None
secondNew = None
while originalPointer != None:
newHead = originalPointer
originalPointer = originalPointer.nex... | katchengli/tech-interview-prep | interview_cake/ic24.py | Python | apache-2.0 | 777 |
# -*- test-case-name: foolscap.test.test_eventual -*-
from twisted.internet import reactor, defer
from twisted.python import log
class _SimpleCallQueue(object):
# XXX TODO: merge epsilon.cooperator in, and make this more complete.
def __init__(self):
self._events = []
self._flushObservers = []... | warner/petmail | src/petmail/eventual.py | Python | mit | 2,927 |
# -*- coding: utf-8 -*-
import fauxfactory
from time import sleep
from cfme.utils.browser import ensure_browser_open
from cfme.utils.conf import credentials
from cfme.utils.ssh import SSHClient
from cfme.utils.appliance import get_or_create_current_appliance
from cfme.utils.path import conf_path
# TODO move these int... | quarckster/cfme_tests | cfme/utils/ext_auth.py | Python | gpl-2.0 | 5,248 |
"""
Copyright 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your ... | gnu-sandhi/sandhi | modules/gr36/grc/gui/DrawingArea.py | Python | gpl-3.0 | 4,913 |
# 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 agreed to in writing, software
#... | vefimova/rally | rally/plugins/openstack/context/cinder/volumes.py | Python | apache-2.0 | 2,669 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Tests for match rule filenameendswith
"""
import unittest
from smartfilesorter.matchplugins.filenameendswith import FilenameEndsWith
class TestFilenameEndsWith(unittest.TestCase):
def setUp(self):
self.rule = FilenameEndsWith('_file')
def test_case_... | jashort/SmartFileSorter | tests/matchplugins/test_filenameendswith.py | Python | bsd-3-clause | 766 |
#
# Graphene schema for exposing ProcessClassification model
#
import graphene
from valuenetwork.valueaccounting.models import ProcessType
from valuenetwork.api.types.Process import ProcessClassification
from valuenetwork.api.types.EconomicEvent import Action
from django.db.models import Q
class Query(object): #gra... | FreedomCoop/valuenetwork | valuenetwork/api/schemas/ProcessClassification.py | Python | agpl-3.0 | 887 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import socket
import threading
from . import utils2 as utils
from ..utils.message import info, error
__author__ = 'fyabc'
class LanClient:
def __init__(self, user):
self.user = user
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
... | fyabc/MiniGames | HearthStone2/MyHearthStone/network/lan_client.py | Python | mit | 2,327 |
import numpy as np
import re
def clean_str(string):
"""
Tokenization/string cleaning for all datasets except for SST.
Original taken from https://github.com/yoonkim/CNN_sentence/blob/master/process_data.py
"""
string = re.sub(r"[^A-Za-z0-9(),!?\'\`]", " ", string)
string = re.sub(r"\'s", " \'s... | dennybritz/cnn-text-classification-tf | data_helpers.py | Python | apache-2.0 | 2,472 |
# -*- coding: utf-8 -*-
from pyqtgraph.Qt import QtGui, QtCore
from pyqtgraph.widgets.GraphicsView import GraphicsView
from pyqtgraph.GraphicsScene import GraphicsScene
from pyqtgraph.graphicsItems.ViewBox import ViewBox
#class FlowchartGraphicsView(QtGui.QGraphicsView):
class FlowchartGraphicsView(GraphicsView):
... | ibressler/pyqtgraph | pyqtgraph/flowchart/FlowchartGraphicsView.py | Python | mit | 3,889 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import weakref
from acq4.util import Qt
from .CanvasItem import CanvasItem
import pyqtgraph as pg
import pyqtgraph.graphicsItems.TargetItem
from .itemtypes import registerItemType
class MarkersCanvasItem(CanvasItem):
"""
Canvas item used for markin... | acq4/acq4 | acq4/util/Canvas/items/MarkersCanvasItem.py | Python | mit | 6,603 |
# coding: utf-8
# 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... | reminisce/mxnet | python/mxnet/runtime.py | Python | apache-2.0 | 3,230 |
from Components.Converter.Converter import Converter
from time import time as getTime, localtime, strftime
from Components.Converter.Poll import Poll
from Components.Element import cached
from Components.config import config
class RemainingToText(Poll, Converter):
DEFAULT = 0
WITH_SECONDS = 2
NO_SECONDS = 2
IN_SE... | openatv/enigma2 | lib/python/Components/Converter/RemainingToText.py | Python | gpl-2.0 | 20,422 |
#!/usr/bin/env python3
from argparse import ArgumentParser
from pathvalidate.argparse import validate_filename_arg, validate_filepath_arg
parser = ArgumentParser()
parser.add_argument("--filename", type=validate_filename_arg)
parser.add_argument("--filepath", type=validate_filepath_arg)
options = parser.parse_args(... | thombashi/pathvalidate | examples/argparse_validate.py | Python | mit | 452 |
import nibabel as nib
import numpy as np
import json
import sys
import os
# Path to function
pathtofunction = '../utils/functions'
pathtofunction2='../utils/graphing'
# Append path to sys
sys.path.append(pathtofunction)
sys.path.append(pathtofunction2)
from graph_lindiagnostics import qqplot, res_var
from behavtask_t... | berkeley-stat159/project-theta | code/scripts/graph_lindiag_script.py | Python | bsd-3-clause | 3,674 |
#!/usr/bin/env python
# ictrl_quotes. Created on 08.10.2015
# Copyright (C) 2014 Andreas Schulz <andreas.schulz@frm2.tum.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... | alenz33/ictrlquotes | ictrlquotes/sql/__init__.py | Python | gpl-2.0 | 4,603 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | neuroidss/nupic.vision | classifiers.py | Python | gpl-3.0 | 2,264 |
from __future__ import print_function
from ..color import Color
from ..effect import Effect
import time
class EffectKnightRider(Effect):
def run(self, color=Color(0, 0, 0), milliseconds=20, iterations=1):
print("[EffectKnightRider][info] Knight rider: to NeoPixel pixels with pause '%d' milliseconds and ... | bradcornford/Neopixel-Controller | neopixelcontroller/lib/effects/effect_knight_rider.py | Python | mit | 1,030 |
# Copyright 2014 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... | changsimon/trove | trove/tests/int_tests.py | Python | apache-2.0 | 3,057 |
"""empty message
Revision ID: 59c106871e7b
Revises: None
Create Date: 2014-12-19 16:33:43.710001
"""
# revision identifiers, used by Alembic.
revision = '59c106871e7b'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###... | wbushey/santaclaus | migrations/versions/59c106871e7b_.py | Python | gpl-3.0 | 488 |
'''
Steps for problem.feature lettuce tests
'''
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from lettuce import world, step
from common import i_am_registered_for_the_course, visit_scenario_item
from problems_setup import PROBLEM_DICT, answer_problem, problem_has_answer, add_problem_to_... | nttks/jenkins-test | lms/djangoapps/courseware/features/problems.py | Python | agpl-3.0 | 6,670 |
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at h... | 0xPIT/Espruino | boards/LPC1768.py | Python | mpl-2.0 | 1,246 |
class GlobalNotFoundException(Exception):
"""Used when you cant locate important global var
"""
pass
| DavidBarishev/DDtankFarmingBot | Ddtank_farm_bot/Framework/Exceptions.py | Python | gpl-3.0 | 113 |
#!/usr/bin/python
#
# (c) 2013, RSD Services S.A
#
# This file is part of Ansible
#
# Ansible 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 ve... | faust64/ansible | lib/ansible/modules/system/java_cert.py | Python | gpl-3.0 | 10,031 |
class AnalyticsCollectionManagerSingleton:
""" This Singleton class manages the DBs analytics collection. """
__instance = None
@staticmethod
def get_instance(db=None):
""" Static access method. """
if not AnalyticsCollectionManagerSingleton.__instance:
AnalyticsCollectionM... | JuezUN/INGInious | inginious/frontend/plugins/analytics/analytics_collection_manager.py | Python | agpl-3.0 | 2,152 |
def set_(lang):
global _
_ = lang
def get_ ():
return _
| unreal666/outwiker | plugins/texequation/texequation/i18n.py | Python | gpl-3.0 | 70 |
'''
Created on Aug 27, 2014
@author: Max Zwiessele
'''
import numpy as np
class _Norm(object):
def __init__(self):
pass
def scale_by(self, Y):
"""
Use data matrix Y as normalization space to work in.
"""
raise NotImplementedError
def normalize(self, Y):
"... | esiivola/GPYgradients | GPy/util/normalizer.py | Python | bsd-3-clause | 3,915 |
# vim: ai sts=4 ts=4 et sw=4
from django.db import models
from apps.reporters.models import Location, Reporter, PersistantConnection
import time as taim
class NetDistribution(models.Model):
reporter = models.ForeignKey(Reporter, null=True, blank=True)
connection = models.ForeignKey(PersistantConnection, null=T... | takinbo/rapidsms-borno | apps/bednets/models.py | Python | lgpl-3.0 | 3,707 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.