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 os
import sys
import subprocess
import shlex
import sys
import StringIO
import datetime
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + os.sep + os.pardir + os.sep + "makahiki" + os.sep)
from apps.utils import script_utils
def termination_string():
"""
Gets the current system time and app... | jtakayama/makahiki-draft | install/run_initialize_instance.py | Python | mit | 7,542 |
# python standard library
import unittest
# third-party
try:
from mock import patch
except ImportError:
pass
# this package
from theape.parts.storage.screenstorage import ScreenStorage
class TestScreenStorage(unittest.TestCase):
def setUp(self):
self.sys_patch = patch('sys.stdout')
s... | rsnakamura/theape | theape/parts/storage/tests/testscreenstorage.py | Python | mit | 1,239 |
#!/bin/python
"""
Main user interface and controller for Tinbergen.
"""
import sys
import os
import gobject
import gtk
import gst
import tbdatamodel
import string
#import math
NO_TIME = float('nan')
if __name__ == '__main__':
# Get the path to this script using sys.argv[0]
script_dir = os.path.dirname(sys.a... | biogeo/tinbergen | tinbergen.py | Python | mit | 24,413 |
# Extracts a singla RAW depth file of contiguous data
#
# Requires to build xndec
import struct
from onifile import *
from xndec import *
if __name__ == "__main__":
import sys,os
if len(sys.argv) == 0:
print "Required: ONIfilename"
sys.exit(-1)
docolor = len(sys.argv) > 3
filesize = ... | eruffaldi/pyoni | src/onitool/oni2depth.py | Python | mit | 1,555 |
from .command_line_mixins import CommandLineMixins
from .module import Module
from .console_app import ConsoleApp
__all__ = ['CommandLineMixins', 'Module', 'ConsoleApp'] | mattvperry/ktane-py | ktane/__init__.py | Python | mit | 173 |
import asyncio
import tempfile
from io import BytesIO
import shutil
import os
from lbry.blob_exchange.serialization import BlobRequest
from torba.testcase import AsyncioTestCase
from lbry.conf import Config
from lbry.extras.daemon.storage import SQLiteStorage
from lbry.blob.blob_manager import BlobManager
from lbry.b... | lbryio/lbry | lbry/tests/unit/blob_exchange/test_transfer_blob.py | Python | mit | 11,587 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from json import loads
from multiprocessing import Pool
from PyWebRunner import WebTester
from yaml import load
ARGS = {}
def run_test(filepath):
try:
errors = ARGS.errors or False
driver = ARGS.browser or 'Chrome'
timeout = A... | IntuitiveWebSolutions/PyWebRunner | PyWebRunner/runner.py | Python | mit | 2,439 |
# -*- coding: utf-8 -*-
import time
from public_api import PublicAPI
class PrivateAPI(PublicAPI):
def __init__(self, client_id, secret, production=True, version="v1", timeout=20):
try:
super(self.__class__, self).__init__(production, version, timeout)
except TypeError:
Publ... | wisfern/vnpy | beta/api/korbit/korbit-python-master/korbit/private_api.py | Python | mit | 6,359 |
from survive.player.playermodel import Player
from survive.activities.crafting.craftingcontroller import CraftingController
from survive.inventory.inventorycontroller import InventoryController
from survive.activities.hunting.huntingcontroller import HuntingController
from survive.generic.controller import Controller
f... | Azurras/Survithon | survive/game/gamecontroller.py | Python | mit | 2,082 |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
# clicking on Welcome link.
driver = webdriver.Firefox()
driver.get("http://www.practiceselenium.com/")
driver.find_element_by_link_text("Check Out").click()
assert "Check Out" in driver.title
driver.close() | bishnucit/Python-Preludes | 6.py | Python | mit | 286 |
import ply.lex as lex
tokens = (
'NUMBER',
'PLUS',
'MINUS',
'TIMES',
'DIVIDE',
'LPAREN',
'RPAREN',
'COMMA',
'ID',
'EXCL',
'POW',
'DTIMES',
'MOD',
'EQ',
'APOSTROPHE',
'AND',
'OR',
'NOT',
)
t_DTIMES = r'\*\*'
t_PLUS = r'\+'
t_MINUS =... | ProjetPP/PPP-CAS | ppp_cas/calchasLex.py | Python | mit | 876 |
'''
Graph
======
The :class:`Graph` widget is a widget for displaying plots. It supports
drawing multiple plot with different colors on the Graph. It also supports
a title, ticks, labeled ticks, grids and a log or linear representation on
both the x and y axis, independently.
To display a plot. First create a graph w... | kivy/plyer | examples/accelerometer/using_graph/libs/garden/garden.graph/__init__.py | Python | mit | 35,339 |
class Solution(object):
def countNegatives(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
if len(grid) == 0 or len(grid[0]) == 0:
return 0
cnt = 0
rows = len(grid)
cols = len(grid[0])
for i in range(rows):
... | kingsamchen/Eureka | crack-data-structures-and-algorithms/leetcode/count_negative_numbers_in_a_sorted_matrix_q5340.py | Python | mit | 488 |
# 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-compute/azure/mgmt/compute/v2017_12_01/models/disk_encryption_settings.py | Python | mit | 1,716 |
from .. import tool
def test_keygen():
def get_keyring():
WheelKeys, keyring = tool.get_keyring()
class WheelKeysTest(WheelKeys):
def save(self):
pass
class keyringTest:
backend = keyring.backend
@classmethod
... | IsCoolEntertainment/debpkg_python-wheel | wheel/test/test_tool.py | Python | mit | 746 |
from pathlib import Path
import logging
logger = logging.getLogger('ipyvolume')
HERE = Path(__file__).parent
_figures = []
_watching = set()
def _update_shaders(path=None, file_changed=None):
names = ['volr-fragment', 'volr-vertex', 'mesh-vertex', 'mesh-fragment', 'scatter-vertex', 'scatter-fragment', 'shadow-v... | maartenbreddels/ipyvolume | ipyvolume/hotreload.py | Python | mit | 1,466 |
#!/usr/bin/env python
from __future__ import unicode_literals
from setuptools import setup
setup(
name='xcache',
version='0.2',
description='clean caches when needed',
author='Sven R. Kunze',
author_email='srkunze@mail.de',
url='https://github.com/srkunze/xcache',
license='MIT',
class... | srkunze/xcache | setup.py | Python | mit | 573 |
import os
import urlparse
import zipfile
import requests
from bs4 import BeautifulSoup
from downloader import Downloader
from common import Subtitles, User
class Subscene(object):
def __init__(self):
super(Subscene, self).__init__()
self._base_url = u'http://subscene.com/'
self._search_url = self._get_full_ur... | scorpiontahir02/easysub | src/easysub/subscene.py | Python | mit | 2,817 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from os.path import splitext
import yaml
def build_plan(discovery_result, config=None):
""" Extract content and determine which checks need to be run
Checks are assigned in the following order:
1. <filename>.fval
2. <dir>.fval
3. d... | jonhadfield/fval | fval/plan.py | Python | mit | 3,930 |
from mimetypes import guess_extension
from uuid import UUID
from interfax.files import File, Files
from interfax.response import Document
try:
from unittest.mock import Mock, patch, call
except ImportError:
from mock import Mock, patch, call
class TestFiles(object):
def setup_method(self, method):
... | interfax/interfax-python | tests/test_files.py | Python | mit | 3,313 |
import psycopg2
import unittest
import sys
import os
class GFugaRotaTest(unittest.TestCase):
def setUp(self):
self.table = open(os.path.abspath('../') + '/sql/createsTable/FugaRota.sql', 'r')
self.constraints = open(os.path.abspath('../') + '/sql/createsTable/FugaRota_const.sql', 'r')
sel... | UFCGProjects/sig | src/tests/FugaRotaTest.py | Python | mit | 1,680 |
# Configuration file for jupyter-notebook.
#------------------------------------------------------------------------------
# Configurable configuration
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Logg... | Enjoying-Learning/Enjoying | docs/config/jupyter_notebook_config.py | Python | mit | 22,055 |
# -*- coding: utf-8 -*-
import requests
from .utils.misc import file2dict
from vnpy.rpc import RpcClient
TIMEOUT = 10
class RemoteClient:
def __init__(self, broker, host, port=1430, **kwargs):
self._s = requests.session()
self._api = "http://{}:{}".format(host, port)
self._broker = broke... | msincenselee/vnpy | vnpy/api/easytrader/remoteclient.py | Python | mit | 5,338 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
##################################################################
# Documentation
"""Package containing a collection of ML-based sentiment analyzers.
Attributes:
.. moduleauthor:: Wladimir Sidorenko (Uladzimir Sidarenka)
"""
#############################... | WladimirSidorenko/CGSA | cgsa/dl/__init__.py | Python | mit | 1,120 |
print("Status: 302")
print("Location: /static/index.html")
| Serag8/Bachelor | My_work/appengine/index_redirect.py | Python | mit | 59 |
import numpy as np
from gym.spaces import Box
from metaworld.envs import reward_utils
from metaworld.envs.asset_path_utils import full_v2_path_for
from metaworld.envs.mujoco.sawyer_xyz.sawyer_xyz_env import SawyerXYZEnv, _assert_task_is_set
class SawyerHammerEnvV2(SawyerXYZEnv):
HAMMER_HANDLE_LENGTH = 0.14
... | rlworkgroup/metaworld | metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_hammer_v2.py | Python | mit | 5,835 |
# Name: undo.py
# Purpose: XRC editor, undo/redo module
# Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be>
# Created: 01.12.2002
# RCS-ID: $Id: undo.py 54812 2008-07-29 13:39:00Z ROL $
from globals import *
import view
from component import Manager
from model import Model
undo... | ktan2020/legacy-automation | win/Lib/site-packages/wx-3.0-msw/wx/tools/XRCed/undo.py | Python | mit | 7,307 |
import unittest
from pungi import string
from pungi import expect
class StringTest(unittest.TestCase):
def test_pp_with_no_args(self):
expect(string.pp()).toBe("")
def test_pp_of_single_arg(self):
expect(string.pp('1')).toBe("'1'")
expect(string.pp(1)).toBe("1")
def test_pp_of_m... | endeepak/pungi | tests/test_string.py | Python | mit | 846 |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 8 08:13:16 2016
@author: bell
"""
import os
import pandas as pd
path = '/Users/bell/Data_Local/SPN1_Development/ukmet_buoy/download/L4/SPN1/'
all_files= [each for each in os.listdir(path) if each.endswith('.dat')]
frame = pd.DataFrame()
for f in all_files[610:620]:
... | shaunwbell/FOCI_Analysis | temp/ukmet_buoy_spn1.py | Python | mit | 1,167 |
def getoverlap(a,b):
return max(0,min(a[1],b[1]) - max(a[0],b[0]))
print(getoverlap( [[1, 3], [3, 6]])) | defjam903/Google-Interview-prep | Searching/Bunny_Lap.py | Python | mit | 110 |
from setuptools import setup
setup(
name='testpkg',
packages=['testpkg'],
sass_manifests={
'testpkg': ('static/scss', 'static/css')
},
setup_requires=['libsass']
)
| admire93/libsass-python | testpkg/setup.py | Python | mit | 194 |
"""Custom WeGovNow template tags."""
from django import template
register = template.Library()
@register.filter()
def exclude_uwum_app(apps):
"""Exclude UWUM app."""
apps_without_uwum = []
for app in apps:
if app.provider.id != 'uwum':
apps_without_uwum.append(app)
return apps... | ExCiteS/geokey-wegovnow | geokey_wegovnow/templatetags/wegovnow.py | Python | mit | 470 |
# -*- coding: utf-8 -*-
from distutils.core import setup
from pyrobotics.BB import __version__
setup(name='pyRobotics',
version=__version__,
author='Adrián Revuelta Cuauhtli',
author_email='adrianrc.89@gmail.com',
url='http://bioroboticsunam.github.io/pyRobotics',
license='LICENSE.txt',
data_fil... | BioRoboticsUNAM/pyRobotics | setup.py | Python | mit | 513 |
# Copyright (c) 2013 Jose Cruz-Toledo
# 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, dis... | jctoledo/ligandneighbours | ligandneighbours.py | Python | mit | 10,769 |
# DO NOT IMPORT ANY PROJECT MODULES HERE
# to avoid circular imports.
# DO NOT MOVE THIS FILE; IT MUST REMAIN INSIDE THE PROJECT FOLDER (check below)
import os
# WARNING: project-path assumes this file is in the project folder itself.
CURRENT_FILE_PATH = os.path.abspath(__file__)
PROJECT_PATH = os.path.dirname(CURREN... | FermiParadox/ipy_student_exercises | never_importer.py | Python | mit | 384 |
"""Base Treehopper API for Python.
This module provides digital and analog I/O, hardware and software PWM, I2C, SPI, and UART support.
"""
## @namespace treehopper.api
from treehopper.api.interfaces import *
from treehopper.api.pin import Pin, PinMode, ReferenceLevel
from treehopper.api.device_commands import DeviceC... | treehopper-electronics/treehopper-sdk | Python/treehopper/api/__init__.py | Python | mit | 976 |
"""."""
import numpy as np
import pyaccel
from siriuspy.namesys import SiriusPVName as _PVName
from siriuspy.devices import SOFB
from ..optimization import SimulAnneal
from ..utils import ThreadedMeasBaseClass as _BaseClass, \
ParamsBaseClass as _ParamsBaseClass
class Params(_ParamsBaseClass):
"""."""
... | lnls-fac/apsuite | apsuite/commisslib/measure_respmat_tbbo.py | Python | mit | 8,002 |
"""
__MT_pre__RPortPrototype.py_____________________________________________________
Automatically generated AToM3 syntactic object (DO NOT MODIFY DIRECTLY)
Author: levi
Modified: Sun Aug 9 23:45:38 2015
________________________________________________________________________________
"""
from ASGNode import *
from A... | levilucio/SyVOLT | GM2AUTOSAR_MM/MT_pre__RPortPrototype.py | Python | mit | 5,212 |
#!/usr/bin/env python
import itertools
import six
from csvkit import CSVKitReader
from csvkit.cli import CSVKitUtility
from csvkit.headers import make_default_headers
class CSVLook(CSVKitUtility):
description = 'Render a CSV file in the console as a fixed-width table.'
def add_arguments(self)... | haginara/csvkit | csvkit/utilities/csvlook.py | Python | mit | 2,305 |
#!/usr/bin/env python
# encoding: utf-8
from yard.exceptions import NoDefaultVersion
from yard.consts import RESOURCE_VERSION_RE
import re
class Metaclass(type):
def __getattr__(self, attrname):
return getattr(self.versions[self.default], attrname)
class VersionController(object):
__metaclass__ = Me... | laginha/yard | src/yard/version.py | Python | mit | 1,888 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.11.1)
#
# WARNING! All changes made in this file will be lost!
from qtpy import QtCore
qt_resource_data = b"\
\x00\x00\x01\x65\
\x3c\
\x73\x76\x67\x20\x78\x6d\x6c\x6e\x73\x3d\x22\x68\x74\x74\x... | unrza72/qplotutils | qplotutils/ui/resources_rc.py | Python | mit | 38,372 |
import thread_pool
from tornado.testing import AsyncTestCase
from unittest import TestCase
import time, socket
from tornado.ioloop import IOLoop
from tornado.iostream import IOStream
from functools import partial
class ThreadPoolTestCase(AsyncTestCase):
def tearDown(self):
thread_pool.thread_pool = thread... | bobpoekert/tornado-threadpool | tests.py | Python | mit | 2,117 |
'''
Action Bar
==========
.. versionadded:: 1.8.0
.. image:: images/actionbar.png
:align: right
The ActionBar widget is like Android's `ActionBar
<http://developer.android.com/guide/topics/ui/actionbar.html>`_, where items
are stacked horizontally. When the area becomes to small, widgets are moved
into the :clas... | Cheaterman/kivy | kivy/uix/actionbar.py | Python | mit | 29,384 |
#!/usr/bin/env python
#
# Generated Fri Apr 15 16:00:42 2011 by generateDS.py version 2.4c.
#
import sys
import ??? as supermod
etree_ = None
Verbose_import_ = False
( XMLParser_import_none, XMLParser_import_lxml,
XMLParser_import_elementtree
) = range(3)
XMLParser_import_library = None
try:
# lxml
... | dasmith/FrameNet-python | 1.5/frameIndexSub.py | Python | mit | 5,466 |
import numpy as N
from mplstereonet import stereonet_math
from scipy.stats import chi2
from numpy.testing import assert_array_almost_equal
from .geom.util import vector, unit_vector, dot
def quaternion(vector, angle):
"""
Unit quaternion for a vector and an angle
"""
return N.cos(angle/2)+vector*N.sin... | davenquinn/Attitude | attitude/stereonet.py | Python | mit | 7,069 |
#!/usr/bin/env python3
"""
Copyright 2017 Jocelyn Falempe kdj0c@djinvi.net
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, cop... | kdj0c/onepagepoints | onepagebatch.py | Python | mit | 17,621 |
from unittest.mock import patch
from cloudbridge.factory import CloudProviderFactory
from cloudbridge.factory import ProviderList
from django.contrib.auth.models import User
from django.urls import reverse
from djcloudbridge import models as cb_models
from rest_framework import status
from rest_framework.test impor... | CloudVE/djcloudbridge | djcloudbridge/tests.py | Python | mit | 8,003 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2019_04_01/aio/operations/_network_security_groups_operations.py | Python | mit | 30,870 |
# Array-based circular queue implementation.
# Copyright © 2014 Bart Massey
# [This program is licensed under the "MIT License"]
# Please see the file COPYING in the source
# distribution of this software for license terms.
class Queue(object):
def __init__(self, max_size):
self.queue = [None] * (max_size ... | BartMassey/nb-misc | arrayqueue.py | Python | mit | 1,163 |
from nflpool.data.dbsession import DbSessionFactory
from nflpool.data.account import Account
"""Create a check that only the user who is True in the AccountInfo database with is_superuser can access
the admin pages. Make sure nflpool/data/secret.py has an email assigned that matches the user during registration"""
... | prcutler/nflpool | nflpool/services/admin_service.py | Python | mit | 1,833 |
{
# Financial Page - debt tab
"uidFinanceTabDebtPanel": {
W3Const.w3PropType: W3Const.w3TypePanel,
W3Const.w3PropSubUI: [
"uidFinanceTabDebtQueryPanel",
"uidFinanceTabDebtAddPanel"
]
},
# Finance Page - debt tab, query
"uidFinanceTabDebtQueryPanel": {... | eddiedb6/ej | web/metadata/EJUIFinanceDebtTab.py | Python | mit | 7,198 |
"""
Copyright (c) 2015-2020 Raj Patel(raj454raj@gmail.com), StopStalk
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
... | stopstalk/stopstalk-deployment | private/scripts/populate-atcoder-problems.py | Python | mit | 1,810 |
from .calibre_access import (print_record, calibre_downloads, calibre_searches,
all_records, download_coro, search_coro, download_database,
locate_logs, get_database)
__all__ = (print_record, calibre_downloads, calibre_searches, all_records, download_coro,
... | Laharah/calibre-access | calibre_access/__init__.py | Python | mit | 386 |
class Clock:
"""Clock that displays 24 hour clock that rollsover properly"""
def __init__(self, hour, minute):
self.hour = hour
self.minute = minute
self.cleanup()
def __repr__(self):
return f'Clock({self.hour}, {self.minute})'
def __str__(self):
return '{:02d}... | exercism/python | exercises/practice/clock/.meta/example.py | Python | mit | 752 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Blog'
db.delete_table('posts_blog')
# Adding model 'BlogPost'
db.create_t... | carquois/blobon | blobon/posts/migrations/0004_auto__del_blog__add_blogpost.py | Python | mit | 6,130 |
from datetime import datetime
import time
import sys
import re
import click
FMT = "%Y-%m-%d %H:%M:%S"
def validate_date(ctx, param, value):
if isinstance(value, tuple):
return value
try:
datetime.strptime(value, FMT)
except ValueError as err:
raise click.BadParameter("format must ... | davidone/misc | diff_between_times.py | Python | mit | 1,097 |
"""Receive image_path as identifier instead
Revision ID: cc01f345ceb7
Revises: d782b5fe2eae
Create Date: 2015-12-29 15:16:01.785492
"""
# revision identifiers, used by Alembic.
revision = 'cc01f345ceb7'
down_revision = 'd782b5fe2eae'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands a... | ma3lstrom/manga-cork | mangacork/migrations/versions/cc01f345ceb7_receive_image_path_as_identifier_instead.py | Python | mit | 956 |
"""
WSGI config for test_project project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATI... | dsanders11/django-autocomplete-light | test_project/test_project/wsgi.py | Python | mit | 1,557 |
# -*- coding: utf-8 -*-
#
# PyMeasure documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 6 13:06:00 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | dvspirito/pymeasure | docs/conf.py | Python | mit | 8,651 |
# Fix for older setuptools
import re
import os
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup, find_packages
def fpath(name):
return os.path.join(os.path.dirname(__file__), name)
def read(fname):
try:
return open(fpath(fname), encoding=... | rochacbruno/flask_simplelogin | setup.py | Python | mit | 1,254 |
# Provide a class for authoring a simple letter. In the constructor, supply the names of
# the sender and the recipient:
# def _ _init_ _(self, letterFrom, letterTo)
# Supply a method
# def addLine(self, line)
# to add a line of text to the body of the letter. Supply a method
# def getText(self)
# that ret... | futurepr0n/Books-solutions | Python-For-Everyone-Horstmann/Chapter9-Objects-and-Classes/P9_11.py | Python | mit | 1,242 |
#!/usr/bin/python
# Import System Required Paths
import sys
sys.path.append('/usr/local/src/volatility-master')
# Import Volalatility
import volatility.conf as conf
import volatility.registry as registry
registry.PluginImporter()
config = conf.ConfObject()
import volatility.commands as commands
import volatility.addr... | muscatmat/vmi-event-naive-detector | scripts/check_creds.py | Python | mit | 972 |
"""
The setup package to install MasterQA dependencies
"""
from setuptools import setup, find_packages # noqa
import os
import sys
this_directory = os.path.abspath(os.path.dirname(__file__))
long_description = None
total_description = None
try:
with open(os.path.join(this_directory, 'README.md'), 'rb') as f:
... | masterqa/MasterQA | setup.py | Python | mit | 2,876 |
import numpy as np
import pandas as pd
import datetime as dt
def initiate_procedure():
results = pd.DataFrame(columns=('Responses', 'Value', 'Reversal', 'Run',
'Trial', 'Direction', 'DateTime'))
return results
def append_result(res, resp, down, up, stepSize... | codles/UpDownMethods | UpDownMethods/process.py | Python | mit | 5,746 |
# Powered by Python 2.7
# To cancel the modifications performed by the script
# on the current graph, click on the undo button.
# Some useful keyboards shortcuts :
# * Ctrl + D : comment selected lines.
# * Ctrl + Shift + D : uncomment selected lines.
# * Ctrl + I : indent selected lines.
# * Ctrl + Shift +... | spaghetti-open-data/ODFest2017-horizon2020-network | H2020_Code_2017/delKCoreSubGraphs.py | Python | mit | 4,608 |
# 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-billing/azure/mgmt/billing/operations/invoices_operations.py | Python | mit | 11,810 |
import re
from functools import reduce
from nltk import word_tokenize
from nltk.corpus import stopwords
stop = set(stopwords.words("english"))
repls = ("(", ""), (")", ""), ("'s", "")
def tokenize(text):
lev1 = re.sub("[!#*%:,.;&-]", "", text) # Remove specific chars
lev2 = re.sub(r'... | Nickil21/Indeed-ML-codesprint-2017 | source/data_preprocessing.py | Python | mit | 776 |
# Function to stack raster bands.
import numpy as np
from osgeo import gdal
def stack_bands(filenames):
"""Returns a 3D array containing all band data from all files."""
bands = []
for fn in filenames:
ds = gdal.Open(fn)
for i in range(1, ds.RasterCount + 1):
bands.append(ds.Ge... | cgarrard/osgeopy-code | Chapter12/listing12_1.py | Python | mit | 378 |
from rest_framework import serializers
from .models import ModerationAction
class ModerationSerializer(serializers.ModelSerializer):
content_key = serializers.CharField(write_only=True)
content = serializers.CharField(write_only=True)
content_author_id = serializers.CharField(write_only=True)
auto_ap... | CareerVillage/slack-moderation | src/moderations/serializers.py | Python | mit | 701 |
# -*- coding: utf-8 -*-
import re
from mobify.source import MobifySource
class OReillySource(MobifySource):
HEADER = u"""
<h1>{title}</h1>
<p><strong>{lead}</strong></p>
<p><small>{author} @ oreilly.com</small><br></p>
"""
@staticmethod
def is_my_url(url):
# https://www.oreilly.com/ideas/the-ev... | macbre/mobify | mobify/sources/oreilly.py | Python | mit | 1,627 |
# -*- coding: utf-8 -*-
import numpy as np
from numpy.random import RandomState
from fakespikes.util import to_spikes
from fakespikes.rates import constant
class Spikes(object):
"""Simulates statistical models of neural spiking
Params
------
n : int
Number of neurons
t : float
Sim... | voytekresearch/fakespikes | fakespikes/neurons.py | Python | mit | 4,820 |
import sys, os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../src/lib/common')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../src/lib/etvnet')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../src/lib/youtube')))
| shvets/etvnet-plex-plugin | test/test_helper.py | Python | mit | 302 |
from ..Qt import QtGui, QtCore
import os, weakref, re
from ..pgcollections import OrderedDict
from .ParameterItem import ParameterItem
PARAM_TYPES = {}
PARAM_NAMES = {}
def registerParameterType(name, cls, override=False):
global PARAM_TYPES
if name in PARAM_TYPES and not override:
raise Exception("Pa... | hiuwo/acq4 | acq4/pyqtgraph/parametertree/Parameter.py | Python | mit | 29,533 |
class Solution:
def findDuplicate(self, nums: List[int]) -> int:
slow = nums[0]
fast = nums[nums[0]]
while slow != fast:
slow = nums[slow]
fast = nums[nums[fast]]
slow2 = 0
while slow != slow2:
slow = nums[slow]
slo... | jiadaizhao/LeetCode | 0201-0300/0287-Find the Duplicate Number/0287-Find the Duplicate Number.py | Python | mit | 357 |
#!/usr/bin/python
from __future__ import division
import argparse
import datetime, sys, os
import urllib2, json
import ttbindec, defs
p = argparse.ArgumentParser()
p.add_argument('ttbin', nargs='*', type=argparse.FileType('rb'), default=sys.stdin, help='.ttbin files (default stdin)')
p.add_argument('-g', '--geolocate... | dlenski/ttbindec | ttbin_summary.py | Python | mit | 3,157 |
# This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
import mahotas as mh
from mahotas.colors import rgb2grey
import numpy as np
# Adds a little salt-n-pep... | krahman/BuildingMachineLearningSystemsWithPython | ch10/figure13.py | Python | mit | 791 |
from nanoplay import PayloadProtocol, ControlProtocol, Player, CustomServer
| nanonyme/nanoplay | nanoplay/__init__.py | Python | mit | 76 |
# -*- coding: utf-8 -*-
"""
:copyright: Copyright 2013 by Łukasz Mierzwa
:contact: l.mierzwa@gmail.com
"""
from __future__ import unicode_literals
import logging
from inspect import ismethod
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.utils.encoding import ... | prymitive/bootstrap-breadcrumbs | django_bootstrap_breadcrumbs/templatetags/django_bootstrap_breadcrumbs.py | Python | mit | 7,292 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/restart_deployed_code_package_description.py | Python | mit | 1,899 |
import sys
import argparse
from svtools.external_cmd import ExternalCmd
class BedpeSort(ExternalCmd):
def __init__(self):
super(BedpeSort, self).__init__('bedpesort', 'bin/bedpesort')
def description():
return 'sort a BEDPE file'
def epilog():
return 'To read in stdin and output to a file, use /d... | hall-lab/svtools | svtools/bedpesort.py | Python | mit | 1,152 |
"""
@name: Modules/Web/web_internet.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2013-2020 by D. Brian Kimmel
@license: MIT License
@note: Created on Jun 3, 2013
@summary: Handle the "Internet" information for a house.
"""
__updated__ = '2020-01-02'
# Import system... | DBrianKimmel/PyHouse | Project/src/Modules/Computer/Web/web_internet.py | Python | mit | 1,421 |
# encoding: UTF-8
"""
无人值守运行服务
"""
from __future__ import print_function
from time import sleep
from datetime import datetime, time
from multiprocessing import Process
import webbrowser
from webServer import run as runWebServer
from tradingServer import main as runTradingServer
from vnpy.trader.vtEngine import LogE... | rrrrrr8/vnpy | examples/WebTrader/run.py | Python | mit | 1,854 |
import os
import hashlib
import urllib
import logging
import re
import json
import webapp2
import jinja2
from google.appengine.api import channel as channel_api # 'channel' is kind of ambiguous in context
from google.appengine.ext import db
from google.appengine.api import memcache
# This section will eventually get ... | pytonc/upluschat | main.py | Python | mit | 15,674 |
from .basedimension import BaseDimensionEncoder, BaseDimensionDecoder
from zounds.core import IdentityDimension
class IdentityDimensionEncoder(BaseDimensionEncoder):
def __init__(self):
super(IdentityDimensionEncoder, self).__init__(IdentityDimension)
def dict(self, o):
return dict()
class ... | JohnVinyard/zounds | zounds/persistence/identitydimension.py | Python | mit | 466 |
from hubcheck.pageobjects.widgets.item_list import ItemList
from hubcheck.pageobjects.basepageelement import TextReadOnly
import re
class SearchResults(ItemList):
"""Specific type of ItemList used to iterate through lists that result
from searches.
Provides a header_counts() function, that returns t... | codedsk/hubcheck | hubcheck/pageobjects/widgets/search_results.py | Python | mit | 1,807 |
from django.db import models
from django.core.urlresolvers import reverse
from django.contrib.contenttypes.models import ContentType
try: # new import added in Django 1.7
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.fields import GenericRelation
except Impor... | saulshanabrook/django-dumper | test/models.py | Python | mit | 2,381 |
#coding=utf8
import os, sys
from PIL import Image
from PIL import ImageFile
import glob
output_dir = "resized_images"
def main():
# 找出路徑下全部的圖片檔案
types = ('*.png', '*.jpg', '*.jpeg' ,'*.bmp' ,'*.gif') # the tuple of file types
all_image_files = []
for files in types:
all_image_files.extend(gl... | twtrubiks/pillow-examples | resizePicture/resize.py | Python | mit | 2,818 |
from __future__ import unicode_literals
import json
from django.utils import six
from kgb import SpyAgency
from reviewboard.hostingsvcs.github import GitHub
from reviewboard.hostingsvcs.models import HostingServiceAccount
from reviewboard.hostingsvcs.repository import RemoteRepository
from reviewboard.hostingsvcs.ut... | chipx86/reviewboard | reviewboard/webapi/tests/test_remote_repository.py | Python | mit | 5,858 |
# -*- coding: utf-8 -*-
"""
tests.trello.py
~~~~~~~~~
a Trello mock for testing
"""
from flask import current_app as app
class MockTrelloCard:
id = 1
url = "http://mock.trello.com/card/1"
def __init__(self):
return
class MockTrelloLabel:
def __init__(self, _id, name, *args, **kw... | boulder-python/boulderpython.org | tests/mocks/trello.py | Python | mit | 1,457 |
# Copyright (c) 2015-2018 Cisco Systems, Inc.
#
# 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... | metacloud/molecule | test/unit/command/test_syntax.py | Python | mit | 1,887 |
# Problem B
# Small dataset
# O = G = V = 0. (Each unicorn has only one hair color in its mane.)
def solve(N, R, Y, B):
res = ""
imp = "IMPOSSIBLE "
if sum((R,Y,B)) == 0:
return ""
if max(R,Y,B) > N//2 :
return imp
if (R==Y) and (Y==B):
return "RYB"*R
elif (R==Y) and... | subhrm/google-code-jam-solutions | solutions/2017/1B/B/B_small.py | Python | mit | 1,604 |
"""
This file is part of the continuum IDA PRO plugin (see zyantific.com).
The MIT License (MIT)
Copyright (c) 2016 Joel Hoener <athre0z@zyantific.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software")... | zyantific/continuum | continuum/client.py | Python | mit | 4,170 |
#!/usr/bin/env python
"""
This provides various OMAP/IGEP related helper functions.
"""
from igep_qa.helpers.common import QMmap, QCpuinfo, QDeviceTree
import commands
import time
def cpu_is_omap5():
""" Returns True if machine is OMAP5, otherwise returns False
"""
return QDeviceTree().compatible("ti,... | eballetbo/igep_qa | igep_qa/helpers/omap.py | Python | mit | 4,552 |
from __future__ import print_function
import os
import sys
import subprocess as sp
import pytest
import yaml
import tempfile
import requests
import argparse
import json
import re
from argparse import Namespace
from argparse import ArgumentParser
import glob
import contextlib
import tarfile
from helpers import CreateRec... | gogetdata/ggd-cli | tests/test_make_meta_recipe.py | Python | mit | 47,025 |
import sys
from clint.textui import puts
from clint.textui import colored
from clint.textui import progress
from clint.textui import columns
TTY_COLUMN_SIZE = 80
isatty = lambda : sys.stdout.isatty()
def print_colored(txt, color):
if isatty():
puts(color(txt))
print_error = lambda txt: print_colored... | pgk/genignore | genignore/helpers.py | Python | mit | 616 |
#!/usr/bin/env python3
# imports go here
#
# Free Coding session for 2015-01-30
# Written by Matt Warren
#
def main():
print("writing code for someone else")
print("and not getting paid for it")
print("with no chance that it benfits me - even indirectly")
print("on a friday night")
print("this su... | mfwarren/FreeCoding | 2015/01/fc_2015_01_30.py | Python | mit | 367 |
from setuptools import setup, find_packages
setup(
name='cql3parser',
version='0.0.0',
install_requires=['Parsley == 1.1'],
packages=find_packages()
)
| dreid/cql3parser | setup.py | Python | mit | 168 |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:4496")
else:
access = Ser... | TimMaylon/corecoin | contrib/bitrpc/bitrpc.py | Python | mit | 7,838 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Johnny's main caching functionality."""
import sys
import re
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.3, 2.4 fallback.
from uuid import uuid4
try:
from hashlib import md5
except ImportError:... | GoodCloud/johnny-cache | johnny/cache.py | Python | mit | 21,360 |
#!/usr/bin/env python
from setuptools import setup
requirements = [
"docopt>=0.6.1",
"virtualenv",
]
setup(name='ppm',
version='1.0',
description='Python Package Manager',
author='Guilherme Rezende',
author_email='guilhermebr@gmail.com',
url='http://github.com/guilhermebr/pp... | guilhermebr/ppm | setup.py | Python | mit | 489 |