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 |
|---|---|---|---|---|---|
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | iambocai/ansible | v2/test/errors/test_errors.py | Python | gpl-3.0 | 3,194 |
# 1. Strip non alphabetic
inputStr = "I may opt for a top yam for Amy, May, and Tommy."
import re
regex = re.compile('[^a-zA-Z ]')
output = regex.sub('',inputStr)
# 2. Convert letters to lower case
output = output.lower()
# 3. sort all the letters within each word
# 4. also eliminate duplicates
DicOfWords = {}
for word... | meisamhe/GPLshared | Research_Projects_UTD/Data_Science/some_python.py | Python | gpl-3.0 | 988 |
#!/usr/bin/env python3
# vim: set encoding=utf-8 tabstop=4 softtabstop=4 shiftwidth=4 expandtab
#########################################################################
# Copyright 2012-2013 Marcus Popp marcus@popp.mx
#########################################################################
# ... | smaiLee/smarthome | plugins/cli/__init__.py | Python | gpl-3.0 | 9,935 |
#!/usr/bin/env python
"""
This example shows that python suffers from some problem of
not being able to reuse sockets even though the socket.SO_REUSEADDR
is used...
"""
import socket
while True:
adr = ('localhost', 8080)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(adr)
s.setsockopt(s... | veltzer/demos-python | src/examples/short/networking/socket_reuseaddr.py | Python | gpl-3.0 | 427 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-06-14 19:52
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djsend', '0055_relationcategorizationblock_response_wait'),
]
operations = [
... | rivasd/djPsych | djsend/migrations/0056_auto_20170614_1552.py | Python | gpl-3.0 | 588 |
from __future__ import absolute_import
from galaxy.web.base.controller import *
from galaxy.web.framework.helpers import time_ago, iff, grids
from galaxy.model.orm import *
from galaxy import model, util
from galaxy.web.form_builder import *
from .requests_common import RequestsGrid, invalid_id_redirect
from galaxy im... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/lib/galaxy/webapps/galaxy/controllers/requests_admin.py | Python | gpl-3.0 | 47,292 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2017 University of Oxford
#
# This file is part of msprime.
#
# msprime is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at ... | ashander/msprime | msprime/trees.py | Python | gpl-3.0 | 89,405 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'amaury'
import subprocess
import time
import sys
class Timeout(Exception):
pass
def run(command, timeout=10):
proc = subprocess.Popen(command, bufsize=0, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
poll_seconds = .250
deadli... | aurelienmaury/galaxie | sandbox_mo/zero-ears/proc.py | Python | gpl-3.0 | 645 |
# coding=utf-8
import unittest
"""421. Maximum XOR of Two Numbers in an Array
https://leetcode.com/problems/maximum-xor-of-two-numbers-in-an-array/description/
Given a **non-empty** array of numbers, a 0, a1, a2, … , an-1, where 0 ≤ ai <
231.
Find the maximum result of ai XOR aj, where 0 ≤ _i_ , _j_ < _n_.
Could yo... | openqt/algorithms | leetcode/python/ac/lc421-maximum-xor-of-two-numbers-in-an-array.py | Python | gpl-3.0 | 1,365 |
""" Helper for the CS Resources section
"""
import re
from distutils.version import LooseVersion #pylint: disable=no-name-in-module,import-error
from DIRAC import S_OK, S_ERROR, gConfig
from DIRAC.ConfigurationSystem.Client.Helpers.Path import cfgPath
from DIRAC.Core... | hgiemza/DIRAC | ConfigurationSystem/Client/Helpers/Resources.py | Python | gpl-3.0 | 10,846 |
from rest_framework import permissions
class IsReadOnly(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
if request.method in permissions.SAFE_METHODS:
return True
return obj.owner == self.request.user | linfanangel/Trality | cart/cartapp/permission.py | Python | gpl-3.0 | 268 |
###############################################################################
# #
# 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 ... | dparks1134/UniteM | unitem/bin.py | Python | gpl-3.0 | 11,713 |
import abc
import logging
from time import sleep, time
from subprocess import call, check_output
from config import sim_dump_location, safe_location, devel
import infoli_diagnostics
import sys
class countermeasure(object):
''' Countermeasure class '''
__metaclass__ = abc.ABCMeta
@abc.abstractmet... | A-Kokolis/thesis-ntua | scc_implementation/scc_countermeasures.py | Python | gpl-3.0 | 2,957 |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 21 16:48:46 2016
@author: huliqun
"""
import compileall
compileall.compile_dir('..') | LiqunHu/MVPN | complineProj.py | Python | gpl-3.0 | 143 |
from flask import Flask, render_template, request, jsonify, session, redirect, escape, url_for
import bcrypt
class ServerError(Exception):pass
def loginForm(db, form):
error = None
try:
username = form['username']
cur = db.query("SELECT COUNT(1) FROM users WHERE user = %s", [username])
if not cur.fetchone()... | Madpilot0/Flask-Simpleauth | lib/Users.py | Python | gpl-3.0 | 1,789 |
#coding:utf8
import httplib2
import urllib
from connutils import HTTP
import json
import re
import bs4
import MySQLdb
aa={"name":"wuhaifeng","age":11}
# in 可以判断map中是否包含某个key
print aa["wu"] | oaksharks/BBS | main/test.py | Python | gpl-3.0 | 211 |
import numpy as np
from sverchok.utils.testing import *
from sverchok.utils.logging import debug, info
from sverchok.utils.geom import CubicSpline
class CubicSplineTests(SverchokTestCase):
def setUp(self):
super().setUp()
vertices = [(-1, -1, 0), (0, 0, 0), (1, 2, 0), (2, 3, 0)]
self.spli... | portnov/sverchok | tests/cubic_spline_tests.py | Python | gpl-3.0 | 1,513 |
#!/usr/bin/env python
import networkx as nx
from networkx.algorithms.flow import edmonds_karp
def main():
g = nx.DiGraph()
g.add_edge('s', 'v1', capacity=5)
g.add_edge('s', 'v2', capacity=22)
g.add_edge('s', 'v3', capacity=15)
g.add_edge('v1', 'v4', capacity=10)
g.add_edge('v2', 'v1', capaci... | wangjiezhe/note_for_python | Graph/mincut_maxflow.py | Python | gpl-3.0 | 898 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# www.genesilico.pl
#
from numpy import array
from random import uniform
import shutil
from shutil import rmtree
import os
from copy import deepcopy
from Modules.Input... | mdobrychlop/pyry3d_chimera_extension | Calculate.py | Python | gpl-3.0 | 37,311 |
# -*- coding: utf-8 -*-
"""
requests.api
~~~~~~~~~~~~
This module implements the Requests API.
:copyright: (c) 2012 by Kenneth Reitz.
:license: Apache2, see LICENSE for more details.
"""
from . import sessions
def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Reque... | adazey/Muzez | libs/requests/api.py | Python | gpl-3.0 | 6,115 |
#!/usr/bin/python
import sys
import time
import random
from fidonet import Address
from fidonet.formats import *
import fidonet.app
class App (fidonet.app.AppUsingAddresses, fidonet.app.AppUsingNames):
logtag = 'fidonet.makemsg'
def create_parser(self):
p = super(App, self).create_parser()
... | larsks/python-ftn | fidonet/apps/makemsg.py | Python | gpl-3.0 | 3,792 |
# Copyright 2012, 2013 Arndt Droullier, Nive GmbH. All rights reserved.
# Released under GPL3. See license.txt
#
__doc__ = """
Image
-----
The image element inserts images into the web page.
Images uploaded as fullsize will be be linked as pop ups.
If the Python Image Library (PIL) is installed automated image conve... | nive/nive_cms | nive_cms/image.py | Python | gpl-3.0 | 2,927 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Workflow:
# 1. Check if the folder has been analysed before
# 1.1 Status: checked, converted, reported, compiled, emailed, running, error, completed
# 2. If the sequencer is NextSeq:
# 2.1 Run bcl2fastq to create the FASTQ files
# 2.1.1 Execution:
# nohup /us... | CEFAP-USP/fastqc-report | RunFastQC.py | Python | gpl-3.0 | 18,788 |
# SkinDesigner: A Plugin for Building Skin Design (GPL) started by Santiago Garay
# This file is part of SkinDesigner.
#
# Copyright (c) 2017, Santiago Garay <sgaray1970@gmail.com>
# SkinDesigner is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | PayettePeople/SkinDesigner | src/SkinDesigner_System-CurtainWall.py | Python | gpl-3.0 | 12,231 |
# Copyright (C) 2012 Brett Ponsler, Pete Lamonica
# This file is part of pysiriproxy.
#
# pysiriproxy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any ... | bponsler/pysiriproxy | pysiriproxy/objects/baseObject.py | Python | gpl-3.0 | 5,552 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-05-15 19:40
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('songs', '0006_alternatebookname_alternativeparshaname'),
]
operations = [
migration... | brentd-smith/smolkinsite | songs/migrations/0007_auto_20170515_1940.py | Python | gpl-3.0 | 442 |
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'fake-key'
DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessi... | lyndsysimon/django-changelog | tests/test_settings.py | Python | gpl-3.0 | 2,637 |
import cv2
import time
import numpy as np
import win32gui, win32ui, win32con, win32api
hwin = win32gui.FindWindow(None,'Grand Theft Auto V')#it gets the process ID or as microsoft calls it 'window handle'
rect = win32gui.GetWindowRect(hwin)
def grab_screen():
while(True):
x = rect[0]
... | mehta-raghav/fred-pygtav | screengrab.py | Python | gpl-3.0 | 1,245 |
# This file is formatted with black.
# https://github.com/psf/black
import os
import json
import subprocess
import sys
import simplekml
ALT_MODE = simplekml.AltitudeMode.absolute # Absolute altitude means from sea floor
# Current commit
if os.environ.get("TRAVIS"):
COMMIT = os.environ["TRAVIS_COMMIT"]
else:
... | tomeshnet/node-list | ci/scripts/kml/main.py | Python | gpl-3.0 | 3,457 |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from diagnostic_msgs/DiagnosticStatus.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import diagnostic_msgs.msg
class DiagnosticStatus(genpy.Message):
_md5sum = "d0ce0... | UnbDroid/robomagellan | Codigos/Raspberry/desenvolvimentoRos/devel/lib/python2.7/dist-packages/diagnostic_msgs/msg/_DiagnosticStatus.py | Python | gpl-3.0 | 10,760 |
# highSpeedManuveringCapacitorNeedMultiplierPostPercentCapacitorNeedLocationShipModulesRequiringHighSpeedManuvering
#
# Used by:
# Implants named like: Eifyr and Co. 'Rogue' High Speed Maneuvering HS (6 of 6)
# Skill: High Speed Maneuvering
type = "passive"
def handler(fit, container, context):
level = container.... | Ebag333/Pyfa | eos/effects/highspeedmanuveringcapacitorneedmultiplierpostpercentcapacitorneedlocationshipmodulesrequiringhighspeedmanuvering.py | Python | gpl-3.0 | 568 |
"""Map paths based on patterns defined in the config file."""
import os
from functools import partial
from tinypipeline.core import config
class Paths(object):
"""Handle paths within the pipeline."""
def __getattr__(self, attr):
"""Get the path behind the given attr pattern."""
if attr in c... | PaulSchweizer/tinypipeline | tinypipeline/core/paths.py | Python | gpl-3.0 | 1,191 |
#
# #/usr/bin/env python3
# -*- coding:utf-8 -*-
from database import Measure
import json
import requests
import time
import yaml
with open("param.yml", 'r') as stream:
try:
param = yaml.load(stream)
except yaml.YAMLError as e:
print(e)
def getkwatthours(url, data, headers, sensorId, t0, t1)... | SamR1/OpenCityLab-dataviz | functions.py | Python | gpl-3.0 | 4,740 |
#!/usr/bin/env python
import sys
import logging
import argparse
from gff3 import feature_lambda, feature_test_qual_value
from CPT_GFFParser import gffParse, gffWrite
from Bio.SeqFeature import FeatureLocation
log = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def __get_features(child, interpro... | TAMU-CPT/galaxy-tools | tools/gff3/gff3_rebase.py | Python | gpl-3.0 | 4,407 |
# Copyright 2016 Metehan Özbek <mthnzbk@gmail.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; either version 3 of the License, or
# (at your option) any later version.
#
# This program is... | PisiLinuxNew/kaptan | kaptan/libkaptan/ui_other.py | Python | gpl-3.0 | 4,525 |
from django.conf.urls import url
from . import views
from django.contrib.auth.views import PasswordResetConfirmView, PasswordResetView, PasswordResetDoneView, PasswordResetCompleteView
urlpatterns = [
url(r'^$', views.index,name="home"),
url(r'update_dataset$', views.update_dataset, name='update_dataset'),
... | texta-tk/texta | account/urls.py | Python | gpl-3.0 | 1,734 |
# coding=utf-8
#
# (c) Copyright 2008 by Daniel J. Rocco
# Licensed under the Creative Commons Attribution-
# Noncommercial-Share Alike 3.0 United States License, see
# <http://creativecommons.org/licenses/by-nc-sa/3.0/us/>
#
"""
Command-module for controlling **TortoiseSVN** from Windows Explorer
==================... | Erotemic/local | depricated/speech/Examples/_tortoisesvn.py | Python | gpl-3.0 | 6,848 |
'''
Created on 23 Jul 2009
@author: charanpal
'''
from exp.sandbox.data.ExamplesList import ExamplesList
from apgl.graph.DictGraph import DictGraph
from apgl.graph.SparseGraph import SparseGraph
from sandbox.util.Parameter import Parameter
import numpy
class EgoSimulator:
"""
A class which simula... | charanpald/wallhack | wallhack/egograph/EgoSimulator.py | Python | gpl-3.0 | 7,289 |
# encoding: utf-8
from Tkinter import *
from penview import *
from graph_view import *
from table_view import *
class DataRegion(Frame):
def __init__(self, parent, window):
Frame.__init__(self, parent)
self.window = window
# set up the graph view, consisting of a controls and a scrollab... | Pfiver/penview | data_region.py | Python | gpl-3.0 | 1,947 |
#!/bin/env python
# Documentation: Please see the usage() function below!
import sys
import subprocess
import platform
import psutil
# Default ZeroMQ port
PORT = 5570
def is_listening(port):
"""
More proper boolean operator for easier
reading.
return 1 # Indicate a found listener
return 0 ... | TrailingDots/ListeningPort | listeningPort.py | Python | gpl-3.0 | 6,416 |
### 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 3
# of the License, or (at your option) any later version.
#
# This program is distributed... | Passtechsoft/TPEAlpGen | blender/release/scripts/addons_contrib/mesh_snap_utilities_line.py | Python | gpl-3.0 | 41,708 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/Users/chernomirdinmacuvele/Documents/workspace/PescArt2.0/UserInt/ui_addRulesToForm.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
clas... | InUrSys/PescArt2.0 | GeneratedFiles/ui_addRulesToForm.py | Python | gpl-3.0 | 5,232 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import tornado
from multiprocessing import Process
from tornado.httpclient import AsyncHTTPClient
repeat = 5
def handle_response(response):
global repeat
repeat -= 1
if response.error:
print "err:%s"%(response.error,)
else:
print response... | shanghaiyangming/trouter | test/t.py | Python | gpl-3.0 | 1,035 |
#dominant
import os
folder = sys.argv[1]
def make_file_list(input_dir):
file_list = []
input_file_list = os.listdir(input_dir)
for input_file in input_file_list:
if input_file[-8:] == '.cluster':
file_list.append(input_file)
return file_list
file_list = make_file_list(folder)
for... | taejoonlab/taejoonlab-toolbox | PopGen/dominant_nucl.py | Python | gpl-3.0 | 2,301 |
# -*- coding: utf-8 -*-
import re
import sublime, sublime_plugin
class IspfShiftRightCommand(sublime_plugin.TextCommand):
def run(self, edit):
selection = self.view.sel()
for region in selection:
region_text = self.view.substr(region)
shifted_lines = []
for lin... | vadimshchukin/zsublime | ISPF/ISPF.py | Python | gpl-3.0 | 1,523 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditio... | tkaitchuck/nupic | build_system/autobuild/deploy.py | Python | gpl-3.0 | 7,654 |
import xmlrpclib
tracks_list = ['track UNO', 'track DOS']
playlistID = 129
server = xmlrpclib.Server('http://localhost:8003')
#print server.chop_in_half('I am a confidant guy')
file = "file:///media/usb1000/media/BURNSTATION/music/notype/[NT 075] n.kra - bits.pieces/075-01-n.kra-mangle.ogg"
#print server.burn_to_... | Xicnet/burnstation | daemon/xmlrpclient.py | Python | gpl-3.0 | 646 |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from collections import defaultdict
# from pprint import pprint
import argparse # Note: python 2.7+
import datetime
import json
import logging
import os
import sys
impor... | nens/githubinfo | githubinfo/commits.py | Python | gpl-3.0 | 11,594 |
# Copyright (c) 2011, Eucalyptus Systems, Inc.
# All rights reserved.
#
# Redistribution and use of this software 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, t... | sosilent/euca | clc/eucadmin/eucadmin/utils.py | Python | gpl-3.0 | 2,194 |
## Code outside the data string, and the setup and action blocks is ignored
## If manually editing, you must reload the code. Delete the resource timestamp so kaithem knows it's new
__data__="""
{continual: false, enable: true, once: true, priority: interactive, rate-limit: 0.0,
resource-timestamp: 1645141613510257, ... | EternityForest/KaithemAutomation | kaithem/data/modules/Beholder/main.py | Python | gpl-3.0 | 787 |
#!/usr/bin/env python
import luigi
import dynamic_range_simulation
import darknoise_simulation
import pde_simulation
import relative_pde_simulation
import n_pe_simulation
import crosstalk_neighbour_simulation
class All(luigi.WrapperTask):
def requires(self):
yield crosstalk_neighbour_simulation.All()
yie... | ntim/g4sipm | sample/run/luigi/all.py | Python | gpl-3.0 | 561 |
from django import forms
from django.forms import ModelForm
from django.db import models
from app.models import NFL_Division
from app.models import NFL_Conference_Choices
class NFL_DivisionForm_Create(ModelForm):
name = forms.CharField(max_length = 100,
widget = forms.TextInput({
... | LarryHillyer/PoolHost | PoolHost/nfl/division/forms.py | Python | gpl-3.0 | 1,479 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import settings
#----------------------------------------
# globals
#----------------------------------------
web = settings.web
stow = web.utils.storage
#----------------------------------------
# 初始化菜单 权限控制
#----------------------------------------
def init_menus():
_... | liangtianyou/ST | stclient/menus.py | Python | gpl-3.0 | 3,290 |
"""Metadata related information.
:Date: 22 Sep, 2015
:Author: Alex Jironkin
"""
import abc
class PHEMetaData(object):
"""Abstract class to provide interface for meta-data creation."""
__metaclass__ = abc.ABCMeta
def __init__(self):
pass
@abc.abstractmethod
def get_meta(self):
"... | phe-bioinformatics/PHEnix | phe/metadata/__init__.py | Python | gpl-3.0 | 419 |
def my_mean(list):
length = count_length(list)
sum = 0
for i in list:
sum = sum + i
return sum / length
def count_length(list):
count = 0
for i in list:
if i == '':
break
else:
count += 1
return count
numbers = [1,2,3,4,5,6,7,8,9]
print(my_mean(numbers))
| ledeprogram/algorithms | class1/homework/born_mathias_1_1.py | Python | gpl-3.0 | 276 |
# IMAPFS - Cloud storage via IMAP
# Copyright (C) 2013 Wes Weber
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# T... | waweber/imapfs | imapfs/file.py | Python | gpl-3.0 | 7,538 |
# -*- coding: utf-8 -*-
import os
y = str(5**4**3**2)
print("5**4**3**2 = %s...%s and has %i digits" % (y[:20], y[-20:], len(y)))
os.system("pause")
| NicovincX2/Python-3.5 | Théorie des nombres/Arithmétique/Théorie algébrique des nombres/Arithmétique multiprécision/arbitrary-precision_integers_example.py | Python | gpl-3.0 | 152 |
#!/usr/bin/env python3
#
# PLASMA : Generate an indented asm code (pseudo-C) with colored syntax.
# Copyright (C) 2015 Joel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... | chubbymaggie/reverse | plasma/lib/arch/arm/utils.py | Python | gpl-3.0 | 4,197 |
# -*- coding: utf-8 -*-
# Copyright (C) 2005 Osmo Salomaa
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This pr... | otsaloma/gaupol | aeidon/files/ssa.py | Python | gpl-3.0 | 5,726 |
# -*- coding: utf-8 -*-
import pytest
import os
import jsonschema
from flexmock import flexmock
from f8a_worker.workers import LicenseCheckTask
from f8a_worker.schemas import load_worker_schema, pop_schema_ref
from f8a_worker.object_cache import EPVCache
# TODO: drop the try/except after switching to Python 3
try:
... | fridex/fabric8-analytics-worker | tests/workers/test_licensecheck.py | Python | gpl-3.0 | 2,348 |
import copy
import json
import logging
import threading
import uuid
from flask import Flask, abort, jsonify, request
import kubernetes
app = Flask(__name__)
app.secret_key = "mega secret key"
JOB_DB = {}
def get_config(experiment):
with open('config_template.json', 'r') as config:
return json.load(config... | diegodelemos/cap-reuse | step-broker/app.py | Python | gpl-3.0 | 3,081 |
#!/usr/bin/env python2
#hue interpreter v .1
#by Alan Laughter
#released under the GPL v.3
#hue is identical to brainfuck (for the moment) and is converted with the following table:
#HUE = ]
#hue = >
#huE = <
#hUe = +
#hUE = -
#Hue = .
#HuE = ,
#HUe = [
#this version cannot accept input properly however can run any o... | AlanLaughter/huehuehue | huev.1/hue.py | Python | gpl-3.0 | 3,687 |
#!/usr/bin/env python
#
# Copyright 2014 Institute for Theoretical Information Technology,
# RWTH Aachen University
# www.ti.rwth-aachen.de
#
# This 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 S... | rwth-ti/gr-ofdm | python/ofdm/qa_moms_ff.py | Python | gpl-3.0 | 1,256 |
import numpy as np
from pygmin.potentials.potential import BasePotential
class WhamPotential(BasePotential):
"""
#############################################################################
# the idea behind this minimization procedure is as follows:
##################################################... | js850/PyGMIN | pygmin/wham/wham_potential.py | Python | gpl-3.0 | 4,820 |
import pygame as pg
from .sprite import Sprite
class Animation(object):
def __init__(self,
paths=None,
imgs=None,
sprites=None,
spritesheet=None,
rect=None,
count=None,
colorkey=None,
loop=False,
frame_interval=1,
size=None):
if paths:
self.frames = [Sprit... | LittleSmaug/summercamp2k17 | src/game/animation.py | Python | gpl-3.0 | 1,129 |
import os
import shutil
import zipfile
import tempfile
from osgeo import ogr
from datetime import datetime, timedelta
from unittest.mock import patch
from geonode.br.management.commands.utils.utils import ignore_time
from geonode.tests.base import GeoNodeBaseTestSupport
from geonode.utils import copy_tree, fixup_shp_... | tomkralidis/geonode | geonode/tests/test_utils.py | Python | gpl-3.0 | 5,051 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# graph_tool -- a general graph manipulation python module
#
# Copyright (C) 2006-2013 Tiago de Paula Peixoto <tiago@skewed.de>
#
# 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... | profgiuseppe/graph-tool-tests | src/graph_tool/all.py | Python | gpl-3.0 | 2,008 |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 8 10:47:00 2016
@author: Remi Eyraud
Tested with Python 2.7 and Python 3.4
"""
# State the problem number
problem_number = '4'
# and the user id (given during registration)
user_id = '42'
train_file = problem_number + ".spice.train"
prefix_file = problem_number + ".s... | vinhqdang/spice | torch-rnn/spice/p4/spectral_original.py | Python | gpl-3.0 | 6,288 |
# File globals
data_coordinates_file_suffix = 'position_data_coordinates.txt'
actual_coordinates_file_suffix = 'actual_coordinates.txt'
category_file_suffix = 'categories.txt'
order_file_suffix = 'order.txt'
# Parameter globals
default_z_value = 1.96
default_pipeline_flags = 3
default_dimensions = 2
# Visualization g... | kevroy314/msl-iposition-pipeline | cogrecon/core/cogrecon_globals.py | Python | gpl-3.0 | 991 |
#
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The facts class for iosxr
this file validates each subset of facts and selectively
calls the appropriate facts gathering function
"""
from __future__ import absolute_imp... | amenonsen/ansible | lib/ansible/module_utils/network/iosxr/facts/facts.py | Python | gpl-3.0 | 2,778 |
import os
import sys
def current_file_directory():
return os.path.dirname(os.path.realpath(__file__))
BASE_DIR = os.path.dirname(os.path.dirname(current_file_directory()))
sys.path.append(BASE_DIR)
os.environ['DJANGO_SETTINGS_MODULE'] = 'paper_plane.settings'
| tiankangkan/paper_plane | king_spider/music_web_spider/__init__.py | Python | gpl-3.0 | 269 |
import os, re, sys
import read_dicts
from collections import Counter
import pandas as pd
import numpy as np
import operator
import random
sys.path.append('.')
ENABLE_WRITE = 1
INDEX_NAMES_FILES = '../../data/aaindex/list_of_indices.txt'
def getscores(d, aalist, seq):
score_list = list()
char_freq = dict()... | seokjunbing/cs75 | src/data_processing/read_data.py | Python | gpl-3.0 | 22,577 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'splash.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_splash(object):
def setupUi(self, splash):
splash.setObjectName... | mcrav/XDToolkit | src/splash.py | Python | gpl-3.0 | 1,610 |
# Copyright (c) 2014-2017 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later vers... | gnumdk/lollypop | lollypop/player_userplaylist.py | Python | gpl-3.0 | 4,223 |
from pyplanet.views import TemplateView
class ToolbarView(TemplateView):
template_name = 'core.pyplanet/toolbar.xml'
def __init__(self, app, *args, **kwargs):
"""
Initiate Player Toolbar
:param app: App instance.
:type app: pyplanet.apps.core.pyplanet.app.PyPlanetConfig
"""
super().__init__(*args, **k... | PyPlanet/PyPlanet | pyplanet/apps/core/pyplanet/views/toolbar.py | Python | gpl-3.0 | 1,256 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
The experiment with 10 Hz/5Hz, wisp, attention, 70, cA 3, delta, theta, alpha low, alpha high, batch size = 1 and
balanced data set
@author: yaric
"""
import experiment as ex
import config
from time import time
experiment_name = 'cA_3_1_dt-th-a_l-a_h' # will be use... | yaricom/brainhash | src/experiment_cA3_1_dt_th_al_ah.py | Python | gpl-3.0 | 1,954 |
import urllib.request
def download(path):
print('Beginning file download with urllib2...')
url = []
url.append('http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz')
url.append('http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz')
url.append('http://yann.lecun.com/exdb/mnist/t10k-i... | shucommon/little-routine | python/AI/tensorflow/MNIST_data/download.py | Python | gpl-3.0 | 745 |
# URL INFO http://www.tv3.cat/pvideo/FLV_bbd_dadesItem.jsp?idint=4705751
# URL RTMP http://www.tv3.cat/pvideo/FLV_bbd_media.jsp?PROFILE=EVP&ID=4705751&QUALITY=H&FORMAT=MP4
# el QUALITY y el FORMAT salen del URL INFO
'''
REMOTE_DBG = True
if REMOTE_DBG:
try:
import pysrc.pydevd as pydevd
... | samsaga2/tv3alacarta | default.py | Python | gpl-3.0 | 937 |
# -*- coding: utf-8 -*-
import console
import task_modules.module_switch as module_switch
def main():
chatbot = Chatbot()
chatbot.waiting_loop()
class Chatbot(object):
def __init__(self, name="NCKU"):
self.name = name # The name of chatbot.
self.speech = '' # The... | konata39/chatbot-backend | chatbot.py | Python | gpl-3.0 | 4,400 |
#!/usr/bin/env python3
# A simulation of a Doppler Probe checking blood pressure
import os
import signal
import time
from doppler_probe_sim import DopplerProbeSim
doppler_probe_sim = None
def CatchInterrupt(signalnum, frame):
if doppler_probe_sim is not None:
doppler_probe_sim.simulation_status = DopplerProbeSim... | eoghan-c/blood_pressure | main.py | Python | gpl-3.0 | 1,376 |
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | persepolisdm/persepolis | persepolis/scripts/mainwindow.py | Python | gpl-3.0 | 251,071 |
# Chris Bugg
# 10/1/14
# NOTE: Runs on Python 2.7.6
# UPDATE:
# 10/10/14
# -> Now runs with 8 sub-processes using
# the [a-z,A-Z,0-9] alphabet
#
# 10/12/2014 UPDATE: Ubuntu 14.04, OS X, and Windows 7 have commited to this project by Chris H
# Ubuntu GUI ran 1.71 million hashe... | COCS4950G7/COSC4950 | Source/demoCrack3.py | Python | gpl-3.0 | 6,305 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('access', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='User',
fields=[
... | torehc/carontepass-v2 | web/carontepass/access/migrations/0002_user.py | Python | gpl-3.0 | 962 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-20 21:23
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django_api.models
class Migration(migrations.Migration):
dependencies = [
('django_api', '0018_auto_20160420_23... | IsacEkberg/crag-finder | django_api/migrations/0019_auto_20160420_2323.py | Python | gpl-3.0 | 2,068 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of PyDownTV.
#
# PyDownTV is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) a... | aabilio/PyDownTV | Servers/riasbaixas.py | Python | gpl-3.0 | 2,956 |
import hashlib
from django.db import IntegrityError
from django.db import models
# A version is a way of caching item data so changes can be
# undone
class Version(models.Model):
change_uuid = models.CharField(max_length=50, db_index=True)
uuid = models.CharField(max_length=50, db_index=True)
item_type =... | portableant/open-context-py | opencontext_py/apps/ocitems/versions/models.py | Python | gpl-3.0 | 845 |
from re import compile
from itertools import count
from collections import namedtuple, Iterable
class LabelGenerator:
def __init__(self, name, joinchar="."):
self.labels = {None:self._makeiterator(name, joinchar)}
self.name = name
self.joinchar = joinchar
def _makeiterator(sel... | cakesmith/Firefly | toolkit.py | Python | gpl-3.0 | 2,945 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | pkill-nine/qutebrowser | tests/conftest.py | Python | gpl-3.0 | 6,876 |
from decimal import *
class util:
def getInterval(self, function):
"""
function: lambda function
Method that obtains the integer intervals where the function
changes its sign from negative to positive.
If it finds the function's root within its intervals, i... | kotoromo/Numeric_Methods | Bisection/util.py | Python | gpl-3.0 | 1,437 |
# coding: utf-8
from __future__ import absolute_import, division, unicode_literals, print_function
import unittest
import mock
from xmpp.protocol import JID, Message
from vmbot.helpers import database as db
from vmbot.models.user import User
from vmbot.helpers.decorators import requires_role, requires_dir_chat
@... | Hijacker/vmbot | test/test_acl_decorators.py | Python | gpl-3.0 | 2,199 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Jan Zikes, Radim Rehurek
# Copyright (C) 2014 Radim Rehurek <me@radimrehurek.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""Online Latent Dirichlet Allocation (LDA) in Python, using all CPU cores to parallelize and speed up m... | napsternxg/gensim | gensim/models/ldamulticore.py | Python | gpl-3.0 | 16,688 |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
# Ralf Habacker, 2006 (rh)
# Yinon Ehrlich, 2009
"""
g++/llvm detection.
"""
import os, sys
from waflib import Configure, Options, Utils
from waflib.Tools import ccroot, ar
from waflib.Configure import conf
@conf
def find_avr_gxx(conf):
"""
Fin... | sofian/qualia | examples/makefiletests/avr_gxx.py | Python | gpl-3.0 | 4,490 |
class StateMachine:
def __init__(self, initial_state):
self.currentState = initial_state
# Template method:
def process(self, inputs):
for i in inputs:
self.currentState.run(i)
| ma-renaud/Basement_Monitoring_GUI | state_machine.py | Python | gpl-3.0 | 218 |
from __future__ import absolute_import
from __future__ import division
from builtins import zip
from builtins import map
from builtins import range
from builtins import object
from past.utils import old_div
import bisect
class quadNG(object): # quadratic Newton-Gregory Interpolation
''' quadratic Ne... | sonofeft/XYmath | xymath/newtGreg2.py | Python | gpl-3.0 | 5,126 |
# Copyright 2014 Michael Frank <msfrank@syntaxjockey.com>
#
# This file is part of Mandelbrot.
#
# Mandelbrot is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opti... | msfrank/mandelbrot | mandelbrot/timerange.py | Python | gpl-3.0 | 6,251 |
# Copyright 2008, Patrick C. McGinty
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distribut... | epronk/mktoc | src/mktoc/test_disc.py | Python | gpl-3.0 | 3,118 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#É adimensional?
adi = False
#É para salvar as figuras(True|False)?
save = True
#Caso seja para salvar, qual é o formato desejado?
formato = 'jpg'
#Caso seja para salvar, qual é o diretório que devo salvar?
dircg = 'fig-sen'
#Caso seja para salvar, qual é o nome do arquivo... | asoliveira/NumShip | scripts/plot/leme-velo-u-cg-plt.py | Python | gpl-3.0 | 2,013 |
#!/usr/bin/python -u
# -*- coding: utf-8 -*-
from listasTematicas.models import *
from especies.models import *
from django import forms
from django.contrib import admin
from django.contrib.auth.models import User
from django.http import HttpResponseRedirect,HttpResponse
from django.shortcuts import render, ren... | desarrollosimagos/svidb | administrativo/listasTematicas/admin.py | Python | gpl-3.0 | 12,168 |
def smith_waterman(s1: str, s2: str) -> int:
match = 2
mismatch = -2
gap = -1
mat = [[0 for i in range(len(s1) + 1)] for j in range(len(s2) + 1)]
for j in range(len(mat)):
for i in range(len(mat[j])):
if i == 0 or j == 0:
continue
upper_left = mat[j... | tikuta/nachune | nachune/align.py | Python | gpl-3.0 | 581 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Satpy developers
#
# This file is part of satpy.
#
# satpy is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or... | pytroll/satpy | satpy/readers/li_l2.py | Python | gpl-3.0 | 5,368 |