code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
import sys
from PyFBA import lp, log_and_message
def reaction_bounds(reactions, reactions_with_upsr, media, lower=-1000.0, mid=0.0, upper=1000.0, verbose=False):
"""
Set the bounds for each reaction. We set the reactions to run between
either lower/mid, mid/upper, or lower/upper depending on whether the
... | linsalrob/PyFBA | PyFBA/fba/bounds.py | Python | mit | 4,803 |
from .create2 import *
from .factory import *
__all__ = ["FactoryCreate", "FactorySimulation"]
| USC-ACTLab/pyCreate2 | pyCreate2/__init__.py | Python | mit | 96 |
# -*- coding: utf-8 -*-
"""This file should be used to run the flask app with something like Gunicorn.
For example: gunicorn -b 0.0.0.0:8000 ocspdash.web.wsgi:app
This file should NOT be imported anywhere, though, since it would instantiate the app.
"""
from ocspdash.web import create_application
app = create_appl... | scolby33/OCSPdash | src/ocspdash/web/wsgi.py | Python | mit | 330 |
"""
batch.py
Batch simulation for M1 model using NetPyNE
"""
from netpyne.batch import Batch
import numpy as np
def runBatch(b, label, setup='mpi_bulletin'):
b.batchLabel = label
b.saveFolder = 'data/'+b.batchLabel
b.method = 'grid'
if setup == 'mpi_bulletin':
b.runCfg = {'type': 'mpi_bulle... | Neurosim-lab/netpyne | examples/batchCellMapping/batch.py | Python | mit | 1,998 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Company',
fields=[
('id', models.AutoField(verb... | guoqiao/django-nzpower | nzpower/migrations/0001_initial.py | Python | mit | 981 |
from diary import DiaryDB, Event
import unittest
import sqlite3
import os.path
class TestDiaryDB(unittest.TestCase):
TEMP_DB_PATH = os.path.join(os.path.dirname(__file__),
'testing_dir', 'temp.db')
SIMPLE_EVENT = Event("INFO", "LEVEL")
def setUp(self):
self.logdb ... | GreenVars/diary | tests/logdb_test.py | Python | mit | 2,455 |
import os
import textwrap
import glob
from os.path import join, curdir, pardir
import pytest
from pip.utils import appdirs, rmtree
from tests.lib import (pyversion, pyversion_tuple,
_create_test_package, _create_svn_repo, path_to_url)
from tests.lib.local_repos import local_checkout
from test... | habnabit/pip | tests/functional/test_install.py | Python | mit | 25,668 |
from .ppo import PPOAgent
| qsheeeeen/Self-Driving-Car | rl_toolbox/agent/__init__.py | Python | mit | 26 |
#!/usr/bin/env python3
import click
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import rc
import numpy as np
import pandas as pd
prop1range = [0.0, 1.0] # VF
prop2range = [0.0, 800.0] # ML
num_ch4_a3 = 2.69015E-05 # from methane-comparison.xlsx
fsl = fs = 8
rc('font',**{'family':'sans-serif','... | WilmerLab/HTSOHM-dev | analysis/figure_ml_vs_vf.py | Python | mit | 2,118 |
from drf_yasg import openapi
organization_params_in_header = openapi.Parameter(
"org", openapi.IN_HEADER, required=True, type=openapi.TYPE_INTEGER
)
organization_params = [
organization_params_in_header,
]
opportunity_list_get_params = [
organization_params_in_header,
openapi.Parameter("name", openap... | MicroPyramid/Django-CRM | opportunity/swagger_params.py | Python | mit | 2,381 |
"""
WSGI config for Pjs project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS... | MSzalowski/Pjs2 | Pjs/Pjs/wsgi.py | Python | mit | 384 |
from datetime import datetime
class PanoplyException(Exception):
def __init__(self, args=None, retryable=True):
super(PanoplyException, self).__init__(args)
self.retryable = retryable
class IncorrectParamError(Exception):
def __init__(self, msg: str = "Incorrect input parametr"):
sup... | panoplyio/panoply-python-sdk | panoply/errors/exceptions.py | Python | mit | 1,017 |
import numpy
import os
import sys
# This script depends on a SJSON parsing package:
# https://pypi.python.org/pypi/SJSON/1.1.0
# https://shelter13.net/projects/SJSON/
# https://bitbucket.org/Anteru/sjson/src
import sjson
if __name__ == "__main__":
if sys.version_info < (3, 4):
print('Python 3.4 or higher needed to... | nfrechette/acl | tools/graph_generation/gen_bit_rate_stats.py | Python | mit | 2,309 |
"""
GpuCorrMM-based convolutional layers
"""
import theano
from .. import init
from .. import nonlinearities
from .base import Layer
from .conv import conv_output_length
from theano.sandbox.cuda.basic_ops import gpu_contiguous
from theano.sandbox.cuda.blas import GpuCorrMM
__all__ = [
"MMLayer",
"Conv2DM... | takacsg84/Lasagne | lasagne/layers/corrmm.py | Python | mit | 4,504 |
"""
handlers for transactional messaging service
"""
import json
# tornado imports
from tornado.queues import Queue
from tornado import websocket, gen, web
#local imports
from settings import DEBUG
#===============================================================================
# WEBSOCKETS SERVER
#================... | pythonpopayan/bermoto | backend/handlers/transactional_messaging.py | Python | mit | 3,778 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# TWX documentation build configuration file, created by
# sphinx-quickstart on Sat Jun 27 15:07:02 2015.
#
# 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
# autoge... | datamachine/twx | docs/conf.py | Python | mit | 10,106 |
# encoding=utf-8
from courtesy import courtesy_reply
from log_decorator import error_logging
@error_logging('na')
def response(com, answer, **kwargs):
return courtesy_reply(('na',), **kwargs)
| tztztztztz/robot | response/no_answer.py | Python | mit | 198 |
import pytest
import re
import capybara
from capybara.exceptions import ElementNotFound
class TestAssertAllOfSelectors:
@pytest.fixture(autouse=True)
def setup_session(self, session):
session.visit("/with_html")
def test_does_not_raise_if_the_given_selectors_are_on_the_page(self, session):
... | elliterate/capybara.py | capybara/tests/session/test_assert_all_of_selectors.py | Python | mit | 4,160 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding unique constraint on 'Category', fields ['name']
db.create_unique(u'website_category', ['name'])
... | LucasMagnum/pyexplain | pyexplain/website/migrations/0003_auto__add_unique_category_name.py | Python | mit | 1,760 |
import glob
import os
import numpy as np
def load_emebeddings(folder):
files = [filename for filename in glob.iglob(folder + '**', recursive=True) if not os.path.isdir(filename)]
w2v = {}
for file in files:
with open(file, "r", encoding='utf8') as lines:
for line in lines:
... | swagner-de/irws_homeworks | word_embeddings/embedding.py | Python | mit | 1,203 |
# -*- coding: utf-8 -*-
import urllib2
from lxml import etree
class Scraper(object):
# subclass must override this property
url = None
def scrape(self):
stream = self.get_stream()
doc = self.get_document(stream)
return self.do_scrape(doc)
def get_document(self, stream):
... | csakatoku/uamobile | uamobile/scrapers/base.py | Python | mit | 543 |
#!/usr/bin/env python
# coding: UTF-8
# The MIT License
#
# Copyright (c) 2011 Keita Kita
#
# 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 limitatio... | mikanbako/Work-Recorder | src/main/aggregate_work_time.py | Python | mit | 4,369 |
from .analyzer import Pep8Analyzer
from .issues_data import issues_data
analyzers = {
'pep8' :
{
'title' : 'Pep-8',
'class' : Pep8Analyzer,
'language' : 'python',
'issues_data' : issues_data,
},
}
| quantifiedcode/checkmate | checkmate/contrib/plugins/python/pep8/setup.py | Python | mit | 266 |
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
with open('readme.rst') as reader:
long_description = reader.read()
setup(name='theape',
long_description=long_description... | rsnakamura/theape | setup.py | Python | mit | 1,343 |
import pygame
from ui.utils.interpolator import Interpolator
class LcarsWidget(pygame.sprite.DirtySprite):
"""Base class for all widgets"""
def __init__(self, color, pos, size, handler=None):
pygame.sprite.DirtySprite.__init__(self)
if self.image == None:
self.image = pygame.Surfac... | tobykurien/rpi_lcars | app/ui/widgets/sprite.py | Python | mit | 3,393 |
a = (1, 2)
b = (1, 3, 5, 7, 8, 11)
print a[0]
#b[3] = 3 # error!
x1 = a[0]
y1 = a[1]
x1, y1 = a
b1, b2, b3, b4, b5, b6 = b
print b4
#b1, b2 = b # error!
a = 1, 2, 3
print a
def f():
return 1, 3
a = f()
x, y = f()
x = f()[0]
| amiraliakbari/sharif-mabani-python | by-session/ta-921/j8/tuple1.py | Python | mit | 263 |
__author__ = 'Varun Nayyar'
from Utils.MFCCArrayGen import emotions, speakers, getCorpus
from MCMC import MCMCRun
from emailAlerter import alertMe
def main2(numRuns = 100000, numMixtures = 8, speakerIndex = 6):
import time
for emotion in emotions:
start = time.ctime()
Xpoints = getCor... | nayyarv/MonteGMM | Inference/BayesInference.py | Python | mit | 844 |
#!/usr/bin/env python
import sys
import os.path
import datetime
import subprocess
import time
"""
Run snapstream reader script for several files and out a table of match counts.
Example:
$ python run_on_dates.py eg01china.c 2014-01-01 2014-07-01
"""
def validate(date_string):
try:
datetime.datetime.strpti... | ppham27/snapstream-reader | legacy/run_on_dates.py | Python | mit | 1,762 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-25 16:19
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... | Crimson-Star-Software/data-combine | datacombine/datacombine/migrations/0001_initial.py | Python | mit | 7,003 |
#
# Copyright (c) 2015 Red Hat
# Licensed under The MIT License (MIT)
# http://opensource.org/licenses/MIT
#
from django.conf import settings
from django.forms import SelectMultiple
import django_filters
from pdc.apps.common.filters import MultiValueFilter, NullableCharFilter
from . import models
class RPMFilter(dj... | maxamillion/product-definition-center | pdc/apps/package/filters.py | Python | mit | 4,125 |
# vim: set et sw=4 sts=4 fileencoding=utf-8:
#
# Copyright (c) 2013-2017 Dave Jones <dave@waveform.org.uk>
# Copyright (c) 2013 Mime Consulting Ltd. <info@mimeconsulting.co.uk>
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated docum... | waveform80/lars | tests/test_dns.py | Python | mit | 2,559 |
#! python3
'''
mcbd.py - Saves and loads pieces of text from/to the clipboard to/from a
shelf type file.
Usage: python3 mcbd.py save <keyword> - saves clipboard for keyword.
python3 mcbd.py <keyword> - loads to clipboard for keyword.
python3 mcbd.py list - loads all keywords to clipboard.
... | apaksoy/automatetheboringstuff | practice projects/chap 08/multiclipboard with deletion chap 8/mcbd.py | Python | mit | 2,608 |
# 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 ... | sharadagarwal/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_retry.py | Python | mit | 13,601 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# tritonschedule documentation build configuration file, created by
# sphinx-quickstart on Wed Jun 22 11:40:06 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in th... | brianhang/tritonscheduler | docs/conf.py | Python | mit | 11,786 |
from django.conf.urls import url
from .views import ObservationListView, AddObservationView, UploadObservationsView
app_name = "observations"
urlpatterns = [
url(r"^$", ObservationListView.as_view(), name="observation_list"),
url(
r"^(?P<observer_id>\d+)/$",
ObservationListView.as_view(),
... | zsiciarz/variablestars.net | observations/urls.py | Python | mit | 661 |
import numpy as np
from numpy.testing import assert_array_equal
from nose.tools import (assert_equal, assert_raises, raises, assert_true,
assert_false)
try:
from nose.tools import assert_is
except ImportError:
from landlab.testing.tools import assert_is
from landlab import RasterModel... | decvalts/landlab | landlab/grid/tests/test_raster_grid/test_faces.py | Python | mit | 1,453 |
resultado = 0
contador = 0
numero = int(input('Digite um numero: '))
while resultado < numero:
resultado = (contador -2) * (contador -1) * contador
if resultado == numero:
print('O numero %d e triangular. %d x %d x %d = %d' % (numero, (contador -2), (contador - 1), contador, numero))
... | kidchenko/playground | python-para-zumbis/Lista 3/Desafios/exercicio1.py | Python | mit | 398 |
<<<<<<< HEAD
<<<<<<< HEAD
"""Configuration file parser.
A configuration file consists of sections, lead by a "[section]" header,
and followed by "name: value" entries, with continuations and such in
the style of RFC 822.
Intrinsic defaults can be specified by passing them into the
ConfigParser constructor as a dictio... | ArcherSys/ArcherSys | Lib/configparser.py | Python | mit | 148,451 |
from typing import Dict, List
from service.ws_re.register._base import Register
from service.ws_re.register.author import Author
from service.ws_re.register.authors import Authors
from service.ws_re.register.lemma import Lemma
from service.ws_re.register.register_types.volume import VolumeRegister
class PublicDomain... | the-it/WS_THEbotIT | service/ws_re/register/register_types/public_domain.py | Python | mit | 3,225 |
#!/usr/bin/python2.7
from setuptools import setup, find_packages
setup(
name='bftest_cli',
version='0.1a',
description='A wrapper to manage docker instances',
url='https://github.com/wnormandin/bftest_cli',
author='wnormandin',
author_email='bill@pokeybill.us',
license='MIT',
classifie... | wnormandin/bftest_cli | setup.py | Python | mit | 762 |
from stt_watson.SttWatsonAbstractListener import SttWatsonAbstractListener
class SttWatsonLogListener(SttWatsonAbstractListener):
def __init__(self):
pass
def listenHypothesis(self, hypothesis):
print "Hypothesis: {0}".format(hypothesis)
def listenPayload(self, payload):
print(u"... | HomeHabbit/stt-watson | stt_watson/SttWatsonLogListener.py | Python | mit | 490 |
from __future__ import annotations
from ..typecheck import *
from ..import ui
from ..import dap
from . import css
from .breakpoints_panel import BreakpointsPanel
from .input_list_view import InputListView
if TYPE_CHECKING:
from ..debugger import Debugger
class DebuggerPanel(ui.div):
on_settings: Callable[[], ... | dmilith/SublimeText3-dmilith | Packages/Debugger/modules/views/debugger_panel.py | Python | mit | 3,906 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Acrisel LTD
# Copyright (C) 2008- Acrisel (acrisel.com) . All Rights Reserved
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public... | Acrisel/acris | acris/acris_example/resource_pool_callback.py | Python | mit | 2,420 |
from kaleidoscope.globals import SecType
class OrderLeg(object):
def __init__(self, quantity, contract):
"""
This class is an abstraction of an order leg of an option strategy. It holds the information
for a single order leg as part of an entire option strategy.
"""
self.q... | michaelchu/kaleidoscope | kaleidoscope/options/order_leg.py | Python | mit | 884 |
import pytest
from apispec import yaml_utils
def test_load_yaml_from_docstring():
def f():
"""
Foo
bar
baz quux
---
herp: 1
derp: 2
"""
result = yaml_utils.load_yaml_from_docstring(f.__doc__)
assert result == {"herp": 1, "derp": 2}
... | marshmallow-code/apispec | tests/test_yaml_utils.py | Python | mit | 908 |
import unittest
import os
os.environ['MIAMI_ENV'] = 'test'
import simplejson as json
from miami.models import Team, User, Task
class ModelsTest(unittest.TestCase):
def test_team_toJSON(self):
team = Team('Log')
team.id = 1
self.assertEquals({'id':1, 'name': 'Log', 'color': '2a33d8'}, team... | archiechen/miami | tests/models_tests.py | Python | mit | 1,133 |
"""
Global Settings
"""
settings = {}
# try:
# conf = __import__("django.conf")
# settings = conf.conf.settings
# except ImportError:
# settings = {}
# Broker - amqp,
BROKER_URL = getattr(settings, "BROKER_URL", "amqp://guest@127.0.0.1//")
# file storage path (default: memory), e.g. /tmp/tracker.db
CE... | ikeikeikeike/celery-tracker | tracker/configs/celeryconfig.py | Python | mit | 1,416 |
my_file = open("/tmp/my_file", "w")
my_file.write("Test string")
my_file.close()
my_file = open("/tmp/my_file", "r")
content = my_file.read()
my_file.close()
if (content == "Test string"):
print("OK")
else:
print("KO")
| Nakrez/RePy | tests/parser/good/file.py | Python | mit | 229 |
"""Second module, imported as inspect_recursive.a, with no contents"""
import inspect_recursive.first as a
import sys
if sys.version_info >= (3, 7):
# For some reason 3.6 says second doesn't exist yet. I get that, it's a
# cyclic reference, but that works in 3.7.
import inspect_recursive.second as b
fro... | mosra/m.css | documentation/test_python/inspect_recursive/inspect_recursive/second.py | Python | mit | 358 |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE.txt in the project root for
# license information.
# -------------------------------------------------------------------------
from azure.... | Azure/azure-sdk-for-python | sdk/core/azure-core/tests/async_tests/test_rest_stream_responses_async.py | Python | mit | 9,371 |
#!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the KombatKoin-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
from datetime import date
bitcoinDir = "./";
... | kombatcoin/KBK1 | share/qt/clean_mac_info_plist.py | Python | mit | 901 |
# -*- coding: utf-8 -*-
import logging
import os
from django.conf import settings
from django.core.management import BaseCommand
from django.apps import apps
from django.core.management import CommandError
from django.template.defaultfilters import slugify
from django.template.loader import get_template
from django.db... | allcaps/django-scaffold | scaffold/management/commands/build.py | Python | mit | 8,615 |
import urllib.request
import pickle
import sys
import ast
try:
import variables as v
except:
class var():
def __init__(self):
self.screen = None
v = var()
import pygame as py
class textLabel(py.sprite.Sprite):
def __init__(self, text, pos, colour, font, size, variable ... | lightopa/Aiopa-Battles | updater.py | Python | mit | 9,215 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Presidentielcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util impor... | presidentielcoin/presidentielcoin | qa/rpc-tests/bipdersig-p2p.py | Python | mit | 6,875 |
from yapsy.IPlugin import IPlugin
from manager.message import Message
import protocol.control as control
import schedule
class Time(IPlugin, Message):
def __init__(self):
IPlugin.__init__(self)
Message.__init__(self)
self.text = control.SPEED_1 + '\x0B9 \x0B8' + control.NEW_LINE + contro... | ctmyers/sign | plugins/time/time.py | Python | mit | 380 |
from django import forms
from django.db import models
class Births(models.Model):
year = models.IntegerField("Year")
county = models.CharField("County",max_length=20)
mothersAge = models.IntegerField("Mother's Age")
mothersEdu = models.CharField("Mother's Education",max_length=50)
source = models.U... | DalenWBrauner/FloridaDataOverlay | Website/Florida_Data_Overlay/Overlay/models.py | Python | mit | 1,899 |
# Various utilies for dealing with Neutron and the renaming from Quantum.
from subprocess import check_output
from charmhelpers.core.hookenv import (
config,
log,
ERROR,
)
from charmhelpers.contrib.openstack.utils import os_release
def headers_package():
"""Ensures correct linux-headers for running... | jiasir/openstack-trove | lib/charmhelpers/contrib/openstack/neutron.py | Python | mit | 7,812 |
# Copyright (c) 2008 Joost Cassee
# Licensed under the terms of the MIT License (see LICENSE.txt)
"""
This TinyMCE widget was copied and extended from this code by John D'Agostino:
http://code.djangoproject.com/wiki/CustomWidgetsTinyMCE
"""
from django import forms
from django.conf import settings
from django.contrib... | RaD/django-tinymce | tinymce/widgets.py | Python | mit | 4,724 |
from canvas_sdk import client, utils
def make_account_admin(request_ctx, account_id, user_id, role=None, role_id=None, send_confirmation=None, **request_kwargs):
"""
Flag an existing user as an admin within the account.
:param request_ctx: The request context
:type request_ctx: :class:RequestC... | penzance/canvas_python_sdk | canvas_sdk/methods/admins.py | Python | mit | 3,874 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import setuptools
from setuptools.command.develop import develop
from setuptools.command.install import install
class DevelopScript(develop):
def run(self):
develop.run(self)
ntlk_install_packages()
class InstallScript(install):
def run(self):
... | mircealungu/Zeeguu-Core | setup.py | Python | mit | 923 |
import os, sys; sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
import pytest
from lasio import read
test_dir = os.path.dirname(__file__)
egfn = lambda fn: os.path.join(os.path.dirname(__file__), "examples", fn)
def test_open_url():
l = read("https://raw.githubusercontent.com/kinverarity1/"
... | Kramer477/lasio | tests/test_open_file.py | Python | mit | 2,943 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('taskmanager', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Proj... | memnonila/taskbuster | taskbuster/apps/taskmanager/migrations/0002_auto_20150708_1158.py | Python | mit | 1,290 |
###################################
## SPADE formant analysis script ##
###################################
## Processes and extracts 'static' (single point) formant values, along with linguistic
## and acoustic information from corpora collected as part of the SPeech Across Dialects
## of English (SPADE) project.
##... | MontrealCorpusTools/SPADE | formant.py | Python | mit | 4,664 |
from .base import ItemCollector
class BaseProbabilityCollector(ItemCollector):
# result_dependencies = (*CountCollector, *FrequencyCollector)
def __init__(self, previous_collector_set):
super().__init__(previous_collector_set)
self.__cached_result = None
def get_result(self, collector_set):
if self.__c... | davidfoerster/schema-matching | src/schema_matching/collector/probability.py | Python | mit | 748 |
import RPi.GPIO as GPIO
import time
led = 11
GPIO.setmode(GPIO.BOARD)
GPIO.setup(led,GPIO.OUT)
#for x in range(0,100):
GPIO.output(led,True)
time.sleep(0.5)
GPIO.output(led,False)
time.sleep(0.5)
GPIO.output(led,True)
time.sleep(0.5)
GPIO.output(led,False)
time.sleep(0.5)
GPIO.output(led,True)
time.sleep(0.2)
GPIO.o... | OuHangKresnik/Ninja | raspberry/ledplay/ledstart.py | Python | mit | 612 |
import os
from HTMLParser import HTMLParser
from ConfigParser import NoOptionError
import nltk
from sentence import Sentence
from resources import Resources
from wordnet_cache import WordnetCache as Wordnet
class ReadAndEnrich(object):
def __init__(self, conf):
self.conf = conf
self.enricher = E... | juditacs/semeval | semeval/read_and_enrich.py | Python | mit | 5,919 |
#! /usr/bin/env python
"""
couchbasekit.fields
~~~~~~~~~~~~~~~~~~~
:website: http://github.com/kirpit/couchbasekit
:copyright: Copyright 2013, Roy Enjoy <kirpit *at* gmail.com>, see AUTHORS.txt.
:license: MIT, see LICENSE.txt for details.
* :class:`couchbasekit.fields.CustomField`
* :class:`couchbasekit.fields.Choice... | kirpit/couchbasekit | couchbasekit/fields.py | Python | mit | 6,692 |
from ..base import HaravanResource
class ShippingLine(HaravanResource):
pass
| Haravan/haravan_python_api | haravan/resources/shipping_line.py | Python | mit | 83 |
from gscripts import qtools
import sys, os
if not os.path.exists("fastqc/"):
os.mkdir("fastqc")
cmds = []
Sub = qtools.Submitter()
for fileName in sys.argv[1:]:
fastqc_command = "fastqc -o fastqc %s" %fileName
cmds.append(fastqc_command)
Sub.job(command_list=cmds, sh_file="runFastqc.sh", job_name=... | YeoLab/gscripts | gscripts/general/submit_fastqc.py | Python | mit | 403 |
# -*- coding: utf-8 -*-
import csv
import os
import gzip
class File:
def read(self, path, **kwargs):
path = os.path.join(kwargs.get('root_path', ''), path)
content_type = kwargs.get('content_type', 'txt')
if content_type == 'txt':
with file(path, 'r') as f:
co... | alibozorgkhan/utils | utils/fileoo.py | Python | mit | 1,696 |
import json
from django.core.serializers.json import DjangoJSONEncoder
from instanotifier.fetcher.rss.fetcher import fetch_rss_feed
def fetch_rss_url(url):
result = fetch_rss_feed(url)
return result
def write_to_file(filename, data):
json_data = json.dumps(data, cls=DjangoJSONEncoder)
with open(fi... | AlexanderKaluzhny/instanotifier | instanotifier/fetcher/rss/utils.py | Python | mit | 635 |
''' Work of Cameron Palk '''
import sys
import pandas as pd
def main( argv ):
try:
csv_filepath = argv[ 0 ]
output_filepath = argv[ 1 ]
except IndexError:
print( "Error, usage: \"python3 coord_bounds.py <CSV> <output_file>\"" )
return
training_data = pd.read_csv( csv_filepath )
training_data[ 'clean_... | CKPalk/SeattleCrime_DM | DataMining/Stats/coord_bounds.py | Python | mit | 801 |
import my_data_file
d = my_data_file.my_data
print "Hello my name is %s and i am %d years of age and my coolnes is %d " % (d [ 'naam' ], d [ 'age' ], d ['coolheid']) | ArtezGDA/text-IO | Martijn/format.py | Python | mit | 170 |
'''
Support for WM_TOUCH messages (Windows platform)
================================================
'''
__all__ = ('WM_MotionEventProvider', 'WM_MotionEvent')
import os
from kivy.input.providers.wm_common import WNDPROC, \
SetWindowLong_WndProc_wrapper, RECT, POINT, WM_TABLET_QUERYSYSTEMGESTURE, \
QUERYSYST... | kivy/kivy | kivy/input/providers/wm_touch.py | Python | mit | 5,945 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from dr import app
if __name__ == '__main__':
app.run()
| goll/flask_app | provisioning/files/wsgi.py | Python | mit | 109 |
def fib_recursive(n):
"""[summary]
Computes the n-th fibonacci number recursive.
Problem: This implementation is very slow.
approximate O(2^n)
Arguments:
n {[int]} -- [description]
Returns:
[int] -- [description]
"""
# precondition
assert n >= 0, 'n must be a p... | amaozhao/algorithms | algorithms/dp/fib.py | Python | mit | 1,513 |
'''
spawn º¯Êý»¹¿ÉÓÃÓÚÔÚºǫ́ÔËÐÐÒ»¸ö³ÌÐò. ÏÂÀýÖÐ ¸ø run º¯ÊýÌí¼ÓÁËÒ»¸ö¿ÉÑ¡µÄ mode ²ÎÊý;
µ±ÉèÖÃΪ os.P_NOWAIT ʱ, Õâ¸ö½Å±¾²»»áµÈ´ý×Ó³ÌÐò½áÊø, ĬÈÏÖµ os.P_WAIT ʱ spawn »áµÈ´ý×Ó½ø³Ì½áÊø.
ÆäËüµÄ±êÖ¾³£Á¿»¹ÓÐ os.P_OVERLAY ,ËüʹµÃ spawn µÄÐÐΪºÍ exec ÀàËÆ, ÒÔ¼° os.P_DETACH , ËüÔÚºǫ́ÔËÐÐ×Ó½ø³Ì, Ó뵱ǰ¿ØÖÆÌ¨ºÍ¼üÅ̽¹µã¸ôÀë.
''... | iamweilee/pylearn | os-spawn-example-2.py | Python | mit | 778 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-10-21 13:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('exdb', '0005_swap_type_subtype'),
]
operations = [
migrations.AddField(
... | mostateresnet/exdbproject | exdb/migrations/0006_experience_temp_subtypes.py | Python | mit | 509 |
# i2c_esp.py Test program for asi2c.py
# Tests Responder on ESP8266
# The MIT License (MIT)
#
# Copyright (c) 2018 Peter Hinch
#
# 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 restr... | peterhinch/micropython-async | v2/i2c/i2c_esp.py | Python | mit | 2,245 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-12 14:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('type_page', '0004_auto_20170711_1241'),
]
operations = [
migrations.AddFiel... | dumel93/project- | type_page/migrations/0005_footballtype_comments.py | Python | mit | 471 |
'''
Created on May 20, 2012
@author: Jason Huang
'''
#Given an array of integers A, give an algorithm to find the longest Arithmetic progression in it, i.e find a sequence i1 < i2 < ¡ < ik, such that
#A[i1], A[i2], ¡, A[ik] forms an arithmetic progression, and k is the largest possible.
#The sequence S1, S2... | jastination/software-engineering-excercise-repository | seer_python/dp/MaxArithmeticProgression.py | Python | mit | 440 |
""" Extend suppliers table with new fields (to be initially populated from declaration data)
Revision ID: 940
Revises: 930
Create Date: 2017-08-16 16:39:00.000000
"""
# revision identifiers, used by Alembic.
revision = '940'
down_revision = '930'
from alembic import op
import sqlalchemy as sa
def upgrade():
o... | alphagov/digitalmarketplace-api | migrations/versions/940_more_supplier_details.py | Python | mit | 1,372 |
from chainer.iterators import multiprocess_iterator
from chainer.iterators import serial_iterator
MultiprocessIterator = multiprocess_iterator.MultiprocessIterator
SerialIterator = serial_iterator.SerialIterator
| kikusu/chainer | chainer/iterators/__init__.py | Python | mit | 214 |
#!/usr/local/bin python
# -*- coding: utf-8 -*-
from RPSOM import Model
from RPSOM.transition_graph import output_graph
if __name__=='__main__':
# learning rate alpha setup
alpha_max = [0.1, 0.5, 0.7]
alpha_min = [0.01, 0.1, 0.2]
# neighborhood radius sigma setup
sigma_max = [5, 7, 10]
sigma_min = [1, 2, 3]
ep... | kinect110/RPSOM | src/examples/RPSOM_animal.py | Python | mit | 941 |
# -*- coding:utf-8 -*-
""" Provide log related functions. You need to Initialize the logger and use the logger to make logs.
Example:
>>> logger = Initialize()
Use logger.level(\*msg) to log like:
>>> logger.error("Pickle data writing Failed.")
>>> logger.info("Pickle data of ", foo, " written successfu... | wanghewen/CommonModules | CommonModules/Log.py | Python | mit | 3,611 |
import json
from collections import abc
# item 26: use muptiple inheritance for mixin only
# a mixin that transforms a python object to a dictionary that's ready for seralization
class ToDictMixin(object):
def to_dict(self):
"""Return a dictionary representation of this object"""
return self._traver... | totoro72/pt1 | ep/item_26_multiple_inheritance_for_mixin_only.py | Python | mit | 2,705 |
from __future__ import print_function
from __future__ import absolute_import
import re
from pyingest.config.utils import u2asc
from .default import DefaultParser
from .author_names import AuthorNames
from .entity_convert import EntityConverter
head_dict = {'TITLE:': 'journal', 'NUMBER:': 'volume', 'SUBJECT:': 'title',... | adsabs/adsabs-pyingest | pyingest/parsers/gcncirc.py | Python | mit | 4,888 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from config.template_middleware import TemplateResponse
from gaecookie.decorator import no_csrf
from gaepermission.decorator import login_required
from pytz import common_timezones
import settings
from tekton import router
from tekton.gae.... | erikabarros/naguil | backend/appengine/routes/account.py | Python | mit | 1,088 |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
# 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, or (at your option) any later
# version.
#
# This program is distr... | ccpgames/eve-metrics | web2py/gluon/contrib/pysimplesoap/client.py | Python | mit | 36,225 |
from setuptools import setup, find_packages
setup(name='MODEL1310110042',
version=20140916,
description='MODEL1310110042 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/MODEL1310110042',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/MODEL1310110042 | setup.py | Python | cc0-1.0 | 377 |
#!/usr/bin/python
import json
from pprint import pprint
import re
import urllib
import time
from geopy import geocoders
import Image
import os
# TODO: handle test cases
# testcases:
# hollywood & vine, hollywood and vine
# order of operations: hashtag, img, address, other text.
# hashtag allcaps or lowercase
# upload... | levisimons/CRASHLACMA | CRASHLACMA/twitter_json_parser.py | Python | cc0-1.0 | 2,983 |
# coding=utf-8
from app import mongo_utils
from bson import json_util
from flask import Blueprint, render_template, request, Response,session
import json
import time
from datetime import datetime
from operator import itemgetter
mod_main = Blueprint('main', __name__)
@mod_main.route('/', methods=['GET'])
def index():
... | crtarsorg/glasomer.rs-v2 | app/mod_main/views.py | Python | cc0-1.0 | 17,233 |
print("In Python, what do you call a 'box' used to store data?")
answer = input()
if answer == "variable":
print(" :) ")
else:
print(" :( ")
print("Thank you for playing!")
print('''
Q1 - In Python, what do you call a 'box' used to store data?
a - text
b - variable
c - a shoe box
''')
answer = in... | arve0/example_lessons | src/python/lessons/Quiz/Project Resources/Quiz.py | Python | cc0-1.0 | 553 |
from scapy.all import *
import plotly
from datetime import datetime
import pandas as pd
#Read the packets from file
packets=rdpcap('mypcap.pcap')
#lists to hold packetinfo
pktBytes=[]
pktTimes=[]
#Read each packet and append to the lists
for pkt in packets:
if IP in pkt:
try:
pktBytes.app... | erikjjpost/scripts | PcapTimeline.py | Python | cc0-1.0 | 1,022 |
import zmq
ctx = zmq.Context.instance()
server = ctx.socket(zmq.PUSH)
server.bind('inproc://foo')
clients = [ctx.socket(zmq.PULL) for i in range(10)]
poller = zmq.Poller()
for client in clients:
client.connect('inproc://foo')
poller.register(client, zmq.POLLIN)
for client in clients:
server.send(b'DATA')
... | waveform80/presentations | concurrency/demo3.py | Python | cc0-1.0 | 390 |
#!/usr/bin/env python
"""
NPR 2017-01-22
www.npr.org/2017/01/22/511046359/youve-got-to-comb-together-to-solve-this-one
The numbers 5,000, 8,000, and 9,000 share a property that only five integers altogether have.
Identify the property and the two other integers that have it.
"""
# The property is that they are superv... | boisvert42/npr-puzzle-python | 2017/0122_unusual_numbers.py | Python | cc0-1.0 | 2,574 |
from datetime import datetime
import threading
import time
from collections import deque
import logging
logger = logging.getLogger(__name__)
class MonitorThread(threading.Thread):
"""executes a function f with sleep_time intervals in between
"""
def __init__(self, sleep_time, callback):
threadin... | goncalopp/mexbtcapi | mexbtcapi/util/deprecated/monitor.py | Python | cc0-1.0 | 3,325 |
#! /usr/bin/env python
"""
This script produces quality plots to check that the LFs are fine compared to simumlations.
"""
import sys
import os
from os.path import join
data_dir = os.environ['DATA_DIR']
import glob
from lib_plot import *
#from lineListAir import *
SNlim = 5
# "D:\data\LF-O\LFmodels\data\trends_colo... | JohanComparat/nbody-npt-functions | bin/bin_galform/plotLFs-color-mag-trends.py | Python | cc0-1.0 | 11,045 |
import ast
from python_minifier.rename.binding import NameBinding
from python_minifier.rename.name_generator import name_filter
from python_minifier.rename.util import is_namespace
def all_bindings(node):
"""
All bindings in a module
:param node: The module to get bindings in
:type node: :class:`ast... | listyque/TACTIC-Handler | thlib/side/python_minifier/rename/renamer.py | Python | epl-1.0 | 6,672 |
#VERSION: 2.14
#AUTHORS: Diego de las Heras (diegodelasheras@gmail.com)
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of ... | ppolewicz/qBittorrent | src/searchengine/nova/engines/torrentz.py | Python | gpl-2.0 | 5,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.