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 |
|---|---|---|---|---|---|
from instal.firstprinciples.TestEngine import InstalSingleShotTestRunnerFromText, InstalTestCase
from instal.instalexceptions import InstalParserArgumentError
class TestNormParserArgsPerms(InstalTestCase):
IAL_PRELUDE = """
institution inst_name;
type Alpha; % Ground with {a, b}
type Beta; % Ground wi... | cblop/tropic | instal-linux/instal/firstprinciples/normparserargs/TestNormParserArgsPerms.py | Python | epl-1.0 | 12,302 |
#!/usr/bin/python
''' put the following before <body> to enable analytics (tracking)
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-3543530-1";
urchinTracker();
</script>
'''
import sys
if len(sys.argv) < 2:
exit
pageset = sy... | ellson/graphviz-web-dynamic | ht2php.py | Python | epl-1.0 | 1,789 |
#!/usr/bin/env python
import time
from appmetrics import metrics
from pykafka import KafkaClient
DEBUG = 0
## From AppMetrics
reservoir = metrics.histogram.UniformReservoir(1028)
hist = metrics.new_histogram("call-timer", reservoir)
raw_ns = []
client = KafkaClient(hosts="127.0.0.1:9092")
# implicitly creates th... | egustafson/sandbox | Python/kafka-pykafka-01/k-prod.py | Python | apache-2.0 | 1,179 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | timj/scons | test/Configure/cache-ok.py | Python | mit | 5,144 |
# Copyright (c) 2015 Intel Corpration
#
# 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 w... | shakamunyi/sahara | sahara/tests/unit/plugins/cdh/v5_7_0/test_validation.py | Python | apache-2.0 | 879 |
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# *************************************... | elijah513/ice | java/test/src/main/java/test/Ice/plugin/run.py | Python | gpl-2.0 | 1,110 |
# From https://www.baldengineer.com/raspberry-pi-gui-tutorial.html
# by James Lewis (@baldengineer)
# Minimal python code to start PyQt4 GUI
#
# always seem to need this
import sys
# This gets the Qt stuff
import PyQt4
from PyQt4.QtWidgets import *
# This is our window from QtCreator
import mainwindow_auto
# creat... | shinichiba/YamadaLabSkinFrictionR7 | main.py | Python | mit | 1,249 |
from i3pystatus import Status
status = Status()
status.register("redshift",
redshift_parameters = ["-l 14.628434:-90.522713"]
)
status.register("backlight",
format = "{percentage}"
)
#status.register("alsa")
status.register("alsa",
card = 0,
mixer = "Master"
)
status.register("alsa",
card = 1,... | UltimatePancake/dotfiles | .config/i3/topbar.py | Python | gpl-2.0 | 482 |
from polyphony import testbench
class D:
def get_v(self, v):
return v
class C:
def __init__(self, v):
self.v = v
def alias08(x):
s = 0
for i in range(x):
c = C(i)
s += c.v
return s
@testbench
def test():
assert 1+2+3 == alias08(4)
assert 0 == alias08(0... | ktok07b6/polyphony | tests/class/alias08.py | Python | mit | 335 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | cernops/keystone | keystone/conf/resource.py | Python | apache-2.0 | 3,837 |
import re
import pytest
pytestmark = pytest.mark.page('tables.html')
class TestTdExists(object):
def test_returns_true_if_the_td_exists(self, browser):
assert browser.td(id='t1_r2_c1').exists is True
assert browser.td(id=re.compile('t1_r2_c1')).exists is True
assert browser.td(text='Tabl... | lmtierney/watir-snake | tests/browser/elements/td_tests.py | Python | mit | 2,658 |
#!/usr/bin/env python
import os
import re
import sys
import numpy as np
from chrom import *
from ..util import util as u
from ..util.elements import ELEMENTS
au2ang = 0.529177249
#
# GAMESS US output file
#
class Gamess(Chrom):
'''A class to parse GAMESS US td logfiles.'''
def __init__(self, outfile):
... | dpadula85/ExSPy | stable/QM_parser/parser/gamess.py | Python | gpl-3.0 | 3,672 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2018-03-07 11:07
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('organization_pages', '0026_auto_20180307_1152'),
]
... | Ircam-Web/mezzanine-organization | organization/pages/migrations/0027_auto_20180307_1207.py | Python | agpl-3.0 | 619 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test re-org scenarios with a mempool that contains transactions
# that spend (directly or indirectly)... | segsignal/bitcoin | qa/rpc-tests/mempool_reorg.py | Python | mit | 4,514 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# BounCA Tutorials documentation build configuration file, created by
# sphinx-quickstart on Sat Jun 4 17:20:42 2016.
#
import os
import sys
import sphinx_bootstrap_theme
html_show_sourcelink = False
html_show_sphinx = False
html_permalinks = None
# Add any Sphinx ... | repleo/bounca | docs/source/conf.py | Python | apache-2.0 | 9,227 |
from random import choice
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import (
AbstractBaseUser,
BaseUserManager,
Group,
PermissionsMixin,
)
from django.db import models
from openslides.utils.search import user_name_helper
from ..core.config import config
fro... | rolandgeider/OpenSlides | openslides/users/models.py | Python | mit | 6,452 |
from django import forms
from cyder.base.eav.forms import get_eav_form
from cyder.cydhcp.vlan.models import Vlan, VlanAV
class VlanForm(forms.ModelForm):
#site = forms.ModelChoiceField(queryset=Site.objects.all())
class Meta:
model = Vlan
VlanAVForm = get_eav_form(VlanAV, Vlan)
| akeym/cyder | cyder/cydhcp/vlan/forms.py | Python | bsd-3-clause | 301 |
import sys
import setuptools
from version import __version__ as version
requirements = ['tornado', 'praw>=3.3.0', 'six', 'requests', 'kitchen']
# Python 2: add required concurrent.futures backport from Python 3.2
if sys.version_info.major <= 2:
requirements.append('futures')
setuptools.setup(
name='rtv',
... | yskmt/rtv | setup.py | Python | mit | 1,544 |
from __future__ import print_function
import datetime
from decimal import *
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
from _utils import unique_slugify
from django_rea.valueaccounting.models.recipe import EventType
class Proces... | django-rea/nrp | django_rea/valueaccounting/models/process.py | Python | agpl-3.0 | 44,063 |
#
# 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
# ... | pshchelo/heat | heat/engine/resources/openstack/swift/swift.py | Python | apache-2.0 | 8,933 |
#!/usr/bin/env python
'''Main program for subhd.py
'''
import argparse
from guessit import guess_video_info
from subhd_py.core import SubHDDownloader
from subhd_py.compressor import ZIPFileHandler, RARFileHandler
from subhd_py.sanitizer import to_unicode, to_chs, to_cht, reset_index, set_utf8_without_bom
EPILOG = '''
... | gogozs/subhd.py | bin/subhd.py | Python | gpl-3.0 | 5,975 |
from django.contrib import admin
# Register your models here.
from .models import Comment
admin.site.register(Comment) | iharsh234/eElectronics | comments/admin.py | Python | mit | 127 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | google-research/google-research | simulation_research/traffic/random_traffic_generator_test.py | Python | apache-2.0 | 13,728 |
import daft
def simple():
# Instantiate a PGM.
pgm = daft.PGM([3.3, 3.0], origin=[0.3, 0.3], grid_unit=2.6, node_unit=1.3, observed_style="inner")
# Model parameters:
pgm.add_node(daft.Node("a", r"$a$", 0.8, 2.8))
pgm.add_node(daft.Node("b", r"$b$", 1.8, 2.8))
# Latent variable - intrinsic ... | dongwooc/StatisticalMethods | examples/Cepheids/cepheids_pgm.py | Python | gpl-2.0 | 1,050 |
from office365.runtime.client_object import ClientObject
class VideoChannel(ClientObject):
pass
| vgrem/SharePointOnline-REST-Python-Client | office365/sharepoint/publishing/video_channel.py | Python | mit | 102 |
# Copyright 2020 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... | tensorflow/examples | tensorflow_examples/lite/model_maker/core/task/audio_classifier.py | Python | apache-2.0 | 5,964 |
# coding=utf-8
import unittest
from mdstudio.db.sort_mode import SortMode
class SortModeTests(unittest.TestCase):
def test_asc(self):
self.assertEqual(str(SortMode.Asc), 'asc')
def test_desc(self):
self.assertEqual(str(SortMode.Desc), 'desc')
def test_asc2(self):
self.assertEqua... | MD-Studio/MDStudio | mdstudio/mdstudio/tests/db/test_sort_mode.py | Python | apache-2.0 | 502 |
# encoding: 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 'UserProfile.time_zone'
db.add_column('user_profiles', 'time_zone', self.gf('django.db.models.fields... | archhurd/archweb | main/migrations/0037_auto__add_field_userprofile_time_zone.py | Python | gpl-2.0 | 11,869 |
# -*- coding: utf-8 -*-
"""
werkzeug.testsuite.serving
~~~~~~~~~~~~~~~~~~~~~~~~~~
Added serving tests.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import sys
import time
import urllib
import unittest
from functools import update_wrapper
from StringIO im... | rooty/minishopgae | werkzeug/testsuite/serving.py | Python | gpl-3.0 | 2,218 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | datalogics/scons | test/Subst/AllowSubstExceptions.py | Python | mit | 2,925 |
# coding: utf-8
from __future__ import unicode_literals
import itertools
import os
import re
from .common import InfoExtractor
from ..compat import (
compat_HTTPError,
compat_urllib_parse_unquote,
compat_urllib_parse_unquote_plus,
compat_urllib_parse_urlparse,
)
from ..utils import (
ExtractorErro... | TRox1972/youtube-dl | youtube_dl/extractor/pornhub.py | Python | unlicense | 10,204 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import requests
import random
import json
import sys
import tkinter.messagebox
# import win32api, win32con
import time
import bs4
import re
import configparser
import argparse
import offical_day
import ping
from log_util import root_logger
parser = argpars... | PeytonXu/learn-python | cases/henghan_oa_checkin_checkout/auto_checkin_out.py | Python | mit | 7,603 |
# -*- coding: utf-8 -*-
from flexmock import flexmock
from orator.migrations import DatabaseMigrationRepository
from orator.commands.migrations import InstallCommand
from .. import OratorCommandTestCase
class MigrateInstallCommandTestCase(OratorCommandTestCase):
def test_execute_calls_repository_to_install(self)... | sdispater/orator | tests/commands/migrations/test_install_command.py | Python | mit | 679 |
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from rest_framework import serializers
from lib.tools import validator
from system.library.music.models import LibraryMusic
from system.media.models import Media
class LibraryMusicSerializer(serializers.ModelSerializer):
"""
系统素材库 - 音乐库 序... | doraemonext/wechat-platform | wechat_platform/api/library/music/serializer.py | Python | bsd-2-clause | 2,975 |
import unittest
import mock
from tests.mock import mock_factory
from xcrawler.pythonutils.converters.object_converter import ObjectConverter
from xcrawler.pythonutils.converters.object_converter import StringConverter
from xcrawler.pythonutils.types.instance_resolver import InstanceResolver
class TestObjectConverte... | lucdom/xCrawler | tests/pythonutils/converters/test_object_converter.py | Python | gpl-2.0 | 4,967 |
"""
after octave code by cicciospice, numpy recode by zeffii
function [x,y,z] = hilbert3(n)
if n <= 0
x = 0;
y = 0;
z = 0;
else
[xo,yo,zo] = hilbert3(n-1);
x = .5*[.5+zo .5+yo -.5+yo -.5-xo -.5-xo -.5-yo .5-yo .5+zo];
y = .5*[.5+xo .5+zo .5+zo .5+yo -.5+yo -.5-z... | kilon/sverchok | node_scripts/templates/zeffii/hilbert3.py | Python | gpl-3.0 | 1,184 |
"""Tests for the thumbs module"""
import pytest
from bok_choy.promise import EmptyPromise
from workbench import scenarios
from workbench.test.selenium_test import SeleniumTest
class ThreeThumbsTest(SeleniumTest):
"""Test the functionalities of the three thumbs test XBlock."""
def setUp(self):
supe... | edx/xblock-sdk | workbench/test/test_filethumbs.py | Python | apache-2.0 | 3,181 |
from setuptools import setup, find_packages
# from distutils.core import setup
setup(
name='python-youtrack-api',
version='1.0.0',
description='Python client for JetBrains\' YouTrack REST API',
packages=[
'sit_youtrack', 'sit_youtrack.agilezen',
'sit_youtrack.bugzilla', 'sit_youtrack.c... | softintouch/python-youtrack-api | setup.py | Python | apache-2.0 | 732 |
#! /usr/bin/env python
from sys import argv, exit
from os import path
from DBR import SqliteDB
from numpy import *
# define colors
purple = "\033[95m"
green = "\033[92m"
red = "\033[91m"
normal = "\033[0m"
class ParticleReader(object):
"""
This class is used to perform statistical analysis on particle
... | chunshen1987/particle_Afterburner | ParticleReader.py | Python | gpl-3.0 | 41,335 |
# -*- coding: utf-8 -*-
#
# 2015-07-16 Initial writeup
# (c) Cornelius Kölbel
# License: AGPLv3
# contact: http://www.privacyidea.org
#
# This code is free software; you can redistribute it and/or
# modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
# License as published by the Free Software Foun... | XCage15/privacyidea | privacyidea/lib/stats.py | Python | agpl-3.0 | 5,464 |
import pytest
from zeroless import (Server, Client)
class TestClientServer:
def test_server_port_property(self):
port = 1050
server = Server(port=port)
assert server.port == port
def test_client_addresses_property(self):
client = Client()
addresses = (('10.0.0.1', 156... | x8lucas8x/python-zeroless | tests/test_client_server.py | Python | lgpl-2.1 | 483 |
from qt import QtCore, QtGui
class Icon(QtGui.QIcon):
def setColor(self, color, size=None):
icon = self
size = size or icon.actualSize(QtCore.QSize(256, 256))
pixmap = icon.pixmap(size)
rect = QtCore.QRect(0, 0, size.width(), size.height())
if not self.isNull():
... | dsparrow27/zoocore | zoo/libs/pyqt/widgets/icon.py | Python | gpl-3.0 | 632 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import merge_dicts
class MallTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mall\.tv/(?:[^/]+/)*(?P<id>[^/?#&]+)'
_TESTS = [{
'url': 'https://www.mall.tv/18-miliard-pro-neziskovky... | rrooij/youtube-dl | youtube_dl/extractor/malltv.py | Python | unlicense | 2,095 |
import argparse
import pprint
import numpy as np
import pdb
import sys
import os.path
this_dir = os.path.dirname(__file__)
sys.path.insert(0, this_dir + '/..')
from lstm.utils.config import cfg, cfg_from_file, get_output_dir, get_log_dir
from lstm.networks.factory import get_network
from easydict import EasyDict as... | zhangcheng007/cnn_lstm_ctc_ocr | train_net.py | Python | mit | 2,602 |
# Copyright 2019 The Sonnet 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 applicable l... | deepmind/sonnet | sonnet/src/reshape.py | Python | apache-2.0 | 6,622 |
""" Simple logistic regression model to solve OCR task
with MNIST in TensorFlow
MNIST dataset: yann.lecun.com/exdb/mnist/
Author: Chip Huyen
Prepared for the class CS 20SI: "TensorFlow for Deep Learning Research"
cs20si.stanford.edu
"""
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import numpy as np
import tensor... | YeEmrick/learning | stanford-tensorflow/2017/examples/03_logistic_regression_mnist_sol.py | Python | apache-2.0 | 3,350 |
# Copyright (C) 2016 Guillaume Dupuy
# Author: Guillaume Dupuy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.... | Gloorf/ryzom_inventory | wsgi.py | Python | agpl-3.0 | 786 |
# -*- coding: utf-8 -*-
"""
Tests for the backported class:`range` class.
"""
from future.builtins import range
from future.tests.base import unittest
from collections import Iterator, Sequence
from operator import attrgetter
class RangeTests(unittest.TestCase):
def test_range(self):
self.assertTrue(isi... | snakeleon/YouCompleteMe-x86 | third_party/ycmd/third_party/python-future/tests/test_future/test_range.py | Python | gpl-3.0 | 8,578 |
"""
For all the reads in a fastq file, figure out where they are in a series of
bam files
"""
import os
import re
import sys
import argparse
from roblib import stream_fastq
import pysam
from suffix_trees import STree
__author__ = 'Rob Edwards'
if __name__ == "__main__":
parser = argparse.ArgumentParser(descript... | linsalrob/EdwardsLab | bam/assign_mapped_reads.py | Python | mit | 2,572 |
from unittest import mock
import pytest
from openapi_core.testing.datatypes import ResultMock
from openapi_core.testing.factories import FactoryClassMock
from openapi_core.validation.response.shortcuts import spec_validate_data
class TestSpecValidateData:
@mock.patch(
"openapi_core.validation.response.s... | p1c2u/openapi-core | tests/unit/validation/test_response_shortcuts.py | Python | bsd-3-clause | 2,927 |
#!/usr/bin/env python
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings modu... | CBien/django-alert | test_project/manage.py | Python | mit | 698 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Label documents with doc2vec.
"""
import numpy as np
import os
from collections import Counter
from pprint import pprint
import csv
import sys
import gensim
from gensim.corpora import Dictionary, HashDictionary, MmCorpus
from gensim.models.doc2vec import TaggedDocume... | arunchaganty/presidential-debates | python/doc2vec.py | Python | mit | 5,109 |
background_image_filename = 'sushiplate.jpg'
sprite_iamge_filename = 'fugu.png'
import pygame
from pygame.locals import *
from sys import exit
from gameobjects.vector2 import Vector2
pygame.init()
screen = pygame.display.set_mode((640, 480), 0, 32)
background = pygame.image.load(background_image_filename).convert()
... | opensvn/python | pygame/keymovement.py | Python | gpl-2.0 | 1,164 |
# Copyright 2015 IBM Corp.
#
# 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, sof... | openstack/vitrage-dashboard | vitrage_dashboard/alarms/panel.py | Python | apache-2.0 | 733 |
import heap_sort
import unittest
class tc1 (unittest.TestCase):
def test_already_max_heap(self):
self.array = [3,2,1]
self.assertEqual(heap_sort.max_heapify(self.array,0),self.array)
def test_not_max_heap_before(self):
self.array = [1,2,3]
self.assertEqual(heap_sort.max_heapify... | humw/algorithms_in_python | heap_sort/max_heapify_unittest.py | Python | gpl-2.0 | 1,311 |
'''
Created on 11.11.2013
@author: northernstars
'''
from time import sleep
from mrLib.networking.mrSocketManager import mrSocketManager
def onClientAddedListener(clientdata):
print( "SERVER: new client " + str(clientdata[1]) + " added" )
def onDataRecievedListener(socket, addr, data):
print( str(socket... | NorthernStars/python-mrlib | python-mrLib/test/udpTest.py | Python | apache-2.0 | 1,178 |
from simple_cms.models import Navigation
from simple_cms.views import NavigationView
from django.http import Http404
from django.conf import settings
from functools import update_wrapper
class NavigationMiddleware(object):
def process_response(self, request, response):
if response.status_code != 404:
... | 3atmospheres/django-simple-cms | simple_cms/middleware/__init__.py | Python | mit | 715 |
import docx
doc = docx.Document('demo.docx')
len(doc.paragraphs)# Quantidade de Paragrafos no Documento
doc.paragraphs[0].text #Titulo do documento[linha 0 ]
doc.paragraphs[1].text #Texto do documento[linha 1 ]
doc.paragraphs[0].style = 'Normal' # Stilo da linha 1 = Normal
print(readDocx.getText('... | wandersonclayton3/ESOF | Aᴛɪᴠɪᴅᴀᴅᴇ (M4) - Scripts para dia-a-dia/docx_Python.py | Python | apache-2.0 | 455 |
# scrapy includes
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
# spider includes
from product_spiders.items import Product, ProductLoader
# main c... | 0--key/lib | portfolio/Python/scrapy/reliefspot/medlief.py | Python | apache-2.0 | 3,429 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2009 by the FIFE team
# http://www.fifengine.de
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU Le... | mgeorgehansen/FIFE_Technomage | tests/swig_tests/gui_tests.py | Python | lgpl-2.1 | 2,381 |
#!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
"""
Application to manage a set of processus
"""
# Copyright (C) 2017 by
# Emmanuel Desmontils <emmanuel.desmontils@univ-nantes.fr>
# Patricia Serrano-Alvarado <patricia.serrano-alvarado@univ-nantes.fr>
# All rights reserved.
# GPL v 2.0 license.
import m... | edesmontils/SWEEP | tools/ProcessSet.py | Python | gpl-3.0 | 4,418 |
import os
from autotest_lib.client.bin import test, utils
class fsfuzzer(test.test):
version = 1
def initialize(self):
self.job.require_gcc()
# http://people.redhat.com/sgrubb/files/fsfuzzer-0.6.tar.gz
def setup(self, tarball = 'fsfuzzer-0.6.tar.gz'):
tarball = utils.unmap_url(self.... | libvirt/autotest | client/tests/fsfuzzer/fsfuzzer.py | Python | gpl-2.0 | 645 |
import unittest
import main
class ExampleTest(unittest.TestCase):
def test_main(self):
self.assertEqual("2.25.1", main.version())
if __name__ == "__main__":
unittest.main()
| bazelbuild/rules_python | examples/pip_parse/test.py | Python | apache-2.0 | 194 |
"""
The base Command class.
All commands in Evennia inherit from the 'Command' class in this module.
"""
from builtins import range
import re
from evennia.locks.lockhandler import LockHandler
from evennia.utils.utils import is_iter, fill, lazy_property, make_iter
from future.utils import with_metaclass
def _init_c... | MarsZone/DreamLand | evennia/evennia/commands/command.py | Python | bsd-3-clause | 15,717 |
import numpy as np
import matplotlib.pyplot as plt
import math
import random
def freqCombLUT(fList, sampleRate=540e6, resolution=1e4):
size = int(sampleRate/resolution)
I = np.array([0.]*size)
for f in fList:
phase = random.uniform(-math.pi, math.pi)
I = np.add(I, singleFreqLUT(f, sampleRa... | bmazin/SDR | Projects/ChannelizerSim/legacy/lutScaling.py | Python | gpl-2.0 | 1,024 |
import base64
import datetime
import re
from uuid import UUID
import bson
import bson.json_util
from mongo_connector.compat import PY3
if PY3:
long = int
unicode = str
RE_TYPE = type(re.compile(""))
try:
from bson.regex import Regex
RE_TYPES = (RE_TYPE, Regex)
except ImportError:
RE_TYPES = (RE... | thelok/mongo-connector | mongo_connector/doc_managers/formatters.py | Python | apache-2.0 | 5,068 |
# coding: utf-8
from __future__ import unicode_literals
import pytest
from mock import Mock
from ..vocab import Vocab
from ..tokens.doc import Doc
from ..tokens.underscore import Underscore
def test_create_doc_underscore():
doc = Mock()
doc.doc = doc
uscore = Underscore(Underscore.doc_extensions, doc)
... | ryfeus/lambda-packs | Spacy/source2.7/spacy/tests/test_underscore.py | Python | mit | 3,181 |
from autotest.client.virt import virt_test
class kvm(virt_test.virt_test):
"""
Suite of KVM virtualization functional tests.
Contains tests for testing both KVM kernel code and userspace code.
@copyright: Red Hat 2008-2009
@author: Uri Lublin (uril@redhat.com)
@author: Dror Russo (drusso@redh... | nacc/autotest | client/tests/kvm/kvm.py | Python | gpl-2.0 | 663 |
#
# This module will read in the galfit best fit values and uncertainties
#
from astropy.io import fits
'''
to create an object containing galfit results, use obj = GalfitResult('<output block fits file>')
you can access to the output parameters by:
obj.component_num.param
'''
class GalfitComponent(object):... | astronomeralex/galfit-python-parser | galfit_parser.py | Python | mit | 4,037 |
import endpoints
import logging
from api_common import *
from protorpc import messages
from protorpc import remote
'''
Endpoint DTOs
'''
class UserComment(messages.Message):
commentId = messages.StringField(1)
postId = messages.StringField(2)
points = messages.IntegerField(3)
message = messages.Strin... | secret-transaction/RipOff9Gag | server/ripoff9gag/api_comments.py | Python | apache-2.0 | 2,256 |
from guizero import App, PushButton, Text, Box
app = App()
top_box = Box(app, align="top", width="fill")
PushButton(top_box, text="to the left", align="left")
PushButton(top_box, text="to the left", align="left")
Text(app, text="everything you own", align="top")
left_box = Box(app, align="left")
left_box.border = T... | lawsie/guizero | examples/layout_beyonce.py | Python | bsd-3-clause | 382 |
#!/usr/bin/env python2
""" This is the main module, used to launch the persistency engine """
#from persio import iohandler
import persui.persinterface as ui
def main():
""" Launches the user interface, and keeps it on."""
interface = ui.Persinterface()
while True:
interface.run()
if __name__ == ... | jepio/pers_engine | persengine.py | Python | gpl-2.0 | 733 |
from fabric.state import output
from .development import *
#
# Fabric configuration
#
output['debug'] = False # see full command list
def help():
''' Fabfile documentation '''
local('python -c "import fabfile; help(fabfile)"')
| lem-usp/site-bio208 | fabfile/__init__.py | Python | mit | 241 |
"""Test the TcEx DataStore Module."""
# standard library
import json
import uuid
from typing import TYPE_CHECKING
# third-party
import pytest
if TYPE_CHECKING:
# first-party
from tcex import TcEx
class MockPost:
"""Mock tcex session.get() method."""
def __init__(self, data, ok=True):
"""Ini... | ThreatConnect-Inc/tcex | tests/api/tc/v2/datastore/test_datastore.py | Python | apache-2.0 | 9,799 |
from datetime import datetime, timedelta
from collections import namedtuple
import re
import sys
import time
from bs4 import BeautifulSoup
from tinydb import TinyDB, Query
import dateutil
import requests
# CONFIGURABLE THINGS
# Local equivalents of "minutes" and "hours"
TIMEDELTA_HOURS = ('godz', 'hour')
TIMEDELTA_M... | modrzew/gumtree-scraper | scrap.py | Python | mit | 4,891 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-09-08 18:05
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('guidedmodules', '0027_modulesource_to_appsource'),
]
... | GovReady/govready-q | guidedmodules/migrations/0028_auto_20170908_1805.py | Python | gpl-3.0 | 1,353 |
# -*- coding: utf-8 -*-
"""
Fullfill optin requests by users for marketing materials
"""
from __future__ import unicode_literals
import logging
import time
from django.conf import settings
from django.core.management.base import BaseCommand
from ...api import MarketoApi
from ...models import Info
log = logging.getL... | Stanford-Online/edx-platform | openedx/stanford/djangoapps/auth_lagunita/management/commands/opt_in_to_marketing.py | Python | agpl-3.0 | 4,573 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields, api
class QcInspectio... | InakiZabala/odoomrp-wip | quality_control_mrp/models/qc_inspection.py | Python | agpl-3.0 | 962 |
#!/usr/bin/python
import sys
import fnmatch
import os
import shutil
import argparse
from argparse import RawTextHelpFormatter
import time
import math
import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
import pylab as pl
from matplotlib.ticker import MultipleLocator, FormatStrFo... | ederc/LA-BENCHER | scripts/bench.py | Python | gpl-3.0 | 25,047 |
xc = 0.5
yc = 0.5
radius = 0.4
angle1 = 45.0 * (M_PI/180.0) #/* angles are specified */
angle2 = 180.0 * (M_PI/180.0) #/* in radians */
snippet_normalize (cr, width, height)
cr.arc_negative (xc, yc, radius, angle1, angle2)
cr.stroke ()
#/* draw helping lines */
cr.set_source_rgba (1,0.2,0.2,0.6)
cr.arc ... | PoornimaNayak/autotest-client-tests | linux-tools/pycairo/tests/cairo_snippets/snippets/arc_negative.py | Python | gpl-2.0 | 531 |
# -*- coding: utf-8 -*-
#
# django-gcm documentation build configuration file, created by
# sphinx-quickstart on Wed May 22 08:26:11 2013.
#
# 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.
#
# ... | johnofkorea/django-gcm | docs/conf.py | Python | bsd-2-clause | 7,953 |
import webbrowser
webbrowser.open("http://xkcd.com/353/")
| prefrontalvortex/bci_erp | python/test_fire.py | Python | mit | 59 |
import subprocess
import time
import pytest
@pytest.fixture(scope="session", autouse=True)
def docker_compose(request):
""" Run docker-compose """
print("building docker images and starting containers")
buildbase = subprocess.Popen(['docker', 'build', '-t',
'simcity-webse... | NLeSC/sim-city-webservice | integration_tests/conftest.py | Python | apache-2.0 | 1,206 |
#!/usr/bin/python
import sys
aglobal9 = 9
def celsius_to_farenheit(celsius):
atuple = "a", "b", "c"
alist = [1, 2, 3]
aset = {1, 2, 3}
adict = { 1 : "a", 2 : "b", 3 : "c" }
nine = aglobal9
five = 5
thirty_two = 32
i = 1
return str((nine * celsius) / five + thirty_two)
def main()... | amitkr/systemtap | testsuite/systemtap.apps/celsius.py | Python | gpl-2.0 | 606 |
#!/usr/bin/python
#
# Copyright (c) SAS Institute 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... | sassoftware/catalog-service | catalogService_test/cloudstest.py | Python | apache-2.0 | 1,905 |
import hashlib
import itertools
def hash_str(some_str):
return hashlib.md5(bytes(some_str, 'utf-8')).hexdigest()[:16]
previous_hashes = set()
def check_hash(hash_key, hash_val):
if hash_val in previous_hashes:
print("Fatal: Duplicate hash values detected: %s for key %s" % (hash_val, hash_key))
exit(-1)
previo... | wrocket/Tulip-Chess | utils/generate_hashes.py | Python | mit | 2,721 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_slices_operations.py | Python | mit | 21,900 |
import numpy as np
import uncertainties.unumpy as unp
from uncertainties.unumpy import (nominal_values as noms, std_devs as stds)
import matplotlib.pyplot as plt
import matplotlib as mpl
from scipy.optimize import curve_fit
plt.rcParams['figure.figsize'] = (12, 8)
plt.rcParams['font.size'] = 13
plt.rcParams['lines.line... | pascalgutjahr/Praktikum-1 | Schwingung/phaselog.py | Python | mit | 888 |
#coding=utf-8
class PostsModel:
@staticmethod
def get_by_pid(datum, pid):
return datum.single('select * from posts where post_id = ?', (pid, ))
| finron/luokr.com | www.luokr.com/app/model/posts.py | Python | bsd-3-clause | 161 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
Commands for:
- building and publishing virtual environments
- sync'ing application code
- managing (e.g. start, stop, etc.) the api service
- managing (e.g. start, stop, etc.) the workers
on hosts.
Here's an example of updati... | balanced-ops/bfab | bfab/__init__.py | Python | bsd-3-clause | 16,264 |
#!/usr/bin/python
#
# Copyright (C) Citrix Systems 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; version 2.1 only.
#
# This program is distributed in the hope that it will be use... | xapi-project/sm | drivers/lvmanager.py | Python | lgpl-2.1 | 5,632 |
import os
from django.conf import global_settings
from django.contrib.auth import authenticate
from django.db.models import Q
from django.template import context
from django.test import TestCase
from django.test.utils import override_settings
class AuthContextProcessorTests(TestCase):
"""
Tests for the ``dja... | weidongxu84/info-gatherer | django/contrib/auth/tests/context_processors.py | Python | mit | 4,165 |
# View more python learning tutorial on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
"""
Please note, this code is only for python 3+. If you are using python 2+, please modify the code acco... | MediffRobotics/DeepRobotics | DeepLearnMaterials/tutorials/tensorflowTUT/tf14_tensorboard/for_you_to_practice.py | Python | gpl-3.0 | 1,615 |
import unittest
from webob.etag import ETagMatcher
class etag_propertyTests(unittest.TestCase):
def _getTargetClass(self):
from webob.etag import etag_property
return etag_property
def _makeOne(self, *args, **kw):
return self._getTargetClass()(*args, **kw)
def _makeDummyRequest(se... | overtherain/scriptfile | software/googleAppEngine/lib/webob_1_1_1/tests/test_etag.py | Python | mit | 13,612 |
import urllib, urllib2, sys, httplib
url = "/DaaS-0.1"
HOST_IP="128.130.172.216"
input_description="""Expected command line arguments: KeyspaceName TableName PrimaryKeyCondition
Example: TestKeyspace TestTable "key IN (9640,4830)"
TestKeyspace TestTable key = 9640 \n
Condition specified on primar... | tuwiendsg/DaaSM2M | Components/DaaSWebClient/examples/pythonClients/deleteRow.py | Python | apache-2.0 | 1,761 |
from Timeline.Server.Constants import TIMELINE_LOGGER, LOGIN_SERVER, WORLD_SERVER
from Timeline import Username, Password, Inventory
from Timeline.Utils.Events import Event, PacketEventHandler, GeneralEvent
from Timeline.Utils.Crumbs.Items import Pin, Award
from Timeline.Database.DB import Penguin
from twisted.i... | Times-0/Timeline | Timeline/Handlers/Mail.py | Python | gpl-3.0 | 2,802 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 University of Dundee & Open Microscopy Environment.
# All Rights Reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
"""
FOR TRAINING PURPOSES ONLY!
"""
from omero.gateway import BlitzGateway
from Connect_To_OME... | hflynn/openmicroscopy | examples/Training/python/Raw_Data_Access.py | Python | gpl-2.0 | 2,828 |
# Copyright 2017 Battelle Energy Alliance, 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 t... | idaholab/raven | scripts/conversionScripts/toCrossValidation.py | Python | apache-2.0 | 4,535 |
import unittest
from . import JunitXml, TestCase
class TestJunitXml(unittest.TestCase):
""" tests for the JunitXml class """
def test_basic_usage(self):
""" test the basic usage of the JunitXml class """
test_cases = []
for i in range(0, 5):
type_c = ""
if i %... | dbaxa/python-junit-xml-output | junit_xml_output/test.py | Python | mit | 714 |
#!/usr/bin/env python3
"""
day24.py
copyright 2017 noticemesen.py
gitlab: gitlab.com/noticemesenpy
github: github.com/noticemesenpy
********************************************************************************
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Gene... | noticemesenpy/advent_of_code | day24/day24.py | Python | gpl-3.0 | 1,006 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.