code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from collections import Counter
from sklearn import metrics
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import AdaBoostClassifier, RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from... | algomaus/PAEC | src/python/blackbox_kmer.py | Python | gpl-3.0 | 8,184 |
"""
Provides a base class for pipe-based jobs.
"""
# Copyright 2013 Paul Griffiths
# Email: mail@paulgriffiths.net
#
# All rights reserved.
from math import pi
from jobcalc.helper import ptoc, draw_dim_line
from jobcalc.flange import Flange
from jobcalc.component import DrawnComponent
class Pipe(DrawnComponent):
... | paulgriffiths/jobcalc | jclib/pipe.py | Python | gpl-3.0 | 9,416 |
# flake8: noqa
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('sim', '0003_section_turn'),
]
operations = [
migrations.RemoveField(
model_name='sectionturndates... | thraxil/countryx | countryx/sim/migrations/0004_auto_20150428_0639.py | Python | gpl-3.0 | 448 |
from django.db import models
import hashlib
from django.contrib.auth.models import AbstractUser
from notification.utils import logout_notify
class CustomUser(AbstractUser):
token = models.CharField(
max_length=512,
null=True
)
def get_monitor_tokens(self):
return [monitor.android_... | CadeiraCuidadora/UMISS-backend | umiss_project/umiss_auth/models.py | Python | gpl-3.0 | 2,130 |
#!/home/srbrown/anaconda3/bin/python3
import requests
import json
import textwrap
import os
import sys
import logging
from PIL import Image, ImageDraw, ImageFont
from pathlib import Path
from configparser import ConfigParser
# set the home path
home = str(Path.home())
# setup logging
logging.basicConfig(filename=hom... | bennsarrow/apod | apod.py | Python | gpl-3.0 | 3,078 |
#!/usr/bin/env python
"""
In this question your task is again to run the clustering algorithm from lecture, but on a MUCH bigger graph. So big,
in fact, that the distances (i.e., edge costs) are only defined implicitly, rather than being provided as an explicit
list.
The data set is below.
clustering_big.txt
The for... | vinjai/Algorithms_Coursera_Stanford2 | scripts/Problem2b.py | Python | gpl-3.0 | 4,760 |
__author__ = 'Scott Ficarro'
__version__ = '1.0'
import wx
import wx.grid as grid
try:
from agw import pybusyinfo as PBI
except ImportError: # if it's not there locally, try the wxPython lib.
import wx.lib.agw.pybusyinfo as PBI
#import BlaisPepCalcSlim_aui as BlaisPepCalc
import DatabaseOperations as db
#... | BlaisProteomics/mzStudio | mzStudio/dbFrame.py | Python | gpl-3.0 | 37,267 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Raspberry Pi Internet Radio playlist utility
# $Id: create_playlists.py,v 1.21 2014/07/12 10:35:53 bob Exp $
#
# Create playlist files from the following url formats
# iPhone stream files (.asx)
# Playlist files (.pls)
# Extended M3U files (.m3u)
# Direct media ... | pabloest/piradio | create_playlists.py | Python | gpl-3.0 | 13,494 |
from fabric.api import run, local, hosts, cd
from fabric.contrib import django
#Descarga y arranca docker
def install_run():
run('sudo apt-get update')
run('sudo apt-get install -y docker.io')
run('sudo docker pull pmmre/bares:bares')
run('sudo docker run -i -t pmmre/bares:bares /bin/bash')
#Ejecucion de la apl... | pmmre/Bares | fabfile.py | Python | gpl-3.0 | 499 |
#!/usr/bin/python3
from .ruliweb_spiders import RuliwebSpider
class RuliwebSpiderPSP(RuliwebSpider):
name = 'ps'
| munhyunsu/UsedMarketAnalysis | ruliweb_crawl/ruliweb/spiders/ps_spiders.py | Python | gpl-3.0 | 118 |
# -*- coding: utf-8 -*-
"""
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
"""
import os
def mul3and5(n):
result = 0
for num in range(1, n):
if num % 3 == 0 or n... | NicovincX2/Python-3.5 | Project Euler/1.list_sum_of_multiples_3-5.py | Python | gpl-3.0 | 536 |
# Copyright (C) 2014 Oleh Prypin <blaxpirit@gmail.com>
#
# This file is part of UniversalQt.
#
# UniversalQt 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 opt... | BlaXpirit/steam-notifier | universal-qt/qt/gui.py | Python | gpl-3.0 | 1,555 |
def add(x: float, y: float) -> float:
return x + y
def main() -> int:
print("2.0 + 3.0 =", add(2.0, 3.0))
return 0
| mugwort-rc/py2cpp | samples/add.py | Python | gpl-3.0 | 128 |
#!/Programs/Python34/python
import cgi
import os
import cgitb
import sys
from importlib.machinery import SourceFileLoader
import core.web as web
cgitb.enable()
WEB_ROOT = os.environ["SCRIPT_NAME"].replace("index.py", "")
ROOT = os.environ["SCRIPT_FILENAME"].replace("index.py", "")
getMethod = cgi.FieldSto... | JLesuperb/PythonWeb | framework-mvc/index.py | Python | gpl-3.0 | 1,455 |
import bottle, json, time
from gevent.socket import IPPROTO_TCP, TCP_NODELAY
from gevent.pywsgi import WSGIServer
from gevent.fileobject import FileObject as gevent_open
from geventwebsocket.handler import WebSocketHandler
from sakura.hub.web.manager import rpc_manager
from sakura.hub.web.bottle import bottle_get_wsock... | eduble/panteda | sakura/hub/web/greenlet.py | Python | gpl-3.0 | 6,600 |
# Copyright 2011 Sebastien Maccagnoni-Munch
#
# This file is part of Omoma.
#
# Omoma 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.
#
# Omoma is distributed in the hope that it will be useful,
# b... | TheGU/omoma | omoma/omoma_web/importexport/ofxparser.py | Python | gpl-3.0 | 6,882 |
import sys
import array
import xml.sax
from bin.libs.xmlhandler.corpusXMLHandler import CorpusXMLHandler
from base.sentence import Sentence
from base.word import Word, WORD_ATTRIBUTES
from base.__common import ATTRIBUTE_SEPARATOR
from util import verbose
NGRAM_LIMIT=16
def copy_list(ls):
return map(lambda x: x, ls... | KWARC/mwetoolkit | bin/old/indexlib_stable.py | Python | gpl-3.0 | 12,942 |
# -*- coding: utf-8 -*-
from __future__ import division
__author__ = 'ogaidukov'
from collections import defaultdict
from io import BytesIO
from werkzeug import secure_filename
from flask import request, Blueprint, render_template, redirect, escape, jsonify, url_for, make_response
from flask.ext.login import login_r... | olegvg/me-advert | me-advert/console/views/manager.py | Python | gpl-3.0 | 58,046 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-10-08 02:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ToDo',
... | mcueto/djangorestframework-auth0_sample | sample/migrations/0001_initial.py | Python | gpl-3.0 | 725 |
# -*- coding: utf-8 -*-
import re
import urlparse
from core import httptools
from core import scrapertools
from core import tmdb
from core.item import Item
from platformcode import config, logger
host = 'http://www.qserie.com'
def mainlist(item):
logger.info()
itemlist = []
itemlist.append(Item(chann... | pitunti/alfaPitunti | plugin.video.alfa/channels/qserie.py | Python | gpl-3.0 | 17,287 |
#countWalk.py
#Garik Sadovy
#gcsadovy
import arcpy, sys, os
path = sys.argv[1]
for (path, dirs, files) in os.walk(path):
for file in files:
if file.endswith(".shp") == True:
count = arcpy.GetCount_management("C:\Temp\COVER63p.shp")
print "{0}/{1} has {2} entries.".format... | gcsadovy/generalPY | countWalk_test.py | Python | gpl-3.0 | 339 |
__module_name__ = "hexchat-oper"
__module_version__ = "2.1"
__module_description__ = "Python 3 Windows"
import os
import sys
import hexchat
import threading
sys.path.append(os.path.join(os.path.dirname("__file__"), "extras"))
path = os.path.join(os.path.dirname("__file__"), "extras")
geoip_dat = os.path.join(path,"GeoI... | irrgit/hexchat-plugins | hexchat-oper/hexchat-oper.py | Python | gpl-3.0 | 18,986 |
from controller.controller_unit import Controller
from colorama import Fore, init as fore_init
from arg_parser import init_parser
from benchmark.run_benchmark import Benchmark
fore_init()
args = init_parser()
def run():
try:
print(Fore.LIGHTGREEN_EX, "Welcome to the game Logik!", Fore.RESET)
prin... | miskopo/Logik | run.py | Python | gpl-3.0 | 1,562 |
# -*- coding: utf8 -*-
from ffcgi import cgi_event
del(cgi_event['id'])
SQL = (
("lists", """select SQL_CALC_FOUND_ROWS r.*,u1.FIO as customer, u2.FIO as performer, (select count(1) from delo_order where requirement_id=r.id )cnt
FROM `requirement` r left join users u1 on(u1.id=id_customer)
... | ffsdmad/af-web | cgi-bin/plugins2/report/order/requirement_list.py | Python | gpl-3.0 | 787 |
#!/usr/bin/env python
import re
import os
from os import path
import logging
import sqlalchemy
import taxtastic
import taxtastic.ncbi
from taxtastic.ncbi import read_names, read_archive
from . import config
from .config import TestBase
log = logging
outputdir = config.outputdir
datadir = config.datadir
ncbi_master... | fhcrc/taxtastic | tests/test_ncbi.py | Python | gpl-3.0 | 3,662 |
#!/usr/bin/python
# continue : its skips an iteration.
for student in ['rajni','madhuri','priya','kumar','sunil','raj','praveen']:
if student == 'kumar':
continue
#break
#pass
print "results for the student - {}".format(student) | tuxfux-hlp-notes/python-batches | archieves/batch-58/exams.py | Python | gpl-3.0 | 237 |
import glob
import os
import pickle
import unittest
import numpy as np
from scipy import sparse
from sklearn import datasets
from sklearn.exceptions import NotFittedError
from sklearn.externals import joblib
from sklearn.metrics import accuracy_score
from sklearn.metrics import mean_absolute_error
from sklearn.metrics... | StrikerRUS/rgf_python | tests/test_rgf_python.py | Python | gpl-3.0 | 26,813 |
#!/usr/bin/env python
# Copyright 2010-2013 by Alexander O'Neill
# Project home page: http://github.com/alxp/subspeech.
# 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... | alxp/subspeech | subspeech.py | Python | gpl-3.0 | 8,733 |
'''
SASMOL: Copyright (C) 2011 Joseph E. Curtis, Ph.D.
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.
... | madscatt/sasmol | src/python/test_sasmol/test_sasop/test_intg_sasop_Move_rotate.py | Python | gpl-3.0 | 4,901 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'EstLanUser'
db.create_table(u'accounts_estlanuser', (
... | Jyrno42/EstLan-Web | EstLan/accounts/migrations/0001_initial.py | Python | gpl-3.0 | 7,021 |
#!/usr/bin/env python
'''
Written by Dejanira Araiza Illan, January 2016
'''
import re
import os
legcount=[]
badlegcount=[]
timeout2 = []
activations = []
boredoms = []
activations2 = []
for jj in range(10,51):
for i in range(1,161):
legs = 0
badlegs = 0
to2 = 0
for num,line in enumerate(open(os.getcwd()+'... | robosafe/mc-vs-bdi | data/xproduct_mc_table.py | Python | gpl-3.0 | 3,144 |
#/usr/bin/env python
#coding:utf-8
# Author : tuxpy
# Email : q8886888@qq.com.com
# Last modified : 2015-05-19 17:09:43
# Filename : utils.py
# Description :
from __future__ import unicode_literals, print_function
import os
def get_tmp_filepath(_file):
"""生成一个针对_file的临时文件名"""
_path = os.... | lujinda/replace | replace/utils.py | Python | gpl-3.0 | 701 |
#!/usr/bin/env python
"""
======================
Compare 70/24 um Plots
======================
Plot a comparison between the Hi-GAL and MIPSGAL images for a clump. For now,
Specifically for clump 5253.
"""
from __future__ import division
import aplpy
import numpy as np
from matplotlib import pyplot as plt
import matpl... | autocorr/besl | besl/bplot/comp70.py | Python | gpl-3.0 | 6,645 |
#!/usr/bin/python2
'''
This is an exapmle of how to use the closure feature to do some
oo work.
Notice:
- We treat the 'Person' function as a constructor.
- We call it with a capital first letter.
- We pass arguments to it needed to create the instance.
- In order to have lots of data in the closure we simply
store a ... | nonZero/demos-python | src/examples/short/closure/closure_oo.py | Python | gpl-3.0 | 1,354 |
''' Password based key-derivation function - PBKDF2 '''
# This module is for Python 3
# Copyright (c) 2011, Stefano Palazzo <stefano.palazzo@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright noti... | bobintetley/asm3 | src/asm3/pbkdf2/pbkdf23.py | Python | gpl-3.0 | 5,091 |
# Copyright (C) 2011, 2012, 2014, 2015 David Maxwell and Constantine Khroulev
#
# This file is part of PISM.
#
# PISM 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 you... | talbrecht/pism_pik07 | site-packages/PISM/sia.py | Python | gpl-3.0 | 1,881 |
#!/home/vyos/vyos-api/bin/python
import pytest
import sys
import os
sys.path.append('/home/vyos/vyos-api/ServiceManager')
from ConfigInterfaces import configinterface as ifacecfg
import validation as vld
def test_ethernet_config():
action=["set","delete"]
for act in action:
if act not in action:
... | abessifi/pyatta | tests/servicemanager/test_config_interfaces.py | Python | gpl-3.0 | 722 |
# -*- coding: utf-8 -*-
import subprocess
import os
import sys
import re
import errno
# This variable contains a reference version of the current code-base. It is
# updated by release and dev-cycle scripts.
BASE_VERSION = '2021.12.21'
# This commit is the reference commit of the BASE_VERSION above. Technically, it
#... | catmaid/CATMAID | django/projects/mysite/utils.py | Python | gpl-3.0 | 2,015 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2018 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... | airodactyl/qutebrowser | qutebrowser/browser/mouse.py | Python | gpl-3.0 | 9,296 |
# test cigar strings
#############################################################################
#############################################################################
# #
# Copyright (C) 2013 - 2014 Genome Research Ltd. ... | rcallahan/smalt | test/cigar_test.py | Python | gpl-3.0 | 3,208 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014, David Poulter
#
# 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 p... | davebrent/consyn | consyn/cli/rm.py | Python | gpl-3.0 | 1,493 |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
UF = [
('AC', 'Acre'),
('AL', 'Alagoas'),
('AP', 'Amapá'),
('AM', 'Amazonas'),
('BA', 'Bahia'),
('CE', 'Ceará'),
('DF', 'Distrito Federal'),
('ES', 'Espírito Santo'),
('GO', 'Goiás'),
('MA', 'Maranhã... | interlegis/atendimento | atendimento/utils.py | Python | gpl-3.0 | 1,685 |
# -*- coding: utf-8 -*-
from rest_framework import serializers
from .models import (
Offer,
Questionnaire,
Submission)
class OfferSerializer(serializers.ModelSerializer):
class Meta:
model = Offer
fields = (
'pk',
'created',
'modified',
... | mxmaslin/Test-tasks | django_test_tasks/old_django_test_tasks/apps/loans/serializers.py | Python | gpl-3.0 | 1,466 |
#!/usr/bin/env python
# Copyright 2013 National Renewable Energy Laboratory, Golden CO, USA
# This file is part of NREL MatDB.
#
# NREL MatDB 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... | ssullivangh/nrelmat | nrelmat/ScanXml.py | Python | gpl-3.0 | 52,847 |
#! /usr/bin/python
import sys
sys.path.append('../')
from toolbox.hreaders import token_readers as reader
from toolbox.hmappers import simple_mapper as mapper
_map = mapper.Simple_mapper(1,[0,3])
_reader = reader.Token_reader()
for line in sys.stdin:
words = _reader.read_all(line)
print '{}\t{}'.format(_map.... | xavi783/u-tad | Modulo4/ejercicio3/mapper.py | Python | gpl-3.0 | 358 |
from __future__ import print_function
import datetime
import errno
import os
import sys
import core
from core import logger, nzbToMediaDB
from core.nzbToMediaUtil import extractFiles, CharReplace, convert_to_ascii, get_nzoid
from core.nzbToMediaUtil import flatten, listMediaFiles, import_subs
from core.transcoder imp... | Filechaser/nzbToMedia | checkfilesinfolder.py | Python | gpl-3.0 | 10,729 |
# -*- encoding: utf-8 -*-
# pylint: disable=no-self-use
"""Test class for Organization CLI"""
import random
from fauxfactory import gen_string
from random import randint
from robottelo.cli.base import CLIReturnCodeError
from robottelo.cli.factory import (
make_domain, make_hostgroup, make_lifecycle_environment,
... | tkolhar/robottelo | tests/foreman/cli/test_organization.py | Python | gpl-3.0 | 38,207 |
from argparse import ArgumentParser
import os.path
class CliHelper(object):
@staticmethod
def readable_file(parser, arg):
if not os.path.exists(arg):
parser.error("The file %s does not exist!" % arg)
else:
return open(arg, 'r') # return an open file handle
class CliA... | codingo/Reconnoitre | Reconnoitre/lib/core/input.py | Python | gpl-3.0 | 4,515 |
# (c) Nelen & Schuurmans. GPL licensed, see LICENSE.rst.
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from datetime import datetime
import logging
from enum import Enum
from lxml import et... | nens/ribxlib | ribxlib/parsers.py | Python | gpl-3.0 | 13,369 |
#!/usr/bin/env python
"""
mtpy/mtpy/analysis/distortion.py
Contains functions for the determination of (galvanic) distortion of impedance
tensors.
The methods used follow Bibby et al 2005.
As it has been pointed out in that paper, there are various possibilities for
constraining the solution, esp. in the 2D case.
H... | geophysics/mtpy | mtpy/analysis/distortion.py | Python | gpl-3.0 | 14,307 |
# The loose feed parser that interfaces with an SGML parsing library
# Copyright 2010-2021 Kurt McKee <contactme@kurtmckee.org>
# Copyright 2002-2008 Mark Pilgrim
# All rights reserved.
#
# This file is a part of feedparser.
#
# Redistribution and use in source and binary forms, with or without modification,
# are perm... | rembo10/headphones | lib/feedparser/parsers/loose.py | Python | gpl-3.0 | 3,452 |
# This is an auto-generated file. Do not edit it.
from twisted.python import versions
version = versions.Version('twisted.web2', 8, 2, 0)
| Donkyhotay/MoonPy | twisted/web2/_version.py | Python | gpl-3.0 | 138 |
#!/usr/bin/env python
# encoding: utf-8
"""
setup_py2exe_Search_BMO_Instances.py
Copyright (C) 2016 Stefan Braun
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 (... | stefanbraun-private/pyVisiToolkit | py2exe_scripts/setup_py2exe_Search_BMO_Instances.py | Python | gpl-3.0 | 1,166 |
#!/usr/bin/python3
#
# CherryMusic - a standalone music server
# Copyright (c) 2012 Tom Wallroth & Tilman Boerner
#
# Project page:
# http://fomori.org/cherrymusic/
# Sources on github:
# http://github.com/devsnd/cherrymusic/
#
# CherryMusic is based on
# jPlayer (GPL/MIT license) http://www.jplayer.org/
# Cher... | cherrymusic-meta/cherrymusic-experimental | cherrymusicserver/db/__init__.py | Python | gpl-3.0 | 4,959 |
"""
Cross Origin Resource Sharing (CORS) headers must be present when using multiple backends.
This middleware automatically returns OPTIONS requests, and appends other requests with the correct headers.
"""
import asyncio
from aiohttp import hdrs, web, web_exceptions
from brewblox_service import brewblox_logger, st... | glibersat/brewpi-service | brewblox_service/cors.py | Python | gpl-3.0 | 1,385 |
from file_finder import find_a_file
def is_module_installed(mod_name, should_exit=False):
try:
__import__(mod_name)
print "Python module %s is already installed, huzzah!"% mod_name
except ImportError:
print "Darn it! Python was unable to import the module '%s'; please make sure it is installed correctly." % ... | willblev/RNA_TwiZe | check_requirements.py | Python | gpl-3.0 | 1,668 |
# Text file dumper
from subprocess import call
import re
address = raw_input("URL: ")
# Grabs the raw html of the page
def get_html(address):
call(["wget", address, "-O", "toread.txt"])
with open("toread.txt") as source:
html = source.read()
return html
# Searches for all assosiated text files an... | palkiakerr/Misc | python/TextGrabber/textgrabber.py | Python | gpl-3.0 | 1,053 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'checkin_complete_form.ui'
#
# Created: Thu Jul 29 19:23:25 2010
# by: PyQt4 UI code generator 4.7.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_Checkin_Success_Form(object):
de... | nzaillian/Cheatsquare | checkin_complete_form.py | Python | gpl-3.0 | 5,493 |
'''
No doubt that fixed coordinates are the most flexible way of organizing elements in
an n-dimensional space; however, it is very time-consuming. Instead, Kivy provides a
good set of layouts instead, which facilitate the work of organizing widgets. A Layout
is a Widget subclass that implements different strategies to... | pd-Shah/kivy | 6-event/event.py | Python | gpl-3.0 | 3,400 |
class CityModel:
def __init__(self, world):
self.world = world
self.cities = {}
def add_hex_to_city(self, hid, cid):
if self.world.diplomacy.is_neutral(hid):
self.cities[cid] = hid
return True
else:
return False
| connor-cash/nesonomics | NESCore/CityModel.py | Python | gpl-3.0 | 290 |
#!/bin/env python
""" Benchmarking for the index external service running on couchdb """
import os, sys, httplib, urllib, socket
import random
import couchdb.client
from db import couchdb_server, port
import time
rand = random.Random()
def runTime(doi):
db = couchdb_server['documents']
eqnID, searchTerm = rand.... | jamii/texsearch | scripts/times.py | Python | gpl-3.0 | 1,254 |
#! /usr/bin/env python
#
# spigot is a rate limiter for aggregating syndicated content to pump.io
#
# (c) 2011-2015 by Nathan D. Smith <nathan@smithfam.info>
# (c) 2014 Craig Maloney <craig@decafbad.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Pub... | nathans/spigot | spigot.py | Python | gpl-3.0 | 19,916 |
import numpy as np
from pele.potentials import BasePotential
class WhamPotential(BasePotential):
"""
the idea behind this minimization procedure is as follows
from a simulation at temperature T you find the probability of finding energy
E is P(E,T). We know this can be compared to the density o... | marktoakley/LamarckiAnt | SCRIPTS/python/ptmc/histogram_reweighting/wham_potential.py | Python | gpl-3.0 | 3,705 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 t... | TRex22/Sick-Beard | sickbeard/properFinder.py | Python | gpl-3.0 | 10,916 |
import sys
class Node():
def __init__(self, data):
self.data = data
self.left = None
self.right = None
class Tree() :
def __init__(self):
self.root = Node(4)
self.printed_val = - sys.maxint -1
def bst_or_not(self, present_root) :
if present_root :
... | srinivasanmit/all-in-all | amazon/bst_or_not.py | Python | gpl-3.0 | 932 |
#!/usr/bin/python
#
# currentTest.py TEST CURRENT SENSOR
#
import sys
sys.path.append("/home/pi/RWPi/rwpilib")
import myPDALib
import myPyLib
import time
import traceback
import currentsensor
# ### TEST MAIN() ######################
def main():
myPyLib.set_cntl_c_handler() # Set CNTL-C handler
try:
pri... | slowrunner/RWPi | systemtests/currentTest.py | Python | gpl-3.0 | 631 |
import gillard
import test_utils
class GillardTestCase(test_utils.GillardBaseTestCase):
def test_invalid_req(self):
rv = self.app.get('/bad_url_dont_exist')
assert rv.status_code == 404
def test_index_exists(self):
rv = self.app.get('/')
assert rv.status_code == 200
as... | spncrlkt/gillard | gillard/test/gillard_tests.py | Python | gpl-3.0 | 479 |
from datetime import datetime
from pytaku.config import secret
from pytaku.models import User
from itsdangerous import URLSafeSerializer, BadSignature
from google.appengine.api.app_identity import get_application_id
_secret_str = secret[get_application_id()]
_signer = URLSafeSerializer(_secret_str)
_datetimefmt = '%Y-... | hnq90/pytaku | pytaku/api/token.py | Python | gpl-3.0 | 1,297 |
#!/usr/bin/env python3
# Copyright (C) 2017 Dmitry Malko
# This file is part of PeptoVar (Peptides of Variations): the program for personalized and population-wide peptidome generation.
#
# PeptoVar is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | DMalko/PeptoVar | lib/fasta.py | Python | gpl-3.0 | 3,432 |
from copy import copy
from datetime import datetime
from hl7 import client
from hl7.containers import Message
import hl7
from gloss import models, exceptions
from gloss.translators.hl7.segments import MSH, InpatientPID, QueryPD1, MSA
from gloss.translators.hl7.hl7_translator import HL7Translator
from gloss.message_ty... | openhealthcare/gloss | gloss/external_api.py | Python | gpl-3.0 | 4,019 |
__author__ = 'matt'
from glob import glob
import os
import re
class find_coocs:
def __init__(self, orig, term, coocs, win_size, dest):
self.files = glob('{}/*.txt'.format(orig))
self.term = term
self.coocs = set(coocs)
self.win_size = win_size
self.dest = dest
def find(self):
with open(self.dest, mode... | sonofmun/DissProject | Data_Production/find_cooc_places.py | Python | gpl-3.0 | 1,327 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | mcldev/geonode | setup.py | Python | gpl-3.0 | 2,133 |
#!/usr/bin/env python
import pickle, os, sys
from dq2.info.TiersOfATLAS import _refreshToACache, ToACache
from getopt import getopt,GetoptError
_refreshToACache
if __name__ == '__main__':
type = False
protocol = False
try:
opts, args = getopt(sys.argv[1:],':tp', ['type','protocol'])
except ... | ganga-devs/ganga | ganga/GangaAtlas/Lib/Athena/access_info.py | Python | gpl-3.0 | 1,225 |
import pinocchio as se3
robot=robots[4]
se3.computeAllTerms(robot.model,robot.data, robot.q, robot.v)
vardq = 0.0001
varddq = 0.
dq = np.matrix(np.ones(robot.nv)*vardq)
ddq = np.matrix(np.ones(robot.nv)*varddq)
frame_id = IDX_NECK #25
#a
x_dot_dot = robot.frameAcceleration(frame_id)
#b
J = robot.frameJacobian(robot.q... | GaloMALDONADO/motorg | motorog/test.py | Python | gpl-3.0 | 845 |
from distutils.core import setup
setup(
name='Pyspectr',
version='0.1.0',
author='Krzysztof Miernik',
author_email='kamiernik@gmail.com',
packages=['Pyspectr'],
url=['https://github.com/kmiernik/Pyspectr'],
scripts=['bin/py_grow_decay.py',
'bin/spectrum_fitter.py'],
license... | kmiernik/Pyspectr | setup.py | Python | gpl-3.0 | 774 |
import os
import string
import yaml
from collections import Mapping
from pprint import pformat
YamlLoader = yaml.Loader
if 'CLoader' in dir(yaml):
YamlLoader = yaml.CLoader
DEFAULT_CONFIG_SELECTOR = 'USED_CONFIG>'
BASE_CONFIG_SELECTOR = '<BASE'
INCLUDE_FILE_SPECIFIER = '<INCLUDE'
class CircularDependencyError(E... | andras-tim/octoconf | octoconf/octoconf.py | Python | gpl-3.0 | 7,588 |
#!/usr/bin/python
import sys
from merciscript import *
suff=sys.argv[1]
sequences=sys.argv[2]
#custom_motifs = create_pairs(['A', 'C', 'G', 'T'], 2)
runmerci('brightness' + suff + '.fa','darkness' + suff + '.fa')
#motifs1 = parseresult()
motifs1 = parse_output_file("+")
runmerci('darkness' + suff + '.fa','bright... | petkobogdanov/silver-clusters | start/annotate_new.py | Python | gpl-3.0 | 684 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('naf_autoticket', '0050_incidentticketprocess_ticketeffectarea'),
]
operations = [
migrations.AlterField(
model_n... | kevinnguyeneng/django-uwsgi-nginx | app/naf_autoticket/migrations/0051_auto_20170307_1543.py | Python | gpl-3.0 | 468 |
#!/usr/bin/env python
import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-procmail'... | nitmir/django-procmail | setup.py | Python | gpl-3.0 | 1,603 |
from mock import patch
from mock import call
import mock
import kiwi
from .test_helper import raises, patch_open
from kiwi.exceptions import KiwiLiveBootImageError
from kiwi.builder.live import LiveImageBuilder
class TestLiveImageBuilder(object):
@patch('platform.machine')
def setup(self, mock_machine):
... | adrianschroeter/kiwi | test/unit/builder_live_test.py | Python | gpl-3.0 | 12,040 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from configparser import ConfigParser
import sqlite3
from werkzeug.security import generate_password_hash as gen_pass_hash
webtex_path = os.path.dirname(os.path.abspath(__file__))
conf_path = webtex_path + '/WebTeX.ini'
db_path = webtex_path + '/WebTeX.db'
def... | trileg/WebTeX | WebTeX/init.py | Python | gpl-3.0 | 1,059 |
class KBucket:
def __init__(self, k):
self._k = k
self._contacts = {}
def add(self, contact, distance):
if not self._contacts.__contains__(distance):
self._contacts[distance] = []
if(self._contacts[distance].__contains__(contact)):
self._contacts[distanc... | 0xNaN/dak | kbucket.py | Python | gpl-3.0 | 1,352 |
#!/usr/bin/python
from math import pi
from fake_sensor import FakeSensor
import rospy
import tf
from geometry_msgs.msg import Quaternion
from stuff.srv import FakeSensor,FakeSensorResponse
def make_quaternion(angle):
q = tf.transformations.quaternion_from_euler(0, 0, angle)
return Quaternion(*q)
def call... | mkhuthir/catkin_ws | src/stuff/service_sensor.py | Python | gpl-3.0 | 621 |
# -*- coding: utf-8 -*-
def split_frames(frames) -> tuple:
'''Splits zmq ROUTER frames to base and message.'''
base = []
nfn = 0
for frame in frames:
nfn += 1
base.append(frame)
if frame == b'':
break
msg = frames[nfn:]
return base, msg
| waipu/bakawipe | lib/sup/zmq.py | Python | gpl-3.0 | 298 |
#!/usr/bin/env python2.7
import subprocess, socket, sys, select, os, time, binascii, struct, platform, time, logging
from os.path import join as pjoin
from Core.Command import WinRUN
from Core.Color import WinColor, WinStatus
from Core.Start import WinStart
logging.basicConfig(handlers=file, level=logging.DEBUG)
logge... | micle2018/OCCULT | Modules/chat/WinServer.py | Python | gpl-3.0 | 7,221 |
from rest_framework import parsers, renderers
from rest_framework.response import Response
from rest_framework.views import APIView
from django.contrib.auth import authenticate
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from rest_framework import serializers
fr... | yabirgb/OCManager | core/users/authentication.py | Python | gpl-3.0 | 2,507 |
# -*- coding: utf-8 -*-
import daemon
import scrappers
import pymongo
import os
import sys
import datetime
import time
import re
from config import Config
SCRAPPERS = (
('itjobs', scrappers.ITJobs),
)
class JobFeeder(object):
def __init__(self, scrappers):
self.scrappers = scrappers
self.cu... | diogoosorio/werk.io | importer/src/feeder.py | Python | gpl-3.0 | 1,664 |
import sys, xbmcplugin, xbmcaddon, xbmc
from xbmcgui import ListItem
# xbmc hooks
addon = xbmcaddon.Addon(id='plugin.audio.googlemusic.exp')
# plugin constants
plugin = "GoogleMusicEXP-" + addon.getAddonInfo('version')
dbg = addon.getSetting( "debug" ) == "true"
addon_url = sys.argv[0]
handle = int(sys.ar... | mrotschi/googlemusic-xbmc | utils.py | Python | gpl-3.0 | 1,856 |
#!/usr/bin/env python3
#License GPL v3
#Author Horst Knorr <gpgmailencrypt@gmx.de>
import shutil
import subprocess
from .child import _gmechild
from ._dbg import _dbg
from .version import *
S_NOSPAM=0
S_MAYBESPAM=1
S_SPAM=2
#################
#_basespamchecker
#################
class _basespamchecker(_gmec... | gpgmailencrypt/gpgmailencrypt | gmeutils/spamscanners.py | Python | gpl-3.0 | 3,487 |
# -*- coding: utf-8
from .models import Condicionfisicavivienda, Comunidad, Hogar, Parentesco, Persona, Tipolocalidad, Tipovia, Tipovivienda, Vivienda, \
Miembrohogar, Zona, Vocero, Pais, Patologia, Salud, Tipoapoyo, Tipodiscapacidad, Discapacidad
from .forms import PersonaForm, MiembrohogarForm, VoceroForm
from dj... | gvizquel/comunidad | demografia/admin.py | Python | gpl-3.0 | 7,155 |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2009 Doug Hellmann All rights reserved.
#
"""
"""
#end_pymotw_header
import csv
csv.register_dialect('pipes', delimiter='|')
with open('testdata.pipes', 'r') as f:
reader = csv.reader(f, dialect='pipes')
for row in reader:
print row
| qilicun/python | python2/PyMOTW-1.132/PyMOTW/csv/csv_dialect.py | Python | gpl-3.0 | 310 |
# -*- coding: utf-8 -*-
# rdiffweb, A web interface to rdiff-backup repositories
# Copyright (C) 2012-2021 rdiffweb contributors
#
# 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 ... | ikus060/rdiffweb | rdiffweb/core/rdw_templating.py | Python | gpl-3.0 | 8,299 |
import cv2
import numpy as np
import urllib2
import security
from event import Event
from time import time, sleep
class Camera(object):
def __init__(self):
self.FrameCaptured = Event()
self.name = ''
def read(self):
raise NotImplementedError
def save(self, filename):
imag... | shraklor/observations | camera.py | Python | gpl-3.0 | 3,388 |
#!/usr/bin/python3.3 -O
import re
prog = re.compile("^(\d{1,3})[.](\d{1,3})[.](\d{1,3})[.](\d{1,3})/(\d{1,2})$")
def iptobinpad(ip):
return ''.join([bin(int(i))[2:].zfill(8) for i in ip])
def CIDRtoIP(mask):
"""
return the subnet IP extracted from CIDR notation
"""
ip = ("1" * mask).ljust(32, '0'... | Arzaroth/virtualnetwork | network/classes.py | Python | gpl-3.0 | 7,100 |
styles = {
'darkgreen': {
'name': 'darkgreen',
'background': '#000000',
'foreground': '#007700',
'lines': '#001100',
'border': '#001100',
'info': '#007700',
'font': 'DejaVu Sans Mono',
'fontsize': 12,
'padding': 6,
'size': [0.6, 0.95],
... | genewoo/pyroom | styles.py | Python | gpl-3.0 | 2,605 |
import logging
from channels.generic.websocket import AsyncJsonWebsocketConsumer
logger = logging.getLogger('essarch.core.auth.consumers')
class NotificationConsumer(AsyncJsonWebsocketConsumer):
async def connect(self):
user = self.scope["user"]
grp = 'notifications_{}'.format(user.pk)
a... | ESSolutions/ESSArch_Core | ESSArch_Core/auth/consumers.py | Python | gpl-3.0 | 940 |
import subprocess
import select
import time
import sys
"""Provides wrapper functions that run cli commands and wrapper classes to
communicate with them.
Error messages are piped to stderr.
"""
proctal_exe = "./proctal"
class Error(Exception):
pass
class StopError(Error):
"""Raised when the process is not r... | daniel-araujo/proctal | src/cli/tests/util/proctal_cli.py | Python | gpl-3.0 | 16,972 |
# -*- coding: utf-8 -*-
# This file is part of Gtfslib-python.
#
# Gtfslib-python 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... | afimb/gtfslib-python | test/test_all_gtfs.py | Python | gpl-3.0 | 6,602 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'pordb_suchbegriffe.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_Suchbegriffedialog(object):
def setupUi(self, Suchbegriffed... | hwmay/pordb3 | pordb_suchbegriffe.py | Python | gpl-3.0 | 4,105 |
# Bulletproof Arma Launcher
# Copyright (C) 2016 Lukasz Taczuk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# b... | overfl0/Bulletproof-Arma-Launcher | src/sync/torrent_utils.py | Python | gpl-3.0 | 18,951 |