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 credentials
import digitalocean
import json
def process_droplet(droplet):
stats = {}
stats['name']= droplet.name
stats['id'] = droplet.id
stats['memory'] = droplet.memory
stats['vcpus'] = droplet.vcpus
stats['disk'] = droplet.disk
stats['status'] = droplet.status
return stats
dr... | michaelx11/onehaus | digitalocean/list_droplets.py | Python | mit | 546 |
from __future__ import unicode_literals
from django.db import models
class Account(models.Model):
eth_address = models.CharField(max_length=64, verbose_name=u"Ethereum address", db_index=True)
created = models.DateTimeField(auto_now_add=True)
class Emailaddress(models.Model):
account = models.ForeignKe... | arjanz/eth-identity-registry | eth_identity/main/models.py | Python | mit | 549 |
def login():
import pycurl
curlobj=pycurl.Curl()
curlobj.setopt(pycurl.URL, 'http://192.168.20.55:100/login_handler?__logins=0&came_from=192.168.20.55:100/post_login')
curlobj.setopt(pycurl.POSTFIELDS, 'login=admin&password=ecrmadmin');
curlobj.setopt(pycurl.COOKIEFILE, "cookies.txt")
curlobj.s... | LamCiuLoeng/vat | vatsystem/util/scheduled_tasks.py | Python | mit | 882 |
__author__ = 'Nick'
| nh0815/PySearch | engine/__init__.py | Python | mit | 20 |
import os
import time
import urllib.error
import urllib.request
from bs4 import BeautifulSoup
url = 'https://news.yahoo.co.jp/list/'
ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) '\
'AppleWebKit/537.36 (KHTML, like Gecko) '\
'Chrome/55.0.2883.95 Safari/537.36 '
req = urllib.request.Request(url, hea... | nkmk/python-snippets | notebook/beautiful_soup_image.py | Python | mit | 1,018 |
from setuptools import setup
setup(name='models',
version='0.1',
description='Models',
url='http://github.com/bhzunami/immo',
author='Nicolas Mauchle',
author_email='nicolas.mauchle@students.fhnw.ch',
license='MIT',
packages=['models'],
zip_safe=False) | bhzunami/Immo | immo/models/setup.py | Python | mit | 301 |
#---------------------------------------------------------------------------------------------------------------
# HELPER CLEANER
# Name: cleaner.py
# Desc: Encapsula funciones estaticas para formatear y limpiar el output del parser
# Author: Lucas Paiva
#----------------------------------------------------------------... | lucaspaiva/minion-crawler | helpers/cleaner.py | Python | mit | 2,611 |
'''
loan_payoff_tools: Test module.
Meant for use with py.test.
Write each test as a function named test_<something>.
Read more here: http://pytest.org/
Copyright 2014, Phillip Green II
Licensed under MIT
'''
import unittest
import loan_payoff_tools.utils as utils
class UtilsTestCase(unittest.TestCase):
def ... | phillipgreenii/loan_payoff_tools | tests/utils_test.py | Python | mit | 1,362 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/12/27 11:47
# @Author : TOM.LEE
A = 1
B = 2
C = 3 | amlyj/pythonStudy | 3.6/test_import/config.py | Python | mit | 115 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : user.py
@Time : 2019/03/03 21:43:22
@Author : Kyaing
@Version : 1.0
@Desc : None
'''
# here put the import lib
from flask import Blueprint
# blueprint
user = Blueprint('user', __name__)
@user.route('/v1/user/get') # v1表示版本
def get_use... | kaideyi/KDYSample | kYPython/flask-api/ginger/app/api/v1/user.py | Python | mit | 352 |
from .abstract_website import AbstractWebsiteTask
class PythonTask(AbstractWebsiteTask):
"""
Runs Python code in the project's virtual environment, with Django loaded.
"""
name = "python"
def run(self, code, show=True):
setup = \
"import os; os.environ[\'DJANGO_SETTINGS_MODULE... | Numerical-Brass/Wool | fabfile/website/python.py | Python | mit | 589 |
# coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
__version__ = '1.5.0'
__version_info__ = (1, 5, 0)
| wbond/asn1crypto | asn1crypto/version.py | Python | mit | 152 |
import datetime
from xml.dom import minidom
from xml.sax.saxutils import unescape
class LinkedInModel:
pass
def __repr__(self):
d = {}
for x,y in self.__dict__.items():
if (self.__dict__[x]):
d[x] = y
return (self.__module__ + "." + self.__class__.__name__ +... | mo-mughrabi/python-linkedin | linkedin/model.py | Python | mit | 12,721 |
import _plotly_utils.basevalidators
class BelowValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="below", parent_name="layout.mapbox.layer", **kwargs
):
super(BelowValidator, self).__init__(
plotly_name=plotly_name,
parent_name=par... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/mapbox/layer/_below.py | Python | mit | 416 |
"""Philips hue proxy code."""
import abc
import logging
import sys
import threading
from pi import proxy
class ScanningProxy(proxy.Proxy):
"""A proxy object with a background scan thread."""
__metaclass__ = abc.ABCMeta
def __init__(self, refresh_period):
self._refresh_period = refresh_period
self._... | tomwilkie/awesomation | src/pi/scanning_proxy.py | Python | mit | 1,444 |
from loda_support import *
from query_search import *
from gp_support import *
class Query(object):
def __init__(self, opts=None, **kwargs):
self.opts = opts
self.test_indexes = None
def update_query_state(self, **kwargs):
pass
def get_next_query(self, **kwargs):
pass
... | shubhomoydas/pyaad | pyalad/query_model.py | Python | mit | 7,739 |
from device import Register, Device
class FakeServo(Device):
def __init__(self, dev_id, dev_port, show_packets=True):
self.model = Register(0, 2, Register.RO, init_val=12)
self.version = Register(2, 1, Register.RO, init_val=1)
self.led = Register(0x19, 1, Register.RW, 0, 1, 0,... | dhylands/bioloid3 | fake_servo.py | Python | mit | 589 |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of maker.
# License www.tree.io/license
"""
Format localization for Russian language
"""
DATE_FORMAT = "j F Y"
DATETIME_FORMAT = "j F Y, H:i"
SHORT_DATE_FORMAT = "d.m.Y"
SHORT_DATETIME_FORMAT = "d.m.Y, H:i"
TIME_FORMAT = "H:i"
SHORT_TIME_FORMAT = ... | alejo8591/maker | formats/ru/formats.py | Python | mit | 326 |
#!/usr/bin/env python
from . import _import
from .expression import Expression
from .integerliteralexpr import IntegerLiteralExpr
from ..type.primitivetype import PrimitiveType
class GeneratorExpr(Expression):
def __init__(self, kwargs={}):
super(GeneratorExpr, self).__init__(kwargs)
locs = _im... | plum-umd/java-sketch | jskparser/ast/expr/generatorexpr.py | Python | mit | 1,556 |
""" Handles caching downloaded data. """
import collections
import json
import logging
import operator
import os
import cPickle as pickle
import sys
import time
import cv2
import numpy as np
import images
import utils
logger = logging.getLogger(__name__)
class Cache(object):
""" Defines an interface for cache... | djpetti/rpinets | common/data_manager/cache.py | Python | mit | 26,163 |
# calling words from the individual word lists #
# import list
import random
import linecache
def CallWordlist(difficulty):
if difficulty == 1:
# the difficulty is be chosen in the main game
wordfile = "wordlist.txt"
numberoflines = 1
wordlistother(wordfile,numberoflin... | Dhillan/Type | Callingwordlist.py | Python | mit | 2,146 |
from setuptools import setup, find_packages
setup(
name='mochizuki',
version='0.0.1',
description='Python IRC server',
long_description='',
url='https://github.com/kennydo/mochizuki',
author='Kenny Do',
license='MIT',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
... | kennydo/mochizuki | setup.py | Python | mit | 637 |
# coding=utf-8
__author__ = 'Anatoli Kalysch'
from idaapi import PluginForm, msg
from ui.UIManager import form_to_widget
class PluginViewer(PluginForm):
def __init__(self, title):
super(PluginViewer, self).__init__()
self.title = title
def Show(self, **kwargs):
return PluginForm.Show... | anatolikalysch/VMAttack | ui/PluginViewer.py | Python | mit | 635 |
#!/usr/bin/env python
import subprocess
from os import path
DIR_OF_THIS_SCRIPT = path.dirname( path.abspath( __file__ ) )
PYTHON_DIR = path.join( DIR_OF_THIS_SCRIPT, 'python' )
def RunFlake8():
print( 'Running flake8' )
subprocess.check_call( [
'flake8',
'--select=F,C9',
'--max-complexity=10',
P... | davits/DyeVim | run_tests.py | Python | mit | 583 |
from django import template
register = template.Library()
@register.filter(name='display_account', is_safe=True)
def display_account(field):
# all_accounts = ['Twitter', 'Facebook']
all_accounts = ['Facebook']
for base_account in field:
acc = base_account.get_provider_account().get_brand()['name']... | bhanduroshan/fbstats-docker | mainapp/templatetags/display_account.py | Python | mit | 850 |
from renderer import RenderBase
# import all of the render filters that we want to invoke, and make
# sure that they are listed in a sensible sequence in the PIPELINE
# list.
from markdownRenderer import MarkdownRenderer
from tagRenderer import TagRenderer
PIPELINE = [
#RenderBase,
TagRenderer,
# Keep... | bgporter/wastebook | renderers/__init__.py | Python | mit | 626 |
import sys
import time
import logging
from lbrynet.core import log_support
from lbrynet.core.client.ClientRequest import ClientRequest
from lbrynet.core.server.ServerProtocol import ServerProtocol
from lbrynet.core.client.ClientProtocol import ClientProtocol
from lbrynet.core.RateLimiter import RateLimiter
from lbryne... | zestyr/lbry | tests/unit/core/client/test_ConnectionManager.py | Python | mit | 11,761 |
__author__ = 'agopalak'
import forecastio
import datetime
import pytz
import json
import os
from geopy import geocoders
import logging
# Setting up logging
logger = logging.getLogger(__name__)
logging.basicConfig(format='%(levelname)s: %(name)s: %(message)s', level=logging.INFO)
# Forecast.io API key
forecastIO_api_... | agopalak/football_pred | pre_proc/get_weather.py | Python | mit | 1,742 |
import unittest
from unittest.mock import Mock
from constants import PROTECTIVE_HEAL_ABSORB_PERCENTAGE
from heal import Heal, HolyHeal, ProtectiveHeal
class HealTests(unittest.TestCase):
def test_str(self):
heal_amount = 5.111
heal = Heal(heal_amount=heal_amount)
expected_str = f'{heal_am... | Enether/python_wow | tests/heal_tests.py | Python | mit | 6,757 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-08-01 21:56
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('website', '0001_initial'),
]
operations = [
... | Frky/moon | website/migrations/0002_auto_20160801_2156.py | Python | mit | 1,031 |
# -*- coding: utf-8 -*-
#
# -----------------------------------------------------------------------------------
# Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softw... | frankyao47/open-hackathon | open-hackathon-client/src/client/views/__init__.py | Python | mit | 15,997 |
import unittest
import logging
from ..basic import DictDatastore
from ..key import Key
from ..query import Query
class TestDatastore(unittest.TestCase):
pkey = Key('/dfadasfdsafdas/')
stores = []
numelems = []
def check_length(self,len):
try:
for sn in self.stores:
self.assertEqual(len(sn... | datastore/datastore | datastore/core/test/test_basic.py | Python | mit | 30,676 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('mutant', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='BooleanFieldDefinition',
fields=[
... | charettes/django-mutant | mutant/contrib/boolean/migrations/0001_initial.py | Python | mit | 707 |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.nic.hn/status_registered
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.parser import parse ... | huyphan/pyyawhois | test/record/parser/test_response_whois_nic_hn_status_registered.py | Python | mit | 2,258 |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
from sklearn.metrics import classification_report
# "coarse or fine"
GRANULARITY = "fine"
if GRANULARITY == "coarse":
GT_FILENAME = "val_coarse.txt"
PREDICTION_FILENAME = "predictions_rand_coarse.txt"
elif GRANULARITY... | ahaque/dsbowl | createConfusionMatrix.py | Python | mit | 1,375 |
import sys
import json
import urllib
import urllib2
import logging
MATHJS_API = "http://math.leftforliving.com"
class CalculatorPlugin(object):
logger = None
"""Logging object for CalculatorPlugin"""
def __init__(self):
# Initialize logging
self.logger = logging.getLogger(__name__)
d... | BiohZn/Cardinal | plugins/calculator/plugin.py | Python | mit | 1,732 |
#! /usr/bin/env python
"""Parses QR codes found in image files and outputs results as CSV"""
from os import listdir
import argparse
import csv
import Image
import zbar
parser = argparse.ArgumentParser()
parser.add_argument("-p", "--path", type=str, required=True, help="the path to the image files")
parser.add_argu... | ruscoe/Python-QR-Dump | qr-dump.py | Python | mit | 1,261 |
# Ant
#
# Copyright (c) 2012, Gustav Tiger <gustav@tiger.name>
#
# 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, m... | ddboline/Garmin-Forerunner-610-Extractor_fork | ant/easy/__init__.py | Python | mit | 1,159 |
#!python
"""
script which updates all modules,
works on Linux and Windows if the module is
included the list of modules handled by this module
"""
from __future__ import print_function
import sys
import os
import argparse
def get_parser():
"""
defines the way to parse the script ``pymy_update``
"""
ty... | sdpython/pymyinstall | src/pymyinstall/cli/pymy_update.py | Python | mit | 4,453 |
# 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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/__init__.py | Python | mit | 689 |
import os
import sys
import glob
from setuptools import setup
if sys.platform == 'darwin':
import py2app
elif sys.platform == 'win32':
import py2exe
sys.setrecursionlimit(100000)
def find_data_files(sources, targets, patterns):
"""Locates the specified data-files and returns the matches
in a data_files... | emptyewer/DEEPN | setup_readdepth.py | Python | mit | 3,770 |
"""This module contains functions used for extracting components
from a covariance matrix.
"""
import numpy as np
from scipy.linalg import eigh as sp_eigh
import fa_kit.retention as retention
# Options used in Factor extraction
EIG_OPTS = {
'noise_reg': 1.0e-4
}
# Options used in Prinicple Axis Factoring
PAF_O... | bmcmenamin/fa_kit | fa_kit/extraction.py | Python | mit | 3,363 |
from prettytable import PrettyTable
t = open('dados_rj.txt').readlines()
candidatos = []
for linha in t[2:-1]:
candidatos.append(eval(linha[:-3]))
candidatos.append(eval(t[-1][:-4]))
coligacoes = {}
for candidato in candidatos:
h = candidato['cc'].find('-')
if h == -1: coligacao = candidato['cc']
el... | rodrigoj42/AnaliseTSE | workbench/vereadores.py | Python | mit | 2,773 |
#!/usr/bin/env python
#
# Jetduino Example for using the Grove - LCD RGB Backlight (http://www.seeedstudio.com/wiki/Grove_-_LCD_RGB_Backlight)
#
# The Jetduino connects the Jetson and Grove sensors. You can learn more about the Jetduino here: http://www.NeuroRoboticTech.com/Projects/Jetduino
#
# Have a question about... | NeuroRoboticTech/Jetduino | Software/Python/grove_rgb_lcd/example2.py | Python | mit | 4,838 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lichesshub.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that t... | AfricaChess/lichesshub | manage.py | Python | mit | 808 |
# -*- coding: utf-8 -*-
from pyramid.view import view_config
from pyramid.response import Response
from io import StringIO
import urllib.request
import httplib2
from pyramid.httpexceptions import HTTPBadRequest, HTTPBadGateway
import logging
import json
import os
log = logging.getLogger(__name__)
class Metadata(objec... | Geoportail-Luxembourg/geoportailv3 | geoportal/geoportailv3_geoportal/views/metadata.py | Python | mit | 2,717 |
# vim:ts=4:sts=4:sw=4:expandtab
import base64
import logging
import pickle
import psycopg2.extensions
import select
import time
from django import db
from django.db import connection
from django.db import models
from satori.core.dbev.events import registry
from satori.events import Event
from satori.core.models import... | zielmicha/satori | satori.core/satori/core/dbev/notifier.py | Python | mit | 6,622 |
#-*- coding: utf-8 -*-
import abc
import glob
import os
import json
from scipy import io
import numpy as np
import h5py
import random
import re
random.seed(111)
class FileSorter:
def __init__(self):
pass
def sort(self, list_of_strs):
list_of_strs.sort(key=self._alphanum_key)
def _tr... | penny4860/SVHN-deep-digit-detector | digit_detector/file_io.py | Python | mit | 4,440 |
from django.http import HttpResponse
from django.shortcuts import render
def home(request):
'''
'''
return render(request, 'home.html')
| texib/bitcoin-zoo | core/views.py | Python | mit | 150 |
class OpenStruct(dict):
'''Base wrapper to allow direct method access to item keys.'''
######################################################################
# private
def __getattr__(self, key):
if key[0] == '_':
return self.__dict__[key]
else:
return self.get(... | bradrf/configstruct | configstruct/open_struct.py | Python | mit | 618 |
""" test minimum dx function """
from __future__ import division
import numpy as np
from firedrake import *
from quasi_geostrophic_model import *
def test_min_cell_length_1d():
n = 10.0
Dx = 1.0 / n
mesh = UnitIntervalMesh(n)
min_cell_length = MinDx(mesh)
actual_hyp = np.sqrt((Dx ** 2))
... | alsgregory/quasi_geostrophic_model | tests/test_min_dx.py | Python | mit | 734 |
"""
WSGI config for meh project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` sett... | comandrei/meh | meh/meh/wsgi.py | Python | mit | 1,410 |
#!/usr/bin/env python2
##
# PyCross
# https://github.com/leosartaj/PyCross.git
#
# Copyright (c) 2014 Sartaj Singh
# Licensed under the MIT license.
##
from PyCross import __version__
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup, find_packages
setup(
... | leosartaj/PyCross | setup.py | Python | mit | 1,202 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Create the data for the LSTM.
"""
import os
import sys
import argparse
import numpy as np
import h5py
import itertools
import pdb
import re
import pickle
from collections import defaultdict
def build_embeds(fname, outfile, words):
def load_bin_vec(fname, vocab):
... | jeffreyling/seq2seq-hard | preprocess_summary.py | Python | mit | 26,676 |
"""
Coinbase Python Client Library
AUTHOR
George Sibble
Github: sibblegp
LICENSE (The MIT License)
Copyright (c) 2013 George Sibble "gsibble@gmail.com"
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the ... | Jbusma/BitcoinVendor | coinbase.py | Python | mit | 17,091 |
from setuptools import setup, find_packages
description = """
See `github repo <https://github.com/pior/pyramid_bugsnag>`_ for information.
"""
setup(
name='pyramid_bugsnag',
version='0.5.dev0',
description='Pyramid extension to send exceptions to Bugsnag',
long_description=description,
classifi... | pior/pyramid_bugsnag | setup.py | Python | mit | 1,200 |
from eth_utils.toolz import (
curry,
)
@curry
def zpad(value: bytes, length: int) -> bytes:
return value.rjust(length, b'\x00')
zpad32 = zpad(length=32)
@curry
def zpad_right(value: bytes, length: int) -> bytes:
return value.ljust(length, b'\x00')
zpad32_right = zpad_right(length=32)
@curry
def fp... | pipermerriam/ethereum-abi-utils | eth_abi/utils/padding.py | Python | mit | 427 |
#!/usr/local/bin/python3
def main():
# Test suite
return
if __name__ == '__main__':
main()
| HKuz/Test_Code | Problems/sample.py | Python | mit | 107 |
#!/usr/bin/env python
"""
Cross-platform batch computing interface.
"""
import os
import subprocess, subprocess as sub
import getpass
from collections import OrderedDict as odict
from itertools import chain
import copy
import time
import resource
import numpy as np
from ugali.utils.logger import logger
GB=1024**3
CL... | DarkEnergySurvey/ugali | ugali/utils/batch.py | Python | mit | 9,657 |
from django.urls import path
from .views import MyView
urlpatterns = [
path('', MyView.as_view(), name='form'),
]
| bradleyg/django-ajaximage | example/kitten/urls.py | Python | mit | 121 |
from django.contrib import admin
from .models import Payment, Fee
class PaymentAdmin(admin.ModelAdmin):
list_display = ['owner', 'amount', 'the_file', 'status']
class FeeAdmin(admin.ModelAdmin):
list_display = ['owner', 'amount', 'payment_for', 'status']
admin.site.register(Payment, PaymentAdmin)
admin.si... | kaqfa/semantik | payments/admin.py | Python | mit | 346 |
__author__ = 'bunjiboys'
import logging
log = logging.getLogger(__name__)
class ThirdPartyPlugin(object):
def run(self, *args, **kwargs):
log.info('run method executed. self: {self}, args: {args}, kwargs: {kwargs}'.format(
self=str(self),
args=", ".join(args),
kwargs="... | bunjiboys/plugin_example | third_party/third_party_plugin/plugins/third_party.py | Python | mit | 668 |
# The contents of this file are subject to the Common Public Attribution
# License Version 1.0. (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://code.reddit.com/LICENSE. The License is based on the Mozilla Public
# License Version 1.1, ... | h2oloopan/easymerge | EasyMerge/tests/reddit/r2/r2/models/admintools.py | Python | mit | 15,321 |
import unittest
from application import server
from application.server import app,db, publish_json_to_queue, remove_username_password
from application.server import republish_latest_version, republish_by_title_and_application_reference
from application.server import republish_all_versions_of_title, NoRowFoundException
... | LandRegistry/system-of-record | tests/test_app.py | Python | mit | 34,058 |
# 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/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_container_service_client.py | Python | mit | 4,092 |
# coding:utf-8
'''
Created on 2017/12/26.
@author: chk01
''' | sunyihuan326/DeltaLab | shuwei_fengge/practice_one/Company/match_check/__init__.py | Python | mit | 61 |
import _plotly_utils.basevalidators
class ReversescaleValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(self, plotly_name="reversescale", parent_name="cone", **kwargs):
super(ReversescaleValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_nam... | plotly/plotly.py | packages/python/plotly/plotly/validators/cone/_reversescale.py | Python | mit | 409 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from config.template_middleware import TemplateResponse
from gaebusiness.business import CommandExecutionException
from tekton import router
from gaecookie.decorator import no_csrf
from reviews_app import facade
from routes.reviewss import... | seijiakiyama/fatec-script | tekton-master/backend/appengine/routes/reviewss/admin/edit.py | Python | mit | 1,019 |
import unittest
import numpy as np
from pymicro.xray.detectors import RegArrayDetector2d
class DetectorsTests(unittest.TestCase):
def setUp(self):
"""testing the detectors module:"""
self.detector = RegArrayDetector2d(size=(1024, 512))
self.detector.pixel_size = 0.1 # mm
self.dete... | heprom/pymicro | pymicro/xray/tests/test_detectors.py | Python | mit | 4,122 |
########################################################
# evaluator.py
# Author: Jamie Zhu <jimzhu@GitHub>
# Created: 2014/2/6
# Last updated: 2014/11/03
########################################################
import numpy as np
from numpy import linalg as LA
import time, sys
import random
import core
from utilitie... | wsdream/CARP | Baseline/src/evaluator.py | Python | mit | 5,581 |
from __future__ import print_function
import pickle
import os.path as path
import sklearn.utils
def dump_list(input_list, file_path):
"""
Dump list to file, either in "txt" or binary ("pickle") mode.
Dump mode is chosen accordingly to "file_path" extension.
Parameters
----------
input_lis... | ndrplz/computer_vision_utils | list_helper.py | Python | mit | 2,647 |
from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register(Appointment)
| jimga150/HealthNet | HealthNet/appointments/admin.py | Python | mit | 120 |
import socket as sk
import sys
from PyQt4.QtCore import *
MAX_THREADS = 50
#def usage():
#print("\npyScan 0.1")
#print("usage: pyScan <host> [start port] [end port]")
class Scanner(QThread):
def __init__(self):
super(Scanner,self).__init__(self)
# build up the socket obj
self.sd = ... | shashi28/nuts | Temp Code/ps_new.py | Python | mit | 2,859 |
#!/usr/bin/env python
#-*- coding: utf8 -*-
from locals import TEXTURES_DIR
from objects import Object
import glob
import os
import pygame.transform
class AnimationException(Exception):
pass
class Animation(Object):
passable = True
movable = True
frame_time = 40 # ms
directory = None
textu... | ironsmile/tank4eta | animations.py | Python | mit | 3,462 |
from flask import Flask, render_template, redirect, url_for
from csv_view.csvdiff import diff_files, patch
import webbrowser
from collections import OrderedDict
from io import StringIO
import unicodecsv as csv
from git import Repo
import json
import os
import sys
from difflib import SequenceMatcher
import random, threa... | danielecook/csv-compare | csv_view/compare.py | Python | mit | 3,053 |
# -*- coding: utf-8 -*-
# Gematria-API (c) Raphael Enochian
| raphael-enochian/gematria-api | gematria_api/rest.py | Python | mit | 60 |
'''
M-LOOP: Machine-Learning Online Optimization Packaage
Python package for performing automated, online optimization of scientific experiments or anything that can be computer controlled. The package employs machine learning algorithms to rapidly find optimal parameters for systems under control.
If you use this p... | charmasaur/M-LOOP | mloop/__init__.py | Python | mit | 734 |
import socket
import subprocess
def is_port_free(port):
val = subprocess.check_output(['ss', '-tH']).decode('utf-8')
return ':{} '.format(port) not in val
def free_port():
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('', 0))
port_num = sock.getsockname()[1]
sock.close()
... | nathants/py-util | util/net.py | Python | mit | 340 |
from pypov.pov import Texture, Pigment
from pypov.pov import Finish, Box, Cone, Object, Cylinder
from pypov.pov import Union, Difference, Intersection
from pypov.colors import Colors
from pypov.common import grey, white
from lib.base import five_by_five_corner
from lib.textures import cross_hatch, cross_hatch_2, wall_... | autowitch/pypov | scenes/geomorphs/lib/geomorphs/corner_5x5_021.py | Python | mit | 2,262 |
from datetimewidget.widgets import DateTimeWidget
from django import forms
from locations.models import Event, Quest
class EventForm(forms.ModelForm):
class Meta:
model = Event
fields = (
'start', 'end', 'address', 'title', 'description', 'point'
)
widgets = {
... | ilonajulczuk/tubylcy | tubylcy/locations/forms.py | Python | mit | 590 |
#!/usr/bin/python
import traveler
import math
traveler.start() | luiseduardobrito/mc346-1s-2015-projeto-python | main.py | Python | mit | 64 |
# -*- coding: utf-8 -*-
import click
from ircb.lib.async import coroutinize
from ircb.storeclient import UserStore
@click.group(name='users')
def user_cli():
"""Manager users"""
from ircb.storeclient import initialize
initialize()
@click.command(name='create')
@click.argument('username')
@click.argumen... | waartaa/ircb | ircb/cli/user.py | Python | mit | 623 |
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Rds20140815CreateAccountForInnerRequest(RestApi):
def __init__(self,domain='rds.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.AccountDescription = None
self.AccountName = None
self.AccountPassword = None
se... | francisar/rds_manager | aliyun/api/rest/Rds20140815CreateAccountForInnerRequest.py | Python | mit | 567 |
import png
import numpy as np
import sys, os
import nrrd
if (len(sys.argv) < 3):
print 'Error: missing arguments!'
print 'e.g. python MaskNRRD.py imageIn.nrrd mask.nrrd imageOut.nrrd'
else:
print 'Loading image: %s...'% (str(sys.argv[1]))
data1, header1 = nrrd.read(str(sys.argv[1]))
print 'Loa... | Robbie1977/NRRDtools | MaskNRRD.py | Python | mit | 751 |
class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
s = str(x)
return s == s[::-1] if x >= 0 else False
s = Solution()
print s.isPalindrome(3)
print s.isPalindrome(-42324)
print s.isPalindrome(22)
print s.isPalindrome(-21474... | nanhuayu/hello-world | OnlineJuge/leetcode/009PalindromeNumber02.py | Python | mit | 327 |
import json
import os
from io import StringIO
from django.core.management.base import BaseCommand
from django.core.management import call_command
from website.settings import BASE_DIR
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument("app_name", type=str)
parser.ad... | Macainian/BaseDjangoProject | website/management/commands/create_fixture.py | Python | mit | 2,231 |
from inspect import getargspec
from pyws.functions.args import DictOf, TypeFactory
from pyws.utils import cached_property
__all__ = ('Function', 'NativeFunctionAdapter', )
CONTEXT_ARG_NAME = 'context'
class Function(object):
"""
An abstract function class. Implements simple context handling and argument
... | stepank/pyws | src/pyws/functions/__init__.py | Python | mit | 5,479 |
import dateutil.parser
max_gap = 10
with open('created.txt', 'rb') as f:
last_dt = None
for line in [line.strip() for line in f.readlines()]:
dt = dateutil.parser.parse(line)
if last_dt is not None:
delta = dt - last_dt
if delta.total_seconds() > max_gap:
... | maroy/TSTA | p3/gaps.py | Python | mit | 386 |
'''
Created on Sep 26, 2013
@author: gary
'''
import time
import xmlrpclib
class XBeeCommand( object ):
'''
classdocs
'''
url = ""
connected = False
def __init__( self, host ):
'''
Constructor
'''
super( XBeeCommand, self ).__init__()
self.url = 'http:... | gary-pickens/HouseMonitor | housemonitor/utils/xbee_command.py | Python | mit | 1,730 |
"""
Tests of the core auth models (Role, Membership, Collection, FacilityUser, etc).
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django.db.utils import IntegrityError
from django.test im... | indirectlylit/kolibri | kolibri/core/auth/test/test_models.py | Python | mit | 27,911 |
"""
title control-break example
author Ernesto P. Adorio
description Control break implementation example using finite state machine.
Actual report formatting to be provided by Python programmer.
"""
# control-break example on branch and salesman sample records.
records = [("branch1", "sale... | ActiveState/code | recipes/Python/473847_Control_break_report/recipe-473847.py | Python | mit | 2,738 |
from app import app
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8000)
| alexa-infra/dastier | dastier/serve.py | Python | mit | 87 |
# Author: Samuel Genheden samuel.genheden@gmail.com
"""
Program to analyse the elements of all solutes in a list
The solutes are taken from the Minnesota solvation database
"""
import argparse
import re
import dblib
def _elements(form) :
"""
Parse elements from molecular formula
"""
elements = []
... | SGenheden/Scripts | Projects/Solvation/analyse_elements.py | Python | mit | 1,294 |
from __future__ import print_function
import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
try:
import argparse
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
except ImportError:
... | EVEprosper/ProsperSlides | ProsperSlides/quickstart.py | Python | mit | 2,617 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# MEASURE - Master Equation Automatic Solver for Unimolecular REactions
#
# Copyright (c) 2010 by Joshua W. Allen (jwallen@mit.edu)
#
# Permission is hereby granted, free of charge, to... | jwallen/MEASURE | measure.py | Python | mit | 9,973 |
'''
pyspark --packages com.databricks:spark-csv_2.11:1.5.0 --executor-memory 6g
'''
import sys
from operator import add
from pyspark import SparkContext
from csv import reader
import os
import StringIO
import datetime
import numbers
import re
def get_type_desc(line):
return (line[6], line[7]), 1
if __name__ == ... | leedtan/SparklesSunshinePuppies | MapReduce_kycd_OfnsDesc.py | Python | mit | 837 |
from flask import render_template
from flask import request
from flaskexample import app
from sqlalchemy import create_engine
import pandas as pd
import psycopg2
import yaml
from a_Model import ModelIt
from flaskexample.support_functions import formatted_query
ymlfile = open("../configs.yml", 'r')
cfg = yaml.load(ymlf... | joelmpiper/bill_taxonomy | apps/flaskexample/views.py | Python | mit | 4,450 |
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
def landing(request):
return HttpResponseRedirect(reverse("game"))
def game(request, template="mf_game/game.html"):
data = {}
return render(request, template, data)
| aminehaddad/mf-game | mathfun/mf_game/views.py | Python | mit | 305 |
# -*- coding: utf-8 -*-
"""
ENERPI - CRON Scheduler
- Print User-CRON table
- Set command on reboot
- Set periodic command
- Remove CRON command
"""
# crontab included in python-crontab
# noinspection PyPackageRequirements
from crontab import CronTab
import datetime as dt
def info_crontable():
"""
Print cur... | azogue/enerpi | enerpi/config/crontasks.py | Python | mit | 3,572 |
"""
For Class #2 of an informal mini-course at NYU Stern, Fall 2014.
Topic: reminders, matplotlib graphics
Repository of materials (including this file):
* https://github.com/DaveBackus/Data_Bootcamp
Written by Dave Backus, Sarah Beckett-Hile, and Glenn Okun
Created with Python 3.4
"""
"""
Reminders 0: editor, IP... | DaveBackus/Data_Bootcamp | Code/Python/bootcamp_mini_graphics.py | Python | mit | 4,376 |