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 numpy as np from pyraf import iraf from pyraf.iraf import kepler ''' Useful functions for Kepler light curve processing Use this with the program 'makelc.py' Originally by Jean McKeever Edited and improved by Meredith Rawls ''' # calculate orbital phase # times must be a list of observation times in the same un...
mrawls/kepler-makelc
lc_functions.py
Python
mit
5,357
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 17-8-13 下午1:31 # @Author : Tom.Lee # @CopyRight : 2016-2017 # @File : demo.py # @Product : PyCharm # @Docs : # @Source : import rpyc from rpyc.utils.server import ThreadedServer class MyService(rpyc.Se...
amlyj/pythonStudy
2.7/rpc/RPyC/demo.py
Python
mit
1,415
# -*- coding: utf-8 -*- import six import marshmallow as ma from flask_apispec import ResourceMeta, Ref, doc, marshal_with, use_kwargs class Pet: def __init__(self, name, type): self.name = name self.type = type class PetSchema(ma.Schema): name = ma.fields.Str() type = ma.fields.Str() c...
Tackitt/flask-apispec
examples/petstore.py
Python
mit
2,262
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django import forms from django.utils.translation import ugettext_lazy as _ from django.contrib.auth import get_user_model from django.utils import timezone from django.template import defaultfilters from django.conf import settings from ..core.uti...
alesdotio/Spirit
spirit/user/forms.py
Python
mit
4,294
from unittest2.events import Plugin, addOption from unittest2.util import getSource import os import sys try: import coverage except ImportError, e: coverage = None coverageImportError = e help_text1 = 'Enable coverage reporting' class CoveragePlugin(Plugin): configSection = 'coverage' com...
dugan/coverage-reporter
coverage_reporter/extras/unittest2_plugin.py
Python
mit
1,511
import sys import json from numbers import Number import time import requests import version __BASE_URL = "https://api.outbound.io/v2" this = sys.modules[__name__] ERROR_INIT = 1 ERROR_USER_ID = 2 ERROR_EVENT_NAME = 3 ERROR_CONNECTION = 4 ERROR_UNKNOWN = 5 ERROR_TOKEN = 6 APNS = "apns" GCM = "gcm" def init(key):...
linkleonard/lib-python
outbound/__init__.py
Python
mit
12,217
#!/usr/bin/env python2 # setup.py from setuptools import setup, find_packages setup(name='pumptweet', version='2.1', description='Cross posts from Pump.io to Twitter.', setup_requires=['setuptools-markdown'], long_description_markdown_filename='README.md', classifiers=[ 'Development Status :: 3 - Alpha', 'In...
dper/pumptweet
setup.py
Python
mit
1,006
from flask.ext.wtf import Form from wtforms import StringField, PasswordField from wtforms.validators import DataRequired, Length, Email class LoginForm(Form): email = StringField(validators=[DataRequired(), Length(1, 64), Email()]) password = PasswordField(validators=[DataRequired()])
simpleapples/light-blog
app/auth/forms/login_form.py
Python
mit
295
"""Describe the language syntax.""" import re class Symbol: """Describes the language symbols.""" # General pattern of formulas pattern = '([a-z0-9&\-\|><\(\)]*)' accepted_chars = '([a-z0-9&\-\|><\(\)]*)' def __init__(self, value): """Init a propositional symbol.""" self.value =...
italopaiva/propositional-logic
lp/syntax.py
Python
mit
7,307
# -*- coding: UTF-8 -*- HMAP = { ' ': u'\u00A0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F', '!': u'\uFF01\u01C3\u2D51\uFE15\uFE57', '"': u'\uFF02', '#': u'\uFF03\uFE5F', '$': u'\uFF04\uFE69', '%': u'\uFF05\u066A\u2052\uFE6A', '&': u'\uFF06\uFE60', "'":...
JoshuaRLi/notquite
notquite/constants.py
Python
mit
2,903
#!/usr/bin/env python # Copyright (c) 2014-2015 Daniel Kraft # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # Test the "getauxblock" merge-mining RPC interface. from test_framework.test_framework import KcoinTestFramework from t...
Kcoin-project/kcoin
qa/rpc-tests/getauxblock.py
Python
mit
5,748
from __future__ import absolute_import, division, print_function import os # Package directory, i.e. the parent directory in respect to this file pkg_dir = os.path.dirname(os.path.dirname(__file__)) try: import pytest except ImportError: def run_tests(extra_args=None): raise ImportError('pytest is ...
kbg/drms
drms/tests/_runner.py
Python
mit
578
import numpy as np from theano.tensor.shared_randomstreams import RandomStreams from matplotlib import pyplot from keras.preprocessing import sequence from keras.models import Sequential from keras.layers import Dense, Dropout from keras.layers import LSTM from keras.layers.embeddings import Embedding from keras.datas...
asazo/ANN
tarea3/Pregunta2/model_dropout.py
Python
mit
1,371
from setuptools import setup from codecs import open from os import path from ffmpymedia import __version__ here = path.abspath(path.dirname(__file__)) # Get the long description from the relevant file with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( name='ff...
flaviocpontes/ffmpymedia
setup.py
Python
mit
1,809
#!/usr/bin/env python import matplotlib matplotlib.use('agg') import sys import yt import numpy as np from yt.visualization.volume_rendering.api import \ Scene, \ VolumeSource # this is for the wdconvect problem def doit(plotfile): ds = yt.load(plotfile) ds.periodicity = (True, True, True) f...
BoxLib-Codes/wdmerger
analysis/vol-wd.py
Python
mit
2,763
def test(*args): if len(args) == 2: print "le premier argument est : " + str(args[0]) print "le second arguement est : " + str(args[1]) elif len(args) == 3: print "le premier argument est : " + str(args[0]) print "le second arguement est : " + str(args[1]) print "le sec...
Bideau/SmartForrest
RaspberryPi/dataBase/oldmysql/testmultitarg.py
Python
mit
651
import sys import pyaudio import quietnet import options import psk FORMAT = pyaudio.paInt16 CHANNELS = options.channels RATE = options.rate FREQ = options.freq FREQ_OFF = 0 FRAME_LENGTH = options.frame_length DATASIZE = options.datasize p = pyaudio.PyAudio() stream = p.open(format=FORMAT, channels=CHANNELS, rate=RAT...
richo/quietnet
send.py
Python
mit
2,002
import collisions import data import vector_math import math def cast_ray(ray, sphere_list, amb, light, eye_point): result_color = data.Color(1.0, 1.0, 1.0) #test for closest sphere to the eye collision_tuple = find_closest_collision(ray, sphere_list) if collision_tuple: #some useful variables sphere_hit = col...
14bmkelley/raytracer-python
cast.py
Python
mit
3,882
import os import django from django.conf import settings; settings.configure() from docx.engines.base import Engine as base from django.template import Template from django.template import Template, Context """ Engine for Django """ class Engine(base): def __init__(self): self.tag_re = "(\{[^\}]+?\}\}?)" ...
holli-holzer/python-docx
docx/engines/DjangoEngine.py
Python
mit
1,123
# encoding: utf-8 # Copyright 2011 Tree.io Limited # This file is part of Treeio. # License www.tree.io/license """ Events: Hardtree module definition """ PROPERTIES = { 'title': 'Calendar', 'details': 'Manage events and calendars', 'url': '/calendar/', 'system'...
rogeriofalcone/treeio
events/hmodule.py
Python
mit
444
# -*- coding: utf-8 -*- # vim: set fileencoding=utf-8 # Copyright (c) 2008, 2010 Janne Blomqvist # This source code file is subject to the terms of the MIT (Expat) # License. See the file LICENSE for details. """This module contains unit tests for the vasputil.dos module.""" import unittest import vasputil.dos as d...
oren88/vasputil
vasputil/tests/test_dos.py
Python
mit
592
from collections import Counter from typing import List, Mapping, Union, Optional import numpy as np import pandas as pd import seaborn as sns from matplotlib import pyplot as plt from bartpy.runner import run_models from bartpy.sklearnmodel import SklearnModel ImportanceMap = Mapping[int, float] ImportanceDistribut...
JakeColtman/bartpy
bartpy/diagnostics/features.py
Python
mit
8,265
#!/usr/bin/env python3 import argparse import json import math import sys from collections import defaultdict import trueskill import matplotlib.pyplot as plot import utility def phi(x): """Cumulative distribution function for the standard normal distribution Taken from python math module documentation""" ...
Janzert/halite_ranking
rating_stats.py
Python
mit
8,861
BASE_PROJECTS_FOLDER_NAME = 'projects' TRAINING_FILES_FOLDER_NAME = 'trainingfiles' TRAININGS_FOLDER_NAME = 'trainings' NETWORK_FILES_FOLDER_NAME = 'networkfiles' PROJECT_DATASETS_FOLDER_NAME = 'datasets' PROJECT_PREDEFINED_DATASETS_FOLDER_NAME = 'predefineddatasets' GENERAL_FILES_FOLDER_NAME = 'generalfiles' TESTS_FIL...
nitnelav1101/nexuralnetwork-web
nexuralnetweb/config.py
Python
mit
552
from django.db import models from django.contrib.auth.models import User # Create your models here. class Quote(models.Model): quote = models.CharField(max_length=2048) date = models.DateTimeField('date published') poster = models.ForeignKey(User) def __str__(self): # __unicode__ on Pyth...
keyz182/adamsays
says/models.py
Python
mit
350
# # main.py # RegexAsYouType # # Created by Anders Hovmoller on 5/19/09. # Copyright Calidris 2009. All rights reserved. # #import modules required by application import objc import Foundation import AppKit from PyObjCTools import AppHelper # import modules containing classes required to start application and lo...
boxed/RegexAsYouType
main.py
Python
mit
420
from __future__ import division import numpy as np # Non-monotonic Sobol G Function (8 parameters) # First-order indices: # x1: 0.7165 # x2: 0.1791 # x3: 0.0237 # x4: 0.0072 # x5-x8: 0.0001 def evaluate(values, a=None): if type(values) != np.ndarray: raise TypeError("The argument `values` m...
willu47/SALib
src/SALib/test_functions/Sobol_G.py
Python
mit
1,685
import logging import os import time import exifread logger = logging.getLogger(__name__) def rename(filenames): for filename in filenames: new_filename = _new_filename_from(filename) if new_filename: os.rename(filename, new_filename) logger.info('Renamed %s to %s', filen...
mina-asham/pictures-dedupe-and-rename
pictures/rename/rename.py
Python
mit
1,752
def at_len(the_list): """ Takes a list and returns the number of atomic elements (basic unit of data) of the list :param the_list: a list of elements :return: the number of atomic elements in the list """ count = 0 for each_elem in the_list: if isinstance(each_elem, list): ...
pegurnee/2015-01-341
projects/project1_mini_python/python_mini_project.py
Python
mit
412
import os import qprompt path = qprompt.ask_str("Enter path to file", vld=lambda x: os.path.isfile(x)) size = qprompt.ask_int("Enter number less than 10", vld=lambda x: x < 10)
jeffrimko/Qprompt
examples/ask_2.py
Python
mit
177
from django.db import models from django.db.models.signals import post_save from what_apps.push.functions import push_with_json STATUS_CHOICES = ( (0, 'cool'), #Everything is cool. (1, 'not cool'), #Problems with staging only. (2, 'fuck all.') #Problems with produc...
SlashRoot/WHAT
what_apps/meta/models.py
Python
mit
1,075
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2017 Alex Forencich 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 righ...
alexforencich/python-ivi
ivi/rigol/rigolDS4014.py
Python
mit
1,674
""" Provides the LuminosoClient object, a wrapper for making properly-authenticated requests to the Luminoso REST API. """ import json import logging import os import requests import time from getpass import getpass from requests.adapters import HTTPAdapter from requests.packages.urllib3.util.retry import Retry from ur...
LuminosoInsight/luminoso-api-client-python
luminoso_api/v5_client.py
Python
mit
20,872
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-10-19 10:42 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('courses', '0007_auto_20161019_1014'), ] operations = [ migrations.RenameField( ...
sonic182/portfolio3
courses/migrations/0008_auto_20161019_1042.py
Python
mit
430
""" Basically I'm trying to cover 4 options, one of each: (Previously featured state?, Use previous positions?) --------------------------------------------------------- (no, no) = get_initial_featuring (yes, no) = get_particle_featuring (yes, yes) = translate_featuring (no, yes) = f...
peri-source/peri
peri/runner.py
Python
mit
29,237
"""Thetests for the Modbus sensor component.""" import pytest from homeassistant.components.binary_sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.components.modbus.const import ( CALL_TYPE_COIL, CALL_TYPE_DISCRETE, CONF_INPUT_TYPE, CONF_LAZY_ERROR, CONF_SLAVE_COUNT, ) from homeassistant.c...
rohitranjan1991/home-assistant
tests/components/modbus/test_binary_sensor.py
Python
mit
7,895
from context import Meta meta = Meta() merge_two_dicts = meta.load("http://www.meta-lang.org/snippets/56ee471dc0cb8f7470fbb500") flatten_list = meta.load("http://www.meta-lang.org/snippets/56ee45b9c0cb8f7470fbb185") unordered = meta.load("http://www.meta-lang.org/snippets/56ee4583c0cb8f7470fbb0c5") dict1 = {x:i fo...
Ejhfast/meta
test/test_optimize.py
Python
mit
606
# -*- coding: utf-8 -*- from fontTools.misc.textTools import num2binary from fontTools.ttLib.tables.ttProgram import streamOpcodeDict, opcodeDict from io import BytesIO class InstructionStream(object): """ :param program_bytes: The program bytecode. :type program_bytes: bytes The instruction stream....
typesupply/extractor
Lib/extractor/stream.py
Python
mit
9,611
""" CacheItem interface: '_id': string, 'url': string, 'response_url': string, 'body': string, 'head': string, 'response_code': int, 'cookies': None,#grab.response.cookies, """ from hashlib import sha1 import zlib import logging import marshal import time from grab.response import Response from grab.cookie import Cook...
subeax/grab
grab/spider/cache_backend/postgresql.py
Python
mit
6,990
#!/usr/bin/env python # -*- coding: utf8 -*- # ***************************************************************** # ** PTS -- Python Toolkit for working with SKIRT ** # ** © Astronomical Observatory, Ghent University ** # ***************************************************************** ##...
Stargrazer82301/CAAPR
CAAPR/CAAPR_AstroMagic/PTS/pts/core/tools/serialization.py
Python
mit
1,823
class Solution: def helper(self,target,string): i,j=0,0 while i<len(target) and j<len(string): if target[i]==string[j]: i+=1 j+=1 else: i+=1 return j==len(string) def findLongestWord(self, s, d): """ ...
Hehwang/Leetcode-Python
code/524 Longest Word in Dictionary through Deleting.py
Python
mit
654
""" manage ====== Collection of helpers to manage database migrations, shell access, etc. :copyright: Copyright (c) 2015 Andrey Martyanov. All rights reserved. :license: MIT, see LICENSE for more details. """ from flask.ext.migrate import MigrateCommand from flask.ext.script import Manager from ...
martyanov/notv
manage.py
Python
mit
622
from csv import DictReader import os from rest_framework import status from rest_framework.viewsets import ViewSet from rest_framework.exceptions import NotFound from rest_framework.response import Response import odatagym_app.settings as ods import logging logger = logging.getLogger('odata_gym') class DatasetsHan...
lucalianas/opendata_gym
odatagym_app/datasets_handler/views.py
Python
mit
1,158
import _plotly_utils.basevalidators class ColorsrcValidator(_plotly_utils.basevalidators.SrcValidator): def __init__(self, plotly_name="colorsrc", parent_name="funnel.marker", **kwargs): super(ColorsrcValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
plotly/plotly.py
packages/python/plotly/plotly/validators/funnel/marker/_colorsrc.py
Python
mit
402
"""This module contains the data handler.""" import numpy as np import tssim from bokeh.models import ColumnDataSource def create_source(series): return ColumnDataSource(data=dict(x=series.index.values, y=series.values)) def dummy1(): ts = tssim.TimeSeries(start="2017-04-04", freq="D", periods=1100) ts...
mansenfranzen/notebooks
Confidence Interval Simulation Bokeh/model.py
Python
mit
2,316
# -*- coding: utf-8 -*- from nfcserver.model.access import Access from nfcserver.model.user import User from flask import render_template, request, redirect, url_for from nfcserver.db import dao from nfcserver.blueprint import nfc from exception import NoneUserName import nxppy, time @nfc.route('/access') def accessP...
KimBoWoon/Embeddad-System
nfc-server/nfcserver/controller/index.py
Python
mit
1,224
from beard import pos import base_test import unittest class TestPosModule(base_test.RequireTokens): def test_create_from_tokens(self): data = pos.create_from_tokens(self.tokens_01) w = data.get('words', {}) p = data.get('parts_of_speech', {}) self.assertTrue(w) self.ass...
YuukanOO/beard
tests/test_pos.py
Python
mit
454
from typing import List, Tuple from fastapi import Depends, FastAPI, Security from fastapi.security import SecurityScopes from fastapi.testclient import TestClient app = FastAPI() def get_user(required_scopes: SecurityScopes): return "john", required_scopes.scopes def get_user_override(required_scopes: Securi...
tiangolo/fastapi
tests/test_dependency_security_overrides.py
Python
mit
1,463
# # This example measures the performance of Path ORAM # when storage is accessed through a local file. # import os import random import time import pyoram from pyoram.util.misc import MemorySize from pyoram.oblivious_storage.tree.path_oram import \ PathORAM import tqdm pyoram.config.SHOW_PROGRESS_BAR = True #...
ghackebeil/PyORAM
examples/path_oram_file.py
Python
mit
2,687
import sys from indicnlp import common common.set_resources_path(INDIC_NLP_RESOURCES) from indicnlp import loader from indicnlp.normalize import indic_normalize from indicnlp.transliterate import unicode_transliterate if __name__ == '__main__': """ This script transliterates Hindi to Kannada. It removes/rema...
anoopkunchukuttan/indic_nlp_library
contrib/hindi_to_kannada_transliterator.py
Python
mit
2,212
# --- # jupyter: # jupytext: # formats: ipynb,py:light # notebook_metadata_filter: nbsphinx # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.4.1 # kernelspec: # display_name: Python 3 # language: python # name:...
interactiveaudiolab/nussl
docs/recipes/wham/ideal_ratio_mask.py
Python
mit
3,780
# -*- coding: utf8 -*- # # 国家统计局 行政区域代码 文本: # # http://www.stats.gov.cn/tjsj/tjbz/xzqhdm/ # from __future__ import print_function from collections import OrderedDict class Area(object): level = None def __init__(self, code, name, parent=None): '''use unicode name''' self.code = int(code) ...
dlutxx/memo
data/nation_parse.py
Python
mit
3,087
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import pytest import numpy as np import torch.nn as nn import torch as T from torch.autograd import Variable as var import torch.nn.functional as F from torch.nn.utils import clip_grad_norm_ import torch.optim as optim import numpy as np import sys import os import mat...
ixaxaar/pytorch-dnc
test/test_rnn.py
Python
mit
4,532
import datetime def road_to_10k(tweet_list, author): status_count = author.statuses_count tweets_today = len(tweet_list) tweets_remaining = 10000 - status_count last_day = datetime.datetime(2014, 12, 31) today = datetime.datetime.now() days_remaining = (last_day - today).days + 1 tweets_pe...
gradiuscypher/twitter_gradiusbot
mention_processing.py
Python
mit
657
#-*- coding:utf-8 -*- import logging logging.basicConfig(level=logging.ERROR) from cache_abstract import CacheAbstractDriver import asyncio try: import redis except ImportError: logging.error("Can't import 'redis' module") exit(-1) try: import aioredis except ImportError: logging.error("Can't import...
free-free/pyblog
pyblog/cache/redis_cache.py
Python
mit
13,227
from abc import ABCMeta, abstractmethod class ProgressMessage(object): def __init__(self, path, bytes_per_second, bytes_read, bytes_expected): self._path = path self._bytes_per_second = bytes_per_second self._bytes_read = bytes_read self._bytes_expected = bytes_expected @prope...
Sybrand/digital-panda
digitalpanda/bucket/abstract.py
Python
mit
2,411
import time from threading import Thread import mido class MidiPlayer(object): def __init__(self, port_name=None): if port_name: self.port_name = port_name else: try: self.port_name = self.ports[0] except IndexError: self.port_na...
JasonFruit/abcviewer
abcv/midiplayer.py
Python
mit
2,689
import webbrowser import os import re # Styles and scripting for the page main_page_head = ''' <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Fresh Tomatoes!</title> <!-- Bootstrap 3 --> <link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap....
nathandh/udacity-fullstack-MovieTrailerWebsite
fresh_tomatoes.py
Python
mit
6,106
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild from pkg_resources import parse_version from kaitaistruct import __version__ as ks_version, KaitaiStruct, KaitaiStream, BytesIO from enum import Enum if parse_version(ks_version) < parse_version('0.7'): raise Excep...
sonusz/PhasorToolBox
phasortoolbox/parser/pcap/ethernet_frame.py
Python
mit
1,756
""" LemonTree is simple, flexible, and experimental deep learning package based on Theano. """ __version__ = '0.0.4'
khshim/lemontree
lemontree/__init__.py
Python
mit
117
''' title = "Camel Case String" level = "intro" dificulty = "easy" tags = ["strings", "functions", "camel-case"] description = """ Write a function that receives a string and returns a camel case version of it. Example: camel_case('hello world') # Hello World """ ''' def camel_case(a_string): pass
rmotr/whooshercises
assignments/camel_case_string.py
Python
mit
310
''' Created on Mar 7, 2016 @author: mike ''' from patgen.dictionary import parse_dictionary_word, format_dictionary_word,\ Dictionary import unittest from patgen.margins import Margins class TestDictionary(unittest.TestCase): def test_parse(self): text, hyphens, missed, false, weights =...
pgmmpk/pypatgen
patgen/tests/test_dictionary.py
Python
mit
1,321
import unittest import giraffe as c import giraffe.exceptions as exc def make_graph_tst(cls): class Test(unittest.TestCase): def test_eq_ne(self): g = cls() g2 = cls() self.assertEqual(g, g2) self.assertEqual(g2, g) g.add_vertex(1) ...
Julian/giraffe
giraffe/tests/test_core.py
Python
mit
13,956
# helper functions import numpy as np import matplotlib.pyplot as plt import os import pandas as pd from diffpy.Structure import loadStructure from pyobjcryst.crystal import CreateCrystalFromCIF from diffpy.srreal.bondcalculator import BondCalculator from diffpy.srreal.pdfcalculator import PDFCalculator from diffpy....
chiahaoliu/pdf_lib
pdf_lib/pdf_helper.py
Python
mit
3,994
#!/usr/bin/env python3 # fwiloprov.py import re import getpass import pexpect from pexpect import EOF from pexpect import TIMEOUT from pexpect import ExceptionPexpect from locationcode import Loccode from networksid import NWdevice from ipaddress import ip_address from ipaddress import ip_network from ipa...
takkaneko/netengtools
fwiloprov.py
Python
mit
6,508
import fileinput import argparse from astexport import __version__, __prog_name__ from astexport.parse import parse from astexport.export import export_json def create_parser(): parser = argparse.ArgumentParser( prog=__prog_name__, description="Python source code in, JSON AST out. (v{})".format( ...
fpoli/python-astexport
astexport/cli.py
Python
mit
1,148
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'settings.ui' # # Created: Thu Dec 25 23:21:20 2014 # by: PyQt4 UI code generator 4.10.3 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui from languagebox import LanguageBox from sys import platfo...
hb9kns/PyBitmessage
src/bitmessageqt/settings.py
Python
mit
40,025
from coc_war_planner.api.permissions import CreateNotAllowed from coc_war_planner.api.permissions import IsChiefOrReadOnly from coc_war_planner.api.permissions import IsUserOrReadOnly from coc_war_planner.api.permissions import IsOwnerOrReadOnly from coc_war_planner.api.permissions import IsNotPartOfClanOrCreateNotAllo...
arthurio/coc_war_planner
coc_war_planner/api/views.py
Python
mit
3,228
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-09-06 17:16 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependen...
muhummadPatel/raspied
students/migrations/0002_add_Booking_model.py
Python
mit
923
# Register your models here. from app.subsystem.usermanagement.professor import * from app.subsystem.usermanagement.programdirector import * from app.subsystem.usermanagement.student import * # admin.site.register(Professor) # admin.site.register(ProgramDirector) # admin.site.register(Student)
foxtrot94/EchelonPlanner
src/app/admin.py
Python
mit
296
import rethinkdb as r import db def _forget_project(name, conn): db.get_table().filter(r.row['name'] == name).delete().run(conn) def forget_project(name): conn = db.get_conn() return _forget_project(name, conn)
boryas/eidetic
lib/forget.py
Python
mit
226
#!/usr/bin/env python #from distutils.core import setup from setuptools import setup import subprocess import os import platform import re def get_pi_version(): pi_versions = { "0002" : "Model B Revision 1.0", "0003" : "Model B Revision 1.0", "0004" : "Model B Revision 2.0", "0005" : "Model B Revision 2.0", ...
EmbeditElectronics/Python_for_PSoC
API_Python/setup.py
Python
mit
3,289
""" A fake time series data server used during development to serve up JSON for live updating plot rendering in the browser. The test datafile has 25000 points and cycles through this entire series every 60 minutes. Examples -------- >>> python fake_dataserver.py >>> import requests; requests.get('http://127.0.0.1:500...
pomeslab/matplotdash
server/fake_dataserver.py
Python
mit
2,830
# Script to evaluate the performance of the clustering algorithm. import argparse from itertools import combinations from collections import defaultdict def count_correct_pairs(cluster, labels_lookup): """ Given a cluster, count the number of pairs belong to the same label and the total number of pairs. ...
varun-suresh/Clustering
evaluation.py
Python
mit
1,895
from django.shortcuts import render_to_response from django.template import RequestContext from django.http import HttpResponseRedirect from django.contrib.auth.models import User def index(request): return render_to_response('index.html', None) def run(request): pass def save(request): pass # user s...
lncwwn/js-partner
js_partner/views.py
Python
mit
1,205
# encoding: utf-8 """Tests for io.py""" #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. #------...
mattvonrocketstein/smash
smashlib/ipy3x/utils/tests/test_io.py
Python
mit
6,837
import unittest from test.test_game_state import TestAvailableActionSets from test.test_game_state import TestTurnComplete from test.test_vector import TestVector from test.test_buttons import TestButtonCollection from test.test_ai_simple import TestAISimple from test.test_drawing_surface import TestDrawingSurface fro...
CoachCoen/games
test/test_all.py
Python
mit
467
import os from setuptools import setup, find_packages def read(fname): with open(os.path.join(os.path.dirname(__file__), fname)) as file_handle: return file_handle.read() setup( name = "simple_midi_parser", version = "0.1.0", url="https://pypi.python.org/pypi/simple_midi_parser", package...
pgk/simple-midi-parser
setup.py
Python
mit
613
#!/usr/bin/env python # Copyright (c) 2010, Antons Rebguns. 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 above copyright # notice, t...
sigproc/robotic_surgery
src/ros/crustcrawler_smart_arm/smart_arm_kinematics/nodes/test_ik_service.py
Python
mit
3,443
# Copyright (c) 2015 bitlinker@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish...
bitlinker/ArduWeather
Software/NarodmonDaemon/OregonSensor.py
Python
mit
2,140
__author__ = 'himanshu' import json import requests def _setup_request_data(filename): file= open(filename, 'rb') data = {} lineno = 0 lines = file.readlines() for l in lines: lineno+=1 if l=="\n" or l=="": break parts = l.spl...
himanshuo/spamassassin
demo/demo.py
Python
mit
1,292
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2018-10-22 00:58 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("PartyListV2", "0011_auto_20181021_2203"), ] operations = [ migrations.RenameField( ...
sigmapi-gammaiota/sigmapi-web
sigmapiweb/apps/PartyListV2/migrations/0012_auto_20181022_0058.py
Python
mit
444
#!/usr/bin/env python # -*- coding: utf-8 -*- # ISPForum internet quality measurement daemon # Marek Wajdzik 29.10.2017 <wajdzik.m@gmail.com> import logging import asyncio import socket class TCPServer(object): def __init__(self, port=9981): #Logger self.logger = logging.getLogger("tcpserver") ...
consi/ispfqd
ispfq/tcpserver.py
Python
mit
1,481
import codecs import os import re from setuptools import Command, find_packages, setup here = os.path.abspath(os.path.dirname(__file__)) version = "0.0.0" changes = os.path.join(here, "CHANGES.rst") match = r"^#*\s*(?P<version>[0-9]+\.[0-9]+(\.[0-9]+)?)$" with codecs.open(changes, encoding="utf-8") as changes: f...
allisson/python-vindi
setup.py
Python
mit
1,845
VALID_VIES = "LU26375245" VALID_VIES_COUNTRY_CODE = "LU" VALID_VIES_NUMBER = "26375245" VALID_VIES_IE = [ "1234567X", "1X23456X", "1234567XX", ]
codingjoe/django-vies
tests/__init__.py
Python
mit
157
import numpy as np a_2d = np.arange(6).reshape(2, 3) print(a_2d) # [[0 1 2] # [3 4 5]] a_2d_flip = np.flip(a_2d) print(a_2d_flip) # [[5 4 3] # [2 1 0]] print(np.shares_memory(a_2d, a_2d_flip)) # True print(a_2d[::-1, ::-1]) # [[5 4 3] # [2 1 0]] a_1d = np.arange(3) print(a_1d) # [0 1 2] print(np.flip(a_1d)) # ...
nkmk/python-snippets
notebook/numpy_flip.py
Python
mit
2,759
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class Client(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50)) def __init__(self, name): self.name = name def __repr__(self): return '<Client %r>' % self.name class Area(db.Model): ...
yuriyarhipov/FeatureRequestApp
models.py
Python
mit
1,068
print ("project euler problem 5 find the smallest number divisible by each number smaller than twenty") print 16*9*5*7*11*13*17*19
Greh/Project-Euler
euler5.py
Python
mit
132
"""combine 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') Class-ba...
WSULib/combine
combine/urls.py
Python
mit
818
import numpy as np if __name__ == '__main__': pop_vec = [16389723, 10262186, 20593430, 71685839, 49425543, 88979305, 8060519, 68538709, 33484131, 23071690, 41755874, 26457769, 36884039, 56493891, 33397663, 42181417, 89855501, 90028072, 52745625, 61911446, 43970320, 26994017, 76207174,...
AlgorithmLover/OJCodes
qlcoder/data_mining/transform_matrix/population_statistics.py
Python
mit
1,029
import numpy as np from matplotlib import pyplot def scatterplot(X, marker='.', title=None, fig=None, ax=None, **kwargs): '''General plotting function for a set of points X. May be [1-3] dimensional.''' assert len(X.shape) in (1,2), 'Only valid for 1 or 2-d arrays of points' assert len(X.shape) == 1 or X.shape[...
all-umass/manifold_spanning_graphs
viz.py
Python
mit
2,551
import numpy as np import torch import torch.nn as nn from itertools import product from torch.nn import functional as F #import pytorch_fft.fft as fft # def laplace(): # return np.array([[0.25, 0.5, 0.25], [0.5, -3.0, 0.5], [0.25, 0.5, 0.25]]).astype(np.float32)[None, None, ...] def laplace(): return np.arr...
atlab/attorch
attorch/regularizers.py
Python
mit
3,598
from rest_framework.permissions import BasePermission, SAFE_METHODS class IsAdminOrModeratorOrReadOnly(BasePermission): def has_object_permission(self, request, view, obj): if request.method in SAFE_METHODS: return True if request.user and request.user.is_staff: return Tru...
kasper190/SPAforum
forum/api/permissions.py
Python
mit
441
import os import sys import requests import time from pocket import Pocket import webbrowser import collections import json sys.dont_write_bytecode = True os.environ.setdefault("DJANGO_SETTINGS_MODULE", "trex.settings") import django django.setup() from restapi.models import * from random import randint # POCKET_CON...
tavy14t/tw_project
Testing/Pocket_Testing.py
Python
mit
4,909
import cv2 import os import skimage.io output_dir = '../training_images/Final_Training/Images/00043/' images_path = './samples/' if not os.path.exists(output_dir): os.makedirs(output_dir) name = 0; img_names = [f for f in os.listdir(images_path) if f.endswith(".ppm")] for img_name in img_names: img = cv2.i...
lachaka/traffic_sign_recognition
datasets/neg_images/img_gen.py
Python
mit
644
from PIL import Image import stripe import datetime from django.shortcuts import render, redirect from django.views.generic import TemplateView, View, FormView from django.core.urlresolvers import reverse_lazy, reverse from django.views.decorators.csrf import csrf_exempt from django.utils.decorators import method_dec...
ZzCalvinzZ/picturepay
picture/views.py
Python
mit
5,543
from pyccel.stdlib.internal.blas import dgemv from numpy import zeros n = 4 m = 5 a = zeros((n,m), 'double') x = zeros(m, 'double') y = zeros(n, 'double') # ... a[0,0] = 1.0 a[1,0] = 6.0 a[2,0] = 11.0 a[3,0] = 16.0 a[0,1] = 2.0 a[1,1] = 7.0 a[2,1] = 12.0 a[3,1] = 17.0 a[0,2] = 3.0 a[1,2] = 8.0 a[2,2] = 13.0 a[3,2]...
ratnania/pyccel
tests/internal/scripts/blas/ex2.py
Python
mit
611
from django.shortcuts import render from django.conf import settings from django.http import HttpResponseRedirect, HttpResponse from django.urls import reverse from django.views.decorators.csrf import csrf_exempt from fetcher import api import requests import json def index(request): return render(request, 'fetc...
zyphrus/fetch-django
fetcher/views.py
Python
mit
1,510
# -*- coding: utf-8 -*- import pytest import mock from apispec import APISpec, Path from apispec.exceptions import PluginError, APISpecError description = 'This is a sample Petstore server. You can find out more ' 'about Swagger at <a href=\"http://swagger.wordnik.com\">http://swagger.wordnik.com</a> ' 'or on irc.f...
gorgias/apispec
tests/test_core.py
Python
mit
13,849
""" THIS SCRIPT CREATES AN INDEX OF NEIGHBORHOOD CHANGE USING USER SPECIFIED INDICATORS: 1. CALCULATE Z-SCORE FOR EACH INDICATOR 2. CALCULATE NEGATIVE Z-SCORE FOR INDICATORS THAT SHOULD DETRACT FROM SCORE (I.E. VACANCY RATE) 3. ADD INDICATORS TOGETHER FOR RAW SCORE 4. DEFINE CLASSIFICATION METHOD 5....
adriennemcd/neighborhood-change-index
nc-pt1.py
Python
mit
19,716