code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
# noinspection PyUnresolvedReferences
import mujoco_py # Mujoco must come before other imports. https://openai.slack.com/archives/C1H6P3R7B/p1492828680631850
from mpi4py import MPI
from gailtf.baselines.common import set_global_seeds
import os.path as osp
import gym
import logging
from gailtf.base... | ryanjulian/gail-tf | gailtf/baselines/trpo_mpi/run_mujoco.py | Python | mit | 2,970 |
# noinspection PyPackageRequirements
from Crypto.Cipher import AES
import base64
#AES256
BLOCK_SIZE = 32
PADDING = '{'
DECRYPTION_CHECK = "|PASSMON|"
def aes_encrypt(word, key):
"""Encrypts password"""
pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * PADDING
encode_aes = lambda c, s: base64.b64encode(c.enc... | Plasticoo/Pass_Shelter3 | src/encryption/aes_encryption.py | Python | mit | 936 |
# this one is like your scripts with argv
def print_two(*args):
arg1, arg2 = args
print "arg1: %r, arg2: %r" % (arg1, arg2)
# ok that *args is actually pointless, we can just do this
def print_two_again(arg1, arg2):
print "arg1: %r, arg2: %r" % (arg1, arg2)
# this just takes one argument
def print_on... | chrisortman/CIS-121 | k0776243/exercises/ex18.py | Python | mit | 526 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('filesAndForms', '0002_inputfile_next_one'),
]
operations = [
migration... | nynguyen/sprint_zero_demo | main/filesAndForms/migrations/0003_auto_20150322_1638.py | Python | mit | 763 |
import _plotly_utils.basevalidators
class SpikedashValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="spikedash", parent_name="layout.yaxis", **kwargs):
super(SpikedashValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/yaxis/_spikedash.py | Python | mit | 542 |
import token_names as tokens
import abstract_syntax_tree as AST
class Parser(object):
def __init__(self, lexer):
self.lexer = lexer
self.current_token = self.lexer.get_next_token()
def error(self, message):
raise Exception(message)
def consume(self, token_type):
if self.cu... | doubledherin/my_compiler | parser.py | Python | mit | 8,875 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.model import no_value_fields
class Workflow(Document):
def validate(self):
self.set_active()
self.create_custom_field_for_... | mhbu50/frappe | frappe/workflow/doctype/workflow/workflow.py | Python | mit | 3,999 |
import server
from bson.json_util import loads
def list_data_test_no_data():
response = server.list_data(MockDB())
assert response == "[]"
def list_data_test_one_datum():
data = [
{"username" : "barney", "emotion" : "2"}
]
response = server.list_data(MockDB(data))
response = loads(re... | icbat/happiness-meter | api/server_test.py | Python | mit | 5,113 |
import unittest
class TestParentDataParams(unittest.TestCase):
def setUp(self):
from treetl import Job
self.expected_results = { jn: i+1 for i, jn in enumerate([ 'JobA', 'JobB', 'JobC', 'JobD' ]) }
self.actual_results = { }
def update_actual_results(job):
self.actua... | robhowley/treetl | tests/test_parent_data_param.py | Python | mit | 1,534 |
from .models import *
def statics_pages(request):
pages = Page.objects.all().filter(visible=True)
return {
'statics_pages': pages,
} | xXcoronaXx/Dblog | statics_pages/context_processors.py | Python | mit | 143 |
from StringIO import StringIO
from fabric.api import get, put
def read_file(remote_path):
"""Wrapper around fabric's ``get``"""
sio = StringIO()
get(remote_path, sio)
return sio.getvalue()
def write_file(text, remote_path, use_sudo=False):
put(StringIO(text), remote_path, use_sudo)
| davidhalter/depl | depl/helpers.py | Python | mit | 308 |
#!/usr/bin/env python
# encoding: utf-8
"""
serializers.py
Created by Christophe VAN FRACKEM / Bastien ARNETTE on 2014/04/21/.
Copyright (c) 2014 Tiss'Page. MIT Licence.
UCAR serializers.
"""
__author__ = 'Christophe VAN FRACKEM <contact@tisspage.fr> / Bastien ARNETTE <bastien@rnette.fr>'
__version__= '0.0.1'
__cop... | tisspage/ucar | api-server/api_v0/serializers/file.py | Python | mit | 653 |
import sys
current_word = None
current_count = 0
word = None
for line in sys.stdin:
line = line.strip()
word,count = line.split('\t',1)
try:
count = int(count)
except ValueError:
continue
if current_word == word:
current_count +=... | MihawkHu/CS433_ParallerProgramming_Project | Project4/wordcount/python_wordcount/reducer.py | Python | mit | 574 |
import os
from datetime import timedelta
BROKER_URL = os.environ['CELERY_BROKER_URL']
CELERY_IMPORTS = ('app.cabotapp.tasks', )
CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"
CELERY_TASK_SERIALIZER = "json"
CELERY_ACCEPT_CONTENT = ['json', 'msgpack', 'yaml']
CELERYBEAT_SCHEDULE = {
'run-all-checks... | JensRantil/cabot | app/celeryconfig.py | Python | mit | 703 |
"""
WSGI config for arividam project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | c4sc/arividam | config/wsgi.py | Python | mit | 1,445 |
# -*- coding:utf-8
'''
Created on 22/05/2015
@author: C&C - HardSoft
'''
import os
import sys
import traceback
from util.change import change
from util.homogenize import Homogenize
from columns import Columns
from calc_length import calc_length
class GerJobPdZds(object):
def __init__(self, jobname, path, di... | flavio-casacurta/File-FixedS | GerJobPdZds.py | Python | mit | 3,378 |
from django.conf.urls import patterns, url
from coffees import views
urlpatterns = patterns('',
# GET /api
url(r'^$', views.index, name='coffees_index'),
# POST /api/coffees
url(r'^coffees/$', views.create, name='coffees_create'),
# GET /api/<username>
url(r'^(?P<username>[\w-]+)/$', views.detail, name='coffees_... | chrisenytc/coffy | coffees/urls.py | Python | mit | 331 |
"""empty message
Revision ID: 74af9cceeeaf
Revises: 6e7b88dc4544
Create Date: 2017-07-30 20:47:07.982489
"""
# revision identifiers, used by Alembic.
revision = '74af9cceeeaf'
down_revision = '6e7b88dc4544'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic ... | Tethik/faktura | migrations/versions/74af9cceeeaf_.py | Python | mit | 634 |
# vim: set fileencoding=utf-8 sw=4 ts=4 et :
"""Implements RFC 6266, the Content-Disposition HTTP header.
parse_headers handles the receiver side.
It has shortcuts for some http libraries:
parse_httplib2_response and parse_requests_response.
It returns a ContentDisposition object with attributes like is_inline,
f... | freelan-developers/teapot | teapot/extra/rfc6266.py | Python | mit | 15,052 |
from django import template
register = template.Library()
@register.filter
def add_css_class(field, css):
return field.as_widget(attrs={"class": css})
@register.filter
def space_to_underscore(string):
return string.replace(" ", "_")
#loop over queryset in groups of n
def grouped(l, n):
# Yield success... | Sult/evehub | users/templatetags/add_css.py | Python | mit | 481 |
# Copyright (c) 2010 matt
# Copyright (c) 2010-2011 Paul Colomiets
# Copyright (c) 2011 Mounier Florian
# Copyright (c) 2012 Craig Barnes
# Copyright (c) 2012, 2014-2015 Tycho Andersen
# Copyright (c) 2013 Tao Sauvage
# Copyright (c) 2013 Julien Iguchi-Cartigny
# Copyright (c) 2014 ramnes
# Copyright (c) 2014 Sean Vig
... | himaaaatti/qtile | libqtile/layout/floating.py | Python | mit | 6,615 |
# -*- coding: utf-8 -*-
#
# Author: Pavel Reznikov <pashka.reznikov@gmail.com>
# Created: 14-10-15
#
# Id: $Id$
from quickbooks import *
from massage import *
from reference import *
from report import *
| troolee/quickbooks-python | quickbooks/__init__.py | Python | mit | 205 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import json
from lib.httpl import http_post
from lib.testdata import random_data
""" This is written to work with nosetest, the print statmetnts
in the libs will be supressed when if a test passes when nosetest
is running. When it fails the print statment... | mad01/boilerplates | python/test_api_post.py | Python | mit | 1,294 |
def a():
def b():
print 'b'
print 'a'
print a.b() | paopao74cn/noworkflow | tests/t1.py | Python | mit | 66 |
# 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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/_event_hub_management_client_enums.py | Python | mit | 4,954 |
from pipeline import Pipe
from pysolr import Solr
import json
import logging
import sys
import time
import zmq
import sqlite3 as lite
from collections import defaultdict
class Output(Pipe):
def data_invalid(self,data):
if 'type' not in data:
return True
if len(data.keys()) < 2:
... | jbruce12000/septic-tank | septic_tank/outputs.py | Python | mit | 9,478 |
# ported from:
# https://github.com/aio-libs/aiopg/blob/master/aiopg/sa/engine.py
import asyncio
import aiomysql
from .connection import SAConnection
from .exc import InvalidRequestError, ArgumentError
from ..utils import _PoolContextManager, _PoolAcquireContextManager
from ..cursors import (
Cursor, Deserializati... | aio-libs/aiomysql | aiomysql/sa/engine.py | Python | mit | 6,916 |
from six import iteritems, itervalues
from six.moves import range
from ..interfaces import ISnapshotable
from ..errors import AccessViolationError, InvalidResourceError
from ..util import align, sizeof_fmt, Flags
from ..snapshot import SnapshotNode
import enum
DEFAULT_MEMORY_SIZE = 0x1000000
# Types
from ctypes imp... | happz/ducky | ducky/mm/__init__.py | Python | mit | 24,453 |
from setuptools import setup
setup(url="https://github.com/ityaptin/encounter")
| ityaptin/encounter | setup.py | Python | mit | 81 |
# -*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2017 Moritz Lode
#
# 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... | lodemo/CATANA | src/data_collection/sblade/sblade/spiders/makerstudio.py | Python | mit | 3,250 |
#!/usr/bin/env python3
# Copyright (c) 2017 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 RPC calls related to net.
Tests correspond to code in rpc/net.cpp.
"""
import time
from test_framewo... | Exgibichi/statusquo | test/functional/net.py | Python | mit | 4,228 |
# Generated by Django 2.2.25 on 2021-12-30 13:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("letters", "0012_letter_created_by_staff"),
]
operations = [
migrations.AlterField(
model_name="letter",
name="creat... | watchdogpolska/poradnia | poradnia/letters/migrations/0013_auto_20211230_1439.py | Python | mit | 433 |
"""
WSGI config for sikilabs 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from mezzanine.utils.conf import r... | Sikilabs/sikilabs | sikilabs/wsgi.py | Python | mit | 493 |
# -*- coding: utf-8 -*-
"""
This module contains atmospheric constands and standards.
@author: Hagen
"""
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
class Standard_Atmosphere(object):
def __init__(self, standard='international'):
"""Returns pressure, temperature, an... | hagne/atm-py | atmPy/atmosphere/standards.py | Python | mit | 5,525 |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015-2016 Rapptz
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 r... | potatosushi/Discord-Notification-Bot | discord/server.py | Python | mit | 13,502 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "flexdb.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| EE/flexdb | manage.py | Python | mit | 249 |
from Arithmetic.Numbers.NumberArith import Arithmetic
from Arithmetic.Numbers.Modulo import Modulus
from Arithmetic.Numbers.Primality.Primality import Prime
__all__ = ["Arithmetic", "Modulus", "Prime"]
| justinh5/CipherBox | Arithmetic/__init__.py | Python | mit | 202 |
import pandas as pd
from ...config import _load_secrets
import sqlalchemy
import os
from tqdm import tqdm
class IlluminateSQLInterface:
"""A class representing a SQL interface to
Illuminate
"""
def __init__(self, secrets=None):
if secrets is None:
secrets = _load_secrets()
... | openEduConnect/eduextractor | eduextractor/sis/illuminate/illuminate_exporter.py | Python | mit | 1,702 |
import asyncio
import random
import checks
from TextChecker import TextChecker
from database import Database
from checks import *
from data.rp_texts import *
from data.links import *
from web import Web
from roleplay.Player import Player
import discord
from discord.ext import commands
class Roleplay(commands.Cog):
... | nisanick/Prisma_Machina | cogs/roleplay.py | Python | mit | 45,290 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-26 09:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('explorer', '0006_auto_20170626_0345'),
]
operation... | asterix135/whoshouldivotefor | explorer/migrations/0007_auto_20170626_0543.py | Python | mit | 1,175 |
# Copyright (c) 2015-2021 Patricio Cubillos and contributors.
# MC3 is open-source software under the MIT license (see LICENSE).
import pytest
import mc3.utils as mu
log_content = ["Debugging",
"Hello, this is log",
"Headline",
"""
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Warning:
... | pcubillos/MCcubed | tests/test_logging.py | Python | mit | 2,057 |
# -*- coding: utf-8 -*-
"""Racndicmd setup.py."""
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import os
import sys
class Tox(TestCommand):
"""Tox."""
user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
def initialize_options(self):
... | mtoshi/rancidcmd | setup.py | Python | mit | 2,154 |
# ******************************************************************************
# NOTICE: IF YOU CHANGE THIS FILE PLEASE CHANGE ITS COUNTERPART IN SB_VISION
# ******************************************************************************
# Try to put all game specific code in here
WALL = set(range(0, 28)) # 0 - 27... | sourcebots/robot-api | robot/game_specific.py | Python | mit | 2,127 |
import unittest
from katas.kyu_8.multiply import multiply
class MultiplyTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(multiply(3, 4), 12)
def test_equals_2(self):
self.assertEqual(multiply(10, 10), 100)
| the-zebulan/CodeWars | tests/kyu_8_tests/test_multiply.py | Python | mit | 254 |
import keras
from keras.optimizers import SGD, adadelta, rmsprop, adam
from keras.preprocessing.image import ImageDataGenerator
from keras.utils import np_utils
from keras.metrics import matthews_correlation, precision, recall
import keras.backend as K
import cPickle
import numpy as np
import getpass
username = getpa... | santiagolopezg/MODS_ConvNet | test_lillabcrossval_network.py | Python | mit | 4,398 |
import matplotlib.pyplot as pl
import random as rnd
a = rnd.sample(range(10),10)
print([a])
pl.imshow([a])
| JaeGyu/PythonEx_1 | MatplotlibEx.py | Python | mit | 116 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class ColorBar(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scattergeo.marker"
_path_str = "scattergeo.marker.colorbar"
_valid_props = {
"bgco... | plotly/plotly.py | packages/python/plotly/plotly/graph_objs/scattergeo/marker/_colorbar.py | Python | mit | 78,668 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, unicode_literals, absolute_import
import sys
try:
from unittest.mock import Mock, patch
except ImportError:
from mock import Mock, patch
import pytest
from espwrap.base import batch
from espwrap.adaptors.sendgrid_v3 import SendGridMass... | SpotOnInc/espwrap | tests/test_sendgrid_v3.py | Python | mit | 6,880 |
#!/usr/bin/env python
# A filename is expected as the first command-line argument.
import sys
import json
import os
from ComedyParser import ComedyParser
def askInput(parser):
# ask for the user input
userinput = raw_input('Command: ')
# Quit command
if userinput == "quit":
# stop the pa... | minoskt/ComedyParser | ComedyParser/playComedy.py | Python | mit | 2,429 |
from __future__ import unicode_literals
from django.db import models
class Device(models.Model):
app_label = 'devices'
name = models.CharField(max_length=128, primary_key=True)
last_update = models.DateTimeField(auto_now=True)
modelNames = {
'x86_64':'iPhone Simulator',
'iPhone1,1':'iPhone 1G',
'iPhone1,2':... | mgiger/MobilePerformance | mobile/models.py | Python | mit | 1,874 |
def MinScalarProduct(vector1,vector2,case):
vector1.sort(reverse=False)
vector2.sort(reverse=True)
scalarProduct=0
i=0
while i<len(vector1):
scalarProduct+=vector1[i]*vector2[i]
i+=1
return "Case #"+str(case)+": "+str(scalarProduct)+"\n"
def readTestFile(inputFile,outputFile):
... | alexcasgarcia/GCJ | 2008/1A/MinimumScalarProduct/MinScalarProduct.py | Python | mit | 1,138 |
import file
ciphertext = str(file.openAsAscii("cipher.txt"),"utf-8").replace(" ","")
matches = 0
diffs = set()
N=5
print(len(ciphertext)/N)
for wordlen in range(N*5,N*8,N):
print("Wordlen: {0}".format(wordlen))
for wordIndex in range(len(ciphertext)-wordlen):
for word2Index in range(wordIndex+wordlen,len(ciphertext... | tim-clifford/py-cipher | src/test1.py | Python | mit | 569 |
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 23 2017 at 14:20
@author: Mathias Aschwanden (mathias.aschwanden@gmail.com)
Makes various Variables available to the user.
IMPORTANT: All data has been included without warranty, express or implied.
References:
Molar Masses : From Wikipedia.org
"""
from . impor... | maschwanden/boxsimu | boxsimu/builtins.py | Python | mit | 834 |
import platform
import os
import time
import sys
import json
from threading import Thread
from subprocess import Popen, PIPE
import subprocess
from Queue import Queue, Empty
from datetime import datetime
from ConfigParser import SafeConfigParser
from flask import render_template
from flask import Flask, request, rend... | nlucent/flansible | Flansible/flansible/__init__.py | Python | mit | 2,810 |
from django.shortcuts import render
from django.contrib.auth.models import User
from django.utils.text import slugify
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.p... | skeuomorf/Binge | binge/core/views.py | Python | mit | 1,811 |
import pygame, sys, math
from Meatball import *
class Player(Meatball):
def __init__(self, maxSpeed =5 , pos=[10,10]):
Meatball.__init__(self, pos, None)
size = [45,45]
self.maxSpeed = maxSpeed
self.images = [pygame.transform.scale(pygame.image.load("rsc/ball/SpoonerF.png"), si... | KRHS-GameProgramming-2016/Spoonghetti-Man | Player.py | Python | mit | 4,204 |
import os
import sys
import houseKeeper
from multiprocessing import Pool
import time
def extractMumData(folderName, fileName):
# "Format of the dataList : 1 765 | 11596 10822 | 765 775 | 84.25 | ref_NC_001133_ scf7180000000702"
f = open(folderName + fileName, 'r')
dataLis... | kakitone/finishingTool | experimental/finisherSCCoreLib/alignerRobot.py | Python | mit | 8,230 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'MODEL1310110036.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/MODEL1310110036 | MODEL1310110036/model.py | Python | cc0-1.0 | 427 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainwindow.ui'
#
# Created: Sun Jun 21 00:05:16 2015
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_MainWindow(object):
def setupU... | daniellowtw/Learning | Python GUI and QT/Qt Designer/test.py | Python | cc0-1.0 | 3,059 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Unit tests for pywikibot/textlib.py"""
__version__ = '$Id: cadd8620e9dba64e3c2f3082e6f03f4551fd7641 $'
import unittest
from tests.test_pywiki import PyWikiTestCase
import wikipedia as pywikibot
import pywikibot.textlib as textlib
import catlib
class PyWikiTextLibTestCa... | races1986/SafeLanguage | CEM/tests/test_textlib.py | Python | epl-1.0 | 4,110 |
import sys
import sqlite3
import os
import os.path
def main(dbname):
con = sqlite3.connect(dbname)
con.execute("CREATE TABLE IF NOT EXISTS rooms(id INTEGER PRIMARY KEY, name TEXT NOT NULL,"
" description TEXT NOT NULL)")
con.commit()
path = "./rooms"
for f in os.listdir(path):
... | L0st1nC0d3/TextAdventure | todb.py | Python | epl-1.0 | 1,112 |
""""
Meaningful Scales Detection: an Unsupervised Noise Detection Algorithm for \
Digital Contours
Demo Editor: B. Kerautret
"""
from lib import base_app, build, http, image, config
from lib.misc import app_expose, ctime
from lib.base_app import init_app
import cherrypy
from cherrypy import TimeoutError
import os.path... | juan-cardelino/matlab_demos | ipol_demo-light-1025b85/app_available/75/app.py | Python | gpl-2.0 | 17,698 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------
# File Name: utils.py
# Author: Zhao Yanbai
# Thu Oct 30 06:33:24 2014
# Description: none
# ------------------------------------------------------------------------
import loggi... | acevest/monitor | utils.py | Python | gpl-2.0 | 6,848 |
import simplejson
import datetime
#import facebook
import urllib
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import pre_save, post_save, pre_delete
from django.utils.translation import ugettext_lazy as _
class GoogleProfile(models.Model):
user = models.... | viswimmer1/PythonGenerator | data/python_files/34442233/models.py | Python | gpl-2.0 | 827 |
import pdb
import math
import time
from types import *
import wx
import wx.lib.wxcairo
import cairo
import rsvg
import yang
import svg
import wx.lib.scrolledpanel as scrolled
#from wx.py import shell,
#from wx.py import version
import dot
from common import *
from module import Module
from entity import *
from model ... | OpenClovis/SAFplus-Availability-Scalability-Platform | src/ide/umlEditor.py | Python | gpl-2.0 | 42,936 |
from preprocessing.img_segmenting import ImgSegmenter
from preprocessing.NoiseRemoval import NoiseRemoval
from preprocessing.imageScaler import imageScaler
noise_remover = NoiseRemoval()
img_scaler = imageScaler()
segmenter = ImgSegmenter(5)
| lisiyuan656/Gesture-Recognizer | preprocessing/__init__.py | Python | gpl-2.0 | 250 |
import os
import logging
import time
import ConfigParser
from fabric.operations import get
from fabric.api import sudo, local, lcd, cd, shell_env
from aws_collector.config.config import MAIN_CFG, S3_BUCKET
OUTPUT_FILE_FMT = '%s-%s-collect-output.tar'
S3_UPLOAD_CMD = 'aws s3 cp --region us-east-1 %s s3://%s/%s'
def... | andresriancho/collector | aws_collector/utils/collect.py | Python | gpl-2.0 | 4,386 |
# -*- coding: utf-8 -*-
from .models import Slider, Category, SoundLibrary
def slider(request):
slides = Slider.objects.all()
return {'slider': slides}
def category(request):
categories = Category.objects.all()
return {'category_menu': categories}
def fonoteca(request):
library = SoundLibrar... | gollum23/oidoypaz | web/context_processors.py | Python | gpl-2.0 | 369 |
#!/usr/bin/env python
from .HTMLElement import HTMLElement
from .attr_property import attr_property
from .compatibility import thug_long
class HTMLImageElement(HTMLElement):
def __init__(self, doc, tag):
HTMLElement.__init__(self, doc, tag)
align = attr_property("align")
alt ... | qistoph/thug | src/DOM/W3C/HTML/HTMLImageElement.py | Python | gpl-2.0 | 984 |
from simulator import fasthenry as simulator
from syntax import *
from math import pi, sqrt
from simulator import fasthenry as simulator
__all__ = ['FastHenry', 'Title', 'Units', 'Default', 'Node', 'Segment', 'Port', 'Freq', 'Equiv']
class FastHenry(list):
def __init__(self):
list.__init__(self... | raphaelvalentin/qtlayout | syntax/bin/fasthenry.py | Python | gpl-2.0 | 1,919 |
'''
Created on 2015. 4. 20.
@author: sunabove
'''
from abc import ABCMeta, abstractmethod
class DroneCmd(object):
'''
classdocs
'''
__metaclass__ = ABCMeta
def __init__(self, cmd):
'''
Constructor
'''
self.cmd = cmd
@abstractmethod
def doCm... | kdrone/crazyflie-python-client | lib/cfclient/DroneCmd.py | Python | gpl-2.0 | 955 |
class Solution(object):
def isPalindrome(self, s):
"""
:type s: str
:rtype: bool
"""
s = re.sub('[^a-zA-Z0-9]','',s.lower())
return True if s == s[::-1] else False | ranji2612/leetCode | validPalindrome.py | Python | gpl-2.0 | 215 |
import cv2
import numpy as np
import sys
from time import sleep
class Hue:
h = 0
s = 0
v = 0
class HueAverage:
def __init__(self, wname, wwidth, wheight, avgSize):
self.avgSize = avgSize
self.x = self.y = 0
self.at = Hue();
self.avg = Hue();
self.clicked = False... | philkroos/tinkervision | src/test/colormatch/pick_color.py | Python | gpl-2.0 | 2,616 |
from django.conf.urls import patterns, include, url
from evesch.euser.views import *
urlpatterns = patterns('',
url('^(?P<username>\w{1,30})/$', 'evesch.euser.views.user_view', {'template_name':'euser/user_view.html'}, name='euser_user_view'),
url('^ajax/lookup_users/$', 'evesch.euser.views.lookup_users', ... | JoeJasinski/evesch | evesch/euser/urls.py | Python | gpl-2.0 | 878 |
#!/usr/bin/env python
import unittest
from persistence.in_memory.models.attachment import Attachment
class AttachmentReprTest(unittest.TestCase):
def test_generates_repr_string(self):
# given
att = Attachment(path='/path/to/file')
att.id = 123
#when
r = repr(att)
... | izrik/tudor | tests/persistence_t/in_memory/models/attachment_t/test_attachment_repr.py | Python | gpl-2.0 | 443 |
import sys
import glob
#import sets
import re
def openSpec(fname, mode="r"):
""" open and return filehandle, open stdin if fname=="stdin", do nothing if none """
if fname=="stdin":
return sys.stdin
elif fname=="stdout":
return sys.stdout
elif fname=="none" or fname==None:
return... | maximilianh/maxtools | lib/tabfile.py | Python | gpl-2.0 | 15,316 |
# Copyright (C) 2013-2015 Codethink Limited
#
# 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 the hope that it will be useful,
# but... | nuxeh/morph | morphlib/morphloader.py | Python | gpl-2.0 | 27,674 |
'''CDS management tests'''
from __future__ import print_function
from os.path import basename
import random
import re
import logging
import nose
from stitches.expect import CTRL_C, Expect
from rhui3_tests_lib.conmgr import ConMgr, SUDO_USER_NAME, SUDO_USER_KEY
from rhui3_tests_lib.helpers import Helpers
from rhui3_... | RedHatQE/rhui3-automation | tests/rhui3_tests/test_cds.py | Python | gpl-2.0 | 7,583 |
__author__ = 'ariel'
"""
Python Population Simulator
Copyright (C) 2015 Ariel Young
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 yo... | DarthGeek01/PopulationSimulator | Genetics/Allele.py | Python | gpl-2.0 | 6,542 |
#
# Chris Lumens <clumens@redhat.com>
#
# Copyright 2005, 2006, 2007, 2008, 2011 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hop... | tradej/pykickstart-old | pykickstart/commands/raid.py | Python | gpl-2.0 | 16,234 |
__package__ = 'geobricks_trmm'
__author__ = 'Barbaglia, Guido - Murzilli, Simone'
__email__ = 'guido.barbaglia@gmail.com; simone.murzilli@gmail.com;'
__license__ = 'GPL2' | geobricks/geobricks_trmm | geobricks_trmm/__init__.py | Python | gpl-2.0 | 170 |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# 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
... | brownian/frescobaldi | frescobaldi_app/musicview/__init__.py | Python | gpl-2.0 | 25,858 |
# encoding: utf-8
"""nanotube.py - Window for setting up Graphene sheets and ribbons.
"""
import gtk
from ase.gui.widgets import pack, cancel_apply_ok, oops
from ase.gui.setupwindow import SetupWindow
from ase.gui.pybutton import PyButton
from ase.structure import graphene_nanoribbon
import ase
import numpy as np
in... | slabanja/ase | ase/gui/graphene.py | Python | gpl-2.0 | 8,902 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
DsgTools
A QGIS plugin
Brazilian Army Cartographic Production Tools
-------------------
begin : 2019-01-04
git sha ... | lcoandrade/DsgTools | core/DSGToolsProcessingAlgs/Algs/OtherAlgs/fileInventoryAlgorithm.py | Python | gpl-2.0 | 8,002 |
import re
import utilities
import component
def setvariables(text):
component.chapter_abbrev = utilities.argument_of_macro(text,"chap",2)
###################
def mytransform(text):
thetext = text
# get rid of extraneous spaces after \begin and \end
thetext = re.sub(r"\\begin\s+{",r"\\begin{",th... | moses1984/aafmt | LaTeXtoLaTeX-master/myoperations.py | Python | gpl-2.0 | 1,718 |
from django.conf.urls import include, url
from . import views
urlpatterns = [
url(r'^$', views.subform, name='subform'),
url(r'^submit', views.submit, name='submit'),
] | jameskane05/final_helpstl | submit/urls.py | Python | gpl-2.0 | 177 |
# coding: utf-8
import configureEnvironnement
configureEnvironnement.setup()
import django
django.setup()
from datetime import datetime, date, timedelta
from chambres.models import Reservation, Client
from chambres.views import OneDayStats
rs = Reservation.objects.all()
for r in rs:
if r.dateArrivee > r.dateDep... | simonpessemesse/seguinus | chambres_chercheErreurDate.py | Python | gpl-2.0 | 361 |
# Copyright (C) 2012 University of Southern California
# This software is licensed under the GPLv3 license, included in
# ./GPLv3-LICENSE.txt in the source distribution
from collections import defaultdict
import itertools
import logging
import os
import shlex
import sys
from magi.util import helpers
from magi.util.ex... | deter-project/magi | magi/testbed/emulab.py | Python | gpl-2.0 | 7,564 |
import os
from record import Record
from timeutils import isodate
from git import Git
import applib
import re
class XmlStorage:
""" XML storage engine for the record
"""
@staticmethod
def setup(dataDir):
engineDir = os.path.join(dataDir, 'xml')
os.makedirs(engineDir, exist_ok=True)
... | iesugrace/log-with-git | xmlstorage.py | Python | gpl-2.0 | 13,529 |
# Implementation of classic arcade game Pong
import simplegui
import random
# initialize globals - pos and vel encode vertical info for paddles
WIDTH = 600
HEIGHT = 400
BALL_RADIUS = 20
PAD_WIDTH = 8
PAD_HEIGHT = 80
HALF_PAD_WIDTH = PAD_WIDTH / 2
HALF_PAD_HEIGHT = PAD_HEIGHT / 2
LEFT = False
RIGHT = True
ball... | analca3/InteractivePythonCoursera | pong.py | Python | gpl-2.0 | 4,431 |
#!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | dsweet04/rekall | rekall-agent/rekall_agent/flows/find.py | Python | gpl-2.0 | 8,647 |
import yaml
# We try to dump using the CSafeDumper for speed improvements.
try:
from yaml import CSafeDumper as Dumper
except ImportError: #pragma: no cover
from yaml import SafeDumper as Dumper #pragma: no cover
from hepdata_converter.common import Option, OptionInitMixin
from hepdata_converter.writers import ... | HEPData/hepdata-converter | hepdata_converter/writers/yaml_writer.py | Python | gpl-2.0 | 3,048 |
import remote_controller
import bluetooth
class Carty:
""" this is the main module of the application """
def __init__(self):
self.controller = remote_controller.RemoteController()
self.bluetooth = bluetooth.Bluetooth(self.controller.on_open,
self.c... | IvayloTsankov/carty | src/carty.py | Python | gpl-2.0 | 649 |
import json
from copy import deepcopy
from datetime import datetime, timezone
import listenbrainz.db.stats as db_stats
import listenbrainz.db.user as db_user
from data.model.common_stat import StatRange
from data.model.user_artist_map import UserArtistMapRecord
from data.model.user_daily_activity import DailyActivityR... | metabrainz/listenbrainz-server | listenbrainz/db/tests/test_stats.py | Python | gpl-2.0 | 16,778 |
import datetime
import mailman
import mailbox
import numpy as np
from bigbang.thread import Thread
from bigbang.thread import Node
import pandas as pd
import pytz
import utils
def load(path):
data = pd.read_csv(path)
return Archive(data)
class Archive:
"""
A representation of a mailing list archive... | raj4/bigbang | bigbang/archive.py | Python | gpl-2.0 | 6,045 |
# Library from https://github.com/nikipore/alfred-python
import alfred
import re
import unicodedata
import xml.dom
import xml.dom.minidom
import time
# XML verbs db
conjFR = xml.dom.minidom.parse('conjugation-fr.xml')
verbsFR = xml.dom.minidom.parse('verbs-fr.xml')
conjList = conjFR.getElementsByTagName('template')
v... | usrix/alfred-verbizr-workflow | verbizr.py | Python | gpl-2.0 | 1,716 |
import time
import binascii
import struct
from twisted.internet import defer
from stratum.services import GenericService
from stratum.pubsub import Pubsub, Subscription
from stratum.custom_exceptions import ServiceException, RemoteServiceException
from jobs import JobRegistry
import stratum.logger
log = stratum.log... | oxagast/hashnet | stratum-mining-proxy/mining_libs/stratum_listener.py | Python | gpl-2.0 | 7,466 |
# encoding: utf-8
# module samba.dcerpc.samr
# from /usr/lib/python2.7/dist-packages/samba/dcerpc/samr.so
# by generator 1.135
""" samr DCE/RPC """
# imports
import dcerpc as __dcerpc
import talloc as __talloc
class RidWithAttribute(__talloc.Object):
# no doc
def __init__(self, *args, **kwargs): # real signa... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/samba/dcerpc/samr/RidWithAttribute.py | Python | gpl-2.0 | 1,272 |
# -*- coding: utf-8 -*-
# ===========================================================================
#
# Copyright (C) 2014 Samuel Masuy. All rights reserved.
# samuel.masuy@gmail.com
#
# ===========================================================================
from flask import Flask
# Declare app object
app =... | samuelmasuy/Concordia-Schedule-to-Gcal | app/__init__.py | Python | gpl-2.0 | 448 |
import elementtree.ElementTree as ET
class GraphicRenderingQuality:
High = 2
Medium = 1
Low = 0
#import clr
#from System import *
#from System.IO import *
#from System.Xml import *
#from System.Xml.Serialization import *
#from OpenRacing.Core import *
#from OpenRacing.Graphic import *
#Put in a custom namespace t... | KeithCu/PyTorcs | sim/application/OpenRacingConfig.py | Python | gpl-2.0 | 4,130 |