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 |
|---|---|---|---|---|---|
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django_comment_common.models import Role
from django.contrib.auth.models import User
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--remove',
ac... | louyihua/edx-platform | lms/djangoapps/django_comment_client/management/commands/assign_role.py | Python | agpl-3.0 | 1,144 |
"""IETF usage guidelines plugin
See RFC 8407
"""
import optparse
import sys
import re
from pyang import plugin
from pyang import statements
from pyang import error
from pyang.error import err_add
from pyang.plugins import lint
def pyang_plugin_init():
plugin.register_plugin(IETFPlugin())
class IETFPlugin(lint.L... | mbj4668/pyang | pyang/plugins/ietf.py | Python | isc | 7,093 |
# -*- coding: utf-8 -*-
"""
requests.models
~~~~~~~~~~~~~~~
This module contains the primary objects that power Requests.
"""
import os
from datetime import datetime
from .hooks import dispatch_hook, HOOKS
from .structures import CaseInsensitiveDict
from .status_codes import codes
from .auth import HTTPBasicAuth, ... | msabramo/requests | requests/models.py | Python | isc | 27,078 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2020 The Project X-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
import json
from prjxray.segmaker i... | SymbiFlow/prjxray | fuzzers/031-cmt-mmcm/generate.py | Python | isc | 3,572 |
import csv
import tempfile
import os
from transaction import Transaction
class LastTransactionsParser:
LAST_TRANSACTIONS_FILENAME = os.path.join(tempfile.gettempdir(), 'raapija_transactions_last.csv')
@staticmethod
def read():
try:
with open(LastTransactionsParser.LAST_TRANSACTIONS_FILENAME, 'r', e... | 2mv/raapija | last_transactions_parser.py | Python | isc | 884 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''Tests for output functions'''
# Disable cache
import os
try:
os.environ.pop('LIBROSA_CACHE_DIR')
except:
pass
import librosa
import numpy as np
import tempfile
from nose.tools import raises, eq_
def test_write_wav():
def __test(mono, norm):
y,... | craffel/librosa | tests/test_output.py | Python | isc | 3,760 |
import _plotly_utils.basevalidators
class NamelengthsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self,
plotly_name="namelengthsrc",
parent_name="histogram2dcontour.hoverlabel",
**kwargs
):
super(NamelengthsrcValidator, self).__init__(
... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram2dcontour/hoverlabel/_namelengthsrc.py | Python | mit | 471 |
import unittest
import os
import numpy as np
from dotenv import load_dotenv
import nlpaug.augmenter.audio as naa
from nlpaug.util import AudioLoader
class TestMask(unittest.TestCase):
@classmethod
def setUpClass(cls):
env_config_path = os.path.abspath(os.path.join(
os.path.dirname(__file_... | makcedward/nlpaug | test/augmenter/audio/test_mask.py | Python | mit | 1,503 |
from setuptools import setup, find_packages
with open('README.md', 'r') as f:
long_description = f.read()
setup(
name = 'github-pr-form',
version = '0.1.1',
author = 'Aaron N Browne',
author_email = 'aaron0browne@gmail.com',
url = 'https://github.com/aaron0browne/github-pr-form',
descripti... | aaron0browne/github-pr-form | setup.py | Python | mit | 1,355 |
'''
Created by auto_sdk on 2015.11.10
'''
from top.api.base import RestApi
class TradePostageUpdateRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.post_fee = None
self.tid = None
def getapiname(self):
return 'taobao.trade.postage.up... | colaftc/webtool | top/api/rest/TradePostageUpdateRequest.py | Python | mit | 327 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from imp import load_source
import sys
setup(
name='vcfx',
version=load_source('', 'vcfx/__version__.py').__version__,
description='A Python 3 Vcard parser.',
author='Cassidy Bridges',
author_email='cassidybri... | Pholey/vcfx | setup.py | Python | mit | 531 |
from unittest import TestCase
from unittest.mock import patch, call, MagicMock
from django.test import RequestFactory
from learn.infrastructure.database import Database
from learn.views.wrong_answer import exercise_wrong_answer
class ExerciseWrongAnswerTests(TestCase):
@patch("learn.views.wrong_answer.render")
... | Aigrefin/py3learn | learn/tests/tests_views/tests_exercise_wrong_answer.py | Python | mit | 943 |
import logging
from ._base import Service
from ..domain import Template
log = logging.getLogger(__name__)
class TemplateService(Service):
def __init__(self, template_store, **kwargs):
super().__init__(**kwargs)
self.template_store = template_store
def all(self):
"""Get all templat... | CptSpaceToaster/memegen | memegen/services/template.py | Python | mit | 1,885 |
from setuptools import setup
setup(
name = 'pykiwoom',
version = '0.0.2',
description = 'python module for Kiwoom Open API+',
url = 'https://github.com/pystockhub/pykiwoom',
author = 'brayden.jo',
author_email = 'pystock@outlook.com',
license ... | pystockhub/pykiwoom | setup.py | Python | mit | 401 |
from django import template
register = template.Library()
@register.inclusion_tag(file_name='bootstrap_messages.html')
def bootstrap_messages(messages, icon_remove_class=None):
"""
Render django.contrib.messages messages as bootstrap alert blocks.
Display only info, success, error and warning level messa... | OlegPshenichniy/upfavor-mezzanine | bootstrap_helpers/templatetags/bootstrap_messages.py | Python | mit | 684 |
import random
def Random(n, a, b):
# generates a vector of length n with values randomly distributed from 'a' to 'b'
x = []
for i in range(0, n):
num = a + (b-a)*random.random()
x.append(num)
return x
| Harshs27/Q-Classifier | python/gen_rand_vector.py | Python | mit | 233 |
from click.testing import CliRunner
from furrytrain.nettoips import main
def test_main():
cases = [(' 10.234.10.0/30 ',
'10.234.10.0\n10.234.10.1\n10.234.10.2\n10.234.10.3\n'),
('1000.234.10.0/30',
'error: 1000.234.10.0/30\n'),
('1000.234.10.0/30 ',
... | sozforex/furry-train | tests/test_nettoips.py | Python | mit | 1,059 |
from django.shortcuts import redirect
from django.shortcuts import render
from django.views.decorators.gzip import gzip_page
from events.models import Event
@gzip_page
def home(request):
'''
View for the Events home page
'''
template = 'events/home.html'
events = Event.objects.all().order_by('sta... | compsoc-ssc/compsocssc | events/views.py | Python | mit | 425 |
#!/usr/bin/env python
'''
Generate the main window for the pi-gui program. The interface show the last played
item with cover, title and supllemental informations that is interactive
and two buttons for show up the library screen and exit the porgram itself.
'''
#@author: Philipp Sehnert
#@contact: philipp.sehnert[a... | psikon/pitft-scripts | src/mainscreen.py | Python | mit | 2,347 |
"""
Smoke testing--just see if the system runs.
"""
# These tests are quick and crude.
# TODO: extend the tests by cycling through various combinations
# of configuration and data input.
from __future__ import (absolute_import, division, print_function)
import numpy as np
from utide import ut_constants
from ... | efiring/UTide | tests/test_solve.py | Python | mit | 5,010 |
"""FLOW-BUS protocol for Bronkhorst instruments.
The protocol is described in the instruction manual number 9.17.027.
The implementation uses the `Construct library <http://construct.readthedocs.org/en/latest/>`__.
"""
from binascii import unhexlify
import unittest
from construct import *
header = Struct("header",... | Synss/pyhard2 | pyhard2/driver/_bronkhorst.py | Python | mit | 7,674 |
"""This module includes utilities to store and retrieve dallinger
configuration for the command line in the current user directory.
"""
from pathlib import Path
from typing import Dict
import json
from dallinger.command_line import appdirs
APPDIRS = appdirs.AppDirs("dallinger", "dallinger")
def get_configured_host... | Dallinger/Dallinger | dallinger/command_line/config.py | Python | mit | 1,173 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('project_admin', '0020_project_fiscal_year'),
]
operations = [
migrations.AddField(
... | luiscberrocal/homeworkpal | homeworkpal_project/project_admin/migrations/0021_projectgoal_fiscal_year.py | Python | mit | 568 |
'''
Created on Oct 4, 2016
@author: pjmartin (but mostly the Google TF tutorial site)
'''
import tensorflow as tf
# variable declaration helper functions
# Make the weight variables be a little noisy around 0.0.
def weight_variable(shape, var_name):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variabl... | drpjm/udacity-mle-project5 | src/tfhelpers.py | Python | mit | 2,195 |
import os
import logging
import requests
import json
from hotels.models import FBUser
class FB(object):
"""
Create Facebook Responses
"""
def __init__ (self, body):
logging.basicConfig(level=logging.INFO)
self.logger = logging.getLogger("Facebook")
self.body = body
self... | screwgoth/JugheadBot | hotels/fb.py | Python | mit | 7,670 |
import os
import django
from secret_key import *
# calculated paths for django and the site
# used as starting points for various other paths
DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__))
# project root is same as current directory when being called from manage.py
PROJECT_ROOT = os.path.abspath('./'... | cslansing/shaft | shaft/settings/base.py | Python | mit | 4,489 |
#pragma error
#pragma repy
removefile("this.file.does.not.exist") # should fail (FNF)
| sburnett/seattle | repy/tests/ut_repytests_testremovefilefnf.py | Python | mit | 88 |
"""Barrier reply message tests."""
from pyof.v0x01.controller2switch.barrier_reply import BarrierReply
from tests.test_struct import TestStruct
class TestBarrierReply(TestStruct):
"""Barrier reply message tests (also those in :class:`.TestDump`)."""
@classmethod
def setUpClass(cls):
"""Configure ... | cemsbr/python-openflow | tests/v0x01/test_controller2switch/test_barrier_reply.py | Python | mit | 562 |
import mpi4py
import numpy
import chainer
import chainer.backends
import chainer.utils
from chainer.utils import collections_abc
from chainermn.communicators import _communication_utility
from chainermn.communicators._communication_utility import chunked_bcast_obj
from chainermn.communicators import _memory_utility
fr... | okuta/chainer | chainermn/communicators/mpi_communicator_base.py | Python | mit | 26,362 |
#Schedule-generator for LHL use written by Acebulf (acebulf at gmail.com)
#Current version 1.0 -- Jan 16 2014
#Copyrighted under the MIT License (see License included in the github repo)
import random
import time
while 1:
print "Starting random-schedule generation process..."
starttime = time.time()
kill ... | Acebulf/HockeyPythonScripts | schedule.py | Python | mit | 3,298 |
import logging
import os
import re
import sys
import time
import warnings
import ConfigParser
import StringIO
import nose.case
from nose.plugins import Plugin
from sqlalchemy import util, log as sqla_log
from sqlalchemy.test import testing, config, requires
from sqlalchemy.test.config import (
_create_testing_eng... | obeattie/sqlalchemy | lib/sqlalchemy/test/noseplugin.py | Python | mit | 6,603 |
'''
Master App, testing for master controller
'''
# -*- encoding: utf-8 -*-
# file: MasterApp.py
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import MAIN_DISPATCHER
from ryu.controller.handler import HANDSHAKE_DISPATCHER
from ryu.controller.handler import CONFIG_DIS... | TakeshiTseng/SDN-Work | MultiControl/ms/MasterApp.py | Python | mit | 3,607 |
'''
-------------------------------
Strassens Matrix Multiplication
-------------------------------
Performs matrix multiplication in sub-cubic time, performing only 7 recursive calls
rather than the 8 required by standard multiplication.
The function assumes 2 square matrices that have height/width that is a power o... | codebox/algorithms | strassens_matrix_multiplication.py | Python | mit | 1,704 |
"""
WSGI config for SimpleNote 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.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "SimpleNote.settings")
from django.... | MaximeRaynal/SimpleNote | src/SimpleNote/wsgi.py | Python | mit | 395 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='PhotoFUSE',
version='1.0',
description="PhotoFUSE: Show photos based on ratings and tags",
author='Tim Freund',
author_email='tim@freunds.net',
license = 'MIT License',
url='http://github.com/timfreund/photofu... | timfreund/PhotoFUSE | setup.py | Python | mit | 588 |
# #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
# carusel.py – Моделирование кассы в случае нестационарного потока покупателей
**Постановка проблемы**
Время Интенсивность, Количество покупок Относительная частота Суммарная частота
чел/10 мин
9:00 - 11:00 2 (... | vpv11110000/pyss | examples/carusel/carusel.py | Python | mit | 12,857 |
#! /usr/bin/python3
import sys
import argparse
import itertools
from PIL import Image
if __name__ == '__main__':
argparser = argparse.ArgumentParser()
argparser.add_argument('input')
argparser.add_argument('palette',type=argparse.FileType('wb'))
argparser.add_argument('pattern',type=argparse.FileType(... | DrKylstein/gfxtools | nesimage.py | Python | mit | 5,828 |
import sys
__author__ = "ilausuch"
__date__ = "$13-jun-2017 20:05:19$"
sys.path.append( "../Addons" )
from Client import Client
from Timer import Timer
count=1000
def test1():
print ("Test 1: Multiple entry set same connection (count={0})".format(count))
client = Client("localhost", 10001)
t... | ilausuch/CacheServer | src/test/testServer_speed.py | Python | mit | 1,247 |
# -*- Python -*-
#
# Jiao Lin <jiao.lin@gmail.com>
#
plots_table = """
exp exp-sqe.h5
sim-singlephonon sp-sqe.h5
sim-multiphonon mp-sqe.h5
sim-multiple-scattering ms-sqe.h5
sim-correction sqe_correction.h5
exp-corrected-single-phonon corrected_sqe.h5
sim-total-inel total-inel-sqe.h5
exp-residual residual-sqe.h5
"""
p... | sns-chops/multiphonon | multiphonon/backward/_sqe2dos_script_templates.py | Python | mit | 1,493 |
from django.contrib.auth.models import User, Group
from rest_framework import serializers
from chat.models import Chat, Message
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('id', 'username')
class ChatSerializer(serializers.ModelSerializer):
... | Venskiy/chat | restapi/serializers.py | Python | mit | 1,638 |
import subprocess
from importlib import import_module
import os
import dolfin
import nanopores
from nanopores.tools.utilities import Log
#FIXME: deprecated because of license conflict -> import from dolfin
#from nanopores.meshconvert import convert2xml
MESHDIR = "/tmp/nanopores"
def geofile2geo(code, meta, name=None, ... | mitschabaude/nanopores | nanopores/geo2xml.py | Python | mit | 6,483 |
# -*- coding: utf-8 -*-
from flask.ext.wtf import Form
#from wtforms import Form
from wtforms import Field, StringField, DecimalField, SubmitField, BooleanField, FormField, validators, IntegerField, TextField, RadioField, SelectField, HiddenField, ValidationError
from wtforms.validators import InputRequired, Required,... | Tsukasa85/test | app/main/forms.py | Python | mit | 5,554 |
# coding:utf-8
import os
from db.MysqlHelper import MySqlConnection
from common.JsonHelper import loadJsonConfig
MYSQLCONNECTION = None
def initMysql():
global MYSQLCONNECTION
config = loadJsonConfig(os.path.abspath(os.path.join(os.getcwd(), "../config/db.json")))
MYSQLCONNECTION = MySqlConnection(confi... | zwffff2015/stock | db/MysqlUtil.py | Python | mit | 850 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def add_honeypot(apps, schema_editor):
Destination = apps.get_model("notify", "Destination")
try:
obj = Destination.objects.get(name="honeypot")
except Destination.DoesNotExist:
obj = Destinat... | andreasf/django-notify | notify/migrations/0002_add_honeypot.py | Python | mit | 553 |
#!/usr/bin/python
# Google Spreadsheet DHT Sensor Data-logging Example
# Depends on the 'gspread' and 'oauth2client' package being installed. If you
# have pip installed execute:
# sudo pip install gspread oauth2client
# Also it's _very important_ on the Raspberry Pi to install the python-openssl
# package becau... | mh03r932/raspi2dht11 | examples/google_spreadsheet_twosens.py | Python | mit | 6,208 |
import os
import os.path
import tempfile
import shutil
import unittest
from beets import config
from beets.library import Item, Album, Library
from beetsplug.importfeeds import ImportFeedsPlugin
class ImportfeedsTestTest(unittest.TestCase):
def setUp(self):
config.clear()
config.read(user=False)... | beetbox/beets | test/test_importfeeds.py | Python | mit | 2,123 |
from __future__ import absolute_import, division, generators, print_function
import ast
from ast import PyCF_ONLY_AST as _AST_FLAG
from bisect import bisect_right
import linecache
import sys
import six
import inspect
import tokenize
import py
cpy_compile = compile
class Source(object):
""" a immutable object ho... | tareqalayan/pytest | _pytest/_code/source.py | Python | mit | 14,033 |
def test_help_message(testdir):
result = testdir.runpytest(
'--help',
)
result.stdout.fnmatch_lines([
'pytest-random-order options:',
'*--random-order-bucket={global,package,module,class,parent,grandparent,none}*',
'*--random-order-seed=*',
])
def test_markers_message(t... | jbasko/pytest-random-order | tests/test_cli.py | Python | mit | 503 |
#!/usr/bin/env python
from setuptools import setup, find_packages
with open('README.rst') as file:
long_description = file.read()
setup(name='multivol',
version='1.0',
description=('Multivariate (co)variance'),
long_description=long_description,
author='Stanislav Khrapov',
license=... | khrapovs/multivol | setup.py | Python | mit | 1,004 |
#!/usr/bin/env python3
from datetime import date
import math
import numpy as np
import sys
today = date(2015, 11, 20)
expiry = date(2017, 1, 20)
#Global inputs
s = 138.65
k = 133
t = (expiry - today).days / 365
r = 0.0106161830925
sig = 0.22545538993
div = .027000
def tree(steps, flavor):
Dt = t / steps
r_D... | mishka28/NYU-Python | intro-programming/final_project/binomial_tree.py | Python | mit | 1,850 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.8.3.
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 paths... | williamHuang5468/QuicklyLearnDjango | mysite/mysite/settings.py | Python | mit | 2,686 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-21 11:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('collection', '0001_initial'),
]
operations = [
migrations.AddField(
... | Rawtechio/oscar | oscar/collection/migrations/0002_missed_notes.py | Python | mit | 436 |
#coding:utf-8
#################################
#Copyright(c) 2014 dtysky
#################################
import G2R,os
class MovieDefine(G2R.DefineSyntax):
def Creat(self,Flag,US,FS,DictHash):
DictHash=G2R.DefineSyntax.Creat(self,Flag,US,FS,DictHash)
if DictHash[Flag]==G2R.DHash(US.Args[Flag]):
return DictH... | dtysky/Gal2Renpy | Gal2Renpy/DefineSyntax/MovieDefine.py | Python | mit | 678 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sentinel.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| MikaelSchultz/dofiloop-sentinel | sentinel/manage.py | Python | mit | 257 |
"""Tests for Deque."""
import pytest
@pytest.fixture()
def empty_deque():
"""Build a sample deque for testing."""
from deque import Deque
empty_deque = Deque()
return empty_deque
@pytest.fixture()
def full_deque():
"""Build a sample deque for testing."""
from deque import Deque
full_deq... | julienawilson/data-structures | src/test_deque.py | Python | mit | 2,665 |
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.mail import Mail
from flask.ext.moment import Moment
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from config import config
bootstrap = Bootstrap()
mail = Mail()
moment = Moment()
db = SQLAlchemy()
... | sb2gh/flask_login_1 | app/__init__.py | Python | mit | 988 |
import scipy.io as sio
import numpy as np
import pandas as pd
from tqdm import tqdm
import argparse
def main():
parser = argparse.ArgumentParser(description='RNN for modeling neuron populations')
parser.add_argument('infile', metavar='infile', type=str,
help='Input data file path')
... | elijahc/ml_v1 | load_data.py | Python | mit | 4,089 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# 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 with... | sampathweb/game-server | pybot_game_autobahn.py | Python | mit | 5,481 |
import sys
from twisted.internet.defer import Deferred
def got_poem(poem):
print poem
from twisted.internet import reactor
reactor.stop()
def poem_failed(err):
print >>sys.stderr, 'poem download failed'
print >>sys.stderr, 'I am terribly sorry'
print >>sys.stderr, 'try again later?'
from ... | tidalmelon/twisted-intro | twisted-deferred/defer-8.py | Python | mit | 562 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# pyluxafor documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... | takeontom/pyluxafor | docs/conf.py | Python | mit | 8,401 |
""" pydatastream main module
(c) Vladimir Filimonov, 2013 - 2021
"""
import warnings
import json
import math
from functools import wraps
import requests
import pandas as pd
###############################################################################
_URL = 'https://product.datastream.com/dswsclient/V1/DSServic... | vfilimonov/pydatastream | pydatastream/pydatastream.py | Python | mit | 32,857 |
#!/usr/bin/python
import sys
import lib.ssh_helper as ssh
host = sys.argv[1]
blade = sys.argv[2]
pw = ssh.prompt_password(host)
chan, sess = ssh.get_channel(host, pw)
# Eat the initial welcome text
ssh.get_output(chan)
ssh.run(chan, 'tcpcmdmode -t 3600 -T system:mm[0]')
ssh.run(chan, 'env -T system:blade[' + blade ... | mjcollin/ibm_bladecenter | bc_boot_revert.py | Python | mit | 393 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Robot Lint Rules - Lint rules for Robot Framework data files.
# Copyright (c) 2014, 2015, 2016 Richard Huang <rickypc@users.noreply.github.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gen... | rickypc/dotfiles | .rflint.d/order.py | Python | mit | 3,013 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import division # Standardmäßig float division - Ganzzahldivision kann man explizit mit '//' durchführen
from __future__ import absolute_import
import pygame
from pyecs import *
# from pyecs.components import *
# from components import *
class Process... | xaedes/PyCompuPipe | pycompupipe/components/processing/process_output.py | Python | mit | 525 |
import logging
import winreg
from nativeconfig.configs.base_config import BaseConfig
LOG = logging.getLogger('nativeconfig')
ERROR_NO_MORE_ITEMS = 259
ERROR_NO_MORE_FILES = 18
def traverse_registry_key(key, sub_key):
"""
Traverse registry key and yield one by one.
@raise WindowsError: If key cannot b... | GreatFruitOmsk/nativeconfig | nativeconfig/configs/registry_config.py | Python | mit | 5,235 |
@echo off
rem = """
py25 -x "%~f0"
goto endofPython """
from distutils.core import setup
import py2exe
import shutil
import sys, os
sys.argv += ['py2exe', '-b1', '-d./']
setup(
# use "console = " for console-based apps
windows=["cron.py"],
zipfile=None
)
shutil.rmtree('build')
os.remove('w9xpopen.... | ActiveState/code | recipes/Python/552749_Create_singlefile_executables/recipe-552749.py | Python | mit | 353 |
class Queue:
def __init__(self,values):
self.values = values
def __str__(self):
return str(self.values)
def add(self,value):
self.values = self.values + [value]
def remove(self):
beginningOfQueue = self.values[0]
self.values = self.values[1:]
return be... | alexcasgarcia/CCI | TreesAndGraphs/DFS.py | Python | mit | 2,154 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup, find_packages
except:
from distutils.core import setup, find_packages
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setup(
name='ircb',
version='0.3.0',
description='A IRC bouncer',
... | waartaa/ircb | setup.py | Python | mit | 973 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.datetime_safe
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('topics'... | andychase/codebook | topics/migrations/0015_auto_20151218_1823.py | Python | mit | 1,259 |
# encoding: utf-8
__author__ = "Nils Tobias Schmidt"
__email__ = "schmidt89 at informatik.uni-marburg.de"
'''
Loader exceptions
'''
from androlyze.error.WrapperException import WrapperException
from androlyze.model.android.Constants import MANIFEST_FILENAME
from androlyze.error.AndroLyzeLabError import AndroLyzeLab... | nachtmaar/androlyze | androlyze/loader/exception/__init__.py | Python | mit | 2,440 |
import io
import os
from setuptools import setup, find_packages
def local_file(*name):
return os.path.join(
os.path.dirname(__file__),
*name)
def read(*names, **kwargs):
with io.open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get("encoding", "utf8")
... | abingham/kfg | setup.py | Python | mit | 1,967 |
# -*- coding: utf-8 -*-
from __future__ import (
division, absolute_import, print_function, unicode_literals,
)
from builtins import * # noqa
from future.builtins.disabled import * # noqa
from future.utils import with_metaclass
from abc import ABCMeta
# collections.abc dosn't esist in Python 2.x.... | huntzhan/magic-constraints | magic_constraints/types.py | Python | mit | 15,147 |
import re
# extract all <p> tags
friend17 = friendsoup17.find_all('p')
# remove html tags
friend17clean = []
for i in range(len(friend17)):
friend17clean.append(re.sub('<[^>]+>', '', friend17[i]))
| dnlmc/fp | fp_scrape3.py | Python | mit | 207 |
# setup file necessary to generate the AXUV20 geometry for BP-LY and will
# act as a rosetta stone for generating other detector geometries.
import geometry
import surface
import scipy
# aperature position in RZ coordinates, will be redefined later with CAD work
#
def AXUV20(temp):
diodes = 20*[0]
area = [4e-... | icfaust/TRIPPy | TRIPPy/AXUV.py | Python | mit | 1,093 |
import subprocess
def send_command(*args):
delimiter = '&&'
if len(args) == 2 and delimiter in args[1]:
split_arg = args[1].split(delimiter)
args = [args[1]]
args.extend(split_arg)
process = subprocess.Popen(args, stdout=subprocess.PIPE)
return process.communicate()[0].decode("... | andreipradan/raspberrymediaplayer | src/radio/api/utils.py | Python | mit | 328 |
import ctypes
class MPQFileData(ctypes.Structure):
_fields_ = [
('filename', ctypes.c_char * 1024),
('plainpath', ctypes.c_char_p),
('hashindex', ctypes.c_int, 32),
('blockindex', ctypes.c_int, 32),
('filesize', ctypes.c_int, 32),
('fileflags', ctypes.c_int, 32),
... | srounet/pystormlib | pystormlib/structure.py | Python | mit | 485 |
import pytest
from time import sleep
from autobahn_sync import (
AutobahnSync, ConnectionRefusedError, NotRunningError,
AlreadyRunningError, TransportLost)
from fixtures import crossbar, wamp
class Test(object):
def test_connect(self, crossbar):
wamp = AutobahnSync()
wamp.run()
def... | Scille/autobahn-sync | tests/test_base.py | Python | mit | 1,494 |
"""Added existing tables
Revision ID: f19fc04ba856
Revises:
Create Date: 2017-09-24 03:10:27.208231
"""
from alembic import op
import sqlalchemy as sa
import sys
from pathlib import Path
monocle_dir = str(Path(__file__).resolve().parents[2])
if monocle_dir not in sys.path:
sys.path.append(monocle_dir)
from monoc... | DavisPoGo/Monocle | migrations/versions/f19fc04ba856_added_existing_tables.py | Python | mit | 10,836 |
#coding:utf8
DEBUG = True
try:
import sae
DBNAME = sae.const.MYSQL_DB
USER = sae.const.MYSQL_USER
PASSWD = sae.const.MYSQL_PASS
HOST = sae.const.MYSQL_HOST
PORT = sae.const.MYSQL_PORT
SQLALCHEMY_DATABASE_URI = "mysql://%s:%s@%s:%s/%s" %(USER, PASSWD, HOST, PORT, DBNAME)
except:
SQLALCH... | prikevs/KevBlog | config.py | Python | mit | 437 |
# -*- 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 model 'HoverImagePlugin'
db.create_table('cmsplugin_hoverimageplugin', (
('cmsplugin_pt... | CodeMill/cmsplugin-hoverimage | cmsplugin_hoverimage/migrations/0001_initial.py | Python | mit | 7,784 |
import numpy as np
from Bio import Seq, SeqRecord
alphabet_synonyms = {'nuc':'nuc', 'nucleotide':'nuc', 'aa':'aa', 'aminoacid':'aa',
'nuc_nogap':'nuc_nogap', 'nucleotide_nogap':'nuc_nogap',
'aa_nogap':'aa_nogap', 'aminoacid_nogap':'aa_nogap',
'DNA':'nuc',... | neherlab/treetime | treetime/seq_utils.py | Python | mit | 14,020 |
#Edited 12/3/17 Ben Everest
#Functions used to perform measurements on a trajectory and to save them
import numpy
import QJMCMath
#Performs all the measurements
#TESTED
def measure(index, psi, eResults, eOps, histograms, savingSettings):
#Extracts normalised wavefunctions
psiNormalised = QJMCMath.normalise(psi)
psi... | everestbt/Quantum-Jump-Monte-Carlo-Adaptive-Algorithm | QJMCMeasure.py | Python | mit | 2,869 |
"""
Plot a 3D scatter plot of the alignment scores from alignment_score.py
"""
import os
import random
import sys
import matplotlib.lines
import argparse
import matplotlib.colors
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import pickle
import tkinter as tk
from tkinter import filedialog
... | linsalrob/EdwardsLab | Flinders/plot_scores_3d.py | Python | mit | 1,397 |
# -*- coding: utf-8 -*-
import time, datetime
from lib import i18n
SC_ONCE = _("Once")
SC_WEEKLY = _("Weekly")
SC_MONTHLY = _("Monthly")
def time_from_calendar(calendar):
''' Return a time object representing the date. '''
day = calendar[2]
month = calendar[1] + 1
year = calendar[0]
# Create date... | google-code/billreminder | src/lib/scheduler.py | Python | mit | 2,973 |
# -*- coding: utf-8 -*-
from django import forms
from cmskit.articles.models import Index, Article
from cms.plugin_pool import plugin_pool
from cms.plugins.text.widgets.wymeditor_widget import WYMEditor
from cms.plugins.text.settings import USE_TINYMCE
def get_editor_widget():
"""
Returns the Django form Widg... | ozgurgunes/django-cmskit | cmskit/articles/forms.py | Python | mit | 1,271 |
Plot the forecasted temperatures of Miami in Celsius. You'll need to use the "<a href='#'>create empty list</a>" and "<a href='#'>append</a>" blocks to create a new list of Celsius temperatures from the forecasted temperatures in Blacksburg, and then plot these new temperatures against the old ones.
#####
import weath... | RealTimeWeb/Blockpy-Server | static/programs/temperatures.py | Python | mit | 634 |
from treeseq_funcs import *
| tos-kamiya/pyrem_torq | src/pyrem_torq/treeseq/__init__.py | Python | mit | 29 |
"""
This file is part of the TheLMA (THe Laboratory Management Application) project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Molecule design set library table.
"""
from sqlalchemy import CheckConstraint
from sqlalchemy import Column
from sqlalchemy import Float
from sqlalchemy impo... | helixyte/TheLMA | thelma/repositories/rdb/schema/tables/moleculedesignlibrary.py | Python | mit | 1,817 |
#In this problem you will analyze a profile log taken from a mongoDB instance. To start, please download sysprofile.json
#from Download Handout link and import it with the following command:
#
#mongoimport -d m101 -c profile < sysprofile.json
#Now query the profile data, looking for all queries to the students collect... | baocongchen/M101P-MONGODB-FOR-PYTHON-DEVELOPERS | week4/hw4-4/hw4-4.py | Python | mit | 595 |
import sys
import logging
import urllib
import urllib2
import json
from lxml import etree
class GGeocode():
""" Wrapper for Google Geocode API v3.
https://developers.google.com/maps/documentation/geocoding/
"""
def __init__(self, method='http',
output='json',
sensor='false',
address='',
... | leeclemmer/ggeocode | ggeocode/ggeocode.py | Python | mit | 3,893 |
from croplands_api.models import db
from croplands_api.models.base import BaseModel
from sqlalchemy.exc import IntegrityError
from croplands_api import jwt
import time
import uuid
from croplands_api.exceptions import UserError
from passlib.context import CryptContext
from datetime import datetime
import random
from sql... | justinwp/croplands | croplands_api/models/user.py | Python | mit | 5,797 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/data_lake_store_account_management_client_enums.py | Python | mit | 2,046 |
from LingerManagers.LingerBaseManager import LingerBaseManager
class ActionsManager(LingerBaseManager):
"""ActionsManager loads linger actions,
and manages instances of them according to configuration"""
def __init__(self, configuration):
super(ActionsManager, self).__init__(configuration['... | GreenBlast/Linger | LingerManagers/ActionsManager.py | Python | mit | 908 |
# coding:utf-8
from urllib import parse as url_parse
from logger.log import crawler
from apps.celery_init import celery
from page_get.basic import get_page
from config.conf import get_max_search_page
from page_parse import search as parse_search
from db.search_words import get_search_keywords
from db.keywords_wbdata im... | xtuyaowu/jtyd_python_spider | celery_tasks/weibo/search.py | Python | mit | 2,317 |
#!/usr/bin/env python3
import socket, sys, getopt, os
from signal import signal, pause, SIGINT, SIGTERM, SIG_IGN
from pickle import load, dump
from multiprocessing import Process
from multiprocessing.managers import SyncManager
from lib.server import tcp_server, udp_server, udp_client
from lib.utils import (read_byte... | RafaelPAndrade/LEIC-A-IST | RC/Proj/CS.py | Python | mit | 16,058 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_endpoint_connections_operations.py | Python | mit | 15,435 |
#coding:utf-8
import hashlib, datetime, pdb
from Yep import system_tags, system_schools
MD5PERFIX = "YEPS_WEIMI"
def md5_pwd(pwd):
return hashlib.new("md5", MD5PERFIX + pwd).hexdigest()
# 检查标签是否合法
def check_user_tag(tags):
tag_list = system_tags.tag_list
for tag in tags:
if tag not in tag_list:... | hezuoguang/Yeps-Server | Yeps/Yep/tools.py | Python | mit | 943 |
import json
import os
from django.conf import settings
from django.contrib.auth import get_user_model
from django.test import TestCase
UserModel = get_user_model()
class BaseTestCase(TestCase):
"""Utilidades para todos los tests relacionados con el sitio.
Incluye Fixtures para los modelos, propiedades a lo... | snicoper/snicoper.com | tests/unit/base_test.py | Python | mit | 2,024 |
import unittest
from cripts.services.core import Service, ServiceConfigOption
from cripts.services.forms import (_get_config_fields, make_edit_config_form,
make_run_config_form)
class ServiceWithNoDefaultConfig(Service):
name = "dummy"
version = "1.0"
class ServiceWithDefaultConfig(Service):
nam... | lakiw/cripts | cripts/services/test/forms_test.py | Python | mit | 1,440 |
# -*- coding: utf-8 -*-
# import the necessary packages
from cu_coursecatalog_spider.items import Course, Major, Minor
import scrapy
import json
# Spider used to crawl through the webpage and get info
class SchmidCatalogSpider(scrapy.Spider):
# Name of the spider
name = "schmid-catalog-spider"
# URLs of each scho... | xaviablaza/course-catalog-api | cu_coursecatalog_spider/spiders/schmidcatalogspider.py | Python | mit | 10,386 |