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 |
|---|---|---|---|---|---|
class A:
def test(self):
a = 1
try:
print a
print "foo"
except:##|
print b
print "bar"
##| else:
print "foo2"
print "bar2"
finally:
print "it works"
var = a * a
pri... | aptana/Pydev | tests/org.python.pydev.refactoring.tests/src/python/visitor/selectionextension/testSelectionExtensionTryPartExcept.py | Python | epl-1.0 | 519 |
# Importing Movie class from media module
from media import Movie
# Importing fresh_tomatoes module
import fresh_tomatoes
# Initializing list variable
movie_objects = []
# Creating Movie object for all the movies in the favorite_movie_list.txt file
# and adding them in the list movie_objects
with open("fa... | kaushikdivya/Udacity-Movie-Trailer-Website | entertainment_center.py | Python | mit | 949 |
#
# Copyright (c) 2011-2013 Christopher L. Felton
#
# 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 License, or
# (at your option) any later version.
#
# This prog... | cfelton/minnesota | mn/models/usbext/fx2/_fpgalink_host.py | Python | gpl-3.0 | 4,792 |
from raw import points
from raw import vertices
from raw import edges
from raw import polygons
__all__ = ['points', 'vertices', 'edges', 'polygons']
| selaux/numpy2vtk | numpy2vtk/data/raw/__init__.py | Python | lgpl-3.0 | 150 |
import cv2
import picamera
import numpy as np
import os
from PIL import Image
cam = picamera.PiCamera()
cam.resolution = (640, 480)
kuva = "kahvia"+".jpg"
cam.capture(kuva)
img = cv2.imread('kahvia.jpg')
os.system('rm kahvia.jpg')
mustakahvi = [0,0,0]
laihakahvi = [22,7,4]
tosilaiha = [95,32,40]
tosiharmaa = [57,57,57... | ETShax/Coffeebot | kahvitulos.py | Python | gpl-3.0 | 1,263 |
''' Work of Cameron Palk '''
def FactorInfo( dict ):
def __init__( self, _scope, _card, _stride ):
self.scope = _scope
self.card = _card
self.stride = _stride
def __repr__( self ):
return ( "Scope : {0.scope}\n" +
"Cards : {0.card}\n" +
"Stride: {0.stride}" ).format( self )
def __mul__( self,... | CKPalk/ProbabilisticMethods | A5/Factor/FactorClass.py | Python | mit | 1,028 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012, Nachi Ueno, NTT MCL, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://ww... | tpaszkowski/quantum | quantum/tests/unit/test_debug_commands.py | Python | apache-2.0 | 17,185 |
# Copyright (c) 2010 Jonathan M. Lange. See LICENSE for details.
from testtools import TestCase
from testtools.helpers import (
try_import,
try_imports,
)
from testtools.matchers import (
Equals,
Is,
)
class TestTryImport(TestCase):
def test_doesnt_exist(self):
# try_import('thin... | zarboz/XBMC-PVR-mac | tools/darwin/depends/samba/samba-3.6.6/lib/testtools/testtools/tests/test_helpers.py | Python | gpl-2.0 | 3,580 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apach... | superstack/nova | nova/tests/integrated/test_xml.py | Python | apache-2.0 | 1,866 |
from zope.component import getUtility, getMultiAdapter
from plone.portlets.interfaces import IPortletType
from plone.portlets.interfaces import IPortletManager
from plone.portlets.interfaces import IPortletAssignment
from plone.portlets.interfaces import IPortletDataProvider
from plone.portlets.interfaces import IPort... | HuygensING/bioport-buildout | plone-buildout/src/inghist.bioportcontent/inghist/bioportcontent/tests/test_borntodayportlet.py | Python | gpl-3.0 | 3,901 |
import ALPHA3
import os, re, subprocess, sys
LOCAL_PATH = __path__[0]
if (sys.platform == 'win32'):
TEST_X86 = ALPHA3.io.LongPath(os.path.join(LOCAL_PATH, "w32-testival.exe"))
if not os.path.isfile(TEST_X86):
raise IOError("Test application not found: \"%s\"." % TEST_X86)
TEST_X86_SHELLCODE_FILE = ... | ohio813/alpha3 | test/__init__.py | Python | bsd-3-clause | 6,247 |
"""
/***************************************************************************
Name : PGUtils
Description : Provides generic PostGIS functions that are not
available through GeoAlchemy
Date : 1/April/2014
copyright : (C) 2013 by John Git... | gltn/stdm | stdm/mapping/utils.py | Python | gpl-2.0 | 1,847 |
from __future__ import absolute_import
import time
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponse
from django.test import TestCase, RequestFactory
from django.utils import unittest
from django.views.generic import View, TemplateView, RedirectView
from . import views
cla... | waseem18/oh-mainline | vendor/packages/Django/tests/regressiontests/generic_views/base.py | Python | agpl-3.0 | 14,853 |
class depth_first_search:
'''
Callable class that is instantiated on a graph.
Performs the classic depth first traversal.
'''
def __init__(self, G):
'''
Constructor of the class
[time]: counter to record [arrival] and
[departure] times of the algori... | Sorrop/py-graph-algorithms | depth_first_search.py | Python | mit | 2,741 |
import unittest
from PySide.QtCore import QUrl
from PySide.QtNetwork import QNetworkRequest
from QtMobility.MultimediaKit import QMediaContent, QMediaResource
class QMediaContentTest(unittest.TestCase):
def testNull(self):
media = QMediaContent()
self.assert_(media.isNull())
self.assertEqu... | PySide/Mobility | tests/MultimediaKit/mediacontent_test.py | Python | lgpl-2.1 | 3,692 |
"""
Simple HTTP Live Streaming client.
References:
http://tools.ietf.org/html/draft-pantos-http-live-streaming-08
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Pu... | repotvsupertuga/repo | script.video.F4mProxy/lib/hlsDownloader.py | Python | gpl-2.0 | 20,840 |
import re
class Row2StringConverter():
def __init__(self):
pass
def convert(self, row):
return self._removeRowPosition(row)
def _removeRowPositionAndType(self, row):
return row[4:]
def _removeRowPosition(self, row):
r= [row[0]]
r.extend(row[4:])
... | fabsx00/joern-old | sourceutils/pythonCFGFilter/pruning/row2string/Row2StringConverter.py | Python | gpl-3.0 | 1,246 |
"""The WaveBlocks Project
This file contains a simple function that selects the desired
matrix exponential routine.
@author: R. Bourquin
@copyright: Copyright (C) 2011 R. Bourquin
@license: Modified BSD License
"""
from functools import partial
class MatrixExponentialFactory:
r"""
A factory for matrix expo... | WaveBlocks/WaveBlocks | src/WaveBlocks/MatrixExponentialFactory.py | Python | bsd-3-clause | 1,307 |
from Actuator.PID import PID
from Actuator.abstract_servo import AbstractServo
import GeneralSettings
import math
class PitchServo(AbstractServo):
def __init__(self, antenna_shared_data, setpoint_shared_data, pin_number, min_angle, max_angle):
AbstractServo.__init__(self, antenna_shared_data,
... | Dronolab/antenna-tracking | Actuator/pitch_servo.py | Python | mit | 1,619 |
# tests meminfo functions in micropython module
import micropython
# these functions are not always available
if not hasattr(micropython, "mem_info"):
print("SKIP")
else:
micropython.mem_info()
micropython.mem_info(1)
micropython.qstr_info()
micropython.qstr_info(1)
print("ok")
| pfalcon/micropython | tests/micropython/meminfo.py | Python | mit | 305 |
# cdiazbas@iac.es
def ftsread(ini, endi, ftsdir=None):
"""
Extract spectral data from the interpolated disk-center
intensity atlas recorded at the Kitt-Peak National
Observatory: Neckel and Labs (1984)
Wavelength range: 3290 - 12508 A
Wavelength step: 0.002 A
CALL: atlas,xla... | aasensio/pyiacsun | pyiacsun/atlas/ftsread.py | Python | mit | 1,427 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | v-iam/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/public_ip_address.py | Python | mit | 4,438 |
# -*- coding: utf-8 -*-
#
# Copyright 2018 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... | jonparrott/google-cloud-python | spanner/google/cloud/spanner_admin_database_v1/gapic/database_admin_client.py | Python | apache-2.0 | 39,496 |
from datetime import datetime
import hashlib
import os
from StringIO import StringIO
from fabric.api import env, hide, put, settings
from fabric.contrib import files
from fabric.utils import apply_lcwd
from fabfile.common.lib.operations import run_or_sudo
from fabfile.common.lib import file
FABRIC_MANAGED_DEFAULT_FOR... | hnakamur/my-fabfiles | fabfile/common/lib/template.py | Python | mit | 3,217 |
# Copyright 2013 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... | hayderimran7/tempest | tempest/api/network/test_extra_dhcp_options.py | Python | apache-2.0 | 4,057 |
from distutils.core import setup
try:
ldsc = open("README.rst").read()
except:
ldsc = ""
setup(
name="git-play",
version="0.13",
author="Stewart Park",
author_email="stewartpark92@gmail.com",
scripts=["bin/git-play"],
url="http://github.com/stewartpark/git-play",
license="MIT LICEN... | stewartpark/git-play | setup.py | Python | mit | 709 |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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, publ... | anastue/netforce | netforce_general/netforce_general/models/login.py | Python | mit | 7,577 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from .makohtml2html import parseNode
| kosgroup/odoo | odoo/report/render/makohtml2html/__init__.py | Python | gpl-3.0 | 137 |
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
---
cliconf: edgeos
short_description: Use edgeos cliconf to run command on ... | simonwydooghe/ansible | lib/ansible/plugins/cliconf/edgeos.py | Python | gpl-3.0 | 3,907 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 Lice... | stephanehenry27/Sickbeard-anime | sickbeard/encodingKludge.py | Python | gpl-3.0 | 2,060 |
import argparse, json, os, time
from parcellearning import pairgat
from parcellearning.utilities import gnnio
from parcellearning.utilities.early_stop import EarlyStopping
from parcellearning.utilities.batch import partition_graphs
from parcellearning.utilities.load import load_schema
from shutil import copyfile
from... | kristianeschenburg/parcellearning | parcellearning/pairgat/train.py | Python | mit | 7,408 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('carts', '0006_auto_20170309_1707'),
]
operations = [
migrations.AddField(
model_name='cart',
name='t... | apul1421/table-client-side-app-retake | src/carts/migrations/0007_auto_20170311_0658.py | Python | gpl-3.0 | 805 |
'''
'''
# 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");... | persiaAziz/trafficserver | tests/gold_tests/slow_post/slow_post.test.py | Python | apache-2.0 | 3,542 |
"""
Mud driver (server).
'Tale' mud driver, mudlib and interactive fiction framework
Copyright by Irmen de Jong (irmen@razorvine.net)
"""
import collections
import datetime
import heapq
import importlib
import inspect
import os
import pathlib
import pkgutil
import random
import sys
import threading
import time
from f... | irmen/Tale | tale/driver.py | Python | lgpl-3.0 | 40,140 |
#!/usr/bin/python
import numpy as np
import os
import sys
import math
import matplotlib
matplotlib.use('Pdf')
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.font_manager as fm
## 7-20-15
## Simple code to ... | plazas/wfirst-detectors-vnl | code/bias_nonlinearity_vs_beta_version2_vs_magnitude.py | Python | mit | 27,257 |
from couchpotato.core.event import fireEvent
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode
from couchpotato.core.helpers.rss import RSS
from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.nzb.base import NZBProvider
from ... | tmxdyf/CouchPotatoServer | couchpotato/core/providers/nzb/omgwtfnzbs/main.py | Python | gpl-3.0 | 2,185 |
from math import ceil, floor, pi, sin
from reportlab.lib.pagesizes import landscape, letter
from reportlab.lib.units import inch, mm
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfgen import canvas
def saw_path(c, bbox):
xmin = 0.5
xmax = 2.5
def ... | kbob/MinimumViableSynth | Front Panel/test.py | Python | gpl-3.0 | 5,551 |
"""
Classes for using robotic or other hardware using Topographica.
This module contains several classes for constructing robotics
interfaces to Topographica simulations. It includes modules that read
input from or send output to robot devices, and a (quasi) real-time
simulation object that attempts to maintain a cor... | Tasignotas/topographica_mirror | topo/hardware/robotics.py | Python | bsd-3-clause | 4,850 |
#!/usr/bin/env python3
# Copyright (c) 2019-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Useful Script constants and utils."""
from test_framework.script import (
CScript,
hash160,
... | instagibbs/bitcoin | test/functional/test_framework/script_util.py | Python | mit | 3,286 |
"""
Django settings for richreview_htk project.
Generated by 'django-admin startproject' using Django 1.8.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Bui... | pmitros/edx-speech-tools | Django/richreview_htk/richreview_htk/settings.py | Python | agpl-3.0 | 3,000 |
import cmath
import math
import itertools
import string
import sys
import textwrap
import numpy as np
from numba.cuda.testing import unittest, CUDATestCase
from numba.core import types, utils
from numba import cuda
from numba.tests.complex_usecases import *
from numba.np import numpy_support
def compile_scalar_func... | sklam/numba | numba/cuda/tests/cudapy/test_complex.py | Python | bsd-2-clause | 8,306 |
'''
System tests for `jenkinsapi.jenkins` module.
'''
# To run unittests on python 2.6 please use unittest2 library
try:
import unittest2 as unittest
except ImportError:
import unittest
from jenkinsapi.job import Job
from jenkinsapi.plugin import Plugin
from jenkinsapi.invocation import Invocation
from jenkinsa... | 117111302/jenkinsapi | jenkinsapi_tests/systests/test_jenkins.py | Python | mit | 4,204 |
from django.conf.urls import include, url
from sapl.comissoes.views import (AdicionaPautaView, CargoComissaoCrud, ComissaoCrud,
ComposicaoCrud, DocumentoAcessorioCrud,
MateriasTramitacaoListView, ParticipacaoCrud,
get_... | interlegis/sapl | sapl/comissoes/urls.py | Python | gpl-3.0 | 1,488 |
#!/usr/bin/env python
import logging, logtool
from cfgtool.cmdbase import CmdBase
LOG = logging.getLogger (__name__)
class Action (CmdBase):
@logtool.log_call
def run (self):
self.report (" Clean...")
for fname in self.cfgfiles:
for ext in [self.conf.backup_ext, self.conf.check_ext,
... | clearclaw/cfgtool | cfgtool/cmd_clean.py | Python | lgpl-3.0 | 494 |
# -*- mode: python; coding: utf-8 -*-
#
# Copyright 2011 Andrej A Antonov <polymorphm@gmail.com>.
#
# 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 License, or
# (... | polymorphm/php-miniprog-shell | lib_php_miniprog_shell_2011_12_17/php_func_argparse.py | Python | gpl-3.0 | 1,004 |
# Code from Chapter 3 of Machine Learning: An Algorithmic Perspective (2nd Edition)
# by Stephen Marsland (http://stephenmonika.net)
# You are free to use, change, or redistribute the code in any way you wish for
# non-commercial purposes, but please maintain the name of the original author.
# This code comes with no... | Anderson-Lab/anderson-lab.github.io | csc_466_2021_spring/MLCode/Ch3/logic.py | Python | mit | 1,027 |
# (c) 2015, Alejandro Guirao <lekumberri@gmail.com>
#
# 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... | lekum/ee-ansible-with-python | extending/plugin/lookup/plugins/shelvefile.py | Python | gpl-3.0 | 2,932 |
import threading
rlock = threading.RLock()
rlock.acquire()
rlock.acquire()
print(threading.current_thread())
print(rlock) | muraliparimi/Python | code/threading/11-more_locks.py | Python | mit | 122 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('stories', '0011_story_photo'),
]
operations = [
migrations.AlterField(
model_name='story',
name='pho... | storiesofsolidarity/story-database | stories/migrations/0012_auto_20151124_0442.py | Python | agpl-3.0 | 458 |
import numpy as np
import statsmodels.api as sm
import scipy as sp
def breusch_pagan_test(y,x):
results=sm.OLS(y,x).fit()
resid=results.resid
n=len(resid)
sigma2 = sum(resid**2)/n
f = resid**2/sigma2 - 1
results2=sm.OLS(f,x).fit()
fv=results2.fittedvalues
bp=0.5 * sum(fv**2)
... | burakbayramli/classnotes | tser/tser_020_ar/breusch.py | Python | gpl-3.0 | 429 |
"""
tabled.pretty_print
~~~~~~~~~~~~~~~~~~~
:synopsis: Pretty printing engine for tableD.
:copyright: (c) 2017, Tommy Ip.
:license: MIT
"""
from typing import Dict, List, Text, Optional
from .style_templates import get_style
from .utils import columns_width
def left_pad(string: Text, width: int) -> Text:
""" I... | tommyip/tabled | tabled/pretty_print.py | Python | mit | 6,067 |
#!/usr/bin/python3
import serverboards, time
@serverboards.rpc_method
def init():
"""
Sleeps one second, wants to be restarted in 30 seconds
"""
serverboards.info("Init test running")
time.sleep(0.5)
serverboards.info("Init test stop")
return 30
@serverboards.rpc_method
def fail():
ra... | serverboards/serverboards | backend/apps/serverboards/test/data/plugins/auth/init.py | Python | apache-2.0 | 364 |
from typing import Tuple
import torch
import torchvision
from torch import Tensor
from torchvision.extension import _assert_has_ops
from ..utils import _log_api_usage_once
from ._box_convert import _box_cxcywh_to_xyxy, _box_xyxy_to_cxcywh, _box_xywh_to_xyxy, _box_xyxy_to_xywh
def nms(boxes: Tensor, scores: Tensor, ... | pytorch/vision | torchvision/ops/boxes.py | Python | bsd-3-clause | 12,872 |
import tests.periodicities.period_test as per
per.buildModel((5 , 'SM' , 400));
| antoinecarme/pyaf | tests/periodicities/Semi_Month/Cycle_Semi_Month_400_SM_5.py | Python | bsd-3-clause | 82 |
from distutils.core import setup
from Cython.Build import cythonize
from distutils.extension import Extension
#extensions = [
#Extension("main", 'main.pyx'),
#Extension("bitset", 'bitset.pyx')
#]
setup(
ext_modules=cythonize("*.pyx",
compiler_directives={'profile': True})
)
| Chiel92/evolutionary-computing | cython/setup.py | Python | mit | 315 |
# http://python-packaging-user-guide.readthedocs.org/en/latest/distributing/#uploading-your-project-to-pypi
# to publish package:
# 1) python setup.py register
# 2) python setup.py sdist bdist_wheel upload
# 3) Convert pypi documentation (http://devotter.com/converter)
from setuptools import setup
setup(name='pywFM',... | jfloff/pywFM | setup.py | Python | mit | 978 |
#!/usr/bin/python3
import socket
class Udp:
"""UDP client for reversing data from meteosonde."""
def __init__(self, address):
host, port = address.split(':')
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock.bind((host, int(port)))
def get_frame(self):
... | pinkavaj/rstt | rstt_cli/source/udp.py | Python | apache-2.0 | 379 |
"""
Settings for bok choy tests
"""
import os
from path import path
# Pylint gets confused by path.py instances, which report themselves as class
# objects. As a result, pylint applies the wrong regex in validating names,
# and throws spurious errors. Therefore, we disable invalid-name checking.
# pylint: disable=inv... | vismartltd/edx-platform | cms/envs/bok_choy.py | Python | agpl-3.0 | 3,750 |
"""
inorder traverse a binary tree
https://leetcode.com/problems/binary-tree-inorder-traversal/
date: 10/09/21
"""
import sys
sys.path.append('utils/')
from TreeUtils import TreeNode
from TreeUtils import insert_level_order
def in_order(root):
if root != None:
in_order(root.left)
print(root.data,end=" ")
in... | entrepidea/projects | python/tutorials/algo/leetcode/easy/binary_tree_traversal.py | Python | gpl-3.0 | 489 |
"""Tests for the Home Assistant Websocket API."""
import asyncio
from unittest.mock import patch
from aiohttp import WSMsgType
from async_timeout import timeout
import pytest
from homeassistant.core import callback
from homeassistant.components import websocket_api as wapi, frontend
from tests.common import mock_htt... | JshWright/home-assistant | tests/components/test_websocket_api.py | Python | apache-2.0 | 8,660 |
#!/usr/bin/python
import numpy as np
mdir = "mesh3d/"
fname = "out_p6-p4-p8"
####################
print "input mesh data file"
f1 = open(mdir+fname+".mesh", 'r')
for line in f1:
if line.startswith("Vertices"): break
pcount = int(f1.next())
xyz = np.empty((pcount, 3), dtype=np.float)
for t in range(pcount):
xyz... | jrugis/cell_mesh | mesh2vtk.py | Python | gpl-3.0 | 2,909 |
"""
Configuration for the documentation generation.
"""
import pkg_resources
project = "wakeonlan"
_dist = pkg_resources.get_distribution(project)
version = _dist.version
release = _dist.version
copyright = "2012, Remco Haszing"
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ex... | remcohaszing/pywakeonlan | docs/conf.py | Python | mit | 534 |
import pymongo
import bson
from pymongo import errors
from gridfs import GridFS
from gridfs.errors import NoFile
import memcache
from .config import Config
class DbError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
ASCENDING = pymongo.... | Education-Numerique/api | lxxl/lib/storage.py | Python | agpl-3.0 | 7,141 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | dayatz/taiga-back | tests/integration/test_occ.py | Python | agpl-3.0 | 15,300 |
"""
Unit tests for optimization routines from optimize.py
Authors:
Ed Schofield, Nov 2005
Andrew Straw, April 2008
To run it in its simplest form::
nosetests test_optimize.py
"""
from __future__ import division, print_function, absolute_import
from numpy.testing import assert_raises, assert_allclose, \
... | alephu5/Soundbyte | environment/lib/python3.3/site-packages/scipy/optimize/tests/test_optimize.py | Python | gpl-3.0 | 28,783 |
import discord
from discord.ext import commands
class Updateg:
def __init__(self, bot):
self.bot = bot
async def on_member_update(self, before, after):
BeforeGame = str(before.game)
AfterGame = str(after.game)
if AfterGame != BeforeGame:
if AfterGame == "... | uncleFedor1/DrygBot | cogs/updateg.py | Python | mit | 1,958 |
# Authors: Andreas Mueller <andreas.mueller@columbia.edu>
# Guillaume Lemaitre <guillaume.lemaitre@inria.fr>
# License: BSD 3 clause
import warnings
import numpy as np
from ..base import BaseEstimator, RegressorMixin, clone
from ..utils.validation import check_is_fitted
from ..utils import check_array, _saf... | kevin-intel/scikit-learn | sklearn/compose/_target.py | Python | bsd-3-clause | 9,661 |
#encoding:utf-8
__authors__ = ['"Wei Keke" <keke.wei@cs2c.com.cn>']
__version__ = "V0.1"
'''
# ChangeLog:
#---------------------------------------------------------------------------------
# Version Date Desc Author
#----------------------------------------------------... | faylau/oVirt3.3WebAPITest | src/TestData/Profile/ITC090301_CreateProfile.py | Python | apache-2.0 | 1,306 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/python-docs-samples | people-and-planet-ai/timeseries-classification/trainer.py | Python | apache-2.0 | 10,308 |
#!/usr/bin/env python
#
# A simple benchmark of the tornado.gen module.
# Runs in two modes, testing new-style (@coroutine and Futures)
# and old-style (@engine and Tasks) coroutines.
from timeit import Timer
from tornado import gen
from tornado.options import options, define, parse_command_line
define('num', defaul... | noogel/xyzStudyPython | tornado/translate_tornado_4_2_1/demos/benchmark/gen_benchmark.py | Python | apache-2.0 | 1,189 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC
# 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/l... | aristanetworks/arista-ovs-quantum | quantum/tests/unit/test_attributes.py | Python | apache-2.0 | 17,269 |
import decimal
import os.path
import re
import textwrap
import typing
import unittest
from django.test import TestCase as DjangoTestCase
import kirppu.provision_dsl.interpreter as dsl
from kirppu.provision_dsl.interpreter import Error, ErrorType
from kirppu.models import Item
from kirppu.tests.factories import ItemFac... | jlaunonen/kirppu | kirppu/provision_dsl/test_dsl.py | Python | mit | 9,380 |
import sys
import os
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
import pynab.ids
from pynab.db import db_session, MetaBlack
def local_postprocess():
with db_session() as db:
# noinspection PyComparisonWithNone,PyComparisonWithNone
db.query(MetaBlack).filter(... | gkoh/pynab | scripts/quick_postprocess.py | Python | gpl-2.0 | 1,003 |
#!/usr/bin/env python
from raspledstrip.ledstrip import *
from raspledstrip.animation import *
from raspledstrip.color import Color
import requests
import json
import time
import sys
import traceback
# Things that should be configurable
ledCount = 32 * 5
api = 'http://lumiere.lighting/'
waitTime = 6
class Lumiere:
... | lumiere-lighting/lumiere-node-raspberry-pi | lumiere.old.py | Python | mit | 2,222 |
import logging
import numpy as NP
from pyglow.pyglow import Point
from ..gpstk import PyPosition
from ..util.los_integrator import SlantIntegrator
logger = logging.getLogger('pyrsss.iri.iri_stec')
def iri_stec(dt, stn_pos, sat_pos, alt1=100, alt2=2000, epsabs=1e-1, epsrel=1e-1):
def fun(pos):
llh = pos... | butala/pyrsss | pyrsss/iri/iri_stec.py | Python | mit | 1,141 |
#!/usr/bin/env python -i
# preceding line should have path for Python on your machine
# vizplotgui_vmd.py
# Purpose: viz running LAMMPS simulation via VMD with plot and GUI
# Syntax: vizplotgui_vmd.py in.lammps Nfreq compute-ID
# in.lammps = LAMMPS input script
# Nfreq = plot data point and viz shap... | Pakketeretet2/lammps | python/examples/vizplotgui_vmd.py | Python | gpl-2.0 | 4,474 |
import _plotly_utils.basevalidators
class SizeValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="size", parent_name="sankey.node.hoverlabel.font", **kwargs
):
super(SizeValidator, self).__init__(
plotly_name=plotly_name,
parent_nam... | plotly/python-api | packages/python/plotly/plotly/validators/sankey/node/hoverlabel/font/_size.py | Python | mit | 556 |
# Copyright (c) 2013 Stefano Palazzo <stefano.palazzo@gmail.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 later version.
#
# T... | sfstpala/plzz.de | plzz/tests/test_template.py | Python | gpl-3.0 | 980 |
# Copyright (c) 2013 Hortonworks, 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 ... | esikachev/scenario | sahara/utils/timing.py | Python | apache-2.0 | 1,755 |
# -*- coding: utf-8 -*-
"""
utilities.turbomail
~~~~~~~~~~~~~~~~~~~
Using TurboMail with Flask
http://flask.pocoo.org/snippets/16/
"""
import atexit
from turbomail.control import interface
from turbomail.message import Message
from flask import Flask
# pass in dict of config options
interface.star... | fengsp/flask-snippets | utilities/turbomail.py | Python | bsd-3-clause | 671 |
"""Test config flow."""
from unittest.mock import patch
import pytest
from homeassistant.setup import async_setup_component
from tests.common import MockConfigEntry, mock_coro
@pytest.fixture(autouse=True)
def mock_finish_setup():
"""Mock out the finish setup method."""
with patch(
"homeassistant.c... | leppa/home-assistant | tests/components/mqtt/test_config_flow.py | Python | apache-2.0 | 4,545 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import pickle
import shutil
import sys
import tempfile
import numpy as np
from numpy import arange, nan
import pandas.testing as pdt
from pandas import DataFrame, MultiIndex, Series, to_datetime
# dependencies testing specific
import pytest
import recordlinka... | J535D165/recordlinkage | tests/test_compare.py | Python | bsd-3-clause | 50,974 |
# coding=UTF-8
"""
Tests courseware views.py
"""
import itertools
import json
import unittest
from datetime import datetime, timedelta
from pytz import utc
from uuid import uuid4
import crum
import ddt
import six
from completion.test_utils import CompletionWaffleTestMixin
from crum import set_current_request
from dj... | edx-solutions/edx-platform | lms/djangoapps/courseware/tests/test_views.py | Python | agpl-3.0 | 149,544 |
from flask import render_template, request, session, redirect, url_for, send_file
from sqlalchemy import desc
import json
import unicodecsv
from models import BannedWork, Vote, User, create_banned_work, create_vote, Country
from app import app
from app import db
@app.route('/', methods=['GET', 'POST'])
def index(... | wpapper/Glasnost | web/views2.py | Python | mit | 5,491 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# This is stepconf, a graphical configuration editor for Machinekit
# Copyright 2007 Jeff Epler <jepler@unpythonic.net>
#
# stepconf 1.1 revamped by Chris Morley 2014
# replaced Gnome Druid as that is not available in future linux distributions
# and beca... | ArcEye/MK-Qt5 | src/emc/usr_intf/stepconf/stepconf.py | Python | lgpl-2.1 | 62,092 |
import os
import sys
import random
from clint.textui import colored
import subprocess
from conf import DI
from conf import treemake
from conf import py
import emoticons
from logger import Logger
import tree_reader
def run_tree(infile,outfile):
cmd = "FastTree -nt -gtr "+infile+" 2>fasttree.out > "+outfile
os.... | FePhyFoFum/PyPHLAWD | src/cluster_tree_wc.py | Python | gpl-2.0 | 2,115 |
#!/usr/bin/python
#
# Copyright (C) 2012 Chris Gordon
#
# 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 License, or (at your option) any later version.
#
# This program... | theory14/wimm | src/wimm.py | Python | gpl-2.0 | 5,634 |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | alecdotico/blablastar | cloudstorage/cloudstorage_api.py | Python | mit | 23,708 |
# -*- coding: utf-8 -*-
from . import web_gantt8
| houssine78/addons | web_gantt8/__init__.py | Python | agpl-3.0 | 50 |
import logging
import select
import socket
from collections import deque
from amqpsfw import amqp_spec
from amqpsfw.exceptions import SfwException
from amqpsfw.configuration import Configuration
amqpsfw_logger = logging.getLogger('amqpsfw')
log_handler = logging.StreamHandler()
formatter = logging.Formatter('%(ascti... | akayunov/amqpsfw | lib/amqpsfw/application.py | Python | mit | 6,761 |
from arza.runtime.routine.routine import complete_native_routine
from arza.runtime import error
from arza.types import api, space, plist, environment, datatype, partial
from arza.types.dispatch import generic
from arza.misc.strutil import encode_unicode_utf8
from arza.misc.platform import rstring, compute_unique_id
fr... | gloryofrobots/obin | arza/builtins/lang.py | Python | gpl-2.0 | 12,071 |
from setuptools import setup
setup(name='uzbl',
version='201100808',
description='Uzbl event daemon',
url='http://uzbl.org',
packages=['uzbl', 'uzbl.plugins'],
entry_points={
'console_scripts': [
'uzbl-event-manager = uzbl.event_manager:main'
]
})
| keis/uzbl | setup.py | Python | gpl-3.0 | 318 |
# -*- coding: utf-8 -*-
import json
import os.path
class TweetPict:
"""Getting Timeline using the session."""
def __init__(self, session):
self.session = session
self.params = {}
def tweet_pict(self, msg="", pict_path=""):
url_for_media='https://upload.twitter.com/1.1/media/upload... | fumi-san/push_dog_pict | push_dog_pict/twitter_connect/tweet_pict.py | Python | apache-2.0 | 3,524 |
class C4FileIO():
red_wins = 0
blue_wins = 0
def __init__(self):
try:
f = open("c4wins.txt", "r")
lines = f.readlines()
f.close()
if type(lines) == list:
self.deserialize_file(lines)
except FileNotFoundError:
print(... | Xorgon/Connect4 | src/main/python/c4FileIO.py | Python | mit | 916 |
#/*##########################################################################
# Copyright (C) 2004-2012 European Synchrotron Radiation Facility
#
# This file is part of the PyMca X-ray Fluorescence Toolkit developed at
# the ESRF by the Software group.
#
# This toolkit is free software; you can redistribute it and/or m... | tonnrueter/pymca_devel | PyMca/PeakTableWidget.py | Python | gpl-2.0 | 29,004 |
import sys
# For Python 3
sys.path[0] = sys.path[0] + "/gmaps" | rodneyrick/projetotcc | gmaps/__init__.py | Python | gpl-2.0 | 63 |
# Copyright (c) 2013 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 ... | CingHu/neutron-ustack | neutron/tests/unit/ml2/test_ml2_plugin.py | Python | apache-2.0 | 43,632 |
def test_upper():
assert "foo".upper() == "FOO"
def test_lower():
assert "FOO".lower() == "foo"
| JoelMarcey/buck | third-party/py/pytest/testing/freeze/tests/test_trivial.py | Python | apache-2.0 | 106 |
from datetime import datetime, timedelta
import unittest
from mycroft.skills.scheduled_skills import ScheduledSkill
from mycroft.util.log import getLogger
__author__ = 'eward'
logger = getLogger(__name__)
class ScheduledSkillTest(unittest.TestCase):
skill = ScheduledSkill(name='ScheduledSkillTest')
def te... | ethanaward/mycroft-core | test/skills/scheduled_skills.py | Python | gpl-3.0 | 1,125 |
#!/usr/bin/python
#
# Copyright (c) 2018 Yunge Zhu, <yungez@microsoft.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | pilou-/ansible | lib/ansible/modules/cloud/azure/azure_rm_webappslot.py | Python | gpl-3.0 | 40,667 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.