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 |
|---|---|---|---|---|---|
from matplotlib import pyplot as plt
import seaborn as sns
import pandas as pd
from ..ml.linear_algebra import distmat
def scatter_2d(orig_df: pd.DataFrame, colx, coly, label_col,
xmin=None, xmax=None, ymin=None, ymax=None):
"""
Return scatter plot of 2 columns in a DataFrame, taking labels as ... | Seiji-Armstrong/seipy | seipy/plots_/base.py | Python | mit | 875 |
'''
Created on Jan 30, 2011
@author: snail
'''
import logging
import logging.handlers
import os
import sys
from os.path import join
from os import getcwd
from logging import DEBUG, INFO, WARNING, ERROR, CRITICAL
from pickle import dumps
LogPath = "Logs"
#ensure the logging path exists.
try:
from os import mkdir
... | theepicsnail/SuperBot2 | Logging.py | Python | mit | 3,658 |
#!/usr/bin/env python
import sys, json
from confusionmatrix import ConfusionMatrix as CM
def main():
for line in sys.stdin:
cm = json.loads(line)
print CM(cm["TP"], cm["FP"], cm["FN"], cm["TN"])
if __name__ == '__main__':
main()
| yatmingyatming/LogisticRegressionSGDMapReduce | display_stats.py | Python | mit | 264 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-08-17 20:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app_pessoa', '0004_auto_20170817_1727'),
]
operati... | LEDS/X-data | Xdata/app_pessoa/migrations/0005_auto_20170817_1730.py | Python | mit | 559 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import uuid
from . import utils
from .exceptions import (RevisionNotFound, RevisionAlreadyExists,
NoRevisionsFound, GoingTooFar, AlreadyHere)
def init(directory: str):
print('Creating directory', directory)
os.mkdir(... | ALFminecraft/migro | migro/main.py | Python | mit | 4,923 |
from django import forms
from django.contrib.auth.forms import AuthenticationForm
from django.utils.translation import ugettext_lazy as _
class EmailAuthenticationForm(AuthenticationForm):
"""Email authentication Form
increase the size of the username field to fit long emails"""
# TODO: consider to change... | theteam/django-theteamcommon | src/theteamcommon/forms.py | Python | mit | 770 |
from discrete import *
f = factorial(100)
s = str(f)
print sum([int(s[i]) for i in range(len(s))])
| jreese/euler | python/problem20.py | Python | mit | 101 |
import cPickle as pickle
import numpy as np
import os
import sys
sys.path.append('../')
import gp
from uitools import UITools
class Manager(object):
def __init__(self, output_dir):
'''
'''
self._data_path = '/home/d/dojo_xp/data/'
self._output_path = os.path.join(self._data_path, 'ui_out', output_... | VCG/gp | ui/manager.py | Python | mit | 12,894 |
# Rushy Panchal
"""
See https://bittrex.com/Home/Api
"""
import urllib
import time
import requests
import hmac
import hashlib
BUY_ORDERBOOK = 'buy'
SELL_ORDERBOOK = 'sell'
BOTH_ORDERBOOK = 'both'
PUBLIC_SET = ['getmarkets', 'getcurrencies', 'getticker', 'getmarketsummaries', 'getorderbook',
'getmarkethistor... | panchr/python-bittrex | bittrex/bittrex.py | Python | mit | 9,819 |
import hexchat
import re
__module_name__ = 'BanSearch'
__module_author__ = 'TingPing'
__module_version__ = '2'
__module_description__ = 'Search for bans/quiets matching a user'
banhook = 0
quiethook = 0
endbanhook = 0
endquiethook = 0
banlist = []
quietlist = []
regexescapes = {'[':r'\[', ']':r'\]', '.':r'\.'}
ircr... | TingPing/plugins | HexChat/bansearch.py | Python | mit | 5,101 |
import signal
import subprocess
import sys
import time
import numba
import numpy as np
import SharedArray as sa
sys.path.append('./pymunk')
import pymunk as pm
max_creatures = 50
@numba.jit
def _find_first(vec, item):
for i in range(len(vec)):
if vec[i] == item:
return i
return -1
@numb... | brains-on-art/culture | culture_logic.py | Python | mit | 7,076 |
import logging
from copy import copy
from six import iteritems, reraise
import sys
from .base import Singleton
from .utils import APP_DIR, rel, merge
class BaseConfigMixin(dict):
def __setitem__(self, key, value):
self.__dict__[key.lower()] = value
def __getitem__(self, key):
return self.__d... | translationexchange/tml-python | tml/config.py | Python | mit | 10,511 |
from ..osid import records as osid_records
class HierarchyRecord(osid_records.OsidRecord):
"""A record for a ``Hierarchy``.
The methods specified by the record type are available through the
underlying object.
"""
class HierarchyQueryRecord(osid_records.OsidRecord):
"""A record for a ``Hier... | birdland/dlkit-doc | dlkit/hierarchy/records.py | Python | mit | 848 |
"""
homeassistant.components.device_tracker.tplink
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Device tracker platform that supports scanning a TP-Link router for device
presence.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.tplink.ht... | pottzer/home-assistant | homeassistant/components/device_tracker/tplink.py | Python | mit | 9,226 |
#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2019 The Bitcoin Core developers
# Copyright 2015-2019 The Auroracoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework for auroracoin ... | aurarad/auroracoin | test/util/auroracoin-util-test.py | Python | mit | 6,651 |
from ..models import Job
import datetime
class JobContainer():
def __init__(self):
self.organization = None
self.title = None
self.division = None
self.date_posted = None
self.date_closing = None
self.date_collected = None
self.url_detail = None
sel... | rgscherf/gainful2 | parsing/parsinglib/jobcontainer.py | Python | mit | 2,667 |
import unittest
from tweet_dns.sources.source_base import SourceBase
class SourceBaseTest(unittest.TestCase):
def test_regex(self):
text = """
1.1.1.1
192.168.0.1
127.0.0.1
255.255.255.255
256.
1.1..1
1.200.3.4
... | AstromechZA/TweetDNS | tests/sources/source_base_test.py | Python | mit | 579 |
#!/usr/bin/env python3
# Copyright (c) 2017-2019 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 that the wallet resends transactions periodically."""
from collections import defaultdict
import t... | afk11/bitcoin | test/functional/wallet_resendwallettransactions.py | Python | mit | 3,194 |
from BeautifulSoup import BeautifulSoup as b
from collections import Counter
import urllib2, numpy
import matplotlib.pyplot as plt
response = urllib2.urlopen('http://en.wikipedia.org/wiki/List_of_Question_Time_episodes')
html = response.read()
soup = b(html)
people = []
tables = soup.findAll('table','wikitable')[2:... | dunkenj/DimbleData | QTstats.py | Python | mit | 1,981 |
# -*- coding: utf-8 -*-
"""
Utils has nothing to do with models and views.
"""
from datetime import datetime
from flask import current_app
def get_current_time():
return datetime.utcnow()
def format_date(value, format='%Y-%m-%d %H:%M:%S'):
return value.strftime(format)
def get_resource_as_string(name... | vovantics/flask-bluebone | app/utils.py | Python | mit | 427 |
# Copyright (c) 2016 kamyu. All rights reserved.
#
# Google Code Jam 2016 Round 1A - Problem B. Rank and File
# https://code.google.com/codejam/contest/4304486/dashboard#s=p1
#
# Time: O(N^2)
# Space: O(N^2), at most N^2 numbers in the Counter
#
from collections import Counter
def rank_and_file():
N = input()
... | kamyu104/GoogleCodeJam-2016 | Round 1A/rank-and-file.py | Python | mit | 774 |
import os
import numpy as np
import pandas as pd
import patools.packing as pck
class Trial:
def __init__(self, directory=os.getcwd(), nbs=False):
self.packings = self.loadTrials(directory, nbs)
self.df = pd.DataFrame(index=self.packings.keys())
self._getSphereRads()
self._getPartic... | amas0/patools | patools/trial.py | Python | mit | 5,966 |
txt = "the quick brown fox jumped over thethe lazy dog"
txt2 = txt.replace("the","a")
print txt
print txt2
| treeform/pystorm | tests/strings/replace.py | Python | mit | 110 |
#!/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.
"""Run regression test suite.
This module calls down into individual test cases via subprocess. It will
f... | jimmysong/bitcoin | test/functional/test_runner.py | Python | mit | 17,927 |
class Solution(object):
def findSubstring(self, s, words):
"""
:type s: str
:type words: List[str]
:rtype: List[int]
"""
| xingjian-f/Leetcode-solution | 30. Substring with Concatenation of All Words.py | Python | mit | 173 |
from functools import wraps
import os
from flask import request
from werkzeug.utils import redirect
ssl_required_flag = os.environ.get('SSL_REQUIRED', False) == 'True'
def ssl_required(fn):
@wraps(fn)
def decorated_view(*args, **kwargs):
if ssl_required_flag and not request.is_secure:
return redirect(request.u... | hectorbenitez/flask-heroku | flas/decorators.py | Python | mit | 408 |
# -*- coding: utf-8 -*-
"""
Setuptools script for the xbee-helper project.
"""
import os
from textwrap import fill, dedent
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
def requir... | flyte/xbee-helper | setup.py | Python | mit | 1,972 |
from .base import KaffeError
from .core import GraphBuilder, DataReshaper, NodeMapper
from . import tensorflow
| polltooh/FineGrainedAction | nn/kaffe/__init__.py | Python | mit | 111 |
#!/usr/bin/env python
###
# (C) Copyright (2012-2015) Hewlett Packard Enterprise Development LP
#
# 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 limita... | ufcg-lsd/python-hpOneView | examples/scripts/define-network-set.py | Python | mit | 6,316 |
import argparse
import io
import unittest
import mock
import time
from imagemounter.cli import AppendDictAction
class AppendDictActionTest(unittest.TestCase):
def test_with_comma(self):
parser = argparse.ArgumentParser()
parser.add_argument('--test', action=AppendDictAction)
self.assertD... | jdossett/imagemounter | tests/cli_test.py | Python | mit | 3,178 |
# Import the necessary packages and modules
import matplotlib.pyplot as plt
import numpy as np
# Prepare the data
x = np.linspace(0, 10, 100)
# Plot the data
plt.plot(x, x, label='linear')
# Add a legend
plt.legend()
# Show the plot
plt.show()
print("done")
| vadim-ivlev/STUDY | coding/plot.py | Python | mit | 262 |
#!/usr/bin/env python
##################################################################
# Imports
from __future__ import print_function
from random import random
import codecs
import numpy as np
import sys
##################################################################
# Variables and Constants
ENCODING = "utf-8... | WladimirSidorenko/SentiLex | scripts/find_prj_line.py | Python | mit | 8,625 |
import _plotly_utils.basevalidators
class ArrayminussrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="arrayminussrc", parent_name="bar.error_y", **kwargs
):
super(ArrayminussrcValidator, self).__init__(
plotly_name=plotly_name,
pa... | plotly/plotly.py | packages/python/plotly/plotly/validators/bar/error_y/_arrayminussrc.py | Python | mit | 429 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class MeiziItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
page_num = scrapy.Field()
img_url... | JMwill/wiki | notebook/tool/spider/meizi_spider/python_spider/meizi/meizi/items.py | Python | mit | 514 |
""" Command to set maintenance status. """
from django.core.management.base import BaseCommand
import sys
import json
import os
BASE_DIR = os.path.dirname(__file__)
JSON_FILE = os.path.join(BASE_DIR, '../../maintenance_settings.json')
class Command(BaseCommand):
""" Set maintenance status """
@classmethod
... | mccricardo/django_maintenance | django_maintenance/management/commands/maintenance.py | Python | mit | 1,052 |
"""Functionality to interact with Google Cloud Platform.
"""
| chapmanb/bcbio-nextgen-vm | bcbiovm/gcp/__init__.py | Python | mit | 61 |
import sys
import pdb
import svgfig
import json
import os
import math
import random
def show_help():
print("Usage: main.py input_file [--silent] [--output=<out.svg>]" +
" [--order=order.txt]")
print("Input file is either a text file containing t u v," +
"or a JSON file where the following ... | JordanV/LinkStreamViz | main.py | Python | mit | 11,963 |
from django.contrib import admin
from player.models import Room, PlaylistTrack
from ordered_model.admin import OrderedModelAdmin
class RoomAdmin(admin.ModelAdmin):
list_display = ('name', 'shuffle', 'current_music', 'can_adjust_volume')
class ItemAdmin(OrderedModelAdmin):
list_display = ('move_up_down_link... | Amoki/Amoki-Music | player/admin.py | Python | mit | 434 |
#!/usr/bin/env python
# Copyright (c) 2002-2003 ActiveState Corp.
# Author: Trent Mick (TrentM@ActiveState.com)
"""Test suite for which.py."""
import sys
import os
import re
import tempfile
import unittest
import testsupport
#XXX:TODO
# - def test_registry_success(self): ...App Paths setting
# - def test_regist... | fsys/which | test/test_which.py | Python | mit | 6,969 |
# Made by Christian Oliveros on 04/10/2017 for MMKF15
# Imports Used
import decimal as d
try:
from .constants import VL, EPSILON, STEP_MAX
except SystemError as e:
from constants import VL, EPSILON, STEP_MAX
class Vector3(object):
"""Class that represents a Vector with 3 coordinates"""
def __init__(self, x=0.0... | maniatic0/rasppi-printer | Utilities/vector.py | Python | mit | 5,714 |
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... | astrellon/cotsb | server/.ycm_extra_conf.py | Python | mit | 5,739 |
# -*- coding: utf-8 -*-
#
# py-uwerr documentation build configuration file, created by
# sphinx-quickstart on Sat Nov 24 19:07:07 2012.
#
# 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.
#
# Al... | dhesse/py-uwerr | doc/conf.py | Python | mit | 7,830 |
'''
Example which moves objects around in a 2D world.
This example requires matplotlib. The ros package doesnt have this as a
rosdep though, since nothing else needs it. Just do a system install
of matplotlib.
'''
import roslib; roslib.load_manifest('hierarchical_interactive_planning')
import numpy as np
from scipy im... | jonbinney/python-planning | python_task_planning/examples/move_stuff/move_stuff.py | Python | mit | 8,400 |
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def mainRoute():
return render_template('hello.html')
@app.route('/jujitsu')
def jujitsu():
return render_template('jujitsu.html')
if __name__ == '__main__':
app.run(debug=True,host='0.0.0.0', port=8080)
| CrazyDiamond567/docker-cloud-test | unh698.py | Python | mit | 302 |
#!/usr/bin/env python
# encoding: utf-8
"""MoodleFUSE initialization
"""
import os
import errno
from moodlefuse.filesystem import Filesystem
from moodlefuse.core import setup, config
from moodlefuse.services import USERS
MOODLEFUSE_DATABASE_FILE = 'moodlefuse.sqlite'
MOODLEFUSE_CONFIG_FILE = 'moodlefuse.conf'
MOOD... | BroganD1993/MoodleFUSE | moodlefuse/__init__.py | Python | mit | 836 |
import sys
import time as tmod
import warnings
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
import pandas as pd
warnings.simplefilter("ignore")
sys.path.insert(0, "../FATS/")
import FATS
iterations = 100000
lc_size = 1000
random = np.random.RandomState(42)
results = {
... | carpyncho/feets | res/paper/reports/features_montecarlo.py | Python | mit | 1,591 |
import pymc3 as pm
from lasagne.layers.helper import *
from lasagne.layers.helper import __all__ as __helper__all__
__all__ = [
"find_parent",
"find_root",
] + __helper__all__
def find_parent(layer):
candidates = get_all_layers(layer)[::-1]
found = None
for candidate in candidates:
if isin... | ferrine/gelato | gelato/layers/helper.py | Python | mit | 551 |
import inspect
__all__ = ['GenericVisitor']
class GenericVisitor(object):
"""
A generic visitor.
To define handlers, subclasses should define :data:`visit_Foo`
methods for each class :data:`Foo` they want to handle.
If a specific method for a class :data:`Foo` is not found, the MRO
of the c... | opesci/devito | devito/tools/visitors.py | Python | mit | 4,134 |
import base64
import demistomock as demisto
from WildFireReports import main
import requests_mock
def test_wildfire_report(mocker):
"""
Given:
A sha256 represents a file uploaded to WildFire.
When:
internal-wildfire-get-report command is running.
Then:
Ensure that the command ... | VirusTotal/content | Packs/Palo_Alto_Networks_WildFire/Integrations/WildFireReports/WildFireReports_test.py | Python | mit | 4,906 |
#!/usr/bin/env python2
import argparse
import xml.etree.ElementTree as ET
import subprocess
import os.path as path
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
import time
OUT_DIR = './_out'
HAXE_PATH = 'haxe'
def get_main_info(meta_root):
server_main, client_main ... | Jusonex/haxe-mtasa-typings | example/build.py | Python | mit | 3,302 |
# -*- coding: utf-8 -*-
from google.appengine.api import apiproxy_stub_map
from google.appengine.ext import db
from django.core.urlresolvers import resolve
from django.http import HttpRequest, QueryDict
from ragendja.testutils import ModelTestCase
from search.core import SearchIndexProperty
import base64
class Indexed... | nurey/disclosed | app2/search/tests.py | Python | mit | 2,896 |
# classifier.py
#
# This module contains code to support the classifier notebook
import numpy as np
import pylab as plt
def p_correct_given_pos(sens, fpr, b):
""" Returns a simple Bayesian probability for the probability
that a prediction is correct, given that the prediction
was positive, given ... | widdowquinn/Teaching-SfAM-ECS | workshop/tools/classifier.py | Python | mit | 2,237 |
"""manglocreative URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cl... | rizkiwisnuaji/django-newbie-cms | manglocreative/urls.py | Python | mit | 2,703 |
import numpy as np
import scipy.misc
import matplotlib.pyplot as plt
x = np.linspace(0, 5, 100)
y1 = np.power(2, x)
y2 = scipy.misc.factorial(x)
plt.plot(x, y1)
plt.plot(x, y2)
plt.grid(True)
plt.savefig('../../img/question_4_plots/g.png')
| ammiranda/CS325 | week1/plots/question_4/g.py | Python | mit | 243 |
import random
color_names=[
'aliceblue',
'antiquewhite',
'aqua',
'aquamarine',
'azure',
'beige',
'bisque',
'blanchedalmond',
'blue',
'blueviolet',
'brown',
'burlywood',
'cadetblue',
'chartreuse',
'chocolate',
'coral',
'cornflowerblue',
'cornsilk'... | largetalk/tenbagger | draw/colors.py | Python | mit | 2,176 |
"""
Compare the regions predicted to be prophages to the regions that are marked as prophages in our testing set
Probably the hardest part of this is the identifiers!
"""
import os
import sys
import argparse
import gzip
from Bio import SeqIO, BiopythonWarning
from PhiSpyModules import message, is_gzip_file
__author_... | linsalrob/PhiSpy | scripts/compare_predictions_to_phages.py | Python | mit | 8,988 |
from pymarkdownlint.tests.base import BaseTestCase
from pymarkdownlint.config import LintConfig, LintConfigError
from pymarkdownlint import rules
class LintConfigTests(BaseTestCase):
def test_get_rule_by_name_or_id(self):
config = LintConfig()
# get by id
expected = rules.MaxLineLengthRu... | jorisroovers/pymarkdownlint | pymarkdownlint/tests/test_config.py | Python | mit | 1,809 |
"""
homeassistant.components.binary_sensor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Component to interface with binary sensors (sensors which only know two states)
that can be monitored.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/binary_sensor/
"""
im... | badele/home-assistant | homeassistant/components/binary_sensor/__init__.py | Python | mit | 1,321 |
#! /usr/bin/env python
import sys
sys.setrecursionlimit(150000)
import time
count = 0
def my_yield():
global count
count = count + 1
yield
def run_co(c):
global count
count = 0
t0 = time.clock()
for r in c: ()
t = time.clock()
dt = t-t0
print(dt,count,count / dt)
return r
def parallel_(p1,p2)... | vs-team/Papers | 0. MonadicCoroutines/Src/MonadicCoroutines/CSharp/main.py | Python | mit | 3,063 |
from django import forms
class SearchForm(forms.Form):
criteria = forms.CharField(label='Criteria', max_length=100, required=True) | chaocodes/playlist-manager-django | manager/search/forms.py | Python | mit | 135 |
class Solution:
def combine(self, n, k):
return [list(elem) for elem in itertools.combinations(xrange(1, n + 1), k)]
| rahul-ramadas/leetcode | combinations/Solution.6808610.py | Python | mit | 132 |
import os
import unittest
from erettsegit import argparse, yearify, monthify, levelify
from erettsegit import MessageType, message_for
class TestErettsegit(unittest.TestCase):
def test_yearify_raises_out_of_bounds_years(self):
with self.assertRaises(argparse.ArgumentTypeError):
yearify(2003)
... | z2s8/erettsegit | test_erettsegit.py | Python | mit | 1,186 |
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist
from django.core.paginator import InvalidPage, Paginator
from django.db import models
from django.http import HttpResponseRedirect
from django.template.response import SimpleTemplateResponse, TemplateResponse
from django.utils.datastructures import... | A425/django-nadmin | nadmin/views/list.py | Python | mit | 25,811 |
import json
import re
from pygeocoder import Geocoder
from pygeolib import GeocoderError
import requests
# from picasso.index.models import Tag
from picasso.index.models import Address, Listing, Tag
__author__ = 'tmehta'
url = 'http://www.yellowpages.ca/ajax/search/music+teachers/Toronto%2C+ON?sType=si&sort=rel&pg=1&... | TejasM/picasso | picasso/yellow_pages.py | Python | mit | 3,125 |
import subprocess
with open('names.txt') as f:
names = f.read().splitlines()
with open('portraits.txt') as f:
portraits = f.read().splitlines()
for i, name in enumerate(names):
portrait = portraits[i]
if portrait.endswith('.png'):
subprocess.call(['cp', 'minor/{}'.format(portrait), '{}.png'.fo... | dcripplinger/rotj | data/images/portraits/copy_portraits.py | Python | mit | 341 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
from distutils.core import setup, Extension
setup(name='sample',
ext_modules=[
Extension('sample',
['pysample.c'],
include_dirs=['/some/dir'],
define_macros=[('FOO', '1')],
... | xu6148152/Binea_Python_Project | PythonCookbook/interaction_c/setup.py | Python | mit | 474 |
import logging
import time
import os
from fuocore.models import (
BaseModel,
SongModel,
LyricModel,
PlaylistModel,
AlbumModel,
ArtistModel,
SearchModel,
UserModel,
)
from .provider import provider
logger = logging.getLogger(__name__)
MUSIC_LIBRARY_PATH = os.path.expanduser('~') + '/M... | cosven/feeluown-core | fuocore/netease/models.py | Python | mit | 6,421 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kirppu_project.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| jlaunonen/kirppu | manage.py | Python | mit | 257 |
# -*- coding: utf-8 -*-
# Copyright 2017-TODAY LasLabs Inc.
# License MIT (https://opensource.org/licenses/MIT).
import properties
from datetime import datetime, date
from ..base_model import BaseModel
class Domain(properties.HasProperties):
"""This represents a full search query."""
OR = 'OR'
AND = '... | LasLabs/python-helpscout | helpscout/domain/__init__.py | Python | mit | 7,131 |
"""
Pylot command line tool
manage.py
Command line tool to manage your application
"""
import argparse
from application import get_config
import application.model as model
from pylot import utils
config = get_config()
NAME = "Pylot Manager"
__version__ = config.APP_VERSION
def setup():
# Create all db
mo... | mardix/pylot | pylot/app_templates/manage.py | Python | mit | 1,343 |
#!/usr/bin/env python2
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT/X11 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 import *
from... | Kangmo/bitcoin | qa/rpc-tests/bip9-softforks.py | Python | mit | 8,775 |
while True:
input_number = int(raw_input())
if input_number == 42:
break
print input_number,
exit() | sandy-8925/codechef | test.py | Python | mit | 112 |
import json
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
def jsonfilter(value):
return mark_safe(json.dumps(value))
register.filter('json', jsonfilter)
| Open511/open511-server | open511_server/templatetags/open511.py | Python | mit | 220 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.text import slugify
from django.contrib.auth.models import (
User
)
from pastryio.models.mixins import ArchiveMixin
class BaseProfile(ArchiveMixin):
user = models.OneToOneField(User)
avatar = models.Im... | octaflop/pastryio | apps/profiles/models.py | Python | mit | 496 |
from django.db import models
from django.core.exceptions import ImproperlyConfigured
from django import forms
from django.conf import settings
import warnings
try:
from keyczar import keyczar
except ImportError:
raise ImportError('Using an encrypted field requires the Keyczar module. '
'Y... | orbitvu/django-extensions | django_extensions/db/fields/encrypted.py | Python | mit | 4,102 |
try:
print 'Importing ....'
from base import * # noqa
from local import * # noqa
except ImportError:
import traceback
print traceback.format_exc()
print 'Unable to find moderation/settings/local.py'
try:
from post_env_commons import * # noqa
except ImportError:
pass
| CareerVillage/slack-moderation | src/moderation/settings/__init__.py | Python | mit | 305 |
from distutils.core import setup, Extension
setup(
name="tentacle_pi.TSL2561",
version="1.0",
packages = ["tentacle_pi"],
ext_modules = [
Extension("tentacle_pi.TSL2561",
sources = ["src/tsl2561.c", "src/tsl2561_ext.c"])
]
)
| lexruee/tsl2561 | setup.py | Python | mit | 237 |
from flask import Flask, jsonify, request, redirect, url_for
import subprocess
import os
import json
from cross_domain import *
app = Flask(__name__)
ALLOWED_EXTENSIONS = set(['mol', 'smi'])
try:
TARGET = os.environ['TARGET']
except Exception:
print 'export TARGET=<path to data>'
exit(1)
try:
AlGDoc... | gkumar7/AlGDock | gui/api/REST.py | Python | mit | 6,256 |
# -*- encoding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014-2015 Haltu Oy, http://haltu.fi
#
# 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 witho... | educloudalliance/eca-auth-data | authdata/management/commands/csv_import.py | Python | mit | 6,066 |
import asyncio
import rocat.message
import rocat.actor
import rocat.globals
class BaseActorRef(object):
def tell(self, m, *, sender=None):
raise NotImplementedError
def ask(self, m, *, timeout=None):
raise NotImplementedError
def error(self, e):
raise NotImplementedError
class... | chongkong/rocat | rocat/ref.py | Python | mit | 2,370 |
#!/usr/bin/env python3.7
# coding=utf-8
"""Jerod Gawne, 2018.06.28
https://github.com/jerodg/hackerrank
"""
import sys
import traceback
if __name__ == '__main__':
try:
n, m = map(int, input().split())
for i in range(1, n, 2):
print(str('.|.') * i).center(m, '-')
print(str('WELC... | jerodg/hackerrank-python | python/02.Strings/08.DesignerDoorMat/solution1.py | Python | mit | 510 |
import math
d = int(input())
for _ in range(d):
t, a, b, c = [int(x) for x in input().split()]
l = [a, b, c]
l.sort()
if l[0] + l[1] < l[2]:
l[2] = l[0] + l[1]
print(min(t, math.floor((l[0]+l[1]+l[2])/2)))
| madeinqc/IEEEXtreme9.0 | 06-tacostand-moderate/main.py | Python | mit | 238 |
#!/usr/bin/env python
#file cogent.parse.mothur.py
"""Parses Mothur otu list"""
from record_finder import is_empty
__author__ = "Kyle Bittinger"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__credits__ = ["Kyle Bittinger"]
__license__ = "GPL"
__version__ = "1.5.3"
__maintainer__ = "Kyle Bittinger"
__emai... | sauloal/cnidaria | scripts/venv/lib/python2.7/site-packages/cogent/parse/mothur.py | Python | mit | 1,558 |
from django.contrib import admin
# Register your models here.
from .models import Question, Choice
class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3
class QuestionAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['question_text']}),
('Date information', {'fields... | singh-pratyush96/voter | polls/admin.py | Python | mit | 593 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import todo.mixins
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='TodoItem',
fields=[
('id', m... | aaronbassett/djangocon-pusher | talk/todo/migrations/0001_initial.py | Python | mit | 1,191 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
m = {}
def findFrequentTreeSum(self, root):
"""
:type root: TreeNode
:rtype: List[int]
... | Jspsun/LEETCodePractice | Python/MostFrequentSubtreeSum.py | Python | mit | 849 |
import threading
import wx
from styled_text_ctrl import StyledTextCtrl
class ThreadOutputCtrl(StyledTextCtrl):
def __init__(self, parent, env, auto_scroll=False):
StyledTextCtrl.__init__(self, parent, env)
self.auto_scroll = auto_scroll
self.__lock = threading.Lock()
self.__queue ... | shaurz/devo | thread_output_ctrl.py | Python | mit | 1,266 |
import cgi
from http.server import HTTPServer, BaseHTTPRequestHandler
from database_setup import Base, Restaurant
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from test.restaurant_renderer import RestaurantRenderer
engine = create_engine('sqlite:///restaurantmenu.db')
Base.metadata.b... | MFry/pyItemCatalog | vagrant/itemCatalog/test/webserver.py | Python | mit | 6,549 |
# -*- coding: utf-8 -*-
from .store import Store
from ..tagged_cache import TaggedCache
from ..tag_set import TagSet
class TaggableStore(Store):
def tags(self, *names):
"""
Begin executing a new tags operation.
:param names: The tags
:type names: tuple
:rtype: cachy.tag... | sdispater/cachy | cachy/contracts/taggable_store.py | Python | mit | 497 |
from pandac.PandaModules import *
from toontown.toonbase.ToonBaseGlobal import *
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import StateData
from direct.showbase.PythonUtil import PriorityCallbacks
from toontown.safezone import PublicWalk
from toontown.launcher import DownloadForceAcknowledge
im... | ksmit799/Toontown-Source | toontown/hood/Place.py | Python | mit | 37,078 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-09 16:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Tag',
... | internship2016/sovolo | app/tag/migrations/0001_initial.py | Python | mit | 666 |
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils import timezone
from .models import Course
from .models import Step
class CourseModelTests(TestCase):
def test_course_creation(self):
course = Course.objects.create(
title="Python Regular Expression... | lorimccurry/learning_site | courses/tests.py | Python | mit | 2,724 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('django_graph', '0001_initial'),
('cyborg_identity', '0001_initial'),
]
operations = [
... | shawnhermans/cyborg-identity-manager | cyborg_identity/migrations/0002_iscontactemailaddress_iscontactphonenumber_phonenumber.py | Python | mit | 2,204 |
from . import _version
__version__ = _version.__version__
import os, math, pysam
from clint.textui import progress, puts_err
import sqlite3 as lite
import tempfile, warnings, pickle
def example_reads():
"""
returns the path to the example BAM file
"""
return os.path.join(os.path.join(os.path.dirname(_... | jpiper/pyDNase | pyDNase/__init__.py | Python | mit | 25,452 |
# By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
# What is the 10 001st prime number?
import math
from Utilities import Primes
from Problem import Problem
class N10001stPrime(Problem):
def __init__(self):
self.answer = 104743
def do(self):
... | hperreault/ProjectEuler | 007_N10001stPrime.py | Python | mit | 932 |
#ignore this file
| Fire-Hound/Linear-Regression-APK | ignore.py | Python | mit | 18 |
import unittest
from functools import partialmethod
from muk.sexp import *
class sexp_tests(unittest.TestCase):
def test_null_list(self):
self.isomorphism(l=[], c=[])
def test_singleton_proper_list_to_cons(self):
self.isomorphism(l=[1], c=cons(1, []))
def test_plain_proper_lis... | massimo-nocentini/on-python | microkanren/sexp_test.py | Python | mit | 2,061 |
import json
from operator import itemgetter
import os
import random
import string
import sys
from datetime import datetime
from devtools import debug
from functools import partial
from pathlib import Path
from statistics import StatisticsError, mean
from statistics import stdev as stdev_
from test_pydantic import Te... | samuelcolvin/pydantic | benchmarks/run.py | Python | mit | 8,926 |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import datetime
import numpy as np
from copy import deepcopy
import sys
import logging
class System:
def __init__(self, _start_time, start_power=0, test_plan=None):
self.start_power = start_power
self.power_left = self.start_power
self.last_ev... | pwcz/ml_embedded | simulation_tool/symulator.py | Python | mit | 11,083 |
# Accelerator for pip, the Python package manager.
#
# Author: Peter Odding <peter.odding@paylogic.com>
# Last Change: November 16, 2014
# URL: https://github.com/paylogic/pip-accel
"""
:py:mod:`pip_accel.caches.local` - Local cache backend
======================================================
This module implements... | theyoprst/pip-accel | pip_accel/caches/local.py | Python | mit | 3,310 |