code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
import unittest
from convert import convert
class TestConvert(unittest.TestCase):
def testEmptyJsonParse(self):
generated = convert.parse(convert._load_json_files("./jsonSamples/minimal.json")[0])
def testGlossaryJsonParse(self):
generated = convert.parse(convert._load_json_files("./jsonSampl... | HenrikPoulsen/Json2Class | test/testConvert.py | Python | mit | 475 |
#! /usr/bin/python2
# vim: set fileencoding=utf-8
from dateutil.parser import parse
from subprocess import check_output
from shutil import copy
import datetime
import sys
import os.path
import isoweek
DATE_FORMAT = '%Y%m%d'
START = """\documentclass[a4paper,oneside,draft,
notitlepage,11pt,svgnames]{scrreprt}
\\newcomma... | daureg/illalla | diary/manage.py | Python | mit | 2,888 |
"""Single slice vgg with normalised scale.
"""
import functools
import lasagne as nn
import numpy as np
import theano
import theano.tensor as T
import data_loader
import deep_learning_layers
import layers
import preprocess
import postprocess
import objectives
import theano_printer
import updates
# Random params
rng ... | 317070/kaggle-heart | configurations/je_ss_smcrps_nrmsc_dropoutput.py | Python | mit | 8,198 |
"""
"""
import sys
import re
import keyword
import logging
import traceback
from functools import partial
from PySide import QtCore
from PySide.QtCore import QObject
from maya import cmds
from mampy.pyside.utils import get_qt_object
from mamprefs import config
from mamprefs.base import BaseManager,... | arubertoson/maya-mamprefs | mamprefs/markingmenus.py | Python | mit | 11,879 |
import argparse
import sys
import rospy
from geometry_msgs.msg import (
PoseStamped,
Pose,
Point,
Quaternion,
)
from std_msgs.msg import Header
from baxter_core_msgs.srv import (
SolvePositionIK,
SolvePositionIKRequest,
)
def ik_solve(limb, pos, orient):
#~ rospy.init_node("rsdk_ik_serv... | calumk/ROS-Blocks | ros_blocks/scripts/ik_solver.py | Python | mit | 1,346 |
from classytags.helpers import InclusionTag
from django import template
from django.conf import settings
from django.template.loader import render_to_string
register = template.Library()
class Banner(InclusionTag):
"""
Displays a checkout mode banner.
"""
template = 'sagepay/checkout_mode_banner.ht... | glynjackson/django-oscar-sagepay | sagepay/templatetags/checkout_mode_tag.py | Python | mit | 613 |
#!/usr/bin/env python
import sys, inspect, cgi, os, subprocess, pipes, json, select, time, threading
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from urlparse import parse_qs
from threading import Thread
from gpiozero import RGBLED
from gpiozero import PWMLED
# SETTINGS
serverPort = 40001
baseDir = o... | fedtemis/Fonograf | servers/ledServer.py | Python | mit | 13,546 |
'''
Convert a table from a nested list to a nested dictionary and back.
-----------------------------------------------------------
(c) 2013 Allegra Via and Kristian Rother
Licensed under the conditions of the Python License
This code appears in section 7.4.3 of the book
"Managing Biological Data with Py... | raymonwu/Managing_Your_Biological_Data_with_Python_3 | 07-tabular_data/7.4.3_convert_table.py | Python | mit | 1,222 |
#!/usr/bin/env python
import commands, sys
# Get path of the toolbox
status, path_sct = commands.getstatusoutput('echo $SCT_DIR')
# Append path that contains scripts, to be able to load modules
sys.path.append(path_sct + '/scripts')
from msct_parser import Parser
from nibabel import load, save, Nifti1Image
import ... | 3324fr/spinalcordtoolbox | dev/sct_detect_spinalcord/sct_get_centerline_from_labels.py | Python | mit | 5,974 |
#!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from .mininode import *
from .blockstore import BlockStore, TxStore
from .util import p2p_port
'''
This is a tool for comparing two or more mocacoinds... | mocacinno/mocacoin | qa/rpc-tests/test_framework/comptool.py | Python | mit | 18,040 |
class BaseWidget(object):
def __init__(self, path):
self._path = path
def expand(self):
"Implement this in sub classes"
raise Exception("Not implemented in Base class.")
| evojimmy/linux-server-backup | scripts/widgets/BaseWidget.py | Python | mit | 202 |
#!/usr/bin/env python
# mongodb_replicaset_status.py
# Author: Tyler Stroud <ststroud@gmail.com>
# Date: 2012-11-06
"""
This script monitors replication status of a replicaset
"""
from daemon import runner
import logging
from pymongo import Connection
from pymongo.errors import AutoReconnect
from time import sleep
im... | tystr/mongodb-replication-status | mongodb_replication_status.py | Python | mit | 6,156 |
import numpy as np
from matplotlib import pyplot as plt
from astropy.io import fits
from glob import glob
import os
#Author: Trevor Dorn-Wallenstein
#Date: 9.20.17
#Author's note: the data reduction portion of this does almost exactly what acronym
#(Weisenburger et al. 2017, https://github.com/kweis/acronym) does, wi... | tzdwi/adapt | adapt.py | Python | mit | 20,553 |
'''
Created on Dec 3, 2014
@author: gearsad
'''
import sys
from roverpylot import rover
from bot_update_t import bot_update_t
from bot_control_command_t import bot_control_command_t
import lcm
# Try to start OpenCV for video
try:
import cv
except:
cv = None
class LCMRover(rover.Rover):
'''
A rover ... | GearsAD/semisorted_arnerve | arnerve_bot/arnerve_bot/LCMRover.py | Python | mit | 2,720 |
'''
Created on 10/5/2015
@author: johnPortella
@version: 1.0
'''
import paramiko, os
from ftplib import FTP
#from config_parser import ConfigUtils
class PyFileTransfer(object):
'''
def __init__(self, transfName):
transfConf = ConfigUtils.read_trasnfer_config(transfName)
#hostna... | JohnPortella/pyfile_transfer | pyfile_transfer.py | Python | mit | 6,740 |
# 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_08_01/operations/_azure_firewalls_operations.py | Python | mit | 26,909 |
import unittest
def rotate_matrix(matrix):
end = len(matrix) - 1 # The index of the last row
# Rotating the matrix layer by layer
for row in range((end + 1) / 2):
for col in range(row, end - row):
temp = matrix[row][col]
matrix[row][col] = matrix[end - col][row]
... | heitorschueroff/ctci | ch1/1.07_Rotate_Matrix/rotate_matrix.py | Python | mit | 2,061 |
#!/usr/bin/env python
import logging
import sys
from urllib.parse import urljoin
import requests
from lxml import html
from six.moves.urllib.parse import urlparse
from django_docutils.exc import BasedException
logger = logging.getLogger(__name__)
def _request_favicon(url):
"""Tries to download favicon from URL... | tony/django-docutils | django_docutils/favicon/scrape.py | Python | mit | 2,207 |
import re
import pytest
from flask import url_for
from freezegun import freeze_time
from app.formatters import normalize_spaces
from tests.conftest import (
SERVICE_ONE_ID,
create_active_caseworking_user,
create_active_user_with_permissions,
create_platform_admin_user,
)
@pytest.mark.parametrize('ex... | alphagov/notifications-admin | tests/app/main/views/uploads/test_upload_hub.py | Python | mit | 10,939 |
import numpy as np
import fnmatch, os
import h5py
class Hdf5Loader():
def loadDirectory(self, dirname):
"""
Loads all hdf5 files in the directory dirname
@param dirname: The directory which contains the files to load
@returns: list of h5py File objects
""... | nglrt/virtual_energy_sensor | virtual_energy_sensor/loadtrain.py | Python | mit | 3,264 |
"""
This script investigates how calculating phasic currents from voltage clamp
recordings may benefit from subtracting-out the "noise" determined from a
subset of the quietest pieces of the recording, rather than using smoothing
or curve fitting to guess a guassian-like RMS noise function.
"""
import os
import sys
s... | swharden/SWHLab | doc/uses/EPSCs-and-IPSCs/variance method/2016-12-16 tryout2.py | Python | mit | 4,500 |
from __future__ import print_function
import re
import traceback
class MiniObject(object):
def __init__(self, py_object, **meta):
( "The following python types map to the following mini types:\n"
" bool -> boolean\n"
" str -> string\n"
" int -> integer\n"
... | kerkeslager/sandbox | mini/mini.py | Python | mit | 27,970 |
from qtpy.QtWidgets import QFileDialog
import logging
import pandas as pd
class Export:
header = ['x0', 'y0', 'x1', 'y1', 'row_index', 'column_index',
'lock', 'active',
'fitting_confidence', 'd_spacing_value', 'd_spacing_err',
'sigma_value', 'sigma_err',
'i... | ornlneutronimaging/iBeatles | src/iBeatles/table_dictionary/export.py | Python | mit | 3,916 |
from contextional import GCM
with GCM("A") as A:
@GCM.add_setup
def setUp():
pass
@GCM.add_teardown
def tearDown():
pass
with GCM.add_group("B"):
@GCM.add_setup
def setUp():
pass
@GCM.add_test("some test")
def test(case):
... | SalmonMode/contextional | contextional/test_resources/verbose_fixtures.py | Python | mit | 7,418 |
#!/usr/bin/env python
import sys
import os
import logging
from extensions import valid_tagging_extensions
from readSettings import ReadSettings
from mkvtomp4 import MkvtoMp4
from tmdb_mp4 import tmdb_mp4
from autoprocess import plex
from post_processor import PostProcessor
from logging.config import fileConfig
logpat... | Collisionc/sickbeard_mp4_automator | postCouchPotato.py | Python | mit | 2,496 |
# http://codingbat.com/prob/p145834
def last2(str):
if len(str) < 2:
return 0
count = 0
for i in range(len(str)-2):
if str[i:i+2] == str[len(str)-2:]:
count += 1
return count
| dvt32/cpp-journey | Python/CodingBat/last2.py | Python | mit | 213 |
DESCRIPTION = """\
ACQ4 is a python-based platform for experimental neurophysiology.
It includes support for standard electrophysiology, multiphoton imaging,
scanning laser photostimulation, and many other experimental techniques. ACQ4 is
highly modular and extensible, allowing support to be added for new types of
d... | mgraupe/acq4 | setup.py | Python | mit | 7,496 |
# -*- coding: utf-8 -*-
"""Unit test suite for the models of the application."""
from nose.tools import eq_
from tg2express.model import DBSession
from tg2express.tests import load_app
from tg2express.tests import setup_db, teardown_db
__all__ = ['ModelTest']
def setup():
"""Setup test fixture for all model tes... | archsh/tg2ext.express | example/tg2express/tests/models/__init__.py | Python | mit | 1,626 |
import datetime
import sys
import os.path
import pprint
from inspect import getmembers, isclass
from collections import defaultdict
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.contrib.contenttypes.models import Content... | Goldcap/django-operis | operis/management/commands/generate-api.py | Python | mit | 11,299 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.desk.doctype.notification_settings.notification_settings... | saurabh6790/frappe | frappe/desk/doctype/notification_log/notification_log.py | Python | mit | 4,285 |
'''
File: input.py
Author: Tristan van Vaalen
Handles user input
'''
import signal
import sys
import verbose
v = verbose.Verbose()
class InputHandler():
def __init__(self):
v.debug('Initializing input handler').indent()
self.running = True
self.signal_level = 0
v.debug('Regist... | Scoudem/audiolyze | inputhandler.py | Python | mit | 1,620 |
index = 20
bets = 25
names = ("Plain", "Cheval H", "Cheval V", "Trans", "Trans S", "Carre", "Colonne", "Simple")
for bet in range(bets):
col = 40
# --------------------------------------- money
print("""
when %d =>
if bets_index > %d then
fb_a_addr <= std_logic_vector(to_unsigned(COLS*21 + COLS... | dries007/Basys3 | python/RouletteMaker.py | Python | mit | 1,814 |
from django import forms
from .models import Author
class RegisterNewAuthorForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput())
repeated_password = forms.CharField(widget=forms.PasswordInput())
class Meta:
model = Author
fields = ['email', 'first_name', 'last_n... | jokuf/hack-blog | users/forms.py | Python | mit | 1,762 |
#Faça um programa que o usuário informe a quantidade de alunos de uma turma, o sistema deve ler o peso e altura de cada
# aluno, ao final informar o imc.
T= int(input("entre com a quantidade de alunos"))
x=0
soma=0
somapesos=0
somaltura=0
while (x<T):
P= float(input("entre com o peso do aluno"))
... | erikaklein/algoritmo---programas-em-Python | AlunosPesoAlturaImc.py | Python | mit | 439 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from indico.util.mimetypes import register_custom_mimetypes
__version__ = '2.3-dev'
register_custom_mim... | mic4ael/indico | indico/__init__.py | Python | mit | 329 |
a = 1100087778366101931
b = 7540113804746346429
while (not(a <= b and b <= a)):
if (b <= a):
a = a - b
else:
b = b - a
print(a)
| ellisonch/kinc | languages/imp/programs/prog4.py | Python | mit | 134 |
import warnings
from sqlalchemy.testing import eq_, is_, assert_raises, assert_raises_message
from sqlalchemy import *
from sqlalchemy import exc as sa_exc, util, event
from sqlalchemy.orm import *
from sqlalchemy.orm.util import instance_str
from sqlalchemy.orm import exc as orm_exc, attributes
from sqlalchemy.testing... | robin900/sqlalchemy | test/orm/inheritance/test_basic.py | Python | mit | 94,636 |
#Encryption algorithms transform their input data, or plaintext, in some way that
#is dependent on a variable key, producing ciphertext. This transformation can
#easily be reversed, if (and, hopefully, only if) one knows the key.
#The key can be varied by the user or application and chosen from some very large sp... | jingriver/stocktracker | pytoolkit/cryptography/testCipher.py | Python | mit | 3,810 |
from test import test_support
from test.test_support import bigmemtest, _1G, _2G, _4G, precisionbigmemtest
import unittest
import operator
import string
import sys
# Bigmem testing houserules:
#
# - Try not to allocate too many large objects. It's okay to rely on
# refcounting semantics, but don't forg... | babyliynfg/cross | tools/project-creator/Python2.6.6/Lib/test/test_bigmem.py | Python | mit | 39,354 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-19 20:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0003_auto_20161017_1814'),
]
operations = [
migrations.AddField(
... | aabmass/print-web | print_web_django/api/migrations/0004_printjob_file_uploaded.py | Python | mit | 512 |
import numpy as np
from cs231n.classifiers.linear_svm import *
from cs231n.classifiers.softmax import *
class LinearClassifier(object):
def __init__(self):
self.W = None
def train(self, X, y, learning_rate=1e-3, reg=1e-5, num_iters=100,
batch_size=200, verbose=False):
"""
Train this linea... | hanezu/cs231n-assignment | assignment1/cs231n/classifiers/linear_classifier.py | Python | mit | 5,634 |
import pandas as pd
from typing import List
from datetime import datetime
from .clean_list import clean_dates
class CleanDates():
def clean_dates(self, inputs: pd.DataFrame) -> pd.DataFrame:
return inputs.apply(clean_dates)
| NewKnowledge/punk | punk/preppy/cleanDates.py | Python | mit | 238 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2014 Thomas Voegtlin
#
# 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... | protonn/Electrum-Cash | plugins/cosigner_pool/qt.py | Python | mit | 7,561 |
from django.db import models
from django.utils import timezone
from pytz import common_timezones
from .validators import YoutubeValidator
class TimezoneField(models.CharField):
"""
A field for selecting a timezone from the common timezones list.
"""
def __init__(self, *args, **kwargs):
common... | gamernetwork/gn-django | gn_django/fields.py | Python | mit | 909 |
'''
urlresolver XBMC Addon
Copyright (C) 2017
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distribu... | dbiesecke/dbiesecke.github.io | repo/script.module.urlresolver/lib/urlresolver/plugins/bitporno.py | Python | mit | 1,372 |
"""
@name: PyHouse/Project/src/Modules/Computer/Web/web_rootMenu.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2013-2019 by D. Brian Kimmel
@license: MIT License
@note: Created on May 30, 2013
@summary: Handle the Main menu.
"""
__updated__ = '2019-10-31'
# Import s... | DBrianKimmel/PyHouse | Project/src/Modules/Computer/Web/web_rootMenu.py | Python | mit | 1,294 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
JS and CSS minification
============================
Author: Toni Heittola (toni.heittola@gmail.com)
This plugin will create dynamic datatable with charting features from given yaml-datafile.
"""
import os
import sys
import io
import argparse
import textwrap
from IPy... | toni-heittola/js-datatable | minification.py | Python | mit | 4,998 |
#!/usr/bin/env python
# encoding: utf-8
# Copyright (C) Alibaba Cloud Computing
# All rights reserved.
import unittest
from aliyun.log.es_migration.mapping_index_converter import \
MappingIndexConverter
class TestMappingIndexConverter(unittest.TestCase):
def test_to_index_config(self):
mapping = ... | wjo1212/aliyun-log-python-sdk | tests/es_migration/test_mapping_index_converter.py | Python | mit | 3,908 |
#!/usr/bin/env python3
import os
import errno
import requests
url='http://www.jeep.com/hostd/getlocatedealers.json?zipCode=60202&zipDistance=2500'
directory_name=os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'data'))
try:
os.makedirs(directory_name)
except OSError as exc:
if exc... | simon-wenmouth/dealerships | dealerships/manufacturers/jeep/download_data.py | Python | mit | 628 |
#!/usr/bin/env python
"""
$ python cmdln_main2.py
This is my shell.
$ python cmdln_main2.py foo
hello from foo
"""
import sys
import cmdln
class Shell(cmdln.RawCmdln):
"This is my shell."
name = "shell"
def do_foo(self, argv):
print("hello from foo")
if __name__ == "__main__":
... | hfeeki/cmdln | test/cmdln_main2.py | Python | mit | 421 |
# -*- coding: utf-8 -*-
import re
RATEBEER_BASE_URL = 'http://www.ratebeer.com/beer'
def ratebeer_url(ratebeer_id, short_name):
fixed_name = re.sub(
'[^A-Za-z0-9\-]+',
'',
short_name.replace(' ', '-')
)
return "%s/%s/%s/" % (RATEBEER_BASE_URL, fixed_name, ratebeer_id)
| atlefren/beerdatabase | web/util.py | Python | mit | 309 |
class Medicine(object):
def __init__(self, name):
self.name = name
self.prescriptions = []
def add_prescription(self, prescription):
self.prescriptions.append(prescription)
| emilybache/KataMedicineClash | Python/medicine.py | Python | mit | 228 |
import unittest
from ebird.api.validation import clean_provisional
class CleanProvisionalTests(unittest.TestCase):
"""Tests for the clean_provisional validation function."""
def test_converts_bool(self):
self.assertEqual("true", clean_provisional(True))
self.assertEqual("false", clean_provis... | ProjectBabbler/ebird-api | tests/validation/test_clean_provisional.py | Python | mit | 483 |
import _plotly_utils.basevalidators
class XsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="xsrc", parent_name="histogram2d", **kwargs):
super(XsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_t... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram2d/_xsrc.py | Python | mit | 388 |
import numpy as np
class Basis(object):
__resolution = 1E-9
__eqdecimals = 9 # how many decimals to round off to for relative coordinates
def __init__(self, basis=None, transform=None):
if basis is not None:
self.origin = basis.origin.copy()
if transform is not None:
... | FJFranklin/wifi-py-rpi-car-controller | noise/Noise/Basis.py | Python | mit | 5,396 |
"""
WSGI config for my_doku_application 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "my_doku_application.settin... | jhcodeh/my-doku | my_doku_application/my_doku_application/wsgi.py | Python | mit | 413 |
"""
RUN FROM THIS FILE
Alexandre Yang
ITP 115
Final Project
05/08/2014
Description:
Refer to readme.txt
"""
import pygame
from Oto import Oto
from Button import Button
from Label import Label
# Input: pygame.Surface, tuple, int, int, int, int
# Output: none
# Side-effect: Draws the grid on the screen
def drawBoard... | yangalex/Otomata-python | Otomata.py | Python | mit | 7,139 |
# -*- coding: utf-8 -*-
"""
flango.template
~~~~~~~~~~~~~~
template module provide a simple template system that compiles
templates to Python code which like django and tornado template
modules.
Usage
-----
Well, you can view the tests file directly for the usage under tests.
Bas... | hziling/template | template.py | Python | mit | 11,977 |
import sqlite3
import sys
import os
def menu():
sane = 1
while sane == 1:
print "[ - ] Please enter absolute path to cred. database to be created: "
in_path = raw_input()
if os.path.exists(in_path):
os.system('cls' if os.name == 'nt' else 'clear')
print "[ - ] Invalid path, try again."
else... | 0xhughes/credential_db | createDB.py | Python | mit | 975 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'exampleLoaderTemplate.ui'
#
# Created: Sat Dec 17 23:46:27 2011
# by: PyQt4 UI code generator 4.8.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
... | robertsj/poropy | pyqtgraph/examples/exampleLoaderTemplate.py | Python | mit | 2,302 |
"""
Nonnegative CP decomposition by Hierarchical alternating least squares (HALS).
Author: N. Benjamin Erichson <erichson@uw.edu>
"""
import numpy as np
import numba
from tensortools.operations import unfold, khatri_rao
from tensortools.tensors import KTensor
from tensortools.optimize import FitResult, optim_utils
... | ahwillia/tensortools | tensortools/optimize/ncp_hals.py | Python | mit | 6,382 |
"""
Lingui docs extensions
Inspired by Django Docs
https://github.com/django/django/blob/main/docs/_ext/djangodocs.py
"""
from docutils import nodes
from sphinx import addnodes
from sphinx.domains.std import Cmdoption
from sphinx.locale import _
from sphinx.util.docfields import TypedField
class jsxmacro(nodes.Inli... | lingui/js-lingui | docs/_ext/linguidocs.py | Python | mit | 2,809 |
import logging
import time
import cStringIO
from PIL import Image
from libmproxy.protocol.http import decoded
import re
def request(context, flow):
try:
logging.debug("request")
if (flow.request.pretty_host(hostheader=True).endswith("docs.google.com")):
#logging.debug("Before:")
... | infosec-216/alice | google_table_repl.py | Python | mit | 1,227 |
from django.shortcuts import render_to_response, get_object_or_404
from django.http import JsonResponse, HttpResponseRedirect
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.views.decorators.csrf import csrf_exempt
from django.db.models import Avg
from django.db impor... | pulkitpahwa/smart-image-coordinates | smarter/base/views.py | Python | mit | 9,603 |
<% if (djangoVersion != '2.0') { %>
from django.conf.urls import url, include
<% } else { %>
from django.urls import path, include
<% } %>
from django.contrib import admin
from <%= appName %> import views
<% if (includeLoginPage == true) { %>
from <%= appName %>.forms import AuthenticationForm
from django.contrib.auth.... | dfurtado/generator-djangospa | generators/app/templates/root/appfiles/urls.py | Python | mit | 1,320 |
import json
import unittest
import billboard
class TestCurrentGreatestHot100Singles(unittest.TestCase):
"""Checks that the ChartData object for the current Greatest Hot 100
Singles chart has entries and instance variables that are valid and
reasonable. Does not test whether the data is actually correct.
... | jameswenzel/billboard-charts | tests/test_greatest_hot_100_singles.py | Python | mit | 1,451 |
#!/usr/bin/env python
"""
A toolkit for identifying and advertising service resources.
Uses a specific naming convention for the Task Definition of services. If you
name the Task Definition ending with "-service", no configuration is needed.
This also requires that you not use that naming convention for task definiti... | simonluijk/aws-ecs-service-discovery | register.py | Python | mit | 6,803 |
#!/usr/bin/env python
# Data manager for reference data for the QIIME Galaxy tools
import argparse
import ftplib
import json
import os
import tarfile
import zipfile
import requests
protocol = {
"unite": "http",
"greengenes": "ftp",
"silva": "http",
"img": "ftp"
}
baseUrl = {
"unite": "http://uni... | blankclemens/tools-iuc | data_managers/data_manager_qiime_database_downloader/data_manager/data_manager_qiime_download.py | Python | mit | 11,147 |
#-*- encoding: utf-8 -*-
"""
Right triangles with integer coordinates
The points P (x1, y1) and Q (x2, y2) are plotted at integer co-ordinates and are joined to the origin, O(0,0), to form ΔOPQ.
There are exactly fourteen triangles containing a right angle that can be formed when each co-ordinate lies between 0 and... | zlsun/ProjectEuler | 091.py | Python | mit | 484 |
"""LaTeX Exporter class"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import os
from traitlets import Unicode, default
from traitlets.config import Config
from nbconvert.filters.highlight import Highlight2Latex
from nbconvert.filters.filter_links import reso... | nitin-cherian/LifeLongLearning | Python/PythonProgrammingLanguage/Encapsulation/encap_env/lib/python3.5/site-packages/nbconvert/exporters/latex.py | Python | mit | 3,419 |
'''
Opcode d(11:8) Operand d(7:0) Operation
0 8 bits representing a constant Load constant to Reg0
1 8 bits representing a constant Load constant to Reg1
2 d7 selects register Reg0 or Reg1 Load value of selected register to the... | BryceBesler/ENEL453-Assembler | testCases/TestCasesRan/14-03-14--21-39/assembly.py | Python | mit | 11,254 |
from persistence.models import Agent, BaseModel
from peewee import *
class Message(BaseModel):
"""description of class"""
correlationid = CharField()
category = IntegerField()
body = CharField(null=True)
sender = ForeignKeyField(Agent, related_name='send_messages')
receiver = ForeignKeyField(... | onnovalkering/sparql-over-sms | sos-service/src/persistence/models/message.py | Python | mit | 1,021 |
total = 0
n = 0
stop = 0
nextMark = input('Type in a mark: ')
while stop == 0:
nextMark = eval(nextMark)
total = total+nextMark
n = n + 1
nextMark = input('Hit enter to stop, or type in a mark: ')
if nextMark == "":
stop = 1
print("You entered", n, 'marks. The average is:',to... | MrColwell/PythonProfessionalLearning | PythonForTeachers/studentExercises/8_2_average.py | Python | mit | 339 |
from iota.crypto import FRAGMENT_LENGTH
from iota.exceptions import with_context
from iota.types import Hash, TryteString, TrytesCompatible
__all__ = [
'BundleHash',
'Fragment',
'TransactionHash',
'TransactionTrytes',
'Nonce'
]
class BundleHash(Hash):
"""
An :py:class:`TryteString` (:py:c... | iotaledger/iota.lib.py | iota/transaction/types.py | Python | mit | 2,751 |
import re
from time import sleep
from .settings import settings
def get_parsed_mentions(raw_text):
regex = re.compile(r"@([\w\.]+)")
regex.findall(raw_text)
return regex.findall(raw_text)
def get_parsed_hashtags(raw_text):
regex = re.compile(r"#(\w+)")
regex.findall(raw_text)
return regex.f... | huaying/ins-crawler | inscrawler/fetch.py | Python | mit | 5,418 |
"""
Tests for core and utility classes
"""
import unittest
from pandas_accounting import Company, Subsidiary
class TestCompany(unittest.TestCase):
def setUp(self):
self.C = Company(shares=100)
def test_company_shares(self):
self.assertEqual(self.C.shares, 100)
class TestSubsidiary(unittes... | davidastephens/pandas-accounting | pandas_accounting/core/tests/test_core.py | Python | mit | 439 |
#!/usr/bin/env python
import click
from aeriscloud.cli.helpers import standard_options, Command
@click.command(cls=Command)
@standard_options(start_prompt=False)
def cli(box):
"""
Destroy a box
"""
box.destroy()
if __name__ == '__main__':
cli()
| AerisCloud/AerisCloud | aeriscloud/cli/aeris/destroy.py | Python | mit | 271 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-11 03:42
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('students', '0007_auto_20170410_0523'),
('job', '001... | jamesaud/se1-group4 | jmatcher/job/migrations/0016_auto_20170411_0342.py | Python | mit | 2,381 |
from .db_utils import PostgresController
from .enums import Action, Change
__all__ = ['PostgresController', 'Action', 'Change']
| dashwav/nano-chan | cogs/utils/__init__.py | Python | mit | 129 |
"""
bamboo.globals
~~~~~~~~~~~~~
"""
from peak.util.proxies import CallbackProxy
from bamboo.context import context
db = CallbackProxy(lambda: context["db"])
| hahnicity/bamboo | bamboo/globals.py | Python | mit | 159 |
"""Plot spatial P-E"""
import re
import sys
script_dir = sys.path[0]
import os
import pdb
import argparse
import numpy as np
import matplotlib.pyplot as plt
import iris
from iris.experimental.equalise_cubes import equalise_attributes
import cartopy.crs as ccrs
import cmdline_provenance as cmdprov
repo_dir = '/'.join... | DamienIrving/ocean-analysis | visualisation/water_cycle/plot_pe_spatial.py | Python | mit | 9,330 |
from flask.ext.admin.contrib.mongoengine import ModelView
from .models import Prediction
from app.management.mixins import AdminMixin
class PredictionView(AdminMixin, ModelView):
column_searchable_list = ('text',)
| piotrdubiel/scribeserver | app/recognition/admin.py | Python | mit | 220 |
from django.db import models
class EventTeam(models.Model):
name = models.CharField(max_length=100)
class Event(models.Model):
team1 = models.ForeignKey(EventTeam, null=True, related_name='opponent1')
team2 = models.ForeignKey(EventTeam, null=True, related_name='opponent2')
start_at = models.DateTi... | sporteasy/sporteasy_breaking_mvc | sporteasy_breaking_mvc/core/models.py | Python | mit | 665 |
"""
Django settings for urlscript project.
Generated by 'django-admin startproject' using Django 1.9.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
... | theju/urlscript | urlscript/settings.py | Python | mit | 3,699 |
from bs4 import BeautifulSoup
from django.conf import settings
from django.contrib.gis import admin
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.forms.formsets import formset_factory
from django.http import HttpResponseRedirect
from django.utils.translation ... | geonition/geoforms | geoforms/admin.py | Python | mit | 17,493 |
import pandas as pd
import numpy as np
import scipy as sp
import sys
import warnings
import copy
import operator
import sklearn
from slicer import Slicer, Alias, Obj
# from ._order import Order
from .utils._general import OpChain
# slicer confuses pylint...
# pylint: disable=no-member
op_chain_root = OpChain("shap.... | slundberg/shap | shap/_explanation.py | Python | mit | 32,276 |
from werkzeug.contrib.fixers import ProxyFix
from app import app
app.wsgi_app = ProxyFix(app.wsgi_app)
| ulope/nearest_pypi | wsgi.py | Python | mit | 104 |
# -*- coding: utf-8 -*-
from dp_tornado.engine.controller import Controller
class MmddController(Controller):
def get(self):
self.model.tests.helper_test.datetime.switch_timezone('Asia/Seoul')
ts = 1451671445
ms = ts * 1000
dt = self.helper.datetime.convert(timestamp=ts)
... | why2pac/dp-tornado | example/controller/tests/view/ui_methods/mmdd.py | Python | mit | 1,216 |
from django.db import models
from fms import constants as FC
from django.utils import timezone
from django.core.files import File
from django.core.exceptions import ObjectDoesNotExist
class DocumentCategory(models.Model):
name = models.CharField(max_length=30, null=False, blank=False)
code = models.CharField(max_l... | jagannath93/File-Management-System | fms/models.py | Python | mit | 6,299 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from accounts.models import Profile
from django import forms
from django.conf import settings
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
from django.contrib.auth.models import User
from django.utils import formats, timezon... | genonfire/bbgo | accounts/forms.py | Python | mit | 3,484 |
"""
automatic_questioner
--------------------
Module which serves as a interactor between the possible database with the
described structure and which contains information about functions and
variables of other packages.
Scheme of the db
----------------
# {'function_name':
# {'variables':
# {'variabl... | tgquintela/pythonUtils | pythonUtils/TUI_tools/automatic_questioner.py | Python | mit | 19,433 |
import logging
import time
import os
# will change these to specific imports once code is more final
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5 import uic
BRUSH_WHITE = QBrush(QColor(255, 255, 255), Qt.SolidPattern)
BRUSH_GREEN = QBrush(QColor(0, 255, 0), Qt.SolidPat... | missionpinball/mpf-monitor | mpfmonitor/core/devices.py | Python | mit | 13,716 |
import os
from select import select
from subprocess import PIPE
import sys
import time
from itertools import chain
from plumbum.commands.processes import run_proc, ProcessExecutionError
from plumbum.commands.processes import BY_TYPE
import plumbum.commands.base
from plumbum.lib import read_fd_decode_safely
class Fut... | AndydeCleyre/plumbum | plumbum/commands/modifiers.py | Python | mit | 16,698 |
# -*- coding: utf-8 -*-
"""
Clase C{TypeDeclarationNode} del árbol de sintáxis abstracta.
"""
from pytiger2c.ast.declarationnode import DeclarationNode
class TypeDeclarationNode(DeclarationNode):
"""
Clase C{TypeDeclarationNode} del árbol de sintáxis abstracta.
Representa las distintas declaracione... | yasserglez/pytiger2c | packages/pytiger2c/ast/typedeclarationnode.py | Python | mit | 1,319 |
import sdl2
from mgl2d.input.game_controller import GameController
class JoystickController(GameController):
_DEBUG_CONTROLLER = False
AXIS_DEAD_ZONE = 4000
AXIS_MIN_VALUE = -32768
AXIS_MAX_VALUE = 32767
def __init__(self):
super().__init__()
self._sdl_controller = None
s... | maxfish/mgl2d | mgl2d/input/joystick_controller.py | Python | mit | 2,557 |
# -*- coding: utf-8 -*-
#
# MIT License
#
# Copyright (c) 2017 Michal Stefanik <stefanik dot m@mail.muni.cz>, Tomas Jirsik <jirsik@ics.muni.cz>
# Institute of Computer Science, Masaryk University
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated document... | CSIRT-MU/Stream4Flow | applications/statistics/hosts_profiling/spark/host_daily_profile.py | Python | mit | 13,684 |
#!/usr/bin/env python
import unittest
import securetrading
from securetrading.test import abstract_test_stobjects
import six
class Test_Request(abstract_test_stobjects.Abstract_Test_StObjects):
def setUp(self):
super(Test_Request, self).setUp()
self.class_ = securetrading.Request
def test___... | Secure-Trading/PythonAPI | securetrading/test/test_requestobject.py | Python | mit | 5,171 |
# coding: utf-8
from users import models as m
# write your business logic here
| asyncee/django-project-template | src/users/services.py | Python | mit | 81 |
from django.contrib import admin
from .models import Catalog, Item
admin.site.register(Catalog)
admin.site.register(Item)
| JacekKarnasiewicz/HomePage | apps/tree_traversal/admin.py | Python | mit | 124 |
"""
A simple HTTP interface for making GET, PUT and POST requests.
"""
import http.client
import json
from urllib.parse import urlparse, urlencode # NOQA
from base64 import b64encode
from functools import partial
from collections import namedtuple
Response = namedtuple("Response", ("payload", "headers", "status", "i... | ddevlin/GitSavvy | common/interwebs.py | Python | mit | 2,509 |