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 |
|---|---|---|---|---|---|
from rubberduino import RubberDuino
| zatarra/rubberduino | rubberduino/__init__.py | Python | mit | 36 |
"""Root url REST resources."""
import flask
import flask_restful
from .jobs import Jobs
from .spec import Spec
class Home(flask_restful.Resource):
"""Home url REST resource."""
def get(self):
"""
Home
Available endpoints for the web api.
---
tags:
- docs
... | drmonkeysee/ecs-scheduler | ecs_scheduler/webapi/home.py | Python | mit | 1,021 |
#!/usr/bin/env python
# Copyright (c) 2015, Scott D. Peckham
#------------------------------------------------------
# S.D. Peckham
# July 9, 2015
#
# Tool to break CSDMS Standard Variable Names into
# all of their component parts, then save results in
# various formats. (e.g. Turtle TTL format)
#
# Example of use at... | mprinc/McMap | src/scripts/CSN_Archive2/parse_csvn.py | Python | mit | 7,899 |
#!/usr/bin/env python
###############################################################################
# $Id: gdal2grd.py 27044 2014-03-16 23:41:27Z rouault $
#
# Project: GDAL Python samples
# Purpose: Script to write out ASCII GRD rasters (used in Golden Software
# Surfer)
# from any source supported b... | tilemapjp/OSGeo.GDAL.Xamarin | gdal-1.11.0/swig/python/samples/gdal2grd.py | Python | mit | 4,946 |
# coding: utf-8
"""
This module contains all the code related to building necessary data files from
the source opendata files.
"""
from __future__ import absolute_import, print_function, unicode_literals
import logging
import flatisfy.exceptions
from flatisfy import database
from flatisfy import data_files
from flat... | Phyks/Flatisfy | flatisfy/data.py | Python | mit | 3,457 |
#! /usr/bin/env python
# -*- coding=utf-8 -*-
from distutils.core import setup
setup(
name='pythis',
version='1.4',
description='zen of python in Simplified Chinese',
url='https://github.com/vincentping/pythis',
author='Vincent Ping',
author_email='vincentping@gmail.com',
licen... | vincentping/pythis | setup.py | Python | mit | 1,142 |
import numpy as np
import time
from sklearn.ensemble import AdaBoostClassifier
from sklearn.metrics import classification_report
data = np.loadtxt('./data/TrainSamples.csv', delimiter=",")
label = np.loadtxt('./data/TrainLabels.csv', delimiter=",")
test = np.loadtxt('./data/TestSamples1.csv', delimiter=',')
testLabel ... | hitlonewind/PR-experiment | Classifrer/Adaboost.py | Python | mit | 713 |
from collections.abc import Mapping as MappingABC
from typing import (
Any,
BinaryIO,
Dict,
IO,
Iterable,
Iterator,
Mapping,
MutableMapping,
Optional,
Set,
TextIO,
Tuple,
TypeVar,
Union,
)
from .reading import load
from .writing import dump
from .xmlprops import d... | jwodder/javaproperties | src/javaproperties/propclass.py | Python | mit | 8,167 |
# coding: utf-8
from __future__ import absolute_import
from .base import Base
class Install(Base):
def __init__(self, config):
self.config = config
def run(self):
for package in self.config.packages:
package.install()
| hirokazumiyaji/pundler | pundler/commands/install.py | Python | mit | 258 |
"""
PyMapPlot
--------------
Overlays on map tiles in Python.
"""
from setuptools import setup
setup(
name='pymapplot',
version='0.0.1',
url='https://github.com/HengfengLi/pymapplot',
license='MIT',
author='Hengfeng Li',
author_email='hengf.li@gmail.com',
description=('Overlays on map tile... | HengfengLi/pymapplot | setup.py | Python | mit | 866 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test ZMQ interface
#
from test_framework.test_framework import NavCoinTestFramework
from test_framew... | navcoindev/navcoin-core | qa/rpc-tests/zmq_test.py | Python | mit | 3,264 |
# -*- coding: utf-8 -*-
# This example compares the available inverse Abel transform methods
# currently - direct, hansenlaw, and basex
# processing the O2- photoelectron velocity-map image
#
# Note it transforms only the Q0 (top-right) quadrant
# using the fundamental transform code
from __future__ import absolute_i... | stggh/PyAbel | examples/example_all_O2.py | Python | mit | 4,428 |
from __future__ import print_function, division, unicode_literals
import os
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
import numpy as np
from scipy.spatial.distance import euclidean
from pymatgen.core.structure import Structure
from p... | henniggroup/MPInterfaces | mpinterfaces/mat2d/electronic_structure/analysis.py | Python | mit | 32,249 |
from datetime import datetime
from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.contrib.comments.models import Comment
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from djan... | n1k0/djortunes | django_fortunes/models.py | Python | mit | 2,141 |
N, M = map(int,input().split()) # More than 6 lines of code will result in 0 score. Blank lines are not counted.
for i in range(1, N, 2):
print(('.|.' * i).center(M, '-')) # Enter Code Here
print('WELCOME'.center(M, '-')) # Enter Code Here
for i in range(N-2, -1, -2):
print(('.|.' * i).center(M, '-')) # Ent... | avtomato/HackerRank | Python/_03_Strings/_09_Designer_Door_Mat/solution.py | Python | mit | 333 |
import sys
reload(sys)
sys.setdefaultencoding("utf8")
from urllib import urlencode
from flask import jsonify, redirect, url_for, abort, request, render_template
from syzoj import oj, controller
from syzoj.models import User, Problem, File, FileParser
from syzoj.controller import Paginate, Tools
from .common import n... | cdcq/jzyzj | syzoj/views/problem.py | Python | mit | 4,193 |
# Copyright 2017 ContextLabs B.V.
import time
import hashlib
import urllib
import requests
import sawtooth_signing as signing
from base64 import b64decode
from random import randint
from sawtooth_omi.protobuf.work_pb2 import Work
from sawtooth_omi.protobuf.recording_pb2 import Recording
from sawtooth_omi.protobuf.iden... | omi/stl-api-gateway | omi_api/client.py | Python | mit | 10,377 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright(c) 2015 Red Hat, 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/l... | gestiweb/docker-base | dev/eneboo-cloud/novnc/utils/websockify/tests/test_websocketproxy.py | Python | mit | 4,556 |
#!/usr/bin/env python
# encoding: utf-8
from django.contrib.auth.decorators import (
permission_required as original_permission_required,
login_required as original_login_required,)
from keyauth.decorators import key_required as original_key_required
from functools import wraps
class DjangoToYardDecorator(obj... | laginha/yard | src/yard/resources/decorators/adapted.py | Python | mit | 1,471 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Spyder Te... | spyder-ide/spyder-terminal | spyder_terminal/api.py | Python | mit | 764 |
ximport math
a = open("Q46.txt")
words = []
for i in a.read().replace('"', '').strip("\"").split(","):
words.append(i)
triangle = []
for word in words:
num = sum([ord(a)-64 for a in word])
nn = math.trunc((2*num)**.5 )
if 2*num == (nn*(nn+1)):
triangle.append(True)
else:
triangle.a... | weiwang/project_euler | python/Q46.py | Python | mit | 334 |
"""
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/492216
Iterator algebra implementations of join algorithms: hash join, merge
join, and nested loops join, as well as a variant I dub "bisect join".
Requires Python 2.4.
Author: Jim Baker, jbaker@zyasoft.com
"""
import operator
from rdflib import py3compat... | mpetyx/pyrif | pyrif/FuXi/Rete/IteratorAlgebra.py | Python | mit | 4,077 |
#!/usr/bin/env python -OO
# encoding: utf-8
###########
# ORP - Open Robotics Platform
#
# Copyright (c) 2010 John Harrison, William Woodall
#
# 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 Softwa... | wjwwood/open-robotics-platform | template.py | Python | mit | 1,949 |
#!/usr/bin/python
from btc.main import *
#from btc.pyspecials import *
# get wordlists
def open_wordlist(wordlist):
try:
if wordlist in ('Electrum1', 'electrum1', 'electrum'):
from btc._electrum1wordlist import ELECTRUM1_WORDLIST
assert len(ELECTRUM1_WORDLIST) == 1626
r... | wizardofozzie/simpybtc | btc/mnemonic.py | Python | mit | 7,793 |
#region config
vex.pragma(config, I2C_Usage, I2C1, i2cSensors)
vex.pragma(config, Sensor, in1, leftLight, sensorLineFollower)
vex.pragma(config, Sensor, in2, middleLight, sensorLineFollower)
vex.pragma(config, Sensor, in3, rightLight, sensorLineFollower)
vex.pragma(config, Sensor, in4, wristPot, sensorPotentiometer)
ve... | NoMod-Programming/PyRobotC | examples/InTheZone/FantasticBox - Tank Control.py | Python | mit | 3,175 |
from django.core.urlresolvers import reverse
from django.test import TestCase
class SmokeTestMeanCoach(TestCase):
def test_index_page_returns_200(self):
resp = self.client.get(reverse('meancoach:index'))
assert resp.status_code == 200
| dev-coop/meancoach | meancoach_project/apps/meancoach/tests/smoke_tests.py | Python | mit | 258 |
# Python imports
import cgi
import locale
import logging
import os
import os.path
import sys
import time
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
# Douglas imports
from douglas import __version__
from douglas import crashhandling
from douglas import plugin_utils
fr... | willkg/douglas | douglas/app.py | Python | mit | 37,546 |
import _plotly_utils.basevalidators
class EnabledValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self,
plotly_name="enabled",
parent_name="densitymapbox.colorbar.tickformatstop",
**kwargs
):
super(EnabledValidator, self).__init__(
plo... | plotly/python-api | packages/python/plotly/plotly/validators/densitymapbox/colorbar/tickformatstop/_enabled.py | Python | mit | 515 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'fake-key'
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'analytics',
'tests'
]
ROO... | Baguage/django-google-analytics-id | tests/test_settings.py | Python | mit | 612 |
#!/usr/bin/env python
"""
<Program Name>
formats.py
<Author>
Geremy Condra
Vladimir Diaz <vladimir.v.diaz@gmail.com>
<Started>
Refactored April 30, 2012. -vladimir.v.diaz
<Copyright>
See LICENSE for licensing information.
<Purpose>
A central location for all format-related checking of TUF objects.
No... | team-ferret/pip-in-toto | pip/toto/ssl_crypto/formats.py | Python | mit | 25,848 |
from django.conf import settings
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.contrib import admin
admin.autodiscover()
from tagging.models import TaggedItem
from wakawaka.models import WikiPage
from pinax.apps.account.openid_consumer import PinaxCons... | amarandon/pinax | pinax/projects/code_project/urls.py | Python | mit | 2,413 |
from django.db import models
# Create your models here.
class SignUp(models.Model):
email = models.EmailField()
full_name = models.CharField(max_length=120, blank=True, null=True)
timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
updated = models.DateTimeField(auto_now_add=False, auto... | jnayak1/cs3240-s16-team16 | upload/models.py | Python | mit | 726 |
from collections import OrderedDict
from .. import Provider as CompanyProvider
class Provider(CompanyProvider):
formats = OrderedDict(
(
("{{company_limited_prefix}}{{last_name}} {{company_limited_suffix}}", 0.2),
(
"{{company_limited_prefix}}{{last_name}}{{company... | joke2k/faker | faker/providers/company/th_TH/__init__.py | Python | mit | 4,173 |
from django.db import models
from customer.models import Customer
from product.models import Product
from django.utils import timezone
# Create your models here.
class OrderStatus:
IN_BASKET = 0
PAYED = 1
class Order(models.Model):
customer = models.ForeignKey(Customer)
product = models.ForeignKey(P... | MahdiZareie/PyShop | shop/models.py | Python | mit | 691 |
# -*- coding: utf-8 -*-
from peewee import *
import urllib
import tempfile
import os
from contextlib import contextmanager
from sshtunnel import SSHTunnelForwarder
import traceback
db = MySQLDatabase(
"cod", host="127.0.0.1", user="cod_reader", port=3308, connect_timeout=10000
)
# Get
# ssh wout@axil1.ua.ac.be... | woutdenolf/spectrocrunch | scraps/cod.py | Python | mit | 6,727 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2016 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the... | Diti24/python-ivi | ivi/agilent/agilent34410A.py | Python | mit | 4,335 |
class ListViewTestsMixin(object):
def test_admin_users_can_access_all_tables(self):
for username in ('super', 'follow'):
with self.login_as(username):
for model_name in ('news', 'tip', 'crawl', 'user', 'schedule'):
self._test_table_view(username, model_name, ... | ivandeex/dz | dz/tests/views.py | Python | mit | 3,249 |
#!/usr/bin/env python
# coding=utf-8
"""
This example showcases the randomness features of Sacred.
Sacred generates a random global seed for every experiment, that you can
find in the configuration. It will be different every time you run the
experiment.
Based on this global seed it will generate the special paramete... | IDSIA/sacred | examples/06_randomness.py | Python | mit | 2,287 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^register/$', views.register, name='register'),
url(r'^login/$', views.user_login, name='login'),
url(r'^logout/$', views.user_logout, name='logout'),
url(r'^groups/$', views.groups, name='groups'),
url(r'^sitemanager/$', v... | j-windsor/cs3240-f15-team21-v2 | accounts/urls.py | Python | mit | 876 |
# descriptors.__init__
#
# Expose Descriptor, Validated, and all descriptors so they can be
# imported via "from descriptors import ..."
from __future__ import print_function, unicode_literals, division
from descriptors.Descriptor import Descriptor
from descriptors.Validated import Validated
import descriptors.handma... | noutenki/descriptors | descriptors/__init__.py | Python | mit | 631 |
# coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import si... | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | orcid_api_v3/models/preferences_v30_rc1.py | Python | mit | 3,447 |
class Invalid_IP_exception(Exception):
pass
| mikesligo/distributed-search | Exceptions/Invalid_IP_exception.py | Python | mit | 48 |
"""
WSGI config for kanban project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` s... | clione/django-kanban | src/kanban/wsgi.py | Python | mit | 1,419 |
#!/usr/bin/env python
import re
from os import path as op
from setuptools import setup
def _read(fname):
try:
return open(op.join(op.dirname(__file__), fname)).read()
except IOError:
return ''
_meta = _read('bottle_manage.py')
_license = re.search(r'^__license__\s*=\s*"(.*)"', _meta, re.M).g... | klen/bottle-manage | setup.py | Python | mit | 1,585 |
import pygame
from pygame.locals import *
from threading import Lock
from videoreceiver import VideoReceiver
from controlio import ControlIO
import sys
class Rover(object):
"""Primary control interface for Rover"""
FPS = 15
MLIMITLOW = 32
LLIMITLOW = 96
WIDTH = 1280
HEIGHT = 960
BLACK = (0,... | csauer42/rover | controller/rover.py | Python | mit | 4,030 |
# import pymysql
from flask import request,jsonify
import ec_forum.error as error
import ec_forum.sql as sql
import ec_forum.expr as expr
from ec_forum.salt import encrypt, decrypt
from config import MyConfig
sqlQ = sql.sqlQ()
def run(app):
@app.route('/sign_up', methods=['POST'])
def sign_up():
if r... | imxana/ec_forum | ec_forum/account.py | Python | mit | 4,404 |
""" Helpers for making some things in PIL easier """
from PIL import ImageDraw, ImageFont, ImageStat
from math import ceil
def drawTextWithBorder(draw, text, coords,
fontname="Impact", fontsize=80,
color="#fff", strokecolor="#000"):
""" Draw text with a border. Althou... | The-Penultimate-Defenestrator/memefarm | memefarm/pilutil.py | Python | mit | 2,924 |
from blessings import Terminal
from django.conf import settings
from django.contrib.staticfiles import finders, storage as djstorage
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand
from django.core.management import call_command
from django.utils.encoding impo... | hzdg/django-staticbuilder | staticbuilder/management/commands/collectforbuild.py | Python | mit | 5,220 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-07-13 18:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shortner', '0001_initial'),
]
operations = [
migrations.AddField(
... | diabolicfreak/url_shortner | src/shortner/migrations/0002_shortnerurl_shortcode.py | Python | mit | 504 |
from _winreg import *
import os, sys, win32gui, win32con
def queryValue(key, name):
value, type_id = QueryValueEx(key, name)
return value
def show(key):
for i in range(1024):
try:
n,v,t = EnumValue(key, i)
print '%s=%s' % (n... | ActiveState/code | recipes/Python/416087_Persistent_environment_variables/recipe-416087.py | Python | mit | 1,724 |
from corrdb.common.models import UserModel
from corrdb.common.models import ProfileModel
from corrdb.common import get_or_create
import hashlib
import datetime
import simplejson as json
import os
import re
def password_check(password):
"""
Verify the strength of 'password'
Returns a dict indicating the wro... | usnistgov/corr | corr-cloud/cloud/views/admin_generation.py | Python | mit | 3,973 |
import vanilla
import urlparse
import fnmatch
import base64
import bencode
import struct
import socket
import peers
import posixpath
from eventlet.green import zmq
import cPickle as pickle
import eventlet.queue
import fairywren
import itertools
import logging
import array
def sendBencodedWsgiResponse(env,start_respons... | hydrogen18/fairywren | tracker.py | Python | mit | 8,937 |
import numpy as np
class LinfinityRegression:
def __init__(self, iterations, learning_rate, regularization_strength):
self.iterations = iterations
self.learning_rate = learning_rate
self.regularization_strength = regularization_strength
@staticmethod
def soft_thresholding_operator... | aosingh/Regularization | LinfinityRegularization/LinfinityRegularizer.py | Python | mit | 2,373 |
from sys import argv
from os.path import exists
script, from_file, to_file = argv
print "Copying from %s to %s" % (from_file, to_file)
# we could do these two on one line too, how?
# in_file = open(from_file)
# indata = in_file.read()
indata = open(from_file).read()
print "The input file is %d bytes long" % len(in... | CodeCatz/litterbox | Pija/LearnPythontheHardWay/ex17.py | Python | mit | 570 |
lol = []
vvs = []
with open("yeast2000.txt") as the_file:
first = True
idx = 0
cnt = 0
lcnt = 0
var = []
for line in the_file:
ll = [item.strip() for item in line.split()]
lcnt += 1
if first:
lol.append(ll[:len(ll)-2])
first = False
continue
var.append(ll)
cnt += 1
if cnt == 200:
cnt = 0... | verdverm/pypge | pypge/benchmarks/yeast.py | Python | mit | 719 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Test case for Edge3D.
"""
import unittest
from catplot.grid_components.nodes import Node2D, Node3D
from catplot.grid_components.edges import Edge2D, Edge3D
class Edge3DTest(unittest.TestCase):
def setUp(self):
self.maxDiff = True
def test_construc... | PytLab/catplot | tests/edge_3d_test.py | Python | mit | 2,499 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
[path]
cd /Users/brunoflaven/Documents/01_work/blog_articles/extending_streamlit_usage/001_nlp_spacy_python_realp/
[file]
python 013_nlp_spacy_python.py
# source
Source: https://realpython.com/natural-language-processing-spacy-python/
"""
import spacy
from spacy... | bflaven/BlogArticlesExamples | extending_streamlit_usage/001_nlp_spacy_python_realp/013_nlp_spacy_python.py | Python | mit | 2,127 |
# coding: utf-8
from django import forms
from . import models as m
| asyncee/django-application-template | forms.py | Python | mit | 69 |
# -*- coding: utf-8 -*-
import sys
import subprocess
import signal
import locale
from six import print_
from six.moves import urllib
import requests
class Color:
PURPLE = '\033[95m'
BLUE = '\033[94m'
GREEN = '\033[92m'
ORANGE = '\033[93m'
RED = '\033[91m'
BOLD = '\033[1m'
UNDERLINE = '\0... | selectnull/serverscope-benchmark | serverscope_benchmark/utils.py | Python | mit | 2,357 |
'''
Created on Jun 8, 2011
@author: Piotr
'''
import unittest
import os
from readers.ConfigReader import ConfigReader
class ConfiReaderPolarCoordinatesTests(unittest.TestCase):
'''
Tests all variations of the polar coordinates settings provided
in the configuration file.
'''
def __saveT... | Dzess/ALFIRT | alfirt.runner/src/readers/tests/ConfigReaderPolarCoordinateTests.py | Python | mit | 4,095 |
#!/usr/bin/env python3
"""Project Euler - Problem 52 Module"""
import pelib
def problem52():
"""Problem 52 - Permuted multiples"""
x = 1
while True:
ss_str_2x = sorted(set(str(2 * x)))
ss_str_3x = sorted(set(str(3 * x)))
ss_str_4x = sorted(set(str(4 * x)))
ss_str_5x = sor... | rado0x54/project-euler | python/problem0052.py | Python | mit | 651 |
class Solution(object):
def firstMissingPositive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
l = len(nums)
for i in range(0, l):
cur = nums[i]
while cur >= 1 and cur <= l and nums[cur - 1] != cur:
tmp = nums[cur - 1]
... | hawkphantomnet/leetcode | FirstMissingPositive/Solution.py | Python | mit | 495 |
import math, os
import pygame
import thorpy
has_surfarray = False
try:
from PyWorld2D.rendering.tilers.beachtiler import BeachTiler
from PyWorld2D.rendering.tilers.basetiler import BaseTiler
from PyWorld2D.rendering.tilers.roundtiler import RoundTiler
from PyWorld2D.rendering.tilers.loadtiler import Lo... | YannThorimbert/PyWorld2D | rendering/tilers/tilemanager.py | Python | mit | 11,093 |
import os
import sys
def main(args):
if len(args) != 2:
print("Usage: python project-diff.py [path-to-project-1] [path-to-project-2]")
return
dir1 = args[0]
dir2 = args[1]
project1 = collect_text_files(dir1)
project2 = collect_text_files(dir2)
files_only_in_1 = []
files_only_in_2 = []
files_... | blakeohare/crayon | Scripts/project-diff.py | Python | mit | 5,511 |
from unittest import TestCase
from plivo import plivoxml
from tests import PlivoXmlTestCase
class SElementTest(TestCase, PlivoXmlTestCase):
def test_set_methods(self):
expected_response = '<Response><Speak><s><break strength="strong"/>' \
'<emphasis level="strong">This is Test... | plivo/plivo-python | tests/xml/test_sElement.py | Python | mit | 2,927 |
class Solution(object):
def wordPattern(self, pattern, str):
s = pattern
t = str.split()
# gets the index of each char within the string and generates a list
sDex = map(s.find, s)
# gets the index of each word within the array and generates a list
tDex = map(t.index,... | Jspsun/LEETCodePractice | Python/WordPattern.py | Python | mit | 407 |
import numpy as np
from numpy import linalg as la
import time
import subprocess
from streaming import Oja
from streaming import BlockOrthogonal
import MovieLens
if __name__ == "__main__":
#oja=Oja(Ceta=1e-3,k=1,stream=MovieLens.UserStream())
boi1=BlockOrthogonal(k=1,stream=MovieLens.User... | mitliagkas/pyliakmon | main.py | Python | mit | 931 |
recording = '''jtfxgqec
zxoeuddn
anlfufma
dxuuyxkg
ttnewhlw
sjoyeiry
rgfwwdhw
qymxsllk
forftdvy
rzmnmewh
hogawihi
mtsyexba
mrjzqqfk
ypmkexpg
pjuyopgv
rtqquvaj
evubmlrq
bqlrtuce
ndidnbps
vqukosam
mzdyfkcd
rrbwdimb
uhnvxgly
aaimxpcv
acxvinqj
muaeikzy
lhzbosjd
fflqqiit
unfhzfrs
gmwoyvob
cculubmy
zqbugcwa
ijouicwt
bildjjww... | Korred/advent_of_code_2016 | day_6_part_2.py | Python | mit | 5,783 |
template = ' R_{\\text{6Д}} = \dfrac{R_6}{1-K_{\\text{ОК}}} = 10 \cdot %.0f = %.0f~\\text{Ом}'%(R6,R6d) | shlopack/cursovaya | template/3_4.py | Python | mit | 108 |
from django.conf import settings
from django.core.checks import Error, register
@register
def check_threshold(app_configs, **kwargs):
'''
Checks if THRESHOLD is set on settings.py
'''
errors = []
if not hasattr(settings, 'THRESHOLD'):
errors.append(Error(
'settings must have th... | henriquenogueira/aedes | aedes_server/core/checks.py | Python | mit | 1,051 |
from ..core.bunk_user import BunkUser
"""
Metadata class for easy embeds when a duel has completed
"""
class DuelResult:
def __init__(self, chal: BunkUser, opnt: BunkUser, winner: BunkUser, loser: BunkUser):
self.challenger: BunkUser = chal
self.opponent: BunkUser = opnt
self.winner: BunkUs... | fugwenna/bunkbot | src/rpg/duel_result.py | Python | mit | 623 |
import rply
from ..lexer import lexers
__all__ = ('parsers',)
class Parsers(object):
def __init__(self):
self._fpg = None
self._fp = None
self._spg = None
self._sp = None
@property
def fpg(self):
if self._fpg is None:
self._fpg = rply.ParserGenerato... | funkybob/rattle | rattle/parser/__init__.py | Python | mit | 1,048 |
from flask import render_template, redirect, request, flash, session, jsonify, abort, Response, stream_with_context
from werkzeug import secure_filename
from flask.ext.login import login_required, current_user
from . import hacker_module as mod_hacker
from . import controllers as controller
from .forms import RateForm,... | hackBCA/missioncontrol | application/mod_hacker/views.py | Python | mit | 9,013 |
SECRET_KEY = "foo" | flosch/simpleapi | tests/settings.py | Python | mit | 18 |
#!/usr/bin/env python2.7
import feedparser
import sys
import string
# holds the feeds
feeds = []
Feed_list = []
kill = 'g'
tags = 'g'
# multiple feed list ... | pdm126/rss-crawler | dev.py | Python | mit | 4,063 |
"""
rate limiting strategies
"""
from abc import ABCMeta, abstractmethod
import weakref
import six
import time
@six.add_metaclass(ABCMeta)
class RateLimiter(object):
def __init__(self, storage):
self.storage = weakref.ref(storage)
@abstractmethod
def hit(self, item, *identifiers):
"""
... | duyet-website/api.duyet.net | lib/limits/strategies.py | Python | mit | 5,640 |
# vim: tabstop=4 shiftwidth=4 expandtab
# Copyright (c) 2008, Aldo Cortesi. All rights reserved.
#
# 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 limit... | nxnfufunezn/qtile | libqtile/manager.py | Python | mit | 59,901 |
liquors = [
'Njezjin', 'Tsjernigof', 'Ossipewsk', 'Gorlowka',
'Gomel',
'Konosja', 'Weliki Oestjoeg', 'Syktywkar', 'Sablja',
'Narodnaja', 'Kyzyl',
'Walbrzych', 'Swidnica', 'Klodzko', 'Raciborz', 'Gliwice',
'Brzeg', 'Krnov', 'Hradec Kralove',
'Leuk', 'Brig', 'Brienz', 'Thun', 'Sarnen', 'Burgle... | helgefmi/ohno | ohno/spoilers/shopkeeper.py | Python | mit | 4,485 |
"""Run MRJob to get the number of words per comment by subreddit."""
from mrjob.job import MRJob
from math import sqrt
import re
class MRCommentWordCount(MRJob):
def mapper(self, _, line):
cline = re.sub("[~`*>#().!?,\[]","",line)
cline2 = re.sub("(>)|(&)|(<)|\]"," ",cline).lower()
... | NosajGithub/subreddit_profiler | non_shiny _code/03_analysis_code/mrjob/mrjobCommentWordCount.py | Python | mit | 1,328 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from subprocess import call
from pyfasta.fasta import Fasta # Depends on fasta.py from https://github.com/brentp/pyfasta
def create_aligned_file(filename, gapopen=10, gapextend=0.5):
try:
f = Fasta(filename)
except:
print "Error: '",filename... | c-automate/sequence-editing-helpers | aligne_and_correct_sequences.py | Python | mit | 7,974 |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.txt')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.txt')) as f:
CHANGES = f.read()
requires = [
'pyramid',
'pyramid_chameleon',
'pyramid_d... | Akagi201/learning-python | pyramid/MyShop/setup.py | Python | mit | 1,213 |
#!/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... | miqui/python-hpOneView | examples/scripts/get-profiles.py | Python | mit | 4,576 |
#!/usr/bin/env python3
# transpiled with BefunCompile v1.3.0 (c) 2017
def td(a,b):
return ((0)if(b==0)else(a//b))
def tm(a,b):
return ((0)if(b==0)else(a%b))
x0=50
x1=0
x2=50
x3=88
x4=88
def _0():
return 1
def _1():
global x3
global x0
global x4
x3=x0
x4=x3+1
return 2
def _2():
g... | Mikescher/Project-Euler_Befunge | compiled/Python3/Euler_Problem-091.py | Python | mit | 1,054 |
import datetime
import os
import re
class WLError(Exception):
"""Base class for all Writelightly exceptions."""
class WLQuit(WLError):
"""Raised when user sends a quit command."""
def lastday(*args):
"""Return the last day of the given month.
Takes datetime.date or year and month, returns an integer... | thesealion/writelightly | writelightly/utils.py | Python | mit | 3,963 |
#!/usr/bin/env python3
# Uses the wikipedia module to define words on the command line
import wikipedia
import sys
sys.argv.pop(0)
for word in sys.argv:
try:
if word[0] != '-':
if '-full' in sys.argv:
print(wikipedia.summary(word))
else:
print(wikipedia.summary(word, sentences=1))
except:
print("... | dendory/scripts | wikipedia_define.py | Python | mit | 347 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def VirtualHardwareOption(vim, *args, **kwargs):
'''The VirtualHardwareOption data object... | xuru/pyvisdk | pyvisdk/do/virtual_hardware_option.py | Python | mit | 1,413 |
class ServiceUnavailable(Exception):
pass
class UnknownNode(Exception):
pass
class UnknownService(Exception):
pass
class ResourceException(Exception):
def __init__(self, error_message):
self.error_message = error_message
def __str__(self):
return self.__repr__()
def __repr_... | Lothiraldan/ZeroServices | zeroservices/exceptions.py | Python | mit | 434 |
from datetime import datetime
# pokemon lottery
global_lotto_last_run = datetime(1969, 12, 31, 23, 59, 59, 999999)
lotto_new_run = None
print_speed_base = 0.03 # delay between printed characters
""" Graphics Notes:
The screen is 15x11 squares in dimension. Each square is 16x16 pixels. Total
screen is 240x176. Sinc... | itsthejoker/Pokemon-Homage | lemonyellow/core/__init__.py | Python | mit | 1,110 |
from office365.runtime.client_value import ClientValue
class GroupSiteInfo(ClientValue):
def __init__(self):
super(GroupSiteInfo, self).__init__()
self.SiteStatus = None
self.SiteUrl = None
self.DocumentsUrl = None
self.ErrorMessage = None
self.GroupId = None
| vgrem/Office365-REST-Python-Client | office365/sharepoint/portal/group_site_info.py | Python | mit | 315 |
from sys import exit, version_info
import logging
logger = logging.getLogger(__name__)
try:
from smbus import SMBus
except ImportError:
if version_info[0] < 3:
logger.warning("Falling back to mock SMBus. This library requires python-smbus. Install with: sudo apt-get install python-smbus")
elif ver... | WayneKeenan/picraftzero | picraftzero/thirdparty/pimoroni/pantilthat/__init__.py | Python | mit | 1,293 |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 28 15:26:46 2016
@author: camacho
"""
import Kernel;reload(Kernel);kl = Kernel
import Kernel_likelihood;reload(Kernel_likelihood); lk= Kernel_likelihood
import Kernel_opt as opt
import numpy as np
import matplotlib.pyplot as pl
import george
import george.kernels as ge
... | jdavidrcamacho/Tests_GP | 02 - Programs being tested/02 - optimization test files/optimization tests 3/Atempt_tests.py | Python | mit | 8,673 |
# encoding: utf-8
import datetime
import os
from pysteam import shortcuts
import paths
from logs import logger
def default_backups_directory():
return os.path.join(paths.application_data_directory(), 'Backups')
def backup_filename(user, timestamp_format):
timestamp = datetime.datetime.now().strftime('%Y%m%d%H... | scottrice/Ice | ice/backups.py | Python | mit | 1,971 |
"""Database resource."""
import re
from acapi.resources.acquiaresource import AcquiaResource
from acapi.resources.backup import Backup
from acapi.resources.backuplist import BackupList
class Database(AcquiaResource):
"""Environment database."""
#: Valid keys for environment object.
valid_keys = ["db_cl... | skwashd/python-acquia-cloud | acapi/resources/database.py | Python | mit | 2,082 |
# 'microblog' is an example, change the model for your own.
from flask import g
from flask_admin import Admin
from flask_admin.contrib.sqla import ModelView
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
def register(app):
db = SQLAlchemy(app)
# flask command
@app.cli.command('in... | imxana/Flask_init | apps/models.py | Python | mit | 3,510 |
from issues.models import ReportedLink, ReportedUser
from issues.serializers import ReportedLinkSerializer, ReportedUserSerializer
class ReportedLinkAPI(object):
serializer_class = ReportedLinkSerializer
def get_queryset(self):
return ReportedLink.objects.all()
class ReportedLinkSelfAPI(object):
... | projectweekend/Links-API | links/issues/mixins.py | Python | mit | 849 |
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _
def validate_bug_tracker(input_url):
"""
Validates that an issue tracker URI string contains one `%s` Python format
specification type (no other types are supporte... | 1tush/reviewboard | reviewboard/admin/validation.py | Python | mit | 1,557 |
# issue/views_admin.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from .controllers import *
from .models import ALPHABETICAL_ASCENDING, Issue, OrganizationLinkToIssue
from admin_tools.views import redirect_to_sign_in_page
from config.base import get_environment_variable
from django.db.models import... | wevote/WeVoteServer | issue/views_admin.py | Python | mit | 60,986 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py | Python | mit | 16,766 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cluster import KMeans , MiniBatchKMeans
from test_helpers import TestHelpers
from time import time
###############################################################################
# Get data
helpers... | clemsos/mitras | tests/test_tfidf_scale_up_kmeans.py | Python | mit | 1,739 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_scale_set_managed_disk_parameters.py | Python | mit | 1,259 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.