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 json
import os
import os.path as opath
import shutil
import subprocess
from codegen.datatypes import build_datatype_py, write_datatype_py
from codegen.compatibility import (
write_deprecated_datatypes,
write_graph_objs_graph_objs,
DEPRECATED_DATATYPES,
)
from codegen.figure import write_figure_class... | plotly/plotly.py | packages/python/plotly/codegen/__init__.py | Python | mit | 11,939 |
import csv
import json
fake_usernames = json.loads(open('members.json').read())
print '{} fake users'.format(len(fake_usernames))
csv_reader = csv.DictReader(open('../data-transport/migrations/users.csv'))
users = [user for user in csv_reader]
print '{} real users'.format(len(users))
print '{} merged'.format(len(zip(u... | participedia/api | migrations/utils/fake_users.py | Python | mit | 968 |
"""
Created on April 14, 2017
@author Miguel Contreras Morales
"""
import QueryTool
import datetime
import cherrypy as QueryServer
import os
if __name__ == "__main__":
"""
This initializes CherryPy services
+ self - no input required
"""
print "Intializing!"
portn... | neosinha/automationengine | AutomationEngine/QueryTool/Main.py | Python | mit | 1,129 |
#!/usr/bin/env python
import sys
sys.path.append('../')
from logparser import LogMine, evaluator
import os
import pandas as pd
input_dir = '../logs/' # The input directory of log file
output_dir = 'LogMine_result/' # The output directory of parsing results
benchmark_settings = {
'HDFS': {
'l... | logpai/logparser | benchmark/LogMine_benchmark.py | Python | mit | 5,994 |
import os
from unittest import TestCase
from invokust.settings import create_settings
from invokust import LocustLoadTest
from locust import HttpUser, between, task
class WebsiteUser(HttpUser):
wait_time = between(1, 3)
@task()
def get_home_page(self):
"""
Gets /
"""
self.... | FutureSharks/invokust | tests/test_loadtest.py | Python | mit | 866 |
host = "0.0.0.0"
secret_key = "mysecret"
repo_conf = {
"kwargs": {"dsn": "dbname=taiga"}
}
queue_conf = {
"path": "taiga_events.queues.pg.EventsQueue",
"kwargs": {
"dsn": "dbname=taiga"
}
}
| nsdont/taiga-docker | events/conf.py | Python | mit | 216 |
import os
import unittest
from dateutil.parser import parse as dtparse
import numpy as np
from pocean.dsg import ContiguousRaggedTrajectoryProfile
import logging
from pocean import logger
logger.level = logging.INFO
logger.handlers = [logging.StreamHandler()]
class TestContinousRaggedTrajectoryProfile(unittest.Tes... | joefutrelle/pocean-core | pocean/tests/dsg/trajectoryProfile/test_trajectoryProfile_cr.py | Python | mit | 4,960 |
try:
from Tkinter import *
except ImportError:
from tkinter import *
try:
import tkMessageBox
except ImportError:
from tkinter import messagebox as tkMessageBox
try:
import tkFileDialog
except ImportError:
from tkinter import filedialog as tkFileDialog
import os
from PIL import Image, ImageTk
... | prando/photoselector | photo.py | Python | mit | 11,323 |
class ADBEnum(object):
commands = {
"am start": "adb shell am start"
}
class D2JEnum(object):
commands = {
"decompile": "dex2jar-2.0/d2j-dex2jar.sh --force --output"
}
class APIMappings(object):
mappings = {
"install_shortcut":
{
"permiss... | AndroidSecurityTools/lobotomy | framework/enums/enums.py | Python | mit | 5,361 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import ConfigParser
from os import path as p
import re
from beam.constans import BEAM_PROJECT_CONF_NAME, BEAM_ROOT_DIR
from beam.cli import UI
from beam.errors import BEAMConfParserException
_sentinel = object()
class PBase(... | inFullMobile/BEAM-Framework | beam/config_parser.py | Python | mit | 4,098 |
'''
Bank API controller
Part of Multi-thread Cache system
LICENSE MIT @2017 Ivan Lausuch <ilausuch@gmail.com>
'''
class Bank:
"""
Bank API
"""
def __init__(self, client, bank):
self.client = client
self.bank = bank
def getKeys(self):
'''
Get all key enti... | ilausuch/CacheServer | src/APICore/Bank.py | Python | mit | 798 |
# Copyright (c) 2008 Giorgos Verigakis <verigak@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE A... | moul/splitfs | fusepy/fuse.py | Python | mit | 23,924 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-27 19:21
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Message'... | KredekPth/Kurs_django | contact/migrations/0001_initial.py | Python | mit | 661 |
import zerorpc
import time
class HelloRPC(object):
def transfer(self, document):
return "Document received, %s" % document
s.stop()
def receive(self, file):
print 'server received, %s' % file
return
s = zerorpc.Server(HelloRPC())
s.bind("tcp://0.0.0.0:4242")
print... | cloud-engineering/Torpid | zerorpc_server.py | Python | mit | 368 |
# Copyright (c) 2017 Microsoft Corporation.
#
# 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, merge, publis... | domin1101/malmo-challenge | ai_challenge/pig_chase/environment.py | Python | mit | 11,366 |
##
# \namespace cross3d.classes
#
# \remarks [desc::commented]
#
# \author Mikeh
# \author Blur Studio
# \date 06/08/11
#
from fcurve import FCurve
from exceptions import Exceptions
from dispatch import Dispatch
from clipboard import Clipboard
from valuerange import ValueRange
from framerange import... | blurstudio/cross3d | cross3d/classes/__init__.py | Python | mit | 434 |
from .add_binary import *
from .breaking_bad import *
from .decode_string import *
from .delete_reoccurring import *
from .domain_extractor import *
from .encode_decode import *
from .group_anagrams import *
from .int_to_roman import *
from .is_palindrome import *
from .is_rotated import *
from .license_number import *... | keon/algorithms | algorithms/strings/__init__.py | Python | mit | 1,248 |
"""Utilities for forming search expressions based on field classes."""
# Copyright (c) 2001-2009 ElevenCraft Inc.
# See LICENSE for details.
import sys
from schevo.lib import optimize
from operator import and_, eq, or_
from schevo.base import Field
class Expression(object):
def __init__(self, left, op, right... | Schevo/schevo | schevo/expression.py | Python | mit | 1,535 |
# This is the Twisted Get Poetry Now! client, version 8.0
import optparse, sys
from twisted.internet import defer
from twisted.internet.protocol import Protocol, ClientFactory
from twisted.protocols.basic import NetstringReceiver
def parse_args():
usage = """usage: %prog [options] [hostname]:port ...
This is t... | jdavisp3/twisted-intro | twisted-client-8/get-poetry.py | Python | mit | 4,824 |
# @Author: Zeta Syanthis <zetasyanthis>
# @Date: 2017/07/21
# @Email: zeta@zetasyanthis.org
# @Project: MyArchive
# @Last modified by: zetasyanthis
# @Last modified time: 2017/07/21
# @License MIT
"""Generic database module using SQLAlchemy."""
import logging
from sqlalchemy import create_engine, event
from sql... | zetasyanthis/myarchive | src/myarchive/db/db.py | Python | mit | 3,698 |
"""
calculatepi.py
Author: Sawyer Hanlon
Credit: Mr Dennison
Assignment:
Write and submit a Python program that computes an approximate value of π by calculating the following sum:
(see: https://github.com/HHS-IntroProgramming/Calculate-Pi/blob/master/README.md)
This sum approaches the true value of π as n approache... | sawyerhanlon/Calculate-Pi | calculatepi.py | Python | mit | 998 |
'''
WSGI config
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.9/howto/deployment/wsgi/
Copyright (c) 2017 Vanessa Sochat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this so... | vsoch/docfish | docfish/wsgi.py | Python | mit | 1,430 |
# scdown
| susurrant-audio/scdown | scdown/__init__.py | Python | mit | 9 |
"""
Copy RWIS data from iem database to its final resting home in 'rwis'
The RWIS data is partitioned by UTC timestamp
Run at 0Z and 12Z, provided with a timestamp to process
"""
import datetime
import sys
import psycopg2.extras
from pyiem.util import get_dbconn, utc
def main(argv):
"""Go main"""
iemdb = g... | akrherz/iem | scripts/dbutil/rwis2archive.py | Python | mit | 5,737 |
RESULTS = [0x58759924, 0x2be2c273, 0x03165f2e, 0xe4f4832b, 0x88fa93d2, 0xcc096c83, 0xfb713a21, 0x99aa55bd,
0xeae7f35d, 0xddaf236c, 0xda0552ce, 0xd2fb442f, 0xfd1ac65e, 0xa680c86c, 0x7a9f36c0, 0xa5ccce35,
0x8060b929, 0xe2a6a2da, 0x68175335, 0x18859b40, 0xd2b4213b, 0x97a896c0, 0x119d3659, 0xbc89d7b1,... | guilload/pyisaac | tests/fixtures.py | Python | mit | 30,816 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
meza.fntools
~~~~~~~~~~~~
Provides methods for functional manipulation of content
Examples:
basic usage::
>>> from meza.fntools import underscorify
>>>
>>> header = ['ALL CAPS', 'Illegal $%^', 'Lots of space']
... | reubano/tabutils | meza/fntools.py | Python | mit | 34,504 |
#!/usr/bin/env python
# encoding: utf-8
from flask import Blueprint, redirect, session, url_for, flash
from flask_babel import _
from flask_babel import refresh
from flask_login import current_user
from app import db, constants
from app.views import redirect_back
blueprint = Blueprint('lang', __name__, url_prefix='/... | viaict/viaduct | app/views/lang.py | Python | mit | 1,481 |
"""Suite CodeWarrior suite: Terms for scripting the CodeWarrior IDE
Level 0, version 0
Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5
AETE/AEUT resource version 1/0, language 0, script 0
"""
import aetools
import MacOS
_code = 'CWIE'
class... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.3/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py | Python | mit | 23,097 |
from dal import autocomplete
from django.conf.urls import url
from django.views import generic
from .forms import TestForm
from .models import TestModel
urlpatterns = [
url(
'test-autocomplete/$',
autocomplete.Select2QuerySetView.as_view(
model=TestModel,
create_field='na... | luzfcb/django-autocomplete-light | test_project/select2_one_to_one/urls.py | Python | mit | 547 |
#!/usr/bin/env python3
from anormbookmarker.test.test_enviroment import *
with self_contained_session(CONFIG.database_timestamp) as session:
BASE.metadata.create_all(session.bind)
# make a tag to make an alias to
aa = Tag.construct(session=session, tag='a a')
session.commit()
db_result = [('select CO... | jakeogh/anormbookmarker | anormbookmarker/test/tests/Tag/two_single_char_words.py | Python | mit | 876 |
# encoding: utf-8
import re
import jinja2
import jinja2.ext
import markdown2
import os
import sys
sys.path.append(".")
from staticjinja import make_site
from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup
# remove annoying characters
def cleanitup(text):
chars = {
'\xe2': '',
'\x80': '',
'... | columbiaviz/columbiaviz.github.io | build.py | Python | mit | 3,474 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-05-19 15:13
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('lotes', '0069_leadcolecao_regracolecao'),
]
operations = [
migrations.AlterModelOp... | anselmobd/fo2 | src/lotes/migrations/0070_regracolecao_table_name.py | Python | mit | 608 |
import numpy as np
import tensorflow as tf
import itertools
import collections
import helper
def _print_success_message():
print('Tests Passed')
def test_text_to_ids(text_to_ids):
test_source_text = 'new jersey is sometimes quiet during autumn , and it is snowy in april .\nthe united states is u... | lyoung13/deep-learning-nanodegree | p4-language-translation/problem_unittests.py | Python | mit | 13,363 |
import unittest
import numpy
import cupy
from cupy import testing
import cupyx.scipy.special # NOQA
def _boundary_inputs(boundary, rtol, atol):
left = boundary * (1 - numpy.copysign(rtol, boundary)) - atol
right = boundary * (1 + numpy.copysign(rtol, boundary)) + atol
return [left, boundary, right]
c... | cupy/cupy | tests/cupyx_tests/scipy_tests/special_tests/test_erf.py | Python | mit | 4,572 |
import socket
from subprocess import Popen, PIPE, STDOUT
import os
import time
import string
import requests
import json
import omxplayer
class UnsupportedFileTypeException(Exception):
'''Raised if the file type is not among the list of supported types'''
pass
class FileNotFoundException(Exception):
'''... | nakamura9/deploy_ad_server | client/omxplayer/myomx.py | Python | mit | 4,075 |
#!/usr/bin/env python3
#
# This file generates an estimation of window size for the
# two queues for _each_ sample. It will not be exact, and
# it's correctness will vary with the variation of queue delay
# in the queue.
#
# The results are saved to:
# - derived/window
# each line formatted as: <sample id> <window ec... | henrist/aqmt | aqmt/calc_window.py | Python | mit | 2,753 |
"""User-defined positioned parser example.
This shows how a new parser can be defined outside Parsita and used in tandem
with the built-in parsers. The ``positioned`` parser updates the value
returned from an arbitrary parser with the position in the input that was
consumed by that parser.
"""
from abc import abstrac... | drhagen/parsita | examples/positioned.py | Python | mit | 3,313 |
from mrjob.job import MRJob
from mrjob.protocol import JSONValueProtocol
import json
class WordCount(MRJob):
'''
The default MRJob.INPUT_PROTOCOL is `RawValueProtocol`, but we are reading tweets,
so we'll add a parser before we even get to the mapper.
'''
# incoming line needs to be parsed (I thin... | dssg/tweedr | tweedr/emr/gnip_wc.py | Python | mit | 1,253 |
import cartolafc
api = cartolafc.Api(email='email@email.com', password='s3nh4', attempts=5, redis_url='redis://localhost:6379/0')
print(api.amigos())
print(api.clubes())
print(api.liga(nome='Virtus Premier League'))
print(api.liga(nome='Nacional', page=2))
print(api.liga(nome='Nacional', page=3, order_by=cartolafc.RO... | vicenteneto/python-cartolafc | examples/examples.py | Python | mit | 1,020 |
import numpy as np
import time
import krpc
import init_simulation
import unified_powered_flight_guidance as upfg
from launch_targeting import launch_targeting, LaunchSite
from flight_manager import flight_manager
from flight_sim_3d import GravityTurnControl, cart2sph
g0 = init_simulation.g0
mu = init_simulat... | ubik2/PEGAS-kRPC | kRPC/Main.py | Python | mit | 10,069 |
import tkinter as tk
import sys
import json
import sys
from tkinter import filedialog
from tkinter import Spinbox
from tkinter import Canvas
from tkinter import RIGHT
from tkinter import ttk
from PIL import Image, ImageTk
from core.readAlgoFile import readAlgo
from core.readAlgoFile import getAlgoList
from core.ConfigP... | neuropoly/axonsegpy | axonsegpy/GUI.py | Python | mit | 4,301 |
import math
import os
import sys
sys.path.append(os.path.dirname(sys.argv[0])+"/../TensorFlowScripts")
import train_GED
from hyperopt import hp, fmin, rand, tpe, STATUS_OK, Trials
space = {
'lr': hp.loguniform('lr', math.log(1e-5), math.log(30)),
'wd' : hp.choice('wd', [1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e... | pakozm/DNNJ | HyperoptScripts/hyperopt_mlp.py | Python | mit | 1,224 |
import itertools
import observed
from observed import observable_function, observable_method
import pytest
def get_caller_name(caller):
"""Find the name of a calling (i.e. observed) object.
Args:
caller: The observed object which is calling an observer.
Returns:
The name of the caller. ... | DanielSank/observed | observed_test.py | Python | mit | 10,795 |
# Tweepy
# Copyright 2009-2022 Joshua Roesslein
# See LICENSE for details.
from collections.abc import Mapping
class EqualityComparableID:
__slots__ = ()
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.id == other.id
return NotImplemented
class Hasha... | tweepy/tweepy | tweepy/mixins.py | Python | mit | 949 |
# -*- coding: utf-8 -*-
import argparse
from next_run import NextRun
if __name__ == u'__main__':
# Parse command line arguments
parser = argparse.ArgumentParser(
description=u'Cron Admin tool.'
)
parser.add_argument(
u'-t',
dest=u'current_time',
default=u'16:10',
... | ian-wilson/cron-admin | nextrun/__main__.py | Python | mit | 975 |
"""distutils.command.install
Implements the Distutils 'install' command."""
# created 1999/03/13, Greg Ward
__revision__ = "$Id: install.py,v 1.56 2001/01/16 16:16:03 akuchling Exp $"
import sys, os, string
from types import *
from distutils.core import Command, DEBUG
from distutils.sysconfig import get_config_vars... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.1/Lib/distutils/command/install.py | Python | mit | 22,295 |
# coding:utf-8
'''
created on 2018/8/22
@author:sunyihuan
'''
from __future__ import print_function
import os
import sys
# This is a placeholder for a Google-internal import.
import tensorflow as tf
import mnist_input_data
tf.app.flags.DEFINE_integer('training_iteration', 1000,
'numbe... | sunyihuan326/DeltaLab | daily_learning/serving_learning/save_model.py | Python | mit | 4,825 |
# LXC Python Library
# for compatibility with LXC 0.8 and 0.9
# on Ubuntu 12.04/12.10/13.04
# Author: Elie Deloumeau
# Contact: elie@deloumeau.fr
# The MIT License (MIT)
# Copyright (c) 2013 Elie Deloumeau
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associate... | mosquito/LXC-Web-Panel | lwp/lxc/__init__.py | Python | mit | 13,591 |
import json
import os.path
from ems.app import Bootstrapper, absolute_path
from ems.inspection.util import classes
from ems.validation.abstract import Validator, MessageProvider
from ems.validation.registry import Registry
from ems.validation.rule_validator import RuleValidator, SimpleMessageProvider
from ems.validat... | mtils/ems | ems/support/bootstrappers/validation.py | Python | mit | 1,933 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Reddit worker
"""
import praw
import sys
import time
import yaml
from datetime import datetime
from pytz import UTC
from pymongo import MongoClient, IndexModel, ASCENDING, DESCENDING, TEXT
from pymongo.errors import PyMongoError
__version__ = '0.0.1-alpha.1'
c... | nicolaevladescu/hootch | workers/Reddit.py | Python | mit | 6,671 |
import torch.nn as nn
from utils import *
class pspnet(nn.Module):
def __init__(self, feature_scale=4, n_classes=21, is_deconv=True, in_channels=3, is_batchnorm=True):
super(pspnet, self).__init__()
self.is_deconv = is_deconv
self.in_channels = in_channels
self.is_batchnorm = is_b... | ibadami/pytorch-semseg | ptsemseg/models/pspnet.py | Python | mit | 3,018 |
# -*- coding: utf-8 -*-
import os
import json
from pymatgen.ext.matproj import MPRester
data = {}
with MPRester() as mpr:
for i, d in enumerate(
mpr.query(criteria={}, properties=["task_ids", "pretty_formula"])
):
for task_id in d["task_ids"]:
data[task_id] = d["pretty_formula"]
o... | materialsproject/MPContribs | mpcontribs-api/mpcontribs/api/contributions/generate_formulae.py | Python | mit | 431 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('comment', '0002_auto_20150703_1252'),
]
operations = [
migrations.RenameField(
model_name='comment',
... | 28harishkumar/Social-website-django | comment/migrations/0003_auto_20150711_2109.py | Python | mit | 525 |
import sys
for line in open(sys.argv[1], "r").readlines():
if line.strip() == "":
continue
if line[0] == "@":
sys.stdout.write(line)
| Cibiv/Teaser | tools/samheader.py | Python | mit | 141 |
"""
System settings
===============
"""
from __future__ import print_function
from fabric.api import hide, run, settings
from burlap.files import file # pylint: disable=redefined-builtin
from burlap.utils import read_lines, run_as_root
from burlap.constants import *
is_file = file.is_file
class UnsupportedFamily(Ex... | chrisspen/burlap | burlap/system.py | Python | mit | 7,377 |
#!/usr/bin/python
#
# linearize-hashes.py: List blocks in a linear, no-fork version of the chain.
#
# Copyright (c) 2013-2014 The Bitcoin developers
# Copyright (c) 2015-2018 The PIVX developers
# Copyright (c) 2018 The Ion developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYIN... | mitchellcash/ion | contrib/linearize/linearize-hashes.py | Python | mit | 3,123 |
# 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/v2020_05_01/operations/_available_service_aliases_operations.py | Python | mit | 9,072 |
import numpy as np
import rough_surfaces.params as rp
import rough_surfaces.generate as rg
import rough_surfaces.analyse as ra
import rough_surfaces.surface as rs
import rough_surfaces.contact as rc
import matplotlib.pyplot as plt
from matplotlib import rcParams
import rough_surfaces.plot as rplt
# TODO dont do this
rc... | plang85/rough_surfaces | examples/example_contact.py | Python | mit | 1,319 |
class RegistroLogin(object):
def __init__ (self,dados=None):
if dados is not None:
self.id = dados['id']
self.token = dados['token']
self.id_usuario = dados['id_usuario']
self.ip = dados['ip']
self.entrada = dados['entrada']
def getId(self):
return self.id
def setToken(self,token):
self.to... | AEDA-Solutions/matweb | backend/Database/Models/RegistroLogin.py | Python | mit | 777 |
import json
class Group(object):
order = ["name",
"facebook",
"sms",
"mail",
"show"]
def __init__(self, name, eventsAtr):
self.name = name
self.eventsAtr = eventsAtr
def convert(self):
dictionary = {}
dictionary["name"] = se... | matejd11/birthdayNotify | birthdayNotify/group.py | Python | mit | 1,058 |
#encoding:utf-8
subreddit = 'motivation'
t_channel = '@Mootivati0n'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Fillll/reddit2telegram | reddit2telegram/channels/~inactive/mootivati0n/app.py | Python | mit | 142 |
# -*- coding: utf-8 -*-
from ...query.expression import QueryExpression
from .relation import Relation
class HasManyThrough(Relation):
_first_key = None
_second_key = None
_far_parent = None
def __init__(self, query, far_parent, parent, first_key, second_key):
"""
:param query: A Bu... | MakarenaLabs/Orator-Google-App-Engine | orator/orm/relations/has_many_through.py | Python | mit | 5,076 |
# coding: utf-8
# Copyright (c) 2015 Fabian Barkhau <fabian.barkhau@gmail.com>
# License: MIT (see LICENSE file)
from kivy.uix.label import Label
from gravur.utils import load_widget
@load_widget
class LabelBox(Label):
pass
| F483/gravur | gravur/common/labelbox.py | Python | mit | 232 |
"""
This is a typical script to reconstruct one frame of a movie using a mosaic
of other frames with the Python package Pompei. It generates this picture of
general Maximus in Gladiator using 1100+ frames of the movie.
http://i.imgur.com/Eoglcof.jpg
This script goes in five steps:
1. Extract one frame every 5 second... | Zulko/pompei | examples/typical_script.py | Python | mit | 4,324 |
import pandas as pd
import numpy as np
import re
data_path = "C:/Users/SpiffyApple/Documents/USC/RaphaelBostic"
#################################################################
################### load tax data ###############################
#upload tax data
tx = pd.read_csv("/".join([data_path, "metro_TY13.... | kiwiPhrases/EITChousing | EITCcalculations_ver2.py | Python | mit | 6,048 |
import _plotly_utils.basevalidators
class YValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="y", parent_name="scatterpolar.marker.colorbar", **kwargs
):
super(YValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatterpolar/marker/colorbar/_y.py | Python | mit | 495 |
# Import everything needed to edit video clips
from moviepy.editor import *
# Load myHolidays.mp4 and select the subclip 00:00:50 - 00:00:60
clip = VideoFileClip("myHolidays.mp4").subclip(50,60)
# Reduce the audio volume (volume x 0.8)
clip = clip.volumex(0.8)
# Generate a text clip. You can customize the font, colo... | ttm/socialLegacy | tests/legacy/testAnim2.py | Python | mit | 714 |
"""
A webdriver/selenium based scraper for San Francisco Board of Supervisors
voting data.
- Troy Deck (troy.deque@gmail.com)
"""
from selenium import webdriver
from datetime import date
import argparse
import time
import db
#############
# Constants #
#############
PATIENCE = 2 # Seconds to wait after executing a... | tdeck/grab-sf-votes | collect.py | Python | mit | 9,518 |
#!/usr/bin/python
"""Print stats about stdin per-line timings."""
import signal
import sys
import time
start = time.time()
count = 0
try:
for line in sys.stdin:
count += 1
except KeyboardInterrupt:
print
pass
end = time.time()
et = end - start
lps = count / et
print "Elapsed time = %f, lines = %d,... | vivek8943/twitter-streamer | streamer/scripts/lps.py | Python | mit | 351 |
# 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/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_certificates_operations.py | Python | mit | 26,217 |
from rrsm.core import StateMachine, StateTypeError | jnmclarty/rrsm | rrsm/__init__.py | Python | mit | 50 |
# -*- coding: utf-8 -*-
""" Asset
@author: Michael Howden (michael@sahanafoundation.org)
@date-created: 2011-03-18
Asset Management Functionality
"""
prefix = request.controller
resourcename = request.function
#=============================================================================... | sinsai/Sahana_eden | controllers/asset.py | Python | mit | 2,306 |
import unittest
import string, random
from generate import gen_passphrase, possibilities, \
possibilities_magnitude
def generate_word(
size=6,
chars=string.digits+string.ascii_letters):
'''
Return a (non-cryptographically-secure) random word 'size'
characters long composed of the charac... | ouroboros8/phrasepasser | tests.py | Python | mit | 2,692 |
import csv
from django.db.models import Max
from django.utils.translation import ugettext_lazy as _
from urllib2 import URLError
from googlemaps import GoogleMaps, GoogleMapsError
from locations.models import Location
from locations.exceptions import LocationEncodingError
class CsvParseError(csv.Error):
pass
d... | bennylope/django-lokoj | locations/utils.py | Python | mit | 5,917 |
#!/usr/bin/env python
"""
Command-line utility for administrative tasks.
"""
import os
import sys
if __name__ == "__main__":
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE",
"AzureAuthSample.settings"
)
from django.core.management import execute_from_command_line
execute_from_command... | ElliottMiller/python-azuread-sample | manage.py | Python | mit | 336 |
import imagepusher, random
if __name__ == '__main__':
host, port = '', 18002
pusher = imagepusher.ImagePusher( (host, port) )
width, height = 12, 10
munch = [ [ [0,0,0] for x in xrange(width) ] for y in xrange(height) ]
while True:
for i in xrange(16):
for j in xrange(i+1):
for y in xrange(height):
... | techinc/imagepusher | munch.py | Python | mit | 651 |
#
# mjmud - The neverending MUD project
#
# Copyright (c) 2014, Matt Jordan
#
# See https://github.com/matt-jordan/mjmud for more information about the
# project. Please do not contact the maintainers of the project for information
# or assistance. The project uses Github for these purposes.
#
# This program is free so... | matt-jordan/mjmud | lib/transports/ws_receiver.py | Python | mit | 1,886 |
from django.core.cache import cache as cache_impl
from django.utils.encoding import smart_str
import hashlib
class Hashcache(object):
"""
Wrapper for django.core.cache.cache that hashes the keys to avoid key
length errors. Maybe eventually it will do other cool things.
You can optionally pass you... | yola/hashcache | hashcache/hashcache.py | Python | mit | 1,100 |
import json
from django.db import models
import requests
from Suchary.settings import GCM_API_KEY
class Device(models.Model):
registration_id = models.TextField()
android_id = models.TextField(unique=True)
alias = models.TextField(blank=True)
version = models.CharField(max_length=20)
model = mod... | jchmura/suchary-django | api/models.py | Python | mit | 1,121 |
from jsonrpc import ServiceProxy
access = ServiceProxy("http://127.0.0.1:12644")
pwd = raw_input("Enter wallet passphrase: ")
access.walletpassphrase(pwd, 60)
| Tutakamimearitomomei/Kongcoin | contrib/wallettools/walletunlock.py | Python | mit | 159 |
#!/usr/bin/env python
"""
Python format parser
"""
import collections
import copy
import glob
import logging
import os
import re
import six
import sys
import traceback
import py010parser
import py010parser.c_parser
from py010parser import c_ast as AST
import pfp.fields as fields
import pfp.errors as errors
import p... | greenoaktree/pfp | pfp/interp.py | Python | mit | 50,954 |
# -*- coding: utf-8 -*-
#
# spikeval documentation build configuration file, created by
# sphinx-quickstart on Thu Sep 29 13:42:58 2011.
#
# 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.
#
# ... | pmeier82/spikeval | doc/source/conf.py | Python | mit | 8,785 |
import NarrativeService.feeds as feeds
import NarrativeService.util.workspace as ws
from baseclient import ServerError
# from storage.mongo import (
# save_share_request,
# find_existing_share_request
# )
SERVICE_TOKEN_KEY = "service-token"
WS_TOKEN_KEY = "ws-admin-token"
class ShareRequester(object):
def... | kbaseapps/NarrativeService | lib/NarrativeService/sharing/sharemanager.py | Python | mit | 2,862 |
#!/usr/bin/python3
# coding: utf-8
import sys
import json
import requests
import pprint
import unittest
import string
import random
import os
import json
import time
import datetime
import base64
import uuid
import argparse
pp = pprint.PrettyPrinter(depth=6)
parser = argparse.ArgumentParser()
parser.add_argument('--... | hgn/hippod | tests/0303-same-object-default.py | Python | mit | 8,290 |
"""
URL mapping for user interface.
"""
from django.conf import settings
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.contrib.staticfiles.views import serve
from django.views.generic import TemplateView
from ui.views import HowView
urlpatterns = [
url(r'... | btimby/cloudstrype | web/cloudstrype/ui/urls.py | Python | mit | 792 |
# -*- coding: utf-8 -*-
"""
Created on 18 juil. 2013
"""
from __future__ import unicode_literals
import logging
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
import sys
import os
from django.template import loader
from django.template.context import Context
import sh... | onysos/django-nginx-config | django_nginx/management/commands/create_nginx_config.py | Python | mit | 8,249 |
"""
The MIT License (MIT)
Copyright (c) 2016 Daniele Linguaglossa <d.linguaglossa@mseclab.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 th... | mseclab/PyJFuzz | test/test_pjf_configuration.py | Python | mit | 2,126 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('rerun')
class MaxReRuns(object):
"""Force a task to rerun for debuggin... | qvazzler/Flexget | flexget/plugins/operate/rerun.py | Python | mit | 643 |
import io
import sys
import pytest
from rich import inspect
from rich.console import Console
skip_py36 = pytest.mark.skipif(
sys.version_info.minor == 6 and sys.version_info.major == 3,
reason="rendered differently on py3.6",
)
skip_py37 = pytest.mark.skipif(
sys.version_info.minor == 7 and sys.version... | willmcgugan/rich | tests/test_inspect.py | Python | mit | 12,081 |
#!/usr/bin/env docker-script
#!python:latest python
import os, sys
details = os.uname()
print('Uname: ', details.sysname, details.release, details.machine)
print('Guest CWD:', os.getcwd())
print('Host CWD: ', os.environ['HOST_CWD'])
print('argv: ', sys.argv)
| adamrehn/docker-script | test.py | Python | mit | 268 |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from mnn.model import MNnModel
# Single disc
model = MNnModel()
model.add_disc('z', 1.0, 10.0, 100.0)
# Evaluating density and potential :
print(model.evaluate_density(1.0, 2.0, -0.5))
print(model.evaluate_potential(1.0, 2.0, -... | mdelorme/MNn | mnn/examples/simple_model.py | Python | mit | 1,497 |
import pytest
from postmarker.exceptions import ClientError
CASSETTE_NAME = "exceptions"
def test_raise(postmark):
with pytest.raises(ClientError) as exc:
postmark.templates.get(123)
assert str(exc.value) == "[1101] The 'TemplateId' associated with this request is not valid or was not found."
as... | Stranger6667/postmarker | test/test_exceptions.py | Python | mit | 354 |
import sys
from copy import deepcopy
from math import sqrt
def read_num():
return list(map(int, sys.stdin.readline().split()))
def read_sudoku():
try:
n = read_num()
if not n:
n = read_num()
n = n[0]
return [read_num() for _ in range(n*n)]
except Exception:
... | secnot/uva-onlinejudge-solutions | 989 - Su Doku/main.py | Python | mit | 2,568 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from django.utils import unittest
from django.test.client import RequestFactory
from django.db.models import query
from django.contrib.admin.sites import AdminSite
from cities_light import admin as cl_admin
from cities_light import models as cl_models
... | KevinGrahamFoster/django-cities-light | test_project/tests.py | Python | mit | 1,189 |
# -*- coding: utf-8 -*-
"""
Authentication module for web.py
Needs a user table with at least the following columns:
CREATE TABLE user (
user_id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
user_login varchar(64) NOT NULL,
user_password varchar(180) NOT NULL,
user_email ... | galeo/web.py-auth | auth/__init__.py | Python | mit | 1,163 |
"""
Utility module to manipulate directories.
"""
import os
import types
import shutil
__author__ = "Jenson Jose"
__email__ = "jensonjose@live.in"
__status__ = "Alpha"
class DirUtils:
"""
Utility class containing methods to manipulate directories.
"""
def __init__(self):
pass
@staticme... | jensonjose/utilbox | utilbox/os_utils/dir_utils.py | Python | mit | 7,866 |
#-*- coding: utf-8 -*-
from django import forms
from django.db.models import Q
from nom.models import soluciones, estados, ciudades
class data_form(forms.Form):
state_choices = [ ('0', 'Escoge un estado'), ] + [(edo.id, edo.estado) for edo in estados.objects.all()]
city_choices = [ ('0', 'Escoge una ciudad') ]
#tec... | JonathanAlvarado/bioclimatica | nom020/nom/forms.py | Python | mit | 1,697 |
#!/usr/bin/env python
"""
server config.
"""
from basinboa.system.loader import YamlLoader
class Config(object):
"""docstring for Config"""
def __init__(self, name):
super(Config, self).__init__()
self.name = name
self.items = 0
def __repr__(self):
return "Config: %s, item... | marlboromoo/basinboa | basinboa/system/config.py | Python | mit | 869 |
"""
Created on Jul 11, 2013
@author: briank
"""
# from zope.interface import Interface, Attribute
# ## END DBK
| DBrianKimmel/PyHouse | Project/src/Modules/Computer/Web/ipyhouse.py | Python | mit | 113 |
print("this is a test file")≈
| caromedellin/starting_git | test.py | Python | mit | 32 |