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/env python
# -*- coding: utf-8 -*-
# send mail utf-8 using gmail smtp server /w jpegs
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.Header import Header
from email.Utils import formatdate
import smtplib
def send_email... | karaage0703/denpa-gardening | send_mail.py | Python | mit | 1,390 |
from django.shortcuts import render, redirect
from django.http import HttpResponse
__author__ = 'Nick'
def index(request):
return redirect('/search') | nh0815/PySearch | pysearch/views.py | Python | mit | 154 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def IpPool(vim, *args, **kwargs):
'''Specifications of the network configuration to be us... | xuru/pyvisdk | pyvisdk/do/ip_pool.py | Python | mit | 1,191 |
from __future__ import unicode_literals
from django.db import models
class Weather(models.Model):
time=models.DateTimeField(auto_now_add=True)
nodeid=models.CharField(max_length=3, blank=False)
temp=models.FloatField(default=0.0)
humi=models.FloatField(default=0.0)
israin=models.BooleanField(default=False)
def... | wasit7/tutorials | arduino_python/04_sciweather/sciweather/myapp/models.py | Python | mit | 393 |
# Copyright (c) 2015 Tanium Inc
#
# Generated from console.wsdl version 0.0.1
#
#
from .base import BaseType
class SensorSubcolumnList(BaseType):
_soap_tag = 'subcolumns'
def __init__(self):
BaseType.__init__(
self,
simple_properties={},
complex_properties=... | tanium/pytan | lib/taniumpy/object_types/sensor_subcolumn_list.py | Python | mit | 487 |
from pony.orm import *
from datetime import datetime
db = Database('sqlite', 'players.sqlite', create_db=False)
pony.options.MAX_FETCH_COUNT=50000
class Players(db.Entity):
_table_ = "profile_stats"
id = PrimaryKey(int, auto=True)
last_updated = Required(datetime)
name = Required(unicode, 50)
ser... | AMorporkian/tagprostats | db.py | Python | mit | 6,957 |
# File Transfer model #3
#
# In which the client requests each chunk individually, using
# command pipelining to give us a credit-based flow control.
import os
from threading import Thread
import zmq
from zhelpers import socket_set_hwm, zpipe
CHUNK_SIZE = 250000
def client_thread(ctx, pipe):
dealer = ctx.socke... | soscpd/bee | root/tests/zguide/examples/Python/fileio3.py | Python | mit | 2,555 |
A = int(input())
B = int(input())
SOMA = (A + B)
print("SOMA = %d" %SOMA)
| Eliel-Lopes/Python-URI | 1003.py | Python | mit | 75 |
# Copyright (c) 2015 Vikas Iyengar, iyengar.vikas@gmail.com (http://garage4hackers.com)
# Copyright (c) 2016 Detux Sandbox, http://detux.org
# See the file 'COPYING' for copying permission.
import pexpect
import paramiko
import time
from ConfigParser import ConfigParser
from hashlib import sha256
from magic import Mag... | detuxsandbox/detux | core/sandbox.py | Python | mit | 8,692 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The PlanBcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Utilities for manipulating blocks and transactions."""
from .mininode import *
from .script import CScrip... | planbcoin/planbcoin | test/functional/test_framework/blocktools.py | Python | mit | 3,929 |
'''
Flask-uWSGI-WebSocket
---------------------
High-performance WebSockets for your Flask apps powered by `uWSGI <http://uwsgi-docs.readthedocs.org/en/latest/>`_.
'''
__docformat__ = 'restructuredtext'
__version__ = '0.6.1'
__license__ = 'MIT'
__author__ = 'Zach Kelling'
import sys
from ._async import *
from ._uws... | zeekay/flask-uwsgi-websocket | flask_uwsgi_websocket/__init__.py | Python | mit | 1,032 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2019_07_01/aio/operations/_express_route_circuit_peerings_operations.py | Python | mit | 21,838 |
#!/usr/bin/python
import sys
from PyQt4.QtCore import pyqtSignature, SIGNAL, QSettings, QVariant
from PyQt4.QtGui import (QDialog, QApplication, QSpinBox, QLabel, QPushButton,
QGridLayout, qApp, QIcon)
from calculos import importe
NAME = "Metro Contador"
COMPANY = "metrocontador"
PROGRAM="... | xr09/metrocontador | metrocontador.py | Python | mit | 3,516 |
"""
A nearly direct translation of Andrej's code
https://github.com/karpathy/char-rnn
"""
from __future__ import division
import cgt
from cgt import nn, utils, profiler
import numpy as np, numpy.random as nr
import os.path as osp
import argparse
from time import time
from StringIO import StringIO
from param_collection... | rohanraja/cgt_distributed | examples/char.py | Python | mit | 12,474 |
from . import analyse
from . import generate
from . import params
from . import contact
from . import surface
from . import plot
| plang85/rough_surfaces | rough_surfaces/__init__.py | Python | mit | 129 |
# -*- coding: utf8 -*-
import MapModel as Mm
from MapObjects.MovingObject import MovingObject
import Statistic
class Enemy(MovingObject):
dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]
def __init__(self, health, width, height):
super().__init__()
self.gold = 2
self.able_to_go = {Mm.Player,... | v-samodelkin/TowerDefence | MapObjects/Enemy.py | Python | mit | 2,746 |
#!/usr/bin/env python
# Copyright (c) 2005-2009 Jaroslav Gresula
#
# Distributed under the MIT license (See accompanying file
# LICENSE.txt or copy at http://jagpdf.org/LICENSE.txt)
#
import jagpdf
import jag.testlib as testlib
def test_main(argv=None):
doc = testlib.create_test_doc(argv, 'defaultfont2.pdf')
... | jgresula/jagpdf | code/test/apitest/py/defaultfont2.py | Python | mit | 952 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
# Datetime ############################
dt = datetime.datetime.now()
print(dt)
dt = datetime.datetime(year=2018, month=8, day=30, hour=13, minute=30)
print(dt)
print(dt.isoformat())
# Date ################################
d = datetime.date.today()
pr... | jeremiedecock/snippets | python/datetime_snippets.py | Python | mit | 605 |
import EightPuzzleWithHeuristics as Problem
# puzzle0:
CREATE_INITIAL_STATE = lambda: Problem.State([0, 1, 2, 3, 4, 5, 6, 7, 8]) | vaibhavi-r/CSE-415 | Assignment3/puzzle0.py | Python | mit | 129 |
# encoding: UTF-8
'''
1. 合约选择
Contracts_init.json中写入需要订阅的期货品种,如需要订阅pp和IF,写入
{
"pp": "0",
"IF": "0"
}
2. 主力合约判断
运行程序后,点击‘合约初始化’按钮,程序会获取通联的期货数据,自动判断主力合约。并写入Contracts_init.json中。
注:通联选择的是持仓量判断主力,本程序选择的是昨日成交量判断,两者不同时会给出提示。
3. 合约订阅
4. Tick存储
'''
import json
import os
import pymongo
import tushare as ts
# ts.set_tok... | freeitaly/Trading-System | vn.trader/dataRecorderAlone/DataRecorder -Paolo版本/uiDataRecorder1.py | Python | mit | 13,588 |
# Copyright 2013 John Reese
# Licensed under the MIT license
######################
# Parsing options
######################
# the regex to parse data from irc log filenames.
# must contain two named matching groups:
# channel: the name of the channel
# date: the date of the conversation
filename_regex = r'(?P<ch... | jreese/ircstat | ircstat/defaults.py | Python | mit | 4,274 |
#!/bin/python
import sys
def getSumOfAP(n, max):
size = (max - 1) // n
return (size * (n + size * (n)) / 2)
def getSumOfMultiples(n):
return (getSumOfAP(3, n) + getSumOfAP(5, n) - getSumOfAP(15, n))
def main():
numInputs = int(raw_input().strip())
for idx in xrange(numInputs):
n = int... | pavithranrao/projectEuler | projectEulerPython/problem001.py | Python | mit | 429 |
<<<<<<< HEAD
<<<<<<< HEAD
#!/usr/bin/env python
# Copyright 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for the input.py file."""
import gyp.input
import unittest
import sys
class TestFindCycles(unittest.T... | ArcherSys/ArcherSys | node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input_test.py | Python | mit | 9,761 |
#!/usr/bin/env python2
##
# PyChat
# https://github.com/leosartaj/PyChat.git
#
# Copyright (c) 2014 Sartaj Singh
# Licensed under the MIT license.
##
from distutils import log
from setuptools import setup, find_packages
from PyChat import __version__
try:
from setuptools.command import egg_info
egg_info.writ... | leosartaj/PyChat | setup.py | Python | mit | 2,220 |
#!/usr/bin/env python3
import codecs
from collections import defaultdict
import errno
import json
import os
def tree():
"""
http://recursive-labs.com/blog/2012/05/31/one-line-python-tree-explained/
"""
return defaultdict(tree)
def index_tags():
"""
Iterate through all locally saved JSON fil... | patrickhoefler/secta | app/index_tags.py | Python | mit | 1,940 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-09-24 08:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reservation_system', '0020_auto_20170924_0838'),
]
operations = [
migration... | greenstatic/maas-reservation-system | maas_reservation_system/reservation_system/migrations/0021_auto_20170924_0855.py | Python | mit | 717 |
import logging
from dummy.models import Test
from dummy.utils import git
from dummy.storage import StorageProvider
from dummy import config
logger = logging.getLogger( __name__ )
def discover_targets( args ):
targets = []
if args.alltargets:
for t in config.TARGETS.keys():
targets.append( t )
elif len( args... | ElessarWebb/dummy | src/dummy/utils/argparser.py | Python | mit | 1,745 |
#!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2013 Riverbank Computing Limited.
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
## All rights reserved.
##
## This file is part of the examples of PyQt.
##
## $QT_BEGIN_LICENSE:BSD$
#... | santosfamilyfoundation/SantosGUI | application/custom/videographicsitem.py | Python | mit | 7,446 |
#!/usr/bin/env python
import os
import sys
from swampdragon.swampdragon_server import run_server
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "flat.settings")
host_port = sys.argv[1] if len(sys.argv) > 1 else None
run_server(host_port=host_port)
| bilbeyt/ITURO-Giant_Flat | flat/server.py | Python | mit | 254 |
# Compatible with ranger 1.6.0 through 1.7.*
#
# This plugin adds the new macro %date which is substituted with the current
# date in commands that allow macros. You can test it with the command
# ":shell echo %date; read"
# from __future__ import (absolute_import, division, print_function)
import time
import range... | amerlyq/airy | ranger/plugins/macro_date.py | Python | mit | 866 |
"""Views for the ``event_rsvp`` app."""
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseRedirect
from django.utils import timezone
from django.utils.decorators import method_decorator
from django.views.generic import (
... | bitmazk/django-event-rsvp | event_rsvp/views.py | Python | mit | 8,144 |
import platform
import importlib
from utils.pyx_replace import read_file
name = 'cython._genpyx_' + '_'.join(platform.architecture()) + '_chess0x88'
try:
chess = importlib.import_module(name)
checksum = chess.CHECKSUM
expected_checksum = read_file("chess0x88.py", [], "cython")
if checksum != expected_... | GRUPO-ES2-GJLRT/XADREZ_ES2 | src/cython/importer.py | Python | mit | 665 |
"""
Primary orchestration and control point for Gooey.
"""
import sys
from itertools import chain
import wx
from gooey.gui import events
from gooey.gui.components.header import FrameHeader
from gooey.gui.components.footer import Footer
from gooey.gui.util import wx_util
from gooey.gui.components.config ... | codingsnippets/Gooey | gooey/gui/containers/application.py | Python | mit | 8,890 |
from thumbor.config import Config
Config.define(
'PNGCRUSH_PATH',
'/usr/local/bin/pngcrush',
'Path for the pngcrush binary',
'Optimizers'
)
Config.define(
'OPTIPNG_PATH',
'/usr/bin/optipng',
'Path for the optipng binary',
'Optimizers'
)
Config.define(
'OPTIPNG_LEVEL',
5,
'... | zanui/thumbor-plugins | thumbor_plugins/optimizers/__init__.py | Python | mit | 378 |
'''
Created on 06/apr/2015
@author: luca
'''
import cv2
import numpy as np
import xml.etree.ElementTree as ET
import xml.dom.minidom
STATE_NONE = 0
STATE_DRAW = 1
STATE_DELETE = 2
POINT_RADIUS = 3
POINT_COLOR_CANDIDATE = (0,127,255)
LINE_COLOR_CANDIDATE = (0,127,255)
LINE_THICK_CANDIDATE = 2
LINE_COLOR = (0,192,0)
... | greeneyesproject/testbed-demo | gui/pklot/designer.py | Python | mit | 8,338 |
import unittest
from timemodel.event_sequence import EventSequence
from timemodel.event import Event
from timemodel.position import Position
class TestEventSequence(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_successor(self):
es = EventSequence()... | dpazel/music_rep | tests/timemodel_tests/test_event_sequence.py | Python | mit | 5,287 |
"""Support for building sinan, bootstraping it on a new version of erlang"""
import sys
import os
import commands
from optparse import OptionParser
class BuildError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
ERTS_VERSION = "5.6.3"
BU... | asceth/sinan | support/support.py | Python | mit | 1,629 |
from . import *
from udsoncan.Response import Response
from udsoncan.exceptions import *
import struct
class ReadDataByIdentifier(BaseService):
_sid = 0x22
_use_subfunction = False
supported_negative_response = [ Response.Code.IncorrectMessageLengthOrInvalidFormat,
... | pylessard/python-udsoncan | udsoncan/services/ReadDataByIdentifier.py | Python | mit | 7,003 |
'''
Created on May 4, 2013
@author: Bartosz Alchimowicz
'''
import re
import format.model
def textToItems(project, text, replace = None):
RE_ACTOR = re.compile(r"@(actor):(\w+)")
RE_BUSINESS_OBJECT = re.compile(r"@(bo):(\w+)")
RE_EOUC = re.compile(r"@(eouc)")
RE_GOTO = re.compile(r"@(goto):((\w+.)*\w+)")
def ... | perfidia/afefuc | src/utils/converter.py | Python | mit | 4,135 |
import collections
import calendar
import datetime
import re
import urllib
from lxml.html import fromstring, tostring
import requests
import slugify
from publish.lib.helpers import to_markdown, anchor_to_resource, get_dom, hd
ROOT = "http://www.england.nhs.uk/statistics/statistical-work-areas/winter-daily-sitreps/"
... | nhsengland/publish-o-matic | datasets/nhse_stats/topics/winter.py | Python | mit | 1,729 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class ColorBar(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatterternary.marker"
_path_str = "scatterternary.marker.colorbar"
_valid_props = {
... | plotly/python-api | packages/python/plotly/plotly/graph_objs/scatterternary/marker/_colorbar.py | Python | mit | 69,895 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-03-22 20:10
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('oauth', '0007_org_slug_nonunique'),
]
operations = [
migrations.AddField(
... | rtfd/readthedocs.org | readthedocs/oauth/migrations/0008_add-project-relation.py | Python | mit | 565 |
from lxml import etree
from healthvaultlib.itemtypes.healthrecorditem import HealthRecordItem
from healthvaultlib.utils.xmlutils import XmlUtils
class Height(HealthRecordItem):
def __init__(self, thing_xml=None):
super(Height, self).__init__()
self.type_id = '40750a6a-89b2-455c-bd8d-b420a4cb500b'... | rajeevs1992/pyhealthvault | src/healthvaultlib/itemtypes/height.py | Python | mit | 2,163 |
# -*- coding: utf-8 -*-
"""
"""
import pytest
import mock
from peak.util.imports import lazyModule
from ymir import api
from ymir.data import BadProvisionInstruction
import tests.common as test_common
yservice = lazyModule('ymir.service')
@test_common.mock_aws
def test_load_skeleton_service():
service = api.lo... | mattvonrocketstein/ymir | tests/test_service.py | Python | mit | 1,173 |
#!/usr/bin/env python
#encoding:utf-8
"""
问题描述:
斐波那契数列
实现一个类, 可通过键值访问, 第n个斐波那契数, 也可通过切片方式
访问, 例如
```
fib = Fib()
fib[3] # 2
fib[0:5] #[0, 1, 1, 2, 3]
```
"""
class Fib(object):
def __init__(self):
self._fib = [0, 1]
... | Yannyezixin/offer-interview | solution/9.py | Python | mit | 1,697 |
# -*- coding: utf-8 -*-
TRANSLATED_WEBHOOK_DATA = {"stamp": {"serial": "DEV-STAMP"}, "receipt": "2DJ2fkRJQdGhaLwLjIZL9Zpz/84=", "secure": False, "created": "2014-04-26 14:35:43.543350"}
WEBHOOK_POSTED_DATA = {'data': u'W1syODAsMjgxXSxbMjY3LDExMF0sWzkzLDU3XSxbMjAzLDUxXSxbMTAzLDI5MV1d'}
VALID_VIEW_RESPONSE = {u'serial':... | rosscdh/django-paymill-redux | dj_paymill/tests/__init__.py | Python | mit | 590 |
"""
Django settings for mooctracker project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... | Jaaga/mooc-tracker | web/mooctracker/mooctracker/settings.py | Python | mit | 3,176 |
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.http import Http404
class StaffRequiredMixin(object):
@classmethod
def as_view(self, *args, **kwargs):
view... | jbaek7023/CustomEcommerce | src/products/mixins.py | Python | mit | 1,045 |
"""
Tests for jpmesh.angle.
"""
import unittest
from jpmesh import Angle
class TestAngle(unittest.TestCase):
"""Tests for jpmesh.Angle.
"""
def test_properties(self):
"""Test for properties.
"""
millisecond = 3600000
angle = Angle.from_millisecond(millisecond)
se... | ymoch/pyjpmesh | test/test_angle.py | Python | mit | 2,197 |
#
# Copyright (c) 2013 Markus Eliasson, http://www.quarterapp.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... | haard/quarterapp | quarterapp/account.py | Python | mit | 6,524 |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import pytest
import functools
from devtools_testutils import recorded_by_proxy
from azure.ai.formrecognizer._generated.v2022_01_30_preview.models import... | Azure/azure-sdk-for-python | sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dac_analyze_layout.py | Python | mit | 7,732 |
import requests
url = "http://mockbin.com/har"
payload = "{\"number\":1,\"string\":\"f\\\"oo\",\"arr\":[1,2,3],\"nested\":{\"a\":\"b\"},\"arr_mix\":[1,\"a\",{\"arr_mix_nested\":{}}]}"
headers = {'content-type': 'application/json'}
response = requests.request("POST", url, data=payload, headers=headers)
print(respons... | postmanlabs/httpsnippet | test/fixtures/output/python/requests/application-json.py | Python | mit | 328 |
import numpy as np
import matplotlib.pyplot as plt
import sys
### Plot the analytical solution of the heat equation
# * Steady-state
# * Constant advection velocity
# * Constant heat diffusivity
# * Constant heat production
#
# Choosable boundary conditions
# - Fixed surface temperature T=0
# - Fixed bo... | HUGG/NGWM2016-modelling-course | Lessons/03-Analytical-solutions-heat-transfer/scripts/plot_steady_state_heat_eq_advection.py | Python | mit | 1,797 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import webapp2,jinja2,os
import logging
import wowapi
from datetime import datetime
from google.appengine.ext import ndb
from google.appengine.api.memcache import Client
from google.appengine.api import taskqueue
from google.appengine.api.taskqueue import Queue
from goog... | AndyHannon/ctrprogress | ranker.py | Python | mit | 11,305 |
"""
Author: Robert Post
Based on code from Nathan Sprague
from: https://github.com/spragunr/deep_q_rl
"""
import DeepNetworks
import lasagne
import numpy as np
import theano
import theano.tensor as T
import cPickle
import imp
class DeepQNetwork(object):
def __init__(self, batchSize, numFrames, inputHeight, inputW... | Mog333/DeepRL | network/DeepQNetwork.py | Python | mit | 7,211 |
""" Tests for foe.command.interpret._setup_readline """
from foe.command.interpret import _get_input
def test_no_config():
assert not _get_input()
| robobrobro/foe | test/command/interpret/test_get_input.py | Python | mit | 153 |
'''
Created by auto_sdk on 2015.03.18
'''
from top.api.base import RestApi
class ShopGetRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.fields = None
self.nick = None
def getapiname(self):
return 'taobao.shop.get'
| colaftc/webtool | top/api/rest/ShopGetRequest.py | Python | mit | 303 |
from mock import patch
from django.test import TestCase
from django.core.urlresolvers import reverse
from ..models import Contact
class ContactViewTest(TestCase):
def setUp(self):
self.url = reverse('contact')
self.response = self.client.get(self.url)
def test_contact_view_is_accessible(sel... | prontointern/django-contact-form | django_contact_form_project/contacts/tests/test_views.py | Python | mit | 14,146 |
# -*- coding: utf-8 -*-
#
desc = 'Plot Taylor--Green Vortex using pcolormesh'
# phash = 'ff1a8578c9847b22'
phash = '7f1a8578c9857932'
def plot():
from matplotlib import pyplot as plt
import numpy as np
x = np.linspace(0*np.pi, 2*np.pi, 128)
y = np.linspace(0*np.pi, 2*np.pi, 128)
X, Y = np.meshgri... | dougnd/matplotlib2tikz | test/testfunctions/quadmesh.py | Python | mit | 840 |
VERSION = '0.0.2'
| suvit/django-privatesite | privatesite/__init__.py | Python | mit | 18 |
import os
import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ms2ldaviz.settings")
import django
django.setup()
from decomposition.models import *
from basicviz.models import *
# Script to transform an experiment into a motifset for decomposition
if __name__ == '__main__':
experiment_name = sys.argv[1]
... | sdrogers/ms2ldaviz | ms2ldaviz/decomp_create_motifset.py | Python | mit | 1,879 |
#!/usr/bin/python
# Remplir un tableau avec les coefficients du triangle de Pascal
from math import factorial as fact
def combin(n, p):
res = int(fact(n) / (fact(p) * fact(n - p)))
return res
def triangle_pascal(tab):
for i in range(len(tab)):
for j in range(i + 1):
tab[i][j] = combi... | sumaxime/LIFAP1 | TD/TD7/Code/Python/7.py | Python | mit | 539 |
# flake8: noqa: F403, F405
from tests.core import mock
from trakt import Trakt
from trakt.objects import Show, Season, Episode
from hamcrest import *
from httmock import HTTMock
def test_watched():
with HTTMock(mock.fixtures, mock.unknown):
with Trakt.configuration.auth('mock', 'mock'):
item... | fuzeman/trakt.py | tests/users/lists/items/test_shows.py | Python | mit | 1,921 |
#!/usr/bin/python
# interpolate scalar gradient onto nedelec space
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
from dolfin import *
import mshr
Print = PETSc.Sys.Print
# from MatrixOperations import *
import numpy as np
import PETScIO as IO
import common
import scipy
import scipy.i... | wathen/PhD | MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/SplitMatrix/ScottTest/Lshaped/Dominik/NS.py | Python | mit | 11,453 |
# 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.
# --------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/search/azure-search-documents/samples/sample_data_source_operations.py | Python | mit | 2,842 |
import requests
import hashlib
import os
import json
USERNAME = 'christine'
API_KEY = 'd0e4164c2bd99f1f888477fc25cf8c5c104a5cd1'
#Read in the path with user input (or navigate to the directory in the GUI)
#path = '/home/wildcat/Lockheed/laikaboss/malware/'
os.chdir("/home/wildcat/Lockheed/laikaboss")
print("Hint: ... | cfossace/test | pyscript/pyscript2.py | Python | mit | 1,181 |
# ARP Suite - Run ARP Commands From Command Line
import sys
import arp_mitm as mitm
import arp_sslstrip as sslstrip
import arp_listen as listen
import arp_request as request
import arp_cache as cache
import arp_reconnaissance as recon
import arp_interactive as interactive
if __name__ == "__main__":
arguments = sys.ar... | monkeesuit/school | Network Security/ARP/arp suite/py/arp.py | Python | mit | 7,562 |
# ------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -------------------------------------------------------------------------
from ._servi... | Azure/azure-sdk-for-python | sdk/servicebus/azure-servicebus/azure/servicebus/aio/__init__.py | Python | mit | 725 |
'''
Created on 21 de oct. de 2015
@author: cgimenop
'''
from xml.dom import minidom
class TLCase:
CODE = 0;
TITLE = 1
SUMMARY = 2
IMPORTANCE = 3
PRECONDITIONS = 4
STEPS = 5
EXPECTED_RESULT = 6
EXTRA_DETAILS = 7 #UNUSED
EXECUTION_TYPE = 8
E2E = 9 #UNUSED... | cgimenop/Excel2Testlink | ExcelParser/TLCase.py | Python | mit | 6,315 |
"""
>>> import pandas as pd
>>> from nlpia.data.loaders import get_data
>>> pd.options.display.width = 120 # <1>
>>> sms = get_data('sms-spam')
>>> index = ['sms{}{}'.format(i, '!'*j) for (i,j) in\
... zip(range(len(sms)), sms.spam)] # <2>
>>> sms = pd.DataFrame(sms.values, columns=sms.columns, index=index)
>>> s... | totalgood/nlpia | src/nlpia/book/examples/ch4_fix_accuracy_discrepancy.py | Python | mit | 2,729 |
from solid import *
import numpy as np
import subprocess
def multiple_ramp_strings(Rs, width=30):
"""
Joins together source code strings for multiple ramps.
"""
s = ''.join(Rs)
cp = ['\ntranslate([0, %i, 0]) ramp%i();' % (i*width, i) for i in xrange(len(Rs))]
return s + ''.join(cp)
def rende... | thearn/printable_ramps | lib/ramp.py | Python | mit | 3,747 |
import numpy as np
import scipy.optimize as opt
import unittest
def allocate(a, c, initial_guess):
def sum_positives(x):
return sum(i for i in x if i > 0)
def sum_negatives(x):
return -sum(i for i in x if i < 0)
pareto_ref = min(sum_positives(a), sum_negatives(a))
def sqr_sum(o,c):... | hugombarreto/credibility_allocation | allocators/optimization_allocation.py | Python | mit | 3,025 |
import smbl
__RULES=set()
def register_rule(rule):
registered_rules=[r.encode() for r in get_registered_rules()]
if rule.encode() not in registered_rules:
__RULES.add(rule)
def get_registered_rules():
return list(__RULES)
class Rule:
def __init__(self,input,output,run):
self.__input=input
self.__output=o... | karel-brinda/smbl | smbl/utils/rule.py | Python | mit | 572 |
from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
from flexget.utils import json
from flexget.utils.template import RenderError
log = logging.getLogger('rapidpush')
__version__ = 0.4
headers = {'User-Agent': "FlexGet RapidPush... | X-dark/Flexget | flexget/plugins/output/rapidpush.py | Python | mit | 6,710 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq.data.encoders import register_tokenizer
from fairseq.dataclass import FairseqDataclass
@register_tokenizer("nltk", dataclass=Fa... | pytorch/fairseq | fairseq/data/encoders/nltk_tokenizer.py | Python | mit | 755 |
import logging
import math
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.db.models import Q
from django.shortcuts import get_object_or_404, redirect, render
from django.views.generic import View
from experiments_ma... | MOOCworkbench/MOOCworkbench | user_manager/views.py | Python | mit | 7,680 |
#! /usr/bin/env python
'''
Testsuite for the CustomParameter class
'''
from __future__ import absolute_import, division, print_function
import numpy as np
from puq import *
def _hisplot(y, nbins):
n, bins = np.histogram(y, nbins, normed=True)
mids = bins[:-1] + np.diff(bins) / 2.0
return mids, n
def compa... | c-PRIMED/puq | test/CustomParameter_test.py | Python | mit | 7,647 |
import string
def decrypt(cipher):
# cipher: string
old_elems = string.ascii_lowercase
new_elems = string.ascii_lowercase[2:] + string.ascii_lowercase[:2]
mappings = cipher.maketrans(old_elems, new_elems) # python2: string.maketrans(old_elems, new_elems)
return cipher.translate(mappings) # python2:... | au9ustine/org.au9ustine.puzzles.pythonchallenge | pc/level_01.py | Python | mit | 399 |
"""django_youtuber URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
C... | rakanalh/django-youtuber | example_project/urls.py | Python | mit | 765 |
from django.conf.urls import patterns, url
from django.views.decorators.csrf import csrf_exempt
from getpaid.backends.eservice.views import PendingView, SuccessView, FailureView
urlpatterns = patterns('',
url(r'^pending/$', csrf_exempt(PendingView.as_view()), name='getpaid-eservice-pending'),
url(r'^success/$... | mionch/django-getpaid | getpaid/backends/eservice/urls.py | Python | mit | 488 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Source separation algorithms attempt to extract recordings of individual
sources from a recording of a mixture of sources. Evaluation methods for
source separation compare the extracted sources from reference sources and
attempt to measure the perceptual quality of th... | JeroenZegers/Nabu-MSSS | nabu/postprocessing/scorers/bss_eval.py | Python | mit | 57,733 |
#!/usr/bin/env python3
# This script is designed to load quasi-static data into a PostGIS database for
# rendering maps. It differs from the usual scripts to do this in that it is
# designed to take its configuration from a file rather than be a series of
# shell commands, and consideration has been given to doing the ... | kartotherian/meddo | get-external-data.py | Python | mit | 9,549 |
from flask import Flask, render_template
from flask.ext.bootstrap import Bootstrap
from flask.ext.moment import Moment
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.uploads import UploadSet, configure_uploads, IMAGES
from config import config
bootstrap = Bootstrap(... | chenke91/ihaveablog | app/__init__.py | Python | mit | 1,126 |
import logging
import colorlog
from logging.config import fileConfig
import json
class mylogger():
def __init__(self, sdict, logfn):
fileConfig('./logging_config.ini', defaults={'logfilename': logfn})
self.logger = logging.getLogger()
self.sdict = sdict
#save or open from json file
... | balbinot/arghphot | arghphot/logutil.py | Python | mit | 652 |
#! usr/bin/python3
import os
for fn in os.listdir():
if ".pdb" in fn:
#sub = {}
with open(fn, 'r') as f:
for line in f:
c = line.split()
if len(c) > 5 and c[0] == "HET":
ligand= c[1]
print(fn, ligand)
| YedaAnna/work_scripts | list_ligand_id.py | Python | mit | 294 |
ad = 1.
# this statement will be ignored at the codegen
x = ad is None
| ratnania/pyccel | tests/warnings/codegen/is.py | Python | mit | 72 |
"""
Your code basically returns a list of actions. This is the goal of your code.
There are 3 type of Actions that you can add.
1) GoToFlow - Used for jumping to a conversation
2) SetVariable - Used for setting an attribute
3) Publish - Used to reply back to the user
Actions are executed in the order that you send th... | scupid-admin/morph-python-sdk | morph/action.py | Python | mit | 1,819 |
'''
Created on 24.03.2011
@author: michi
'''
from PyQt4.QtGui import QItemDelegate
from sqlalchemy import Table
from sqlalchemy.sql import Alias,Select
from ems import qt4
class ColumnSectionMapper(object):
def __init__(self,alchemySelect=None, parent=None):
self.__columnConfigs = []
self.__colu... | mtils/ems | ems/qt4/itemmodel/columnsectionmapper.py | Python | mit | 3,948 |
from ginger import utils
from datetime import datetime, timedelta
from django.core.cache import cache
from django.conf import settings
from django.utils import timezone
import pytz
__all__ = ['CurrentRequestMiddleware',
'MultipleProxyMiddleware',
'ActiveUserMiddleware',
'LastLoginMi... | vivsh/django-ginger | ginger/middleware.py | Python | mit | 3,073 |
# -*- coding: utf-8 -*-
from hashlib import sha1 as SHA
from django.db import models
from datetime import datetime
from django.utils import timezone
from django.core.urlresolvers import reverse
from client.conf.settings import TBACKUP_DATETIME_FORMAT, settings
from django.utils.html import format_html
fro... | gustavomazevedo/tbackup-client | client/models/Backup.py | Python | mit | 5,953 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-04-30 15:39
from __future__ import unicode_literals
from django.db import migrations
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
('taggit', '0002_auto_20150616_2121'),
('blog', '0001_initial'),
]
... | nicorellius/pdxpixel | pdxpixel/apps/blog/migrations/0002_post_tags.py | Python | mit | 602 |
#!/usr/bin/env python3
from math import floor, ceil
lines = []
with open('input.txt', 'r') as f:
lines = f.read().splitlines()
def get_val(line, start_pos, end_pos, lhalf, uhalf, uhalf_char):
for x in line[start_pos:end_pos:]:
if x == uhalf_char: # take lower half
uhalf -= ceil((uhalf - lhalf) / 2)
... | jekhokie/scriptbox | python--advent-of-code/2020/5/solve.py | Python | mit | 960 |
from django.core.management import call_command
from django.test import TestCase
from frontend.models import PCT
def setUpModule():
call_command('loaddata', 'frontend/tests/fixtures/ccgs.json',
verbosity=0)
def tearDownModule():
call_command('flush', verbosity=0, interactive=False)
class ... | annapowellsmith/openpresc | openprescribing/frontend/tests/commands/test_import_ccg_boundaries.py | Python | mit | 726 |
class Animal(object):
def __init__(self, name): # Constructor of the class
self.name = name
def talk(self): # Abstract method, defined by convention only
raise NotImplementedError("Subclass must implement abstract method")
class Cat(Animal):
def talk(self):
return self.meo... | mcdickenson/python-washu-2014 | day2/polymorphism.py | Python | mit | 771 |
import scrapy
from moovy.items import MoovyItem
class MoovySpider(scrapy.Spider):
name = "moovy"
allowed_domains = ["en.wikipedia.org"]
start_urls = ["https://en.wikipedia.org/wiki/List_of_Tamil_films_of_2015"]
def parse(self,response):
#titles = response.selector.xpath('//table[@c... | miztiik/TamMovie-Recommendation-Engine | moovy/spidy.py | Python | mit | 621 |
from . import ikh
| bernoullio/toolbox | tests/indicators/__init__.py | Python | mit | 18 |
import serial
import time
import threading
from socketIO_client import SocketIO, LoggingNamespace, BaseNamespace
from threading import Thread
from tendo import singleton
import configparser
import sys
me = singleton.SingleInstance()
config = configparser.ConfigParser()
config.read('./config.cfg')
password = config.g... | aaronpcz/py-electret-serial-with-bucket-normalisation | serial-electret-data-listener.py | Python | mit | 4,819 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from contextlib import contextmanager
import functools
import inspect
import logging
import trueskill
from trueskill.backends import available_backends
from trueskill.factorgraph import (Variable, Factor, PriorFactor,
Like... | amit-bansil/netsci | robocompviz/trueskill/trueskillhelpers.py | Python | mit | 5,897 |
# -*- coding: utf-8 -*-
"""
本文件中包含的是CTA模块的回测引擎,回测引擎的API和CTA引擎一致,
可以使用和实盘相同的代码进行回测。
"""
from __future__ import division
from collections import OrderedDict
from datetime import datetime, timedelta
from itertools import product
import pymongo
from vnpy.engine.cta.ctaBase import CtaTickData, StopOrder
from vnpy.engine... | xuwei0455/hedge | bin/ctaBackTesting.py | Python | mit | 32,917 |
#import libraries
import tensorflow as tf
import numpy as np
def get_data():
#data is from the computer hardware dataset found on the UCI ML repository
with open('data.txt', 'r') as fin:
text_in = fin.read()
split = text_in.splitlines()
data = []
for line in split:
data.append(line.split(','))
np_data = np.... | SimpleGeometry/bisv-ml | tensorflow-2/tf_linreg.py | Python | mit | 2,049 |