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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
import unittest
from pprint import pprint
from binascii import hexlify
from datetime import datetime, timedelta, timezone
from .fixtures import (
formatTimeFromNow,
timeformat,
Account_create,
Operation,
Signed_Transaction,
MissingSignatureForKey,
PrivateKey,
Pu... | xeroc/python-graphenelib | tests/test_transactions.py | Python | mit | 11,452 |
#!~/envs/udacity_python3_mongodb
# -*- coding: utf-8 -*-
"""
In this problem set you work with cities infobox data, audit it, come up with a
cleaning idea and then clean it up.
In the previous quiz you recognized that the "name" value can be an array (or
list in Python terms). It would make it easier to process and qu... | francisrod01/wrangling_mongodb | lesson 6/name.py | Python | mit | 1,880 |
import sublime_plugin
from cmakehelpers.compilerflags import clang, gcc
from cmakehelpers.compilerflags import find_completions
COMPLETION_DATABASES = dict(
clang=dict(loader=clang, database=None),
gcc=dict(loader=gcc, database=None))
def log_message(s):
print("CMakeSnippets: {0}".format(s))
def load... | sevas/sublime_cmake_snippets | compiler_completions.py | Python | mit | 1,676 |
"""
Django settings for lostanimals project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... | dmvieira/lost-animals | lostanimals/lostanimals/settings.py | Python | mit | 2,272 |
import functools as ft
import math
from collections import OrderedDict
import numba
import numpy as np
from sde import SDE
# from simulation.strong.explicit.predictorcorrector import Order_10 as pc_e
from simulation.strong.explicit.rk import Order_10 as rk_e
from simulation.strong.explicit.taylor import Order_05 as E... | dbischof90/sdetools | tests/test_scheme_implementations.py | Python | mit | 6,216 |
from django.contrib.auth.models import User
from rest_framework import viewsets, response
from .serializers import HoldingSerializer, UserSerializer
from .models import Holding
class HoldingViewSet(viewsets.ModelViewSet):
queryset = Holding.objects.order_by('created')
serializer_class = HoldingSerializer
... | timmygee/investorservitude | investorservitude/core/views.py | Python | mit | 710 |
# 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/CDPSM/Balanced/IEC61970/Core/IdentifiedObject.py | Python | mit | 3,613 |
#! python3
# Author: Shuvam Shah
import requests, bs4, sys
def findMeaning(word):
baseURL = 'http://www.dictionary.com/browse/'
missSpellingBaseURL = 'http://www.dictionary.com/misspeling?term='
# Download the specific word page.
res = requests.get('%s%s?s=t' % (baseURL, word))
try:
re... | Megaverse/FindInDictionary | defn.py | Python | mit | 1,253 |
"""
Simple robust time and date parsing.
Note: Follows the Australian standard, dd/mm/yyyy.
Americans should replace '%d %m %Y' with '%m %d %Y' and '%d %m %y' with '%m %d %y' below.
Routines will either
- return a date or time
- return None if the string is empty
- throw ... | jfitz/hours-reporter | parse_datetime.py | Python | mit | 2,257 |
""" Original python command-line scraper for UNSW lecture times. Unused in the webapp. """
import re
import sys
from collections import Counter
import requests
SEMESTER = "15s2"
BASE_URL = "http://www.cse.unsw.edu.au/~teachadmin/lecture_times/" + SEMESTER
DAYS = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday... | icedtrees/unsw-lecture-times | scraper/scraper.py | Python | mit | 2,622 |
"""
Data resource for downloading data
"""
from flask_restful import Resource
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import json
import os
from pprint import pprint
from meerkat_nest import model
from meerkat_nest import config
db_url = os.environ['MEERKAT_NEST_DB_URL']
engine =... | meerkat-code/meerkat_nest | meerkat_nest/resources/download_data.py | Python | mit | 862 |
import re
thisDict = {
"path": "thisDict",
"2": "2",
"3": "3",
"5": "5",
"7": "7",
"2 x 2": "{2} x {2}",
"3 x 2": "{3} x {2}",
"4": "{2 x 2}",
"6": "{3 x 2}",
"8": "{2 x 2} x {2}",
"16": "{2 x 2} x {2 x 2}",
"96": "{16} x {6}",
"thisModel.Root": "thisModel.Root: {96}... | CommonAccord/Cmacc-Org | Doc/G/NW-NDA/99/WiP/Schedule/String.py | Python | mit | 2,950 |
"""
@brief test log(time=200s)
"""
import os
import unittest
import math
import warnings
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, is_travis_or_appveyor
from ensae_teaching_cs.special.image.image_synthese_base import Vecteur, Couleur, Source, Repere
from ensae_teach... | sdpython/ensae_teaching_cs | _unittests/ut_special/test_LONG_image2.py | Python | mit | 2,586 |
import scipy.stats as stats
import matplotlib.pyplot as plt
import MySQLdb
from wsd.database import MySQLDatabase
import matplotlib.cm as cm
from matplotlib.colors import LogNorm, Normalize, BoundaryNorm, PowerNorm
from conf import *
from collections import defaultdict
import cPickle as pickle
import numpy as np
import... | trovdimi/wikilinks | normalized_entropy.py | Python | mit | 12,536 |
from sqlalchemy import (
Column,
Integer,
Unicode,
DateTime
)
from .meta import Base
class JournalEntry(Base):
"""Journal entry model base class."""
__tablename__ = 'journal'
id = Column(Integer, primary_key=True)
title = Column(Unicode)
body = Column(Unicode)
author = Column(... | morganelle/pyramid-learning-journal | learning_journal/learning_journal/models/entries.py | Python | mit | 365 |
from coffin.template.response import TemplateResponse
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404, redirect
from .forms import FlingReceiverAddForm, FlingReceiverEditForm
from .models import FlingReceiver
def root(request, template_name='root.html'):
r... | frol/Fling-receiver | apps/fling_receiver/views.py | Python | mit | 2,528 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('academics', '0016_student_auth_key'),
('courseevaluations', '0004_auto_20151208_1004'),
]
operations = [
migrations.... | rectory-school/rectory-apps | courseevaluations/migrations/0005_auto_20151208_1014.py | Python | mit | 877 |
# -*- mode: python -*-
from .combinations import STANDARD_METHOD_COMBINATION
from .specializers import specializer, ROOT_SPECIALIZER
from . import util
from .cache import NoCachePolicy, LRU, TypeCachePolicy
import threading
import inspect
import warnings
try:
from ._py_clos import GenericFunction as GenericFuncti... | adh/py-clos | py_clos/base.py | Python | mit | 7,245 |
from pyramda.function.curry import curry
from pyramda.iterable.reduce import reduce
from .multiply import multiply
product = reduce(multiply, 1)
| jackfirth/pyramda | pyramda/math/product.py | Python | mit | 147 |
'''
Draw a tunnel with keyboard movement, create it and its collision geometry, and walk through it.
Created on Feb 25, 2015
Released Feb 4, 2016
@author: ejs
'''
from panda3d.core import loadPrcFile, loadPrcFileData # @UnusedImport
loadPrcFile("./myconfig.prc")
# loadPrcFileData("", "load-display p3tinydisplay\nba... | eswartz/panda3d-stuff | programs/dynamic-geometry/draw_path_tris.py | Python | mit | 10,950 |
x, y = map(int, input().split())
print(y // x)
| y-sira/atcoder | abc005/a.py | Python | mit | 48 |
# -*- coding: utf-8 -*-
import numpy as np
class RBM(object):
"""Restricted Boltzmann Machine (RBM) """
def __init__(self, theano, T, input=None, n_visible=784, n_hidden=500,
W=None, hbias=None, vbias=None, np_rng=None,
theano_rng=None):
"""
RBM constructor.... | aelaguiz/pyvotune | pyvotune/theano/rbm.py | Python | mit | 13,636 |
from lxml import etree
import sys
from chatbot.core import Chatbot
class ReadChatbotDefinitionException(Exception):
def __init__(self, message):
self.message = message
def load(filename,context={}):
c = Chatbot(context=context)
c.load(filename)
return c
'''
try:
parser = etree.XMLParser()
... | rdorado79/chatbotlib | chatbot/loader.py | Python | mit | 1,057 |
# Copyright 2014 BitPay Inc.
# Copyright 2016 The nealcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from __future__ import division,print_function,unicode_literals
import subprocess
import os
import json
impo... | appop/bitcoin | src/test/bctest.py | Python | mit | 4,554 |
#!/usr/bin/env python3.5
# Arun Debray, 24 Dec. 2015
# Given a group order, classifies finite abelian groups of that order.
# ./finite_abelian_groups.py [-tpi] number
# -t formats the output in TeX (as opposed to in the terminal)
# -p chooses the primary components decomposition (default)
# -i chooses the invariant f... | adebray/enumerating_abelian_groups | finite_abelian_groups.py | Python | mit | 5,033 |
def resample_to_1km( x, template_raster_mask ):
'''
template_raster_mask should be a mask in in the res/extent/origin/crs of the
existing TEM IEM products.
'''
import rasterio, os
from rasterio.warp import RESAMPLING, reproject
import numpy as np
fn = os.path.basename( x )
fn_split = fn.split( '.' )[0].split... | ua-snap/downscale | snap_scripts/old_scripts/tem_iem_older_scripts_april2018/tem_inputs_iem/old_code/crop_mask_resample_to_iem.py | Python | mit | 6,482 |
#! /usr/bin/env python
#
# pyfacebook - Python bindings for the Facebook API
#
# Copyright (c) 2008, Samuel Cormier-Iijima
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions o... | JustinTulloss/harmonize.fm | libs.py/facebook/__init__.py | Python | mit | 32,593 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import random
from graphviz import Digraph
current_indent = 0
color_map = ['lightgrey', 'lightpink', 'orange', 'cyan', 'gold', 'lawngreen', 'sienna', 'yellow', 'red', 'hotpink']
verbose = 0
def print_simple_tree():
indent= "| "
last_indent= "\_"
"""prints a beautiful de... | zwindler/simfrastructure | simfrastructure_core.py | Python | mit | 9,266 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
def replace_attr_if_match(mapper, dic):
"""
Parameters
----------
mapper : sorted list [(key, [(pattern, value)])]
dic : sorted list [(key, value)]
Returns
-------
dic : dict
dict mapped by mapper.
Examples
--------
>>> d... | ibara1454/pyss | pyss/util/match.py | Python | mit | 3,068 |
import OpenPNM
import scipy as sp
class PoreSeedTest:
def setup_class(self):
self.net = OpenPNM.Network.Cubic(shape=[5, 5, 5])
self.geo = OpenPNM.Geometry.GenericGeometry(network=self.net,
pores=self.net.Ps,
... | amdouglas/OpenPNM | test/unit/Geometry/models/PoreSeedTest.py | Python | mit | 1,410 |
#!/usr/bin/python
# This script parses GNATprove's JSON output and gives per-unit verification
# statistics, as well as overall statistics. Supersedes gnatprove_filestats.py
#
# (C) 2017 TU Muenchen, RCS, Martin Becker <becker@rcs.ei.tum.de>
from __future__ import print_function
import sys, getopt, os, inspect, time,... | mbeckersys/gnatprove_unitstats | gnatprove_unitstats.py | Python | mit | 22,049 |
from setuptools import setup, find_packages
setup(
name = "pymp",
version = "0.1",
url = 'http://www.fort-awesome.net/wiki/pymp',
license = 'MIT',
description = "A very specific case when Python's multiprocessing library doesn't work",
author = 'Erik Karulf',
# Below this line is tasty Kool... | ekarulf/pymp | setup.py | Python | mit | 461 |
import pygame
pygame.mixer.init()
sons = []
#Initialisation
def sonSaut():
son = pygame.mixer.Sound('sons/saut.ogg')
son.play()
sons.append(sons)
def sonMort():
son = pygame.mixer.Sound('sons/mort.ogg')
son.play()
sons.append(sons)
def sonBlessureEnnemi():
son = pygame.mixer.Sound('sons... | PolySlug/polyslug | sons/son.py | Python | mit | 836 |
#!/usr/bin/env python
# Exercise 33: While Loops
i = 0
numbers = []
while i < 6:
print "At the top i is %d" % i
numbers.append(i)
i = i + 1
print "Numbers now: ", numbers
print "At the bottom i is %d" % i
print "The numbers: "
for num in numbers:
print num
| Akagi201/learning-python | lpthw/ex33.py | Python | mit | 288 |
from typing import List
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val: int = 0, left: "TreeNode" = None, right: "TreeNode" = None):
self.val = val
self.left = left
self.right = right
@classmethod
def serialize(cls, root: "TreeNode") -> str:
"""... | l33tdaima/l33tdaima | local_packages/binary_tree.py | Python | mit | 1,599 |
#!/usr/bin/env python3.2
import sqlite3
conn = sqlite3.connect('fefe.db')
c = conn.cursor()
c.execute("CREATE table posts (id INTEGER PRIMARY KEY, fefeid TEXT, diasporaid TEXT, post TEXT)")
conn.commit()
c.close()
| svbergerem/fefebot | install.py | Python | mit | 216 |
#!/usr/bin/env python
"""A QR Move SCU application.
For sending Query/Retrieve (QR) C-MOVE requests to a QR Move SCP.
"""
import argparse
import sys
from pynetdicom import (
AE,
evt,
QueryRetrievePresentationContexts,
AllStoragePresentationContexts,
)
from pynetdicom.apps.common import setup_logging,... | scaramallion/pynetdicom | pynetdicom/apps/movescu/movescu.py | Python | mit | 11,001 |
# Standard imports
import os
import sys
import pickle
# Third party imports
import nose
# Local imports
from pypub.scrapers import nature_nrg as nrg
from pypub.paper_info import PaperInfo
class TestNature(object):
def __init__(self):
self.curpath = str(os.path.dirname(os.path.abspath(__file__)))
... | ScholarTools/pypub | tests/nrg_test.py | Python | mit | 3,751 |
# encoding: UTF-8
'''
本文件中实现了行情数据记录引擎,用于汇总TICK数据,并生成K线插入数据库。
使用DR_setting.json来配置需要收集的合约,以及主力合约代码。
History
<id> <author> <description>
2017050300 hetajen Bat[Auto-CTP连接][Auto-Symbol订阅][Auto-DB写入][Auto-CTA加载]
2017050301 hetajen DB[CtaTemplate增加日线bar数据获取接口][Mongo不保存Tick数据][新... | hetajen/vnpy161 | vn.trader/dataRecorder/drEngine.py | Python | mit | 11,808 |
from django.conf.urls import include, patterns, url
from django.contrib import admin
urlpatterns = patterns(
'',
url(r'', include('main.urls')),
url(r'^api/v1/', include('authentication.urls')),
url(r'^api/v1/', include('posts.urls')),
url(r'^admin/', include(admin.site.urls))
)
urlpatterns += [
url(r'^ap... | Svjard/flightpath | config/urls.py | Python | mit | 508 |
#!/usr/bin/env python
import os
from setuptools import setup
setup(
name = 'scp',
version = '0.7.1',
author = 'James Bardin',
author_email = 'j.bardin@gmail.com',
license = 'LGPL',
url = 'https://github.com/jbardin/scp.py.git',
description='scp module for parami... | victorhqc/MySQL-Backups | setup.py | Python | mit | 398 |
# -*- coding: utf-8 -*-
from django import forms
from django.utils.translation import ugettext_lazy as _
from djangosige.apps.estoque.models import LocalEstoque
class LocalEstoqueForm(forms.ModelForm):
class Meta:
model = LocalEstoque
fields = ('descricao',)
widgets = {
'des... | thiagopena/djangoSIGE | djangosige/apps/estoque/forms/local.py | Python | mit | 461 |
listofcricket=['kohli','mathews','morgan','southee','tamim','smith']
print('Enter a name to search')
name = input()
if name not in listofcricket:
print(name+' is not in the list of cricketers')
else:
print(name+' is in this list')
| zac11/AutomateThingsWithPython | Lists/presence_of_element.py | Python | mit | 241 |
import proxybase
import xmlrpclib
import mimetypes
import os
import data
################################################################################
""" getInst
returns an instance of a wpproxy object
"""
def getInst(url, user, password):
wp = WordpressProxy(url, user, password)
return wp
##########... | lama7/blogtool | blogtool/xmlproxy/wp_proxy.py | Python | mit | 17,754 |
# Generated by Django 3.0.2 on 2020-03-04 20:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('files', '0004_image_compressed'),
('userprofile', '0029_auto_20200304_2007'),
]
operations = [
migr... | hackerspace-ntnu/website | userprofile/migrations/0030_skill.py | Python | mit | 955 |
import json
# This is to keep this imports to a minimum and work on
# Python 2.x and 3.x
try:
import urllib.request as urllib2
except ImportError:
import urllib2
PYCON2016_EVENT_NAME = 'pycon2016'
class Command(object):
def __init__(self, id, direction, speed):
"""A command to an elevator
... | albertyw/box-lift-challenge | boxlift_api.py | Python | mit | 5,846 |
from apps.api.utils import SharedAPIRootRouter
from apps.slack import views
urlpatterns = []
router = SharedAPIRootRouter()
router.register('slack', views.InviteViewSet, base_name='slack')
| dotKom/onlineweb4 | apps/slack/urls.py | Python | mit | 191 |
# coding: utf-8
"""
Copyright (C) 2019, Timothy A. Davis, Nikki Zabel, James M. Dawson
E-mail: DavisT -at- cardiff.ac.uk, zabelnj -at- cardiff.ac.uk, dawsonj5 -at- cardiff.ac.uk
Updated versions of the software are available through github:
https://github.com/TimothyADavis/KinMSpy
If you have found this software usefu... | TimothyADavis/KinMSpy | kinms/utils/KinMS_figures.py | Python | mit | 13,307 |
from django.test import TestCase
from socialcrawl.networks.models import Profile
from socialcrawl.clients.crawler import CachedTwitterClient, CachedFacebookClient
class TestCachedTwitterClient(TestCase):
def setUp(self):
"""Sets up a cached twitter client"""
super(TestCachedTwitterClient, self).... | tobami/socialcrawl | socialcrawl/clients/tests/test_crawler.py | Python | mit | 2,491 |
# -*- coding=utf-8 -*-
import requests
import os
import json
import sys
import time
reload(sys)
sys.setdefaultencoding('utf8')
download_base_url = 'http://www.jikexueyuan.com/course/video_download'
cookie_map = 'gr_user_id=eb91fa90-1980-4500-a114-6fea026da447; _uab_collina=148758210602708013401536; connect.sid=s%3AsR... | amlyj/pythonStudy | 2.7/crawlers/jkxy/jk_utils.py | Python | mit | 4,771 |
"""Implements the WaypointGenerator interface. Returns waypoints from a KML
file. All WaypointGenerator implementations should have two methods:
get_current_waypoint(self, x_m, y_m) -> (float, float)
get_raw_waypoint(self) -> (float, float)
reached(self, x_m, y_m) -> bool
next(self)
done(self) -> bo... | bskari/sparkfun-avc | control/extension_waypoint_generator.py | Python | mit | 2,933 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import render_template
from app.extensions import celery, mail
from app.data import db
from celery.signals import task_postrun
from flask_mail import Message
@celery.task
def send_registration_email(user, token):
msg = Message(
'User Registration',
... | Urumasi/Flask-Bones | app/tasks.py | Python | mit | 874 |
from setuptools import setup, find_packages
setup(
name='pyreport',
version='0.3',
packages=['pyreport']
)
| MiiRaGe/pyreport | setup.py | Python | mit | 108 |
#!/usr/bin/env python
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 th... | beetbox/beets | test/testall.py | Python | mit | 1,255 |
"""
These test cases can be used to test-drive a solution to the diamond kata, in an interative manner.
The idea is that you iterate towards a full solution, each test cycle you are closer to a full solution
than in the previous one. The thing with iterating is you may delete stuff that was there before,
or add stuff ... | emilybache/DiamondKata | python/test_diamond_centrist_iterative.py | Python | mit | 5,199 |
import pytest
# Test for storage.keys
pytest_plugins = [
'snovault.tests.serverfixtures',
'snovault.tests.testappfixtures',
]
items = [
{'name': 'one', 'alias': 'TEST1'},
{'name': 'two', 'alias': 'TEST2'},
]
bad_items = [
{'name': 'one', 'alias': 'BAD1'},
{'name': 'bad', 'alias': 'TEST1'},
]... | ENCODE-DCC/snovault | src/snovault/tests/test_key.py | Python | mit | 2,468 |
# -*- coding: utf-8 -*-
"""Util functions for different things. For example: format time or bytesize correct."""
from flask import request, Response
from functools import wraps
from jinja2.filters import FILTERS
import os
import maraschino
from maraschino import app, logger
from maraschino.models import Setting, XbmcS... | N3MIS15/maraschino-webcam | maraschino/tools.py | Python | mit | 8,552 |
# -*- coding: utf-8 -*-
import unittest
from zombase import worker
class FakeDbSession(object):
def __init__(self):
self.has_been_committed = False
def commit(self):
self.has_been_committed = True
class FakeForeman(object):
def __init__(self):
self._dbsession = FakeDbSession()... | mozaiques/zombase | tests/test_worker.py | Python | mit | 1,539 |
class Solution(object):
def generateParenthesis(self, n):
"""
:type n: int
:rtype: List[str]
"""
parent_list = []
self.helper(0, n, "", parent_list)
return parent_list
def helper(self, left, total, parent, parent_list):
if left >= total and len(pa... | FeiZhan/Algo-Collection | answers/leetcode/Generate Parentheses/Generate Parentheses.py | Python | mit | 597 |
#!/usr/bin/env python3
import os
import shutil
import unittest
from unittest import mock
from unittest.mock import patch
import mvtools_test_fixture
import convcygpath
import get_platform
class ConvCygPathTest(unittest.TestCase):
def setUp(self):
v, r = self.delegate_setUp()
if not v:
... | mvendra/mvtools | tests/convcygpath_test.py | Python | mit | 3,080 |
class Person:
"""
关于这个类的描述, 类的作用, 类的构造函数等等; 类属性的描述
Attributes:
count: int 代表是人的个数
"""
# 这个表示, 是人的个数
count = 1
def run(self, distance, step):
"""
这个方法的作用效果
:param distance: 参数的含义, 参数的类型int, 是否有默认值
:param step:
:return: 返回的结果的含义(时间), 返回数据的类型int... | wangshunzi/Python_code | 02-Python面向对象代码/面向对象-基础/classDesc.py | Python | mit | 728 |
from multiprocessing import set_start_method, cpu_count
#set_start_method('forkserver')
import os
os.environ["OMP_NUM_THREADS"] = str(cpu_count()) # or to whatever you want
from argparse import ArgumentParser
from datetime import datetime
from sklearn.model_selection import train_test_split
from sklearn.metrics impo... | exowanderer/SpitzerDeepLearningNetwork | Python Scripts/spitzer_cal_NALU_train.py | Python | mit | 15,910 |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Bui... | almcc/cinder-data | example/server/app/settings.py | Python | mit | 4,215 |
import math
class Point(object):
X = 0
Y = 0
def __init__(self, x, y):
self.X = x
self.Y = y
def getX(self):
return self.X
def getY(self):
return self.Y
def __str__(self):
return "Point(%s,%s)" % (self.X, self.Y)
def __eq__(self, other):
... | gdorion/advent-of-code | 2015/python/Day3/houses.py | Python | mit | 2,174 |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
DEBUG = False
TESTING = False
CSRF_ENABLED = True
SECRET_KEY = 'this-app-will-only-ever-run-locally'
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
class ProductionConfig(Config):
DEBUG = False
clas... | JonathanFrederick/job-hunt | config.py | Python | mit | 510 |
import codecs
import re
from os import path
from setuptools import setup, find_packages
def read(*parts):
file_path = path.join(path.dirname(__file__), *parts)
return codecs.open(file_path).read()
def find_version(*parts):
version_file = read(*parts)
version_match = re.search(r"^__version__ = ['\"](... | versae/qbe | setup.py | Python | mit | 1,374 |
from backend.common.models.event_details import EventDetails
from backend.common.queries.event_details_query import EventDetailsQuery
def test_event_details_not_found() -> None:
details = EventDetailsQuery(event_key="2019nyny").fetch()
assert details is None
def test_event_details_is_found() -> None:
Ev... | the-blue-alliance/the-blue-alliance | src/backend/common/queries/tests/event_details_query_test.py | Python | mit | 515 |
import os, random
from flask import Flask, request, Response, send_from_directory
app = Flask(__name__, static_url_path='')
os.system('mkdir uploaded_data')
def UID():
seed = random.getrandbits(32)
while True:
yield seed
seed += 1
id_generator = UID()
def getUID():
return str(next(id_genera... | gmittal/prisma | server/main.py | Python | mit | 1,289 |
# answer extraction: entity
from extractors import get_extractor
| jcelliott/inquire | inquire/extraction/entity/__init__.py | Python | mit | 65 |
import logging
from collections import UserDict
from pajbot.models.db import DBManager, Base
from sqlalchemy import Column, Integer, String
from sqlalchemy.dialects.mysql import TEXT
log = logging.getLogger('pajbot')
class Setting(Base):
__tablename__ = 'tb_settings'
id = Column(Integer, primary_key=True)... | gigglearrows/anniesbot | pajbot/models/setting.py | Python | mit | 2,197 |
# -*- coding: utf-8 -*
import uuid
import random
import string
from test import DjangoTestCase
class Account(object):
def __init__(self, email=None, password=None):
self.email = email
self.password = password
@staticmethod
def create_email():
return u"some.one+%s@example.com" % u... | kaeawc/django-auth-example | test/account.py | Python | mit | 1,507 |
import os as os
import numpy as np
import scipy as sp
from pathlib import Path
from openpnm.utils import logging, Project
from openpnm.network import GenericNetwork
from openpnm.io import GenericIO
from openpnm.topotools import trim
logger = logging.getLogger(__name__)
class MARock(GenericIO):
r"""
3DMA-Rock ... | TomTranter/OpenPNM | openpnm/io/MARock.py | Python | mit | 5,688 |
from ansiblelint import AnsibleLintRule
class ShellAltService(AnsibleLintRule):
id = 'E507'
shortdesc = 'Use service module'
description = ''
tags = ['shell']
def matchtask(self, file, task):
if task['action']['__ansible_module__'] not in ['shell', 'command']:
return False
... | tsukinowasha/ansible-lint-rules | rules/ShellAltService.py | Python | mit | 567 |
"""
File: tonal_permutation.py
Purpose: Class defining a function whose cycles are composed of tone strings (no None).
"""
from function.permutation import Permutation
from tonalmodel.diatonic_tone_cache import DiatonicToneCache
from tonalmodel.diatonic_tone import DiatonicTone
class TonalPermutation(Permutation):... | dpazel/music_rep | transformation/functions/tonalfunctions/tonal_permutation.py | Python | mit | 3,907 |
from setuptools import setup, find_packages
from codecs import open # To use a consistent encoding
from os import path
from setuptools.command.test import test as test_command
import sys
class Tox(test_command):
# user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
def initialize_options(self):
... | batousik/Python2-Diamond | setup.py | Python | mit | 1,233 |
"""
How to Use this File.
participants is a dictionary where a key is the name of the participant and the value is
a set of all the invalid selections for that participant.
participants = {'Bob': {'Sue', 'Jim'},
'Jim': {'Bob', 'Betty'},
} # And so on.
history is a dictionary where a key is the name of ... | joemarchese/PolyNanna | participants.py | Python | mit | 3,229 |
# -*- coding: utf-8 -*-
"""
.. module:: djstripe.utils.
:synopsis: dj-stripe - Utility functions related to the djstripe app.
.. moduleauthor:: @kavdev, @pydanny, @wahuneke
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import datetime
from django.conf import settings
from... | jameshiew/dj-stripe | djstripe/utils.py | Python | mit | 4,844 |
#!/usr/bin/env python
# ECLAIR/src/ECLAIR/Build_instance/ECLAIR_core.py
# Author: Gregory Giecold for the GC Yuan Lab
# Affiliation: Harvard University
# Contact: g.giecold@gmail.com, ggiecold@jimmy.harvard.edu
"""ECLAIR is a package for the robust and scalable
inference of cell lineages from gene ex... | GGiecold/ECLAIR | src/ECLAIR/Build_instance/ECLAIR_core.py | Python | mit | 58,120 |
from Tkinter import *
class MyDialog:
def __init__(self, parent):
top = self.top = Toplevel(parent)
Label(top, text="Value").pack()
self.e = Entry(top)
self.e.pack(padx=5)
b = Button(top, text="OK", command=self.ok)
b.pack(pady=5)
def ok(self):
pri... | shawn0lee0/OMOOC2py | _src/om2py2w/2wex0/demo/frame.py | Python | mit | 483 |
import _plotly_utils.basevalidators
class SpanmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="spanmode", parent_name="violin", **kwargs):
super(SpanmodeValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/violin/_spanmode.py | Python | mit | 516 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 17-9-28 下午5:22
# @Author : Tom.Lee
# @CopyRight : 2016-2017 OpenBridge by yihecloud
# @File : test2.py
# @Product : PyCharm
# @Docs :
# @Source :
import gettext
domain = 'test'
locale_dir = 'locale/'
... | amlyj/pythonStudy | 2.7/standard_library/i18n/i18n.py | Python | mit | 693 |
#!/usr/bin/env python
import json
import unittest
import numpy as np
from math import pi
import sys
sys.path.insert(0,'../')
from pyfaunus import *
# Dictionary defining input
d = {}
d['geometry'] = { 'type': 'cuboid', 'length': 50 }
d['atomlist'] = [
{ 'Na': dict( r=2.0, eps=0.05, q=1.0, tfe=1.0 ) },
... | gitesei/faunus | examples/pythontest.py | Python | mit | 4,462 |
import numpy as np
def sure_noise(patches):
return np.max(patches, axis=(1, 2, 3)) <= 4
def sure_track(patches):
return np.max(patches, axis=(1, 2, 3)) > 50
if __name__ == '__main__':
from sys import argv, exit
from crayimage.runutils import *
from crayimage.imgutils import plot_grid
try:
data_root ... | yandexdataschool/crayimage | examples/quick_track_preview.py | Python | mit | 2,313 |
#!/usr/bin/python
"""
convertsvg.py 0.1
See <http://svgkit.sourceforge.net/> for documentation, downloads, license, etc.
(c) 2006-2007 Jason Gallicchio.
Licensed under the open source (GNU compatible) MIT License
"""
# Outline of code:
# Read the SVG
# Read the type to convert to
# Read the options (width, height,... | svn2github/SVGKit | cgi-bin/convertsvg.py | Python | mit | 3,564 |
from pymorphy2.analyzer import Parse
__author__ = 'moskupols'
from lang_utils.morphology import morph
# def get_forms(initial):
# """
# Get all possible forms of a given word in initial form.
#
# >>> get_forms('мама')
# ['мам', 'мама', 'мамам', 'мамами', 'мамах', 'маме', 'мамой', 'мамою', 'маму', 'ма... | hatbot-team/hatbot | lang_utils/morphology/word_forms.py | Python | mit | 2,577 |
import sys
import os
PACKAGE_PARENT = '../..'
SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)))
from proxy.repr_to_bytes import repr_bytes_to_bytes_gen
class Message():
def __init__(... | yv84/pyph | src/tests/integrate_tests/msg_log.py | Python | mit | 2,730 |
import shelve
import os
# Many more at:
# http://www.garykessler.net/library/file_sigs.html
# http://www.garykessler.net/library/magic.html
smudges = {
'jpg': {
'offset': 0,
'magic': '\xFF\xD8\xFF'
},
'png': {
'offset': 0,
'magic': '\x89\x50\x4E\x47\x0D\x0A\x1A\x0A'
... | leonjza/filesmudge | filesmudge/populate.py | Python | mit | 1,009 |
"""class to convert datetime values"""
import datetime
class DatetimeConverter(object):
"""stuff"""
_EPOCH_0 = datetime.datetime(1970, 1, 1)
def __init__(self):
"""stuff"""
pass
@staticmethod
def get_tomorrow():
"""stuff"""
return datetime.datetime.today() + da... | pantheon-systems/etl-framework | etl_framework/utilities/DatetimeConverter.py | Python | mit | 889 |
# -*- coding: utf-8 -*-
# import python libs
import os
from array import array
# import pure_pynacl libs
from saltchannel.saltlib.pure_pynacl import lt_py3, lt_py33
from saltchannel.saltlib.pure_pynacl import TypeEnum, integer, Int, IntArray
class u8(Int):
'''unsigned char'''
bits = array('B').itemsize*8
... | assaabloy-ppi/salt-channel-python | saltchannel/saltlib/pure_pynacl/tweetnacl.py | Python | mit | 25,273 |
#!/usr/bin/python2.6
# MarsRoverPictureCrawler (mrpc):
# A download bot for OPPORTUNITY and SPIRIT Mars Rover Pictures
#
# Copyright (C) 2011 by Maximilian Irro <maximilian.irro@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation ... | mpgirro/MarsRoverPictureCrawler | mrpc.py | Python | mit | 5,158 |
from jirafs import utils
from jirafs.plugin import CommandPlugin
from jirafs.utils import run_command_method_with_kwargs
class Command(CommandPlugin):
"""Create a new Jira issue"""
MIN_VERSION = "2.0.0"
MAX_VERSION = "3.0.0"
AUTOMATICALLY_INSTANTIATE_FOLDER = False
FIELDS = (
{
... | coddingtonbear/jirafs | jirafs/commands/create.py | Python | mit | 2,936 |
# encoding=utf-8
# vim: fenc=utf-8 et sw=4 ts=4 sts=4 ai
import weakref
import re
import urllib
from collections import OrderedDict
from datetime import datetime
import logging
import pytz
from mwtemplates import TemplateEditor
from mwtextextractor import get_body_text
from .common import _
logger = logging.getLogger(... | danmichaelo/UKBot | ukbot/revision.py | Python | mit | 7,012 |
#! /usr/bin/env python
import os
from dotfiles import Dotfiles
def main():
homedir = os.environ['HOME']
dotfilesRoot = homedir + '/dotfiles'
d = Dotfiles(dotfilesRoot)
d.setup()
if __name__ == "__main__":
main()
| xaque208/dotfiles | bin/init.py | Python | mit | 239 |
#!/usr/bin/env python
import os
import sys
file_header ='''/*
Copyright (c) 2017, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the ab... | aliakseis/LIII | src/3rdparty/torrent-rasterbar/tools/gen_fwd.py | Python | mit | 3,242 |
from __future__ import absolute_import, division, print_function
__all__ = [
'__title__', '__summary__', '__uri__', '__version__', '__author__',
'__email__', '__license__', '__copyright__',
]
__title__ = 'fuse'
__summary__ = ("Composes boilerplates")
__uri__ = 'https://github.com/aholmback/fuse'
__ve... | aholmback/fuse | fuse/__about__.py | Python | mit | 489 |
#-------------------------------------------------------------------------------
# Name: Largest Product in a Series
# Purpose: The four adjacent digits in the 1000-digit number (provided in
# textfile 'q008.txt') that have the greatest product are
# 9 x 9 x 8 x 9 = 5832. Find the... | alexadusei/ProjectEuler | q008.py | Python | mit | 1,143 |
# -*- coding: utf-8 -*-
from feedz.processors.content_filter import ContentFilterProcessor
| indexofire/gork | src/gork/application/feedz/processors/__init__.py | Python | mit | 91 |
from __future__ import division
__author__ = 'Vladimir Iglovikov'
'''
Merges prediction for https://www.kaggle.com/c/grupo-bimbo-inventory-demand competition
Expm1(Mean([Log1p(x), Log1p(y)]))
'''
import os
import numpy as np
import sys
import pandas as pd
import time
files = sys.argv[1:]
try:
files.remove('mean_l... | ternaus/submission_merger | src/mean_log_merger_bimbo.py | Python | mit | 753 |
# -*- coding: utf-8 -*-
"""Accounts for Third Party music services."""
from __future__ import (
absolute_import, unicode_literals
)
import logging
import weakref
import requests
from .. import discovery
from ..xml import XML
log = logging.getLogger(__name__) # pylint: disable=C0103
# pylint: disable=too-ma... | dundeemt/SoCo | soco/music_services/accounts.py | Python | mit | 7,489 |
"""mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
C... | rvmoura96/projeto-almoxarifado | mysite/urls.py | Python | mit | 838 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.