code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
import math
from readability.exceptions import ReadabilityException
class Result:
def __init__(self, score, grade_levels, ages):
self.score = score
self.grade_levels = grade_levels
self.ages = ages
def __str__(self):
return "score: {}, grade_levels: {}, ages: {}". \
... | cdimascio/py-readability-metrics | readability/scorers/ari.py | Python | mit | 2,533 |
"""
__graph_MT_pre__PythonRef.py___________________________________________________________
Automatically generated graphical appearance ---> MODIFY DIRECTLY WITH CAUTION
_______________________________________________________________________________
"""
import tkFont
from graphEntity import *
from GraphicalForm ... | levilucio/SyVOLT | UMLRT2Kiltera_MM/graph_MT_pre__PythonRef.py | Python | mit | 2,620 |
"""
TriggersManager manages the instances of all the triggers in Linger
"""
from future.utils import itervalues
from LingerManagers.LingerBaseManager import LingerBaseManager
class TriggersManager(LingerBaseManager):
"""TriggersManager loads possible linger triggers,
and manages instances of them accor... | GreenBlast/Linger | LingerManagers/TriggersManager.py | Python | mit | 2,019 |
import boto
from boto.mturk.connection import MTurkConnection
from boto.mturk.question import ExternalQuestion
from connection import connect
import urllib
import argparse
import ConfigParser
import sys, os
import time
import pandas as pd
parser = argparse.ArgumentParser()
parser.add_argument('answers_file', nargs=1,... | arunchaganty/kbp-online | turkApi/reject_assignments.py | Python | mit | 1,557 |
# -*- coding: utf-8 -*-
import datetime
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
try:
from django.utils import lorem_ipsum
except ImportError:
# Support Django < 1.8
from django.contrib.webdesign import lorem_ipsum
import os
import random
import re... | ramcn/demo3 | venv/lib/python3.4/site-packages/autofixture/generators.py | Python | mit | 21,150 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('shop', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='product',
name='collect_... | andreagrandi/drf3-test | drftest/shop/migrations/0002_auto_20150201_1559.py | Python | mit | 820 |
import math
import davis
import os
os.environ["CUDA_VISIBLE_DEVICES"]="-1"
import davis_tf
from gui import Window
if __name__ == '__main__':
NUM_PARTICLES = 1000
DT = 0.0001
GAMMA = 0.01
A_perPartcile = 4*math.pi / NUM_PARTICLES
cutoff = math.sqrt(A_perPartcile) * 2
#cutoff = 0.1
print... | tscheff/Davis | run_davis_tf.py | Python | mit | 630 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^login/$', views.login, name='login'),
url(r'^home/$', views.home, name='home'),
url(r'^home/y12$',views.y12,name='y12'),
]
| sonali0901/hackathon-studnit | studnit/studnit_app/urls.py | Python | mit | 208 |
from forms.curve import koch
reload( koch )
koch1 = koch.Koch()
koch1.curve()
x = koch1.drawCurve()
koch2 = koch.Koch()
koch2.snowflake()
y = koch2.drawCurve()
print x
print y
# Result: curve1
# Result: curve2
| davidpaulrosser/Forms | test/curve/koch.py | Python | mit | 217 |
from warnings import warn
from django.template import Library
from django.utils.safestring import mark_safe
from .. import utils
register = Library()
_WARNING_MESSAGE = (
'You have specified skip_common_chunks=True but the passed context '
'doesn\'t have a request. django_webpack_loader needs a request objec... | ezhome/django-webpack-loader | webpack_loader/templatetags/webpack_loader.py | Python | mit | 2,048 |
#!/usr/bin/env python
# :) my Led Blink Test
# Analog Sensor Example By NetmaxIOT & Rohitkhosla
# OpenSource MIT licence by Netmax IOT Shield And Rohitkhosla
# :)
import time
from Netmaxiot import *
# Connect the Netmaxiot LED to digital port D4,D5,D6
led0 = 4
led1 = 5
led2 = 6
pinMode(led0,"OUTPUT")
pinMode(led1... | NetmaxIOT/Netmaxiot-Shield | Software/Python/tests/multi_led_blink.py | Python | mit | 950 |
import os
from django.conf import settings
ELASTICSEARCH_URL = settings.ELASTICSEARCH_URL
APACHE_TIKA_URL = settings.APACHE_TIKA_URL
os.environ["TIKA_CLIENT_ONLY"] = "true"
os.environ["TIKA_SERVER_ENDPOINT"] = settings.APACHE_TIKA_URL
| watchdogpolska/feder | feder/es_search/settings.py | Python | mit | 237 |
import numpy as np
import math
import os
from scipy.misc import imread
# In order to import caffe, one may have to add caffe in the PYTHONPATH
import caffe
# If using GPU, set to True
GPU = False
if GPU:
caffe.set_mode_gpu()
caffe.set_device(0)
else:
caffe.set_mode_cpu()
def get_features(net, locs_file):
''... | nealjean/predicting-poverty | scripts/extract_features.py | Python | mit | 5,211 |
from datetime import datetime
from dateutil import tz
import stores
class Data():
def __init__(self, player_id=None):
self.to_zone = tz.gettz('America/New_York')
self.from_zone = tz.gettz('UTC')
self._rawData = self.RawData()
years = self._rawData.get_years()
self._players... | fjacob21/nhlplayoffs | data.py | Python | mit | 10,797 |
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
from cmsplugin_articles import __version__
class Tox(TestCommand):
user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
def initialize_options(self):
TestCommand.initialize_optio... | satyrius/cmsplugin-articles | setup.py | Python | mit | 1,886 |
from sys import argv
import pexpect
children = []
for i in range(3, len(argv)):
children.append(pexpect.spawn('/bin/bash'))
children[len(children) - 1].sendline(argv[i])
print(argv[i])
import time
time.sleep(int(argv[1]))
for child in children:
child.sendcontrol('c')
child.sendline('exit')
... | slremy/testingpubsub | myBallPlate/runCommands.py | Python | mit | 462 |
"""Alpenhorn client interface."""
import datetime
import os
import sys
import click
import peewee as pw
from ch_util import data_index as di
from ch_util import ephemeris
@click.group()
def cli():
"""Client interface for alpenhorn. Use to request transfers, mount drives,
check status etc."""
@cli.command(... | radiocosmology/alpenhorn | alpenhorn/legacy/client.py | Python | mit | 32,643 |
<<<<<<< HEAD
<<<<<<< HEAD
#!/usr/bin/env python3
""" turtle-example-suite:
tdemo_tree.py
Displays a 'breadth-first-tree' - in contrast
to the classical Logo tree drawing programs,
which use a depth-first-algorithm.
Uses:
(1) a tree-generator, where the drawing is
quasi the side-effect, whereas the ... | ArcherSys/ArcherSys | Lib/turtledemo/tree.py | Python | mit | 4,415 |
import time
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from nw_util import *
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__f... | nwjs/nw.js | test/sanity/issue3780-jailed-elements/test.py | Python | mit | 1,155 |
import xml.etree.ElementTree as ET
from office365.runtime.odata.odata_base_reader import ODataBaseReader
from office365.runtime.odata.odata_model import ODataModel
class ODataV4Reader(ODataBaseReader):
"""OData v4 reader"""
_options = None
def __init__(self, options):
self._options = options
... | vgrem/SharePointOnline-REST-Python-Client | office365/runtime/odata/odata_v4_reader.py | Python | mit | 1,323 |
"""Implement Agents and Environments (Chapters 1-2).
The class hierarchies are as follows:
Thing ## A physical object that can exist in an environment
Agent
Wumpus
Dirt
Wall
...
Environment ## An environment holds objects, runs simulations
XYEnvironment
VacuumEnvironment
W... | jo-tez/aima-python | agents.py | Python | mit | 35,990 |
from django.contrib import admin
from polls.models import Poll, Choice
class ChoiceInline(admin.StackedInline):
model = Choice
extra = 3
class PollAdmin(admin.ModelAdmin):
#fields = ['question', 'pub_date']
inlines = [ChoiceInline]
list_display = ('question', 'pub_date')
search_fields = ['question... | zhengwy888/rockproject | sandstone/polls/admin.py | Python | mit | 391 |
import logging
logging.basicConfig(level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(name)s: %(message)s',
datefmt='%Y-%m-%dT%H:%M:%S%z')
def get_logger(name: str) -> logging.Logger:
logger = logging.getLogger(name)
logger.setLevel(logging.INFO)
return lo... | GoC-Spending/fuzzy-tribble | src/tribble/log.py | Python | mit | 325 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test example app."""
import datetime
import os
import signal
import subprocess
im... | tiborsimko/invenio-formatter | tests/test_examples_app.py | Python | mit | 1,342 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-08 19:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('timetracking', '0001_initial'),
]
operations = [
migrations.AlterField(
... | rixx/tempus | tempus/timetracking/migrations/0002_auto_20160108_1916.py | Python | mit | 469 |
from math import sqrt
def distance(a, b):
return sqrt(sum(map(lambda x: (x[1]-x[0])**2, zip(a, b))))
def scaler(old_low, old_high, new_low, new_high):
def func(x):
old_range = old_high - old_low
new_range = new_high - new_low
return (((x - old_low) * new_range) / old_range) + new_low
... | micaiahparker/vote | voters/utils.py | Python | mit | 415 |
"""This pipeline is intended to make the classification of T2W modality
features."""
from __future__ import division
import os
import numpy as np
from imblearn import under_sampling
from imblearn import over_sampling
from sklearn.externals import joblib
from sklearn.preprocessing import label_binarize
from sklearn.e... | I2Cvb/mp-mri-prostate | pipeline/feature-balancing/pipeline_balancing_t2w.py | Python | mit | 5,450 |
import json
import os
import subprocess
import requests
def api_url(path):
host = os.environ['API_HOST']
prefix = 's'
if host == '127.0.0.1':
prefix = ''
host = '127.0.0.1:3000'
return 'http{0}://{1}{2}'.format(prefix, host, path)
def end_all():
url = api_url('/runs/end_all')
... | lukaselmer/hierarchical-paragraph-vectors | code/helpers/api.py | Python | mit | 1,745 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logger = logging.getLogger(__name__)
class Endpoint(object):
def __init__(self, method, raw_path, *args, **kwargs):
self._method = method
self._raw_path = raw_path
@property
def method(self):
return self._method
@... | ryankanno/py-api | py_api/endpoint.py | Python | mit | 815 |
# ALAINA KAFKES IMPLEMENTATION - alainakafkes
## Mergesort implementation in Python
## Runtime: O(n log(n))
## Space: O(n)
## Advantages: guaranteed good complexity (no need to worry about choice of pivot as in quicksort)
## Disadvantages: more temporary data storage needed than quicksort
#def mergesort(arr):
# if... | saru95/DSA | Python/mergesort.py | Python | mit | 1,356 |
import os
from setuptools import setup, find_packages
description = "Multi-Author Blog for Django"
long_description = description
if os.path.exists('README.rst'):
long_description = open('README.rst').read()
setup(
name='django-blog',
version='1.0.1',
packages=find_packages(exclude=["tests"]),
i... | jbergantine/django-blog | setup.py | Python | mit | 1,835 |
#! /usr/bin/env python
#
# Generated by PAGE version 4.2
# In conjunction with Tcl version 8.6
# Jan. 19, 2014 09:47:50 AM
import sys
try:
from Tkinter import *
except ImportError:
from tkinter import *
try:
import ttk
py3 = 0
except ImportError:
import tkinter.ttk as ttk
py3 = 1
import p... | FrauBluher/PMSM | Config Tool/page/examples/rework_progress_bar/progress_bar.py | Python | mit | 2,213 |
# -*- coding: utf-8 -*-
import urllib.parse
import requests_oauthlib as roauth
import pandas as pd
from tradeking import utils
BASE_URL = 'https://api.tradeking.com/v1'
_DATE_KEYS = ('date', 'datetime', 'divexdate', 'divpaydt', 'timestamp',
'pr_date', 'wk52hidate', 'wk52lodate', 'xdate')
_FLOAT_KEYS ... | jkoelker/python-tradeking | tradeking/api.py | Python | mit | 11,467 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-07-10 19:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lots_admin', '0032_applicationstatus_eds_sent'),
]
operations = [
migrations.... | datamade/large-lots | lots_admin/migrations/0033_auto_20170710_1456.py | Python | mit | 584 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
# Meta-info
Author: Nelson Brochado
Created: 09/07/2015
Updated: 07/03/2018
# Description
The time complexity of the fractional knapsack is O(n * log(n)), because of the
call to sort the items by value/weight ratio.
# TODO
- Add complexity analysis.
- Create a ... | nbro/ands | ands/algorithms/greedy/fractional_knapsack.py | Python | mit | 2,887 |
#!/usr/bin/env python
# pseudoreplicator 0.0.1
# Generated by dx-app-wizard.
#
# Basic execution pattern: Your app will run on a single machine from
# beginning to end.
#
# See https://wiki.dnanexus.com/Developer-Portal for documentation and
# tutorials on how to modify this file.
#
# DNAnexus Python Bindings (dxpy) do... | ENCODE-DCC/chip-seq-pipeline | dnanexus/pseudoreplicator/src/pseudoreplicator.py | Python | mit | 3,390 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2017 James Beedy <jamesbeedy@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is... | rene4jazz/visimil | snap/plugins/x-nginx.py | Python | mit | 8,003 |
from __future__ import unicode_literals
try:
from urllib import urlencode
from urlparse import urlparse, parse_qs
except ImportError:
from urllib.parse import urlencode, urlparse, parse_qs
from django.views.generic import ListView
class SortableListView(ListView):
# Defaults, you probably want to sp... | JanMalte/django-sortable-listview | sortable_listview/views.py | Python | mit | 5,863 |
#
# Hello World client in Python
# Connects REQ socket to tcp://localhost:5555
#
import sys
import time
import zmq
context = zmq.Context()
# Socket to talk to server
print "Connecting to hello world server..."
socket = context.socket(zmq.REQ)
socket.connect ("tcp://localhost:5555")
while True:
socket.send(s... | cnu/zeromq-talk | hwclient.py | Python | mit | 466 |
#!/usr/bin/python
import rospy
import roslib
import web
import signal
from os import chdir
from os.path import join
from aaf_control_ui.srv import DemandTask
from aaf_control_ui.srv import DemandTaskResponse
from strands_executive_msgs.srv import CreateTask
from strands_executive_msgs.srv import DemandTask as ExecDe... | strands-project/aaf_deployment | aaf_control_ui/scripts/server.py | Python | mit | 6,395 |
# utf-8
# Python 3.5.1
# Software developed by Oscar Russo
# http://github.com/odrusso/bhs-pe-inventory
# Simple program to store the different database configurations
def db_local_users():
"""Returns the config information for the users table of a local database"""
config = {
"user": "root",
... | odrusso/bhs-pe-inventory | src/db_configs.py | Python | mit | 1,278 |
import datetime
from celery import task
from celery.utils.log import get_task_logger
from django.conf import settings
from django.core.mail import EmailMessage
from django.template.loader import get_template
from register_site.models import EntriesIndex
from scanner_engine.models import WatchersIndex, RedirectionsIndex... | Josowsky/SiteScanner-Backend | scanner_engine/tasks.py | Python | mit | 2,039 |
## Security-Constrained LOPF with SciGRID
#
#This Jupyter Notebook is also available to download at: <https://pypsa.readthedocs.io/en/latest/examples/scigrid-sclopf.ipynb> and can be viewed as an HTML page at: <https://pypsa.readthedocs.io/en/latest/examples/scigrid-sclopf.html>.
#
#In this example, the dispatch of ge... | PyPSA/PyPSA | examples/scigrid-de/scigrid-sclopf.py | Python | mit | 2,182 |
import numpy as np
import matplotlib.pyplot as plt
np.ones((1024,1024))
np.ones((1024,1024))*np.nan
im = np.ones((1024,1024))*np.nan
for i, line in ascfile:
im[i] = np.array(list(line)[:-1]).astype('int')
for line in ascfile:
list(line)
break
ascfile
ascfile.split("\n")
ascfile.split("\n")[:-1]
for i, line... | DrkSephy/NOAA-Projects | ims/files/file.py | Python | mit | 529 |
#!/usr/bin/env python3
#
# Copyright (c) 2017 Weitian LI <liweitianux@live.com>
# MIT license
#
# Weitian LI
# 2017-02-12
"""
Collect YAML manifest files, and convert collected results to CSV
format for later use.
"""
import sys
import argparse
import csv
from _context import acispy
from acispy.manifest import Manif... | liweitianux/chandra-acis-analysis | bin/collect_yaml.py | Python | mit | 2,329 |
# -*- coding: utf-8 -*-
from django import forms
from django.utils.translation import gettext_lazy as _
from .models import TopicNotification
class NotificationForm(forms.ModelForm):
is_active = forms.BooleanField(widget=forms.HiddenInput(), initial=True, required=False)
class Meta:
model = TopicN... | nitely/Spirit | spirit/topic/notification/forms.py | Python | mit | 1,524 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) The James Hutton Institute 2016-2019
# (c) University of Strathclyde 2019-2020
# Author: Leighton Pritchard
#
# Contact:
# leighton.pritchard@strath.ac.uk
#
# Leighton Pritchard,
# Strathclyde Institute for Pharmacy and Biomedical Sciences,
# 161 Cathedral Street,
# G... | widdowquinn/pyani | tests/test_graphics.py | Python | mit | 4,265 |
# author: bukun
#
import os
import sys
pwd = os.getcwd()
fo = open('clean_link.sh', 'w')
for wroot, wdirs, wfiles in os.walk(pwd):
for wfile in wfiles:
test = os.path.join(wroot, wfile)
if os.path.islink(test):
print(test)
fo.write('rm -f %s\n' % test)
for wdir in wdirs... | bukun/bkcase | clean_link.py | Python | mit | 501 |
import pytest
import os
import subprocess
import sys
if '-nogui' not in sys.argv:
sys.argv.append('-nogui')
from .utils import pkg_setup
@pytest.mark.package_data(['examples/NeuroMLImport/', '.'])
class TestPTcell:
def test_init(self, pkg_setup):
import SimpleNet_import
| Neurosim-lab/netpyne | tests/examples/test_NeuroMLImport.py | Python | mit | 290 |
# coding: utf-8
from django.conf import settings
DEFAULT_SETTINGS = {
'upload_to': 'videos', # upload_to parameter for unconverted videos
'convert_to': 'videos/converted', # upload_to parameter for converted videos
'screens_to': 'videos/screens', # upload_to parameter for video screenshots
'num_scr... | randomknowledge/django-webvideo | django_webvideo/settings.py | Python | mit | 5,744 |
# -*- coding: utf-8 -*-
from django.conf import settings
import requests, json, time
session = None
if settings.SIMULTANEOUS_QUERY_THREADS > 1:
try:
from requests_futures.sessions import FuturesSession
from concurrent.futures import ThreadPoolExecutor
session = FuturesSession(executor=Th... | bellisk/opendata-multisearch | ord_hackday/search/query.py | Python | mit | 2,336 |
from race_tracker_api.app import get_app
APP = get_app()
if __name__ == "__main__":
APP.run()
| race-tracker/api | uwsgi.py | Python | mit | 100 |
__all__ = [
'get_builder_name',
'get_builder_image_path',
'get_image_path',
'parse_images_parameter',
# Helper commands.
'chown',
'rsync',
]
import getpass
import grp
import pwd
import foreman
from g1 import scripts
from g1.bases.assertions import ASSERT
from g1.containers import models
... | clchiou/garage | shipyard2/shipyard2/rules/images/utils.py | Python | mit | 1,787 |
# -- coding: utf-8 --
# Copyright 2015 Tim Santor
#
# This file is part of proprietary software and use of this file
# is strictly prohibited without written consent.
#
# @author Tim Santor <tsantor@xstudios.agency>
"""Uploads HTML5 banner ads."""
# -----------------------------------------------------------------... | tsantor/banner-ad-toolkit | adkit/upload_html.py | Python | mit | 4,265 |
########################
# lmfit - C/C++ library for Levenberg-Marquardt least-squares minimization and curve fitting
# http://joachimwuttke.de/lmfit/
########################
# download it
# run ./configure [--prefix=<path/to/install>]
# make [install]
#
# EXAMPLE
# ./configure --prefix=/home/simone/MOOV3D/libs/lmfit... | tuttleofx/sconsProject | autoconf/lmfit.py | Python | mit | 616 |
#!/usr/bin/python
from subprocess import call
#3.9.2015 - Writing a script to process Tracy's experimentally evolved
#Mtb samples.
#There are 6 populations that were evolved, with a total of 18 samples.
samples = [
"ERR003100", "ERR003108", "ERR003112", "ERR003116",
"ERR004900", "ERR004908", "ERR004912", "ER... | tracysmith/RGAPepPipe | pooled/expEvo.py | Python | mit | 4,378 |
#!/usr/bin/env python
from setuptools import setup
setup(name='cabot-alert-sms',
version='0.1',
description='An sms alert plugin for Cabot by Lyncir',
author='Lyncir',
author_email='lyncir@gmail.com',
url='http://cabotapp.com',
packages=[
'cabot_alert_sms'
],
)
| lyncir/cabot-alert-sms | setup.py | Python | mit | 319 |
import numpy as np
from kmapper.cover import Cover
# uniform data:
data = np.arange(0, 1000).reshape((1000, 1))
lens = data
cov = Cover(10, 0.5, verbose=0)
def overlap(c1, c2):
ints = set(c1).intersection(set(c2))
return len(ints) / max(len(c1), len(c2))
# Prefix'ing the data with an ID column
ids = np.arr... | MLWave/kepler-mapper | test/cover_test_script.py | Python | mit | 730 |
# Testing Rester with HttpBin API | chitamoor/Rester | rester/test/testHttpBin/__init__.py | Python | mit | 33 |
#!/usr/bin/env python
import unittest
import mock
class TestImapDuplicateRemover(unittest.TestCase):
@mock.patch("imaplib.IMAP4_SSL")
def test_does_nothing_if_no_mails_in_mailbox(self, imap_4):
import imap_duplicate_remover
imap_duplicate_remover.remove_duplicates()
assert not imap_4.r... | hjameel/imap-duplicate-remover | test_imap_duplicate_remover.py | Python | mit | 393 |
# Copyright 2017 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... | Sorsly/subtle | google-cloud-sdk/lib/surface/sql/databases/patch.py | Python | mit | 4,349 |
#!/usr/bin/env python
# coding: utf-8
__author__ = 'toly'
"""
script for make per-page dictionaries according to user personal list of known words
"""
import re
import os
import sys
import argparse
from string import lower
import nltk
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.stem.snowball import... | toly/easy_english | main.py | Python | mit | 6,995 |
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
import os
this_dir = os.path.dirname(__file__)
readme_filename = os.path.join(this_dir, 'README.md')
requirements_filename = os.path.join(this_dir, 'requirements.txt')
def get_project_path(*args):
return... | xplenty/xplenty.py | setup.py | Python | mit | 1,624 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# duco documentation build configuration file, created by
# sphinx-quickstart on Thu Sep 28 12:14:26 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... | luuloe/python-duco | docs/source/conf.py | Python | mit | 6,554 |
from urllib.request import urlopen, Request
from bs4 import BeautifulSoup
import time
def search():
headers = {}
headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
start = 0
searchword = input('Enter the word(s) to se... | maybejose/GoogleIndexSearch | google_index_search.py | Python | mit | 1,361 |
# here detecting 'n' handling events...
# with keyboard 'n' mouse
import World
def pressed(key):
"""listener 4 keyboard pressing"""
# zoom in
if key.char == 'q':
if World.scale_() - 2 > 0:
World.scale_(-2)
World.draw()
# zoom out
elif key.char == 'e':
World... | efanescent/SapidCircuits | Control.py | Python | mit | 654 |
# coding: utf-8
class AdminTools(object):
""" django-admin-tools """
ADMIN_TOOLS_INDEX_DASHBOARD = '{{ project_name }}.config.dashboard.AdminIndexDashboard'
ADMIN_TOOLS_MENU = '{{ project_name }}.config.dashboard.AdminMenu'
ADMIN_TOOLS_THEMING_CSS = 'css/admin.css'
| futurecolors/tinned-django | tinned_django/project_name/config/apps_config/admintools.py | Python | mit | 284 |
from math import ceil
import argparse
import json
import os
def _get_states(i): # get state from parameter
return 'M{}'.format(i), 'I{}'.format(i), 'D{}'.format(i)
class ProfileHiddenMarkovMoldel:
def __init__(self, inputfile, output):
self.inputfile = inputfile
self.output = output
... | burakkose/profile-hidden-markov-models | src/profileHMM.py | Python | mit | 11,453 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from widgets import DatePickerWidget
FILTER_PREFIX = 'drf__'
class DateRangeExForm(forms.Form):
def __init__(self, request, *args, **kwargs):
field_name = kwargs.pop('field_name')
self.request = request
super(DateRan... | exildev/webpage | exile_ui/forms.py | Python | mit | 1,290 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pollapp.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
#!/usr/bin/env python2.7
from django.core.management import exec... | rajmohanperiyasamy/pollapp | manage.py | Python | mit | 761 |
import os
import sys
import logging
import math
import pandas as pd
import pytz
import bt
import matplotlib.pyplot as plt
from talib import RSI, MA
from stock_data_provider import create_dataframe, filter_dataframe
try:
from . import module_loader
except:
import module_loader
sys.dont_write_bytecode = True... | stonewell/learn-curve | test/test_vipset.py | Python | mit | 3,302 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Triangle Project Code.
# Triangle analyzes the lengths of the sides of a triangle
# (represented by a, b and c) and returns the type of triangle.
#
# It returns:
# 'equilateral' if all sides are equal
# 'isosceles' if exactly 2 sides are equal
# 'scalene' ... | kimegitee/python-koans | python3/koans/triangle.py | Python | mit | 886 |
#! /usr/bin/env python
#
# File Name : generate_grid_mrf_model.py
# Created By : largelymfs
# Creation Date : [2016-01-20 14:42]
# Last Modified : [2016-01-20 14:50]
# Description : the pyscripts to generate mrf grid model
#
def output_2d... | YoungLew/NoiseContrastiveLearning | Grid_MRF/generate_grid_mrf_model.py | Python | mit | 1,188 |
"""
Created on Sat Sep 16 18:32:01 2017
@author: dariocorral
"""
import os
import oandapy
import pandas as pd
class Tickers(object):
"""
Basic info about tickers available for OANDA trading
"""
#oanda_api private attribute
_oanda_api = oandapy.API(environment = os.environ['ENV'],
... | dariocorral/panoanda | panoanda/tickers.py | Python | mit | 2,954 |
"""The tests for the logbook component."""
# pylint: disable=protected-access,too-many-public-methods
from datetime import timedelta
import unittest
from unittest.mock import patch
from homeassistant.components import sun
import homeassistant.core as ha
from homeassistant.const import (
EVENT_STATE_CHANGED, EVENT_... | leoc/home-assistant | tests/components/test_logbook.py | Python | mit | 15,111 |
from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from telestream_cloud_qc.api.qc_api import QcApi
| Telestream/telestream-cloud-python-sdk | telestream_cloud_qc_sdk/telestream_cloud_qc/api/__init__.py | Python | mit | 136 |
# coding: utf-8
from __future__ import absolute_import
from flask import Flask, render_template, _app_ctx_stack, abort
from flask_debugtoolbar import DebugToolbarExtension
from flask.ext.restful import Api
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session, Query as SAQuery
f... | pbanaszkiewicz/budgetApp | budgetApp/app.py | Python | mit | 3,510 |
import random
from urllib import urlopen
import sys
WORD_URL = "http://learncodethehardway.org/words.txt"
WORDS = []
PHRASES = {
"class %%%(%%%):":
"Make a class named %%% that is-a %%%.",
"class %%%(object):\n\tdef __init__(self, ***)" :
"class %%% has-a __init__ that takes self and *** parameters.",
"class... | Valka7a/python-playground | python-the-hard-way/oop-test.py | Python | mit | 2,060 |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HUnitDaughter2Woman_CompleteLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HUnitDaughter2Woman_CompleteLHS
"""
# Flag this instance as compiled now
self.is_co... | levilucio/SyVOLT | ExFamToPerson/contracts/unit/HUnitDaughter2Woman_CompleteLHS.py | Python | mit | 2,956 |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.centralnic.com/de.com/status_available
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.parser... | huyphan/pyyawhois | test/record/parser/test_response_whois_centralnic_com_de_com_status_available.py | Python | mit | 2,051 |
import asyncio
import codecs
import logging
logger = logging.getLogger('process')
class StdStream:
def __init__(self, encoding, errors='replace'):
self.buffer_ = ''
self.decoder = codecs.getincrementaldecoder(encoding)(errors)
def feed_data(self, data):
self.buffer_ += self.decoder.de... | Thezomg/gsc | gsc/process.py | Python | mit | 1,432 |
# Copyright (c) Jeroen Van Steirteghem
# See LICENSE
from twisted.internet import reactor, ssl
import OpenSSL
import twunnel.local_proxy_server
import twunnel.local_proxy_server__socks5
import twunnel.logger
class SSLServerContextFactory(ssl.ContextFactory):
isClient = 0
def __init__(self, certificateFil... | jvansteirteghem/twunnel | twunnel/remote_proxy_server__ssl.py | Python | mit | 2,885 |
#!/usr/bin/env python
import sys
import csv
from Bio import SeqIO
#from Bio.Seq import Seq
#from Bio.SeqRecord import SeqRecord
#from collections import defaultdict
def main():
records = SeqIO.to_dict(SeqIO.parse(open(sys.argv[1]), 'fasta'))
reader = csv.DictReader(sys.stdin, dialect="excel-tab")
clusters ... | zibraproject/zika-pipeline | scripts/split-clusters.py | Python | mit | 669 |
import numpy as np
import matplotlib.pyplot as plt
import Graphics as artist
import matplotlib.gridspec as gridspec
from awesome_print import ap
plt.xkcd()
def unique_words(aStr):
return ' '.join([word for word in set(aStr.split())])
def princomp(A,numpc=3):
# computing eigenvalues and eigenvectors of covarianc... | mac389/lovasi | src/orthogonalize-topics-xkcd.py | Python | mit | 2,933 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "froide_theme.settings")
os.environ.setdefault("DJANGO_CONFIGURATION", "Dev")
from configurations.management import execute_from_command_line
execute_from_command_line(sys.argv)
| okfde/froide-theme | manage.py | Python | mit | 315 |
from fabric.api import *
# Fill out USER and HOSTS configuration before running
env.user = ''
env.hosts = ['']
env.code_dir = '/home/%s/rtd/checkouts/readthedocs.org' % (env.user)
env.virtualenv = '/home/%s/rtd' % (env.user)
def install_prerequisites():
"""Install prerequisites."""
sudo("apt-get -y install p... | ojii/readthedocs.org | fabfile-development.py | Python | mit | 2,084 |
# -*- coding: utf-8 -*-
import json
import psycopg2
import math
DSN = "dbname=jonsaints"
areas = {}
with psycopg2.connect(DSN) as conn:
with conn.cursor() as curs:
SQL = '''
select
uuid,
st_area(geom::geography) as area
from polygons p
'''
c... | saintsjd/geonameit | bin/final.py | Python | mit | 2,204 |
from tornado import gen
from tornado.httpclient import AsyncHTTPClient
from tornado.ioloop import IOLoop
@gen.coroutine
def test():
client = AsyncHTTPClient()
ret = yield client.fetch('http://127.0.0.1:8000')
raise gen.Return(ret.body)
@gen.coroutine
def run():
print 'run invoked'
ret = yield te... | ly0/pycrawler | others/temp.py | Python | mit | 386 |
import _plotly_utils.basevalidators
class ColorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="colorsrc", parent_name="waterfall.textfont", **kwargs
):
super(ColorsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_nam... | plotly/plotly.py | packages/python/plotly/plotly/validators/waterfall/textfont/_colorsrc.py | Python | mit | 421 |
"""
Tiny sample of converter
usage: updater.py --converter=tinysample
"""
def convert(xs, args):
print 'hello!', args
return xs # do nothing
| mitou/meikan | converter/tinysample.py | Python | mit | 151 |
import sys
sys.path.append('D:\GitHub\PythonDev\ChargingTime')
import hello
hello = reload(hello)
import hello2
hello2.hello()
import hello3
hello3.hello()
print __name__
print hello3.__name__
import hello4
hello4.hello()
hello4.test()
import sys, pprint
pprint.pprint(sys.path)
import constants
print constants.... | Great-Li-Xin/PythonDev | BatteriesIncluded/BatteriesIncluded.py | Python | mit | 3,142 |
def to_lower(s):
char_map = {
u"I": u"ı",
u"İ": u"i",
}
for key, value in char_map.items():
s = s.replace(key, value)
return s.lower()
def to_upper(s):
char_map = {
u"ı": u"I",
u"i": u"İ",
}
for key, value in char_map.items():
s = s.replac... | th0th/metu-cafeteria-menu | metu_cafeteria_menu/utils.py | Python | mit | 535 |
from django.db import models
from measurement.models import Measurement
from django.utils.encoding import smart_unicode
class Alarm(models.Model):
measurement = models.OneToOneField(Measurement, null=True)
time_created = models.DateTimeField(null=False, auto_now_add=True, auto_now=False)
is_treated = mode... | sigurdsa/angelika-api | alarm/models.py | Python | mit | 1,235 |
# This file is exec'd from settings.py, so it has access to and can
# modify all the variables in settings.py.
# If this file is changed in development, the development server will
# have to be manually restarted because changes will not be noticed
# immediately.
import os
import dotenv
BASE_DIR = os.path.dirname(os.... | edilio/api_builder | api_builder/local_settings.py | Python | mit | 2,017 |
#!/usr/bin/env python
import os
import re
from setuptools import setup, find_packages
version_file = os.path.join(
os.path.dirname(__file__),
'mass_api_client',
'__version__.py'
)
with open(version_file, 'r') as fp:
m = re.search(
r"^__version__ = ['\"]([^'\"]*)['\"]",
fp.read(),
... | mass-project/mass_api_client | setup.py | Python | mit | 617 |
"""Production settings and globals."""
from os import environ
from base import *
# Normally you should not import ANYTHING from Django directly
# into your settings, but ImproperlyConfigured is an exception.
from django.core.exceptions import ImproperlyConfigured
def get_env_setting(setting):
""" Get the environ... | daviferreira/leticiastallone.com | leticiastallone/settings/production.py | Python | mit | 3,050 |
from gevent import monkey
monkey.patch_all()
from werkzeug.wsgi import peek_path_info
from geventwebsocket import Resource
from lablog import config
from lablog.app import App
from lablog.controllers.dashboard import dashboard
from lablog.controllers.auth import auth
from lablog.controllers.auth.facebook import facebo... | NationalAssociationOfRealtors/LabLog | wsgi.py | Python | mit | 1,820 |
"""
@brief test tree node (time=2s)
"""
import sys
import os
import unittest
from pyquickhelper.pycode import get_temp_folder
from pyquickhelper.pycode.build_helper import get_build_script, get_script_command, get_extra_script_command, _default_nofolder
from pyquickhelper.pycode.setup_helper import write_pyproj... | sdpython/pyquickhelper | _unittests/ut_pycode/test_build_script.py | Python | mit | 3,562 |
import asyncio
import os
import pytest
import re
import uuid
from arq import Worker
from buildpg import Values, asyncpg
from buildpg.asyncpg import BuildPgConnection
from foxglove import glove
from foxglove.db import PgMiddleware, prepare_database
from foxglove.db.helpers import DummyPgPool, SyncDb
from foxglove.test_s... | tutorcruncher/morpheus | tests/conftest.py | Python | mit | 7,653 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zango.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| BitWriters/Zenith_project | zango/src/manage.py | Python | mit | 248 |