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 sys
import imp
# Dependecy reloader for Emmet plugin
# The original idea is borrowed from
# https://github.com/wbond/sublime_package_control/blob/master/package_control/reloader.py
reload_mods = []
for mod in sys.modules:
if mod.startswith('emmet') and sys.modules[mod] != None:
reload_mods.append(mod)
mo... | sergeche/emmet-sublime | emmet/reloader.py | Python | mit | 659 |
"""Tests for elpy.ropebackend."""
import os
import shutil
import sys
import tempfile
import mock
from elpy import ropebackend
from elpy import rpc
from elpy.tests import compat
from elpy.tests.support import BackendTestCase
from elpy.tests.support import RPCGetCompletionsTests
from elpy.tests.support import RPCGetCo... | robin-liu-1983/emacs-robin.d | emacs.d/elpa/elpy-20160131.118/elpy/tests/test_ropebackend.py | Python | mit | 6,871 |
"""HTML form handling for web clients.
ClientForm is a Python module for handling HTML forms on the client
side, useful for parsing HTML forms, filling them in and returning the
completed forms to the server. It has developed from a port of Gisle
Aas' Perl module HTML::Form, from the libwww-perl library, but the
inte... | jasrusable/fun | venv/lib/python2.7/site-packages/twill/other_packages/_mechanize_dist/ClientForm.py | Python | gpl-2.0 | 124,260 |
from collections import OrderedDict
from datetime import datetime, timedelta
from io import BytesIO
import json
import uuid
from hpack.struct import HeaderTuple
from http.cookies import BaseCookie, Morsel
from hyperframe.frame import HeadersFrame, DataFrame, ContinuationFrame
from .constants import response_codes, h2... | nwjs/chromium.src | third_party/wpt_tools/wpt/tools/wptserve/wptserve/response.py | Python | bsd-3-clause | 30,417 |
import json
from coalib.bearlib import deprecate_settings
from coalib.bearlib.abstractions.Linter import linter
from dependency_management.requirements.GemRequirement import GemRequirement
from coalib.results.Result import Result
from coalib.results.SourceRange import SourceRange
from coala_utils.param_conversion impo... | IPMITMO/statan | coala-bears/bears/ruby/RubySmellBear.py | Python | mit | 8,585 |
#!/usr/bin/python
import sys
import os
import random
import string
import sqlite3
CREATE = """
CREATE TABLE IF NOT EXISTS hugetable (
id INTEGER PRIMARY KEY AUTOINCREMENT,
weirdtext TEXT,
crazynumber REAL
);
"""
def main():
if len(sys.argv) != 2:
sys.exit("please specify the db filename")
... | alephnaughty/sqlitebrowser | tests/createtestdb.py | Python | gpl-3.0 | 858 |
# Copyright (c) 2005 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list ... | hoangt/tpzsimul.gem5 | src/python/m5/main.py | Python | bsd-3-clause | 13,849 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Android-specific, installs pre-built profilers."""
import logging
import os
from telemetry import decorators
from telemetry.util import support_binaries... | markYoungH/chromium.src | tools/telemetry/telemetry/core/platform/profiler/android_prebuilt_profiler_helper.py | Python | bsd-3-clause | 998 |
# Copyright 2014 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 a... | gruter/bdutil | samples/word_count_mapper.py | Python | apache-2.0 | 1,454 |
# Copyright: (c) 2018, Pluribus Networks
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.netvisor import pn_admin_servic... | kvar/ansible | test/units/modules/network/netvisor/test_pn_admin_service.py | Python | gpl-3.0 | 2,394 |
"""
WE'RE USING MIGRATIONS!
If you make changes to this model, be sure to create an appropriate migration
file and check it in at the same time as your model changes. To do that,
1. Go to the edx-platform dir
2. ./manage.py schemamigration courseware --auto description_of_your_change
3. Add the migration file created... | rismalrv/edx-platform | lms/djangoapps/courseware/models.py | Python | agpl-3.0 | 15,447 |
from ._mod1_1_1_1_0_0 import *
from ._mod1_1_1_1_0_1 import *
from ._mod1_1_1_1_0_2 import *
from ._mod1_1_1_1_0_3 import *
from ._mod1_1_1_1_0_4 import * | asedunov/intellij-community | python/testData/completion/heavyStarPropagation/lib/_pkg1/_pkg1_1/_pkg1_1_1/_pkg1_1_1_1/_pkg1_1_1_1_0/__init__.py | Python | apache-2.0 | 154 |
from setuptools import setup
setup(
name='click-example-termui',
version='1.0',
py_modules=['termui'],
include_package_data=True,
install_requires=[
'click',
# Colorama is only required for Windows.
'colorama',
],
entry_points='''
[console_scripts]
te... | Akasurde/click | examples/termui/setup.py | Python | bsd-3-clause | 347 |
"""
FastCGI server that implements the WSGI protocol.
Uses the flup python package: http://www.saddi.com/software/flup/
This is a adaptation of the flup package to add FastCGI server support
to run Django apps from Web servers that support the FastCGI protocol.
This module can be run standalone or from the django-adm... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-0.96/django/core/servers/fastcgi.py | Python | bsd-3-clause | 5,506 |
from django.contrib.auth import models as auth_app
from django.contrib.auth.management import create_permissions
from django.contrib.auth.models import User, Group
from django.contrib.contenttypes.models import ContentType
from django.core.management import call_command
from django.test import TestCase
from guardian.u... | k4ml/jazzpos | vendor/guardian/tests/orphans_test.py | Python | mit | 3,329 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | bjolivot/ansible | lib/ansible/executor/process/worker.py | Python | gpl-3.0 | 5,884 |
def foo(x):
"""
:type x: collections.MutableMapping
:rtype: dict
"""
return {v: k for k, v in x.iteritems()}
d = dict(a=1, b=2)
foo(d)
l = [i for i in range(10)]
foo(<warning descr="Expected type 'MutableMapping', got 'List[int]' instead">l</warning>) | asedunov/intellij-community | python/testData/inspections/PyTypeCheckerInspection/MutableMapping.py | Python | apache-2.0 | 273 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | ghchinoy/tensorflow | tensorflow/python/estimator/canned/head.py | Python | apache-2.0 | 1,268 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Shaun Zinck <shaun.zinck at gmail.com>
# Copyright (c) 2015 Lawrence Leonard Gilbert <larry@L2G.to>
# Copyright (c) 2016 Jasper Lievisse Adriaanse <j at jasper.la>
#
# Written by Shaun Zinck
# Based on pacman module written by Afterburn <http://github.com/... | pilou-/ansible | lib/ansible/modules/packaging/os/pkgin.py | Python | gpl-3.0 | 10,996 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | wangxiangyu/horizon | horizon/middleware.py | Python | apache-2.0 | 9,937 |
#!/usr/bin/env python
#
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Signs and zipaligns split APKs.
This script is require only by GYP (not GN).
"""
import optparse
import sys
import finalize_apk
... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/build/android/gyp/finalize_splits.py | Python | mit | 1,786 |
SOCIAL_AUTH_SETTINGS = {
'SOCIAL_AUTH_LOGIN_URL': '/',
'SOCIAL_AUTH_LOGIN_REDIRECT_URL': '/done',
'SOCIAL_AUTH_USER_MODEL': 'example.models.User',
'SOCIAL_AUTH_LOGIN_FUNCTION': 'example.auth.login_user',
'SOCIAL_AUTH_LOGGEDIN_FUNCTION': 'example.auth.login_required',
'SOCIAL_AUTH_AUTHENTICATION_... | joelstanner/python-social-auth | examples/pyramid_example/example/settings.py | Python | bsd-3-clause | 2,415 |
from __future__ import absolute_import, division, unicode_literals
try:
from collections import OrderedDict
except ImportError:
try:
from ordereddict import OrderedDict
except ImportError:
OrderedDict = dict
import re
from pip._vendor.six import string_types
from . import base
from .._ut... | BitWriters/Zenith_project | zango/lib/python3.5/site-packages/pip/_vendor/html5lib/treewalkers/etree.py | Python | mit | 4,684 |
from django.core.cache import cache
from django.template import Context, Engine, TemplateSyntaxError
from django.test import SimpleTestCase, override_settings
from ..utils import setup
class CacheTagTests(SimpleTestCase):
libraries = {
'cache': 'django.templatetags.cache',
'custom': 'template_tes... | wkschwartz/django | tests/template_tests/syntax_tests/test_cache.py | Python | bsd-3-clause | 7,021 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | diogocs1/comps | web/addons/delivery/__openerp__.py | Python | apache-2.0 | 1,902 |
"""
The :mod:`sklearn.metrics` module includes score functions, performance metrics
and pairwise metrics and distance computations.
"""
from .ranking import auc
from .ranking import average_precision_score
from .ranking import coverage_error
from .ranking import label_ranking_average_precision_score
from .ranking imp... | valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/sklearn/metrics/__init__.py | Python | gpl-2.0 | 3,440 |
# -*- coding: utf-8 -*-
"""dependenpy node module."""
import json
import sys
from .structures import Graph, Matrix, TreeMap
class NodeMixin(object):
"""Shared code between DSM, Package and Module."""
@property
def ismodule(self):
"""Property to check if object is instance of Module."""
... | Pawamoy/dependenpy | src/dependenpy/node.py | Python | isc | 11,560 |
from django import template
import sys
register = template.Library()
@register.assignment_tag
def wafer_form_helper(helper_name):
'''
Find the specified Crispy FormHelper and instantiate it.
Handy when you are crispyifying other apps' forms.
'''
module, class_name = helper_name.rsplit('.', 1)
... | CarlFK/wafer | wafer/registration/templatetags/wafer_crispy.py | Python | isc | 466 |
#! /usr/bin/env python
# Baxter needs an orientation quaternion instead of a rotational matrix. This script will help you calculate that.
import math
import numpy
###########
# Data: remove this when implementing the script in your code
X = numpy.matrix([-0.35166069, 0.87973912, -0.31999036])
Y = numpy.matrix([-0.8... | smdth/mimLab | rot2quaternion.py | Python | isc | 978 |
import os
import unittest2
import mock
from flask import json, current_app
from flask_alfred_db import AlfredDB
from msgpack import packb
from alfred_db.models import Repository, Push, Base
from alfred_listener import create_app
from alfred_listener.database import db
from alfred_listener.helpers import parse_hook_da... | alfredhq/alfred-listener | tests/__init__.py | Python | isc | 7,460 |
import zmq
import sys
port = "5556"
if len(sys.argv) > 1:
port = sys.argv[1]
int(port)
if len(sys.argv) > 2:
port1 = sys.argv[2]
int(port1)
context = zmq.Context()
print "Connecting to server..."
socket = context.socket(zmq.REQ)
socket.connect ("tcp://localhost:%s" % port)
if len(sys.argv) > 2:
... | andreydelpozo2/breadcrumbs | zmqtest/reqrep_client.py | Python | mit | 623 |
# ----------------------------------------------------------------------------------------------------------------------
#
# Generic Examples
#
# ----------------------------------------------------------------------------------------------------------------------
# ----------------------------------------------------... | idimitrakopoulos/illuminOS | lib/examples.py | Python | mit | 6,738 |
# 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/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_firewall_rules_operations.py | Python | mit | 18,869 |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.nc/status_registered
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.parser import parse as t... | huyphan/pyyawhois | test/record/parser/test_response_whois_nc_status_registered.py | Python | mit | 3,601 |
from flask.ext.mail import Mail, Message
from run import mail
#Sends email notifying user about posted route
def sendValidationEmail(to, url):
header = 'Allez Viens Validation'
sender = 'verify@allezviens.com'
replyTo = 'noreply@allezviens.com'
url = 'allez-viens.herokuapp.com/trip/' + url
body = "Please click <a... | jimgong92/allezViens | communication.py | Python | mit | 1,297 |
from flask import Flask, jsonify, make_response, request
from src.twitter import tweet
from src.sensor import get_temperature_celsius
app = Flask(__name__)
# Routes
@app.route('/hello', methods=['GET'])
def hello_world():
return jsonify({'hello': 'world'})
@app.route('/tweet', methods=['GET'])
def send_tweet... | Andruschenko/lora-remote-server | app.py | Python | mit | 1,443 |
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
NOTIFY_MANAGERS = getattr(
settings, 'CMS_FEEDBACK_NOTIFY_MANAGERS', True)
DEFAULT_NOTIFY_SUBJECT = _('New feedback')
NOTIFY_SUBJECT = getattr(
settings, 'CMS_FEEDBACK_NOTIFY_SUBJECT', DEFAULT_NOTIFY_SUBJECT)
| satyrius/cmsplugin-feedback | cmsplugin_feedback/settings.py | Python | mit | 308 |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HPP1_CompleteLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HPP1_CompleteLHS.
"""
# Flag this ins... | levilucio/SyVOLT | UMLRT2Kiltera_MM/Properties/from_thesis/HPP1_CompleteLHS.py | Python | mit | 38,327 |
# coding: utf-8
from contextlib import closing
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import RidgeCV
from sklearn.model_selection import GridSearchCV
from sklearn.svm import SVR
import numpy as np
import pandas as pd
from jinja2 import Environment, FileSystemLoader
import databa... | tomerun/atcoder_statistics | src/batch/guess_point.py | Python | mit | 4,083 |
# encoding: utf-8
# Fra https://itgk.idi.ntnu.no/oving/index.php?parallell=1
# https://itgk.idi.ntnu.no/oving/2014/skumleskogen2.py
keys = 0
cur = None # current node
# En node er en dictionary med følgende felt:
def make_node(number):
return {"number":number, "label":None, "parent":None, "left":None, "right":None}
... | krissrex/python_projects | Projects/Oving10-itgk/skumleskogen2.py | Python | mit | 7,224 |
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(25, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
input_state1 = GPIO.input(18)
input_s... | mleonard87/whatsthatsong | controller/buttons_test.py | Python | mit | 649 |
from __future__ import print_function
from show3d_balls import *
import argparse
import os
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
import torchvision.datasets as dset
import torc... | fxia22/pointGAN | show_gan_comp.py | Python | mit | 1,664 |
import datetime
from django.conf import settings
settings.EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'
settings.AUTH_PROFILE_MODULE = 'pigeonpost_example.Profile'
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.core import mail
from... | dragonfly-science/django-pigeonpost | pigeonpost/tests.py | Python | mit | 12,077 |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""
RPGDice - a tool to investigate the dice rules of different RPG systems.
"""
__author__ = 'Timid Robot Zehta'
__version__ = '0.0.1'
__licence__ = 'MIT'
| TimZehta/rpgdice | rpgdice/__init__.py | Python | mit | 211 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.stacklayout import StackLayout
from kivy.graphics import Rectangle, Color, Line
from kivy.uix.label import Label
from chess.board import Board
from iconbutton import IconButton
red = [1., 0., 0., 1.]
yellow = [1... | victor-rene/chess-intuition | chessgrid.py | Python | mit | 6,513 |
import time
import os
import shutil
import subprocess
import platform
import sys
from subprocess import Popen, PIPE
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 = O... | nwjs/nw.js | test/sanity/issue6056-spawn-crash/test.py | Python | mit | 721 |
import unittest
from kairosdbclient.rest.apirequests.save_metric_datapoints import SaveMetricDataPointsRequest, MetricDataPoints
class SaveMetricDataPointsRequestTest(unittest.TestCase):
def test_save_metric_data_points_request(self):
data_points = MetricDataPoints('metric', [[100, 5.4]], ttl=0, host='azu... | FrEaKmAn/kairosdb-python-client | tests/rest/apirequests/test_save_metric_datapoints_request.py | Python | mit | 815 |
from curses import wrapper
import curses
from t3.screen import WrappingPoint
curses.initscr()
curses.cbreak()
def main(stdscr):
stdscr.clear()
stdscr.move(0,0)
stdscr.refresh()
y,x= stdscr.getyx()
location = WrappingPoint(stdscr.getmaxyx(),x=x,y=y)
while True:
current = stdscr.getke... | girishramnani/t3 | trials/location_fun.py | Python | mit | 644 |
import gzip
import json
from hashlib import md5
from concurrent import futures
from operator import itemgetter
import requests
from .utils import prepare_url
from . import BASE
class InvalidReferenceData(Exception):
pass
def _load_single_file(url):
r = requests.get(url['url'])
data = gzip.decompress(r... | Mause/pytransperth | transperth/silver_rails/reference_data.py | Python | mit | 1,874 |
# -*- coding: utf-8 -*-
from .configuration import read_configuration
from .webdoc import process_screenshots, get_screenshots
def main(config_path=None):
config = read_configuration(config_path)
process_screenshots(get_screenshots(config.folder), config)
| bjornarg/skald | skald/main.py | Python | mit | 265 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_rule_py3.py | Python | mit | 5,523 |
import os
from tests import test_client_credentials, create_unique_name
from tests.sharepoint.sharepoint_case import SPTestCase
from office365.sharepoint.changes.change_query import ChangeQuery
from office365.sharepoint.files.file import File
from office365.sharepoint.lists.list import List
from office365.sharepoint.... | vgrem/Office365-REST-Python-Client | tests/sharepoint/test_file.py | Python | mit | 8,303 |
import os
SQLALCHEMY_DATABASE_URI=os.environ['DATABASE_URL']
| Opshun/API | config.py | Python | mit | 62 |
#-------------------------------------------------------------------------------
# Name: circle_detector2.py
# Purpose: To provide detector that detects number of line in a given area
# for each considered pixel.
#-------------------------------------------------------------------------------
im... | bzohidov/TomoRain | linkquality/circle_detector2.py | Python | mit | 2,636 |
import pytest
import time
@pytest.fixture
def dep(request):
time.sleep(0.3)
return None
def test_simple1(dep):
time.sleep(0.2)
def test_simple2(dep):
time.sleep(0.2)
| baverman/flameprof | tests/sample_test.py | Python | mit | 188 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core
import numpy as np
class ParameterTags(object):
BIAS = 'BIAS'
WEIGHT = 'WEIGHT'
COMPUTED_PARAM = 'COMPUTED_PARAM'
class Pa... | ryfeus/lambda-packs | pytorch/source/caffe2/python/modeling/parameter_info.py | Python | mit | 1,583 |
import os
from flask_appbuilder.security.manager import AUTH_DB
basedir = os.path.abspath(os.path.dirname(__file__))
# Your App secret key
SECRET_KEY = '\2\1thisismyscretkey\1\2\e\y\y\h'
# The SQLAlchemy connection string.
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db')
#SQLALCHEMY_DATABASE_U... | danlurie/bdpdb | bdpdb/config.py | Python | mit | 3,591 |
'''takes a 2 dimenstional array that represents data points in a n dimensional
space and labels s.t the ith label corresponds to the ith data points
returns a hyperplane consisting of a vector normal to a separating hyperplane
and a point it passes through'''
def train(data, labels):
class0 = []
class1 = []
... | chsahit/sillysvm | sillysvm.py | Python | mit | 2,647 |
#!/usr/bin/env python
from lxml import etree
import re
import json
import locale
import ec2
from six.moves.urllib import request as urllib2
# Following advice from https://stackoverflow.com/a/1779324/216138
# The locale must be installed in the system, and it must be one where ',' is
# the thousans separator and '.' ... | powdahound/ec2instances.info | scrape.py | Python | mit | 32,540 |
from Expression import *
class PredicateExpression(Expression):
"""
Class representing a predicate expression node in the AST
"""
def __init__(self, name, arguments, expression = None):
"""
:param name : Identifier
:param arguments : Declarations
:param expressio... | rafaellc28/Latex2MiniZinc | latex2minizinc/PredicateExpression.py | Python | mit | 1,722 |
"""
Edit Search chain dialog.
Licensed under MIT
Copyright (c) 2017 Isaac Muse <isaacmuse@gmail.com>
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 limitat... | facelessuser/Rummage | rummage/lib/gui/dialogs/edit_search_chain_dialog.py | Python | mit | 7,014 |
import sys
import os
p1, p2 = sys.version_info[:2]
curpath = os.path.abspath( sys.argv[0] )
if os.path.islink(curpath):
curpath = os.readlink(curpath)
currentdir = os.path.dirname( curpath )
build_dir = os.path.abspath( os.path.join(currentdir, "lib-dynload", "_llfuse", "build") )
if not os.path.isdir(build_dir)... | sergey-dryabzhinsky/dedupsqlfs | lib-dynload/_llfuse/__init__.py | Python | mit | 961 |
"""Unit tests for reviewboard.reviews.ui.image.ImageReviewUI."""
from djblets.util.templatetags.djblets_images import crop_image
from reviewboard.admin.server import build_server_url
from reviewboard.reviews.ui.image import ImageReviewUI
from reviewboard.testing import TestCase
class ImageReviewUITests(TestCase):
... | reviewboard/reviewboard | reviewboard/reviews/tests/test_image_review_ui.py | Python | mit | 2,681 |
"""empty message
Revision ID: 6e469162ab8f
Revises: 70d0db914e82
Create Date: 2016-03-19 00:52:56.464140
"""
# revision identifiers, used by Alembic.
revision = '6e469162ab8f'
down_revision = '70d0db914e82'
from alembic import op
import app
import sqlalchemy as sa
def upgrade():
### commands auto generated by... | Maethorin/concept2 | migrations/versions/6e469162ab8f_.py | Python | mit | 1,321 |
"""Prepares a distribution for installation
"""
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
import logging
import mimetypes
import os
import shutil
from pip._vendor import requests
from pip._vendor.six import PY2
from pip._internal.distributions import (
... | davidharvey1986/pyRRG | unittests/bugFixPyRRG/lib/python3.7/site-packages/pip/_internal/operations/prepare.py | Python | mit | 20,030 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Brendan Quinn, Clueful Media Ltd / JT-PATS Ltd
#
# The MIT License
#
# 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, includ... | bquinn/pats-api-python | pats/test_core.py | Python | mit | 1,285 |
# -*- coding: utf-8 -*-
"""
edict
~~~~~
"""
import argparse
import inspect
import sys
class Application:
"""
The central object of edict, this is used to define a new CLI application.
.. versionadded:: 1.0
"""
#: The application's name
#: .. versionadded:: 1.0
name = None
#: T... | chrisguitarguy/edict | edict.py | Python | mit | 3,315 |
import math
import matplotlib.patches
import matplotlib.pyplot
import numpy.random
from matplotlib.path import Path
def calculate_angle(source, point):
x0, y0 = source
x1, y1 = point
dx = x1 - x0
dy = y1 - y0
angle = math.atan2(dy, dx)
return (angle, point)
def calculate_angles(source, points... | jeeyoungk/exercise | python/convexhull.py | Python | mit | 3,569 |
import datetime
from django.db import connections
from django.db.models import Count
from django.db.models import F
from django.db.models import Q
from django.db.models import Sum
from django.db.utils import DatabaseError
from django.db.utils import OperationalError
from rest_framework import pagination
from rest_fram... | mrpau/kolibri | kolibri/plugins/coach/api.py | Python | mit | 15,625 |
import os
from requests.exceptions import ConnectionError, HTTPError, Timeout
from unittest import mock
from django.core.urlresolvers import reverse
from django.test import TestCase
from .exceptions import BadRequest, ServiceUnavailable
from .helpers import make_rest_get_call, make_rest_post_call
class HelpersTestC... | istrategylabs/franklin-api | franklin/core/tests.py | Python | mit | 3,827 |
# -*- coding: utf8 -*-
# Copyright (C) 2013 - Oscar Campos <oscar.campos@member.fsf.org>
# This program is Free Software see LICENSE file for details
"""
Anaconda is a python autocompletion and linting plugin for Sublime Text 3
"""
import os
import sys
import logging
from string import Template
import sublime
impor... | thatneat/dotfiles | other_applications/sublime-text-3/Packages/Anaconda/anaconda.py | Python | mit | 2,768 |
def main(args):
# this is the main entry point of the kitten, it will be executed in
# the overlay window when the kitten is launched
answer = input('Enter some text: ')
# whatever this function returns will be available in the
# handle_result() function
return answer
def handle_result(args, answer, ... | eggcaker/dotfiles | kitty/mykitten.py | Python | mit | 489 |
from django.shortcuts import render
from .models import FormDemo
from .forms import SimpleFormDemoForm, CrispyFormDemoModelForm
def formDemoIndex(request):
return render(request, 'form_demo/index.html', {'title':'Demo for Forms'})
def showSimpleFormDemoForm(request):
msg=""
if request.method == 'POST':... | lerina/agileForms | apps/form_demo/views.py | Python | mit | 2,167 |
# -*- coding: UTF-8 -*
'''
email utils
~~~~~~~~~~~~~~~~
build an email contains qrcode and send it.
:copyright: 20160211 by raptor.zh@gmail.com.
'''
from io import BytesIO
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
import s... | raptorz/userga | mail.py | Python | mit | 7,373 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
"""Usage: slidie.py NAME
[-t T]
[-q Q]
[--p0 P0]
[--pn PM]
[--dt DT]
[--seed SEED]
[--min_P MP]
[--sigma SIGMA]
Wilcon-Cowan EI model, where the oscillation frequency ... | voytekresearch/bw | slidie.py | Python | mit | 2,871 |
import os
from pyramid.config import Configurator
from sqlalchemy import engine_from_config
from .models import Session, Base
def main(global_config, **settings):
"""
Configure and return a WSGI application.
"""
settings['sqlalchemy.url'] = os.environ.get('DATABASE_URL')
engine = engine_from_confi... | recombinators/snapsat | app/app/__init__.py | Python | mit | 1,155 |
# coding: utf8
# Copyright 2015 Vincent Jacques <vincent@vincent-jacques.net>
from .ax_12 import AX12
from .ax_s1 import AXS1
| jacquev6/Pynamixel | Pynamixel/devices/__init__.py | Python | mit | 128 |
#!/usr/bin/env python3
from linklist import *
class Solution(object):
def reorderList(self, head):
if head == None:
return
queue = []
while head:
queue.append(head)
head = head.next
i, j = 0, len(queue)-1
while i < j:
queue[i]... | eroicaleo/LearningPython | interview/leet/143_Reorder_List_v2.py | Python | mit | 684 |
from flask.ext.wtf import Form
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import Required, Email, Length, Regexp, EqualTo
from wtforms import ValidationError
from ..models import User
class LoginForm(Form):
email = StringField('Email', validators=[Required(),... | HoracioAlvarado/fwd | app/auth/forms.py | Python | mit | 1,486 |
import os.path
import yaml
import logging
CONFIG_PATH = os.path.join(os.path.dirname(__file__), 'settings.yaml')
logger = logging.getLogger(__name__)
try:
with open(CONFIG_PATH, 'rb') as fh:
config = yaml.load(fh)
except FileNotFoundError:
logging.error('Config file was not found: settings.yaml')
... | vv-p/jira-reports | settings.py | Python | mit | 1,303 |
#encoding: utf-8
"""
grid.place_network -- Place network model driven by grid-cell inputs, with
competition mediated by global inhibtion
Written by Joe Monaco
Copyright (c) 2007, 2008 Columbia University. All rights reserved.
"""
# Library imports
import numpy as N
# Package imports
from .dmec import GridCollec... | jdmonaco/grid-remapping-model | src/place_network.py | Python | mit | 10,180 |
#!/usr/bin/env python
from __future__ import print_function
import shutil
import unittest
from ruffus.drmaa_wrapper import write_job_script_to_temp_file, read_stdout_stderr_from_files
import ruffus.drmaa_wrapper
import ruffus
import sys
"""
test_drmaa_wrapper_run_job_locally.py
"""
import os
script_dir = os.pat... | bunbun/ruffus | ruffus/test/test_drmaa_wrapper_run_job_locally.py | Python | mit | 6,085 |
from argparse import Namespace
from typing import Tuple
from pymap.config import IMAPConfig
from pymap.interfaces.session import LoginProtocol
from .session import Session
from .config import Config
__all__ = ['add_subparser', 'init']
def add_subparser(subparsers) -> None:
parser = subparsers.add_parser('maild... | icgood/pymap-maildir | pymap_maildir/__init__.py | Python | mit | 878 |
# 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/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_information_protection_policies_operations.py | Python | mit | 12,061 |
# coding=utf-8
# __author__ = 'mio'
def auth_mixin():
"""
@apiDefine AuthHeaderMixin
@apiHeaderExample Auth-Header-Example:
{
"Authorization": "token 78323lj4l32l3l23j2n2l22jl"
}
@apiHeader {String} Authorization 验证身份,注意格式中"token {token}"token后面有一个空格
"""
pass
def ... | boisde/Greed_Island | openapi_doc/lazy_cat_open_api_bulk_send.py | Python | mit | 21,871 |
from pygraphviz import AGraph
import itertools
import base64
def get_png_bytes(saf, **options):
g = get_graphviz(saf, **options)
return base64.b64encode(g.draw(format='png', prog='dot'))
def get_graphviz(saf):
"""
Create a pygraphviz graph from the SAF dependencies
"""
g = AGraph(directed=True... | vanatteveldt/saf | saf/visualize.py | Python | mit | 1,686 |
from fabric.api import *
def create_database():
"""Creates role and database"""
db_user = 'fit'
db_pass = 'password'
db_name = 'fit_content'
sudo('psql -c "DROP DATABASE IF EXISTS %s"' % db_name, user='postgres')
sudo('psql -c "DROP ROLE IF EXISTS %s"' % db_user, user='postgres')
sudo('psql... | kapucko/fit2gether | fabfile.py | Python | mit | 652 |
# Copyright (c) 2014 Michael Strosaker
# MIT License
# http://opensource.org/licenses/MIT
import os, sys
from distutils.core import setup
try:
with open('README.rst', 'rt') as readme:
description = readme.read()
except IOError:
description = ''
setup(
# metadata
name='hmm',
description='H... | mstrosaker/hmm | setup.py | Python | mit | 784 |
# -*- coding: utf-8 -*-
# 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
def is_prime(n):
if n == 2:
return True
else:
r = math.floor(math.sqrt(n)) # n rounded to the greatest integer r so... | songtao-yang/ProjectEuler-Python | 7.10001st prime/problem_7.py | Python | mit | 753 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutClassMethods in the Ruby Koans
#
from runner.koan import *
class AboutClassAttributes(Koan):
class Dog:
pass
def test_objects_are_objects(self):
fido = self.Dog()
self.assertEqual(True, isinstance(fido, object))
def... | kernbeisser/python_koans | python3/koans/about_class_attributes.py | Python | mit | 4,796 |
config ={
'modelfile':'mujoco_models/sawyer/sawyer.xml',
'T': 2000
} | febert/RoboGym | configs/sawyer.py | Python | mit | 68 |
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 06 06:36:03 2015
@author: lzz
定义一个 prime() 函数求整数 n 以内(不包括n)的所有素数(1不是素数),并返回一个按照升序排列的素数列表。使用递归来实现一个二分查找算法函数bi_search(),该函数实现检索任意一个整数在 prime() 函数生成的素数列表中位置(索引)的功能,并返回该位置的索引值,若该数不存在则返回 -1。
输入格式:
第一行为正整数 n
接下来若干行为待查找的数字,每行输入一个数字
输出格式:
每行输出相应的待查找数字的索引值
输入样例:
... | lzz5235/Code-Segment | Python/prime_index.py | Python | mit | 1,520 |
from sqlalchemy import Column, String, DateTime, Integer
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
TABLES = {
'hash': 'hashes'
}
class ImageHash(Base):
__tablename__ = TABLES['hash']
image_hash = Column(String(16), primary_key=True)
image_filename = Column(St... | tistaharahap/images-dhash | models/objects.py | Python | mit | 840 |
# coding: utf-8
import pip
def import_or_install(package):
try:
__import__(package)
except ImportError:
pip.main(['install', package])
# In[21]:
import_or_install("json")
import_or_install("azure.common.credentials")
import_or_install("azure.mgmt.resource")
import_or_install("azure.mgmt.... | dstolts/Azure_Classroom | Python/deployStudentVM.py | Python | mit | 6,844 |
# -*- coding: utf-8 -*-
"""Includes all the fields classes from `marshmallow.fields` as well as
fields for serializing JSON API-formatted hyperlinks.
"""
from marshmallow import ValidationError
# Make core fields importable from marshmallow_jsonapi
from marshmallow.fields import * # noqa
from marshmallow.utils import ... | Tim-Erwin/marshmallow-jsonapi | marshmallow_jsonapi/fields.py | Python | mit | 5,972 |
# -*- coding: utf-8 -*-
import pytest
from dotenvfile import loads
def test_valid_envfile():
lines = loads('\n'.join([
'FOO=1',
'BAR=abc',
]))
assert lines == {
'FOO': '1',
'BAR': 'abc',
}
def test_continuing_line():
lines = loads('\n'.join([
'FOO=abc\\... | smartmob-project/dotenvfile | tests/test_parser.py | Python | mit | 951 |
from multiprocessing import Lock
import pytest
from dash import Dash, Input, Output, dcc, html
from dash.testing.wait import until
def test_rdls001_multi_loading_components(dash_duo):
lock = Lock()
app = Dash(__name__)
app.layout = html.Div(
children=[
html.H3("Edit text input to se... | plotly/dash | tests/integration/renderer/test_loading_states.py | Python | mit | 9,265 |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | plaid/plaid-python | plaid/model/sandbox_bank_transfer_simulate_request.py | Python | mit | 8,024 |
import base64
import json
from kounta.objects import Company
try:
import urllib.request as urllib2
except ImportError:
import urllib2
class BasicClient:
"""
BasicClient makes sure the same URL requested will not make another external
request by caching the results of that URL for the lifetime of t... | elliotchance/kounta-python | kounta/client.py | Python | mit | 2,510 |
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function, unicode_literals
from scrapy.contrib import exporter
class JsonItemExporter(exporter.JsonItemExporter):
"""不启用 ensure_ascii 的 JsonItemExporter"""
def __init__(self, file, **kwargs):
self._configure(kwargs)
... | D6C92FE5/oucfeed.crawler | oucfeed/crawler/exporters.py | Python | mit | 1,012 |