code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
import os
def data_path():
return os.path.abspath(os.path.join(os.path.dirname(__file__), 'data'))
| gregbanks/deltaburke | deltaburke/tests/__init__.py | Python | mit | 106 |
"""
Standardize names of data files on Maryland State Board of Elections.
File-name convention on MD site (2004-2012):
general election
precinct: countyname_by_precinct_year_general.csv
state leg. district: state_leg_districts_year_general.csv
county: countyname_par... | openelections/openelections-core | openelex/us/md/datasource.py | Python | mit | 12,263 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... | rwl/PyCIM | CIM15/IEC61970/Informative/InfAssets/Medium.py | Python | mit | 4,176 |
class Solution(object):
def nthSuperUglyNumber(self, n, primes):
"""
:type n: int
:type primes: List[int]
:rtype: int
"""
if n == 1:
return 1
from heapq import heappop, heappush
base = [(primes[i], 0, primes[i]) for i in range(len(primes))]
... | xingjian-f/Leetcode-solution | 313. Super Ugly Number.py | Python | mit | 751 |
# -*- coding: utf-8 -*-
"""
@author: Chenglong Chen <c.chenglong@gmail.com>
@brief: model parameter space
"""
import numpy as np
from hyperopt import hp
import config
## xgboost
xgb_random_seed = config.RANDOM_SEED
xgb_nthread = config.NUM_CORES
xgb_n_estimators_min = 100
xgb_n_estimators_max = 1000
xgb_n_estimato... | ChenglongChen/Kaggle_HomeDepot | Code/Chenglong/model_param_space.py | Python | mit | 14,040 |
import numpy as np
print(np.__version__)
# 1.19.4
a = np.array([[10.0, 10.1, 10.9], [-10.0, -10.1, -10.9]])
print(a)
# [[ 10. 10.1 10.9]
# [-10. -10.1 -10.9]]
print(np.floor(a))
# [[ 10. 10. 10.]
# [-10. -11. -11.]]
print(np.floor(a).dtype)
# float64
print(np.floor(a).astype(int))
# [[ 10 10 10]
# [-10 ... | nkmk/python-snippets | notebook/numpy_floor_trunc_ceil.py | Python | mit | 681 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.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://www.apache.org/licenses... | tzpBingo/github-trending | codespace/python/tencentcloud/yunjing/v20180228/yunjing_client.py | Python | mit | 122,172 |
# Copyright 2012 John Kleint
# This is free software, licensed under the MIT License; see LICENSE.txt.
"""
Parse FindBugs -xml:withMessages output.
FindBugs XML output is pretty straightforward: a sequence of <BugInstance> tags,
with type and rank (severity) attributes. Each has one or more <SourceLine>
tags; if mor... | jkleint/blamethrower | blamethrower/analyzers/findbugs.py | Python | mit | 2,302 |
import _plotly_utils.basevalidators
class TicktextValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(
self, plotly_name="ticktext", parent_name="densitymapbox.colorbar", **kwargs
):
super(TicktextValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/densitymapbox/colorbar/_ticktext.py | Python | mit | 436 |
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
# A reminder: The 2 fields, 'file_urls' and 'files' are special fields
# required by scrapy pipeline for storing files to local disk.
# See https://groups.google.com/forum/print/msg/scrapy-user... | comsaint/legco-watch | app/raw/scraper/items.py | Python | mit | 4,319 |
__all__ = ('HttpParserError',
'HttpParserCallbackError',
'HttpParserInvalidStatusError',
'HttpParserInvalidMethodError',
'HttpParserInvalidURLError',
'HttpParserUpgrade')
class HttpParserError(Exception):
pass
class HttpParserCallbackError(HttpParserError):... | MagicStack/httptools | httptools/parser/errors.py | Python | mit | 566 |
import os
import os.path
from collections import OrderedDict
from typing import List, Dict, Any, Tuple, Union
# noinspection PyPackageRequirements
import yaml # from pyyaml
import dectree.propfuncs as propfuncs
from .codegen import gen_code
from .types import TypeDefs
def transpile(src_file, out_file=None, **optio... | forman/dectree | dectree/transpiler.py | Python | mit | 7,950 |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from .models import EmailUser as User
from .forms import AdminUserChangeForm, UserCreationForm
@admin.register(User)
class UserAdmin(UserAdmin):
fieldsets = (
(
... | ccwang002/biocloud-server-kai | src/users/admin.py | Python | mit | 1,557 |
import re
import click
import six
from httpie.context import Environment
from httpie.core import main as httpie_main
from parsimonious.exceptions import ParseError, VisitationError
from parsimonious.grammar import Grammar
from parsimonious.nodes import NodeVisitor
from six import BytesIO
from six.moves.urllib.parse i... | Yegorov/http-prompt | http_prompt/execution.py | Python | mit | 11,589 |
import sys
import os
from os import listdir
from os.path import isfile, join, isdir
from os import walk
from collections import defaultdict
import operator
import re
from math import log
import random
import pickle
# This list contains attributes which have already been used in the decision tree and cannot be used aga... | yashketkar/B551-Elements-Of-Artificial-Intelligence | pssapre-sdarekar-yketkar-a4/modules/spam_dt_binary.py | Python | mit | 12,723 |
# Ravi Makhija
# data_preparation_trip_advisor.py
# Version 4.2
#
# Description:
# This script takes as input the json files generated
# from scraping TRIP ADVISOR, and initiates the following
# data preparation sequence:
# 1) Converts json to csv, making each row of the
# csv a unique review with restaurant in... | rchurch4/georgetown-data-science-fall-2015 | data_preparation/data_preparation_trip_advisor.py | Python | mit | 4,646 |
from gn_django.exceptions import ImproperlyConfigured
class AppsRouter:
"""
A router to route DB operations for one or more django apps to a particular
database.
Requires class attributes to be specified:
- `APPS` - an iterable of django app labels
- `DB_NAME` - a string for the DB to rou... | gamernetwork/gn-django | gn_django/db/db_routers.py | Python | mit | 1,915 |
from pyomniar.utils import import_simplejson
from pyomniar.error import OmniarError
class Parser(object):
def parse(self, method, payload):
"""
Parse the response payload and return the result.
Returns a tuple that contains the result data and the cursors
(or None if not present).... | ckelly/pyomniar | pyomniar/parsers.py | Python | mit | 1,440 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'replace_with_ref_dialog_ui.ui'
#
# Created: Fri Nov 18 22:58:33 2016
# by: pyside2-uic running on PySide2 2.0.0~alpha0
#
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore, QtGui, QtWidgets
class Ui_Dia... | theetcher/fxpt | fxpt/fx_refsystem/replace_with_ref_dialog_ui2.py | Python | mit | 4,622 |
import numpy as np
from robotarium import Robotarium, transformations, controllers
# Get Robotarium object used to communicate with the robots/simulator.
r = Robotarium()
# Get the number of available agents from the Robotarium. We don't need a
# specific value from this algorithm.
n = r.get_available_agents()
# Nu... | robotarium/robotarium-python-simulator | examples/barrierCertificates.py | Python | mit | 2,240 |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(self, plotly_name="color", parent_name="box.marker.line", **kwargs):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/box/marker/line/_color.py | Python | mit | 496 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-07 21:49
from __future__ import unicode_literals
from django.db import migrations
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('pinax_lms_activities', '0008_schema_fix'),
]
operations = [
... | pinax/pinax-lms-activities | pinax/lms/activities/migrations/0009_auto_20160207_2149.py | Python | mit | 858 |
>>> couses = ['Photography', 'Design Philosophy', 'Media Theory', 'Design Research', 'Digital Media', 'Computer Skills', 'Graphic Design', 'Typography']
>>> print len(couses)
8
>>> couses.append(Media Theory lecture series)
File "<stdin>", line 1
couses.append(Media Theory lecture series)
... | ArtezGDA/text-IO | Esmee/Collections/Array/array1esmee.py | Python | mit | 1,099 |
import json
import os
from textwrap import dedent
import boto3
import moto
import pytest
from moto.ec2 import ec2_backend
from moto.ec2 import utils as ec2_utils
from ecs_deplojo.connection import Connection
from ecs_deplojo.task_definitions import TaskDefinition
BASE_DIR = os.path.dirname(os.path.abspath(__file__))... | LabD/ecs-deplojo | tests/conftest.py | Python | mit | 3,378 |
import logging
from .base import SdoBase
from .constants import *
from .exceptions import *
logger = logging.getLogger(__name__)
class SdoServer(SdoBase):
"""Creates an SDO server."""
def __init__(self, rx_cobid, tx_cobid, node):
"""
:param int rx_cobid:
COB-ID that the server r... | christiansandberg/canopen | canopen/sdo/server.py | Python | mit | 7,569 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-06-18 05:57
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('caffe', '0001_initial'),
('stencils', '0003_auto_201... | VirrageS/io-kawiarnie | caffe/stencils/migrations/0004_stencil_caffe.py | Python | mit | 591 |
import os
import boto3
import json
import urllib.parse
from elasticsearch import ElasticsearchException
from botocore.exceptions import ClientError
from common.elasticsearch_client import *
from common.constants import *
from common.logger_utility import *
class HandleBucketEvent:
def _fetchS3DetailsFromEvent(se... | VolpeUSDOT/CV-PEP | lambda/cvp-qc/bucket_handler_lambda/bucket_event_lambda_handler.py | Python | mit | 9,274 |
import gevent
import gevent.monkey
gevent.monkey.patch_all()
from time import sleep
import flask
from flask_socketio import SocketIO, emit
app = flask.Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
io = SocketIO(app, resource="/api/v1/socket")
@io.on('connect')
def on_connect():
print("Client connected")... | ericremoreynolds/fsiox | server.py | Python | mit | 559 |
# -*- coding: utf-8 -*-
import xbmc
import xbmcaddon
import re
import sys
import logging
if sys.version_info >= (2, 7):
import json as json
else:
import simplejson as json
# read settings
ADDON = xbmcaddon.Addon()
logger = logging.getLogger(__name__)
def notification(header, message, ti... | gabriel-detassigny/kodi-synology-download | resources/lib/kodiutils.py | Python | mit | 1,657 |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | samuelclay/NewsBlur | vendor/oauth2client/django_orm.py | Python | mit | 4,342 |
from django.shortcuts import render_to_response
from django.views.generic import CreateView
from store.models import cloud_users
from django.http import HttpResponseRedirect
from django.template import RequestContext
from django.core.context_processors import csrf
from django.core.urlresolvers import reverse_lazy
from ... | cparawhore/ProyectoSubastas | store/views.py | Python | mit | 2,791 |
# -*- coding:utf-8 -*-
from django.urls import path
from article.views.post import PostListApiView, PostCreateApiView, PostDetailApiView
urlpatterns = [
# 前缀:/api/v1/article/post/
path('create', PostCreateApiView.as_view(), name="create"),
path('list', PostListApiView.as_view(), name="list"),
path('<i... | codelieche/codelieche.com | apps/article/urls/api/post.py | Python | mit | 382 |
import sys, getopt
import os.path
import sqlite3, json
import requests
import config # config file
from scrapinghub import Connection
""" Scrapinghub2Sqlite
1. Create sqlite database (if not exists yet, obviously)
a. Create tables
2. get all projects from scrapinghub
3. check for new projects (not stored yet in lo... | martjanz/shub2sqlite | import.py | Python | mit | 2,628 |
#!/usr/bin/env python3
import os.path, sys, json
from collections import OrderedDict
todo_list = OrderedDict()
file_path = os.path.expanduser('~/.todo_list.json')
if os.path.isfile(file_path):
with open(file_path, 'r') as todo_list_file:
todo_list.update(json.load(todo_list_file))
args = sys.argv[1:]
d... | tarunbod/dotfiles | scripts/todo.py | Python | mit | 1,774 |
# -*- coding: utf-8; fill-column: 78 -*-
import collections
import itertools
import operator
from flatland.schema.paths import pathexpr
from flatland.signals import validator_validated
from flatland.util import (
Unspecified,
assignable_class_property,
class_cloner,
named_int_factory,
symbol,
)
... | jek/flatland | flatland/schema/base.py | Python | mit | 29,692 |
# Copyright 2008-2013 Nokia Siemens Networks Oyj
#
# Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | ktan2020/legacy-automation | win/Lib/site-packages/robot/result/xmlelementhandlers.py | Python | mit | 6,002 |
#-*- coding: utf-8 -*-
class Hash():
def __init__(self):
self.size = 20
self.slots = []
for i in xrange(0, 20):
self.slots.append([])
def __setitem__(self, key, value):
chain = self.slots[self.hash(key)]
for data in chain:
if data[0] == key:
... | livoras/py-algorithm | searching/hash-chain.py | Python | mit | 1,550 |
# Copyright (c) Alex Ponomarev.
# Distributed under the terms of the MIT License.
def writingcode(commands, path):
f_w = open("tasks/" + path + ".py", 'w')
print('pencilUp()', file=f_w)
for i in commands:
print(str(i), file=f_w)
f_w.close()
| Alexponomarev7/plotter | cgi-bin/lib/plotter_API/create_codeAPI.py | Python | mit | 269 |
from enum import Enum
import re
class OutputTypes:
"""Class representing visible output types"""
class Types(Enum):
"""Types"""
Stdout = 1
Stderr = 2
Result = 3
Image = 4
Pdf = 5
def __init__(self, types_str):
"""Initialization from string"""
... | jablonskim/jupyweave | jupyweave/settings/output_types.py | Python | mit | 1,920 |
import random
import os.path
import re
DONT_DELETE = (
"i came back to life on|winnipeg is currently|loud messages|erased"
)
TEAM_MATES = "bolton|leon|ian|leontoast"
USER_TAG = re.compile("<@.*")
CHANNEL_TAG = re.compile("<!.*")
TESTING_CHANNEL = 'bolton-testing'
def is_bolton_mention(msg_text):
return r... | ianadmu/bolton_bot | bot/common.py | Python | mit | 2,461 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index')
] | tnkteja/django-unchained | csc510project/urls.py | Python | mit | 110 |
# 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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py | Python | mit | 4,607 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from distutils.core import setup, Extension
__version__ = "0.1.0"
macros = [('MODULE_VERSION', '"%s"' % __version__)]
setup(name='xorcrypt',
version=__version__,
author='fk',
author_email='gf0842wf@gmail.com',
description='xor encrypt/decrypt for p... | gf0842wf/xorcrypt | setup.py | Python | mit | 623 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
import re
# pattern to find defined tables
regex_tables = re.compile(
"""^[\w]+\.define_table\(\s... | jefftc/changlab | web2py/gluon/myregex.py | Python | mit | 743 |
# Author: Samuel Genheden samuel.genheden@gmail.com
"""
Program to make a Gromacs ndx-file from
a configuration file of atom groups and
snapshot
"""
import argparse
from sgenlib import pdb
from sgenlib import groups
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Program make density gro... | SGenheden/Scripts | Gromacs/gmx_density_groups.py | Python | mit | 1,390 |
# 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_06_01/aio/operations/_subnets_operations.py | Python | mit | 35,492 |
"""
.. module:: system_data
:platform: linux
:synopsis: The module containing the system data.
.. moduleauthor:: Paul Fanelli <paul.fanelli@gmail.com>
.. modulecreated:: 6/26/15
"""
import bunch
import sys
from yaml.parser import ParserError
from zope.interface import implements
from planet_alignment.data.inte... | paulfanelli/planet_alignment | planet_alignment/data/system_data.py | Python | mit | 1,159 |
while True:
t, p, r = map(int, input().split())
if t == 0 and p == 0 and r == 0: break
logs = [input().split() for _ in range(r)]
score = [[0, 0, -i, [0] * p] for i in range(t)]
c_n, pen, w_n = 0, 1, 3
for tid, pid, time, msg in logs:
tid, pid, time = int(tid) - 1, int(pid) - 1, int(time... | knuu/competitive-programming | aoj/24/aoj2400.py | Python | mit | 671 |
import pickle
import numpy as np
import sys
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ms2ldaviz.settings")
import django
django.setup()
import jsonpickle
from basicviz.models import Experiment,Mass2Motif
if __name__ == '__main__':
with open('/Users/simon/git/lda/notebooks/beer3.dict','r') as f:
... | sdrogers/ms2ldaviz | ms2ldaviz/add_topic_dict_beer3.py | Python | mit | 579 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-01 19:47
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
depen... | othreecodes/MY-RIDE | broadcast/migrations/0001_initial.py | Python | mit | 1,998 |
import os
import requests
import shutil
from bs4 import BeautifulSoup
from datetime import datetime
from .s3 import upload_file
def current():
url = 'http://intelligentlifecomics.com'
req = requests.get(url)
if(req.status_code != 200):
return
soup = BeautifulSoup(req.text, 'html.parser')
... | mpaulweeks/exploitable-comic | py/current.py | Python | mit | 883 |
#!/usr/bin/env python
"""Update the file s10_country_code.json with
the latest list of member countries
requirements:
requests
beautifulsoup
grequests
"""
import requests
import bs4
from os.path import join
import json
import grequests
from requests.adapters import HTTPAdapter
from requests.packages.urllib... | jkeen/tracking_number_data | utils/gen_s10_countries.py | Python | mit | 4,361 |
# coding=utf-8
from .attrs import Attrs, AltScript, Dir, FileAs, Id, Scheme, Lang
from .dcmes import Base
class Property(Attrs):
@property
def property(self):
"""xml attribute: `property`"""
return self._attrs.setdefault('property')
@property.setter
def property(self, value):
... | meng89/epubuilder | epubaker/metas/epub3_meta.py | Python | mit | 570 |
# -*- coding: utf-8 -*-
#
# Insekta documentation build configuration file, created by
# sphinx-quickstart on Sat Dec 24 16:48:19 2011.
#
# 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.
#
# All... | teythoon/Insekta | docs/conf.py | Python | mit | 7,761 |
from django.core.mail import mail_managers
class MailAlert(object):
def send(self, **k):
mail_managers(self.subject(**k), self.message(**k))
def subject(self, **k):
return self.__SUBJECT__.format_map(k)
def message(self, **k):
return self.__TEMPLATE__.format_map(k)
class Group... | joshsimmons/animportantdate | animportantdate/wedding/mail_alerts.py | Python | mit | 633 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class ExampleConfig(AppConfig):
name = 'example'
| vaibhav-singh/django-travis-setup | django_travis_setup/example/apps.py | Python | mit | 154 |
# 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 ... | Azure/azure-sdk-for-python | sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_person_group_operations.py | Python | mit | 21,247 |
#!flask/bin/python3
from app import app
if __name__ == "__main__":
app.run(debug=False,host='0.0.0.0')
| ferb96/burogu | runp.py | Python | mit | 107 |
class Player:
self.rating = 1500 # Actual rating
self.rd = 350 # Rating deviation
self.sigma = 0.06 # Volatility
self.mu = None
self.phi = None
class Glicko2:
self.tau = 1.0 # Should be between 0.3 and 1.2, use higher numbers for more predicatable games
def step2(self, player):
player.mu = (player.... | Rensselaer-AI-League/GeneralizedGameServer | helpers/glicko2.py | Python | mit | 993 |
def __init_break_indices__(num):
indices = [1]*num
for i in xrange(1, num):
indices[num-1-i] = indices[num-i]*i
return indices
def get_lex_permutation (N, base_string, break_indices):
stringPermutation = []
divident = []
base_string = list(base_string)
divident_prefix = 0
f... | MayankAgarwal/euler_py | 024/euler024.py | Python | mit | 991 |
import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer
import json
import KVSHandler as handler
with open('config.json') as d:
config = json.load(d)
ip = config['ip']
port = int(config['port'])
def write(key, value):
global handler
return handler.write(key,value)
def delete(key):
global handler
ret... | f-apolinario/BFTStorageService | server/StorageService.py | Python | mit | 750 |
server = '127.0.0.1'
username = 'admin'
password = 'password'
diagnostic_command = 'run_diag'
log_command = 'run_log' | zatr/testassist | settings.py | Python | mit | 117 |
import tempfile
import pytest
from numpy.testing import assert_allclose
from eemeter.modeling.formatters import ModelDataFormatter
from eemeter.ee.derivatives import annualized_weather_normal
from eemeter.testing.mocks import MockModel, MockWeatherClient
from eemeter.weather import TMY3WeatherSource
@pytest.fixture... | impactlab/eemeter | tests/ee/test_annualized_weather_normal.py | Python | mit | 849 |
import unittest
import matplotlib as mpl
import numpy as np
import pandas as pd
from sklearn import datasets
from sklearn import decomposition
from sklearn.utils import estimator_checks
import prince
class TestPCA(unittest.TestCase):
def setUp(self):
X, _ = datasets.load_iris(return_X_y=True)
c... | MaxHalford/Prince | tests/test_pca.py | Python | mit | 3,331 |
from collections import Counter
from pprint import pprint
count = Counter()
posts = graph.get_object('me', fields=['posts.limit(100)'])['posts']['data']
for i, p in enumerate(posts):
likes = get_all_data(graph, p['id']+"/likes")
print(i, p['id'], len(likes))
for x in likes:
name = x['name']
... | tjwei/HackNTU_Data_2017 | Week09/q_posts_friends.py | Python | mit | 367 |
from django.conf.urls import patterns, url
from rolodex import views
urlpatterns = [
# Default view if the user have not navigated yet
url(r'^$', views.index, name='index'),
# company related urls
url(r'^company/add/$', views.company_add, name... | CCBG/django-rolodex | rolodex/urls.py | Python | mit | 1,436 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
# Copyright (C) 2021-2022 Graz University of Technology.
# Copyright (C) 2022 RERO.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"... | inveniosoftware/invenio-oaiserver | invenio_oaiserver/verbs.py | Python | mit | 5,930 |
#!/usr/bin/python
# coding: utf-8
"""
...
~~~~~~~~~~~~~~~~~~~~~~~~~~
Author: YuJun <cuteuy@gmail.com>
"""
import struct
import numpy
import array
def load_mnist_images(file_name):
""" Loads the images from the provided file name """
image_file = open(file_name, 'rb') # Open the file
# Re... | skyduy/simple-dl | SoftmaxRegression/utils.py | Python | mit | 1,832 |
"""
__ConnVirtualDevice2Distributable_Back_SCTEMc2Distributable_MDL.py_____________________________________________________
Automatically generated AToM3 Model File (Do not modify directly)
Author: levi
Modified: Mon Aug 26 09:54:59 2013
_________________________________________________________________________________... | levilucio/SyVOLT | GM2AUTOSAR_MM/backward_matchers/models/ConnVirtualDevice2Distributable_Back_SCTEMc2Distributable_MDL.py | Python | mit | 19,240 |
from OpenGLCffi.GLES2 import params
@params(api='gles2', prms=['n', 'ids'])
def glGenQueriesEXT(n, ids):
pass
@params(api='gles2', prms=['n', 'ids'])
def glDeleteQueriesEXT(n, ids):
pass
@params(api='gles2', prms=['id'])
def glIsQueryEXT(id):
pass
@params(api='gles2', prms=['target', 'id'])
def glBeginQueryEXT... | cydenix/OpenGLCffi | OpenGLCffi/GLES2/EXT/EXT/occlusion_query_boolean.py | Python | mit | 616 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-06-20 12:32
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('stats', '0008_scenario_mds_allow_partial'),
]
operations... | UUDigitalHumanitieslab/timealign | stats/migrations/0009_auto_20180620_1232.py | Python | mit | 583 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Device',
fields=[
('id', models.AutoField(verbo... | clay584/chuck | chuck/inventory/migrations/0001_initial.py | Python | mit | 1,953 |
# 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/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_app_service_plans_operations.py | Python | mit | 83,276 |
# -*- coding: utf-8 -*-
"""
Compatibility module for TDDA Pandas constraints.
"""
from tdda.constraints.pd.verify import *
| tdda/tdda | tdda/constraints/pdverify.py | Python | mit | 126 |
"""Utility commands to work Unicode data."""
import unicodedata
from plumeria.command import commands
from plumeria.util.command import string_filter
@commands.create('unicode escape', 'unicodeescape', category='Development')
@string_filter
def unicode_escape(text):
"""
Escapes unicode characters in the giv... | sk89q/Plumeria | orchard/unicode.py | Python | mit | 1,605 |
from prop import Property
from groupofchanges import GroupOfChanges
from constants import *
class NonColorProperty(Property):
# Constants
_UTILITY_MULTIPLIERS = { 1: 4, 2: 10 } # multipliers for owning 1 or 2 utilities
_UTILITY = True
_RAILROAD = False
def __init__(self, name, price, rents, property_group, siz... | LK/monopoly-simulator | non_color_property.py | Python | mit | 1,996 |
#!/usr/bin/python3
import sys
import os
sys.path.insert(0, os.getcwd())
from storm.cli import main
main(prog_name='storm')
| GaretJax/storm-erp | cmd.py | Python | mit | 125 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import RPi.GPIO as GPIO
import MFRC522
import signal
import DBAccessor
import Login
import time
from Login import findPayments
from lcd_i2c import lcd_string, lcd_byte, LCD_LINE_1, LCD_LINE_2, LCD_CMD, lcd_init
GPIO.setmode(GPIO.BOARD)
continue_reading = True
current_uid ... | rkelly07/dkekeg | dkekeg.py | Python | mit | 3,802 |
import os
import os.path as osp
import unittest
import matplotlib
TEST_FILES_DIR = osp.abspath(osp.join(osp.dirname(__file__), 'test_files'))
TEST_BANK_DIR = osp.abspath(osp.join(osp.dirname(__file__), '..', '..', 'pylinac test files'))
matplotlib.use('Agg')
DELETE_FILES = bool(os.environ.get("DELETE_FILES", defaul... | jrkerns/pylinac | tests_basic/__init__.py | Python | mit | 604 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the wallet."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.... | NicolasDorier/bitcoin | qa/rpc-tests/wallet.py | Python | mit | 18,545 |
# -*- coding: utf-8 -*-
"""
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
"""
import socket
import os
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bo... | luzfcb/cookiecutter_django_test | config/settings/local.py | Python | mit | 2,250 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Node'
db.create_table(u'django_pjm_node', (
(... | chrisspen/django-pjm | django_pjm/migrations/0001_initial.py | Python | mit | 5,117 |
from __future__ import absolute_import
import json
import os.path
from .base import BaseWriter
class Json(BaseWriter):
"""Writer that output a JSON representation of the input pairs"""
def write(self, fp):
json.dump(self.pairs, fp)
@staticmethod
def get_output_filename(infile):
nam... | rafikdraoui/gazouilli | gazouilli/writers/json.py | Python | mit | 384 |
def verse(x):
if x == 0:
return [
"No more bottles of beer on the wall, no more bottles of beer.",
"Go to the store and buy some more, 99 bottles of beer on the wall.",
]
if x == 1:
return [
"1 bottle of beer on the wall, 1 bottle of beer.",
... | CajetanP/coding-exercises | Exercism/python/beer-song/beer_song.py | Python | mit | 808 |
active_extensions = []
class Extension(object):
def register(self):
pass
def dispatch(event, *args, **kwargs):
for extension in active_extensions:
if not hasattr(extension, event):
continue
getattr(extension, event)(*args, **kwargs)
def register(extension):
instanc... | marteinn/Skeppa | skeppa/ext/__init__.py | Python | mit | 400 |
from django.utils.translation import ugettext_lazy as _
DIAL_CHOICES = (
('none', _('None')),
('din 41091.1', _('Dial with minute and hour markers (DIN 41091, Sect. 1)')),
('din 41091.3', _('Dial with hour markers (DIN 41091, Sect. 3)')),
('din 41091.4', _('Dial with hour numerals (DIN 41091, Part 4)')... | akoebbe/sweetiepi | sweetiepi/clocks/choices.py | Python | mit | 1,719 |
#!/usr/bin/env python2
"""Implement a visuospatial working memory task
described in Mason et al., Science 2007 (doi: 10.1126/science.1131295)"""
# FourLetterTask.py
# Created 12/17/14 by DJ based on SequenceLearningTask.py
# Updated 11/9/15 by DJ - cleanup, instructions
from psychopy import core, visual, gui, data, ... | djangraw/PsychoPyParadigms | BasicExperiments/FourLetterTask.py | Python | mit | 9,655 |
from RemoteFlSys import *
class gfeReader:#GetFilesExts Reader
def __init__(self, Reader, Params, AddInfo, OneTime = True):
self.Params = Params
self.Reader = Reader
self.AddInfo = AddInfo
self.Once = OneTime
class fsDirInf:
def __init__(self, SuperDir, Name, DictFlInfs, ... | KyleTen2/ReFiSys | FlSys.py | Python | mit | 13,483 |
"""Tests for the forms of the ``event_rsvp`` app."""
from django.test import TestCase
from django.utils import timezone
from django_libs.tests.factories import UserFactory
from event_rsvp.forms import EventForm, GuestForm
from event_rsvp.models import Event, Guest
from event_rsvp.tests.factories import EventFactory
... | bitmazk/django-event-rsvp | event_rsvp/tests/forms_tests.py | Python | mit | 3,796 |
# test rasl inner loop on simulated data
#
# pylint:disable=import-error
from __future__ import division, print_function
import numpy as np
from rasl.inner import inner_ialm
from rasl import (warp_image_gradient, EuclideanTransform,
SimilarityTransform, AffineTransform, ProjectiveTransform)
def setup... | welch/rasl | tests/inner_test.py | Python | mit | 4,843 |
import os
from flask import Flask
from ark.utils._time import friendly_time
from ark.master.views import master_app
from ark.account.views import account_app
from ark.goal.views import goal_app
from ark.oauth.views import oauth_app
from ark.dashboard.views import dashboard_app
from ark.goal.models import Goal
from ar... | N402/NoahsArk | ark/app.py | Python | mit | 3,309 |
# -*- coding: utf-8 -*-
# This file is part of the Rocket Web Server
# Copyright (c) 2010 Timothy Farrell
# Import System Modules
import sys
import time
import socket
import logging
import traceback
from threading import Lock
try:
from queue import Queue
except ImportError:
from Queue import Queue
# Import P... | zoni/Rocket | rocket/main.py | Python | mit | 6,710 |
import os
import pkg_resources
import yaml
from fget.utils import fgetprint
from fget.resource.root import Root
class CachedSettings(object):
def __init__(self, cache_dir):
self.cache_dir = cache_dir
def init(self):
settings_filename = 'fget.yaml'
cached_filename = 'fget.jobs'
... | atykhonov/fget | fget/settings.py | Python | mit | 1,884 |
# Copyright (c) 2009 Scott Stafford
# Copyright 2014 The Ostrich / by Itamar O
#
# 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 right... | TheOstrichIO/sconseries | site_scons/site_tools/protoc.py | Python | mit | 4,117 |
from __future__ import unicode_literals
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from jenkins.management.helpers import import_jenkinsserver
# TODO: implement optional field updating...
class Command(BaseCommand):
help ... | caio1982/capomastro | jenkins/management/commands/import_jenkinsserver.py | Python | mit | 960 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@author: Michael Ruster
Extract the timestamp and user of contributions which were authored before the
respecitve user had been blocked. The result can be further processed by
TimeframeCalculations.py.
Requirements: MediaWiki Utilities, WikiWho DiscussionParser
Usage: py... | 0nse/WikiWho | scripts/dataAnalysis/BlockedAfDUserExtraction.py | Python | mit | 3,833 |
__author__ = 'moskupols'
__all__ = ['Statistics', 'BlackList', 'console_statistic']
from .statistics import *
from . import console_statistic
| hatbot-team/hatbot | statistics/__init__.py | Python | mit | 144 |
# 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/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_services_providers_operations.py | Python | mit | 38,715 |
# -*- coding: utf-8 -*-
"""
pygments.formatters.latex
~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for LaTeX fancyvrb output.
:copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from io import StringIO
from pygments.formatter import Formatter
fro... | tmm1/pygments.rb | vendor/pygments-main/pygments/formatters/latex.py | Python | mit | 18,900 |
#!/Users/harvey/Projects/face-hack/venv/face/bin/python
#
# The Python Imaging Library
# $Id$
#
from __future__ import print_function
try:
from tkinter import *
except ImportError:
from Tkinter import *
from PIL import Image, ImageTk
import sys
# ------------------------------------------------------------... | harveybia/face-hack | venv/face/bin/player.py | Python | mit | 2,210 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.