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 |
|---|---|---|---|---|---|
#!/usr/bin/python
# AUTHOR : liuxu
# used to extract server sets from xml
import os
import sys
import getopt
from xml.dom.minidom import parse, parseString
#=======================================
class Server:
def __init__(self, server_node):
self.name = self.getXmlAttr(server_node, 'name')
... | liuxu0703/lx_bash_script | server_script/server_set_executor/server_set_parser.py | Python | mit | 5,122 |
# Django Imports
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.db.models import F
from django.core.exceptions import ObjectDoesNotExist
# Python Imports
import random, decimal
# WaW Imports
from wawmembers.models import *
from wawmembers.forms import *
from ... | heidi666/WorldsAtWar | wawmembers/news.py | Python | mit | 24,705 |
import setuptools
import sys
from pkg_resources import parse_version
def pip_command_output(pip_args):
"""
Get output (as a string) from pip command
:param pip_args: list o pip switches to pass
:return: string with results
"""
import sys
import pip
from io import StringIO
# as pip ... | ant6/beprof | setup.py | Python | mit | 5,222 |
# -*- coding: utf-8 -*-
"""
THE EXPERIMENT:
This is a battery of cognitive tests.
FEATURES OF THE SCRIPT:
The important thing is that this experiment incorporates most features that
experiments will use:
* Initial dialogue box
* Display messages and ask questions to participants (intro, instructions,
p... | MaisonLogicielLibre/CogSciProject-master | bcam_script/welcomescript.py | Python | mit | 17,814 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_custom_common.py | Python | mit | 16,300 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import MySQLdb
db = MySQLdb.connect(host="localhost",user="root",passwd="***",port=***,db="shadowsocks")
cursor = db.cursor()
pf = open('cardnum_passwd_20160730_year.txt')
line = pf.readline()
while line:
line = line.strip()
cardnum = line.split(' ')[0]
passwd = l... | ambjlon/wormhole-ss-panel | tools/import_cardnum_passwd_2_mysql.py | Python | mit | 557 |
"""
NewAuth IPB Sync
===================
Providing more informations to the IPB 3 LDAP authentication module.
"""
from setuptools import setup
setup(
name='NewAuth IPB Sync',
version='0.0.1',
author='@adrien-f',
author_email='vadrin_hegirin@j4lp.com',
description='Helping IPB 3 LDAP authentication... | J4LP/newauth_ipb_sync | setup.py | Python | mit | 515 |
import socket
if __name__ == '__main__':
host = '192.168.0.16'
port = 5000
s = socket.socket()
s.bind((host, port))
s.listen(1)
c, addr = s.accept()
print "Conexion desde (ip, puerto): " + str(addr)
while True:
data = c.recv(1024)
if not data:
... | seatbelts/test-sockets | server.py | Python | mit | 381 |
from unittest import TestCase
from jackster import Chain
def NO_NEXT(*args, **kwargs):
pass
class TestChain(TestCase):
def test_executes_all_in_order(self):
numbers = [1, 2, 3]
def remove(number):
def func(req, res, nxt):
self.assertEqual(numbers[0], number)
... | Daanvdk/jackster | tests/test_chain.py | Python | mit | 518 |
import abc
import json
import avro.schema
import hail as hl
from hail.ir.utils import make_filter_and_replace
from hail.typecheck import typecheck_method, sequenceof, nullable, anytype, oneof
from hail.utils.misc import escape_str
class TableReader(object):
@abc.abstractmethod
def render(self):
pas... | hail-is/hail | hail/python/hail/ir/table_reader.py | Python | mit | 7,479 |
import argparse
import os
import random
from math import log10
import scipy.stats as stats
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
import torchvision.utils as vutils
from tensorboardX import SummaryWriter
from torch.autograd import Variable, grad
... | orashi/PaintsPytorch | dev_train.py | Python | mit | 13,516 |
from flask import Flask
app = Flask(__name__)
app.config.from_object(__name__)
import views
def main():
app.run(host='0.0.0.0')
if __name__ == '__main__':
main()
| alerta/alerta-dashboard | dashboard/dashboard.py | Python | mit | 176 |
"""
Load npy xy, plot and save
"""
import os, sys
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
import matplotlib.pyplot as plt
import matplotlib.cm as mpl_cm
from matplotlib import rc
from matplotlib.font_manager import FontProperties
from matplotlib import rcPa... | peterwilletts24/Python-Scripts | plot_scripts/Rain/Diurnal/sea_diurnal_rain_plot_domain_constrain_8and12km_southern_indian_ocean.py | Python | mit | 10,248 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class SyncListPermissionTestCas... | tysonholub/twilio-python | tests/integration/preview/sync/service/sync_list/test_sync_list_permission.py | Python | mit | 8,205 |
import unittest
from NFL_Draftkings.GetPlayerDKScores import *
class TestPublicApiMethods(unittest.TestCase):
def test_get_scores_empty(self):
data = get_scores(season=2015)
assert len(data) == 585
def test_get_scores_name(self):
data = get_scores(name='Tom Brady', season=2015)
... | kacperadach/draftkings_points_scripts | NFL_Draftkings/tests/TestGetPlayerDKScores.py | Python | mit | 3,306 |
from __future__ import print_function
import sublime, sublime_plugin
import subprocess
import os
# The autoitbuild command is called as target by AutoIt.sublime-build
class autoitbuild(sublime_plugin.WindowCommand):
def run(self):
filepath = self.window.active_view().file_name()
AutoItExePath = sublime.l... | AutoIt/SublimeAutoItScript | autoitbuild.py | Python | mit | 4,027 |
import argparse
import copy
import json
import os
import sys
import numpy as np
from progressbar import ProgressBar
import h5py
from src.data import import_labels
from src.processing import activity_localization, get_classification, smoothing
def process_prediction(experiment_id,
predictions_... | imatge-upc/activitynet-2016-cvprw | scripts/process_prediction.py | Python | mit | 5,361 |
#!/usr/bin/env python3.5
import base64
import asyncio
import jinja2
import peewee_async
import aiohttp
import aiohttp_jinja2
import aiohttp_session.cookie_storage
from aiohttp import web
import database
import endpoints.moderator
import endpoints.consumer
import endpoints.util
import settings
app_loop = asyncio.get_ev... | bcattle/blockhate | app/app.py | Python | mit | 2,242 |
# humidity temperature dht base class
# author: ulno
# created: 2018-01-02
#
import time
from uiot.device import Device
####### HT temperature/humidity with
# TODO think about calibration
class _HTDHT(Device):
# minimum ms between two reads
delay = 1000
# Handle humidity and temperature from dht devices... | ulno/micropython-extra-ulno | lib/node_types/esp8266/compile/uiot/_htdht.py | Python | mit | 1,386 |
"""
This is the Python implementation for the Java package "sun.net.dns", compiled by Pava.
"""
import pava
from pava import nan, inf
pava_classes = {}
pava.module(__name__)
import dns
import sdp
import www
import spi
| laffra/pava | pava/implementation/natives/sun/net/__init__.py | Python | mit | 225 |
"""
Ports define where each port has:
- name
- midpoint: (x, y)
- width:
- orientation: (deg) 0, 90, 180, 270.
where 0 faces east, 90 (north), 180 (west), 270 (south)
"""
from typing import Tuple
import gdsfactory as gf
from gdsfactory.component import Component
@gf.cell
def test_component_with_port(
leng... | gdsfactory/gdsfactory | gdsfactory/samples/17_ports.py | Python | mit | 935 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-04-11 00:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0042_doctor_telephone'),
]
operations = [
migrations.AlterModelOptio... | cqw1/palliassist_webportal | app/migrations/0043_auto_20170410_1904.py | Python | mit | 707 |
import unittest
class Tests(unittest.TestCase):
def test_nothing(self):
self.assertIs(None, None)
| TangledWeb/tangled.auth | tangled/auth/tests/tests.py | Python | mit | 113 |
from django.shortcuts import render, redirect
from django.http import HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.core.urlresolvers import reverse
from django.views.generic import TemplateView
#https://do... | raytung/Slice | UserProfile/views.py | Python | mit | 7,912 |
#!/usr/bin/env python
#
# Nusoft
#
# Executes user actions
#
# Author P G Jones - 2014-08-15 <p.g.jones@qmul.ac.uk> : New file.
####################################################################################################
import system.standard
import system.mac
import package_manager
import package_loader
impor... | pgjones/nusoft | nusoft/nusoft.py | Python | mit | 5,313 |
#!/usr/bin/env pypy
# -*- coding: utf-8 -*-
import argparse
import subprocess
import os
import math
import gzip
import tempfile
import urllib
import json
import ssl
__author__ = 'thomasvangurp'
__description__ = "map reads orders of magnitudes faster using STAR"
def parse_args():
"""Pass command line arguments""... | thomasvangurp/epiGBS | mapping_varcall/map_STAR.py | Python | mit | 27,043 |
#! usr/bin/python3
# -*- coding: utf8 -*-
#
# Flicket - copyright Paul Bourne: evereux@gmail.com
import datetime
from flask import flash
from flask import g
from flask import redirect
from flask import render_template
from flask import request
from flask import url_for
from flask_babel import gettext
from flask_login... | evereux/flicket | application/flicket_admin/views/view_admin.py | Python | mit | 10,742 |
from .data import DataResource
from .execution import ExecutionResource
from .interface import InterfaceResource
from .exposed import ExposedResource
from .admin import AdminResource
| wehriam/awspider | awspider/resources/__init__.py | Python | mit | 183 |
__all__ = ['ttypes', 'constants', 'SocialCoffeeService']
| iaintshine/social_coffee | client/python/socialcoffee/gen-py/socialcoffee/thrift/__init__.py | Python | mit | 57 |
#! /usr/bin/python
# Joe Deller 2014
# The hello world program with most of the comments removed
# Level : Beginner
# Uses : Libraries
# Add a your own message after hello world
# Don't forget to keep the message inside the speech marks ""
import mcpi.minecraft as minecraft
mc = minecraft.Minecraft.create()
mc.post... | joedeller/pymine | helloworldV2.py | Python | mit | 343 |
#!/usr/bin/env python
#
# Project moved to: https://github.com/itzo/slack-beebot
# This is just kept for historical reasons
#
import websocket
import os
import time
from slackclient import SlackClient
import sqlite3 as db
import sys
import re
channel = '#general'
users = {}
# add timestamp to all print statements
o... | itzo/python | slack/beebot.py | Python | mit | 5,731 |
from ._bigwig import lib, ffi
from collections import namedtuple
import array
Interval = namedtuple('Interval', ['chrom', 'start', 'end', 'value'])
class BigWig(object):
"""
>>> b = BigWig("libBigWig/test/test.bw")
>>> b
BigWig('libBigWig/test/test.bw')
>>> for interval in b("1", 0, 99):
... ... | brentp/bw-python | bw/bw.py | Python | mit | 2,872 |
#!/usr/bin/env python
# Copyright (c) 2006-2009 ActiveState Software Inc.
"""setup script for 'thirtyboxes'"""
from distutils.core import setup
import thirtyboxes
#---- setup mainline
setup(name="thirtyboxes",
version=thirtyboxes.__version__,
description="a Python binding to the 30boxes.com API",
... | trentm/python-thirtyboxes | setup.py | Python | mit | 845 |
import time
from datetime import datetime
from db import DATE_FORMAT
class Preprocessor(object):
pass
class SQLPreprocessor(Preprocessor):
def __init__(self, client, table_name):
self.client = client
self.table_name = table_name
self.meta_data = client.getTableSchema(self.table_name)... | mmqm4544/rta | ml_demo/preprocessing.py | Python | mit | 4,853 |
#!/usr/bin/env python
import numpy as np
class KVec():
"""
define K points in BZ, high symmetry line or uniform grid
"""
def __init__(self, kpt_type='uni', kbase=None, nkpt=None, kvec=None):
self.nkpt = nkpt
self.kbase = np.array(kbase, dtype=np.float64)
self.kvec = np.array(... | shenmidelin/pylibwyl | wanntb/kvec.py | Python | mit | 3,851 |
from marshmallow import fields
from marshmallow.utils import is_iterable_but_not_string
from sqlalchemy import inspect
from sqlalchemy.orm.exc import NoResultFound
def get_primary_keys(model):
"""Get primary key properties for a SQLAlchemy model.
:param model: SQLAlchemy model class
"""
mapper = mod... | marshmallow-code/marshmallow-sqlalchemy | src/marshmallow_sqlalchemy/fields.py | Python | mit | 4,946 |
"""
Implement wildcard pattern matching with support for '?' and '*'.
'?' Matches any single character.
'*' Matches any sequence of characters (including the empty sequence).
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, const char *p)
... | ufjfeng/leetcode-jf-soln | python/044_wildcard_matching.py | Python | mit | 2,678 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-23 10:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0026_auto_20151217_2158'),
]
operations = [
migrations.AlterField(... | I-sektionen/i-portalen | wsgi/iportalen_django/articles/migrations/0027_auto_20151223_1141.py | Python | mit | 908 |
def word_break(adict, astr):
"""Check whether a string can be broken into words from a dictionary
This algorithm is a solution to the word break problem described on the IDeserve link:
http://www.ideserve.co.in/learn/word-break-problem.
The solution is a dynamic programming approach, which is achieve... | nikhilnrng/algorithms-and-data-structures | algorithms/string/word_break.py | Python | mit | 1,329 |
#Python 3.3.5 (v3.3.5:62cf4e77f785, Mar 9 2014, 10:37:12) [MSC v.1600 32 bit (Intel)] on win32
# XML protocol: http://www.w3schools.com/xml/xml_validator.asp
"""
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Choice Co subscriptions in Aol Reader</title>
</head>
<body>
<outline title... | okxy/Downloads | quora url to feedly.py | Python | mit | 9,445 |
# -*- coding: utf-8 -*-
"""Unit tests shim needed for py27 compatibilityfor converters."""
import unittest
import sys
PYTHON_VERSION = sys.version_info[:3]
if (PYTHON_VERSION[0] == 2):
unittest.TestCase.assertCountEqual = unittest.TestCase.assertItemsEqual
| lokal-profil/wikidata-stuff | tests/__init__.py | Python | mit | 263 |
"""
WSGI config for acaidera project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | ladylovelace/acaidera | acaidera/wsgi.py | Python | mit | 394 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | Sorsly/subtle | google-cloud-sdk/lib/googlecloudsdk/command_lib/runtime_config/base_commands.py | Python | mit | 2,127 |
from django.db import models
class Chatroom(models.Model):
name = models.CharField(max_length=20, primary_key=True)
occupants = models.IntegerField(default=0)
def __unicode__(self):
return self.name
class Message(models.Model):
chatroom = models.ForeignKey(Chatroom)
username = models.Ch... | noahklein/unichat | chat/models.py | Python | mit | 496 |
GAME_LENGTH = 1.0 # minutes
SIDE_WIDTH = 25
DISCRETE_BG_RADIUS = 50
STOP_AND_CLICK = True
WORLD = {"width" : 485, "height" : 280}
SIZE= { "x":5, "y":5, "hx":2.5, "hy":2.5 }
POS_LIMITS = {
"x_min": SIZE["hx"],
"x_max": WORLD["width"] - SIZE["hx"],
"y_min": SIZE["hy"],
"y_max": WORLD["height"] - SIZE... | hawkrobe/couzin_replication | analysis/experiment3/helpers/config.py | Python | mit | 409 |
import json
import requests
from linebot.models.line_request import LineRequest
from linebot.models.line_response import LineResponse
class Line():
HOST = "trialbot-api.line.me"
def __init__(self,
channel_id,
channel_secret,
mid,
proxy=""):
... | icoxfog417/TravelPenguinBot | linebot/line.py | Python | mit | 1,537 |
import pytest
from datetime import date
import calendar
from rota.rota_days import RotaDays
@pytest.fixture(scope="module")
def rd():
return RotaDays()
class TestRotaDays(object):
def test_format_weekend(self, rd):
Sunday = date(2017, 1, 1)
expected = 'Saturday 31st December/Sunday 1st Janua... | mikepyne/RotaGenerator | tests/test_rota_days.py | Python | mit | 3,037 |
import time
from . import ModelMixin
from . import db
class Weibo(db.Model, ModelMixin):
__tablename__ = 'todos'
id = db.Column(db.Integer, primary_key=True)
task = db.Column(db.String())
created_time = db.Column(db.Integer)
updated_time = db.Column(db.Integer)
# 这是一个外键
# user_id = db.Col... | caoziyao/weibo | models/weibo.py | Python | mit | 700 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division
from qsrlib_qsrs.qsr_triadic_abstractclass import QSR_Triadic_1t_Abstractclass
import math
class QSR_TPCC(QSR_Triadic_1t_Abstractclass):
""" TPCC QSRs.
.. seealso:: For further details about TPCC, see http://www.sfbtr8.spatial-cognition.de... | cburbridge/strands_qsr_lib | qsr_lib/src/qsrlib_qsrs/qsr_tpcc.py | Python | mit | 2,301 |
# -*- coding: utf-8 -*-
import requests
class HttpClient(object):
def __init__(self, featureswitches):
self._fs = featureswitches
def _auth_headers(self):
return {'Authorization': '{customer_key}:{environment_key}'.format(
customer_key=self._fs.customer_key,
environm... | FeatureSwitches/featureswitches-python | featureswitches/http.py | Python | mit | 987 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Tong He and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
"""
import os
import time
import random
import argparse
import numpy as np
from keras import backend as K
from keras.optimizers import SGD
from config import co... | ThomasYeoLab/CBIG | stable_projects/predict_phenotypes/He2019_KRDNN/cbig/He2019/CBIG_hcp_brainnetcnn.py | Python | mit | 7,049 |
# Copyright (c) 2012 Santosh Philip
# =======================================================================
# Distributed under the MIT License.
# (See accompanying file LICENSE or copy at
# http://opensource.org/licenses/MIT)
# =======================================================================
# along with ... | pachi/eppy | eppy/useful_scripts/idfdiff_missing.py | Python | mit | 6,883 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# ***** BEGIN LICENSE BLOCK *****
# This file is part of Shelter Database.
# Copyright (c) 2016 Luxembourg Institute of Science and Technology.
# All rights reserved.
#
#
#
# ***** END LICENSE BLOCK *****
__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.1 $"
__... | cedricbonhomme/shelter-database | shelter/web/models/attribute.py | Python | mit | 1,873 |
from unittest import TestCase
from numpy import array, longfloat, subtract, matrix
from numpy.testing import assert_array_equal
from serpentTools.data import getFile
from serpentTools.parsers.depmatrix import DepmtxReader, readDepmtx
TEST_FILE = getFile('depmtx_ref.m')
class DepmtxTestHelper(TestCase):
"""Clas... | CORE-GATECH-GROUP/serpent-tools | tests/test_depmtx.py | Python | mit | 13,709 |
"""empty message
Revision ID: 429bb2bba731
Revises: ade926462c03
Create Date: 2017-02-05 12:56:39.822000
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '429bb2bba731'
down_revision = 'ade926462c03'
branch_labels = None
depends_on = None
def upgrade():
# ... | te11ur/twitter_watcher | migrations/versions/429bb2bba731_.py | Python | mit | 664 |
"""
Module for shaped pulse integration:
W.T. Franks FMP Berlin
"""
import de.bruker.nmr.mfw.root as root
from de.bruker.nmr.prsc.dbxml.ParfileLocator import getParfileDirs
import os
import TopCmds
import math
"""
Find wave file in some path
Open the wave file
Load the amplitudes and phases
Sum, then divide by step... | TrentFranks/ssNMR-Topspin-Python | modules/IntShape.py | Python | mit | 1,999 |
import cv2
import sys
import time
import tty
import termios
import threading
import urllib2
def getChar():
fd = sys.stdin.fileno()
oldSettins = termios.tcgetattr(fd)
try:
tty.setraw(fd)
ch = sys.stdin.read(1)
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, oldSettins)
re... | jadarve/roborave_2017 | camera/wanscam.py | Python | mit | 2,496 |
from collections import namedtuple
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
import collections
from rest_framework.utils.serializer_helpers import BindingDict
from mongoengine.base.common import get_document
import mongoengine
from collections import OrderedDict
from rest_... | BryanAke/django-rest-framework-mongoengine | rest_framework_mongoengine/utils.py | Python | mit | 8,828 |
""" KamLAND-Zen Majoron limit setting script
This script sets 90% confidence limit on the Majoron-emitting
neutrinoless double beta decay modes (with spectral indices n = 1, 2, 3
and 7), with KamLAND-Zen.
Examples:
To use simply run the script::
$ python Xe136_majoron_limit.py -s /path/to/majoron_mode.hdf5
... | mjmottram/echidna | echidna/scripts/Xe136_majoron_limit.py | Python | mit | 14,539 |
####################
# Scouts
# Copyright (c) 2014 Troop 613. All rights reserved.
#
# This project is distributed according to the terms of the MIT license [http://www.opensource.org/licenses/MIT].
####################
__author__ = "allyn.treshansky"
__date__ = "Dec 9, 2013 4:13:03 PM"
"""
.. module:: converte... | trubliphone/scouts | src/converter.py | Python | mit | 1,252 |
class Solution:
def carFleet(self, target: int, position: List[int], speed: List[int]) -> int:
time = [(target - p) / s for p, s in sorted(zip(position, speed))]
count = curr = 0
for t in time[::-1]:
if t > curr:
count += 1
curr = t
return ... | jiadaizhao/LeetCode | 0801-0900/0853-Car Fleet/0853-Car Fleet.py | Python | mit | 326 |
# -*- coding: utf-8 -*-
from gensim import corpora, models, similarities
import util
import json
threshold = 0.4
threshold_big = 0.5
def start(news_selected, sounds_selected, sounds, now, file_name, sounds_cluster):
ids, docs, downtimes = zip(*sounds)
ids_sel, docs_sel, downtimes_sel = zip(*sounds_selected)
... | AllanXiang/news-media-promoted | promote.py | Python | mit | 2,704 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""This file is part of the django ERP project.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND ... | django-erp/django-erp | djangoerp/wsgi.py | Python | mit | 2,177 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from celery.task.schedules import crontab
from celery.decorators import periodic_task
from celery.utils.log import get_task_logger
from articles.jianshu import save_latest_jianshu_news
logger = get_task_logger(__name__)
@periodic_task(
run_every=(crontab(minute='*/5'... | yaongli/spadger | src/articles/tasks.py | Python | mit | 561 |
#!/usr/bin/env python3
# ver 0.1 - coding python by Hyuntae Jung on 04/02/2018
import argparse
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description='get 1d profile to find intrinsic interface width by 3D conv. alignment')
## args
parser.add_argument('-i', '--... | jht0664/Utility_python_gromacs | python/massf_conv_align_3d.py | Python | mit | 11,557 |
#
# This file is part of the PyMeasure package.
#
# Copyright (c) 2013-2021 PyMeasure Developers
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limit... | ralph-group/pymeasure | pymeasure/instruments/anritsu/anritsuMG3692C.py | Python | mit | 2,718 |
import sys
class Instances(object):
def __init__(self):
self._instances = {}
def register(self, name, instance):
if name not in self._instances:
self._instances[name] = instance
def __getattr__(self, item):
return self._instances[item]
sys.modules[__name__] = Instanc... | JoshuaSkelly/lunch-break-rl | instances.py | Python | mit | 325 |
from lib.plugins import Inspector
from io import StringIO
from fnmatch import fnmatch
from lib.util import ByteSize, parsers
"""
Description:
Gets network interface traffic statistics
Constructor:
- match: Wildcard match for interface name (Default: None)
- hideEmpty: Hide interfaces
Metrics:
"""
class Network(Ins... | zix99/sshsysmon | sshsysmon/inspectors/network.py | Python | mit | 2,327 |
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
def abs_sobel_thresh(img, orient='x', sobel_kernel=3, thresh=(0, 255)):
# Convert to grayscale
gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
# Apply x or y gradient with the OpenCV Sobel() function
# and take... | mlandry1/CarND | Labs/Term1/Advanced Lane Finding Section 24/gradient.py | Python | mit | 3,330 |
#!/usr/bin/env python
"""
Make randomly deformed POSCAR files from the non-deformed POSCAR file.
Usage:
make_random_deform_POSCARs.py [options] POSCAR
Options:
-h, --help Show this help message and exit.
-n NUM Number of output POSCARs to be created. [default: 100]
--deform-range=DEFORM_RANGE
... | ryokbys/nap | nappy/vasp/make_random_deform_POSCARs.py | Python | mit | 3,825 |
'''
IW module
=========
Experimental wireless module -- nl80211 support.
In the very initial state.
'''
from pyroute2.netlink import NLM_F_REQUEST
from pyroute2.netlink import NLM_F_DUMP
from pyroute2.netlink.nl80211 import NL80211
from pyroute2.netlink.nl80211 import nl80211cmd
from pyroute2.netlink.nl80211 import N... | alexliyu/CDMSYSTEM | pyroute2/iwutil.py | Python | mit | 4,030 |
# !/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2012-2015 Christian Schwarz
#
# 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 limitat... | T-002/pycast | pycast/errors/baseerrormeasure.py | Python | mit | 12,364 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#Usage: python DTMF.py SomeSound.wav
#currently only tested with 16bit wav files that were sampled at 44.1kHz
#You might want to convert this file http://upload.wikimedia.org/wikipedia/commons/b/b4/DTMF_all_16.ogg to a 16bit wav file with a sample rate of 44.1kHz to test deco... | elvith-de/Geocaching-Tools | DTMF.py | Python | mit | 9,905 |
#!/usr/bin/env python
# coding:utf8
from __future__ import print_function
import sys
class colors:
''' Class used to set console colors '''
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
@classmethod
def disable... | largeriver/utils | neighbour.py | Python | mit | 1,054 |
"""
Views for zachsite app.
"""
from django.shortcuts import render
from django.views.decorators.http import require_http_methods
from projects.models import Project
from .models import QuestionAndAnswer
@require_http_methods(["GET"])
def index(request):
"""
Zach-Site home page.
"""
question_answer_l... | zachsnyder1/zachsite | zachsite/views.py | Python | mit | 652 |
from django import template
from django.template.loader import render_to_string
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.shortcuts import get_current_site
from django.utils.encoding import smart_text
import django_comments
register = templat... | steventimberman/masterDebater | venv/lib/python2.7/site-packages/django_comments/templatetags/comments.py | Python | mit | 12,167 |
#!/usr/bin/env python3
import pytest, time
from cozify import hub
from cozify.test import debug
from cozify.test.fixtures import live_hub, tmp_hub, tmp_cloud, online_device
from cozify.Error import APIError
# global timer delay for tests that change device state
delay = 2
@pytest.mark.logic
def test_hub_devices_fil... | Artanicus/python-cozify | cozify/test/test_hub_devices.py | Python | mit | 4,352 |
import unittest
import os, os.path, sys
from common.instruments import InstrumentUtils
from lib import calc_pos, crutils
from tests import utils
__location__ = os.path.realpath(
os.path.join(os.getcwd(), sys.argv[0]))
class TestCalcPosMethods(unittest.TestCase):
test_images = utils.test_images
def tes... | germanschnyder/cosmicrays | tests/test_calc_pos.py | Python | mit | 1,374 |
import os
import opensim
opensim.Body('block', 0.0001 , opensim.Vec3(0), opensim.Inertia(1,1,.0001,0,0,0) );
opensim.Body('block', 0.0001 , opensim.Vec3(0), opensim.Inertia(1,1,.0001,0,0,0) );
model_path = os.path.join(os.path.dirname(__file__), '../osim/models/gait9dof18musc.osim')
def test(model_path, visualize):
... | stanfordnmbl/osim-rl | tests/test.segfault.py | Python | mit | 1,435 |
def package_name(argv):
return argv[0].split('/')[-1].split('.')[0]
def pid_arg(package_name):
return '--pid-file=%s.pid' % package_name
def config_uri(package_name):
return '%s.ini' % package_name
| vahana/prf | prf/scripts/common.py | Python | mit | 214 |
#!/usr/bin/env python3
#!/usr/bin/python
def get_value(s):
if s == "true":
return True
if s == "false":
return False
try:
return int(s)
except ValueError:
pass
try:
return float(s)
except ValueError:
pass
return s
def main():
str1 = '1'... | jtraver/dev | python3/type/type2.py | Python | mit | 1,059 |
# Copyright (C) 2011 by Ondrej Martinak <omartinak@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, mo... | omartinak/fishtank | src/timer.py | Python | mit | 1,396 |
#
# rednaskela.tests.entities.test_account
#
# REDNASKELA: The Mobile Mini-RTS
#
# The MIT License (MIT)
#
# Copyright (c) 2013 Christian A. Sueiras
#
# 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... | csueiras/rednaskela | rednaskela/tests/entities/test_account.py | Python | mit | 3,579 |
"""Scale peak-normalize FHD maps to integral-normalize maps with
scaling factor from PSF fitting"""
import argparse
from multiprocessing import Pool, Manager
import numpy as np
from astropy.io import fits
import opstats.utils.settings as s
_mgr = Manager()
_config = _mgr.Namespace()
_config.freq = s.MWA.FREQ_EOR_ALL... | piyanatk/sim | scripts/archive/scale_maps.py | Python | mit | 1,606 |
import argparse
from eval_classification import ANETclassification
def getscore(ground_truth_filename, prediction_filename,
subset='validation', verbose=True, check_status=True):
anet_classification = ANETclassification(ground_truth_filename,
prediction_filena... | gurkirt/actNet-inAct | Evaluation/get_classification_performance.py | Python | mit | 1,613 |
import pybullet as p
import time
import math
cid = p.connect(p.SHARED_MEMORY)
if (cid < 0):
p.connect(p.GUI, options="--minGraphicsUpdateTimeMs=16000")
p.setPhysicsEngineParameter(numSolverIterations=4, minimumSolverIslandSize=1024)
p.setTimeStep(1. / 120.)
logId = p.startStateLogging(p.STATE_LOGGING_PROFILE_TIMING... | MTASZTAKI/ApertusVR | plugins/physics/bulletPhysics/3rdParty/bullet3/examples/pybullet/examples/createMultiBodyBatch.py | Python | mit | 5,499 |
# -*- coding: utf-8 -*-
# @Time : 2017/7/12 下午1:35
# @Author : play4fun
# @File : 图像模糊-平均.py
# @Software: PyCharm
"""
图像模糊-平均.py:
是由一个归一化卷积框完成的。他只是用卷积框 盖区域所有像素的平 均值来代替中心元素。可以使用函数 cv2.blur() 和 cv2.boxFilter() 来完 个任务。
"""
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('../... | makelove/OpenCV-Python-Tutorial | ch16-图像平衡/图像模糊-平均.py | Python | mit | 2,754 |
# -*- coding: utf-8 -*-
'''
Created on Wed Mar 2 10:56:34 2016
@author: jmjj (Jari Juopperi, jmjj@juopperi.org)
'''
import sys
import os
import argparse
import mailbox
import json
import tempfile
def parse_cmd_line_args(arg_str: str='') -> argparse.Namespace:
'''
Parse the command line arguments
... | jmjj/messages2json | messages2json/main.py | Python | mit | 7,657 |
import os
import pytest
os.environ["TEST"] = 'True'
from app import TornadoApp # pylint: disable=wrong-import-position
application = TornadoApp()
@pytest.fixture
def app():
return application
@pytest.mark.gen_test
def test_home_status(http_client, base_url):
response = yield http_client.fetch(base_url)
... | jwnwilson/noelwilson_2017 | server/tests/test_handlers.py | Python | mit | 352 |
from blog import app
import logging
file_path = app.config['LOG_FILE_PATH']
log_format = app.config['LOG_FORMAT']
formatter = logging.Formatter(log_format)
fh = logging.FileHandler(file_path)
fh.setLevel(logging.DEBUG)
fh.setFormatter(formatter)
ch = logging.StreamHandler()
ch.setLevel(logging.ERROR)
ch.setFormatte... | FelixLoether/blog-project | blog/logger.py | Python | mit | 421 |
#!/usr/bin/env python
"""Launches a simulation campaign and save results.
"""
import sys
import os
import signal
import functools
import logging
import multiprocessing as mp
from icarus.util import Settings, config_logging
from icarus.registry import RESULTS_WRITER
from icarus.orchestration import Orchestrator
__all... | FilWisher/distributed-project | icarus/icarus/run.py | Python | mit | 3,863 |
"""Serve files directly from the ContentsManager."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import mimetypes
import json
import base64
from tornado import web
from notebook.base.handlers import IPythonHandler
class FilesHandler(IPythonHandler)... | bdh1011/wau | venv/lib/python2.7/site-packages/notebook/files/handlers.py | Python | mit | 1,626 |
"""
from django.conf.urls import include, url
import views
from organizations.backends import invitation_backend
from organizations.urls import urlpatterns
# Extends organizations.urls.urlpatterns
urlpatterns += [
url(r'^invitations/', include(invitation_backend().get_urls())),
]
"""
from django.conf.urls impor... | cloudartisan/dojomaster | apps/clubs/urls.py | Python | mit | 752 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""Vista principal del programa.
Aqui es donde se pondrán los menus de la aplicación junto con los botones,
necesarios para que funcione la primera vista de la aplicación.
"""
try:
from Tkinter import ttk
except ImportError:
from tkinter import ttk
from src.view_app.vi... | elsudano/skeleton_python | src/view_app/views.py | Python | mit | 3,604 |
#!/usr/bin/env python3.4
# -*- coding: utf-8 -*-
# Requires: py -3.4 -m pip install livestreamer PyQt5
# Execute with: py -3.4 build_with_py2exe.py py2exe
import os.path, site
MY_SITE_PACKAGES = site.getsitepackages().pop()
from distutils.core import setup
import py2exe
setup(
windows = [{
"script": "livestream... | usssentinel/livestreamer_gui | build_with_py2exe.py | Python | mit | 976 |
# -*- coding: utf-8 -*-
"""
Test Suite for database constraints.
The tests will always run on SQLite, provided the sqlite3 python
module is available, which it will be on Mac, but won't necessarily
be on Linux or Windows).
The tests will run on Postgres and MySQL, provided that:
- the appropriate python modiles (p... | tdda/tdda | tdda/constraints/db/testdbconstraints.py | Python | mit | 13,836 |
import _plotly_utils.basevalidators
class UpperfencesrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="upperfencesrc", parent_name="box", **kwargs):
super(UpperfencesrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,... | plotly/plotly.py | packages/python/plotly/plotly/validators/box/_upperfencesrc.py | Python | mit | 407 |
# -*- coding: utf-8 -*-
import re
import cx_Oracle
def oracle_qualified_dsn(oracle_dsn):
"""Return a qualified orcale DSN for SQLALCHEMY; return str"""
cred, service = oracle_dsn.rsplit('@', 1)
host, port, db = re.split("[@/:]+", service)
oracle_dsn = cx_Oracle.makedsn(host, port, db)
oracle_dsn ... | ashwoods/lustro | lustro/utils.py | Python | mit | 1,129 |
# -*- coding: utf-8 -*-
from PyQt4 import QtGui, QtCore
from core import map
import gui.form.entitydialog
from core.localisation import _
class formNpcDialog(gui.form.entitydialog.entityDialog):
"""
Window to fill some informations to create a NPC
label npc name npc name field
label npc species npc specie... | rrpg/world-editor | gui/form/npcdialog.py | Python | mit | 3,119 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Project.background_image'
db.add_column(u'core_project', 'background_image',
... | ngageoint/gamification-server | gamification/core/migrations/0005_auto__add_field_project_background_image.py | Python | mit | 9,795 |