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 |
|---|---|---|---|---|---|
"""
Garn is a small Kwant_ based package for doing effective mass
calculations on two models of contact geometry effects on
semiconductor nanowires.
This documentation is of the software and how it is used and will not
cover the physics behind the simulations. A formal introduction to the
project is publiched in `Nume... | nat13ejo/garn | garn/__init__.py | Python | mit | 2,328 |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/apimanagement/azure-mgmt-apimanagement/setup.py | Python | mit | 2,672 |
#!/usr/bin/env python
# coding: utf-8
from os import environ
from mozu_image_util_functions import log
## Import and set static connection environmental variables -- sql_alchemy_uri, mozu_tenant etc.
from base_config import authenticate, set_environment
set_environment()
# Import initial static vars and Auth func Ca... | relic7/prodimages | mozu/RESTClient.py | Python | mit | 22,278 |
#!/usr/bin/python3
from itertools import *
KINDS = ['unorm', 'snorm', 'uint', 'sint', 'float']
PRECS = [8, 16, 32, 64]
def value(kind, prec, ndim):
ikind = KINDS.index(kind)
iprec = PRECS.index(prec)
index = ikind * len(PRECS) + iprec
return index << 16 | KINDS.index(kind) << 12 | iprec << 8 | (ndim - 1) << 10 ... | ciechowoj/haste-format | make_data_t.py | Python | mit | 5,303 |
from helga import settings
from helga.plugins import command
@command('showme', aliases=['whois', 'whothehellis'],
help="Show a URL for the user's intranet page. Usage: helga (showme|whois|whothehellis) <nick>")
def wiki_whois(client, channel, nick, message, cmd, args): # pragma: no cover
"""
Show t... | shaunduncan/helga-wiki-whois | helga_wiki_whois.py | Python | mit | 487 |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... | Marcdnd/cryptoescudo | contrib/spendfrom/spendfrom.py | Python | mit | 10,054 |
from abc import ABCMeta, abstractmethod
import operator
from future.utils import with_metaclass, lmap
from selene.abctypes.conditions import IEntityCondition
from selene.abctypes.webdriver import IWebDriver
from selene.abctypes.webelement import IWebElement
from selene.exceptions import ConditionMismatchException
c... | SergeyPirogov/selene | selene/conditions.py | Python | mit | 9,603 |
from FortyTwo.fortytwo import *
def Start():
"""No Clue what to add here"""
| 1m0r74l17y/FortyTwo | FortyTwo/__init__.py | Python | mit | 80 |
__title__ = 'libvcs'
__package_name__ = 'libvcs'
__description__ = 'vcs abstraction layer'
__version__ = '0.10.1'
__author__ = 'Tony Narlock'
__github__ = 'https://github.com/vcs-python/libvcs'
__docs__ = 'https://libvcs.git-pull.com'
__tracker__ = 'https://github.com/vcs-python/libvcs/issues'
__pypi__ = 'https://pypi.... | tony/libvcs | libvcs/__about__.py | Python | mit | 440 |
import nibabel as nib
from nibabel import freesurfer
import numpy as np
class Region(object):
_defaults = ['data', '_name', '_layer', 'hemi', 'header', 'space', 'shape', 'img']
def __init__(self, source):
self._source = source
for key in self._defaults:
if key not in self.__di... | helloTC/LearnPython | framework_attempt/MRFreeframe.py | Python | mit | 4,576 |
'''
Copyright (c) 2016 Abhishek Agrawal (abhishek.agrawal@protonmail.com)
Distributed under the MIT License.
See accompanying file LICENSE.md or copy at http://opensource.org/licenses/MIT
'''
# Set up modules and packages
# I/O
import csv
from pprint import pprint
# Numerical
import numpy as np
import pandas as pd
fr... | agrawalabhishek/NAOS | python/plotEllipsoidSurfaceAccelerationLatLong.py | Python | mit | 4,657 |
"""Example Module name.
Module short description
"""
class Example(object):
"""Class description."""
def __init__(self, event):
self.event = event
def work(self):
"""Return the message."""
return 'Hello, %s!' % self.event['name']
| Tomohiro/apex-python-boilerplate | functions/example/src/example.py | Python | mit | 271 |
def main():
print("Hello!")
| BobbyJacobs/cs3240-demo | hello.py | Python | mit | 30 |
# -*- coding: utf-8 -*-
#
# Kolibri 'developer docs' build configuration file
#
# This file is execfile()d with the current directory set to its containing dir.
import inspect
import os
import sys
from datetime import datetime
import django
from django.utils.encoding import force_text
from django.utils.html import str... | DXCanas/kolibri | docs/conf.py | Python | mit | 7,987 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Title(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scattersmith.marker.colorbar"
_path_str = "scattersmith.marker.colorbar.title"
_valid_props =... | plotly/plotly.py | packages/python/plotly/plotly/graph_objs/scattersmith/marker/colorbar/_title.py | Python | mit | 7,130 |
import re
import os
import urllib.request
import tweepy
import json
import time
def tweet_ip():
IPTweet().do_update()
return
class IPTweet(object):
def __init__(self):
self.__location__ = os.path.realpath(os.path.join(
os.getcwd(), os.path.dirname(__file__)
))
def get... | p2j/ip_tweet | iptweet.py | Python | mit | 2,893 |
# -*- coding: utf-8 -*-
"""Tools for visualizing ADCP data that is read and processed by the adcpy module
This module is imported under the main adcpy, and should be available as
adcpy.plot. Some methods can be used to visualize flat arrays, independent of
adcpy, and the plots may be created quickly using the IPanel a... | esatel/ADCPy | adcpy/adcpy_plot.py | Python | mit | 27,568 |
import nltk
import re
import pprint
def main():
IN = re.compile(r'.*\bin\b(?!\b.+ing)')
for doc in nltk.corpus.ieer.parsed_docs('NYT_19980315'):
for rel in nltk.sem.extract_rels('ORG', 'LOC', doc, corpus='ieer', pattern=IN):
print nltk.sem.relextract.rtuple(rel)
if __name__ == "__main__":... | attibalazs/nltk-examples | 7.6_Relation_Extraction.py | Python | mit | 332 |
#!/usr/bin/env python3
import os, sys, signal, argparse, configparser, traceback, time
from contextlib import closing
from ananas import PineappleBot
import ananas.default
# Add the cwd to the module search path so that we can load user bot classes
sys.path.append(os.getcwd())
bots = []
def shutdown_all(signum, fram... | Chronister/ananas | ananas/run.py | Python | mit | 2,535 |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import json
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import A... | ccxt/ccxt | python/ccxt/async_support/ndax.py | Python | mit | 95,533 |
# Copyright (c) 2021 elParaguayo
#
# 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, modify, merge, publish, distrib... | ramnes/qtile | test/widgets/test_moc.py | Python | mit | 6,555 |
from django.db import models
from django.core.validators import MaxValueValidator
class MainSliderBlock(models.Model):
is_active = models.BooleanField(
verbose_name="Отображать блок",
default=True,
)
class Meta:
verbose_name = verbose_name_plural = "Блок Слайдер"
def __str__(... | cthtuf/django-cv | main/models.py | Python | mit | 22,628 |
""" while case """
x = 1
while x<10:
print(x)
x = x + 1
""" while and else case """
x = 1
while x<10:
print(x)
x = x + 1
else:
print("ok")
""" while and else break case """
x = 1
while x<10:
print(x)
x = x + 1
break
else:
print("ok")
| naitoh/py2rb | tests/basic/while.py | Python | mit | 271 |
"""Contains functions for dealing with the .pdb file format."""
from datetime import datetime
import re
from itertools import groupby, chain
import valerius
from math import ceil
from .data import CODES
from .structures import Residue, Ligand
from .mmcif import add_secondary_structure_to_polymers
def pdb_string_to_pd... | samirelanduk/molecupy | atomium/pdb.py | Python | mit | 23,845 |
from roetsjbaan.migrator import *
from roetsjbaan.versioner import *
| mivdnber/roetsjbaan | roetsjbaan/__init__.py | Python | mit | 69 |
import os
import hashlib
import requests
import json
FLICKR_BASE = "http://api.flickr.com/services/rest/"
def api(method, **kwargs):
kwargs.update({
"method": "flickr.{}".format(method),
"format": "json",
"nojsoncallback": "1",
"api_key": os.environ["FLICKR_KEY"],
"auth_tok... | kyleconroy/quivr | flickr.py | Python | mit | 645 |
#!/usr/bin/env python
"""
Backup all your organization's repositories, private or otherwise.
"""
import argparse
import base64
import contextlib
import json
import os
import sys
import urllib2
from collections import namedtuple
from urllib import urlencode
from urllib import quote
API_BASE = 'https://api.github.com/... | sproutsocial/botanist | packages/github_backup.py | Python | mit | 8,574 |
import pytest
from seasalt import container
from assertpy import assert_that
from os import path
def get_minimum_seasalt_kwargs():
return {
'image': 'test-image:latest'
}
def get_minimum_container(docker_fixture):
kwargs = get_minimum_seasalt_kwargs()
return container(docker_cli=docker_fixtu... | ghostsquad/seasalt | src/tests/unit/test_container.py | Python | mit | 5,504 |
from createsend import *
auth = {
'access_token': 'YOUR_ACCESS_TOKEN',
'refresh_token': 'YOUR_REFRESH_TOKEN' }
listId = 'YOUR_LIST_ID'
emailAddress = 'YOUR_SUBSCRIBER_EMAIL_ADDRESS'
subscriber = Subscriber(auth, listId, emailAddress)
# Get the details for a subscriber
subscriberDetail = subscriber.get... | campaignmonitor/createsend-python | samples/subscribers.py | Python | mit | 411 |
import json
from kolekto.printer import printer
from kolekto.commands import Command
class Restore(Command):
""" Restore metadata from a json dump.
"""
help = 'Restore metadata from a json dump'
def prepare(self):
self.add_arg('file', help='The json dump file to restore')
def run(self... | NaPs/Kolekto | kolekto/commands/restore.py | Python | mit | 657 |
import unittest
from layout.datatypes import *
from layout.managers.box import *
class DummyElement(object):
def __init__(self, size):
self.size = size
def get_minimum_size(self, data):
return self.size
def render(self, rect, data):
self.rect = rect
class BoxLMTest(unittest.TestCas... | idmillington/layout | tests/test_managers_box.py | Python | mit | 1,665 |
import pytest
from pydantic import BaseModel, Extra, Field, ValidationError, create_model, errors, validator
def test_create_model():
model = create_model('FooModel', foo=(str, ...), bar=123)
assert issubclass(model, BaseModel)
assert issubclass(model.__config__, BaseModel.Config)
assert model.__name... | samuelcolvin/pydantic | tests/test_create_model.py | Python | mit | 6,429 |
import fragmon
import irc
from fragmon import Player
#some CTCP command handlers
def on_version(mask, location, cmd, args):
irc.ctcp(mask.nick, 'VERSION', fragmon.APPNAME, fragmon.VERSION, fragmon.WEBSITE)
irc.on_ctcp('*', 'version', on_version)
class SumBot(fragmon.ScoreBot):
""" This is an example scorebot... | cdrttn/fragmon | gamequery/query_scorebot.py | Python | mit | 6,268 |
from flask import Flask
from flask import abort, send_file, request, render_template, redirect
from PIL import Image, ImageDraw, ImageFont
import os
import time
import datetime
import boto3
import logging
import csv
import io
import textwrap
from botocore.exceptions import ClientError
app = Flask(__name__)
@app.route... | kylehayes/fpoimg | main.py | Python | mit | 7,642 |
"""
vg composite command
Build composite images from centered images, based on records in composites.csv.
See also vgInitComposites.py, which builds initial pass at composites.csv.
Note: even single channel images get a composite image (bw).
Uses centered image if available, otherwise uses the plain adjusted image.
... | bburns/PyVoyager | src/vgComposite.py | Python | mit | 10,684 |
#!/usr/bin/env python
from position import Position
class InputParser:
@staticmethod
def parse(filePath):
positions = []
with open(filePath, 'r') as file:
for line in file.read().splitlines():
parts = [part.strip() for part in line.split(',')]
if 2 == len(parts):
positions.append(Position(float... | sattila83/Robocar | input_parser.py | Python | mit | 369 |
"""A simple interface for executing bytecodes over a Bluetooth serial port.
From the lms2012 source code documentation:
Beside running user programs the VM is able to execute direct commands from
the Communication Module. In fact direct commands are small programs that
consist of regular byte codes and they are execu... | inductivekickback/ev3 | ev3/direct_command.py | Python | mit | 72,705 |
from flowlight import Machine
m = Machine('host1', connect=True)
m.put('/tmp/remote_file', '/tmp/local_file') # upload
m.get('/tmp/local_file', '/tmp/remote_file') # download
| tonnie17/flowlight | examples/run_sftp.py | Python | mit | 177 |
class Solution(object):
def permuteUnique(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
if nums == []:
return []
result = []
self.helper(nums, [], result)
return result
def helper(self, nums, cur, result):
... | mistwave/leetcode | Python3/no47_Permutations_II.py | Python | mit | 748 |
#!/usr/bin/env python
from demobrowser import app, db
#db.drop_all()
db.create_all()
app.debug = app.config.get('DEBUG', False)
# This is required.
app.secret_key = app.config.get('SECRET_KEY', None)
if app.secret_key is None:
print "ERROR: SECRET_KEY not found in settings.cfg. Please see README.md for help!"
el... | FernFerret/demobrowser | run.py | Python | mit | 379 |
#!/usr/bin/env python
"""
This module contains the :class:`Computation` class and its subclasses.
Computations allow for row-wise calculation of new data for :class:`.Table`.
For instance, the :class:`PercentChange` subclass takes two column names as
arguments and computes the percentage change between them for each r... | JoeGermuska/agate | agate/computations.py | Python | mit | 10,787 |
#*******************************************************************************
#
# Filename : MCResolution.py
# Description : Config file for generating tree for resolution calculation
# Author : Yi-Mu "Enoch" Chen [ ensc@hep1.phys.ntu.edu.tw ]
#
#******************************************************... | NTUHEP-Tstar/TstarAnalysis | SignalMCStudy/python/MCResolution.py | Python | mit | 2,760 |
from datetime import datetime
from .tags import has_tag
COLORS = {
"bold_white": "\033[1;37m",
"red": "\033[0;31m",
"yellow": "\033[0;33m",
"green": "\033[0;32m",
"nocolor": "\033[00m",
"blue": "\033[0;34m"}
class Template(object):
ACCOUNT_COLOR = "blue"
def __call__(self, ledgers, r... | pcapriotti/pledger | pledger/template.py | Python | mit | 4,577 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
import sys
import os.path
import subprocess
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../src/edeposit/amqp"))
try:
from rest import ... | edeposit/edeposit.amqp.rest | bin/edeposit_rest_runzeo.py | Python | mit | 785 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import re
def multiple_split(_str, splits):
res = [_str]
for sp in splits:
tmp = []
# Why?
list(map(lambda x: tmp.extend(x.split(sp)), res))
res = tmp
return [x for x in ... | quietcoolwu/python-playground | imooc/python_advanced/4_1_multiple_split.py | Python | mit | 486 |
"""
"""
import imp
import os
import sys
KEY_MAP = {0: [],
1: [],
2: [u'a', u'b', u'c'],
3: [u'd', u'e', u'f'],
4: [u'g', u'h', u'i'],
5: [u'j', u'k', u'l'],
6: [u'm', u'n', u'o'],
7: [u'p', u'q', u'r', u's'],
8: [u't', u'u', u'v']... | twonds/trinine | trinine/t9.py | Python | mit | 4,257 |
# test seasonal.adjust_seasons() options handling
#
# adjust_seasons() handles a variety of optional arguments.
# verify that adjust_trend() correctly calledfor different option combinations.
#
# No noise in this test set.
#
from __future__ import division
import numpy as np
from seasonal import fit_trend, adjust_seaso... | welch/seasonal | tests/adjust_seasons_test.py | Python | mit | 1,815 |
from functools import partial
from mock import call
from raptiformica.shell.execute import COMMAND_TIMEOUT
from tests.testcase import TestCase
from raptiformica.distributed.exec import try_machine_command
class TestTryMachineCommand(TestCase):
def setUp(self):
self.log = self.set_up_patch('raptiformica... | vdloo/raptiformica | tests/unit/raptiformica/distributed/exec/test_try_machine_command.py | Python | mit | 6,531 |
# -*- coding: utf-8 -*-
# Copyright © 2008-2011 Varyant, LLC
| jlconnor/wsgistack | wack/http/__init__.py | Python | mit | 62 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
COST_AUTO = 5
class Appartment(object):
"""Appartment class consists of features that have all appartments"""
def __init__(self, address, metro, transportation, rooms, space, price, floor, addInfo):
super(Appartment, self).__init__()
self.address = self.setAd... | leanton/cianParser | appartment.py | Python | mit | 5,447 |
#!/usr/bin/env python3
# testHaskellComments.py
""" Test line counter for the Haskell programmig language. """
import unittest
from argparse import Namespace
from pysloc import count_lines_double_dash, MapHolder
class TestHaskellComments(unittest.TestCase):
""" Test line counter for the Haskell programmig langu... | jddixon/pysloc | tests/test_haskell_comments.py | Python | mit | 1,084 |
# Copyright (c) 2008, Casey Duncan (casey dot duncan at gmail dot com)
# see LICENSE.txt for details
"""Perlin noise -- pure python implementation"""
"""
Skeel Lee, 1 Jun 2014
-added SimplexNoise.snoise3() which calculates fBm based on SimplexNoise.noise3()
(I need the same function name, signature and behavi... | skeelogy/maya-skNoiseDeformer | python/libnoise/perlin.py | Python | mit | 12,633 |
'''
main issue here was to global patforrec. youll probs forget.
'''
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import matplotlib.dates as mdates
import numpy as np
from numpy import loadtxt
import time
totalStart = time.time()
date,bid,ask = np.loadtxt('GBPUSD1d.txt', u... | PythonProgramming/Pattern-Recognition-for-Forex-Trading | machFX10.py | Python | mit | 11,354 |
#!/usr/bin/env python
""" nav_test.py - Version 1.1 2013-12-20
Command a robot to move autonomously among a number of goal locations defined in the map frame.
On each round, select a new random sequence of locations, then attempt to move to each location
in succession. Keep track of success rate, time el... | fujy/ROS-Project | src/rbx1/rbx1_nav/nodes/navynavy.py | Python | mit | 12,006 |
import _plotly_utils.basevalidators
class OpacityValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="opacity", parent_name="barpolar", **kwargs):
super(OpacityValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/barpolar/_opacity.py | Python | mit | 474 |
import time
import numpy as np
from collections import Counter
from collections import defaultdict
import matplotlib.pyplot as plt
def unzip(pairs):
"""
Splits list of pairs (tuples) into separate lists
Parameter(s)
--------------
pairs(list of tuples):
List of pairs to be split
... | LMML-Team/AlexaSkills | GenerateText/Generate_text.py | Python | mit | 4,460 |
#! /usr/bin/python
import os, sys, glob, time, subprocess, signal
import popen2
subdirectories = ['first', 'second', 'third', 'fourth', 'fifth']
formats = {'first':'line', 'second':'line', 'third':'file', 'fourth':'file', 'fifth':'file'}# if a program has single liner input and output, we put all test cases in single... | frogeyedpeas/ChalupaCity | working_pa1/auto_grader.py | Python | mit | 7,382 |
# coding: utf-8
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.1.2-pre.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
impor... | cliffano/swaggy-jenkins | clients/python-experimental/generated/openapi_client/model/pipeline_step_impl.py | Python | mit | 3,115 |
'''
Maze Generator
By Stephen Davies
Builds a maze using tree construction
'''
# Current idea:
# - Build maze and tree at the same time
# - Start at some square - say (0, 0) for now - and randomly add unused square to leaves of the tree
import random, json
from collections import namedtuple
SquareNode = namedtuple... | steve9164/maze-generator | maze.py | Python | mit | 6,550 |
from .catalogue import remove_detector, register_detector, detector_catalogue
from .base import Detector, RegexDetector, RegionLocalisedRegexDetector
from .credential import CredentialDetector
from .credit_card import CreditCardDetector
from .date_of_birth import DateOfBirthDetector
from .drivers_licence import Driver... | datascopeanalytics/scrubadub | scrubadub/detectors/__init__.py | Python | mit | 796 |
# Name: Main.py
# Author: Shawn Wilkinson
# Imports
from random import choice
# Welcome Message
print("Welcome to the Isolation Game!")
# Make Board
board = [['' for col in range(4)] for row in range(4)]
# Print Board Functin
def show():
# Tmp string
tmpStr = ""
# Loop through board
tmpStr += "\nBoard:"
tmpSt... | super3/PyDev | Class/IsoGame/main.py | Python | mit | 2,825 |
formatter = "%r %r %r %r"
print formatter % (1, 2, 3, 4)
print formatter % ("one", "two", "three", "four")
print formatter % (True, False, False, True)
print formatter % (formatter, formatter, formatter, formatter)
print formatter % (
"I had this thing",
"that you could type up right",
"But it didn't sing... | aurelo/lphw | source/ex8.py | Python | mit | 351 |
# coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.gi... | docusign/docusign-python-client | docusign_esign/models/app_store_product.py | Python | mit | 4,127 |
import datetime
import gzip
import os
import sys
import tempfile
import time
from importlib import reload
from subprocess import Popen
import numpy as np
import pytest
from owslib.fes import PropertyIsEqualTo
import pydov
from pydov.search.boring import BoringSearch
from pydov.search.grondwaterfilter import Grondwate... | DOV-Vlaanderen/pydov | tests/test_error_path.py | Python | mit | 12,376 |
from .Condition import Condition
from .Configuration import Configuration
from .Classifier import Classifier
from .ClassifiersList import ClassifiersList
from .XCS import XCS
from .GeneticAlgorithm import *
| ParrotPrediction/pyalcs | lcs/agents/xcs/__init__.py | Python | mit | 207 |
#!/usr/bin/env python
from prompt_toolkit.history import InMemoryHistory
from prompt_toolkit import prompt
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
history = InMemoryHistory()
while True:
text = prompt("> ", history=history, auto_suggest=AutoSuggestFromHistory())
if text == 'quit':
... | tleonhardt/CodingPlayground | python/prompt-toolkit/auto_suggestion.py | Python | mit | 410 |
"""
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/link_token_get_metadata_response.py | Python | mit | 8,788 |
from django import template
from django.template.loader import render_to_string
from django.conf import settings
from ..utils import get_tag_id, set_lazy_tag_data
register = template.Library()
@register.simple_tag
def lazy_tag(tag, *args, **kwargs):
"""
Lazily loads a template tag after the page has loaded... | grantmcconnaughey/django-lazy-tags | lazy_tags/templatetags/lazy_tags.py | Python | mit | 2,029 |
import contexts
from unittest import mock
from poll import circuitbreaker, CircuitBrokenError
class WhenAFunctionWithCircuitBreakerDoesNotThrow:
def given_a_call_counter(self):
self.x = 0
self.expected_args = (1, 4, "hello")
self.expected_kwargs = {"blah": "bloh", "bleh": 5}
self.e... | benjamin-hodgson/poll | test/circuit_breaker_tests.py | Python | mit | 8,673 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
long_desc = '''
This package contains the ${name} Sphinx extension.
.. add description here ..
'''
requires = ['Sphinx>=0.6']
setup(
name='sphinxcontrib-${name}',
version='0.1',
url='http://bitbucket.org/birkenfeld/sphinx-contrib',
... | Lemma1/MAC-POSTS | doc_builder/sphinx-contrib/_template/setup.py | Python | mit | 1,194 |
from setuptools import setup
import unittest
def para_test_suite():
test_loader = unittest.TestLoader()
test_suite = test_loader.discover('tests', pattern='test_*.py')
return test_suite
setup(name='para',
version='2.0.1',
author='Migdalo',
license='MIT',
packages=['para'],
te... | Migdalo/para | setup.py | Python | mit | 494 |
# coding: utf-8
# ## Plot velocity from non-CF HOPS dataset
# In[5]:
get_ipython().magic(u'matplotlib inline')
import netCDF4
import matplotlib.pyplot as plt
# In[6]:
url='http://geoport.whoi.edu/thredds/dodsC/usgs/data2/rsignell/gdrive/nsf-alpha/Data/MIT_MSEAS/MSEAS_Tides_20160317/mseas_tides_2015071612_2015081... | rsignell-usgs/notebook | HOPS/hops_velocity.py | Python | mit | 830 |
'''General action classes.'''
import sys
class Action(object):
def __init__(self, situation, name, suffix=None):
'''Actions subclass nothing, but require situations to hold them'''
# a situation is like "outdoors", "indoors", or "fighting"
self._situation = situation
s... | theJollySin/pytextgame | pytextgame/actions.py | Python | mit | 3,233 |
"""
Copyright (c) 2016, John Deutscher
Description: Sample Python script for OCR processor
License: MIT (see LICENSE.txt file for details)
Documentation : https://azure.microsoft.com/en-us/documentation/articles/media-services-video-optical-character-recognition/
"""
import os
import json
import azurerm
import time
imp... | gbowerman/azurerm | examples/media_services/analytics/ocr/ocr.py | Python | mit | 14,997 |
"""
Copyright (c) 2017-2022, Jairus Martin.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on May 20, 2017
@author: jrm
"""
from atom.api import Typed
from enamlnative.widgets.grid_layout import ProxyGridLayout
from .android_view_grou... | codelv/enaml-native | src/enamlnative/android/android_grid_layout.py | Python | mit | 2,385 |
# -*- coding: utf-8 -*-
import re
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run... | CenterForOpenScience/mfr-code-pygments | setup.py | Python | mit | 2,143 |
# -*- coding: utf-8 -*-
import sys
import logging
import logging.handlers
import logging.config
from config import CENTRAL_CONFIG
#from config import LOGGING_CFG_SRV, ENDPOINT
#logging.config.fileConfig(LOGGING_CFG_SRV)
#log = logging.getLogger(__name__)
import time
from time import strftime, localtime
import ... | mabotech/maboss.py | maboss/motorx/jobexecutor/je_server1.py | Python | mit | 1,138 |
# -*- coding : uft-8 -*-
import scrapy
import urllib
from jd_51job.items import Jd51JobItem
from scrapy.http import Request
from scrapy.exceptions import IgnoreRequest
import os
import datetime
import re
class Jd51JobSpider(scrapy.Spider):
name = "jd_51job"
allowed_domain = ["51job.com"]
datafile = os.... | zymtech/Scrapiders | jd_51job/jd_51job/spiders/jd.py | Python | mit | 3,113 |
"""
Compute the GRS from genotypes and a GRS file.
"""
# This file is part of grstools.
#
# The MIT License (MIT)
#
# Copyright (c) 2017 Marc-Andre Legault
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# ... | legaultmarc/grstools | grstools/scripts/mendelian_randomization.py | Python | mit | 3,401 |
# Generated from ChordLabel.g4 by ANTLR 4.7
from antlr4 import *
if __name__ is not None and "." in __name__:
from .ChordLabelParser import ChordLabelParser
else:
from ChordLabelParser import ChordLabelParser
# This class defines a complete listener for a parse tree produced by ChordLabelParser.
class ChordLab... | bzamecnik/chord-labels | chord_labels/parser/ChordLabelListener.py | Python | mit | 3,465 |
# -*- coding: utf-8 -*-
__author__ = 'massimo'
import unittest
class UtilTestFunctions(unittest.TestCase):
def test_verify_url(self):
self.assertTrue(True)
if __name__ == "__main__":
UtilTestFunctions.main()
| yangsibai/SiteMiner | test/util_test.py | Python | mit | 229 |
import copy
import warnings
import collections
import tempfile
import sys
import os
import sqlite3
import six
from textwrap import dedent
from gffutils import constants
from gffutils import version
from gffutils import bins
from gffutils import helpers
from gffutils import feature
from gffutils import interface
from gf... | hjanime/gffutils | gffutils/create.py | Python | mit | 50,151 |
"""
SignalHound related detector functions
extracted from pycqed/measurement/detector_functions.py commit 0da380ad2adf2dc998f5effef362cdf264b87948
"""
import logging
import time
from packaging import version
import qcodes as qc
from pycqed.measurement.det_fncs.Base import Soft_Detector, Hard_Detector
from pycqed.me... | DiCarloLab-Delft/PycQED_py3 | pycqed/measurement/det_fncs/hard/SignalHound.py | Python | mit | 5,908 |
# -*- coding: utf-8 -*-
"""
Stores information about agent and comes with supporting methods to sample random agents.
"""
__author__ = "Julian Jara-Ettinger"
__license__ = "MIT"
import random
import numpy as np
class Agent(object):
def __init__(self, Map, CostPrior, RewardPrior, CostParams, RewardParams, Capa... | julianje/Bishop | build/lib/bishop/Agent.py | Python | mit | 10,204 |
import random
def printifyInstruction(instr, mcs):
"""
Construct a preaty representation of the instruction in memory.
mcs -> 'maximum characters span'
"""
return "({0:{3}d}, {1:{3}d}, {2:{3}d})".format(instr['A'], instr['B'], instr['C'], mcs)
class Orbis:
def __init__(self, gSize):
se... | 3Nigma/jale | main.py | Python | mit | 3,579 |
import json
import nbformat
import nbconvert
from nbformat.v4 import new_code_cell, new_markdown_cell, new_notebook, new_output
from nbconvert.preprocessors import ExecutePreprocessor
kernel_name = 'python3' # set it programmatically so that you only need to change it in one place
display_name = 'Python 3'
outpu... | masterfish2015/my_project | python/demo1/jupyter_markdown-master/script.py | Python | mit | 1,530 |
import os
from osgeo import ogr
def layers_to_feature_dataset(ds_name, gdb_fn, dataset_name):
"""Copy layers to a feature dataset in a file geodatabase."""
# Open the input datasource.
in_ds = ogr.Open(ds_name)
if in_ds is None:
raise RuntimeError('Could not open datasource')
# Open the g... | cgarrard/osgeopy-code | Chapter4/listing4_2.py | Python | mit | 1,083 |
import os
from conans.model.manifest import FileTreeManifest
from conans.test.utils.test_files import temp_folder
from conans.util.files import load, md5, save
class TestManifest:
def test_tree_manifest(self):
tmp_dir = temp_folder()
files = {"one.ext": "aalakjshdlkjahsdlkjahsdljkhsadljkhasljkd... | conan-io/conan | conans/test/unittests/model/manifest_test.py | Python | mit | 2,125 |
from __future__ import division, print_function
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import clean_and_search
from ktransit import FitTransit
from multiprocessing import Pool
from scipy import ndimage
import glob, timeit, sys
import time as pythonTime
# OPTI... | barentsen/dave | blsCode/yash_bls.py | Python | mit | 17,107 |
import logging
from plumeria.command import commands, CommandError
from plumeria.core.storage import pool
from plumeria.core.user_prefs import prefs_manager
from plumeria.message import Message
from plumeria.message.mappings import build_mapping
from plumeria.perms import direct_only
from plumeria.core.scoped_config.m... | sk89q/Plumeria | plumeria/core/scoped_config/__init__.py | Python | mit | 4,341 |
#!/usr/bin/env python
def dloader(url, stylenum, imgnum):
import os, sys, requests, re
regex = re.compile(r'^(http://.*?)\?dl\=\d{1,2}.*?$')
urlget = url
localpath = os.path.join('/Users/johnb/Pictures', stylenum + '_' + imgnum + '.jpg')
import subprocess
subprocess.call(['wget', url, '-o', localpath])
if re... | relic7/prodimages | python/jbmodules/http_tools/download_files/downloadfile_HTTPS_requests.py | Python | mit | 598 |
# import libraries: dataframe manipulation, machine learning, os tools
from pandas import Series, DataFrame
import pandas as pd
import numpy as np
import os
import matplotlib.pylab as plt
from sklearn.cross_validation import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import cl... | jasdumas/jasdumas.github.io | post_data/RF_adult_income.py | Python | mit | 5,021 |
import threading
from queue import Queue, Empty
from time import sleep
from libAnt.drivers.driver import Driver
from libAnt.message import *
class Network:
def __init__(self, key: bytes = b'\x00' * 8, name: str = None):
self.key = key
self.name = name
self.number = 0
def __str__(self... | half2me/libant | libAnt/node.py | Python | mit | 4,209 |
import unittest
import uuid
import pytest
import azure.cosmos.cosmos_client as cosmos_client
import azure.cosmos.retry_utility as retry_utility
import test.test_config as test_config
@pytest.mark.usefixtures("teardown")
class QueryTest(unittest.TestCase):
"""Test to ensure escaping of non-ascii characters from par... | Azure/azure-documentdb-python | test/query_tests.py | Python | mit | 9,355 |
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.mail import Mail
from flask.ext.moment import Moment
from flask.ext.sqlalchemy import SQLAlchemy
from config import config
from flask.ext.redis import Redis
bootstrap = Bootstrap()
mail = Mail()
moment = Moment()
db = SQLAlchemy()
redis1 ... | simonqiang/gftest | app/__init__.py | Python | mit | 888 |
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models.signals import post_save
from django.utils.translation import ugettext as _
from django.utils.timezone import localtime
from actstream impo... | adsworth/ldp3 | ldp/trip/models.py | Python | mit | 2,583 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "santicms.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| daimon99/santicms | src/manage.py | Python | mit | 251 |
import socket
conn=socket.create_connection(('localhost', 1200))
input = conn.makefile()
print input.readline()
conn.close()
# You can use telnet localhost 1200
| robertojrojas/networking-Go | src/DaytimeServer/daytime-client.py | Python | mit | 162 |
#-*- coding: utf-8 -*-
# A very simple Flask Hello World app for you to get started with...
from flask import Flask, render_template, redirect, url_for
from forms import TestForm
app = Flask(__name__, template_folder='/home/dremdem/mysite/templates')
app.secret_key = 's3cr3t'
class NobodyCare(object):
def __in... | dremdem/maykor_python_learn | Lesson16/mysite/flask_app.py | Python | mit | 843 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Lempel–Ziv–Welch compression algorithm example, with 4096 dictionary size."""
from multipack.datastructures import HashTable, DynamicArray
class Lzw:
"""Lempel-Ziv-Welch compression implementation."""
def __init__(self, stream, dict_size=4096):
sel... | mortsi/multi-pack | multipack/lzw.py | Python | mit | 4,768 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.