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 pytest
from hashlib import md5
from marshmallow import ValidationError, missing as missing_
from marshmallow.fields import Int
from marshmallow_jsonapi import Schema
from marshmallow_jsonapi.fields import Str, DocumentMeta, ResourceMeta, Relationship
class TestGenericRelationshipField:
def test_serialize... | marshmallow-code/marshmallow-jsonapi | tests/test_fields.py | Python | mit | 16,428 |
import collections
from syn.base_utils import istr, getfunc
from syn.type.a import Schema, List
from .base import Base, Harvester
from .meta import Attr, pre_create_hook, preserve_attr_data
#-------------------------------------------------------------------------------
# Constants
_LIST = '_list'
#----------------... | mbodenhamer/syn | syn/base/b/wrapper.py | Python | mit | 4,871 |
import calendar
import codecs
import collections
import mmap
import os
import re
import time
import zlib
# see 7.9.2.2 Text String Type on page 86 and D.3 PDFDocEncoding Character Set
# on page 656
def encode_text(s):
return codecs.BOM_UTF16_BE + s.encode("utf_16_be")
PDFDocEncoding = {
0x16: "\u0017",
... | sserrot/champion_relationships | venv/Lib/site-packages/PIL/PdfParser.py | Python | mit | 34,422 |
import games
import handlers
import hlib.error
import hlib.input
from handlers import require_login, page
import hruntime # @UnresolvedImport
class Handler(handlers.GenericHandler):
class ValidateProfile(hlib.input.SchemaValidator):
username = hlib.input.Username()
@require_login
@page
@hlib.input.val... | happz/settlers | src/handlers/profile.py | Python | mit | 757 |
from setuptools import setup
setup(
name='Central',
version='0.6.0',
packages=['central', 'central.config'],
url='https://github.com/viniciuschiele/central',
license='MIT',
author='Vinicius Chiele',
author_email='vinicius.chiele@gmail.com',
description='A dynamic configuration library',... | viniciuschiele/central | setup.py | Python | mit | 863 |
import yaml
import json
from pprint import pprint
with open ("q6yaml.yml") as f:
yaml_data = yaml.load(f)
with open ("q6json.json") as ff:
json_data = json.load(ff)
seperator = "-" * 20
print seperator
pprint("YAML output")
print seperator
pprint(yaml_data)
print seperator
pprint("JSON output")
print seperator... | jrgreenberg/jrgreenberg_PyNet | Week1/q7.py | Python | mit | 355 |
#!/usr/bin/env python
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import NotFoundError
from time import strftime
try:
import configparser
except:
from six.moves import configparser
import argparse
# Note: You MUST at least enter valid AWS API Keys in this file:
CONFIG_FILE = 'es-s3... | cldcvr/elasticsearch-s3-backup | es-s3-snapshot/es-s3-snapshot.py | Python | mit | 8,107 |
#!/usr/bin/python
import logging
import struct
starttls_modes = {
21: 'ftp',
25: 'smtp',
110: 'pop3',
143: 'imap',
587: 'smtp',
38476: 'pgsql'
}
def starttls(s, port, mode='auto'):
logger = logging.getLogger('pytls')
logger.debug('Using %d, mode %s', port, mode)
if mode == 'auto... | WestpointLtd/pytls | tls/starttls.py | Python | mit | 1,759 |
"""
Django settings for meal_api project.
Generated by 'django-admin startproject' using Django 1.9.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
... | Seattle-Meal-Maps/seattle-meal-maps-api | meal_api/meal_api/settings.py | Python | mit | 3,895 |
#!/usr/bin/python
#
# Copyright (c) 2011 Rime Project.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, m... | AI-comp/Orientation2015Problems | rime/plugins/example.py | Python | mit | 1,853 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def HostDisconnectedEvent(vim, *args, **kwargs):
'''This event records a disconnection fr... | xuru/pyvisdk | pyvisdk/do/host_disconnected_event.py | Python | mit | 1,157 |
"""
circonus.tag
~~~~~~~~~~~~
Manipulate tags on resources that support them.
"""
from circonus.util import get_resource_from_cid
TAGGABLE_RESOURCES = [
"check_bundle",
"contact_group",
"graph",
"maintenance",
"metric_cluster",
"template",
"worksheet"
]
"""Circonus API resources for wh... | monetate/circonus | circonus/tag.py | Python | mit | 3,972 |
from cloudcast.template import *
from cloudcast.library import stack_user
iSCMCompleteHandle = WaitConditionHandle()
iSCMComplete = WaitCondition(
Handle = iSCMCompleteHandle,
Timeout = "3600" # Be generous with time
)
iSCMData = Output(
Description = "Output provided by the iSCM process",
Value = iSCMComplete... | tuxpiper/raduga | raduga/cfn/build_stack.cfn.py | Python | mit | 332 |
import cards
import hands
import preflop_sim
import afterflop_sim
import pickle
# add more features if we have time
features = { 'high-pair':0, 'middle-pair':1, 'low-pair':2, '2-pair-good':3, '3-kind':4, 'straight':5, 'flush':6, 'full-house':7, '4-kind':8, 'straight-flush':9, 'really-good-high':10, 'good-high':11, 'm... | pmaddi/CPSC458_Final-Project | afterriver_sim.py | Python | mit | 3,164 |
import datetime
from peewee import *
from .base import get_in_memory_db
from .base import ModelTestCase
from .base_models import *
def lange(x, y=None):
if y is None:
value = range(x)
else:
value = range(x, y)
return list(value)
class TestCursorWrapper(ModelTestCase):
database = ge... | coleifer/peewee | tests/results.py | Python | mit | 6,695 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('challenges', '0005_auto_20150809_1703'),
]
operations = [
migrations.RenameField(
model_name='challenge',
... | avinassh/learning-scraping | challenges/migrations/0006_auto_20150822_1315.py | Python | mit | 570 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutHashes in the Ruby Koans
#
from runner.koan import *
class AboutDictionaries(Koan):
def test_creating_dictionaries(self):
empty_dict = dict()
self.assertEqual(dict, type(empty_dict))
self.assertEqual(dict(), empty_dict)
... | Turivniy/Python_koans | python2/koans/about_dictionaries.py | Python | mit | 1,986 |
# -*- coding: utf-8 -*-
import time
import sys
import socket
import cPickle
import os
from pydbg import *
from pydbg.defines import *
from util import *
PICKLE_NAME = "crash_info.pkl"
exe_path = "D:\\testPoc\\Easy File Sharing Web Server\\fsws.exe"
import threading
import time
host, port = "127... | b09780978/SEH_Fuzzer | SEH_Fuzzer/Seh_bug_fuzzer.py | Python | mit | 3,793 |
import numpy as np
import matplotlib.pyplot as plt
import sys
### Plot the analytical solution of the heat equation
# * Steady-state
# * No advection
# * Constant heat conductivity
# * Constant heat production
#
# Choosable Dirichlet + von Neumann boundary conditions
# T=T0 at z=z1
# q=q0 at z=z2
####... | HUGG/NGWM2016-modelling-course | Lessons/05-Finite-differences/scripts/plot_steady_state_heat_eq_innerbnd.py | Python | mit | 1,717 |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "cmd_pkg"
PROJECT_SPACE_DIR = "/home/m... | Projet-Guerledan/ROSonPi | glider_dir/build/cmd_pkg/catkin_generated/pkg.installspace.context.pc.py | Python | mit | 400 |
# In order to collect the relevant articles, I used LexisNexis Academic (http://www.lexisnexis.com/hottopics/lnacademic) to search for all instances of Planned Parenthood in The New York Times, from when it first appeared in 1969 to the present.
# I batch downloaded files, 500 at a time, and then culled them into a si... | elizabethdherman/ps239T-final-project | Code/01_data_setup.py | Python | mit | 855 |
#!/usr/bin/env python3
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.stats import poisson
def quantile_normalize(df):
"""
input: dataframe with numerical columns
output: dataframe with quantile normalized values
"""
df_sorted = pd.DataFra... | jdurbin/sandbox | python/quantile/qn.py | Python | mit | 809 |
# -*- encoding: utf8 -*-
import django_filters
from django import forms
from django_filters.widgets import LinkWidget
from .models import Film, SlaveCatalog
from django.shortcuts import render
class FilmFilter(django_filters.FilterSet):
genre = django_filters.AllValuesFilter(widget=LinkWidget, label='')
name =... | gomezhyuuga/moviewatch | movies/filters.py | Python | mit | 688 |
"""
tornadochat.py
A TCP chat server in the style of 'Chatroulette' using Tornado.
Part of a study in concurrency and networking in Python:
https://github.com/mjwestcott/chatroulette in which I create versions of this
server using asyncio, gevent, Tornado, and Twisted.
Some 'features':
- on connection, clients a... | mjwestcott/chatroulette | tornadochat.py | Python | mit | 8,485 |
# -*- coding: utf-8 -*-
# (C) 2015 Muthiah Annamalai
from opentamiltests import *
from solthiruthi.morphology import RemoveCaseSuffix #, RemovePlural
import re
import codecs
from tamil import utf8
class RemoveSuffixTest(unittest.TestCase):
def test_basic_suffix_stripper(self):
obj = RemoveCaseSuffix()
... | atvKumar/open-tamil | tests/solthiruthi_suffixremoval.py | Python | mit | 840 |
import theano
import os
import numpy as np
from theano import tensor
from blocks.initialization import Constant
from blocks.bricks import Linear, Tanh, NDimensionalSoftmax
from bricks import AssociativeLSTM, LSTM
from fuel.datasets import IterableDataset
from fuel.streams import DataStream
from blocks.model import Mode... | mohammadpz/Associative_LSTM | main.py | Python | mit | 4,956 |
# codplayer - base class for the audio devices
#
# Copyright 2013 Peter Liljenberg <peter.liljenberg@gmail.com>
#
# Distributed under an MIT license, please see LICENSE in the top dir.
import array
import time
import sys
import threading
import alsaaudio
from . import sink
from . import model
class PyAlsaSink(sink.... | petli/codplayer | src/codplayer/py_alsa_sink.py | Python | mit | 10,530 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
pass
def backwards(self, orm):
pass
models = {
}
complete_apps = ['djangodash'] | noamsu/djangodash2012 | djangodash/migrations/0001_initial.py | Python | mit | 319 |
import copy
import pyspawn
import matplotlib.pyplot as plt
import numpy as np
import h5py
import glob
au_to_fs = 0.02418884254
au_to_ev = 13.6
au_to_ang = 0.529177
def plot_total_energies(time, toten, keys, istates_dict, colors, markers, linestyles):
"""Plots total classical energies for each trajectory and saves ... | blevine37/pySpawn17 | pyspawn/plotting/traj_plot.py | Python | mit | 6,119 |
import _plotly_utils.basevalidators
class FamilyValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="family", parent_name="parcoords.labelfont", **kwargs
):
super(FamilyValidator, self).__init__(
plotly_name=plotly_name,
parent_name=... | plotly/plotly.py | packages/python/plotly/plotly/validators/parcoords/labelfont/_family.py | Python | mit | 517 |
# -*- coding: utf-8 -*-
"""
auto rule template
~~~~
:author: LoRexxar <LoRexxar@gmail.com>
:homepage: https://github.com/LoRexxar/Kunlun-M
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2017 LoRexxar. All rights reserved
"""
from utils.api import *
class CVI_100... | LoRexxar/Cobra-W | rules/php/CVI_1002.py | Python | mit | 1,175 |
#!/usr/bin/python
# coding: utf-8
class Solution(object):
def checkPossibility(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
p = None
for i in xrange(len(A) - 1):
if A[i] > A[i+1]:
if p is not None:
return Fal... | Lanceolata/code-problems | python/leetcode_easy/Question_184_Non_decreasing_Array.py | Python | mit | 453 |
'''
Handles files, folders and paths.
'''
import os
import shutil
from datetime import datetime
from datetime import date
from GeoConverter import settings
from OGRgeoConverter.jobs import jobidentification
def store_uploaded_file(job_id, file_data, file_name):
'''
Takes file data as argument and stores it i... | geometalab/geoconverter | OGRgeoConverter/filesystem/filemanager.py | Python | mit | 4,442 |
# -*- coding: utf-8 -*-
from ccxt.async.base.exchange import Exchange
import hashlib
import math
import json
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import NotSupported
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import InvalidOrder
from ccxt.base.errors import Order... | tritoanst/ccxt | python/ccxt/async/livecoin.py | Python | mit | 20,475 |
"""
[2015-05-11] Challenge #214 [Easy] Calculating the standard deviation
http://www.reddit.com/r/dailyprogrammer/comments/35l5eo/20150511_challenge_214_easy_calculating_the/
Description
Standard deviation is one of the most basic measurments in statistics. For some collection of values (known as a "population" in st... | feliposz/daily-programmer-solutions | E214_StandardDeviation.py | Python | mit | 4,596 |
'''
DataTable: a flask/sqlachemy module to generate HTML with server side data.
The project use datatable from http://www.datatables.net/
'''
__all__ = ('Table', 'Column')
import simplejson
from flask import url_for, request
from sqlalchemy import asc, desc
class Column(object):
def __init__(self, name, field, d... | kivy/p4a-cloud | master/web/table.py | Python | mit | 6,001 |
import sys
try:
import uerrno
try:
import uos_vfs as uos
open = uos.vfs_open
except ImportError:
import uos
except ImportError:
print("SKIP")
sys.exit()
try:
uos.VfsFat
except AttributeError:
print("SKIP")
sys.exit()
class RAMFS:
SEC_SIZE = 512
def __... | Peetz0r/micropython-esp32 | tests/extmod/vfs_fat_fileio2.py | Python | mit | 2,661 |
# encoding: utf-8
from django.db import migrations, models
def forwards(apps, schema_editor):
if not schema_editor.connection.alias == 'default':
return
# Your migration code goes here
model = apps.get_model('board', 'Status')
model.objects.create(
name="Down",
slug="down",
... | aksalj/whiskerboard | board/migrations/0002_initial_statuses.py | Python | mit | 959 |
#!/usr/bin/python
# TODO: issues with new oauth2 stuff. Keep using older version of Python for now.
# #!/usr/bin/env python
import subprocess
import praw
from hashlib import sha1
from flask import Flask
from flask import Response
from flask import request
from cStringIO import StringIO
from base64 import b64encode
fr... | foobarbazblarg/stayclean | stayclean-2017-june/serve-signups-with-flask.py | Python | mit | 8,193 |
import pygame
from configuraciones import *
class limite(pygame.sprite.Sprite):
al = 800
an = 2
def __init__(self, cl = ROJO):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface([self.al,self.an])
self.cl = cl
self.image.fill(self.cl)
self.rect= self.im... | Jofemago/Computacion-Grafica | SPACE INVADERS/Fronteras.py | Python | mit | 785 |
from myhdl import block, always, Signal, modbv, concat, intbv, always_comb, instances
from hdmi.cores import control_token_0, control_token_1, control_token_2, control_token_3
INIT = 1
SEARCH = 2
BIT_SLIP = 4
RCVD_CTRL_TKN = 8 # Received control token
BLANK_PERIOD = 16
PHASE_ALIGNED = 32 # Phase Alignment Achieved
... | srivatsan-ramesh/HDMI-Source-Sink-Modules | hdmi/cores/receiver/phase_aligner.py | Python | mit | 5,642 |
# -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------------
# tiff.py - tiff file parsing
# -----------------------------------------------------------------------------
# $Id$
#
# -----------------------------------------------------------------------------
# kaa-Metada... | jtackaberry/stagehand | external/metadata/image/tiff.py | Python | mit | 3,914 |
#!/usr/bin/python
# filename: celeryconfig.py
###########################################################################
#
# Copyright (c) 2014 Bryan Briney. All rights reserved.
#
# @version: 1.0.0
# @author: Bryan Briney
# @license: MIT (http://opensource.org/licenses/MIT)
#
######################################... | briney/abstar | abstar/celeryconfig.py | Python | mit | 985 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on Jul 3, 2014
@author: anroco
How to know if an element exists within a tuple in python?
¿como saber si un elemento existe dentro de una tupla python?
'''
#create a tuple
tupla = ('a', 'b', 'c', 'd', 'e')
print (tupla)
#use the in statement
print('c' in tu... | OxPython/Python_tuples_exists | src/exists_item_tuples.py | Python | epl-1.0 | 344 |
from django.shortcuts import render
from django.http import HttpResponse
from article.models import Article
from datetime import datetime
# Create your views here.
def home(request):
post_list = Article.objects.all()
return render(request, 'home.html', {'post_list' : post_list})
def detail(request, my_args):
post ... | Moon84/my_blog | article/views.py | Python | epl-1.0 | 493 |
#!/usr/bin/python
import subprocess, re
def get_cpu_info():
command = "cat /proc/cpuinfo"
all_info = subprocess.check_output(command, shell=True).strip()
for line in all_info.split("\n"):
if "model name" in line:
model_name = re.sub(".*model name.*:", "", line,1).strip()
return model_name.replace("(R)","")... | JeffsanC/uavs | src/rpg_vikit/vikit_py/src/vikit_py/cpu_info.py | Python | gpl-2.0 | 340 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
TO DO:
- Guardar las opciones usadas anteriormente
- Hacer una base de datos sobre proteínas, con su peso molecular y su número
de residuos, para calcular rápidamente el factor de corrección.
"""
import pygtk
pygtk.require("2.0")
import gtk
import gobject
import glib
... | vhernandez/jwsProcessor | src/jwsprocessor/main.py | Python | gpl-2.0 | 15,739 |
# Copyright (c) 2010 Witchspace <witchspace81@gmail.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 the rights
# to use, copy, modify,... | obulpathi/reversecoin | reversecoin/bitcoinrpc/connection.py | Python | gpl-2.0 | 28,122 |
import os
import sys
import transaction
import pysword.books
from sqlalchemy import engine_from_config
from pyramid.paster import (
get_appsettings,
setup_logging,
)
from pyramid.scripts.common import parse_vars
from ..models import (
DBSession,
Base,
TTitle,
TPresenter,
TBibleBook,... | tanj/SermonLog | sermonlog/scripts/initializedb.py | Python | gpl-2.0 | 11,323 |
"""Generic functions for generating code."""
import json
import sys
import configen.generator_cpp as cpp
_LANGUAGE_MODULE_DICT = {'c++': cpp}
def write_files(code, language, filename):
generator_module = _LANGUAGE_MODULE_DICT[language]
generator_module.write_files(code, filename)
def convert_json(json_sc... | alexey-naydenov/configen | configen/generate.py | Python | gpl-2.0 | 2,185 |
import unittest
import threading
import time
import tempfile
import os
from logmon.textlog import TextLog
file_created = threading.Lock()
log_attached = threading.Lock()
class TestTextLog(unittest.TestCase):
@classmethod
def write_to_log(cls, filename, num_repeats=10):
with open(filename, "w") as f:
... | avkhanov/logmon | logmon_test/test_textlog.py | Python | gpl-2.0 | 1,593 |
# -*- coding: utf-8 -*-
"""
qgiscloudapi
library for accessing the qgiscloud API using Python
Copyright 2011 Sourcepole AG
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/li... | manisandro/qgis-cloud-plugin | qgiscloud/qgiscloudapi/qgiscloudapi.py | Python | gpl-2.0 | 20,543 |
# Copyright (C) 2014 SocialCookies @IV/GII
# @anaprados @oskyar @torresj @josemlp91
# @franciscomanuel @rogegg @pedroag @melero90
# Aplicacion web, para gestionar pedidos de galletas,
# con fotos de Instagram y Twitter.
# This program is free software; you can redistribute it and/or
# modify it under the terms o... | IV-GII/SocialCookies | ENV1/webcookies/webcookies/urls.py | Python | gpl-2.0 | 1,375 |
#!/usr/bin/env python
"""
This will show russian text in koi8-r encoding.
"""
from xml.parsers import expat
import string
# Produces ImportError in 1.5, since this test can't possibly pass there
import codecs
class XMLTree:
def __init__(self):
pass
# Define a handler for start element events
de... | Pikecillo/genna | external/PyXML-0.8.4/test/test_encodings.py | Python | gpl-2.0 | 1,292 |
#!/usr/bin python
import sys
sys.path.insert(0,'/home/william/caffe-master/python')
import os
import numpy as np
import matplotlib.pyplot as plt
import caffe
'''
The wrapper for calling the deep-net to get the feature of the region
Here will provide two way for calling:
One: provide the folder where storage the i... | AIML/Sematic-Image-Search | src/feature/get_feature.py | Python | gpl-2.0 | 4,785 |
#!/bin/python3
import csv
import glob
from konfiguracja import *
from hyphenate import hyphenate_word
import operator
import re
import pathlib #Aby sprawdzić, czy plik istnieje
def Wczytaj_ksiazke1(ksiazka):
global d_wyrazy
c_ksiazka=open(ksiazka,"r")
str_ksiazka=c_ksiazka.read()
for wyraz in re... | adamryczkowski/powtarzane-cwiczenia | import_books.py | Python | gpl-2.0 | 2,890 |
#!/usr/bin/python2
#
# term-war
#
# Copyright (c) 2013
#
# Author Branislav Blaskovic <branislav@blaskovic.sk>
#
import sys
from decorations import Colors
Color = Colors()
class Writer:
def __init__(self):
pass
def out(self, text, color=Color.ENDC, new_line=True):
# Write some message to t... | blaskovic/term-war | src/interaction.py | Python | gpl-2.0 | 631 |
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from cfme.common.vm import VM
from cfme.control.explorer import PolicyProfile, VMCompliancePolicy, Action, VMControlPolicy
from cfme.infrastructure.virtual_machines import Vm
from utils.log import logger
from utils.providers import setup_a_provider as _setup_a_p... | thom-at-redhat/cfme_tests | cfme/tests/control/test_bugs.py | Python | gpl-2.0 | 6,198 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2012, 2013, 2014, 2015 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... | nharraud/invenio-access | invenio_access/views/admin.py | Python | gpl-2.0 | 5,025 |
# -*- coding: utf-8 -*-
from itertools import groupby
try:
from django.db import IntegrityError
except:
pass
from django.contrib.auth.decorators import user_passes_test
from django.contrib.contenttypes.models import ContentType
from django.http import Http404
from django.http import HttpResponse
from django.... | ShaolongHu/Nitrate | tcms/management/views.py | Python | gpl-2.0 | 18,151 |
# pylint: disable=missing-docstring,too-few-public-methods,invalid-name
from collections import defaultdict
class A:
pass
class B:
pass
A.__class__ = B
A.__class__ = str
A.__class__ = float
A.__class__ = dict
A.__class__ = set
A.__class__ = defaultdict
A.__class__ = defaultdict(str) # [inva... | PyCQA/pylint | tests/functional/i/invalid/invalid_class_object.py | Python | gpl-2.0 | 382 |
'''app.notify.admin'''
import os
from bson import json_util
from flask import g, request
from .. import get_keys
from logging import getLogger
log = getLogger(__name__)
#-------------------------------------------------------------------------------
def update_agency_conf():
log.info('updating %s with value %s', r... | SeanEstey/Bravo | app/notify/admin.py | Python | gpl-2.0 | 803 |
#!/usr/bin/env python3
import unittest
from trans import g2pbr
class PhonTest(unittest.TestCase):
def setUp(self):
self.test_words = {
'financiamento': 'finãsiamẽto',
}
self.phon = g2pbr.Phon(rules='trans/rules.pt')
def test_words(self):
for w in self.test... | shoeki/ling | tests.py | Python | gpl-2.0 | 462 |
#!/usr/bin/env python3
###############################################################################
# #
# Copyright 2019. Triad National Security, LLC. All rights reserved. #
# This program was produced under U.S. Government contrac... | CSD-Public/stonix | src/tests/rules/unit_tests/zzzTestRuleConfigureSystemAuthentication.py | Python | gpl-2.0 | 4,993 |
# coding: utf-8
import pygame, sys
from pygame.locals import *
import script
import menu
wind_size = 568,500
back = pygame.image.load('image/tela_game_over.jpg')
reiniciar = pygame.image.load('image/botoes/reiniciar.png')
voltar = pygame.image.load('image/botoes/voltar.png')
screen = pygame.display.set_mode(wind_size)... | anapaulabarros/flyingbee | reinicio.py | Python | gpl-2.0 | 1,246 |
from csv_utils import *
import pylab as p
import sys
directory="/home/jspaleta/scratch/king_salmon_vnadata_sept_9_card7redo"
plotdir="ksr_paired_recv_path_plots"
radar="KSR"
plot_directory=os.path.join(directory,plotdir)
if not os.path.exists(plot_directory): os.mkdir(plot_directory)
colors={0:"red",1:"blue",2:"black... | loxodes/SuperDARN_Hardware_Tools | kingsalmon_scripts/ksr_comparison_plots.py | Python | gpl-2.0 | 9,126 |
# Copyright 2008-2013 Jaap Karssenberg <jaap.karssenberg@gmail.com>
'''Package with source formats for pages.
Each module in zim.formats should contains exactly one subclass of
DumperClass and exactly one subclass of ParserClass
(optional for export formats). These can be loaded by L{get_parser()}
and L{get_dumper()... | jaap-karssenberg/zim-desktop-wiki | zim/formats/__init__.py | Python | gpl-2.0 | 50,661 |
# iSCSI configuration dialog
#
# Copyright (C) 2013 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 distribute... | Sabayon/anaconda | pyanaconda/ui/gui/spokes/advstorage/iscsi.py | Python | gpl-2.0 | 18,143 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-11-25 13:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('qms_core', '0015_auto_20161114_1808'),
]
operations = [
migrations.AlterFiel... | nextgis/quickmapservices_server | qms_server/qms_core/migrations/0016_auto_20161125_1320.py | Python | gpl-2.0 | 486 |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2016 EventGhost Project <http://www.eventghost.net/>
#
# EventGhost 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 versio... | WoLpH/EventGhost | eg/Classes/SerialPortChoice.py | Python | gpl-2.0 | 2,115 |
__author__ = 'dcristian'
import os
import socket
from uuid import getnode as get_mac
import json
import sys
import subprocess
class P:
module_failed = {}
class Constant:
debug_dummy = False
db_values_json = None
db_auto_module_json = None
def __init__(self):
pass
SIGNAL_SENSOR ... | dan-cristian/haiot | common/__init__.py | Python | gpl-2.0 | 13,018 |
import os
# import tempfile
from ..compat import is_win32, is_py3
import xbmc, xbmcvfs
xdg_cache = tmp_dir = xbmc.translatePath('special://profile/addon_data/script.module.streamlink.base')
if not xbmcvfs.exists(tmp_dir):
xbmcvfs.mkdirs(tmp_dir)
if is_win32:
try:
from ctypes import windll, cast, c... | repotvsupertuga/tvsupertuga.repository | script.module.streamlink.base/resources/lib/streamlink/utils/named_pipe.py | Python | gpl-2.0 | 2,398 |
"""Runs Capacity and Utilization with Replication Workload."""
from utils.appliance import IPAppliance
from utils.conf import cfme_performance
from utils.grafana import get_scenario_dashboard_urls
from utils.log import logger
from utils.providers import get_crud
from utils.smem_memory_monitor import add_workload_quanti... | dajohnso/cfme_tests | cfme/tests/perf/workloads/test_capacity_and_utilization_replication.py | Python | gpl-2.0 | 6,340 |
# Copyright 2008, 2009 CAMd
# (see accompanying license files for details).
"""Definition of the Atoms class.
This module defines the central object in the ASE package: the Atoms
object.
"""
import warnings
from math import cos, sin
import numpy as np
from ase.atom import Atom
from ase.data import atomic_numbers, ... | conwayje/ase-python | ase/atoms.py | Python | gpl-2.0 | 57,335 |
#!/usr/bin/env python
#
# lsdserver -- Linked Sensor Data Server
# Copyright (C) 2014 Geoff Williams <geoff@geoffwilliams.me.uk>
#
# 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 ... | GeoffWilliams/lsdserver | lsdserver/__init__.py | Python | gpl-2.0 | 3,360 |
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of Logilab-common.
#
# Logilab-common is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as publ... | hpfem/agros2d | resources/python/logilab/common/registry.py | Python | gpl-2.0 | 41,377 |
__author__ = 'lenovo'
# -*- coding: utf-8 -*-
DOMAIN = u'http://rs.xidian.edu.cn/'
USERNAME = u'***'
PASSWORD = u'***'
LOGINFIELD = u'username'
COOKIETIME = 2592000
HOMEURL = DOMAIN + u'forum.php'
LOGINURL = DOMAIN + u'member.php?mod=logging&action=login&loginsubmit=yes&handlekey=login&loginhash=LCaB3&inajax=1' | pang1567/rsmovie | src/config.py | Python | gpl-2.0 | 315 |
'''
Using the Python language, have the function AdditivePersistence(num) take the num parameter being passed
which will always be a positive integer and return its additive persistence
which is the number of times you must add the digits in num until you reach a single digit.
For example: if num is 2718 then your p... | anomen-s/programming-challenges | coderbyte.com/easy/Additive Persistence/solve.py | Python | gpl-2.0 | 777 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2011, 2012 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 opt... | jrbl/invenio | modules/bibauthorid/lib/bibauthorid_dbinterface.py | Python | gpl-2.0 | 81,035 |
# pylint: disable=C0103,C0111
import mock
import unittest
import tests.mocks as mocks
from bumblebee.input import LEFT_MOUSE
from bumblebee.modules.cmus import Module
class TestCmusModule(unittest.TestCase):
def setUp(self):
mocks.setup_test(self, Module)
self.songTemplate = """
status {status}... | TechRunner2/i3-gaps-rice | .config/i3/bar/tests/modules/test_cmus.py | Python | gpl-2.0 | 4,535 |
import requests
from bs4 import BeautifulSoup
import re
from flask import current_app
from flask_mail import Mail, Message
from app import create_app
app = create_app ('config')
mail = Mail(app)
msg = Message("Failed to add sites",
sender="leo@search.techarena51.com",
rec... | Leo-g/Flask-FullTextSearch | scrape_r_python.py | Python | gpl-2.0 | 2,134 |
from NSCP import Settings, Registry, Core, log, status, log_debug, log_error, sleep
from test_helper import BasicTest, TestResult, Callable, setup_singleton, install_testcases, init_testcases, shutdown_testcases
from types import *
from time import time
import random
import os
prefix = 'scheduler'
class SchedulerTest... | mickem/nscp | scripts/python/test_scheduler.py | Python | gpl-2.0 | 6,169 |
import numpy as np
class Node:
"""
The node of the signal flow graph, implements calc_func() that is called in the main loop of the graph.
This is the class that should be subclassed, for building new signal processing effects.
When subclassing you simply:
1. create the needed [Obj]InWire and... | brunodigiorgi/pyAudioGraph | pyAudioGraph/AudioGraph.py | Python | gpl-2.0 | 4,400 |
# -*- coding: utf-8 -*-
# [HARPIA PROJECT]
#
#
# S2i - Intelligent Industrial Systems
# DAS - Automation and Systems Department
# UFSC - Federal University of Santa Catarina
# Copyright: 2006 - 2007 Luis Carlos Dill Junges (lcdjunges@yahoo.com.br), Clovis Peruchi Scotti (scotti@ieee.org),
# Guilh... | samuelfd/harpia | harpia/bpGUI/Or.py | Python | gpl-2.0 | 6,118 |
#!/usr/bin/python
from plotbridge.plot import Plot
import numpy as np
p = Plot('spiral', template='gnuplot_2d_with_direction',
overwrite=True)
p.set_width(300); p.set_height(300)
t = np.linspace(0, 10*np.pi, 101)
curve_in_complex_plane = np.exp(-t/10. + 1j*t)
p.add_trace(curve_in_complex_plane)
p.update();... | govenius/plotbridge | examples/gnuplot_with_direction/with_direction.py | Python | gpl-2.0 | 329 |
from starstoloves.lib.repository import RepositoryItem
class ConnectionHelper(RepositoryItem):
DISCONNECTED = 0;
CONNECTED = 1;
FAILED = 2;
state = None
username = None
def __init__(self, username=None, state=None, **kwargs):
self.username = username
if state is None:
... | tdhooper/starstoloves | starstoloves/lib/connection/connection.py | Python | gpl-2.0 | 565 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 ... | SCSSoftware/BlenderTools | addon/io_scs_tools/utils/path.py | Python | gpl-2.0 | 35,485 |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetShippingCosts
# Retrieves shipping costs for an item.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use th... | willprice/arduino-sphere-project | scripts/example_direction_finder/temboo/Library/eBay/Shopping/GetShippingCosts.py | Python | gpl-2.0 | 5,348 |
__author__ = 'williewonka'
import openpyxl
wb = openpyxl.load_workbook("json/jaartallen.xlsx")
sheet = wb.get_active_sheet()
wb_export = openpyxl.Workbook()
sheet_export = wb_export.get_active_sheet()
for cell in sheet.columns[1]:
if cell.value is None:
continue
jaar = 2014
# try:
for entry i... | williewonka/USE-patents-project | jaartal_extractor.py | Python | gpl-2.0 | 783 |
#!/usr/bin/python
###############################################################################
# NAME: pyp_io.py
# VERSION: 2.0.0 (29SEPTEMBER2010)
# AUTHOR: John B. Cole, PhD (john.cole@ars.usda.gov)
# LICENSE: LGPL
###############################################################################
# FUNCTIONS:
# a_... | wintermind/pypedal | PyPedal/pyp_io.py | Python | gpl-2.0 | 50,964 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: st dub 8 21:37:34 2015
# by: The Resource Compiler for PyQt (Qt v4.8.6)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x01\x3b\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48... | ctu-yfsg/2015-c-qgis-vfr | resources_rc.py | Python | gpl-2.0 | 13,627 |
from temboo.Library.RunKeeper.FitnessActivities.DeleteActivity import DeleteActivity, DeleteActivityInputSet, DeleteActivityResultSet, DeleteActivityChoreographyExecution
from temboo.Library.RunKeeper.FitnessActivities.RecordActivity import RecordActivity, RecordActivityInputSet, RecordActivityResultSet, RecordActivity... | willprice/arduino-sphere-project | scripts/example_direction_finder/temboo/Library/RunKeeper/FitnessActivities/__init__.py | Python | gpl-2.0 | 880 |
class Stack():
def __init__(self, arg = []):
self.Q1 = arg
self.Q2 = []
def stack_empty(self):
if len(self.Q1) == 0 and len(self.Q2) == 0:
return True
else:
return False
def push(self, x):
if self.stack_empty() is True:
self.Q1.ap... | jasonleaster/Algorithm | Stack/Python_version/stack_by_two_queue.py | Python | gpl-2.0 | 1,379 |
def max_sum_subarray(nums):
currSum, currMin, currMax = 0, 0, 0-2**31
for num in nums:
currSum += num
currMax = max(currMax, currSum-currMin)
currMin = min(currMin, currSum)
return currMax
if __name__ == '__main__':
nums = [-2, 1, -3, 4, -1, 2, 1, -5, 4]
print max_sum_subar... | starcroce/PyAlgoDataStructure | array/maxim_subarray.py | Python | gpl-2.0 | 330 |
# -*- mode: python -*-
# -*- coding: iso8859-15 -*-
##############################################################################
#
# Gestion scolarite IUT
#
# Copyright (c) 2001 - 2013 Emmanuel Viennet. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the term... | denys-duchier/Scolar | sco_bulletins_example.py | Python | gpl-2.0 | 2,668 |
#!/usr/bin/env python
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Run BioSQL tests using SQLite"""
from Bio import MissingExternalDependencyError
from BioSQL import BioSeqDatabase
from common... | updownlife/multipleK | dependencies/biopython-1.65/Tests/test_BioSQL_MySQLdb.py | Python | gpl-2.0 | 1,071 |
# Author: Hubert Kario, (c) 2016
# Released under Gnu GPL v2.0, see LICENSE file for details
"""Test for CVE-2015-7575 (SLOTH)"""
from __future__ import print_function
import traceback
import sys
import getopt
import re
from itertools import chain
from tlsfuzzer.runner import Runner
from tlsfuzzer.messages import Con... | mildass/tlsfuzzer | scripts/test-rsa-sigs-on-certificate-verify.py | Python | gpl-2.0 | 8,772 |
##
# Copyright 2015-2020 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | pescobar/easybuild-easyblocks | easybuild/easyblocks/p/pbdmpi.py | Python | gpl-2.0 | 2,289 |
from gettext import gettext as _
from django.http import HttpResponse, HttpResponseRedirect
from django import forms
from django.shortcuts import render_to_response
import sys
sys.path.append('../../../')
import re
import gourmet.backends.db
import gourmet.shopping
import gourmet.recipeManager
import json
from django.... | thinkle/gourmet | gourmet/plugins/web_plugin/gourmetweb/recview/views.py | Python | gpl-2.0 | 7,488 |
#
# Copyright (C) 2013-2016 Fabian Gieseke <fabian.gieseke@di.ku.dk>
# License: GPL v2
#
import os
import sys
import numpy
TIMING = 1
WORKGROUP_SIZE_BRUTE = 256
WORKGROUP_SIZE_LEAVES = 32
WORKGROUP_SIZE_UPDATE = 16
WORKGROUP_SIZE_COPY_INIT = 32
WORKGROUP_SIZE_COMBINE = 64
WORKGROUP_SIZE_TEST_SUBSET = 32
WORKGROUP_SIZ... | gieseke/bufferkdtree | bufferkdtree/neighbors/buffer_kdtree/setup.py | Python | gpl-2.0 | 6,584 |