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 unittest from test.stub_environment import StubEnvironment from googkit.commands.command import Command from googkit.commands.sequence import SequenceCommand from googkit.compat.unittest import mock class DummyFooCommand(Command): pass class DummyBarCommand(Command): pass class TestSequenceComman...
googkit/googkit
test/commands/test_sequence.py
Python
mit
1,073
''' This script is intended to run a set of POS experiments by varying the amount of training data used to produce a curve. @author: rgeorgi ''' import argparse from utils.argutils import configfile, existsfile, writedir from corpora.POSCorpus import POSCorpus import os from interfaces.stanford_tagger import StanfordP...
rgeorgi/intent
intent/scripts/pos/run_data_curve.py
Python
mit
3,174
import unittest from tests.core import TestCore from pyrep import PyRep from pyrep.objects.dummy import Dummy import numpy as np from os import path from pyrep.robots.mobiles.youbot import YouBot from pyrep.robots.mobiles.turtlebot import TurtleBot from pyrep.robots.mobiles.line_tracer import LineTracer ASSET_DIR = p...
stepjam/PyRep
tests/test_mobiles_and_configuration_paths.py
Python
mit
3,195
# -*- coding: utf-8 -*- from app import app # Start point if __name__ == '__main__': app.run(debug=True)
naznadmn/Compression.io
run.py
Python
mit
110
from L500analysis.data_io.get_cluster_data import GetClusterData from L500analysis.utils.utils import aexp2redshift from L500analysis.plotting.tools.figure_formatting import * from L500analysis.plotting.profiles.tools.profiles_percentile \ import * from L500analysis.utils.constants import rbins, linear_rbins from d...
cavestruz/L500analysis
plotting/profiles/T_Vr_evolution/Tnt_Vr_evolution/plot_Tnt_Vr_r500c.py
Python
mit
2,927
import ckan.plugins.toolkit as toolkit log = __import__('logging').getLogger(__name__) country_vocab = 'country_names' def country_names(): import pycountry # Create the tag vocabulary if it doesn't exist user = toolkit.get_action('get_site_user')({'ignore_auth': True}, {}) context = {'user': user['...
energy-data/energydata.info
ckanext-extrafields/ckanext/extrafields/helpers.py
Python
mit
4,544
# coding=utf-8 r""" This code was generated by \ / _ _ _| _ _ | (_)\/(_)(_|\/| |(/_ v1.0.0 / / """ from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.l...
tysonholub/twilio-python
twilio/rest/lookups/v1/phone_number.py
Python
mit
9,203
class Solution(object): def summaryRanges(self, nums): """ :type nums: List[int] :rtype: List[str] """ if len(nums) == 0: return [] if len(nums) == 1: return [str(nums[0])] ret = [] head = nums[0] last = nums[0] for i in range(1, len(nums)): val = nums[i] if val-last > 1: if last ==...
xingjian-f/Leetcode-solution
228. Summary Ranges QuestionEditorial Solution.py
Python
mit
580
#Brought to you by Jeremy Rubin, 2013 config = dict( # your app's name name="APP_NAME", #port - can still be overwritten via cli args default_port="8000", #static file dir static_location="static", # Where static files are located #useful for enabling devmode/production features # ie,...
JeremyRubin/tornado-trails
config.py
Python
mit
786
question_list = [ # (mark, count, [directories]) # math demo (1,1,'crc/crc_'), (1,1,'hamming/fill_check_bits_'), # move to earlier section (1, 1, 'eop/chapter3/hello_world_io_forward_0'), (1, 1, 'eop/chapter3/hello_world_io_backward_0'), # Section 3.2 Assignment (1, 1, 'eop/chapter3/swap_io_0'), # Figure 3.1...
stryder199/RyarkAssignments
Assignment2/quizzes/eop_chapter3.py
Python
mit
1,692
# -*- coding: utf-8 -*- #------------------------------------------------------------------------------- # Name: corpus/virtual.py # Purpose: Access to the Virtual corpus collection # # Authors: Christopher Ariza # # Copyright: Copyright © 2010, 2012 Michael Scott Cuthbert and the music21 Project ...
arnavd96/Cinemiezer
myvenv/lib/python3.4/site-packages/music21/corpus/virtual.py
Python
mit
7,729
from django.core.exceptions import ImproperlyConfigured from django.core.management.base import BaseCommand from django.db.models import get_models, get_app from django.contrib.auth.management import create_permissions class Command(BaseCommand): args = '<app app ...>' help = 'reloads permissions for specifie...
gdoermann/django-limbo
limbo/management/commands/update_permissions.py
Python
mit
859
from __future__ import unicode_literals import pytest from design_patterns.observer import Subject @pytest.fixture def subject(): return Subject() def test_subscribe(subject): result = [] def func(*args, **kwargs): result.append((args, kwargs)) subject.subscribe(func) subject(1, 2, ...
victorlin/design-patterns
tests/test_observer.py
Python
mit
1,197
#!/usr/bin/env python import cmd class Illustrate(cmd.Cmd): "Illustrate the base class method use." def cmdloop(self, intro=None): print('cmdloop(%s)' % intro) return cmd.Cmd.cmdloop(self, intro) def preloop(self): print('preloop()') def postloop(self): print('postloo...
tleonhardt/CodingPlayground
python/cmd/override_base.py
Python
mit
1,238
from collections import Counter def life(before): """ Takes as input a state of Conway's Game of Life, represented as an iterable of ``(int, int)`` pairs giving the coordinates of living cells, and returns a `set` of ``(int, int)`` pairs representing the next state """ before = set(before) ...
jwodder/ghutil
test/data/files/life.py
Python
mit
600
from constants import * import pygame as pg from time import sleep from metronome import * import math import numpy as np from copy import deepcopy from audio import * from instructions_panel import * from loop import * class MusicMaker: def __init__(self, screen): self.pitch = 0 self.screen = scr...
kenanbit/loopsichord
music_maker.py
Python
mit
20,511
import _plotly_utils.basevalidators class TicklabelstepValidator(_plotly_utils.basevalidators.IntegerValidator): def __init__( self, plotly_name="ticklabelstep", parent_name="scatterternary.marker.colorbar", **kwargs ): super(TicklabelstepValidator, self).__init__( ...
plotly/plotly.py
packages/python/plotly/plotly/validators/scatterternary/marker/colorbar/_ticklabelstep.py
Python
mit
519
# -*- coding: utf-8 -*- from ..base import ApiBase class Order(ApiBase): _category = 'ihotel' def list(self, **kwargs): """订单列表,方法名称:ihotel.order.list,必须使用 https http://open.elong.com/wiki/Ihotel.order.list """ return self._request('list', https=True, raw=True, **kwargs) ...
DeanThompson/pyelong
pyelong/api/ihotel/order.py
Python
mit
1,386
#!/usr/bin/env python # -*- coding: utf8 -*- from datetime import date, datetime, timedelta try: import unittest2 as unittest except ImportError: import unittest import agate import numpy import agatenumpy agatenumpy.patch() class TestNumpy(unittest.TestCase): def setUp(self): self.rows = ( ...
onyxfish/agate-numpy
tests/test_agatenumpy.py
Python
mit
3,421
""" Convenience decorators for use in fabfiles. """ from __future__ import with_statement #from Crypto import Random #from fabric import tasks from fabric.api import runs_once as _runs_once #from .context_managers import settings from burlap.tasks import WrappedCallableTask def task_or_dryrun(*args, **kwargs): ...
chrisspen/burlap
burlap/decorators.py
Python
mit
3,218
# Generated from /Users/xudong/git/HTTPIDL/Grammar/HTTPIDLLexer.g4 by ANTLR 4.7 # encoding: utf-8 from __future__ import print_function from antlr4 import * from io import StringIO import sys def serializedATN(): with StringIO() as buf: buf.write(u"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2") ...
cikelengfeng/HTTPIDL
Sources/Compiler/Parser/HTTPIDLLexer.py
Python
mit
12,882
import pdfcoloursplit import os import zipfile from .config import config from celery import Celery celery_broker = config["Celery"]["broker"] celery_backend = config["Celery"]["backend"] app = Celery("worker", broker=celery_broker, backend=celery_backend) @app.task def split_pdf(temp_dir, pdf_filename, duplex, stack...
camerongray1515/pdf-colour-split
pdfcoloursplit_web/pdfcoloursplit_web/worker.py
Python
mit
725
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals # IMPORTANT: only import safe functions as this module will be included in jinja environment import frappe import operator import re, urllib, datetime, math import babel.dates fr...
Amber-Creative/amber-frappe
frappe/utils/data.py
Python
mit
20,775
import json import datetime import traceback import re from base64 import b64encode from ast import literal_eval from flask import Blueprint, render_template, render_template_string, make_response, url_for, current_app, request, redirect, jsonify, abort, flash, session from flask_login import login_required, current_us...
ngoduykhanh/PowerDNS-Admin
powerdnsadmin/routes/admin.py
Python
mit
82,003
import copy from supriya.realtime.ControlInterface import ControlInterface class GroupInterface(ControlInterface): """ Interface to group controls. :: >>> server = supriya.Server.default().boot() >>> group = supriya.Group().allocate() >>> group.extend([ ... supriya.S...
Pulgama/supriya
supriya/realtime/GroupInterface.py
Python
mit
3,704
import zmq import argparse def main(): parser = argparse.ArgumentParser() parser.add_argument('-s', '--sub', help='django subscription socket', type=str, required=True) parser.add_argument('-p', '--pub', help='tornado publication socket', type=str, required=True) args = parser.parse_args() ctx = ...
mike-grayhat/djazator
src/djazator/mq.py
Python
mit
674
# This relies on each of the submodules having an __all__ variable. from .core import * from .constructors import * __all__ = (['__version__'] + core.__all__ + constructors.__all__ ) __version__ = '0.3.0'
Evgenus/metaconfig
metaconfig/__init__.py
Python
mit
220
import pandas import numpy as np from os import listdir from os.path import isfile,join from math import isnan path = "../webscraper/course_data/csv/" filenames = [f for f in listdir(path) if isfile(join(path,f))] buildings = {} bNames = ["PCS","FAIR","EHS","ING","ALOF","ALUM","UP","HARR","BH", "JUB","PH","KO...
sremedios/ParkMT
sam_test/stats.py
Python
mit
2,947
from .temperature_sensitivity import *
philngo/ee-meter
eemeter/models/__init__.py
Python
mit
39
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import ConfigParser LOGIN_FORM_SELECTOR = '.inline_login_form' ERROR_MSG_SELECTOR = '.input_validation_error_text[style*="di...
Alafazam/simple_projects
python/quora.py
Python
mit
1,739
# -*- coding: utf-8 -*- """ Created on Mon Aug 31 10:00:32 2015 @author: mje """ import mne from mne.minimum_norm import (make_inverse_operator, apply_inverse, write_inverse_operator) import socket import numpy as np import matplotlib.pyplot as plt # Setup paths and prepare raw data host...
MadsJensen/malthe_alpha_project
make_inverse_operator.py
Python
mit
1,501
import flask_login from wtforms import form, fields, validators from werkzeug.security import check_password_hash, generate_password_hash from models import User from keepmydevices import app, db class LoginForm(form.Form): login = fields.StringField(validators=[validators.required()]) password = fields.Pass...
MiloJiang/KeepMyDevices
Server/keepmydevices/login.py
Python
mit
1,802
import os import re import jinja2 import webapp2 # Set useful fields root_dir = os.path.dirname(__file__) template_dir = os.path.join(root_dir, 'templates') jinja_environment = jinja2.Environment(autoescape=True, loader=jinja2.FileSystemLoader(template_dir)) app = webapp2.WSGIApplication([ (...
mattsp1290/rawr
routes.py
Python
mit
517
import socket from os import unlink, devnull import logbook from logbook.queues import ZeroMQSubscriber from tests.utils.launcher import Launcher from tests.utils.setup import Setup from tests.utils.loop import BooleanLoop, CounterLoop from tests.utils.driver import LocalStorageDriver from tests.utils.benchmark impor...
onitu/onitu
tests/benchmarks/benchmarks.py
Python
mit
6,954
from smbio.util.menu import Menu # "Declare" your menus. main_menu = Menu('Welcome to the show!', reentrant=True) sub_menu = Menu('The cool submenu.') # Add menus as submenus easily. main_menu.add('Cool stuff', sub_menu) # Annotate which menu a function belongs to, and what its text should be. @main_menu.function('A...
brenns10/smbio
examples/menu.py
Python
mit
722
from yapsy import IPlugin from extraction import ExtractedDataItem __author__ = 'adam.jorgensen.za@gmail.com' class PostProcessedDataItem(ExtractedDataItem): """ Overrides the ExtractedDataItem class to provide an indication that an ExtractedDataItem instance has undergone post-processing. """ d...
slventures/jormungand
src/jormungand/api/postprocessing.py
Python
mit
1,271
from distutils.core import setup setup(name='GraphRank', version='0.1.0', description='GraphRank Core Classes and Utils', author='Sean Douglas', author_email='douglas.seanp@gmail.com', url='https://github.com/ldouguy/GraphRank', packages=['graphrank'], )
ldouguy/GraphRank
setup.py
Python
mit
261
import re from capybara.helpers import desc, normalize_text, toregex from capybara.queries.base_query import BaseQuery from capybara.utils import isregex class TitleQuery(BaseQuery): """ Queries the title content of a node. Args: expected_title (str | RegexObject): The desired title. exa...
elliterate/capybara.py
capybara/queries/title_query.py
Python
mit
2,115
import re import threading import time import unittest from selenium import webdriver from app import create_app, db, fake from app.models import Role, User, Post class SeleniumTestCase(unittest.TestCase): client = None @classmethod def setUpClass(cls): # start Chrome options = webdri...
miguelgrinberg/flasky
tests/test_selenium.py
Python
mit
3,228
import math import torch from torch.optim import Optimizer class GigaWolfOptimizer(Optimizer): def __init__(self, params, optimizer, optimizer2): defaults = dict() self.optimizer = optimizer self.optimizer2 = optimizer2 super(GigaWolfOptimizer, self).__init__(params, defaults) def step(self, clo...
255BITS/HyperGAN
hypergan/optimizers/needs_pytorch/giga_wolf_optimizer.py
Python
mit
553
from django.db import models from django.contrib.flatpages.models import FlatPage class FlatpagesNav(models.Model): """Defines whether a flatpage should appear in the main or footer nav and/or if this setting is currently active or not""" flatpage = models.ForeignKey(FlatPage) in_main_nav = models.Boo...
Tivix/django-flatpages-nav
flatpages_nav/models.py
Python
mit
655
import liblo import sys import serial import time serial_wait_time_s = 0.05 prev_timestamp_s = 0 class Game: def __init__(self): self.players = [ Player(1), Player(2) ] self.waiting_for_headsets = True def tick(self, serial_conn): # Game has only two states on the server: ...
bhagman/PourCourtesy
muse_server.py
Python
mit
7,372
## # LL(1) parser generated by the Syntax tool. # # https://www.npmjs.com/package/syntax-cli # # npm install -g syntax-cli # # syntax-cli --help # # To regenerate run: # # syntax-cli \ # --grammar ~/path-to-grammar-file \ # --mode LL1 \ # --output ~/parsermodule.py ## yytext = '' yyleng = 0 __ = None...
DmitrySoshnikov/syntax
src/plugins/python/templates/ll.template.py
Python
mit
1,917
""" Revision ID: 0317_uploads_for_all Revises: 0316_int_letters_permission Create Date: 2019-05-13 10:44:51.867661 """ from alembic import op from app.models import UPLOAD_LETTERS revision = '0317_uploads_for_all' down_revision = '0316_int_letters_permission' def upgrade(): op.execute(""" INSERT INTO ...
alphagov/notifications-api
migrations/versions/0317_uploads_for_all.py
Python
mit
918
import unittest import json from decision import server class DecisionTestCase(unittest.TestCase): def setUp(self): server.app.config['TESTING'] = True self.client = server.app.test_client() def test_server(self): self.assertEquals((self.client.get('/')).status_code, 200) self...
LandRegistry/decision-alpha
tests/test_app.py
Python
mit
1,621
from collections import namedtuple from nose.tools import eq_, raises from ...features import Feature from ..sklearn_classifier import ScikitLearnClassifier from ..test_statistics import table class FakeIdentityEstimator: def __init__(self): self.classes_ = [True, False] self._params = {} ...
yafeunteun/wikipedia-spam-classifier
revscoring/revscoring/scorer_models/tests/test_sklearn_classifier.py
Python
mit
1,825
# Copyright (C) 2017 Cuckoo Foundation. # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org # See the file "docs/LICENSE" for copying permission. from cuckoo.processing.static import ELF def test_elf_static_info(): assert ELF("tests/files/busybox-i686.elf").run() == { "file_header": { ...
cuckoobox/cuckoo
tests/test_elf.py
Python
mit
53,018
import copy import json import os import random import re import sys import time from bs4 import BeautifulSoup import html2text from jinja2 import Template from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support ...
jstoebel/kata_scrape
kata_scrape/client.py
Python
mit
7,775
from OpenGLCffi.GLES2 import params @params(api='gles2', prms=['face', 'mode']) def glPolygonModeNV(face, mode): pass
cydenix/OpenGLCffi
OpenGLCffi/GLES2/EXT/NV/polygon_mode.py
Python
mit
121
# global import logging import pandas as pd import numpy as np # local import utils from core.features import Features from core.DocVocabulary import DocVocabulary from core.TermVocabulary import TermVocabulary from core.msg import TwitterMessageParser def prepare_problem(vectorizer, task_type, train_table, test_tab...
nicolay-r/tone-classifier
models/utils_keras.py
Python
mit
2,274
import argparse from collections import OrderedDict import os import re import sys import types if sys.version_info >= (3, 0): from io import StringIO else: from StringIO import StringIO __version__ = "0.9.4" ACTION_TYPES_THAT_DONT_NEED_A_VALUE = {argparse._StoreTrueAction, argparse._StoreFalseAction, a...
lahwaacz/ConfigArgParse
configargparse.py
Python
mit
35,213
# Copyright 2016 Dietrich Epp. # # This file is part of Kitten Teleporter. The Kitten Teleporter source # code is distributed under the terms of the MIT license. # See LICENSE.txt for details. import yaml from mako import template CONFIG_DEFAULT = '''\ --- # Local configuration, not checked into source control. ''' ...
depp/shifter-children
tools/config.py
Python
mit
5,169
import os ## This class has static methods for file handling # @author Adriano Zanette # @version 1.0 class FileUtils(object): ## test if a file exists # @author Adriano Zanette # @version 1.0 # @param filename String File name # @return Boolean @staticmethod def exists(filename): ...
adzanette/scf-extractor
scf-extractor/modules/FileUtils.py
Python
mit
2,348
from rest_framework.decorators import detail_route from rest_framework.response import Response def get_transition_viewset_method(transition_name, **kwargs): ''' Create a viewset method for the provided `transition_name` ''' @detail_route(methods=['post'], **kwargs) def inner_func(self, request, p...
hzy/drf-fsm-transitions
drf_fsm_transitions/viewset_mixins.py
Python
mit
1,307
""" The goal of this challenge is to create a function that will take a list of names and a bin size and then shuffle those names and return them in a list of lists where the length of the inner lists matches the bin size. For example calling the function with a list of names and the size of 2 should return a lis...
developerQuinnZ/this_will_work
student-work/jeff_beyer/week_1/group_challenge/names_challenge.py
Python
mit
1,543
# -*- coding: utf-8 -*- from PySide import QtCore, QtGui class Ui_Widget(object): def setupUi(self, Widget): Widget.setObjectName("Widget") Widget.resize(639, 686) Widget.setMaximumSize(639, 646) Widget.setMinimumSize(639, 646) self.imageBox = QtGui.QGroupBox(Widget...
HH890612/MiliCloud
ui/publish_ui.py
Python
mit
5,541
__author__ = 'sukrit' class Provider: """ Base Provider class for API Client implementation. """ def __init__(self, **kwargs): super(Provider, self).__init__() def not_supported(self): """ Raises NotImplementedError with a message :return: """ rais...
totem/fleet-py
fleet/client/fleet_base.py
Python
mit
3,221
import click import csv import datetime import json import io from abc import ABCMeta, abstractmethod from itertools import groupby from collections import namedtuple from soccer import leagueids, leagueproperties LEAGUE_PROPERTIES = leagueproperties.LEAGUE_PROPERTIES LEAGUE_IDS = leagueids.LEAGUE_IDS def get_writ...
Saturn/soccer-cli
soccer/writers.py
Python
mit
14,627
# Copyright (C) 2016 - Oscar Campos <oscar.campos@member.fsf.org> # This program is Free Software see LICENSE file for details # Add any new listsners import in here from anaconda_go.listeners.linting import BackgroundLinter from anaconda_go.listeners.autocompletion import GoCompletionEventListener from anaconda_go.l...
danalec/dotfiles
sublime/.config/sublime-text-3/Packages/anaconda_go/listeners/__init__.py
Python
mit
582
import unittest import json import os from pathlib import Path import shutil from envvar_helper import add_aws_envvar class EnvVarHelperTests(unittest.TestCase): def setUp(self): base_path = Path(Path.cwd(), "tests", "integration", "fixtures") self.template = Path(base_path, "template.json") ...
azam-a/domini
tests/integration/test_envvar_helper.py
Python
mit
925
# -*- coding: utf-8 -*- """ Turkey-specific Tables @copyright: 2015-2016 (c) Sahana Software Foundation @license: MIT 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 ...
flavour/ifrc_qa
modules/s3db/tr.py
Python
mit
2,818
import numpy class MSRALossFunctionAbs(object): def __init__(self, distrib, c=None): self.__x = distrib self.__dim = distrib.shape[1] self.__c = c @property def x(self): return self.__x @property def dim(self): return self.__dim @property def c(s...
yarmenti/MSRA
lib/msra_loss.py
Python
mit
1,307
import ast class ImportVisitor(ast.NodeVisitor): def __init__(self, names): self._names = names self._info = {} def visit_Import(self, node): self._visitImport(node, [a.name for a in node.names]) def visit_ImportFrom(self, node): parts = [node.module+'.'+a.name for a in node.names] parts.append(node.m...
jmorse/cyanide
lint-imports/importvisitor.py
Python
mit
1,030
# 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/schemaregistry/azure-schemaregistry/azure/schemaregistry/_generated/rest/schema_groups/_request_builders.py
Python
mit
2,609
import pytest class TestExample: def testMultiply2And3Properly(self): # given x = 2 y = 3 # when c = x * y # then assert c == 6
nokia-wroclaw/innovativeproject-dbshepherd
test/TestDummy.py
Python
mit
184
"""How accurate is Skyfield's subpoint computation routine? Let's call it with a varying number of iterations, and see how accurately it can turn a Topos-generated position back into a latitude, longitude, and elevation. """ from numpy import einsum from skyfield.api import Topos, load from skyfield.constants import ...
skyfielders/python-skyfield
design/subpoint_accuracy.py
Python
mit
1,687
"""Detect viral infections via bwa alignment of unaligned reads. This is primarily useful for cancer samples where viral infection can inform treatment. """ import glob import os from bcbio import bam, utils from bcbio.distributed.transaction import file_transaction from bcbio.pipeline import datadict as dd from bcbi...
biocyberman/bcbio-nextgen
bcbio/qc/viral.py
Python
mit
2,676
import numpy as np import math from sklearn import datasets, neighbors, linear_model digits = datasets.load_digits() X_digits = digits.data y_digits = digits.target np.random.seed(0) indices = np.random.permutation(len(X_digits)) num_samples = len(digits.data) test_set_size = math.floor(.1 * num_samples) print "num...
pieteradejong/python
scikitlearn-ex1.py
Python
mit
1,884
#!/usr/bin/env python from flexbe_core import EventState, Logger from flexbe_core.proxy import ProxyActionClient # Additional imports can be added inside the following tags import rospy import sys import copy import numpy as np import math import time import logging import std_msgs.msg from geometry_msgs.msg import P...
matteopantano/youbot-thesis
states/IK_Solver_Trajectory.py
Python
mit
4,840
from __future__ import print_function from psychopy import sound, monitors, core, visual, event, data, gui, logging, info import numpy as np from copy import deepcopy from math import atan, cos, sin, pi, sqrt, pow import time, sys, platform, os, StringIO import pylab from pandas import DataFrame from calcUnderOvercorre...
alexholcombe/spatiotopic-motion
dots.py
Python
mit
18,851
import os from uuid import uuid4 import xml.etree.ElementTree as ET import re import unicodedata from time import sleep import requests PROCSTATUS_INVALID_RETRY_TRACE = '9714' PROCSTATUS_USER_NOT_FOUND = '9581' CARD_TYPE_VISA = 'VISA' CARD_TYPE_MC = 'MC' CARD_TYPE_AMEX = 'Amex' CARD_TYPE_DISCOVER = 'Discover' CARD_T...
dave2328/chase
chase/chase.py
Python
mit
16,997
from functools import partial from graphql.validation import ScalarLeafsRule from .harness import assert_validation_errors assert_errors = partial(assert_validation_errors, ScalarLeafsRule) assert_valid = partial(assert_errors, errors=[]) def describe_validate_scalar_leafs(): def valid_scalar_selection(): ...
graphql-python/graphql-core
tests/validation/test_scalar_leafs.py
Python
mit
4,160
from rexec import FileWrapper from django.http import HttpResponse from django.shortcuts import get_object_or_404 from ..models.attachment import Attachment def download(request, id): attachment = get_object_or_404(Attachment, pk=id) wrapper = FileWrapper(attachment.file) response = HttpResponse(wrapper...
jmescuderojustel/codeyourblogin-python-django-1.7
src/blog/controllers/attachment_controller.py
Python
mit
423
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: POGOProtos/Networking/Requests/Messages/UseItemXpBoostMessage.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _me...
obiben/pokemongo-api
pogo/POGOProtos/Networking/Requests/Messages/UseItemXpBoostMessage_pb2.py
Python
mit
2,699
import common import music_queue import pagination import artists import audio_tracks @route('/music/music/collections_menu') def GetCollectionsMenu(title): oc = ObjectContainer(title2=unicode(L(title))) oc.add(DirectoryObject( key=Callback(HandleCollections, title=L('All Collections')), ...
shvets/music-plex-plugin
src/lib/plex_plugin/Contents/Code/collections.py
Python
mit
2,763
# Copyright 2013 Canonical Ltd. # # Authors: # Charm Helpers Developers <juju@lists.ubuntu.com> """Charm Helpers ansible - declare the state of your machines. This helper enables you to declare your machine state, rather than program it procedurally (and have to test each change to your procedures). Your install hook...
jiasir/openstack-trove
lib/charmhelpers/contrib/ansible/__init__.py
Python
mit
5,365
from __future__ import division, absolute_import, print_function extensions = [] source_suffix = '.rst' master_doc = 'index' project = u'Confuse' copyright = u'2012, Adrian Sampson' version = '0.1' release = '0.1.0' exclude_patterns = ['_build'] pygments_style = 'sphinx' # -- Options for HTML output ------------...
sampsyo/confuse
docs/conf.py
Python
mit
416
#!/usr/bin/python # Imports import requests from sys import version_info # Setup py3 = version_info[0] > 2 if py3: zip_code = input('Which zip code would you like to check the weather of? ') else: zip_code = raw_input("Which zip code would you like to check the weather of? ") api_key = 'fc8ae934cc756cb097a187d5a0...
Belax8/my-pi-projects
Misc/weather-api.py
Python
mit
838
from typing import Any, Dict, cast from pytest import mark, param, raises from graphql.type import ( GraphQLArgument, GraphQLDirective, GraphQLEnumType, GraphQLEnumValue, GraphQLField, GraphQLInputField, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType, GraphQLSc...
graphql-python/graphql-core
tests/type/test_extensions.py
Python
mit
13,423
""" WSGI config for regex project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTING...
mkhuthir/learnPython
Book_learning-python-r1.1/ch10/regex/regex/wsgi.py
Python
mit
387
import matplotlib.pyplot as plt import numpy as np from moviepy.video.io.bindings import mplfig_to_npimage import moviepy.editor as mpy import pdb import cv2 # DRAW A FIGURE WITH MATPLOTLIB # duration = 2 # fig_mpl, ax = plt.subplots(1,figsize=(5,3), facecolor='white') # xx = np.linspace(-2,2,200) # the x vector # z...
ChengeLi/VehicleTracking
utilities/plot2gif.py
Python
mit
2,284
#!/usr/bin/env python # -*- coding: utf-8 -*- """ nwid.wiget.base ~~~~~~~~~~~~~~~ This module contains nwid base widget object and data structures. """ from __future__ import absolute_import from .widget import BaseWidget from .scrollable import Scrollable
hbradleyiii/nwid
nwid/widget/base/__init__.py
Python
mit
261
import math class Solution(object): def climbStairs(self, n): """ :type n: int :rtype: int """ sqrt5 = math.sqrt(5) return int(sqrt5 / 5 * (pow((1+sqrt5)/2, n+1) - pow((1-sqrt5)/2, n+1))) a = Solution() print a.climbStairs(2)
SeisSparrow/Leetcode
python/70.py
Python
mit
279
import os ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) def load_path(): return os.path.join(ROOT_DIR,"chromedriver")
pallab-gain/slack-daily-update
driver/loadpath.py
Python
mit
132
from __future__ import division SPREADS = { 6: [1.0, 1.0, 1.0, 2.0, 2.0, 3.0, 4.0], 5: [1.0, 1.0, 2.0, 2.0, 3.0, 4.0], 4: [1.0, 1.0, 2.0, 3.0, 3.0], 3: [1.0, 1.0, 2.0, 4.0], 2: [1.0, 2.0, 3.0], 1: [1.0, 1.0], } def round_to_nearest(x, base): # nudge towards rounding up (eg 4.5 towards 5) ...
norm/django-concertina
concertina/__init__.py
Python
mit
4,154
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe, sys from frappe import _ from frappe.utils import cint, flt, now, cstr, strip_html, getdate, get_datetime, to_timedelta from frappe.model import default_fields from...
gangadharkadam/frappecontribution
frappe/model/base_document.py
Python
mit
18,678
# coding: utf8 # Copyright 2015 Vincent Jacques <vincent@vincent-jacques.net> from .joint import InterpolatorTestCase, JointTestCase
jacquev6/Pynamixel
Pynamixel/concepts/tests.py
Python
mit
135
#!/usr/bin/env python # -*- coding: utf-8 -*- import inspect import numpy as np import emcee import george from george import kernels import os import sys currentframe = inspect.currentframe() currentdir = os.path.dirname(os.path.abspath(inspect.getfile(currentframe))) parentdir = os.path.dirname(currentdir) sys.pa...
mtjvc/gpew
examples/chi2_vs_gp.py
Python
mit
4,487
"""settings.""" DEFAULT_INDEXES = [ 'towns', ] MAPPINGS = { 'towns': """{ "mappings": { "town": { "properties": { "location": { "type": "geo_point" }, "name" : { "typ...
CornerstoneLabs/twittermap
search/es-towns/settings.py
Python
mit
609
"""Creates a table detailing the properties of all VPHAS frames in DR2.""" import os import numpy as np from astropy import log from astropy.table import Table, vstack from astropy.utils.console import ProgressBar import surveytools from surveytools.footprint import VphasExposure if __name__ == '__main__': blue_...
barentsen/surveytools
scripts/create-frame-index.py
Python
mit
1,073
from __future__ import absolute_import from __future__ import unicode_literals import random import tqdm from .gold import GoldParse from .scorer import Scorer from .gold import merge_sents class Trainer(object): '''Manage training of an NLP pipeline.''' def __init__(self, nlp, gold_tuples): self.nlp...
oroszgy/spaCy.hu
spacy/train.py
Python
mit
3,105
""" Recent METARs containing some pattern """ import json import memcache import psycopg2.extras from paste.request import parse_formvars from pyiem.reference import TRACE_VALUE from pyiem.util import get_dbconn, html_escape json.encoder.FLOAT_REPR = lambda o: format(o, ".2f") def trace(val): """Nice Print""" ...
akrherz/iem
htdocs/geojson/recent_metar.py
Python
mit
3,238
"""Tests for the Lutron Caseta integration.""" class MockBridge: """Mock Lutron bridge that emulates configured connected status.""" def __init__(self, can_connect=True): """Initialize MockBridge instance with configured mock connectivity.""" self.can_connect = can_connect self.is_cur...
rohitranjan1991/home-assistant
tests/components/lutron_caseta/__init__.py
Python
mit
1,289
import RPi.GPIO as GPIO import time i1 = int(raw_input("How many seconds do you want the red light to flash?")) i2 = int(raw_input("How many seconds do you want the yellow light to flash?")) i3 = int(raw_input("How many seconds do you want the green light to flash?")) i4 = int(raw_input("How many seconds do you want th...
johnlbullock/Raspberry_Pi_Code
Traffic_Light_Input.py
Python
mit
833
class Approx(object): def __init__(self,val): self._val = val self._epsilon = 0.01 def epsilon(self,epsilon): self._epsilon = epsilon return self def __eq__(self,other): return abs(other - self._val) <= self._epsilon*abs(other + self._val)/2
CD3/config-makover
test/utils.py
Python
mit
269
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('admin_ddjj_app', '0025_auto_20150715_2023'), ] operations = [ migrations.AlterField( model_name='bienpersona', ...
lanacioncom/ddjj_admin_lanacion
admin_ddjj_app/migrations/0026_auto_20150716_1821.py
Python
mit
488
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-18 21:21 from __future__ import unicode_literals import courses.fields from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('courses', '0002_content_file_image_text_video'), ] operations = [ ...
pauljherrera/avantiweb
courses/migrations/0003_auto_20170318_1821.py
Python
mit
973
# -*- coding: utf-8 -*- import logging import threading import storj.exception as sjexc from PyQt4 import QtCore, QtGui from .engine import StorjEngine from .file_download import SingleFileDownloadUI from .file_mirror import FileMirrorsListUI from .file_upload import SingleFileUploadUI from .qt_interfaces.file_mana...
lakewik/storj-gui-client
UI/file_manager.py
Python
mit
9,693
import contextlib from io import StringIO from unittest import TestCase import docopt from torba.testcase import AsyncioTestCase from lbry.extras.cli import normalize_value, main from lbry.extras.system_info import get_platform from lbry.extras.daemon.Daemon import Daemon class CLITest(AsyncioTestCase): @stati...
lbryio/lbry
lbry/tests/unit/test_cli.py
Python
mit
4,993
# The MIT License (MIT) # Copyright (c) 2016-2017 HIS e. G. # # 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 rights to use, copy, modi...
hsiegel/postsai-commitstop
permissions/sendHistory.py
Python
mit
1,442