code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf8
from __future__ import division, print_function
import numpy as np
def least_square(xpts, ypts):
'''
Performs a basic least square regression for a curve:
y = ax + b
Returns estimated (a, b), residuals array and totals
arrays. We need this method because numpy... | flaviovdf/vodlibs | vod/stats/fit.py | Python | mit | 1,139 |
import random
import os
from utils import *
def speak(text):
os.system('espeak -a 200 "' + text + ' &"')
speed = 100
dirmv = 1
while True:
er = move(10, dirmv * speed, True)
# if it hits an obstacle
if er is -1:
speak('Ops an obstacle!')
dirmv *= -1
move(4, dirmv * speed, False)
#rota... | andrei-alpha/robotics | old/obstacle_without_sensors.py | Python | mit | 477 |
"""
WSGI config for mymenu 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... | quangnguyen-asnet/python-django | mymenu/mymenu/wsgi.py | Python | mit | 389 |
from collections import OrderedDict
from sympy import true
from devito.tools import as_tuple, is_integer, memoized_meth
from devito.types import Dimension
__all__ = ['Vector', 'LabeledVector', 'vmin', 'vmax']
class Vector(tuple):
"""
An object in an N-dimensional space.
The elements of a vector can b... | opesci/devito | devito/ir/support/vector.py | Python | mit | 14,039 |
#!/usr/bin/env python
import sys
# import particle restart
sys.path.append('../../src/utils')
import particle_restart as pr
# read in particle restart file
if len(sys.argv) > 1:
p = pr.Particle(sys.argv[1])
else:
p = pr.Particle('particle_12_842.binary')
# set up output string
outstr = ''
# write out pro... | shenqicang/openmc | tests/test_particle_restart_eigval/results.py | Python | mit | 1,055 |
#!/usr/bin/env python
"""
Unscientific benchmarking of this versus the --release rust
implementation below using the %timeit Ipython magic (times in sec)
n_kmers, py_runtime, rust_runtime
6594204, 14.4, 0.578
Both give identical counts on the files tested (and printing kmers out
and diff'ing the resul... | bovee/needletail | bench/benchmark.py | Python | mit | 1,291 |
import logging
import sys
logging.getLogger("aiohttp").setLevel(logging.WARNING)
logging.getLogger("asyncio").setLevel(logging.WARNING)
logging.getLogger("urllib3.connectionpool").setLevel(logging.WARNING)
class Log(object):
def __init__(self, name):
self.name = name
logging.basicC... | alekLukanen/pyDist | pyDist/comms/Logging.py | Python | mit | 516 |
from django import forms
from django_registration.forms import RegistrationForm
from .models import Team, User
class UserRegistrationForm(RegistrationForm):
class Meta(RegistrationForm.Meta):
model = User
fields = [
'username',
'email',
'password1',
... | bit-bots/imagetagger | src/imagetagger/users/forms.py | Python | mit | 473 |
import os
import sys
import getopt
import json
def main(argv):
"""Specify input to generator with:
-s : save path
-f : model_def folder
"""
opts, args = getopt.getopt(argv,"s:f:")
save_location = "models/ddpg_models/"
model_def_folder = ""
print(opts)
for opt, arg in opts:
... | fizz-ml/pytorch-aux-reward-rl | model_generator.py | Python | mit | 671 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @file graph_session.py
# @brief
# @author QRS
# @blog qrsforever.github.io
# @version 1.0
# @date 2019-05-30 18:22:35
################################ jupyter-vim #######################################
# https://github.com/qrsforever/vim/blob/master/bundle/.configs/jupyt... | qrsforever/workspace | ML/learn/tensorflow.google.cn/low_level/graph_session.py | Python | mit | 2,151 |
import pandas
def get_hourly_entries(df):
"""
The data in the MTA Subway Turnstile data reports on the cumulative
number of entries and exits per row. Assume that you have a dataframe
called df that contains only the rows for a particular turnstile machine
(i.e., unique SCP, C/A, and UNIT). This... | angelmtenor/IDSFC | L2_Data_Wrangling/P8_get_hourly_entries_and_exits.py | Python | mit | 2,645 |
from __future__ import with_statement
from pyramid.view import view_config
from pyramid.renderers import render
from intranet3.utils.views import BaseView
from intranet3.models import (
User,
TimeEntry,
Tracker,
Project,
Client,
DBSession,
)
from intranet3.forms.times import ProjectsTimeForm, ... | stxnext/intranet-open | src/intranet3/intranet3/views/times/tickets.py | Python | mit | 4,991 |
from __future__ import division
from builtins import zip
from builtins import map
from builtins import range
__all__ = ['Categorical', 'CategoricalAndConcentration', 'Multinomial',
'MultinomialAndConcentration', 'GammaCompoundDirichlet', 'CRP']
import numpy as np
from warnings import warn
import scipy.stats... | mattjj/pybasicbayes | pybasicbayes/distributions/multinomial.py | Python | mit | 17,570 |
from tomlkit import dumps
from tomlkit import loads
def test_write_backslash():
d = {"foo": "\\e\u25E6\r"}
expected = """foo = "\\\\e\u25E6\\r"
"""
assert expected == dumps(d)
assert loads(dumps(d))["foo"] == "\\e\u25E6\r"
def test_escape_special_characters_in_key():
d = {"foo\nbar": "baz"}
... | sdispater/tomlkit | tests/test_write.py | Python | mit | 437 |
import io, os, re, subprocess, sys
#@snip/WorkDir[
#@requires: mod:os
class WorkDir(object):
'''A context manager for changing to a different working directory. The
original working directory is restored upon exiting the context.'''
def __init__(self, path):
'''Initialize a context for changing t... | Rufflewind/calico | tools/utils.py | Python | mit | 5,989 |
from django import forms
class ContactForm(forms.Form):
name = forms.CharField(label='Nombre', max_length=100)
file = forms.ImageField(label='Imagen')
message = forms.CharField(label='Mensaje', max_length=100)
| andree1320z/deport-upao-web | deport_upao/core/forms.py | Python | mit | 224 |
#!/usr/bin/env python
"""Script to read the libphonenumber per-prefix metadata and generate Python code.
Invocation:
buildprefixdata.py [options] indir outfile module_prefix
Processes all of the per-prefix data under the given input directory and emit
generated Python code.
Options:
--var XXX : use this prefix f... | Mitali-Sodhi/CodeLingo | Dataset/python/buildprefixdata.py | Python | mit | 8,450 |
import rogueutil as rutil
import libtcodpy as libtcod
def roll_to_hit(attacker, defender, messagefunction, player_actor):
roll = rutil.roll(100)
atck_bonus = fatigue_bonus(defender.fighter.fatigue, defender.fighter.max_fatigue)
defender_bonus = fatigue_bonus(attacker.fatigue, attacker.max_fatigue)
... | lantra/vugamedev | src/combat.py | Python | mit | 5,778 |
from botlang.evaluation.values import NativeException
def is_exception(value):
return isinstance(value, NativeException)
def try_catch_complete(process, failure,
after_execution=lambda: None, prod=True):
exception = None
try:
value = process()
if is_exception(value... | PostCenter/botlang | botlang/environment/primitives/exceptions.py | Python | mit | 1,226 |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""Module docstring.
This serves as a long usage message.
"""
import configargparse
from cli_app import log
LOG = log.Logger.get()
class Options(object):
def __init__(self):
self.parser = configargparse.ArgParser(
default_config_files=['./conf... | xamurej/py3-cli-skel | cli_app/options.py | Python | mit | 888 |
#DEPRECATED
import csv
import numpy
# Load var info
researched_var='le'
researched_index=0
result=numpy.zeros((31112,1))
count=0
with open('output/prepared_data.csv', 'rb') as datafile:
datareader = csv.reader(datafile, delimiter=';', quotechar='"')
num_row = 0
header=next(datareader)
for i in ... | Diviyan-Kalainathan/causal-humans | DimensionalityReduction/data_reader.py | Python | mit | 2,112 |
# -*- coding: utf-8 -*-
#
# traceview documentation build configuration file, created by
# sphinx-quickstart on Fri May 2 20:12:10 2014.
#
# 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
# autogenerated file.
#
#... | danriti/python-traceview | docs/conf.py | Python | mit | 8,222 |
class Boleto:
def __init__(self, ano_mes, vencimento, mensalidade, dependencia, desconto, liquido, situacao):
self.ano_mes = ano_mes
self.vencimento = vencimento
self.mensalidade = mensalidade
self.dependencia = dependencia
self.desconto = desconto
self.liquido = liqu... | SamuelTM/univapi | stm/univapi/modelos/boleto.py | Python | mit | 357 |
from django.conf.urls import patterns, include, url
from django.conf import settings
urlpatterns = patterns('',
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', \
{'document_root': settings.MEDIA_ROOT, 'show_indexes':True}),
url(r'', include('controller.urls')),
url('^.*/$', 'controller.v... | oskgeek/xmccamp | xmccamp/xmccamp/urls.py | Python | mit | 338 |
from ctypes import c_int, c_double, c_void_p
from devito.types import CompositeObject, LocalObject, Symbol
__all__ = ['Timer', 'VoidPointer', 'VolatileInt', 'c_volatile_int',
'c_volatile_int_p']
class Timer(CompositeObject):
def __init__(self, name, sections):
super().__init__(name, 'profile... | opesci/devito | devito/types/misc.py | Python | mit | 1,443 |
from datetime import datetime, timedelta
import random
from django.db import models
from django.core.exceptions import ValidationError
from django.conf import settings
from django.utils.functional import cached_property
from drip.utils import get_user_model
# just using this to parse, but totally insane package nami... | alexphelps/django-drip | drip/models.py | Python | mit | 6,448 |
# -*- coding: UTF-8 -*-
import responses
from helpers import TestCase
from wptranslate.mediawiki import query
class TestMediaWiki(TestCase):
def setUp(self):
self.lang = 'foo'
self.url = 'https://%s.wikipedia.org/w/api.php' % self.lang
@responses.activate
def test_query_return_none_on_... | bfontaine/wptranslate | tests/test_mediawiki.py | Python | mit | 1,013 |
from HG_Code.HG_Test import UnitTest as UT
from HG_Code import Model as mo
from HG_Code.Visualize import Visualizer
from HG_Code.SimManager import sim_manager
from HG_Code.Hunger_Grid import hunger_grid
from HG_Code.Kat import Kat
from HG_Code import hg_settings
from HG_Code import Mutate as mu
unitTest = UT.Run_Unit_... | TeamADEA/Hunger_Games | HG_Driver.py | Python | mit | 1,353 |
#!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test REST interface
#
from test_framework import BitcoinTestFramework
from util import *
import json
try... | fastcoinproject/fastcoin | qa/rpc-tests/rest.py | Python | mit | 3,264 |
import os, sys, array
import numpy as np
class BigFile:
def __init__(self, datadir):
self.nr_of_images, self.ndims = map(int, open(os.path.join(datadir,'shape.txt')).readline().split())
id_file = os.path.join(datadir, "id.txt")
self.names = open(id_file).read().strip().split()
asse... | li-xirong/jingwei | util/simpleknn/bigfile.py | Python | mit | 3,569 |
#! /user/bin/env python
__version__ = '0.8.54'
| jalanb/jab | src/python/__init__.py | Python | mit | 48 |
# -*- coding: utf-8 -*-
from ccxt.async.base.exchange import Exchange
import math
import json
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import InsufficientFunds
from ccxt.base.errors import InvalidOrder
from ccxt.base.errors import OrderNotFound
class qryptos (Exchange):
def describe(self... | tritoanst/ccxt | python/ccxt/async/qryptos.py | Python | mit | 12,912 |
import os
import numpy as np
import pytest
from spectrum_overload import Spectrum
from mingle.utilities.spectrum_utils import load_spectrum, select_observation
@pytest.mark.parametrize("fname", ["HD30501-1-mixavg-tellcorr_1.fits", "HD30501-1-mixavg-h2otellcorr_1.fits"])
def test_load_spectrum(fname):
fname = os... | jason-neal/companion_simulations | tests/utilities/test_spectrum_utils.py | Python | mit | 1,224 |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import re
import json
import boto3
import logging
import pystache
import unicodedata
from elasticsearch import Elasticsearch
import settings
logger = logging.getLogger(__name__)
logger.setLevel(settings.LOG_LEVEL)
class Event(dict):
... | KunihikoKido/aws-lambda-es-suggest | lambda_function.py | Python | mit | 2,422 |
# http://www.codingdojo.org/cgi-bin/index.pl?KataPokerHands
import poker_hands as pk
import unittest
class PokerHandsTest(unittest.TestCase):
def test_case_1_should_lose_high_card_ace(self):
a = ["2H", "3D", "5S", "9C", "KD"]
b = ["2C", "3H", "4S", "8C", "AH"]
result = pk.poker_hands(a, ... | ibotdotout/coe-pairing | tests/poker_hands_test.py | Python | mit | 13,620 |
__author__ = 'cjk4wr'
print("test!")
| cjk4wr/cs3240-labdemo | Test.py | Python | mit | 38 |
#!/usr/bin/python
import json
from urllib import urlopen
import requests
import getpass
from string import Template
import sys
import os
import subprocess
class RunError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
def run(command, **kwar... | aqavi-paracha/coinsbazar | qa/pull-tester/pull-tester.py | Python | mit | 8,761 |
from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
from .consumers import PRESENCE_ROOM
from .models import Campaign
def connect_info_object(sender, **kwargs):
reference = kwargs.get("reference")
if not reference:
reference = sender.reference
if not reference:
... | okfde/froide-campaign | froide_campaign/listeners.py | Python | mit | 1,213 |
# 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 ... | rjschwei/azure-sdk-for-python | azure-mgmt-logic/azure/mgmt/logic/models/x12_processing_settings.py | Python | mit | 2,753 |
import os
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
import prefs
db = SQLAlchemy()
def create_flask_app():
app = Flask(__name__, template_folder=os.path.join(prefs.Config.APPLICATION_ROOT, 'templates'), static_folder=os.path.join(prefs.Config.APPLICATION_ROOT, 'static'))
app.config... | apostrophest/ingroup | database.py | Python | mit | 382 |
# file = open("data\\accounting.dat")
file = open("D:\\JudgesData\\accounting.dat")
costs = []
while True:
price = list(''.join(file.readline().rstrip("\r\n").split(',')))
if price == []: break
del price[0]
if price[0] == '(':
del price[0]
del price[-1]
price = -float(''.join(p... | timtim17/PSCSTA | Accounting.py | Python | mit | 1,055 |
# Problem:
# Write a program that enters a password (one line with any text) and
# checks if it is entered matches the phrase "s3cr3t! P @ ssw0rd".
# In case of a collision, bring "Welcome".
# In case of inconsistency "Wrong Password!"
password = input()
if password == "s3cr3t!P@ssw0rd":
print("Welcome")
else:
... | YaniLozanov/Software-University | Python/PyCharm/03.Logical checks/09.Password Guess.py | Python | mit | 348 |
import sys
from math import ceil
def main():
AREA = 1.76
w = float(input())
h = float(input())
print(ceil(w * h / AREA))
if __name__ == "__main__":
sys.exit(int(main() or 0)) | ttitto/python | Basics/SampleExam/MostCommonCharacter/paint_bottles.py | Python | mit | 196 |
#!/usr/bin/python3
import subprocess, shutil, os, sqlite3, re
import utils
from email_validator import validate_email as validate_email_, EmailNotValidError
import idna
def validate_email(email, mode=None):
# Checks that an email address is syntactically valid. Returns True/False.
# Until Postfix supports SMTPUTF8,... | choltha/mailinabox | management/mailconfig.py | Python | cc0-1.0 | 21,317 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt (Qt v4.8.5)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x01\x82\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x17\x00\... | jhemmi/QgisDiffPlugin | resources_rc.py | Python | cc0-1.0 | 2,620 |
import requests, zipfile, subprocess, csv, json
update_data_file = 'http://data.octo.dc.gov/feeds/dcra_building_permits/dcra_building_permits_current_csv.zip'
zip_filename = 'dcra_building_permits_current_csv.zip'
# Gather the file
zip_request = requests.get('http://data.octo.dc.gov/feeds/dcra_building_permits/dcra_b... | dfdx2/ancfinder | scripts/update_building_permits.py | Python | cc0-1.0 | 1,929 |
class Solution(object):
def reverseList(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
pre = None
while head:
temp = head.next
head.next = pre
pre = head
head = temp
return pre | darkpeach/AlgorithmCoding | _206_ReverseLinkedList.py | Python | epl-1.0 | 297 |
import win32ui
import win32con
import win32api
import string
import commctrl
import pythoncom
from pywin.mfc import dialog
error = "TypeLib browser internal error"
FRAMEDLG_STD = win32con.WS_CAPTION | win32con.WS_SYSMENU
SS_STD = win32con.WS_CHILD | win32con.WS_VISIBLE
BS_STD = SS_STD | win32con.WS_TABST... | Southpaw-TACTIC/Team | src/python/Lib/site-packages/win32com/client/tlbrowse.py | Python | epl-1.0 | 8,026 |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | sadanandb/pmt | src/tactic/ui/chart/chart2_wdg.py | Python | epl-1.0 | 27,920 |
import random
class Player(object):
def __init__(self,name):
self.name = name
self.alive = True
self.gold = 100
self.health = random.randint(3,12)
self.Image = "images/hero.jpg"
self.x = 100
self.y = 260
self.sound = "audio/hero_attack.wav"
... | bmccurry/simpleRPG | Player.py | Python | epl-1.0 | 2,570 |
import redis
import json
from flask import current_app
class CachingService:
rc = None
def cache(self):
if self.rc is None:
self.rc = redis.StrictRedis(host=current_app.config['CACHE_HOST'], port=current_app.config['CACHE_PORT'], db=0)
return self.rc
def get(self, key: str) ->... | gengstrand/clojure-news-feed | server/feed5/swagger_server/services/caching_service.py | Python | epl-1.0 | 640 |
__author__ = 'pvarenik'
from sys import maxsize
class Group:
def __init__(self, name=None, header=None, footer=None, id=None):
self.name = name
self.header = header
self.footer = footer
self.id = id
def __repr__(self):
return "%s,%s,%s,%s" % (self.id, self.name, self.h... | pvarenik/PyCourses | model/group.py | Python | gpl-2.0 | 592 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 Smile (<http://www.smile.fr>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under th... | 3dfxsoftware/cbss-addons | smile_access_control/res_group.py | Python | gpl-2.0 | 4,958 |
# Made by zhantyzgz and fixed by me (luksireiku)
from core.utils import *
commands = [
('/nowplaying', ['user'])
]
description = 'Returns what you are or were last listening to. If you specify a username, info will be returned for that username.'
shortcut = '/np'
def run(m):
username = get_input(m)
if n... | zhantyzgz/polaris | plugins/lastfm.py | Python | gpl-2.0 | 2,882 |
#!/usr/bin/env python3
# Dogtail demo script
from dogtail.config import config
#config.debugSleep = True
#config.debugSearching = True
#config.debugTranslation = True
import dogtail.tc
from dogtail.procedural import *
from dogtail.utils import screenshot
from dogtail.predicate import GenericPredicate
# These next tw... | martiinsiimon/dogtail | examples/gedit-test-utf8-procedural-api.py | Python | gpl-2.0 | 3,778 |
#!/usr/bin/env python
# coding: utf-8
"""
PairsApi.py
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
... | QuantiModo/QuantiModo-SDK-Python | SwaggerPetstore/apis/pairs_api.py | Python | gpl-2.0 | 5,412 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Vamos a programar una calculadora
import sys
# convierto el operando sea int o float a float
def numerical_float(operando):
return float(operando)
def suma(sum1, sum2):
return sum1 + sum2
def resta(rest1, rest2):
return rest1 - rest2
def resultado(opera... | vmartinezf/ptavi-p2 | calc.py | Python | gpl-2.0 | 980 |
import sys
import os
import shlex
import argparse
def blockPrint():
sys.stdout = open(os.devnull, 'w')
# Restore
def enablePrint():
sys.stdout = sys.__stdout__
cap = raw_input("Enter parameters for the capacitor : (Enter blank for default values)\n")
XY = raw_input("Enter parameters for the XY Control : (Ent... | McDermott-Group/Simulation | Mask Automation/main.py | Python | gpl-2.0 | 1,940 |
#!/usr/bin/env python
import argparse
import os
import psycopg2
from settings import connection_string
import csv
__author__ = 'John J. Horton'
__copyright__ = 'Copyright (C) 2012 John Joseph Horton'
__license__ = 'All rights reserved'
__maintainer__ = 'johnjosephhorton'
__email__ = 'john.joseph.horton@gmail.com'
_... | johnjosephhorton/runSQL | runSQL.py | Python | gpl-2.0 | 2,185 |
import glob, os, sys,fnmatch
import matplotlib.pyplot as plt
from astropy.io import ascii
import numpy as np
def match_list_values(ls1,ls2):
#Return lists of the indices where the values in two lists match
#It will return only the first index of occurrence of repeating values in the lists
#Written by Kame... | kkozarev/mwacme | casa_commands_instructions/plot_max_spectra_calibrated.py | Python | gpl-2.0 | 12,151 |
"""Utilities to enable code objects to be pickled.
Any process that import this module will be able to pickle code objects. This
includes the func_code attribute of any function. Once unpickled, new
functions can be built using new.function(code, globals()). Eventually
we need to automate all of this so that functi... | iproduct/course-social-robotics | 11-dnn-keras/venv/Lib/site-packages/ipykernel/codeutil.py | Python | gpl-2.0 | 1,319 |
#!/usr/bin/env python
""" Calculate the Julian Date """
import time
import math
t = time.time()
""" Technically, we should be adding 2440587.5,
however, since we are trying to stick to the stardate
concept, we add only 40587.5"""
jd = (t / 86400.0 + 40587.5)
# Use the idea that 10 Julian days is equal to 1 ... | casep/Molido | sdate.py | Python | gpl-2.0 | 350 |
#!/usr/bin/env python
import argparse
import sys
import time
import MySQLdb
def main():
arg_parser = argparse.ArgumentParser(
description="Open connections to MySQL and then optionally execute a payload."
)
arg_parser.add_argument(
"host",
help="MySQL server"
)
arg_parser.add_argument(
"--... | chao-mu/mysql-repeater | mysql-flood.py | Python | gpl-2.0 | 5,834 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-02-01 22:07
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('links', '0006_auto_20170201_1756'),
]
operations = [
migrations.RenameField(
... | amadeusproject/amadeuslms | links/migrations/0007_auto_20170201_1907.py | Python | gpl-2.0 | 440 |
# -*- python -*-
# Copyright (C) 2009-2017 Free Software Foundation, Inc.
# 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 versio... | jocelynmass/nrf51 | toolchain/arm_cm0/arm-none-eabi/lib/thumb/v7-ar/fpv3/hard/libstdc++.a-gdb.py | Python | gpl-2.0 | 2,493 |
#!/usr/bin/env python
import os
from collections import defaultdict
from glob import glob
import click
import csv
from ninja_utils.parsers import FASTQ
from dojo.taxonomy.maps import RefseqCatalogMap
@click.command()
@click.argument('path', type=click.Path(exists=True))
@click.option('-v', '--verbose', is_flag=Tru... | knights-lab/NINJA-DOJO | dojo/scripts/extract_ncbi_tid_from_mp2_gold.py | Python | gpl-2.0 | 1,651 |
'''app.notify.sms_announce'''
import os
import twilio
from flask import g, request
from datetime import datetime, date, time, timedelta
from dateutil.parser import parse
from pymongo.collection import ReturnDocument
from app import get_keys, colors as c
from app.main.etapestry import call, get_prim_phone, EtapError, ge... | SeanEstey/Bravo | app/notify/sms_announce.py | Python | gpl-2.0 | 2,703 |
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# 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 2
# of the License, or (at your option) any later versi... | gemrb/gemrb | gemrb/GUIScripts/GUISONGS.py | Python | gpl-2.0 | 2,309 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2007 Donald N. Allingham
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2008 Jerome Rapinat
# Copyright (C) 2008 Benny Malengier
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the ... | Forage/Gramps | gramps/gen/filters/rules/media/_hassourcecount.py | Python | gpl-2.0 | 1,807 |
###############################################################################
# This file is part of openWNS (open Wireless Network Simulator)
# _____________________________________________________________________________
#
# Copyright (C) 2004-2007
# Chair of Communication Networks (ComNets)
# Kopernikusstr. 16, D-... | openwns/wrowser | openwns/wrowser/probeselector/DirectoryReaders.py | Python | gpl-2.0 | 2,528 |
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
import yaml
from cfme import test_requirements
from cfme.intelligence.reports.schedules import ScheduleCollection
from cfme.intelligence.reports.widgets import AllDashboardWidgetsView
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.util... | anurag03/integration_tests | cfme/tests/intelligence/reports/test_crud.py | Python | gpl-2.0 | 8,992 |
"""
class for storing static results of a tarjan ordering
"""
from scipy.sparse.csc import csc_matrix
from scipy.sparse.csr import csr_matrix
from scipy.sparse.linalg import inv, factorized, spsolve
from scipy.sparse import eye
from scipy.io import savemat, loadmat
import os
from collections import namedtuple
from .... | bkuczenski/lca-tools | antelope_background/background/flat_background.py | Python | gpl-2.0 | 18,042 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.4 on Sun Dec 9 09:55:02 2012
"""Program for calculating calibration curves for travelling wave ion
mobility mass spectrometry"""
__author__ = "Ganesh N. Sivalingam <g.n.sivalingam@gmail.com"
import wx, os
# begin wxGlade: extracode
# end wxGl... | gnsiva/Amphitrite | gui/CalibrationGui/CalibrationGui.py | Python | gpl-2.0 | 16,785 |
#!/usr/bin/env python
"""
test cache functions.
- save/load
- mmerge
"""
import unittest
import trustlet.igraphXdigraphMatch as IXD
import networkx as nx
import igraph
import os
#import sys
#import random
#import time
class TestIXD(unittest.TestCase):
def setUp(self):
self.g = IXD.XDiGraph()
self.g.add_edge('da... | guaka/trust-metrics | trustlet/unittest/testXDiGraph.py | Python | gpl-2.0 | 3,116 |
#
# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
#
# 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; version 2 of the License.
#
# This program is distributed in th... | mysql/mysql-utilities | mysql/utilities/command/proc.py | Python | gpl-2.0 | 8,819 |
import time, os
import io
import time
import picamera
os.putenv('SDL_VIDEODRIVER', 'fbcon')
os.putenv('SDL_FBDEV' , '/dev/fb1')
os.putenv('SDL_MOUSEDRV' , 'TSLIB')
os.putenv('SDL_MOUSEDEV' , '/dev/input/touchscreen')
os.putenv('SDL_AUDIODRIVER' , 'alsa')
# Create an in-memory stream
#my_stream = io.BytesIO(... | lumened/touch-flux | src/demo.py | Python | gpl-2.0 | 805 |
# -*- coding: utf-8 -*-
import datetime
import unittest
import clowder
import mock
# import psutil
class BaseClowderTestCase(unittest.TestCase):
"""Base class for all clowder test cases."""
def assert_send_contains_data(self, send_mock, key, value):
"""Assert that the given send mock was called wit... | keithhackbarth/clowder_python_client | tests.py | Python | gpl-2.0 | 6,224 |
#!/usr/bin/env python
#-------------------------------------------------------------------------------
# FILE: mymail.py
# PURPOSE: send mail messages and receive commands via email
#
# AUTHOR: Jason G Yates
# DATE: 18-Nov-2016
#
# MODIFICATIONS:
#-----------------------------------------------------------------... | jgyates/genmon | genmonlib/mymail.py | Python | gpl-2.0 | 22,978 |
#!/usr/bin/env python
##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
import builtins as builtin
except ImportError:
import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatib... | pli3/e2-openwbif | plugin/controllers/views/web/getservices.py | Python | gpl-2.0 | 5,478 |
# -*- coding: UTF-8 -*-
# /*
# * Copyright (C) 2013 Libor Zoubek + jondas
# *
# *
# * 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 2, or (at your option)
# * ... | zbyna/plugin.video.sosac.ph | default.py | Python | gpl-2.0 | 2,056 |
# File bothmethods.py
class Methods:
def imeth(self, x): # Normal instance method: passed a self
print([self, x])
def smeth(x): # Static: no instance passed
print([x])
def cmeth(cls, x): # Class: gets class, not instance
print([cls... | simontakite/sysadmin | pythonscripts/learningPython/bothmethods.py | Python | gpl-2.0 | 486 |
import webbrowser
class Movie():
""" This class provides a way to store movie related information."""
def __init__(self, title, storyline, poster,
trailer, duration, rating, release_year, access_name):
self.title = title
self.storyline = storyline
self.poster_url = po... | talib570/movie-trailer-website | media.py | Python | gpl-2.0 | 718 |
"""
Oracle JDK
===========
This module provides tools for installing `Oracle JDK`_
.. _Oracle JDK: http://www.oracle.com/technetwork/java/javase/
"""
from __future__ import with_statement
import re
from fabric.api import run, cd, settings, hide
from fabtools.files import is_link
from fabtools.system import get_ar... | juanantoniofm/accesible-moodle | fabtools/oracle_jdk.py | Python | gpl-2.0 | 3,596 |
from Sire.IO import *
from Sire.Mol import *
from Sire.System import *
from Sire.MM import *
from Sire.Units import *
amber = Amber()
print("Loading the molecules...")
(molecules, space) = amber.readCrdTop("test/io/SYSTEM.crd", "test/io/SYSTEM.top")
print("...all loaded :-)")
protein = molecules[MolNum(2)].molecule... | chryswoods/SireTests | unittests/SireMM/testintracutoff.py | Python | gpl-2.0 | 1,618 |
# Copyright 2004-2012 Tom Rothamel <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, m... | MSEMJEJME/Get-Dumped | renpy/display/im.py | Python | gpl-2.0 | 45,147 |
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------
# Name: sfp_intfiles
# Purpose: From Spidering and from searching search engines, identifies
# files of potential interest.
#
# Author: Steve Micallef <steve@binarypool.com>
#... | Reality9/spiderfoot | modules/sfp_intfiles.py | Python | gpl-2.0 | 6,481 |
#!/usr/bin/env python3
## Estimates errors using Monte Carlo sampling
# Hamish Silverwood, GRAPPA, UvA, 23 February 2015
import numpy as np
import gl_helper as gh
import pdb
import pickle
import sys
import numpy.random as rand
import matplotlib.pyplot as plt
#TEST this will eventually go outside
def ErSamp_gauss_l... | PascalSteger/gravimage | programs/gi_mc_errors.py | Python | gpl-2.0 | 2,025 |
#!/usr/bin/env python
# coding=UTF-8
import os
from multiprocessing import Process, Queue, current_process, Lock
from time import sleep
def ntptest(host):
sleep (10)
return 0
def worker(queue,lock):
lock.acquire()
print 'starting child process with id: ', os.getpid()
print 'parent process:', os.getppid()
lock.... | phocean/netios | test/jc.py | Python | gpl-2.0 | 789 |
from kivy.utils import platform
from kivy.logger import Logger
Logger.info('Loading RevMob module')
if platform() == 'android':
from .android import *
elif platform() == 'ios':
from .ios import *
else:
Logger.warning('[RevMob] Unkown platform: %s' % platform())
| aron-bordin/Kivy-Tutorials | 5_Perception/Perception/revmob/__init__.py | Python | gpl-2.0 | 275 |
# -*- coding: utf-8 -*-
##
## This file is part of Harvesting Kit.
## Copyright (C) 2014 CERN.
##
## Harvesting Kit 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 2 of the
## License, or (at ... | kaplun/harvesting-kit | harvestingkit/jats_package.py | Python | gpl-2.0 | 11,580 |
from django.shortcuts import render_to_response
from django.template import RequestContext
from home.models import HomeImage
def index(request):
info = {}
info['homeImages'] = HomeImage.objects.all().order_by('title').order_by('order')
return render_to_response('home/index.html', { 'info': info }, co... | UTAlan/PhotosByMallie | mallie/home/views.py | Python | gpl-2.0 | 361 |
# -*- coding: utf-8 -*-
""" rituals.util – Helper modules.
"""
# Copyright ⓒ 2015 Jürgen Hermann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in t... | jhermann/rituals | src/rituals/util/__init__.py | Python | gpl-2.0 | 1,671 |
#!/usr/bin/env python3
# daemon.py
"""
originally from the Python Cookbook (version 3)
11.8. Implementing Remote Procedure Calls
12.2. Determining If a Thread Has Started
12.14. Launching a Daemon Process on Unix
(perhaps more)
"""
import os
import sys
import atexit
import signal
import json
from datetime ... | buffalotheory/critter_list | pyplayer/pyplayerd.py | Python | gpl-2.0 | 7,138 |
"""
Misc utils for IPv4 management
"""
# Copyright (c) 2008 Peter V. Saveliev
#
# This file is part of Connexion project.
#
# Connexion 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... | freesmartphone/framework | framework/cxutil/ip.py | Python | gpl-2.0 | 2,408 |
#!/usr/bin/env python
import unittest
import os.path
import sys
import time
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)), ".."))
import base
from PyQt4.QtTest import QTest
from enki.core.core import core
class Test(base.TestCase):
def _verifyText(self, fileName, text):
w... | vi/enki | tests/test_core/test_uisavefiles.py | Python | gpl-2.0 | 2,949 |
from django import forms
from django.db.models import Avg, Count, Max, Min, StdDev
from django.db.models import Q
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.views.decorators.csrf import csrf_exempt
from django.views.generic.simple import direct_to_template
from main.util... | pyropeter/archweb | mirrors/views.py | Python | gpl-2.0 | 4,912 |
# force floating point division. Can still use integer with //
from __future__ import division
# This file is used for importing the common utilities classes.
import numpy as np
import matplotlib.pyplot as plt
import sys
class BellData:
def __init__(self,forces,RatesFold,RatesUnfold=None):
self.Forces = fo... | prheenan/BioModel | BellZhurkov/Python/TestExamples/TestUtil/Bell_Test_Data.py | Python | gpl-2.0 | 2,506 |
"""
Parse string to create Regex object.
TODO:
- Support \: \001, \x00, \0, \ \[, \(, \{, etc.
- Support Python extensions: (?:...), (?P<name>...), etc.
- Support \<, \>, \s, \S, \w, \W, \Z <=> $, \d, \D, \A <=> ^, \b, \B, [[:space:]], etc.
"""
from hachoir_regex import (RegexString, RegexEmpty, RegexRepeat,
R... | foreni-packages/hachoir-regex | hachoir_regex/parser.py | Python | gpl-2.0 | 6,130 |
from jbot import simulator
def diagonal_moving(robot):
robot.clear_messages()
robot.send_message("moving diagonally")
for m in range(0, 100):
robot.move_left(1)
robot.move_up(1)
def directional_moving(robot):
robot.send_message("moving down")
robot.move_down(30)
robot.send... | frozenjava/RobotSimulator | examples/robotFunctionality.py | Python | gpl-2.0 | 704 |
import os
from tito.builder import UpstreamBuilder
from tito.common import debug, run_command
class DistributionBuilder(UpstreamBuilder):
""" This class is used for building packages for distributions.
Parent class UpstreamBuilder build one big patch from upstream and create e.g.:
Patch0: foo-1.2.13-1-t... | xsuchy/tito | src/tito/distributionbuilder.py | Python | gpl-2.0 | 2,016 |