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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('stats', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Dispensed',
fields=[
... | proyectosdeley/proyectos_de_ley | proyectos_de_ley/stats/migrations/0002_dispensed.py | Python | mit | 1,175 |
#This will be the thread responsible for the matchmaking which operates as follows:
#There are four lists where the players are divided into based on their rank.
#List 1 is for ranks 0,1,2.
#List 2 is for ranks 3,4,5.
#List 3 is for ranks 6,7,8.
#List 4 is for ranks 9,10.
#When a player waits for a match too long, this... | Shalantor/Connect4 | server/matchMakingThread.py | Python | mit | 4,679 |
# coding: utf-8
from geventwebsocket.handler import WebSocketHandler
from gevent import pywsgi, sleep
import json
import MySQLdb
class JPC:
#
# 初期化
#
def __init__(self, filepath_config):
import hashlib
# 設定ファイルをロード
fp = open(filepath_config, 'r')
config = json.load(fp)
... | ptr-yudai/JokenPC | server/JPC.py | Python | mit | 11,068 |
"""
download a file named filename from the atsc301 downloads directory
and save it as a local file with the same name.
command line example::
python -m a301utils.a301_readfile photon_data.csv
module example::
from a301utils.a301_readfile import download
download('photon_data.csv')
"""
import a... | a301-teaching/a301_code | a301utils/a301_readfile.py | Python | mit | 2,239 |
#!/usr/bin/env python3
import matplotlib.pyplot as plt
from math import sqrt
from math import log
dx = [1/sqrt(16), 1/sqrt(64), 1/sqrt(256), 1/sqrt(1024)]
dx_tri = [1/sqrt(32), 1/sqrt(128), 1/sqrt(512), 1/sqrt(2048)]
dx_pert = [0.0270466, 0.0134827, 0.00680914, 0.00367054]
dx_fp = [0.122799, 0.081584, 0.0445639, 0.022... | Rob-Rau/EbbCFD | ms_refinement/plot_conv.py | Python | mit | 2,727 |
import sublime, sublime_plugin
import os.path
import platform
def compare_file_names(x, y):
if platform.system() == 'Windows' or platform.system() == 'Darwin':
return x.lower() == y.lower()
else:
return x == y
class SwitchFileCommand(sublime_plugin.WindowCommand):
def run(self, extensions=... | koery/win-sublime | Data/Packages/Default/switch_file.py | Python | mit | 1,112 |
from __future__ import print_function
from datetime import datetime
import inspect
import json
import logging
import os
try:
import pkg_resources
except ImportError: # pragma: no cover
pkg_resources = None
import random
import re
import subprocess
import shutil
import string
import sys
import time
import bot... | miguelgrinberg/slam | slam/cli.py | Python | mit | 28,330 |
import sys
import mechanize
import re
import json
import time
import urllib
import dogcatcher
import HTMLParser
import os
h = HTMLParser.HTMLParser()
cdir = os.path.dirname(os.path.abspath(__file__)) + "/"
tmpdir = cdir + "tmp/"
voter_state = "SC"
source = "State"
result = [("authory_name", "first_name", "last_nam... | democracyworks/dog-catcher | south_carolina.py | Python | mit | 12,842 |
"""The tests for the MQTT cover platform."""
from unittest.mock import patch
import pytest
from homeassistant.components import cover
from homeassistant.components.cover import (
ATTR_CURRENT_POSITION,
ATTR_CURRENT_TILT_POSITION,
ATTR_POSITION,
ATTR_TILT_POSITION,
)
from homeassistant.components.mqtt ... | rohitranjan1991/home-assistant | tests/components/mqtt/test_cover.py | Python | mit | 102,124 |
import pytest
from everest.repositories.rdb.testing import check_attributes
from everest.repositories.rdb.testing import persist
from thelma.tests.entity.conftest import TestEntityBase
class TestExperimentEntity(TestEntityBase):
def test_init(self, experiment_fac):
exp = experiment_fac()
check_a... | helixyte/TheLMA | thelma/tests/entity/test_experiment.py | Python | mit | 3,511 |
"""
virtstrap.log
-------------
Provides a central logging facility. It is used to record log info
and report both to a log file and stdout
"""
import sys
import logging
import traceback
CLINT_AVAILABLE = True
try:
from clint.textui import puts, colored
except:
# Clint is still not stable enough yet to just i... | ravenac95/virtstrap | virtstrap-core/virtstrap/log.py | Python | mit | 6,365 |
from ...utils.tests import base as base
from ...utils.tests import mpi as mpit
# key order: dataset; epsilon; C
__REFERENCE_RESULTS__ = {
"dryrun": {
0.1: {
0.1: {
"accuracy": 1-0.9300,
},
1: {
"accuracy": 1-0.9300,
},
... | albermax/xcsvm | xcsvm/xcsvm/tests/solvers/llwmr.py | Python | mit | 7,407 |
from __future__ import print_function
from eventlet import hubs
from eventlet.support import greenlets as greenlet
__all__ = ['Event']
class NOT_USED:
def __repr__(self):
return 'NOT_USED'
NOT_USED = NOT_USED()
class Event(object):
"""An abstraction where an arbitrary number of coroutines
can... | sbadia/pkg-python-eventlet | eventlet/event.py | Python | mit | 7,095 |
from PyQt4 import QtCore, QtGui
from components.propertyeditor.Property import Property
from components.RestrictFileDialog import RestrictFileDialog
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys, os
class QPropertyModel(QtCore.QAbstractItemModel):
def __init__(self, parent):
super(QProp... | go2net/PythonBlocks | components/propertyeditor/QPropertyModel.py | Python | mit | 7,747 |
# -*- coding: utf-8 -*-
"""
Sitemap builder
"""
import json, os
from treelib import Tree
from optimus.conf import settings
class SitemapError(Exception):
pass
class PageSitemap(object):
"""
Construct ressource page to build and published sitemap
"""
def __init__(self, tree, view, with_root=Fal... | sveetch/Sveetoy | project/sitemap.py | Python | mit | 4,546 |
import rcblog
if __name__ == '__main__':
rcblog.main()
| sanchopanca/rcblog | run.py | Python | mit | 60 |
# -*- coding: utf-8 -*-
# @Time : 2017/7/27 18:04
# @Author : play4fun
# @File : calibrateCamera2.py
# @Software: PyCharm
"""
calibrateCamera2.py:
"""
import cv2
import numpy as np
def draw_axis(img, charuco_corners, charuco_ids, board):
vecs = np.load("./calib.npz") # I already calibrated the camera
... | makelove/OpenCV-Python-Tutorial | ch200_Extra_modules/aruco/Camera Calibration using ChArUco and Python/calibrateCamera2.py | Python | mit | 2,398 |
def hamming_distance(bytes1, bytes2):
distance = 0
for b1, b2 in zip(bytes1, bytes2):
xored = b1^b2
distance += sum(1 for n in range(8) if (xored >> n) & 0x01)
return distance
| nfschmidt/cryptopals | python/byte.py | Python | mit | 206 |
"""
Module containing MPG Ranch NFC coarse classifier, version 3.1.
An NFC coarse classifier classifies an unclassified clip as a `'Call'`
if it appears to be a nocturnal flight call, or as a `'Noise'` otherwise.
It does not classify a clip that has already been classified, whether
manually or automatically.
This cla... | HaroldMills/Vesper | vesper/mpg_ranch/nfc_coarse_classifier_3_1/classifier.py | Python | mit | 14,590 |
from setuptools import setup, find_packages
setup(
name="simple-crawler",
version="0.1",
url="https://github.com/shonenada/crawler",
author="shonenada",
author_email="shonenada@gmail.com",
description="Simple crawler",
zip_safe=True,
platforms="any",
packages=find_packages(),
i... | shonenada/crawler | setup.py | Python | mit | 359 |
import unittest
import numpy as np
import theano
import theano.tensor as T
from tests.helpers import (SimpleTrainer, SimpleClf, SimpleTransformer,
simple_reg)
from theano_wrapper.layers import (BaseLayer, HiddenLayer, MultiLayerBase,
BaseEstimator, BaseTra... | sotlampr/theano-wrapper | tests/test_layers.py | Python | mit | 18,340 |
# Past examples are programmatically insecure
# You require arguments to be passed in but what if the wrong arguments are provided?
# Look at the timestable solution which changes numbers to text - what happens if you provide the number 30?
#
# One way of controlling these things uses conditions
# These enable specific... | Chris35Wills/Chris35Wills.github.io | courses/examples/Beginners_python/conditions.py | Python | mit | 826 |
import py
from rpython.annotator import model as annmodel
from rpython.rtyper.llannotation import SomePtr, lltype_to_annotation
from rpython.conftest import option
from rpython.rtyper.annlowlevel import (annotate_lowlevel_helper,
MixLevelHelperAnnotator, PseudoHighLevelCallable, llhelper,
cast_instance_to_base... | oblique-labs/pyVM | rpython/rtyper/test/test_llann.py | Python | mit | 15,371 |
#Import Libraries
import eventmaster as EM
from time import sleep
import random
import sys
""" Create new Instance of EventMasterSwitcher and turn off logging """
s3 = EM.EventMasterSwitcher()
s3.setVerbose(0)
with open('example_settings_.xml', 'r') as content_file:
content = content_file.read()
s3.loadFromXML(... | kyelewisstgc/EventMaster-Python | tests/test_offline.py | Python | mit | 4,308 |
#!/usr/bin/python3
# This code is available for use under CC0 (Creative Commons 0 - universal).
# You can copy, modify, distribute and perform the work, even for commercial
# purposes, all without asking permission. For more information, see LICENSE.md or
# https://creativecommons.org/publicdomain/zero/1.0/
# usage:
... | MSchuwalow/StudDP | studdp/picker.py | Python | mit | 5,867 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "remakery.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| symroe/remakery | manage.py | Python | mit | 251 |
#!/usr/bin/env python
import dateutil.parser
import dateutil.tz
import feedparser
import re
from datetime import datetime, timedelta
from joblist import JobList
class FilterException(Exception):
pass
class IndeedJobList(JobList):
'''Joblist class for Indeed
This joblist is for the indeed.com rss feed. I... | keisetsu/joblist | indeed.py | Python | mit | 5,528 |
from .config import Config, HentaiHavenConfig, HAnimeConfig, Section
from .last_entry import LastEntry
| NightShadeNeko/HentaiBot | data/__init__.py | Python | mit | 103 |
from Tkinter import *
from ScrolledText import ScrolledText
from unicodedata import lookup
import os
class Diacritical:
"""Mix-in class that adds keyboard bindings for accented characters, plus
other common functionality.
An inheriting class must define a select_all method that will respond
to Ctr... | ActiveState/code | recipes/Python/286155_Entering_accented_characters_Tkinter/recipe-286155.py | Python | mit | 3,210 |
import base64
import json
import requests
def call_vision_api(image_filename, api_keys):
api_key = api_keys['microsoft']
post_url = "https://api.projectoxford.ai/vision/v1.0/analyze?visualFeatures=Categories,Tags,Description,Faces,ImageType,Color,Adult&subscription-key=" + api_key
image_data = open(image_... | SlashDK/OpenCV-simplestuff | vendors/microsoft.py | Python | mit | 1,684 |
from django.db import models
from django.contrib.auth.models import User, Group
from django.utils.translation import ugettext_lazy as _
from django.core.validators import RegexValidator
from django.conf import settings
class Repository(models.Model):
"""
Git repository
"""
# basic info
name = mode... | gitmill/gitmill | django/repository/models.py | Python | mit | 2,579 |
import re
def read_lua():
PATTERN = r'\s*\[(?P<id>\d+)\] = {\s*unidentifiedDisplayName = ' \
r'"(?P<unidentifiedDisplayName>[^"]+)",\s*unidentifie' \
r'dResourceName = "(?P<unidentifiedResourceName>[^"]+' \
r')",\s*unidentifiedDescriptionName = {\s*"(?P<uniden' \
... | vakhet/rathena-utils | dev/ragna.py | Python | mit | 1,183 |
from django.apps import AppConfig
class JcvrbaseappConfig(AppConfig):
name = 'jcvrbaseapp'
| jucapoco/baseSiteGanttChart | jcvrbaseapp/apps.py | Python | mit | 97 |
# coding=utf8
import time
import random
import unittest
from qiniuManager.progress import *
class Pro(object):
def __init__(self):
self.progressed = 0
self.total = 100
self.title = 'test'
self.chunked = False
self.chunk_recved = 0
self.start = time.time()
@bar... | hellflame/qiniu_manager | qiniuManager/test/progress_test.py | Python | mit | 1,900 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-18 18:01
from __future__ import unicode_literals
from django.db import migrations, models
import django.forms.widgets
class Migration(migrations.Migration):
dependencies = [
('sshcomm', '0002_auto_20170118_1702'),
]
operations = [
... | t-mertz/slurmCompanion | django-web/sshcomm/migrations/0003_auto_20170118_1901.py | Python | mit | 697 |
from bson.objectid import ObjectId
import json
class Room():
def __init__(self, players_num, objectid, table, current_color='purple'):
if players_num:
self.players_num = players_num
else:
self.players_num = 0
for el in ['p', 'b', 'g', 'r']:
if ... | Andrey-Tkachev/infection | models/room.py | Python | mit | 6,066 |
class Solution:
def countSegments(self, s: 'str') -> 'int':
return len(s.split())
| jiadaizhao/LeetCode | 0401-0500/0434-Number of Segments in a String/0434-Number of Segments in a String.py | Python | mit | 94 |
import datetime
from sqlalchemy import create_engine, ForeignKey, Column, Integer, String, Text, Date, Table, Boolean
from sqlalchemy.orm import sessionmaker, relationship
from sqlalchemy.ext.declarative import declarative_base
from . import app
from flask_login import UserMixin
engine = create_engine(app.config["SQLA... | tydonk/fight_simulator | fight_simulator/database.py | Python | mit | 3,978 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Pyramidal bidirectional LSTM encoder."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
class PyramidBLSTMEncoder(object):
"""Pyramidal bidirectional LSTM Encoder.
Args:
... | hirofumi0810/tensorflow_end2end_speech_recognition | models/encoders/core/pyramidal_blstm.py | Python | mit | 7,080 |
import numpy as np
import pandas as pd
arts = pd.DataFrame()
# 1. Clean the dates so you only see numbers by using string manipulations
arts["execution_date"] = arts["execution_date"].str.findall(r"([0-9]+)").str[0]
arts["execution_date"] = arts["execution_date"].astype(float)
arts.head()
# 1. If a year is lower th... | versae/DH2304 | data/arts2.py | Python | mit | 1,974 |
import os
from .base import Output
class AppleSay(Output):
"""Speech output supporting the Apple Say subsystem."""
name = 'Apple Say'
def __init__(self, voice = 'Alex', rate = '300'):
self.voice = voice
self.rate = rate
super(AppleSay, self).__init__()
def is_active(self):
return not os.system('which say')... | frastlin/PyAudioGame | pyaudiogame/accessible_output2/outputs/say.py | Python | mit | 535 |
from jupyter_server.utils import url_path_join as ujoin
from .config import Lmod as LmodConfig
from .handler import default_handlers, PinsHandler
def _jupyter_server_extension_paths():
return [{"module": "jupyterlmod"}]
# Jupyter Extension points
def _jupyter_nbextension_paths():
return [
dict(
... | cmd-ntrf/jupyter-lmod | jupyterlmod/__init__.py | Python | mit | 1,051 |
from models import Event
from django.views.generic import DetailView, ListView
class EventListView(ListView):
template_name = 'agenda/event_list.html'
queryset = Event.objects.upcoming()
paginate_by = 20
class EventArchiveview(EventListView):
queryset = Event.objects.past()
class EventDetailV... | feinheit/feincms-elephantagenda | elephantagenda/views.py | Python | mit | 403 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Prueba',
fields=[
('id', models.AutoField(verbo... | HenryGBC/landing_company | landing/migrations/0001_initial.py | Python | mit | 556 |
#!/usr/bin/env python
"""
Download NLTK data
"""
__author__ = "Manan Kalra"
__email__ = "manankalr29@gmail.com"
import nltk
nltk.download() | manankalra/Twitter-Sentiment-Analysis | demo/download.py | Python | mit | 145 |
import numpy as np
import ctypes
import struct
import time
# relative imports in Python3 must be explicit
from .ioctl_numbers import _IOR, _IOW
from fcntl import ioctl
SPI_IOC_MAGIC = ord("k")
SPI_IOC_RD_MODE = _IOR(SPI_IOC_MAGIC, 1, "=B")
SPI_IOC_WR_MODE = _IOW(SPI_IOC_MAGIC, 1, "=B")
SPI_IOC_... | varunsuresh2912/SafeRanger | Python PiCode/Lepton.py | Python | mit | 7,177 |
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
from scipy.interpolate import interp1d,splev,splrep
def extractSpectrum(filename):
"""
NAME:
extractSpectrum
PURPOSE:
To open an input fits file from SDSS and extract the relevant
components, ... | BU-PyCon/Meeting-3 | Programs/interpolate.py | Python | mit | 3,010 |
import unittest
import random
from pygraph.classes.graph import graph
class SWIM(object):
def __init__(self, graph):
self.graph = graph
def edge_alive(self, nodeA, nodeB, alive):
'''
edge_alive(A, B, True|False)
'''
edge = (nodeA, nodeB)
if alive:
s... | achoi007/CloudComputing | Concepts/SWIM.py | Python | mit | 2,292 |
import numpy as np
from astropy.coordinates import EarthLocation, SkyCoord
__all__ = ['MWA_LOC', 'MWA_FIELD_EOR0', 'MWA_FIELD_EOR1', 'MWA_FIELD_EOR2',
'MWA_FREQ_EOR_ALL_40KHZ', 'MWA_FREQ_EOR_ALL_80KHZ',
'MWA_FREQ_EOR_HI_40KHZ', 'MWA_FREQ_EOR_HI_80KHZ',
'MWA_FREQ_EOR_LOW_40KHZ', 'MWA_FR... | piyanatk/sim | opstats/utils/settings.py | Python | mit | 1,196 |
__all__ = ['LEAGUE_PROPERTIES']
LEAGUE_PROPERTIES = {
"PL": {
"rl": [18, 20],
"cl": [1, 4],
"el": [5, 5],
},
"EL1": {
"rl": [21, 24],
"cl": [1, 2],
"el": [3, 6]
},
"EL2": {
"rl": [21, 24],
"cl": [1, 2],
"el": [3, 6]
},
... | RayYu03/pysoccer | soccer/data/leagueproperties.py | Python | mit | 1,439 |
'''
This script demonstrates how to create a periodic Gaussian process
using the *gpiso* function.
'''
import numpy as np
import matplotlib.pyplot as plt
from sympy import sin, exp, pi
from rbf.basis import get_r, get_eps, RBF
from rbf.gproc import gpiso
np.random.seed(1)
period = 5.0
cls = 0.5 # characteristic le... | treverhines/RBF | docs/scripts/gproc.e.py | Python | mit | 1,343 |
# 1417. Weighing Problem
# Gives nn coins, each weighing 10g, but the weight of one coin is 11g. There
# is now a balance that can be accurately weighed. Ask at least a few times
# to be sure to find the 11g gold coin.
#
# Example
# Given n = 3, return 1.
#
# Explanation:
# Select two gold coins on the two ends of the... | kingdaa/LC-python | lintc/1417_Weighing_Problem.py | Python | mit | 958 |
#!/usr/bin/python
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
Print = PETSc.Sys.Print
# from MatrixOperations import *
from dolfin import *
import numpy as np
import matplotlib.pylab as plt
import scipy.sparse as sps
import scipy.sparse.linalg as slinalg
import os
import scipy.io
i... | wathen/PhD | MHD/FEniCS/ShiftCurlCurl/saddle.py | Python | mit | 5,740 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-08-01 07:59
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import proso.django.models
class Migration(migrations.Migration):
initial = T... | adaptive-learning/proso-apps | proso_models/migrations/0001_initial.py | Python | mit | 11,335 |
#!/usr/bin/env python
# Usage parse_shear sequences.fna a2t.txt emb_output.b6
import sys
import csv
from collections import Counter, defaultdict
sequences = sys.argv[1]
accession2taxonomy = sys.argv[2]
alignment = sys.argv[3]
with open(accession2taxonomy) as inf:
next(inf)
csv_inf = csv.reader(inf... | knights-lab/analysis_SHOGUN | scripts/parse_shear.py | Python | mit | 2,010 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from .config import Config
| kaka19ace/kkutil | kkutil/config/__init__.py | Python | mit | 77 |
import seaborn as sns
import matplotlib.pyplot as plt
def plot_corrmatrix(df, square=True, linewidths=0.1, annot=True,
size=None, figsize=(12, 9), *args, **kwargs):
"""
Plot correlation matrix of the dataset
see doc at https://stanford.edu/~mwaskom/software/seaborn/generated/seaborn.he... | ericfourrier/auto-clean | autoc/utils/corrplot.py | Python | mit | 590 |
#--------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), t... | Azure/azure-sdk-for-python | sdk/core/azure-core/tests/async_tests/test_base_polling_async.py | Python | mit | 30,931 |
from organise import app
app.run()
| msanatan/organise | run.py | Python | mit | 36 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.contrib.gis.geos import GeometryCollection
def change_line_to_multiline(apps, schema_editor):
# We can't import the Person model directly as it may be a newer
# version than this migration expe... | auto-mat/django-webmap-corpus | webmap/migrations/0012_line_to_multiline.py | Python | mit | 736 |
from eth_utils import (
is_hex,
is_string,
is_integer,
remove_0x_prefix,
force_text,
)
def is_predefined_block_number(value):
if not is_string(value):
return False
return force_text(value) in {"latest", "pending", "earliest"}
def is_hex_encoded_block_hash(value):
if not is_st... | pipermerriam/web3.py | web3/utils/blocks.py | Python | mit | 1,270 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^', include('ebets.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| pisskidney/dota | dota/urls.py | Python | mit | 222 |
class Solution(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
inspected_dict = {}
for i, num in enumerate(nums):
try:
j = inspected_dict[num]
... | chenjiancan/LeetCodeSolutions | src/two_sum/two_sum.py | Python | mit | 414 |
#! /usr/bin/env python
"""Unit tests for the image downloader."""
import unittest
import download
__author__ = "Nick Pascucci (npascut1@gmail.com)"
class DownloadTest(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_img_matcher(self):
html = """<html>
<bod... | nickpascucci/AppDesign | download/download_test.py | Python | mit | 1,195 |
# -*- coding: utf-8 -*-
r"""
.. _SoftiMAX:
SoftiMAX at MAX IV
------------------
The images below are produced by scripts in
``\examples\withRaycing\14_SoftiMAX``.
The beamline will have two branches:
- STXM (Scanning Transmission X-ray Microscopy) and
- CXI (Coherent X-ray Imaging),
see the scheme provided by K. T... | kklmn/xrt | examples/withRaycing/14_SoftiMAX/__init__.py | Python | mit | 16,930 |
import unittest
import pandas as pd
import nose.tools
from mia.features.blobs import detect_blobs
from mia.features.intensity import detect_intensity
from mia.utils import preprocess_image
from ..test_utils import get_file_path
class IntensityTests(unittest.TestCase):
@classmethod
def setupClass(cls):
... | samueljackson92/major-project | src/tests/regression_tests/intensity_regression_test.py | Python | mit | 780 |
#!usr/bin/python2.7
# coding: utf-8
# date: 16-wrzesień-2016
# autor: B.Kozak
# Simple script giving length of sequences from fasta file
import Bio
from Bio import SeqIO
import sys
import os.path
filename = sys.argv[-1]
outname = filename.split('.')
outname1 = '.'.join([outname[0], 'txt'])
FastaFile = open(filena... | bartosz-kozak/Sample-script | python/seq_len.py | Python | mit | 544 |
"""
[2015-12-28] Challenge #247 [Easy] Secret Santa
https://www.reddit.com/r/dailyprogrammer/comments/3yiy2d/20151228_challenge_247_easy_secret_santa/
# Description
Every December my friends do a "Secret Santa" - the traditional gift exchange
where everybody is randomly assigned to give a gift to a friend. To make
th... | DayGitH/Python-Challenges | DailyProgrammer/DP20151228A.py | Python | mit | 2,377 |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
import os, os.path
from matplotlib import pyplot as plt
from pylab import get_cmap
import SimpleCV as cv
from glob import glob
# <codecell>
def show_img(img, ax = None):
if ax is not None:
plt.sca(ax)
nimg = img.getNumpy()
return pl... | JudoWill/ResearchNotebooks | Woundy.py | Python | mit | 2,781 |
import game
import pygame
from pygame.locals import *
class Resources:
<<<<<<< HEAD
def cambiar(self,imagen):
sheet = game.load_image(imagen)
rects = [pygame.Rect(112,2,26,40),
pygame.Rect(112,2,26,40),
pygame.Rect(112,2,26,40),
pygame.Rect(4,4,30,... | cangothic/2D-Platformer | resources.py | Python | mit | 2,891 |
'''
author Lama Hamadeh
'''
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
import assignment2_helper as helper
# Look pretty...
matplotlib.style.use('ggplot')
# Do * NOT * alter this line, until instructed!
scaleFeatures = True #Features scaling (if it's false no scaling appears and that aff... | LamaHamadeh/Microsoft-DAT210x | Module-4/assignment2.py | Python | mit | 3,877 |
import unittest
import os
from sqltxt.table import Table
from sqltxt.column import Column, ColumnName, AmbiguousColumnNameError
from sqltxt.expression import Expression
class TableTest(unittest.TestCase):
def setUp(self):
self.data_path = os.path.join(os.path.dirname(__file__), '../data')
table... | shahin/sqltxt | tests/unit/table_test.py | Python | mit | 5,179 |
#!/usr/bin/env python
# --------------------------------------------------------
# Test regression propagation on ImageNet VID video
# Modified by Kai KANG (myfavouritekk@gmail.com)
# --------------------------------------------------------
"""Test a Fast R-CNN network on an image database."""
import argparse
import... | myfavouritekk/TPN | tools/propagate/sequence_roi_gt_propagation.py | Python | mit | 3,197 |
# coding: utf-8
import django_filters
from django import forms
from django.utils.translation import ugettext_lazy as _
from courses.models import Course
from issues.models import Issue
from issues.model_issue_status import IssueStatus
class IssueFilterStudent(django_filters.FilterSet):
is_active = django_filte... | znick/anytask | anytask/issues/model_issue_student_filter.py | Python | mit | 2,807 |
from django.db import models
import datetime
def get_choices(lst):
return [(i, i) for i in lst]
#
# Person
#
pprint_pan = lambda pan: "%s %s %s" % (pan[:5], pan[5:9], pan[9:])
class Person(models.Model):
name = models.CharField(max_length=255, db_index=True)
fathers_name = models.CharField(max_length=2... | annual-client-report/Annual-Report | report/models.py | Python | mit | 8,050 |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="serverless-wsgi",
version="3.0.0",
python_requires=">3.6",
author="Logan Raarup",
author_email="logan@logan.dk",
description="Amazon AWS API Gateway WSGI wrapper",
long_description... | logandk/serverless-wsgi | setup.py | Python | mit | 867 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('orders', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='order',
name='paid',
... | spectrumone/online-shop-template | myshop/orders/migrations/0002_auto_20160213_1225.py | Python | mit | 390 |
from click.testing import CliRunner
from sqlitebiter.__main__ import cmd
from sqlitebiter._const import ExitCode
from .common import print_traceback
class Test_version_subcommand:
def test_smoke(self):
runner = CliRunner()
result = runner.invoke(cmd, ["version"])
print_traceback(result)
... | thombashi/sqlitebiter | test/test_version_subcommand.py | Python | mit | 373 |
# Patchless XMLRPC Service for Django
# Kind of hacky, and stolen from Crast on irc.freenode.net:#django
# Self documents as well, so if you call it from outside of an XML-RPC Client
# it tells you about itself and its methods
#
# Brendan W. McAdams <brendan.mcadams@thewintergrp.com>
# SimpleXMLRPCDispatcher lets us r... | SolusOS-discontinued/RepoHub | buildfarm/views.py | Python | mit | 5,488 |
from django.core.management.base import BaseCommand, CommandError
from ship_data.models import GpggaGpsFix
import datetime
from main import utils
import csv
import os
from django.db.models import Q
import glob
from main.management.commands import findgpsgaps
gps_bridge_working_intervals = None
# This file is part of ... | cpina/science-cruise-data-management | ScienceCruiseDataManagement/main/management/commands/exportgpstracks.py | Python | mit | 8,461 |
from yaml import load
from os import environ
from os.path import join, isfile
from ..module_ultra_repo import ModuleUltraRepo
from ..module_ultra_config import ModuleUltraConfig
class RepoDaemonConfig:
"""Represent a MU repo to the MU daemon."""
def __init__(self, **kwargs):
self.repo_name = kwargs... | MetaSUB/ModuleUltra | moduleultra/daemon/config.py | Python | mit | 3,078 |
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014, 2019 zordsdavini
# Copyright (c) 2014 Alexandr Kriptonov
# Copyright (c) 2014 Tycho Andersen
#
# 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 Softw... | ramnes/qtile | libqtile/widget/gmail_checker.py | Python | mit | 2,825 |
def gpio_init(pin, output):
try:
with open(f"/sys/class/gpio/gpio{pin}/direction", 'wb') as f:
f.write(b"out" if output else b"in")
except Exception as e:
print(f"Failed to set gpio {pin} direction: {e}")
def gpio_set(pin, high):
try:
with open(f"/sys/class/gpio/gpio{pin}/value", 'wb') as f:
... | commaai/openpilot | common/gpio.py | Python | mit | 432 |
# vim: fileencoding=utf-8
"""
AppHtml settings
@author Toshiya NISHIO(http://www.toshiya240.com)
"""
defaultTemplate = {
'1) 小さいボタン': '${badgeS}',
'2) 大きいボタン': '${badgeL}',
'3) テキストのみ': '${textonly}',
"4) アイコン付き(小)": u"""<span class="appIcon"><img class="appIconImg" height="60" src="${icon60url}" style... | connect1ngdots/AppHtmlME | AppHtmlME.workflow/Scripts/apphtml_settings.py | Python | mit | 1,540 |
#!/usr/bin/env python3
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "houseofdota.production_settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| lucashanke/houseofdota | manage.py | Python | mit | 266 |
"""
Django settings for plasystem project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
from loc... | CARocha/plasystem | plasystem/settings.py | Python | mit | 3,017 |
"""Tests for the object departures module."""
import responses
# initialize package, and does not mix up names
import test as _test
import navitia_client
import requests
class DeparturesTest(_test.TestCase):
def setUp(self):
self.user = 'leo'
self.core_url = "https://api.navitia.io/v1/"
... | leonardbinet/navitia_client | test/test_departures.py | Python | mit | 529 |
# http://github.com/timestocome
# use hidden markov model to predict changes in a stock market index fund
# http://cs229.stanford.edu/proj2009/ShinLee.pdf
# https://www.dartmouth.edu/~chance/teaching_aids/books_articles/probability_book/Chapter11.pdf
import numpy as np
import pandas as pd
import tensorflow as tf
im... | timestocome/Test-stock-prediction-algorithms | Misc experiments/Stocks_SimpleMarkovChain.py | Python | mit | 4,218 |
"""
Django settings for ecommerce project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build path... | Maelstroms38/ecommerce | src/ecommerce/settings/local.py | Python | mit | 7,411 |
"""geo.py: Implementation of class AbstractTwitterGeoCommand
and its subclasses.
"""
from argparse import ArgumentParser
from . import (AbstractTwitterCommand, call_decorator)
from ..parsers import (filter_args, cache)
# GET geo/id/:place_id
# POST geo/place DEPRECATED
# GET geo/reverse_geocode
# GET geo/search
GEO... | showa-yojyo/bin | twmods/commands/geo.py | Python | mit | 4,854 |
from __future__ import absolute_import
from collections import defaultdict as ddict
import os.path as op
def enum(**enums):
"""#enumeration
#backward compatible
:param enums:
"""
return type('Enum', (), enums)
IONISATION_MODE = enum(NEG=-1, POS=1)
class ExperimentalSettings(object):
"""
... | jerkos/mzOS | mzos/exp_design.py | Python | mit | 3,317 |
# -*- coding: utf-8 -*-
from nose.tools import (
eq_,
raises,
)
from py3oauth2.utils import (
normalize_netloc,
normalize_path,
normalize_query,
normalize_url,
)
def test_normalize_url():
eq_(normalize_url('http://a/b/c/%7Bfoo%7D'),
normalize_url('hTTP://a/./b/../b/%63/%7bfoo%7d')... | GehirnInc/py3oauth2 | py3oauth2/tests/test_utils.py | Python | mit | 1,798 |
#!/usr/bin/env python3
# coding=utf-8
"""Executa o servidor de nomes ".br"."""
import logging
import dns
def main():
logging.basicConfig(
format='[%(levelname)s]%(threadName)s %(message)s',
level=logging.INFO)
brNS = dns.NameServer('.br', 2, '127.0.0.1', 10001)
brNS.add_record('uem.br', '12... | marcokuchla/name-systems | runbr.py | Python | mit | 390 |
from __future__ import unicode_literals
from django.apps import AppConfig
class DevelopersConfig(AppConfig):
name = 'developers'
| neldom/qessera | developers/apps.py | Python | mit | 136 |
"""
Contains all elements of this package. They act as the formal elements of the law.
"""
import json
import sys
def from_json(data):
"""
Reconstructs any `BaseElement` from its own `.as_json()`. Returns the element.
"""
def _decode(data_dict):
values = []
if isinstance(data_dict, str... | publicos-pt/pt_law_parser | pt_law_parser/expressions.py | Python | mit | 15,426 |
import scipy as sp
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import sys
import matplotlib.lines as lines
import h5py
from matplotlib.font_manager import FontProperties
import matplotlib.ticker as ticker
from scipy.fftpack import fft
axial_label_font = FontProperties()
axial_label_font.se... | BorisJeremic/Real-ESSI-Examples | motion_one_component/Deconvolution_DRM_Propagation_Northridge/python_plot_parameteric_study.py | Python | cc0-1.0 | 5,870 |
import smtplib
from email.mime.text import MIMEText
from django.core.mail import EmailMultiAlternatives
from django.conf import settings
def send_message(message):
"""
* desc 快捷发送邮件
* input 要发送的邮件信息
* output None
"""
mail_handler = SendMail()
mail_handler.send_mail(settings.REPORT_US... | hanleilei/note | python/vir_manager/utils/mail_utils.py | Python | cc0-1.0 | 2,926 |
from django.db import models
# Create your models here.
class Pizza(models.Model):
name = models.CharField(max_length=128)
price = models.DecimalField(decimal_places=2, max_digits=5)
ingredients = models.TextField()
picture = models.ImageField(blank=True, null=True)
def __unicode__(self):
... | caioherrera/django-pizza | pizzaria/pizza/models.py | Python | cc0-1.0 | 412 |
import json
from django.core.urlresolvers import reverse
from django.http import HttpResponseNotFound
from django.test import TestCase
from mock import Mock
from utils import use_GET_in
from api.views import msas, tables
class ConversionTest(TestCase):
def test_use_GET_in(self):
fn, request = Mock(), Mo... | mehtadev17/mapusaurus | mapusaurus/api/tests.py | Python | cc0-1.0 | 4,338 |
"""
The most important object in the Gratipay object model is Participant, and the
second most important one is Ccommunity. There are a few others, but those are
the most important two. Participant, in particular, is at the center of
everything on Gratipay.
"""
from contextlib import contextmanager
from postgres imp... | mccolgst/www.gittip.com | gratipay/models/__init__.py | Python | cc0-1.0 | 8,904 |