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 |
|---|---|---|---|---|---|
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | dskarbek/qpid-dispatch | tests/router_policy_test.py | Python | apache-2.0 | 13,738 |
# Copyright 2015 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... | eadgarchen/tensorflow | tensorflow/python/keras/_impl/keras/applications/__init__.py | Python | apache-2.0 | 1,450 |
#
# Copyright (C) 2018 Uninett AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License version 3 as published by the Free
# Software Foundation.
#
# This program is distributed in the hope... | UNINETT/nav | python/nav/web/business/urls.py | Python | gpl-2.0 | 1,451 |
#
# Sphinx documentation build configuration file.
#
# 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 configuration values have a default; values that are commented out
# serve to show t... | 1and1/confluencer | docs/conf.py | Python | apache-2.0 | 8,358 |
#
# Copyright (c) 2014-2015 The developers of Aqualid project
#
# 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, mo... | aqualid/aqualid | aql/options/__init__.py | Python | mit | 1,247 |
"""Support for Z-Wave sensors."""
from homeassistant.components.sensor import DEVICE_CLASS_BATTERY, DOMAIN, SensorEntity
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from . import ZWaveDeviceE... | w1ll1am23/home-assistant | homeassistant/components/zwave/sensor.py | Python | apache-2.0 | 3,433 |
from yowsup.structs import ProtocolEntity, ProtocolTreeNode
import sys
class EncProtocolEntity(ProtocolEntity):
TYPE_PKMSG = "pkmsg"
TYPE_MSG = "msg"
TYPE_SKMSG = "skmsg"
TYPES = (TYPE_PKMSG, TYPE_MSG, TYPE_SKMSG)
def __init__(self, type, version, data, mediaType = None, jid = None):
a... | tgalal/yowsup | yowsup/layers/axolotl/protocolentities/enc.py | Python | gpl-3.0 | 1,354 |
# -*- coding: utf-8 -*-
# Copyright: See the LICENSE file.
"""Tests for factory_boy/SQLAlchemy interactions."""
import factory
from .compat import unittest
from .compat import mock
import warnings
from factory.alchemy import SQLAlchemyModelFactory
from .alchemyapp import models
class StandardFactory(SQLAlchemyMode... | rrauenza/factory_boy | tests/test_alchemy.py | Python | mit | 6,790 |
from datetime import timedelta as td
import signal
import time
from threading import Thread
from django.core.management.base import BaseCommand
from django.utils import timezone
from hc.api.models import Check, Flip
from statsd.defaults.env import statsd
SENDING_TMPL = "Sending alert, status=%s, code=%s\n"
SEND_TIME_... | healthchecks/healthchecks | hc/api/management/commands/sendalerts.py | Python | bsd-3-clause | 5,516 |
# Author: Hubert Kario, (c) 2019
# Released under Gnu GPL v2.0, see LICENSE file for details
"""Test for ECDSA support in Certificate Verify"""
from __future__ import print_function
import traceback
import sys
import getopt
from itertools import chain, islice
from random import sample
from tlsfuzzer.runner import Run... | tomato42/tlsfuzzer | scripts/test-ecdsa-in-certificate-verify.py | Python | gpl-2.0 | 15,620 |
# import urllib2
# fin = open('rawcsv/stockdata/stockdata.csv')
# fin.read()
#clean and merge data in one csv
from os import listdir
from os.path import isfile, join
mypath = './USstockHistory167Mb/'
onlyfiles = [ f for f in listdir(mypath) if isfile(join(mypath,f)) and f[-3:] == 'csv' ]
print onlyfiles
ticker = '... | shanshanzhu/Data-Scrappers | USstock/stockcleanerOneFile.py | Python | mit | 1,444 |
import os
import ConfigParser
import snapbill
global currentConnection
currentConnection = None
def setConnection(connection):
global currentConnection
currentConnection = connection
def ensureConnection(connection):
'Ensure an api connection (use current if available)'
# If a connection was provided, use t... | snapbill/snapbill-pyapi | snapbill/util.py | Python | mit | 1,489 |
# Copyright 2015 Internap.
#
# 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, so... | idjaw/netman | netman/api/netman_api.py | Python | apache-2.0 | 2,474 |
import os
from shutil import copyfile
baseFolder = '/home/sangram/Desktop/Challenge/train'
source = baseFolder + 'test1'
for fileName in os.listdir(source):
category = fileName.split('_')[2]
destination = baseFolder + 'val' #+ category
copyfile(source + '/' + fileName, destination + '/' + category + '.' ... | hellosangram/imageclassifiercaffe | deeplearning-medical-images/code/createData.py | Python | gpl-3.0 | 355 |
from linux_story.common import get_story_file
shelves = {
"name": "shelves",
"children":
[
{
"name": "redwall",
"contents": get_story_file("redwall")
},
{
"name": "watership-down",
"contents": get_story_... | KanoComputing/terminal-quest | linux_story/story/trees/my_room.py | Python | gpl-2.0 | 2,652 |
"""A class to store tables.
Sample Usage:
table = SgTable()
table.Append([1, 2, 3])
table.Append([2, 4, 6])
table.Append([3, 6, 9])
for row in table:
print(row)
print(table[1])
table[1] = [2, 2, 2]
print(table[1])
table.SetFields(["a", "b", "c"])
print(table.GetVals("a")... | lnishan/SQLGitHub | components/table.py | Python | mit | 4,814 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import redis, frappe, re
import cPickle as pickle
from frappe.utils import cstr
class RedisWrapper(redis.Redis):
"""Redis client that will automatically prefix conf.db_name"""
... | Amber-Creative/amber-frappe | frappe/utils/redis_wrapper.py | Python | mit | 4,605 |
# Persimmon imports
from persimmon.view.blackboard import BlackBoard, Blocks # MYPY HACK
from persimmon.view.util import PlayButton, Notification
# Kivy imports
from kivy.app import App
from kivy.config import Config
from kivy.factory import Factory
from kivy.properties import ObjectProperty
# Kivy Widgets
from kivy.u... | AlvarBer/Persimmon | persimmon/view/view.py | Python | mit | 1,377 |
# Written by Petru Paler
# see LICENSE.txt for license information
def decode_int(x, f):
f += 1
newf = x.index('e', f)
try:
n = int(x[f:newf])
except (OverflowError, ValueError):
n = long(x[f:newf])
if x[f] == '-':
if x[f + 1] == '0':
raise ValueError
elif x[... | linuxmint/mint4win | src/bittorrent/bencode.py | Python | gpl-2.0 | 7,052 |
'''
Sendkeys module moved back to ctypes.
For x64 systems, for example.
(c) 2009 Igor S. Mandrigin, Agnitum Ltd.
'''
from ctypes import windll
# from the internet
KEYEVENTF_KEYUP = 2
VK_NUMLOCK = 144
KEYEVENTF_EXTENDEDKEY = 1
KEYEVENTF_KEYUP = 2
def _key_down( vk ) :
scan = windll.user32... | savionok/RemoteHID | test/SendKeys-ctypes-0.2/_sendkeys.py | Python | apache-2.0 | 1,787 |
# -*- coding: utf-8 -*-
# Scrapy settings for crawlstocks project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://doc.scrapy.org/en/latest/topics/settings.html
# https://doc.scrapy.org/en/latest/t... | qrsforever/workspace | python/test/crawl_stocks/crawlstocks/settings.py | Python | mit | 8,876 |
import numpy as np
from sklearn.datasets import load_iris
from sklearn import tree
iris = load_iris()
# print(iris.feature_names)
# print(iris.target_names)
# print(iris.data[100])
# print(iris.target[100])
# for i in range(len(iris.target)):
# print("Example %d: label %s, features %s" % (i, iris.target[i], iris.da... | m-debnath/python-rookie | machine-learning-yt/machin-learn-2.py | Python | gpl-3.0 | 1,401 |
#!/usr/bin/python
#GUI Parameters
terminal_color = '#10fb72'
serial_active_color = '#1f4dbc'
serial_inactive_color = '#ff0000'
from Tkinter import *
import time
import os
import BeanSerialTransport
import logging
import numpy
import math
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
transport = BeanSe... | PunchThrough/PunchThrough-BEAN-Arduino-Firmware | beanModuleEmulator/BeanModuleEmulator.py | Python | lgpl-2.1 | 7,613 |
# This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | XeCycle/indico | indico/modules/events/surveys/fields/__init__.py | Python | gpl-3.0 | 1,513 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
BART: Denoising Sequence-to-Sequence Pre-training for
Natural Language Generation, Translation, and Comprehension
"""
import logging
from t... | pytorch/fairseq | fairseq/models/bart/model.py | Python | mit | 15,516 |
#!/usr/bin/python
import sys, os, re
class GPNode:
def __init__(self, name, parent):
self.name = name
self.parent = parent
self.params = {}
self.params_list = [] #This is here to capture the ordering
self.param_comments = {}
self.children = {}
self.children_list = [] #This is here to ca... | apc-llc/moose | python/FactorySystem/ParseGetPot.py | Python | lgpl-2.1 | 8,436 |
from __future__ import division
import inspect
import re
from functools import wraps, partial
from collections import defaultdict
from pdb import set_trace
from copy import copy
from step import piped as step_into
from stop_as_final_func import piped as stop_as_final_func
__all__ = ('verbose', 'endverbose', 'step',... | berrytj/bookends | bookends/bookends.py | Python | mit | 5,522 |
# Copyright 2016-2017 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 ... | ocampocj/cloud-custodian | tools/c7n_mailer/c7n_mailer/azure_mailer/deploy.py | Python | apache-2.0 | 5,600 |
from pipes import quote
import logging
import os
import sys
from mock import patch
import pytest
from fabric.api import env, hide, lcd, local, settings
from fabric.state import connections
from fabtools.vagrant import version as _vagrant_version
HERE = os.path.dirname(__file__)
VAGRANT_VERSION = _vagrant_version... | datascopeanalytics/fabtools | fabtools/tests/functional_tests/conftest.py | Python | bsd-2-clause | 3,621 |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | arenadata/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.0/services/KNOX/package/scripts/params.py | Python | apache-2.0 | 7,178 |
# -*- coding: utf-8 -*-
"""
django-twitter
~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
__title__ = 'django-twitter'
__version__ = '0.1.0'
__author__ = 'Antonio Hinojo'
__license__ = 'MIT'
| ahmontero/django-twitter | twitter/__init__.py | Python | mit | 212 |
import collections
from syn.base_utils import rand_dict, get_fullname, tuple_prepend, \
get_typename, escape_for_eval
from .base import Type, serialize, hashable, rstr, estr, SER_KEYS, \
deserialize, safe_sorted, primitive_form, collect
from .numeric import Int
from .sequence import list_enumval
from .set impor... | mbodenhamer/syn | syn/types/a/mapping.py | Python | mit | 3,893 |
"""
Support for SolarEdge Monitoring API.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.solaredge/
"""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from home... | nugget/home-assistant | homeassistant/components/sensor/solaredge.py | Python | apache-2.0 | 5,332 |
# -*- coding: utf-8 -*-
#
# RedPipe documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 19 13:22:45 2017.
#
# 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.
#
# A... | 72squared/redpipe | docs/conf.py | Python | mit | 5,400 |
#
# Copyright (C) 2013 Savoir-Faire Linux Inc.
#
# This file is part of Sageo
#
# Sageo 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 optio... | smlacombe/sageo | app/model/filters/filter_tristate.py | Python | gpl-3.0 | 1,339 |
# coding: utf8
import asyncio
import logging
from mtypes import Document as _Document
from .utils import to_snake_case
from .fields import Field
from .hooks import (validate_columns_before_save,
log_modified_after_save)
from .errors import DocumentNotFound
class DocumentMetaClass(type):
de... | ioimop/mMongo | mmongo/document.py | Python | gpl-3.0 | 7,617 |
"""Build an Apache Beam pipeline for keras inference to BigQuery."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import tempfile
import apache_beam as beam
from apache_beam.io.gcp.bigquery import BigQueryDisposition
from apache_beam.io.... | GoogleCloudPlatform/healthcare | datathon/datathon_etl_pipelines/generic_imaging/inference_to_bigquery.py | Python | apache-2.0 | 8,351 |
from django.template.defaultfilters import get_digit
from django.test import SimpleTestCase
class FunctionTests(SimpleTestCase):
def test_values(self):
self.assertEqual(get_digit(123, 1), 3)
self.assertEqual(get_digit(123, 2), 2)
self.assertEqual(get_digit(123, 3), 1)
self.assertE... | DONIKAN/django | tests/template_tests/filter_tests/test_get_digit.py | Python | bsd-3-clause | 477 |
class GridType:
_type = None
def __eq__(self, that):
return isinstance(that, self.__class__) or str(self) == str(that)
def __str__(self):
return self._type
def __repr__(self):
return "%s()" % self.__class__.__name__
class GridTypeRectilinear(GridType):
_type = "rectiline... | csdms/pymt | pymt/grids/grid_type.py | Python | mit | 454 |
# -*- coding: utf-8 -*-
################################################################################
# Copyright 2014, The Open Aggregator
# GNU General Public License, Ver. 3 (see docs/license.txt)
################################################################################
"""Probability Features File
The... | jrising/open-estimate | models/features_interpreter.py | Python | gpl-3.0 | 17,777 |
#
#
# Copyright (C) 2008, 2009, 2010 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of con... | apyrgio/snf-ganeti | lib/workerpool.py | Python | bsd-2-clause | 19,287 |
#
# Copyright (C) 2018 by YOUR NAME HERE
#
# This file is part of RoboComp
#
# RoboComp 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... | robocomp/robocomp-robolab | components/hardware/imu/pyimu/src/specificworker.py | Python | gpl-3.0 | 2,340 |
# Copyright (c) 2015 RIPE NCC
#
# 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 the h... | danielquinn/ripe-atlas-cousteau | ripe/atlas/cousteau/exceptions.py | Python | gpl-3.0 | 892 |
from __future__ import print_function
from BigStash.base import BigStashAPIBase
from BigStash.decorators import json_response, no_content_response
from BigStash.error import BigStashError, ResourceNotModified
from cached_property import cached_property
from BigStash import models
from BigStash.serialize import model_to... | longaccess/bigstash-python | BigStash/api.py | Python | apache-2.0 | 8,337 |
from decimal import Decimal
_SCALE = 1000000
def _clean_up(value):
v = str(value)
if '.' in v:
v = v.rstrip('0')
if v[-1] == '.':
v = v[:-1]
return v
def create_amount(native):
class Amount(object):
def __init__(self, value, currency=native, issuer=None):
self.value = _clean_up(value)
self... | johansten/rtxp-py | rtxp/core/amount.py | Python | bsd-3-clause | 845 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickGear.
#
# SickGear 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,... | adam111316/SickGear | sickbeard/metadata/wdtv.py | Python | gpl-3.0 | 10,786 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-20 07:19
from __future__ import unicode_literals
from django.db import migrations, models
def forwards_func(apps, schema_editor):
正規化sheet表 = apps.get_model("臺灣言語平臺", "正規化sheet表")
正規化sheet表.objects.all().delete()
class Migration(migrations.Migra... | sih4sing5hong5/tai5-uan5_gian5-gi2_phing5-tai5 | 臺灣言語平臺/migrations/0007_正規化sheet表直接使用key_file_name建立登入憑證.py | Python | mit | 965 |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from treemap.lib.object_caches import role_permissions
from django.contrib.gis.db.models import Field
from treemap.models import InstanceUser, Role, Plot, MapFeature
"""
Tools to assist in resolving permissi... | kdeloach/otm-core | opentreemap/treemap/lib/perms.py | Python | gpl-3.0 | 8,533 |
import matplotlib.pyplot as plt
import MySQLdb
import datetime
db = MySQLdb.connect(host="<censored>", user="<censored>", passwd="<censored>", db="<censored>")
class Attempt:
def __init__(self, row):
self.id=int(row[0])
self.teamID=int(row[1])
self.taskID=int(row[2])
self.flag=row[3]
self.result=row[4]==1
... | kadircet/HackMETU-15 | stats.py | Python | gpl-2.0 | 2,658 |
"""
Convenience functions for the construction of spatial weights based on
contiguity and distance criteria.
"""
__author__ = "Sergio J. Rey <srey@asu.edu> "
import pysal
from Contiguity import buildContiguity
from Distance import knnW, Kernel, DistanceBand
from util import get_ids, get_points_array_from_shapefile, m... | jlaura/pysal | pysal/weights/user.py | Python | bsd-3-clause | 34,513 |
from lettuce import before, after, world
from selenium import webdriver
@before.all
def set_browser():
world.browser = webdriver.Firefox()
@after.all
def shutdown_browser(results):
world.browser.quit()
| claudiob/neverfails | neverfails/terrain.py | Python | mit | 212 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
DOC
"""
from __future__ import unicode_literals, print_function, division
__author__ = "Serge Kilimoff-Goriatchkine"
__email__ = "serge.kilimoff@gmail.com"
| serge-kilimoff/Sublime4Space | lexicon/__init__.py | Python | mit | 209 |
# Modified work:
# -----------------------------------------------------------------------------
# Copyright (c) 2019 Preferred Infrastructure, Inc.
# Copyright (c) 2019 Preferred Networks, Inc.
# -----------------------------------------------------------------------------
# Original work:
# -------------------------... | chainer/chainercv | chainercv/functions/ps_roi_max_align_2d.py | Python | mit | 26,851 |
# Testing the line trace facility.
from test import support
import unittest
import sys
import difflib
import gc
# A very basic example. If this fails, we're in deep trouble.
def basic():
return 1
basic.events = [(0, 'call'),
(1, 'line'),
(1, 'return')]
# Many of the tests below ... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.0/Lib/test/test_trace.py | Python | mit | 22,358 |
"""
Forms to support third-party to first-party OAuth 2.0 access token exchange
"""
from django.contrib.auth.models import User
from django.forms import CharField
from oauth2_provider.constants import SCOPE_NAMES
import provider.constants
from provider.forms import OAuthForm, OAuthValidationError
from provider.oauth2.f... | Semi-global/edx-platform | common/djangoapps/auth_exchange/forms.py | Python | agpl-3.0 | 3,848 |
# -*- coding: utf-8 -*-
'''
Created on Apr 13, 2014
@copyright 2014, Milton C Mobley
Select strings based on caller components: prefixes, suffixes and substrings.
Regular expression matching is also supported.
Note that some patch and kernel files have utf-8 chars with code > 127. Some of
these codes are not legal u... | miltmobley/PatchTools | patchtools/lib/matcher.py | Python | apache-2.0 | 4,212 |
'''
Pixie: FreeBSD virtualization guest configuration client
Copyright (C) 2011 The Hotel Communication Network inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the Li... | masom/Puck | client/pixie/lib/setup_plugin.py | Python | lgpl-3.0 | 24,567 |
#!/usr/bin/python
##########################################################################
#
# MTraceCheck
# Copyright 2017 The Regents of the University of Michigan
# Doowon Lee and Valeria Bertacco
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | leedoowon/MTraceCheck | src_main/parse_hist.py | Python | apache-2.0 | 4,024 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from decimal import Decimal
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from djanban.utils.week import get_iso_week_of_year
# Daily spent time by member
class DailySpentTime(models.Model):
class Meta:
... | diegojromerolopez/djanban | src/djanban/apps/dev_times/models.py | Python | mit | 8,954 |
"""
Django settings for felicity_threads_base project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BAS... | ParthKolekar/felicity-threads-base | felicity_threads_base/felicity_threads_base/settings_example.py | Python | lgpl-3.0 | 4,361 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import imp
import os
import sys
project_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(project_dir + '/recipes')
if __name__ == "__main__":
suite = unittest.TestSuite()
loader = unittest.TestLoader()
tests_dir = project_dir + ... | narusemotoki/python-recipes | run_tests.py | Python | mit | 644 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# module:
# author: Panagiotis Mavrogiorgos <pmav99,gmail>
"""
Package description
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
# Version
__major__ = 0 # for major interface/format changes
__minor__ = ... | pmav99/dotfiles | templates/pyinit.py | Python | mit | 836 |
## pyayaBot_useCaseTest.py
## This script deploys an instance of pyayaBot using hard-coded values and is a system-wide test.
import pyayaBot_main, sys
if (len(sys.argv) != 2):
print " Syntax error. Usage: pyayaBot_useCaseTest.py channel_name"
sys.exit()
## Initialize test variables.
test_connection_co... | pyayaBotDevs/pyayaBot | python/pyayaBot_useCaseTest.py | Python | apache-2.0 | 952 |
import unittest
def f(x, y):
return x/y
class MyFTest(unittest.TestCase):
def test_div(self):
self.assertEqual(f(1, 2), 0)
def test_div_zero(self):
self.assertRaises(Exception, f, 1, 0)
if __name__ == "__main__":
unittest.main()
| jigarkb/Programming | UnitTest/sample_python_unittest.py | Python | mit | 268 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/matlab/package.py | Python | lgpl-2.1 | 3,852 |
# _UID_dict.py
"""
Dictionary of UID: (name, type, name_info, is_retired)
"""
# Auto-generated by make_UID_dict.py"""
UID_dictionary = {
'1.2.840.10008.1.1': ('Verification SOP Class', 'SOP Class', '', ''),
'1.2.840.10008.1.2': ('Implicit VR Little Endian', 'Transfer Syntax', 'Default Transfer Syntax for DICOM', ''),... | njvack/ge-mri-rtafni | upload-host/vendor/dicom/_UID_dict.py | Python | mit | 26,450 |
# vim: set fileencoding=utf-8
#
# Copyright (C) 2012-2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is dist... | jkonecny12/anaconda | pyanaconda/ui/gui/spokes/lib/custom_storage_helpers.py | Python | gpl-2.0 | 28,820 |
import random
from database import *
from packettypes import *
from gamelogic import *
from objects import *
from constants import *
from utils import *
import globalvars as g
#debug
import time
class DataHandler():
def handleData(self, index, data):
jsonData = decodeJSON(data)
packetType = jsonD... | marcusmoller/pyorpg-server | src/datahandler.py | Python | mit | 40,001 |
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 12 10:50:54 2016
@author: Radu
"""
from neuron import h
from ib_in import Ib_in
from ia_in import Ia_in
from rc_in import Renshaw
from motoneuron import Motoneuron
import numpy
from neuronpy.util import spiketrain
class ReflexNetwork:
"""
"""
def __init__(s... | penguinscontrol/Spinal-Cord-Modeling | CPG/CPG_Network.py | Python | gpl-2.0 | 9,101 |
# -*- coding: utf-8 -*-
from decimal import Decimal
from django.contrib.auth.base_user import BaseUserManager, AbstractBaseUser
from django.db import models
from game.helpers import FieldHistory
import game
class PlayerManager(BaseUserManager):
def create_user(self, login, password, name=None):
if not lo... | rymcimcim/django-foosball | players/models.py | Python | mit | 3,649 |
import numpy as np
f = open("stapler_test_parts.g",'w')
# assume we start zero'd such that x0y0z0a0 is the bottom-leftmost viable position on the first layer
# stapler 1 is left stapler
# stapler 0 is right stapler
z_feedrate = 250
layer = -1
z_max = 20
z_min = 0
z_close_offset = 4 # relative to z_down
z_clear_of... | langfordw/stapler_gcode | stapler_gcode_blcomp.py | Python | mit | 5,784 |
""" Description here
Author: Leonard Berrada
Date: 5 Nov 2015
"""
import sys
sys.path.append("../")
from Regression import AutoRegressive, AutoCorrelation, GaussianProcess, KalmanFilter
from process_data import data_from_file
file_name = "sunspots.mat"
data_dict = data_from_file(file_name)
model = "GP"
# model ... | leonardbj/AIMS | src/exec/sunspots_data.py | Python | mit | 1,531 |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 7 11:27:35 2017
@author: AmatVictoriaCuramIII
"""
#Get modules
#import scipy as sp
import numpy as np
from pandas_datareader import data
import pandas as pd
#portfolio set up
port = ['^GSPC', '^RUA']
numsec = len(port)
equalweight = 1/numsec
df2 = pd.DataFrame(columns=[]... | adamrvfisher/TechnicalAnalysisLibrary | Weight.py | Python | apache-2.0 | 916 |
from django.db import models
from django_rv_apps.apps.believe_his_prophets.models.spirit_prophecy import SpiritProphecy
from django_rv_apps.apps.believe_his_prophets.models.language import Language
from gdstorage.storage import GoogleDriveStorage
gd_storage = GoogleDriveStorage()
class SpiritProphecyChapter(models.... | davrv93/creed-en-sus-profetas-backend | django_rv_apps/apps/believe_his_prophets/models/spirit_prophecy_chapter.py | Python | apache-2.0 | 2,402 |
import unittest2 as unittest
import random
from time import sleep
import os
from nose import SkipTest
from tweepy import Friendship, MemoryCache, FileCache
from config import TweepyTestCase, username, use_replay
test_tweet_id = '266367358078169089'
tweet_text = 'testing 1000'
"""Unit tests"""
class TweepyErrorTest... | dnr2/fml-twitter | tweepy-master/tests/test_api.py | Python | mit | 12,771 |
from AppKit import NSDragOperationMove
from vanilla import *
from mojo.events import setToolOrder, getToolOrder
toolOrderDragType = "toolOrderDragType"
class ToolOrder:
def __init__(self):
self.w = Window((200, 300), "Tool Orderer")
self.w.tools = List((10, 10, -10, -40), g... | typemytype/RoboFontExamples | UI/toolOrderer.py | Python | mit | 1,640 |
# -*- coding: utf-8 -*-
"""
************************************************************************************
Class : PatientFrame
Author : Thierry Maillard (TMD)
Date : 26/11/2016 - 1/12/2016
Role : Define Patient frame content.
Licence : GPLv3
Copyright (c) 2016 - Thierry Maillard
This file is part of CalcAl... | Thierry46/CalcAl | gui/PatientFrame.py | Python | gpl-3.0 | 15,036 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-06-30 17:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0005_auto_20180623_0212'),
]
operations = [
migrations.AddField(
... | sauli6692/ibc-server | core/migrations/0006_uiroute_parent.py | Python | mit | 689 |
#!/usr/bin/env python
import click
import logging
import os
import pagoda
import pagoda.viewer
def full(name):
return os.path.join(os.path.dirname(__file__), name)
@click.command()
def main():
logging.basicConfig()
w = pagoda.cooper.World(dt=1. / 120)
w.load_skeleton(full('../optimized-skeleton.txt... | EmbodiedCognition/pagoda | examples/cooper.py | Python | mit | 478 |
import pyfftw
import numpy as np
import tomviz.operators
import time
class ReconConstrintedDFMOperator(tomviz.operators.CancelableOperator):
def transform_scalars(self, dataset, Niter=None, Niter_update_support=None,
supportSigma=None, supportThreshold=None):
"""
3D Reco... | cryos/tomviz | tomviz/python/Recon_DFT_constraint.py | Python | bsd-3-clause | 9,005 |
import markdown
AUTHOR = 'charlesreid1'
SITENAME = 'paradise lost bot flock'
SITEURL = ''#b-milton'
PATH = 'content'
TIMEZONE = 'America/Los_Angeles'
DEFAULT_LANG = 'en'
# --------------8<---------------------
THEME = 'scurvy-knave-theme'
LICENSE_URL = "https://opensource.org/licenses/MIT"
LICENSE_NAME = "MIT Licen... | charlesreid1/milton | pelican/pelicanconf.py | Python | mit | 11,825 |
# -*- coding: utf-8 -*-
from knowledgebase.db.base import Vertex as BaseVertex
from knowledgebase.db.base import Edge as BaseEdge
from knowledgebase.db.base import ElementView as BaseElementView
from knowledgebase.db.base import Graph as BaseGraph
from bson.objectid import ObjectId
from pymongo import MongoClient
fro... | linkdd/knowledgebase | knowledgebase/db/mongo.py | Python | mit | 5,433 |
# -*- coding: utf-8 -*-
from datetime import datetime
from numpy import mean
from random import randint
from time import time as timestamp
from src.shell.callstack import CallStack
from src.shell.parser.type import TypeLogParser
from src.shell.parser.memalloc import MemallocParser
from src.shell.utils import list_sp... | Frky/scat | src/shell/memory/memcomb.py | Python | mit | 15,616 |
# coding=utf-8
import json
from pprint import pprint
from flask import Response
import requests
from urllib.parse import quote_plus, unquote_plus
from .base_class import ZmirrorTestBase
from .utils import *
class TestCustomResponseRewriter(ZmirrorTestBase):
"""testing using https://httpbin.org/"""
class C(Z... | Aploium/MagicWebsiteMirror | tests/test_custom_response_text_rewrite.py | Python | mit | 1,808 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from PyQt5 import QtCore
from PyQt5 import QtGui
from PyQt5 import QtWidgets
from .guiconfig import collectView
class BaseToolButton(QtWidgets.QPushButton):
"""docstring for BaseButton"""
def __init__(self, text, parent=None):
super(BaseToolButton,... | dragondjf/CloudSetuper | setuper desktop app/gui/mainwindow/navgationbar.py | Python | mit | 1,788 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 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://babel.edgewall.org/wiki/License.
#
# This ... | mastizada/kuma | vendor/packages/Babel/scripts/import_cldr.py | Python | mpl-2.0 | 20,534 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')
import sys
import json
import math
def explode(coords):
"""Explode a GeoJSON geometry's coordinates object and yield coordinate tuples.
... | bianjiang/tweetf0rm | test_data/geo/process_geojson.py | Python | mit | 4,591 |
import time
from binascii import hexlify, unhexlify
from copy import copy
from tempfile import TemporaryDirectory
import pytest
from ledger.compact_merkle_tree import CompactMerkleTree
from ledger.merkle_verifier import MerkleVerifier
from ledger.stores.hash_store import HashStore
from ledger.tree_hasher import TreeH... | evernym/ledger | ledger/test/test_merkle_proof.py | Python | apache-2.0 | 9,276 |
#!/usr/bin/python
# 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 version.
#
# Ansible is distributed... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/cloud/amazon/iam_policy.py | Python | bsd-3-clause | 14,055 |
#-------------------------------------------------------------------------------
#License GPL v3.0
#Author: Alexandre Manhaes Savio <alexsavio@gmail.com>
#Grupo de Inteligencia Computational <www.ehu.es/ccwintco>
#Universidad del Pais Vasco UPV/EHU
#Use this at your own risk!
#------------------------------------------... | alexsavio/aizkolari | aizkolari_postproc.py | Python | bsd-3-clause | 10,748 |
from datetime import timedelta, datetime
from django.core.management.base import BaseCommand, CommandError
from dasdocc.aggregator.models import Feed
try: from settings import TRASH_EXPIRATION
except ImportError: from dasdocc.aggregator.aggregator_settings import TRASH_EXPIRATION
class Command(BaseCommand):
help ... | JohnRandom/django-aggregator | dasdocc/aggregator/management/commands/trashfeeds.py | Python | bsd-3-clause | 549 |
from __future__ import print_function
import filecmp
import glob
import itertools
import os
import sys
import sysconfig
import tempfile
import unittest
project_dir = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
src_dir = os.path.join(project_dir, 'python')
test_dir = os.path.join(project_dir, 'tests')
p... | youtube/cobalt | third_party/brotli/python/tests/_test_utils.py | Python | bsd-3-clause | 3,695 |
import os
import glob
import shutil
from nose.tools import (assert_equal, assert_is_not_none)
from qipipe.staging.map_ctp import CTPPatientIdMap
from ...helpers.logging import logger
COLLECTION = 'Sarcoma'
"""The test collection."""
SUBJECTS = ["Sarcoma%03d" % i for i in range(8, 12)]
"""The test subjects."""
PAT = ... | ohsu-qin/qipipe | test/unit/staging/test_map_ctp.py | Python | bsd-2-clause | 1,122 |
from database.models.ApiUser import ApiUser
from flask_mail import Message
from flask_app.flask_app import config, mail
from flask_app.flask_app import db
from flask import Blueprint, request, abort, Response, render_template, jsonify
import json
import datetime
from utils.email_utils import EmailValidator
security_bp... | MaximeGir/StarTrekCorpora | api/blueprints/security_api_bp.py | Python | mit | 2,329 |
#-*- coding: utf-8 -*-
"""OAuth 2.0 Django Models"""
import time
from hashlib import sha512
from uuid import uuid4
from django.db import models
from django.contrib.auth.models import User
from .consts import CLIENT_KEY_LENGTH, CLIENT_SECRET_LENGTH
from .consts import SCOPE_LENGTH
from .consts import ACCESS_TOKEN_LE... | xrage/oauth2app-mongoDb | oauth2app/models.py | Python | mit | 5,945 |
#! /usr/bin/python2.7
# -*- coding: iso-8859-1 -*-
#-------------------------------------------------------------------
# tarfile.py
#-------------------------------------------------------------------
# Copyright (C) 2002 Lars Gustäbel <lars@gustaebel.de>
# All rights reserved.
#
# Permission is hereby granted, fre... | krux/duplicity-pkg | duplicity/tarfile.py | Python | gpl-2.0 | 89,049 |
import os
import pytest
@pytest.fixture
def virtualenv_path(host):
return os.path.join(
host.user().home,
# Molecule playbook vars can't be passed into Testinfra tests, so hardcode the path
'.virtualenvs/girder'
)
@pytest.fixture
def config_path(host):
return os.path.join(
... | girder/ansible-role-girder | molecule/default/tests/test_default.py | Python | apache-2.0 | 1,679 |
import io
from typing import Dict, Type, Union
from elftools.elf.elffile import ELFFile
class Binary:
magics: Dict[bytes, Type["Binary"]] = {}
def __new__(cls, path):
if cls is Binary:
with open(path, "rb") as f:
cl = cls.magics[f.read(4)]
return cl(path)
... | trailofbits/manticore | manticore/binary/binary.py | Python | agpl-3.0 | 4,521 |
# Copyright (C) 2009, 2010, 2011 Rickard Lindberg, Roger Lindberg
#
# This file is part of Timeline.
#
# Timeline 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... | linostar/timeline-clone | test/specs/utilities/encodings.py | Python | gpl-3.0 | 1,544 |
# Copyright 2013 - Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | jamesyli/solum | solum/objects/sqlalchemy/models.py | Python | apache-2.0 | 4,756 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.