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 |
|---|---|---|---|---|---|
from scytale.ciphers import Caesar
if __name__ == '__main__':
plaintext = input('Plaintext: ')
key = int(input('Key: '))
ciphertext = Caesar(key=key).encrypt(plaintext)
print(f'Ciphertext: {ciphertext}')
| WilliamMayor/scytale.xyz | scripts/encrypt/caesar.py | Python | mit | 222 |
# coding: utf8
"""
webencodings.tests
~~~~~~~~~~~~~~~~~~
A basic test suite for Encoding.
:copyright: Copyright 2012 by Simon Sapin
:license: BSD, see LICENSE for details.
"""
from __future__ import unicode_literals
from . import (lookup, LABELS, decode, encode, iter_decode, iter_encode,
... | aeroaks/httpProfiler | methods/webencodings/tests.py | Python | mit | 6,184 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging, os, sets
from rapid_app import settings_app
from rapid_app.models import ManualDbHandler, PrintTitleDev
log = logging.getLogger(__name__)
class UpdateTitlesHelper( object ):
""" Manages views.update_production_easyA_titles() work. ... | birkin/rapid_exports | rapid_app/lib/viewhelper_updatedb.py | Python | mit | 9,897 |
import os
import unittest
from conans.util.files import mkdir_tmp
from conans import __version__ as client_version
from conans import tools
from conans.client.conan_api import ConanAPIV1
from cpt.test.utils.tools import TestBufferConanOutput
CONAN_UPLOAD_URL = os.getenv("CONAN_UPLOAD_URL",
... | conan-io/conan-package-tools | cpt/test/integration/base.py | Python | mit | 1,994 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as publish... | rogerscristo/BotFWD | env/lib/python3.6/site-packages/telegram/inline/inlinequeryresultdocument.py | Python | mit | 4,538 |
"""Track the jinja2 rendering dependencies using a custom environment.
Trying to track with a custom loader does not work since the templates are cached
by the environment and only triggers the loader the first time the template is used.
By using a modified version of the code generator and environment, the context
i... | grow/grow | grow/templates/jinja_dependency.py | Python | mit | 5,519 |
from tests.test_helper import *
from braintree.resource import Resource
class TestResource(unittest.TestCase):
def test_verify_keys_allows_wildcard_keys(self):
signature = [
{"foo": [{"bar": ["__any_key__"]}]}
]
params = {
"foo[bar][lower]": "lowercase",
... | braintree/braintree_python | tests/unit/test_resource.py | Python | mit | 3,302 |
"""
Tests for efflux.telemetry.endpoint
"""
import unittest
import mock
from efflux.telemetry.endpoint import Telemetry
class Dummy(Telemetry):
def _set_route(self):
self.base_route = None
class TelemetryTests(unittest.TestCase):
'''Tests for EffluxEndpoint'''
MOCKS = [
]
def setUp(... | effluxsystems/pyefflux | tests/unit/test_base.py | Python | mit | 1,403 |
import errno
import fnmatch
import os
import os.path
import random
import shutil
import stat
import sys
from contextlib import contextmanager
from tempfile import NamedTemporaryFile
# NOTE: retrying is not annotated in typeshed as on 2017-07-17, which is
# why we ignore the type on this import.
from pip._vendor.... | davidharvey1986/pyRRG | unittests/bugFixPyRRG/lib/python3.7/site-packages/pip/_internal/utils/filesystem.py | Python | mit | 6,813 |
from math import radians, cos, sin, asin, sqrt, degrees, pi, atan2
from enum import Enum
from typing import Union
# mean earth radius - https://en.wikipedia.org/wiki/Earth_radius#Mean_radius
_AVG_EARTH_RADIUS_KM = 6371.0088
class Unit(Enum):
"""
Enumeration of supported units.
The full list can be check... | mapado/haversine | haversine/haversine.py | Python | mit | 5,961 |
#correctness 100%, performance 0%
import re
stack = []
def solution(line):
global stack
if re.findall('\w+', line): return 0
try:
if not line and not stack: return 1
if line[0] == '(': stack.append('(')
elif line[0] == ')': stack.pop()
print "stack:", stack
line = line[1:]
print "line: %... | nomuna/codility | Lesson_07/nesting.py | Python | mit | 673 |
import optparse
from timeit import Timer
try:
import pyamf
from pyamf.util import BufferedByteStream
use_pyamf = True
except ImportError:
use_pyamf = False
from amfast.context import DecoderContext, EncoderContext
import amfast.encode as encode
import amfast.decode as decode
import amfast.class_def as... | limscoder/amfast | tests/speed_test.py | Python | mit | 10,975 |
import os
import sys
import time
import pygame
import socket
import fcntl
import struct
import serial
import RPi.GPIO as GPIO
time_stamp_prev=0
def main():
GPIO.setmode(GPIO.BCM)
GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_UP)
loop_forever = True
prev_input = 1
while True:
in... | tlevis/Pepino | user-interface/python-scripts/port-test.py | Python | mit | 682 |
"""
distribution.py
Author: Will Campbell
Credit: Dave Wilson, Ethan Adner, http://stackoverflow.com/questions/3121979/how-to-sort-list-tuple-of-lists-tuples
Assignment:
Write and submit a Python program (distribution.py) that computes and displays
the distribution of characters in a given sample of text.
Output of... | willcampbel/Character-Distribution | distribution.py | Python | mit | 1,888 |
import json
from datetime import datetime
# In order for this script to work, the original allData2003_2004.json
# file must be downloaded and placed in the data directory!
f = open('../data/allData2003_2004.json', 'r')
g = open('../data/aggregated-radiation-data.json', 'wb')
raw = json.load(f)
# Since month-by-mon... | rlucioni/cs171-hw4-lucioni-renzo | ProblemGeoUSA/aggregator.py | Python | mit | 950 |
# Licensed under an MIT style license - see LICENSE
"""
ingredients --- Beer ingredients
================================
"""
from enum import Enum
from collections.abc import MutableSequence
from . import timing as T
__all__ = [
'PPG',
'CultureBank',
'Culture',
'Ingredient',
'Fermentable',
... | mkelley/brew | brew/ingredients.py | Python | mit | 25,766 |
#!/usr/bin/env python
from __future__ import absolute_import, unicode_literals, print_function
import re
try:
from urllib2 import urlopen, HTTPError
except ImportError:
# Python 3
from urllib.request import urlopen
from urllib.error import HTTPError
import json
import requests
import time
import sys
... | rfarley3/Kibana | kibana/mapping.py | Python | mit | 17,896 |
#!/usr/bin/python
#
# Copyright (c) 2009 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of ... | luma/filterchain | tools/cpplint.py | Python | mit | 234,744 |
from . import backend
from . import exception_types
from .differential_system import DiffRHS, rhs_prettifier, OdeSystem
from . import utilities
from . import integrators
from .integrators import available_methods
from . import tests
from .utilities import tests
from .exception_types import tests
try:
# Pytest te... | Microno95/DESolver | desolver/__init__.py | Python | mit | 446 |
"""Find all models written by user Hutton, including the DOI and the
source code repository for each model.
"""
from ask_api_examples import make_query
query = '[[Last name::Hutton]]|?DOI model|?Source web address'
def main():
r = make_query(query, __file__)
return r
if __name__ == '__main__':
print ... | mdpiper/csdms-wiki-api-examples | ask_api_examples/list_model_repo_doi.py | Python | mit | 327 |
"""
test_minimal.py
--------------
Test things that should work with a *minimal* trimesh install.
"""
import os
import unittest
import trimesh
# the path of the current directory
_pwd = os.path.dirname(
os.path.abspath(os.path.expanduser(__file__)))
# the absolute path for our reference models
_mwd = os.path.a... | mikedh/trimesh | tests/test_minimal.py | Python | mit | 1,347 |
from django import template
from django.contrib.contenttypes.models import ContentType
from django.template.loader import get_template
from rating.models import *
from rating.utils import get_target_for_object
register = template.Library()
class GetRatingNode(template.Node):
def __init__(self, object_name, va... | ericholscher/django-rating | rating/templatetags/rating_tags.py | Python | mit | 2,481 |
# -*- coding: utf-8 -*-
import os
import sys
from django.contrib.auth.decorators import login_required
from django import get_version as get_django_version
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.conf import settings
from django_info import __version__
de... | marcelor/django_info | django_info/views.py | Python | mit | 1,879 |
#!BPY
"""
Name: 'Inter-Quake Model'
Blender: 249
Group: 'Export'
Tip: 'Export Inter-Quake Model files'
"""
import struct, math
import Blender
import BPyArmature
IQM_POSITION = 0
IQM_TEXCOORD = 1
IQM_NORMAL = 2
IQM_TANGENT = 3
IQM_BLENDINDEXES = 4
IQM_BLENDWEIGHTS = 5
IQM_COLOR ... | lsalzman/iqm | blender-2.49/iqm_export.py | Python | mit | 40,875 |
import ply.lex as lex
from ast import Node
reserved = {
'or' : 'LOR',
'and' : 'LAND',
'neg' : 'NEG',
'exists' : 'EXISTS',
'forall' : 'FORALL',
'implies': 'IMPLIES',
'iff' : 'IFF'
}
tokens = tuple(
[
'WORD',
'VARIABLE',
'CONSTANT',
'FUNCTION',
'PREDICATE',
'COMMA',
'LPA... | arity-r/MiniLogic | lex.py | Python | mit | 1,410 |
"""
A small Sphinx extension that adds Domain objects (eg. Python Classes & Methods) to the TOC Tree.
It dynamically adds them to the already rendered ``app.env.tocs`` dict on the Sphinx environment.
Traditionally this only contains Section's,
we then nest our Domain references inside the already existing Sections.
""... | rtfd/sphinx-autoapi | autoapi/toctree.py | Python | mit | 5,871 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-11-12 17:04
from __future__ import unicode_literals
from django.db import migrations, models
import posts.models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | shawon922/django-blog | posts/migrations/0001_initial.py | Python | mit | 1,203 |
# coding=utf-8
"""Abbreviations and codes of interest."""
LANGUAGE_CODES = {
"aa": "Afar",
"ab": "Abkhazian",
"ae": "Avestan",
"af": "Afrikaans",
"ak": "Akan",
"am": "Amharic",
"an": "Aragonese",
"ar": "Arabic",
"as": "Assamese",
"av": "Avaric",
"ay": "Aymara",
"az": "Az... | clickwork/clickwork | main/abbreviations.py | Python | mit | 9,976 |
from __future__ import print_function
import time
ct = time.time()
from lasagne.layers import get_output, InputLayer, DenseLayer, ReshapeLayer, NonlinearityLayer
from lasagne.nonlinearities import rectify, leaky_rectify
from lasagne.updates import nesterov_momentum, rmsprop, adamax
import sys, os, time
scriptpath = ... | bthyreau/hippodeep | applyseg_unique.py | Python | mit | 11,344 |
# -*- coding: utf-8 -*-
ADMIN_MAPPING = {
'admin_user_suspend': {
'resource': 'admin/users/{id}/suspend',
'docs': ('http://docs.discourse.org/#tag/'
'Admin%2Fpaths%2F~1admin~1users~1%7Bid%7D~1suspend%2Fput'),
'methods': ['PUT'],
},
'admin_user_unsuspend': {
... | 0xc0ffeec0de/tapioca-discourse | tapioca_discourse/resource_mapping/admin.py | Python | mit | 3,741 |
# -*- coding: utf-8 -*-
import logging
import smtplib
from email.mime.text import MIMEText
from datetime import datetime
last_hour = datetime.now().strftime('%H')
last_hour_send_count = 0
class Sender(object):
'Sender插件类,必须使用Sender作为类名'
def __init__(self, options):
'插件初始化方法,options是插件配置数据'
... | onlytiancai/warning-agent | src/senders/mail.py | Python | mit | 2,060 |
import subprocess
import json
import math
import re
import lizard
from jinja2 import Environment, FileSystemLoader
from xml.dom import minidom
from decimal import Decimal
from analyzr.settings import CONFIG_PATH, PROJECT_PATH, LAMBDA
XML_ILLEGAL = u'([\u0000-\u0008\u000b-\u000c\u000e-\u001f\ufffe-\uffff])|([%s-%s][... | frontendphil/analyzr | parsr/checkers.py | Python | mit | 15,240 |
import time
from goose import Goose
def load_jezebel():
with open('resources/additional_html/jezebel1.txt') as f:
data = f.read()
return data
def bench(iterations=100):
data = load_jezebel()
goose = Goose()
times = []
for _ in xrange(iterations):
t1 = time.time()
goose.... | scivey/goosepp | scripts/benchmark_python_goose.py | Python | mit | 648 |
import sublime, sublime_plugin
import difflib
import time
import datetime
import codecs
import os
def diff_changes(file_name, result):
try:
if "Body" in result:
server = result["Body"].splitlines()
elif "Markup" in result:
server = result["Markup"].splitlines()
loca... | xjsender/haoide | salesforce/lib/diff.py | Python | mit | 2,098 |
import sys
from Bio import SeqIO
SNPTOPEAKFILENAME = sys.argv[1]
GENOMEFILENAME = sys.argv[2]
DISTANCE = int(sys.argv[3])
BINDALLELESEQFILENAME = sys.argv[4]
NONBINDALLELEFILENAME = sys.argv[5]
FIRSTPEAKCOL = int(sys.argv[6]) # 0-INDEXED
def getSNPInfo(SNPToPeakLine):
# Get the SNP and peak location from ... | imk1/IMKTFBindingCode | getSequencesForSNPs.py | Python | mit | 2,698 |
from numpy import *
from pylab import *
plt.figure(figsize=(10, 8))
phi_1, phi_2, v1, v2 = genfromtxt(
'../../../../data/out/rust-examples/mcmc/sample.dat').T
plt.hist2d(phi_1, phi_2, bins=100)
plt.colorbar()
plt.show()
| heyfaraday/rustcmb | py/examples/mcmc/image.py | Python | mit | 226 |
from defines import *
import numpy as np
import mobula
import mobula.layers as L
class LeNet5:
def __init__(self, X, labels):
data, label = L.Data([X, labels], "data", batch_size = 100)
conv1 = L.Conv(data, dim_out = 20, kernel = 5)
pool1 = L.Pool(conv1, pool = L.Pool.MAX, kernel = 2, stri... | wkcn/mobula | examples/LeNet5.py | Python | mit | 1,026 |
# -*- coding: utf-8 -*-
import os
import unittest
import tempfile
from datetime import datetime
from flask.ext.sqlalchemy import SQLAlchemy
from app import app, db, Pass, Registration
class PassbookTestCase(unittest.TestCase):
def setUp(self):
temp = tempfile.mkstemp()
self.temp = temp
... | renstrom/passbook_flask_example | tests.py | Python | mit | 1,287 |
from django.apps import AppConfig
class Leaderboard2Config(AppConfig):
name = 'leaderboard'
| FRC-RS/FRS | leaderboard/apps.py | Python | mit | 98 |
from typing import TypeVar, Dict, Any
from django import template
from django.conf import settings
from util.getters import reverse_model_url
register = template.Library()
T = TypeVar('T')
@register.filter(name='get_from_dict')
def get_from_dict(dictionary: Dict[T, Any], key: T):
value = dictionary.get(key)
... | FRC-RS/FRS | TBAW/templatetags/getters.py | Python | mit | 750 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'BIOMD0000000462.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/BIOMD0000000462 | BIOMD0000000462/model.py | Python | cc0-1.0 | 427 |
#!/usr/bin/python
# vi: ts=4 expandtab syntax=python
##############################################################################
# Copyright (c) 2008 IBM Corporation
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which acco... | Awingu/open-ovf | py/tests/OvfEnvironmentTestCase.py | Python | epl-1.0 | 22,345 |
###
# Copyright 2011 Diamond Light Source Ltd.
#
# 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
#
# Unless required by applicable l... | erwindl0/python-rpc | org.eclipse.triquetrum.python.service/scripts/scisoftpy/plot.py | Python | epl-1.0 | 26,232 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | i2c2-caj/CS4990 | Homework/crminal/crm/migrations/0001_initial.py | Python | gpl-2.0 | 6,674 |
#
# BitBake (No)TTY UI Implementation
#
# Handling output to TTYs or files (no TTY)
#
# Copyright (C) 2006-2012 Richard Purdie
#
# SPDX-License-Identifier: GPL-2.0-only
#
from __future__ import division
import os
import sys
import xmlrpc.client as xmlrpclib
import logging
import progressbar
import signal
import bb.ms... | schleichdi2/OPENNFR-6.3-CORE | bitbake/lib/bb/ui/knotty.py | Python | gpl-2.0 | 29,579 |
from checkio_referee import RefereeCodeGolf
from checkio_referee import covercodes, validators, representations
import settings_env
from tests import TESTS
class AutoPaintingValidator(validators.BaseValidator):
def validate(self, outer_result):
steps, k, n = self._test["validation_data"]
if not ... | Empire-of-Code-Puzzles/checkio-empire-auto-painting | verification/src/referee.py | Python | gpl-2.0 | 2,173 |
import random
def war_handler():
war_handler.count += 1
print("War is {0} is happening.").format(war_handler.count)
if len(player_one) > 4 and len(player_two) > 4:
limiter = 3
elif len(player_one) == 4 or len(player_two) == 4:
limiter = 2
else: # len(player_one) < 4 or len(player_... | AustinDKB/War-Card-Game-Simulator | war_sim.py | Python | gpl-2.0 | 4,472 |
#!/usr/bin/env python
###
# Copyright (c) 2013, Jim Richardson <weaselkeeper@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above... | weaselkeeper/misc_monitoring_scripts | src/webapp_monitor.py | Python | gpl-2.0 | 5,060 |
# -*- coding: utf8 -*-
# Copyright (C) 2015 - Philipp Temminghoff <phil65@kodi.tv>
# This program is Free Software see LICENSE file for details
from Utils import *
import xbmc
import xbmcaddon
import xbmcgui
import xbmcvfs
import os
from dialogs import BaseClasses
from LocalDB import local_db
import TheMovieDB
ADD... | AMOboxTV/AMOBox.LegoBuild | script.extendedinfo/resources/lib/WindowManager.py | Python | gpl-2.0 | 12,611 |
#
# The Python Imaging Library.
# $Id: MicImagePlugin.py,v 1.2 2007/06/17 14:12:15 robertoconnor Exp $
#
# Microsoft Image Composer support for PIL
#
# Notes:
# uses TiffImagePlugin.py to read the actual image streams
#
# History:
# 97-01-20 fl Created
#
# Copyright (c) Secret Labs AB 1997.
... | arpruss/plucker | plucker_desktop/installer/osx/application_bundle_files/Resources/parser/python/vm/PIL/MicImagePlugin.py | Python | gpl-2.0 | 2,334 |
#! /usr/bin/env python
from ppclass import pp
les = pp(file="/home/aymeric/Big_Data/LES_dd/psfc_f18.nc",var="PSFC",y=["50,250"],x=["50","100"])
les.verbose = True
les.getplot()
les.x = None
les.y = ["200","250"]
les.t = "10"
les.getplot()
les.x = None
les.y = None
les.t = ["10"]
#les.stridex = 3
#les.stridey = 3
les... | aymeric-spiga/planetoplot | examples/ppclass_reference/les_psfc.py | Python | gpl-2.0 | 360 |
import tkinter
import logging
######################### Utility Functions #########################
def But(w, text='x', command='', side=tkinter.LEFT) :
b = tkinter.Button(w, text=text, command=command)
b.pack(side=side, padx=5, pady=5)
return(b)
def Drop(w, options=['zero', 'one', 'two'], defaul... | pdgilbert/Vcourse | lib/GUIutils.py | Python | gpl-2.0 | 2,664 |
import pstats, sys
fn = 'ddprintstats.prof'
if len(sys.argv) > 1:
fn = sys.argv[1]
p = pstats.Stats(fn)
ps = p.strip_dirs()
ps.sort_stats('tot').print_stats(100)
ps.sort_stats('cumulative').print_stats(100)
ps.sort_stats('ncall').print_stats(100)
| ErwinRieger/ddprint | host/snippets/printstats.py | Python | gpl-2.0 | 257 |
#!/usr/bin/env python
import ast
import os
import re
import sys
from setuptools import find_packages, setup
here = os.path.dirname(__file__)
def read(filename):
with open(os.path.join(here, filename), encoding='utf-8') as f:
return f.read()
metadata = {
k: ast.literal_eval(v)
for k, v in re.f... | gtimelog/gtimelog | setup.py | Python | gpl-2.0 | 2,464 |
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2021 RERO
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that... | rero/reroils-app | rero_ils/modules/stats/views.py | Python | gpl-2.0 | 3,472 |
'''
Using the Python language, have the function MultiplicativePersistence(num)
take the num parameter being passed which will always be a positive integer
and return its multiplicative persistence which is the number of times
you must multiply the digits in num until you reach a single digit.
For example: if num ... | anomen-s/programming-challenges | coderbyte.com/easy/Multiplicative Persistence/solve.py | Python | gpl-2.0 | 820 |
'''
Created on 2014-11-18
@author: hongye
'''
from pyformance import registry
from core.MetricProcessor import MetricProcessor
class AlarmSendStrategy(object):
pass
class AlarmSender(object):
_strategy = None
def send(self):
pass
class AlarmMetricProcessor(MetricProcessor):
_alarmSend... | anyonedev/anyonedev-monitor-agent | monitor/processor/AlarmMetricProcessor.py | Python | gpl-2.0 | 523 |
#! /usr/bin/env python2.5
## PyRT: Python Routeing Toolkit
## OSPF module: provides the OSPF listener and OSPF PDU parsers
## Copyright (C) 2010 Richard Mortier <mort@cantab.net>
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Publ... | mor1/pyrt | ospf.py | Python | gpl-2.0 | 26,560 |
#
# Copyright (C) 2020 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, or (at your option) any later version.
# This program is distributed in the hope that it will be ... | atodorov/anaconda | pyanaconda/modules/payloads/source/hmc/initialization.py | Python | gpl-2.0 | 2,546 |
#
# Copyright 2012 Red Hat, 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... | aglitke/vdsm | tests/gluster_cli_tests.py | Python | gpl-2.0 | 45,993 |
# -*- coding: utf-8 -*-
#
# This tool helps you to rebase package to the latest version
# Copyright (C) 2013-2014 Red Hat, 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 2... | phracek/rebase-helper | rebasehelper/tests/test_archive.py | Python | gpl-2.0 | 2,830 |
# -*- coding: utf-8 -*-
#
# Copyright 2008 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 y... | rdio/translate-toolkit | search/indexing/PyLuceneIndexer1.py | Python | gpl-2.0 | 7,865 |
# -*- coding: utf-8 -*-
########################################################################
# #
# python-OBD: A python OBD-II serial module derived from pyobd #
# #
# C... | brendan-w/python-OBD | obd/utils.py | Python | gpl-2.0 | 6,075 |
from django.db import models as dbmodels, connection
from django.utils import datastructures
from autotest.frontend.afe import model_logic, readonly_connection
_quote_name = connection.ops.quote_name
class TempManager(model_logic.ExtendedManager):
_GROUP_COUNT_NAME = 'group_count'
def _get_key_unless_is_func... | yangdongsheng/autotest | frontend/tko/models.py | Python | gpl-2.0 | 30,170 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pages', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='simplecontact',
fields=[
... | nikhila05/MicroSite | pages/migrations/0002_simplecontact.py | Python | gpl-2.0 | 849 |
# -*- coding: utf-8 -*-
from django.db import models
from ..users.models import User
class Feedback(models.Model):
user = models.ForeignKey(User)
comments = models.CharField(max_length=50000)
date = models.DateTimeField(auto_now=True)
class Meta:
ordering = ["-date"]
def __str__(self):
... | jacobajit/ion | intranet/apps/feedback/models.py | Python | gpl-2.0 | 374 |
import math
class ColorPoint:
"""
Simple color-storage class; stores way-points on a color ramp
"""
def __init__(self,idx,col,colType):
# index, X-coordinate, on a palette
self.idx = idx
# color; usually an RGBA quad
self.color = col
# One of ColorTypes members
... | gratefulfrog/lib | python/pymol/colorramping.py | Python | gpl-2.0 | 13,994 |
#!/usr/bin/env python
# encoding: utf-8
"""
instrumentation.py
This file defines the various 'events' that can happen in the simlir system. Every
time an object in the simulation does something significant, it sends a message
to a global instrumentation object, which currently has a mild wrapping around them
for textu... | niallrmurphy/simlir | instrumentation.py | Python | gpl-2.0 | 8,970 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012-2013 Zuza Software Foundation
# Copyright 2013 Evernote Corporation
#
# This file is part of Pootle.
#
# Pootle 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 Softw... | evernote/pootle | pootle/apps/staticpages/urls.py | Python | gpl-2.0 | 1,786 |
# -*- coding: ascii -*-
import sys, os, os.path
import unittest, doctest
try:
import cPickle as pickle
except ImportError:
import pickle
from datetime import datetime, time, timedelta, tzinfo
import warnings
if __name__ == '__main__':
# Only munge path if invoked as a script. Testrunners should have setup... | theguardian/JIRA-APPy | lib/pytz/tests/test_tzinfo.py | Python | gpl-2.0 | 29,501 |
"""
# Majic
# Copyright (C) 2014 CEH
#
# 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 version.
#
# This pr... | NERC-CEH/jules-jasmin | majic/joj/tests/unit/test_utils.py | Python | gpl-2.0 | 2,688 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2011 Tim G L Lyons, Nick Hall
#
# 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 Found... | arunkgupta/gramps | gramps/gui/views/treemodels/citationbasemodel.py | Python | gpl-2.0 | 6,368 |
## This file is part of Invenio.
## Copyright (C) 2012, 2013 CERN.
##
## Invenio 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 version.
##
... | kaplun/ops | modules/bibdocfile/lib/bibdocfile_webinterface.py | Python | gpl-2.0 | 26,790 |
"""This network tester script attempts to check the link integrity of every
link in a SpiNNaker system. It is intended to be run repeatedly for long
durations and provides a steady (though not hugely intense) flow of traffic
over all links. The script verifies that all packets sent arrived at their
destinations ensurin... | project-rig/network_tester | examples/link_integrity_test.py | Python | gpl-2.0 | 2,976 |
config = {
'XSB_PATH' : '/home/ptsankov/apps/xsb-src/XSB/bin/xsb'
}
| ptsankov/bellog | src/config.py | Python | gpl-2.0 | 69 |
__author__ = 'Ivan Dortulov'
from web.ServerBase import *
from web.RequestHandler import *
from web.async.AsyncRequestHandler import *
from web.async.EventDispatcher import *
from web.async.Connection import *
import socket
import errno
class AsyncServer(BaseServer, EventDispatcher):
def __init__(self, address... | IceCubeDev/hackerschool | WebServer/1.0/JUNK/backup/web/async/AsyncServer.py | Python | gpl-2.0 | 3,762 |
#counts the character frequency in a file.
import sys
def main(filename):
freq = {}
result = []
fp = open(filename, 'r')
for c in fp.read():
if c!= '\n':
freq[c] = freq.get(c, 0) + 1
for i, j in freq.iteritems():
result.append((i, j))
result.sort(key=lambda x: x[1],... | MilanMathew/Python-practice-book | Chapter2/2.35_CharCount.py | Python | gpl-2.0 | 450 |
# -*- coding: utf-8 -*-
"""
direct PAS
Python Application Services
----------------------------------------------------------------------------
(C) direct Netware Group - All rights reserved
https://www.direct-netware.de/redirect?pas;tasks
The following license agreement remains valid unless any additions or
changes ... | dNG-git/pas_tasks | src/pas_tasks/abstract_persistent.py | Python | gpl-2.0 | 2,708 |
import hashlib
import sys
def sha1hash(s):
return hashlib.sha1(s.encode('utf-8')).hexdigest()
def md5hash(s):
return hashlib.md5(s.encode('utf-8')).hexdigest()
def main():
args = sys.argv
if len(args) == 3:
switch = args[1]
string = args[2]
if switch == "md5":
print("{0} : {1}".format(string, md5hash(... | Jacobious52/PythonLab | hash.py | Python | gpl-2.0 | 445 |
#!/usr/bin/env python
# encoding: utf-8
"""
utils.py
Created by Elliot Kroo on 2009-12-25.
Copyright (c) 2009 Elliot Kroo. All rights reserved.
"""
import sys
import os
def toDict(tuples):
resultsDict = {}
for field, value in tuples:
if len(field) > 0 and field[0] != "-":
resultsDict[field] = value
... | robwebset/script.ebooks | resources/lib/mobi/utils.py | Python | gpl-2.0 | 340 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-06-25 18:45
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('courses', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
... | paulopinda/simplemooc | simplemooc/courses/migrations/0002_auto_20160625_1845.py | Python | gpl-2.0 | 454 |
"""
# -*- coding: utf-8 -*-
#
# ========================================================
#
# Purpose: Create a square or hexagon grid for use with Marxan
# Author: Trevor Wiens
# Copyright: Apropos Information Systems Inc.
# Acknolwedgements: This function was derived from QGIS fTools VectorGrid
# fu... | tsw-apropos/qmarxan | qm_mkgrid.py | Python | gpl-2.0 | 25,122 |
#-------------------------------------------------------------------------------
# Name: Example solver
# Purpose: Example solver
#
# Author: Martin Schneider
#
# Created: 07/14/2014
# Copyright: (c) Martin 2014
# Licence: Creative Commons (CC)
#---------------------------------------... | JConwayAWT/PGSS14CC | lib/python/multimetallics/solvers/ExampleSolver.py | Python | gpl-2.0 | 1,857 |
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
__author__ = "alex"
__date__ = "$Jun 1, 2015 10:46:55 PM$"
from math import radians, sin, cos, sqrt, asin
from bs4 import BeautifulSoup
from ty... | Dr762/PythonExamples3.4 | Python3/restraunt_finder.py | Python | gpl-2.0 | 6,651 |
"""
Copyright 2016, 2017 UFPE - Universidade Federal de Pernambuco
Este arquivo é parte do programa Amadeus Sistema de Gestão de Aprendizagem, ou simplesmente Amadeus LMS
O Amadeus LMS é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como publicada pela ... | amadeusproject/amadeuslms | analytics/tests/test_general_dashboard.py | Python | gpl-2.0 | 4,202 |
from unittest import mock
from flask import Response
from routersploit.modules.exploits.routers.zyxel.d1000_rce import Exploit
def apply_response(*args, **kwargs):
resp = Response("TEST home_wan.htm TEST", status=404)
return resp
@mock.patch("routersploit.modules.exploits.routers.zyxel.d1000_rce.shell")
def... | dasseclab/dasseclab | clones/routersploit/tests/exploits/routers/zyxel/test_d1000_rce.py | Python | gpl-2.0 | 735 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""Programa que actua como proxy-registrar en UDP."""
import socketserver
import socket
import sys
import json
import hashlib as HL
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
from time import time, gmtime, strftime
from random import choice, ran... | robernom/ptavi-pfinal | proxy_registrar.py | Python | gpl-2.0 | 9,377 |
"""
#header
"""
import base64
import datetime
import logging
from joj.crowd.models import UserRequest
import urllib2
import simplejson
from simplejson import JSONDecodeError
log = logging.getLogger(__name__)
class ClientException(Exception):
""" Base exception for Crowd-based errors """
def __init__(self):
... | NERC-CEH/jules-jasmin | majic/joj/crowd/client.py | Python | gpl-2.0 | 12,041 |
from django import forms
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm
from crispy_forms.bootstrap import FormActions, AppendedText, StrictButton, InlineField
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Submit, Button, Field, Hidden, HTML, Div
clas... | blacksph3re/alastair | alastair_cookie/forms.py | Python | gpl-2.0 | 1,349 |
from datetime import datetime
class Schedule(object):
WEEK_ONE = datetime(2014, 9, 2, 9)
def week(self):
time_difference = datetime.now() - self.WEEK_ONE
return (time_difference.days/7)+1
def season_year(self):
return 2014
| FenrirUnbound/greg-ball | libraries/schedule.py | Python | gpl-2.0 | 262 |
import logging
logger = logging.getLogger('upkg')
from blessings import Terminal
from cmds.base import BaseCmd
from upkg.lib import Repo
class Cmd(BaseCmd):
"""Docstring for Search """
name = 'status'
help_text = ("Get the status of what's installed")
aliases = ['st', 'stat']
def build(self):
... | jeffbuttars/upkg | upkg/cmds/status.py | Python | gpl-2.0 | 1,988 |
import unittest
from test import support
from test.test_urllib2 import sanepathname2url
import os
import socket
import urllib.error
import urllib.request
import sys
support.requires("network")
TIMEOUT = 60 # seconds
def _retry_thrice(func, exc, *args, **kwargs):
for i in range(3):
try:
ret... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/test/test_urllib2net.py | Python | gpl-2.0 | 12,710 |
#!/usr/bin/env python
# coding: UTF-8
# pt-snap-statements
#
# Copyright(c) 2015-2018 Uptime Technologies, LLC.
import getopt
import os
import sys
import PsqlWrapper
import log
class SnapStatements:
def build_where_clause(self, where_clause, cond):
if where_clause is None:
where_clause = " ... | uptimejp/postgres-toolkit | postgres_toolkit/pt_snap_statements.py | Python | gpl-2.0 | 8,892 |
# -*- coding: utf-8 -*-
"""
Testing WordProcessingDocument
"""
# $Id: test_wordprocessing.py 6355 2007-09-20 17:16:21Z glenfant $
import unittest
import os
from fixures import *
import openxmllib
class WordProcessingTest(unittest.TestCase):
"""Testing querying properties from a document"""
def setUp(self):
... | hltbra/openxmllib | tests/test_wordprocessing.py | Python | gpl-2.0 | 1,363 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Copyright (C) 2012 Fabio Erculiani
Authors:
Fabio Erculiani
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 3.
This program is distributed in... | Enlik/entropy | rigo/rigo_app.py | Python | gpl-2.0 | 38,116 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 Mario Frasca <mario@anche.no>.
# Copyright 2018 Tanager Botanical Garden <tanagertourism@gmail.com>
#
# This file is part of ghini.desktop.
#
# ghini.desktop is free software: you can redistribute it and/or modify
# it under the terms of the GNU General P... | Ghini/ghini.desktop | bauble/plugins/garden/test_import_pocket_log.py | Python | gpl-2.0 | 22,436 |
#!/usr/bin/env python
# coding=utf-8
from ctypes import *;
import os;
#libtest = CDLL(os.getcwd() + '/multiply.so')
#print libtest.multiply(2, 3)
lib = CDLL("./lib.so");
s = "nihao";
lib.display_sz(s);
print "done!"
lib.display(s);
print "done!!"
| gwq5210/python_learn | ctypes_test.py | Python | gpl-2.0 | 250 |
# -*- coding: utf-8 -*-
import re,sys,cookielib,urllib,urllib2,urlparse,HTMLParser,time,random,base64
from resources.lib.modules import cache
from resources.lib.modules import workers
def request(url, close=True, redirect=True, error=False, proxy=None, post=None, headers=None, mobile=False, limit=None, referer=Non... | Coelhon/MasterRepo.repository | plugin.video.psychoxxx/resources/lib/modules/client.py | Python | gpl-2.0 | 14,581 |
from __future__ import division
__author__ = 'jerry'
from utils.settings import pbp, seasons
from Game import Game
class NoCollectionError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class SeasonDataError(Exception):
def __init__(self, msg... | grapesmoker/nba | game/Season.py | Python | gpl-2.0 | 12,250 |
from __future__ import absolute_import
from __future__ import print_function
import six
__author__ = 'a_medelyan'
import rake
import operator
import io
import sys
# EXAMPLE ONE - SIMPLE
stoppath = "SmartStoplist.txt"
# 1. initialize RAKE by providing a path to a stopwords file
rake_object = rake.Rake(stoppath, 3,4,1... | manjeetk09/GoogleScrapper | rake_tutorial.py | Python | gpl-2.0 | 2,623 |