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 pandas as pd
import pickle
from urllib.request import urlopen
from bs4 import BeautifulSoup
from collections import OrderedDict
import logging
import datetime
log = logging.getLogger(__name__)
# Make a publicly available filename output format
OUTPUT_FILENAME_PREFIX_FORMAT = "{date}_{ticker}"
OUTPUT_FILENAME_S... | ktarrant/options_csv | options_csv.py | Python | mit | 7,143 |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... | KhronosGroup/COLLADA-CTS | StandardDataSets/collada/library_effects/effect/profile_COMMON/technique/phong/transparent/effect_phong_transparent_rgb_zero/effect_phong_transparent_rgb_zero.py | Python | mit | 4,635 |
import asyncio
import unittest
import random
from gremlinpy import Gremlin
from . import ConnectionTestCases, EntityTestCases, MapperTestCases
from gizmo import Mapper, Request, Collection, Vertex, Edge
from gizmo.mapper import EntityMapper
class BaseTests(unittest.TestCase):
def setUp(self):
self.requ... | emehrkay/Gizmo | gizmo/test/integration/titan.py | Python | mit | 1,103 |
# t1- TAS
import micropython
micropython.alloc_emergency_exception_buf(100)
import machine as m
from time import sleep_us
from t1 import T1
import unittest
class TestT1(unittest.TestCase):
def testInit(self):
tt = T1()
self.assertEqual(tt.counter, 0)
self.assertIsInstance(tt.led, m.Pin)
... | pramasoul/ESP-geiger | test_t1.py | Python | mit | 1,517 |
"""
Imports from the utils.multiclass module of Scikit-learn.
"""
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi
# License: BSD 3 clause
from __future__ import division
from collections import Sequence
from scipy.sparse import issparse
from scipy.sparse.base import spmatrix
from scipy.sparse import dok_matrix... | flennerhag/mlens | mlens/externals/sklearn/type_of_target.py | Python | mit | 5,606 |
# -*- coding: utf-8 -*-
'''
'''
import numpy as np
import pandas as pd
import unittest
from . import mask_the_info
class TestMaskingMethodSelection(unittest.TestCase):
'''
Test the function selects the masking method to be used
'''
def test_improper_method(self):
'''
Test providing an... | GeorgeManakanatas/PPDM | data_masking_methods/test_mask_the_info.py | Python | mit | 1,315 |
from distutils.core import setup
setup(
name='django-model-monitor',
version='0.0.1',
packages=['modelmonitor'],
package_dir={'': 'src'},
url='https://github.com/OmegaDroid/django-model-monitor',
license='MIT',
author='Daniel Bate',
author_email='',
description='App to monitor chang... | OmegaDroid/django-model-monitor | setup.py | Python | mit | 362 |
import csv
def load_csv_data(file_path, data_type=float, max_rows=None):
"""
Example:
>>> csvio.load_csv_data("train_input.csv")
# Loads all train_input and returns a list of lists
>>> csvio.load_csv_data("train_output.csv" data_type=int)
# Reads csv numbers as integers instead of floats
#... | deepanjanroy/aml3 | csvio.py | Python | mit | 1,512 |
from __future__ import absolute_import
import os
import sys
from subprocess import check_call, CalledProcessError
from google.protobuf.descriptor import FieldDescriptor
if sys.version_info[0] >= 3:
long = int
unicode = str
def compile_proto_file(input_files, output_path, include_path):
"""
Compile a .... | knipknap/telemetric | telemetric/protoutil.py | Python | mit | 3,836 |
from twisted.cred import portal
from twisted.conch import manhole_ssh
from twisted.conch.checkers import SSHPublicKeyDatabase
from carapace.util import ssh as util
from myriad.game.shell import servershell
def getShellFactory(game, **namespace):
realm = servershell.TerminalRealm(game, namespace)
sshPortal =... | oubiwann/myriad-worlds | myriad/game/shell/service.py | Python | mit | 582 |
import datetime as dt
import lucy.core
import uuid
def _get_table(what):
return getattr(lucy.core.db, what)
class LucyObject(dict):
_type = None
def __init__(self, **kwargs):
self['_type'] = self._type
for k, v in kwargs.items():
self[k] = v
def _gen_uuid(self):
... | paultag/lucy | lucy/models/__init__.py | Python | mit | 1,973 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0004_auto_20150426_1817'),
]
operations = [
migrations.AddField(
model_name='blog',
name='co... | codefisher/djangopress | djangopress/blog/migrations/0005_blog_comments_enabled.py | Python | mit | 407 |
# 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-batchai/azure/mgmt/batchai/models/cluster_update_parameters.py | Python | mit | 1,217 |
__author__ = 'Ashwin'
__email__ = 'gashwin1@umbc.edu'
"""
Basic LDA module that is used in the project.
"""
import re
from gensim import corpora, models
import operator
class LDAVisualModel:
def __init__(self, word_corpus):
"""
The LDAVisualModel requires list of word lists from the
docum... | codehacken/LDAExplore | processdata/lda.py | Python | mit | 4,195 |
#
# Python Design Patterns: Builder
# Author: Jakub Vojvoda [github.com/JakubVojvoda]
# 2016
#
# Source code is licensed under MIT License
# (for more details see LICENSE)
#
import sys
#
# Product
# the final object that will be created using Builder
#
class Product:
def __init__(self):
self._partA = ""
se... | JakubVojvoda/design-patterns-python | builder/Builder.py | Python | mit | 2,322 |
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import dateparser
STYLES_DICT = {
'black': '',
'green': 'primary',
'red': 'danger'
}
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
def create_blocks(text: str, entitlement: str, options: list, reply: str) -> list:
... | VirusTotal/content | Packs/Slack/Scripts/SlackAskV2/SlackAskV2.py | Python | mit | 4,905 |
'''
Created on 24 Jan 2017
@author: muth
'''
import os
import RPi.GPIO as GPIO
import threading
from Adafruit_Thermal import *
from time import sleep
from PIL import Image
from PIL import ImageOps
from PIL import ImageEnhance
from PIL import ImageDraw
from PIL import ImageFont
from smemlcd import SMem... | pierre-muth/polapi-zero | dev/polapizero_04.py | Python | mit | 7,080 |
# 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-consumption/azure/mgmt/consumption/models/price_sheet_result.py | Python | mit | 1,885 |
from setuptools import setup, find_packages
setup(
name='opencontracts',
version='0.1',
description="Contract viewing news application",
long_description='',
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Operating System :: OS Independe... | pudo-attic/opencontracts.eu | setup.py | Python | mit | 771 |
# -*- coding: utf-8 -*-
"""
Classes for controling machine learning processes
"""
import numpy as np
import math
import matplotlib.pyplot as plt
import csv
class TrainingPlot:
"""
Creating live plot during training
REUIRES notebook backend: %matplotlib notebook
@TODO Migrate to Tensorboard
"""
... | Breta01/handwriting-ocr | src/ocr/mlhelpers.py | Python | mit | 2,767 |
import cx_Oracle
import time
def callback(message):
print "Message type:", message.type
print "Message database name:", message.dbname
print "Message tables:"
for table in message.tables:
print "--> Table Name:", table.name
print "--> Table Operation:", table.operation
if table.... | marhar/sqlminus | examples/change-notify/oracle-changenotify.py | Python | mit | 1,135 |
#!/usr/bin/python
'''This is the job manage script.
This is a quite universal code for all different type of simulations'''
import os
import time
import subprocess
import logging
import inlist
PROCLIST = []
logging.basicConfig(filename="./project.log",
level=logging.INFO,
format="\n[job.daemon][%(a... | kunyuan/job_manage | job_manager.py | Python | mit | 5,695 |
# -*- coding: utf-8 -*-
"""User models."""
import datetime as dt
from flask_login import UserMixin
from members.database import Column, Model, SurrogatePK, db, reference_col, relationship
from members.extensions import bcrypt
class Role(SurrogatePK, Model):
"""A role for a user."""
__tablename__ = 'roles'
... | iandees/membership | members/user/models.py | Python | mit | 2,166 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from config import DefaultConfig
from flask import Flask
from flask import jsonify
from flask import render_template
from flask import request
from helpers import load_module_instances
import json
import logging
import logging.config
import os
def get_app(config=None,... | ryankanno/flask-skeleton | flask_skeleton/app.py | Python | mit | 2,313 |
"""
The logic and workings behind the stow and unstow sub-commands
"""
from collections import Counter
import pathlib
from dploy import actions
from dploy import utils
from dploy import error
from dploy import main
from dploy import ignore
# pylint: disable=too-few-public-methods
class AbstractBaseStow(main.Abstract... | arecarn/dploy | dploy/stowcmd.py | Python | mit | 15,248 |
from lxml import etree
from dataset.data import Data
from strategy.parser.default_parser import DefaultParser
import re
class PostParser(DefaultParser):
def __init__(self):
self.super = super(PostParser, self)
self.super.__init__()
def get_url_value(self):
v = re.search(r'\d*.html$', se... | yfsoftcom/crawler | strategy/ssq_wilead_com/post_parser.py | Python | mit | 1,529 |
from flask import Blueprint, request, flash, render_template, redirect
from flask.ext.login import login_required, current_user
from mongoengine import DoesNotExist
from datetime import datetime
from recover.EmailClient import email_patient_invite
from recover.fitbit import Fitbit
from recover.forms.AddPatientForm imp... | SLU-Capstone/Recover | recover/views/new_patient.py | Python | mit | 7,097 |
#!/usr/bin/env python2
# -*- mode: python -*-
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2016 The Electrum developers
#
# 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... | spesmilo/electrum | electrum/plugins/hw_wallet/plugin.py | Python | mit | 16,377 |
from app import Handler
from entities.post import Post
from handlers.auth import Auth
class IndexHandler(Handler):
def get(self):
offset = 0
if self.request.get("page"):
offset = int(self.request.get("page")) - 1
current_page = offset + 1
next_page = current_page + 1... | diegopettengill/multiuserblog | handlers/main.py | Python | mit | 1,045 |
# -*- coding: utf-8 -*-
from .models import Author
def get_or_create_author(id, name, screen_name):
authors = Author.objects.filter(id=id)
if not authors.exists():
author = Author.objects.create(id=id, name=name, screen_name=screen_name)
else:
author = authors.first()
return author
| kk6/onedraw | onedraw/authors/api.py | Python | mit | 317 |
"version"
__version__ = '0.2.0'
| abe-winter/pg13-py | pg13/version.py | Python | mit | 32 |
"""
Tests of slot related functions.
"""
import time
import pkg_resources
from nose.tools import eq_ as eq
from nose.tools import with_setup
from pageobjects.slot import find_slot_figure
from pageobjects.util import NotifierPage
from util import main, setup_server, teardown_server, generate, \
startup, closeout
... | DailyActie/Surrogate-Model | 01-codes/OpenMDAO-Framework-dev/openmdao.gui/src/openmdao/gui/test/functional/test_slots.py | Python | mit | 14,693 |
#!/usr/bin/env python
# encoding: utf-8
"""
x_models.py
Functions to check if the X linked models are followed.
Created by Måns Magnusson on 2013-02-12.
Copyright (c) 2013 __MoonsoInc__. All rights reserved.
"""
from __future__ import print_function
import logging
logger = logging.getLogger(__name__)
def check_X_r... | moonso/genmod | genmod/annotate_models/models/x_models.py | Python | mit | 5,496 |
from django.shortcuts import render
# Create your views here.
# coding:utf-8
import json
import os
import time
from django.conf import settings
from django.http import HttpResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def ueditor_index(request):
"""
uedi... | blackholll/loonblog | apps/ueditor/views.py | Python | mit | 3,838 |
from functools import partial
from mongoengine.queryset.queryset import QuerySet
__all__ = ("queryset_manager", "QuerySetManager")
class QuerySetManager:
"""
The default QuerySet Manager.
Custom QuerySet Manager functions can extend this class and users can
add extra queryset functionality. Any cu... | MongoEngine/mongoengine | mongoengine/queryset/manager.py | Python | mit | 2,222 |
from tastypie.api import Api
from django.conf.urls import patterns, include, url
'''
v1_api = Api(api_name='v1')
v1_api.register(DeviceResource())
'''
from machine.views import ControllerListView
urlpatterns = patterns('',
# ...more URLconf bits here...
# Then add:
# url(r'^api/', include(v1_api.urls)),
# ... | nikaashpuri/aquabrim_project | machine/urls.py | Python | mit | 2,401 |
#!/usr/bin/env python3
import logging
import os
import json
from gi.repository import Gtk, Gst, GLib
from lib.config import Config
from lib.uibuilder import UiBuilder
import lib.connection as Connection
# time interval to re-fetch queue timings
TIMER_RESOLUTION = 1.0
class QueuesWindowController():
def __init__... | voc/voctomix | voctogui/lib/queues.py | Python | mit | 2,030 |
'''
Using decorators with syntactic sugar!!
'''
def decorator(fnc_arg):
def wrapper_fnc():
# perform some operations before calling fnc_arg
fnc_arg()
# perform other operations after calling fnc_arg
return wrapper_fnc
def fnc_arg():
# orginal function
pass
# using decorators
decorated_fnc = decora... | smenon8/AlgDataStruct_practice | practice_problems/Decorators.py | Python | mit | 945 |
from flask import render_template, request, flash, redirect, url_for, make_response, session, g
from wwag import app, database
from datetime import datetime
@app.before_request
def before_request():
if '/static/' in request.path:
return
if session.get('user_type') == "Player":
player = database.execute("SE... | zhoutong/wwag | wwag/views/__init__.py | Python | mit | 2,184 |
#!/usr/bin/env python3
import machine
import utime
def default_remote_id():
"""generate remote id based on machine.unique_id()"""
import uhashlib
from ustruct import unpack
# we compute a hash of board's unique_id, since a boards manufactured
# closely together probably share prefix or suffix, and... | wuub/micropython-rfsocket | rfsocket.py | Python | mit | 4,613 |
from . import abstractarchiver
class TARArchiver(abstractarchiver.AbstractArchiver):
def get_file_extensions(self):
return ['tar']
def list_contents(self, opts):
self.run_cmd(opts, ['tar', '--list', '--verbose', '--file', opts.archive])
def extract_archive(self, opts):
se... | eviljoe/junk-n-stuff | src/unitelib/archivers/tar.py | Python | mit | 577 |
for n in range(2, 10):
for x in range(2, n):
if n % x == 0:
print(n, 'equals', x, '*', n//x)
break
else:
# 循环中没有找到元素
print(n, 'is a prime number')
| darkless456/Python | 求质数.py | Python | mit | 228 |
# cryptopals challenge 3
import array
import re
#most common english letters
letter_points = {
'e' : 10,
't' : 10,
'a' : 10,
'o' : 10,
'i' : 10,
'n' : 10,
's' : 5,
'h' : 5,
'r' : 5,
'd' : 5,
'l' : 5,
'u' : 5
}
def decode(orig, char):
hex_data = orig.decode('hex')
... | muursh/cryptopals | challenge3.py | Python | mit | 1,107 |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
import pyte... | Azure/azure-sdk-for-python | sdk/eventhub/azure-eventhub/tests/livetest/synctests/test_properties.py | Python | mit | 3,596 |
import json
from models import *
ANGKATAN = ["2010", "2011", "2012", "2013"]
PRODI = ["Matematika", "Statistika", "Fisika", "Geofisika", "Kimia",
"Elektronika+dan+Instrumentasi", "Ilmu+Komputer"]
def seed_mahasiswa():
for prodi in PRODI:
for angkatan in ANGKATAN:
file_path = ('data... | bahrunnur/InfoKelas | scripts/db_provision.py | Python | mit | 1,093 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-19 12:21
from __future__ import unicode_literals
import importlib
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
####################################################################################... | intelligenia/modeltranslation | modeltranslation/migrations/0006_auto_20160119_1321.py | Python | mit | 5,355 |
"""
Landmark
:Authors:
Berend Klein Haneveld
"""
from vtk import vtkProp3DFollower
from vtk import vtkTransform
from core.vtkDrawing import CreateSphere
from core.vtkDrawing import ColorActor
from core.vtkDrawing import CreateCircle
class Landmark(object):
"""
Landmark is a container for vtkProps for easier
mana... | berendkleinhaneveld/Registrationshop | ui/transformations/Landmark.py | Python | mit | 2,337 |
friends = ['Tom', 'Dick', 'Harry']
for friend in friends:
print 'Hello', friend
print 'Out of FOR loop.'
| rahulbohra/Python-Basic | 27_for_loop.py | Python | mit | 110 |
# -*- coding: utf-8 -*-
from dp_tornado.engine.controller import Controller
class MysqlController(Controller):
def get(self):
self.model.tests.model_test.db_test.mysql.test()
self.finish('done')
| why2pac/dp-tornado | example/controller/tests/model/db/mysql.py | Python | mit | 219 |
import exifread
import os
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
def processFolder(directoryInput,directoryOutput,fileName,directoryInput2= "none"):
# count the pictures per hour
clearCounts()
file_object = open("%s/%s.txt" % (directoryOutput, fileName), 'w')
... | aleckwhite/EXIFExport | ShutterCountJPG.py | Python | mit | 16,497 |
# 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/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_workload_groups_operations.py | Python | mit | 25,692 |
"""Test calendar rrules."""
import datetime
from django.test import TestCase
from dateutil.rrule import DAILY
from dateutil.rrule import MO
from dateutil.rrule import MONTHLY
from dateutil.rrule import TH
from dateutil.rrule import TU
from dateutil.rrule import WEEKLY
from dateutil.rrule import YEARLY
from dateutil.... | Pinkerton/django-ical | django_ical/tests/test_recurrence.py | Python | mit | 25,045 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Author: Lokal_Profil
# License: MIT
#
"""A class for encoding the contents of a qualifier."""
from __future__ import unicode_literals
from builtins import object
from wikidatastuff.helpers import std_p
class Qualifier(object):
"""
A class for encoding the content... | lokal-profil/wikidata-stuff | wikidatastuff/qualifier.py | Python | mit | 1,509 |
from trace_nums import setup_data_workspace, DataInt
class Calculation(object):
def __init__(self):
self.diffs = {}
def set_data(self, a, b, c):
self.a = a
self.b = b
self.c = c
def operation(self, data):
# returns the new chng'd calculation object
# origin... | buckbaskin/data-1 | trace_calculation.py | Python | mit | 4,737 |
#!/usr/bin/env python
# coding: utf-8
date = raw_input("Please Input a Year(YYYY/MM/DD): ")
date = [int(x) for x in date.split("/")]
mounth_day = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
days = sum(mounth_day[:date[1]-1]) + date[2]
if date[1] > 2 and (date[0] % 400 == 0 or date[0] % 4 == 0 and date[0] % 100 ... | 51reboot/actual_13_homework | 03/peter/homework3.py | Python | mit | 353 |
from ..base_settings import BaseSettings
class TestBaseSettings(object):
def setup(self):
self.settings = BaseSettings()
def test_leaf(self):
"""Test setting a leaf node."""
self.settings.set('test', 'thing')
assert(self.settings.get('test') == 'thing')
def test_doesnt_e... | collingreen/yaib | modules/settings/test/test_base_settings.py | Python | mit | 3,181 |
"""
Evaluators to produce dummy data from DummyData models.
"""
import re
from collections import OrderedDict
from . import functions
from .exceptions import DDEvaluatorException
TAG_PATTERN = re.compile(r"""
\{% \s* # open tag
(?P<function> \b \w+ \b) # function name
... | blcook223/DummyData | evaluators.py | Python | mit | 4,844 |
from django.db import models
from clube.models import Clube
from .constants import TIPO_CAMPEONATO
class Campeonato(models.Model):
descricao = models.CharField(max_length=200)
tipo_campeonato = models.CharField(max_length=1, choices=TIPO_CAMPEONATO, default="Q")
data_inicio = models.DateTimeField(blank=T... | leonardocintra/campeonato | core/models.py | Python | mit | 1,544 |
#
# File:
# TRANS_write_netCDF.py
#
# Synopsis:
# Illustrates how to write a netCDF file
#
# Categories:
# I/O
#
# Author:
# Karin Meier-Fleischer, based on NCL example
#
# Date of initial publication:
# September 2018
#
# Description:
# This example shows how to write a netCDF file.
#
# Effe... | KMFleischer/PyEarthScience | Transition_examples_NCL_to_PyNGL/write_data/TRANS_write_netCDF.py | Python | mit | 2,979 |
from django.db import models
from citations.models import Citation
class Chemical(models.Model):
id = models.BigAutoField(primary_key=True)
pmid = models.ForeignKey(Citation, models.DO_NOTHING, db_column='pmid', blank=True, null=True)
idx = models.SmallIntegerField(blank=True, null=True)
uid = models.C... | Radmor/med_search | src/chemicals/models.py | Python | mit | 528 |
from setuptools import setup
setup(
name='jidoka',
version='0.1.3',
author = "Johannes Daniel Nuemm",
author_email = "daniel.nuemm@gmail.com",
description = ("Simple build tool for sass, coffescript and many more..."),
license = "MIT",
url = "https://github.com/m... | monocult/jidoka | setup.py | Python | mit | 728 |
"""
Unspecific helper classes
@author: Martin Kuemmel, Jonas Haase
@organization: Space Telescope - European Coordinating Facility (ST-ECF)
@license: Gnu Public Licence
@contact: mkuemmel@eso.org
@since: 2005/09/13
$LastChangedBy: mkuemmel $
$LastChangedDate: 2008-07-03 10:27:47 +0200 (Thu, 03 Jul 2008) $
$HeadURL: h... | davidharvey1986/pyRRG | lib/asciidata/asciiutils.py | Python | mit | 7,799 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from rakuten_ws.baseapi import ApiService, ApiEndpoint, BaseWebService, ApiRequest, ApiMethod
class SimpleAPI(ApiService):
api_url = "https://testapi"
api_version = "20140222"
format_version = 2
item = ApiEndpoint(ApiMethod('search'), Ap... | alexandriagroup/rakuten-ws | tests/test_baseapi.py | Python | mit | 2,747 |
"""Support for lights through the SmartThings cloud API."""
from __future__ import annotations
import asyncio
from collections.abc import Sequence
from pysmartthings import Capability
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_HS_COLOR,
ATTR_TRANSITION,
SU... | rohitranjan1991/home-assistant | homeassistant/components/smartthings/light.py | Python | mit | 7,919 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sqlite3
# utworzenie połączenia z bazą przechowywaną w pamięci RAM
con = sqlite3.connect(':memory:')
# dostęp do kolumn przez indeksy i przez nazwy
con.row_factory = sqlite3.Row
# utworzenie obiektu kursora
cur = con.cursor()
# tworzenie tabel
cur.executescript... | koduj-z-klasa/python101 | bazy/sqlorm/sqlraw05.py | Python | mit | 2,212 |
import re
from zope.interface import implements
from formal import iformal
class FormsError(Exception):
"""
Base class for all Forms errors. A single string, message, is accepted and
stored as an attribute.
The message is not passed on to the Exception base class because it doesn't
seem to be... | emgee/formal | formal/validation.py | Python | mit | 4,845 |
'''
Created on 2014-6-22
@author: xiajie
'''
import numpy as np
from SupervisedBasic import zipcode
def weight(x0, x, lmbda):
return np.exp(-np.transpose(x0-x).dot(x0-x)/(2*lmbda))
def cal_pi(x0, data_set, K, lmbda):
pi = np.zeros(K)
n = 0.
for k in range(K):
for i in range(len(data_set[k])):... | jayshonzs/ESL | KernelSmoothing/LocalLDA.py | Python | mit | 2,510 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Holds fixtures for the smif package tests
"""
from __future__ import absolute_import, division, print_function
import json
import logging
import os
from copy import deepcopy
import numpy as np
import pandas as pd
from pytest import fixture
from smif.data_layer import S... | willu47/smif | tests/conftest.py | Python | mit | 27,175 |
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
# return HttpResponse("<h1>The Fett homepage</h1>")
return render(request, 'bokplot/index.html', {})
from bokeh.plotting import figure
from bokeh.resources import CDN
from bokeh.embed import ... | Cyberface/django-fett | mysite/bokplot/views.py | Python | mit | 3,716 |
import zmq
import time
PORT = "5555";
c = zmq.Context()
s = c.socket(zmq.PULL)
s.bind("tcp://*:" + PORT)
print "Listening for ZMQ connections on port " + PORT
while True:
print s.recv()
| Institute-Web-Science-and-Technologies/LiveGovWP1 | scripts/zmq-pull-socket.py | Python | mit | 193 |
"""HTTP/1.1 client library
<intro stuff goes here>
<other stuff, too>
HTTPConnection goes through a number of "states", which define when a client
may legally make another request or fetch the response for a particular
request. This diagram details these state transitions:
(null)
|
| HTTPConnection()... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.0/Lib/http/client.py | Python | mit | 37,702 |
class Friends:
@staticmethod
def _get_friends(session, user_id):
"""
https://vk.com/dev/friends.get
"""
response = session.fetch('friends.get', user_id=user_id)
return response["items"]
@staticmethod
def _get_friends_count(session, user_id):
"""
h... | sgaynetdinov/py-vkontakte | vk/friends.py | Python | mit | 469 |
from amqpstorm.management import ManagementApi
from amqpstorm.management.exception import ApiConnectionError
from amqpstorm.management.exception import ApiError
from amqpstorm.tests import CAFILE
from amqpstorm.tests import HTTP_URL
from amqpstorm.tests import HTTPS_URL
from amqpstorm.tests import PASSWORD
from amqpsto... | eandersson/amqpstorm | amqpstorm/tests/functional/management/test_api.py | Python | mit | 3,496 |
#
# This file is part of python-corosync. Python-Corosync is free software
# that is made available under the MIT license. Consult the file "LICENSE"
# that is distributed together with this file for the exact licensing terms.
#
# Python-Corosync is copyright (c) 2008 by the python-corosync authors. See
# the file "AUT... | geertj/python-corosync | lib/corosync/service.py | Python | mit | 951 |
from collections import UserList, UserDict
from contextlib import contextmanager
from functools import partial
def fnv32a(text):
h = 0x811c9dc5
for c in text:
h = ((h ^ ord(c)) * 0x01000193) & 0xffffffff
return h
def numbered_columns(array):
# Can't use `not array` because numpy interprets i... | slyrz/feature | feature/feature.py | Python | mit | 9,670 |
import sqlalchemy as sa
from sqlalchemy import and_
from sqlalchemy import asc
from sqlalchemy import desc
from sqlalchemy import exc as sa_exc
from sqlalchemy import exists
from sqlalchemy import ForeignKey
from sqlalchemy import func
from sqlalchemy import Integer
from sqlalchemy import literal_column
from sqlalchemy... | monetate/sqlalchemy | test/orm/test_froms.py | Python | mit | 131,835 |
import champyongg.requests
from champyongg.common import ChampyonGGObject
from champyongg.classes.champion import Champion
from champyongg.classes.generaldata import GeneralData, Skills
from champyongg.classes.itemset import ItemSet
from champyongg.classes.matchup import Matchup
from champyongg.classes.runeset import R... | meraki-analytics/champyongg | api.py | Python | mit | 6,054 |
import os
import traceback
import copy
import re
import datetime
import renderdoc as rd
from . import util
from . import analyse
from . import capture
from .logging import log, TestFailureException
class ShaderVariableCheck:
def __init__(self, var: rd.ShaderVariable, name: str):
self.var = var
if... | moradin/renderdoc | util/test/rdtest/testcase.py | Python | mit | 27,966 |
# -*- coding: utf-8 -*-
# http://google-styleguide.googlecode.com/svn/trunk/pyguide.html
import index, get, post, delete, put | VojtechBartos/smsgw | smsgw/resources/contacts/datasets/__init__.py | Python | mit | 126 |
from django.db import models
from tinymce import models as tinymce_models
class TestModel(models.Model):
foobar = tinymce_models.HTMLField()
class TestPage(models.Model):
content1 = models.TextField()
content2 = models.TextField()
class TestInline(models.Model):
page = models.ForeignKey(TestPage,... | aljosa/django-tinymce | tests/testapp/models.py | Python | mit | 415 |
# Generated by Django 1.9.7 on 2016-07-12 15:16
from __future__ import unicode_literals
from django.db import migrations
from django.utils import translation
from django.utils.translation import gettext_lazy as _
sitesettings = [
{
'slug': 'site_name',
'description': _('Site name'),
'type'... | astrikov-d/dartcms | dartcms/apps/sitesettings/migrations/0002_insert_settings.py | Python | mit | 1,175 |
"""
Utilities for the rdb backend.
This file is part of the everest project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Created on Jan 7, 2013.
"""
from everest.constants import RESOURCE_ATTRIBUTE_KINDS
from everest.entities.system import UserMessage
from everest.repositories.utils i... | helixyte/everest | everest/repositories/rdb/utils.py | Python | mit | 11,376 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'psychicwight.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', 'quiz.views.home', name='home'),
url(r'^admin/', include(admin.site.u... | noracami/psychic-wight | psychicwight/psychicwight/urls.py | Python | mit | 389 |
# -*- coding: utf-8 -*-
"""
Cli tool for odin
"""
import os
import argparse
import queue
import logging
import uuid
import json
from pprint import pprint
import odin
from odin.static import __version__
from odin.utils import (run_scan, assembler, get_filter)
from odin.store import OpenDnsModel
from odin import utils
... | j0lly/Odin | odin/scripts.py | Python | mit | 15,495 |
#!/usr/bin/env python3
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
A script to check that release executables only contain certain symbols
and are only linked against allowed li... | fujicoin/fujicoin | contrib/devtools/symbol-check.py | Python | mit | 9,699 |
import sys
import java
lineSeparator = java.lang.System.getProperty("line.separator")
global AdminConfig
cellName = ""
nodeName = ""
serverName = ""
auth_alias = ""
driverPath = ""
datasource_name = ""
jndiName = ""
datasource_url = ""
jdbcProvider = ""
implementationClassName = ""
minConnections = ""
maxConnections ... | infinite-Joy/websphere | datasource_setup.py | Python | mit | 2,690 |
from django import template
from django.template.defaultfilters import stringfilter
from .. import space_capital as sc
register = template.Library()
@register.filter
@stringfilter
def space_capital(value):
return sc(value)
| mpdevilleres/tbpc_app | tbpc/utilities/templatetags/extra_tags.py | Python | mit | 231 |
import asyncio
import time
import traceback
from collections import defaultdict
import discord
from discord.ext import commands
from dwarf import formatting as f
from dwarf.bot import Cog
from dwarf.controllers import BaseController
from dwarf.errors import (ExtensionAlreadyInstalled, ExtensionNotFound, ExtensionNotI... | Dwarf-Community/Dwarf | core/cogs.py | Python | mit | 29,709 |
from templeplus.pymod import PythonModifier
from toee import *
import tpdp
import char_class_utils
###################################################
def GetConditionName():
return "Eldritch Knight"
def GetSpellCasterConditionName():
return "Eldritch Knight Spellcasting"
print "Registering " + GetConditionName(... | GrognardsFromHell/TemplePlus | tpdatasrc/tpgamefiles/scr/tpModifiers/eldritch_knight.py | Python | mit | 4,322 |
from __future__ import division
import asyncio
import discord
import random
from discord.ext import commands
from Cogs import Settings, Utils
from pyparsing import (Literal,CaselessLiteral,Word,Combine,Group,Optional,
ZeroOrMore,Forward,nums,alphas,oneOf)
import math
import operator
... | corpnewt/CorpBot.py | Cogs/Calc.py | Python | mit | 6,092 |
"""A simple HTTP server."""
def response_ok():
"""Testing for 200 response code."""
pass
| pasaunders/http-server | src/step1.py | Python | mit | 99 |
import pandas as pd
import os.path
TRANSCRIPT_GTF_FILE = "TRANSCRIPT_GTF_FILE"
GENOME_FASTA_DIR = "GENOME_FASTA_DIR"
SIMULATED_READS = "SIMULATED_READS"
LEFT_SIMULATED_READS = "LEFT_SIMULATED_READS"
RIGHT_SIMULATED_READS = "RIGHT_SIMULATED_READS"
FASTQ_READS = "FASTQ_READS"
QUANTIFIER_DIRECTORY = "QUANTIFIER_DIRECTORY... | COMBINE-lab/piquant | piquant/quantifiers.py | Python | mit | 16,279 |
import rethinkdb
rethinkdb.set_loop_type("asyncio")
__version__ = "0.2.2-pre"
# constants
ALL = 0
DECLARED_ONLY = 1
UNDECLARED_ONLY = 2
from .errors import *
from .db import *
from .values_and_valuetypes import *
from .field import *
from .document import *
| lars-tiede/aiorethink | aiorethink/__init__.py | Python | mit | 275 |
from datetime import datetime
from django.contrib.auth.models import User
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.conf import settings
from django.db.utils import DatabaseError
try:
TIMELINE_MODELS = settin... | teknolab/teknolab-django-timeline | timeline/models.py | Python | mit | 2,192 |
import os
import re
#requires python 2.6
#must be run in same directory as, and only after, count_unique_seq_per_barcode_pair.sh
#all files should look like "X*.counts"
#dir should be current dir
input_filename = ""
output_filename = "noise_sequences.fa"
outfile = open(output_filename,"w")
for filename in os.listdi... | sebastianevda/SEvdA_metagen | Script_2_identify_noise_sequences.py | Python | cc0-1.0 | 1,739 |
# -*- coding: utf-8
import surf
from datetime import datetime
from mmda.engine.utils import mmda_logger
from BeautifulSoup import BeautifulStoneSoup
from urllib2 import urlopen
ABSTRACT_TIMEOUT = 5 #seconds
def populate_abstract(artist_or_releasegroup):
"""
Populate CachedArtist or CachedRleaseGroup with sho... | lidel/mmda | engine/abstract.py | Python | cc0-1.0 | 5,263 |
import sys
import os
import subprocess
initial_layout = [
"---",
"layout: default",
"permalink: 'reviews/{}.html'",
"title: '{}'",
"---\n",
"# {}",
"---\n",
"## Idea\n\n",
"## Method\n\n",
"## Observations\n\n"
]
def main():
paper_name = sys.argv[1]
formatted_name = su... | v1n337/research-review-notes | create_review.py | Python | cc0-1.0 | 642 |
import tablib
import subprocess
import collections
import os.path
import sys
import json
ver = sys.argv[2]
fn = sys.argv[1]
ofn = os.path.basename(os.path.splitext(sys.argv[1])[0]) + '.csv'
subprocess.call(['soffice', '--headless', '--convert-to', "csv", sys.argv[1]])
data = tablib.Dataset()
print('wot')
print(ofn)
w... | bbqsrc/spdx-python | scripts/convert-ods.py | Python | cc0-1.0 | 1,297 |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 24 10:59:39 2019
@author: CHaithcock
"""
| crhaithcock/RushHour | RHGraph/generators/GenerateStatesByClass.py | Python | cc0-1.0 | 90 |
def begining():
n = int(raw_input("Start counting down from..."))
countdown(n)
def countdown(n):
if n <= 0:
print "gg is done!"
else:
print n
countdown(n-1)
begining()
| isaiah2286-cmis/isaiah2286-cmis-cs2 | countingdown.py | Python | cc0-1.0 | 208 |