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
class Helpers(object):
@staticmethod
def squareAndMultiply(b, e, n): ##FIXME##
##TODO: Euler's theorem
mask = 2**e.bit_length()
hadFirstOne = False
res = 1
for i in range(e.bit_length(), -1, -1):
if (e & mask) == 0:
if hadFirstOne:
res = (res**2) % n
else:
res = (res**2... | rookies/crypto | QuotientRing.py | Python | gpl-2.0 | 398 |
# Moviemazer XBMC Addon
# written by Tristan Fischer (sphere)
#
# If you have suggestions or problems: write me.
#
# Mail: sphere@dersphere.de
#
# Special Thanks to the website www.moviemaze.de
# Import Python stuff
import urllib
import urllib2
import re
import os
import sys
import time
from shutil import copyfile
#... | dersphere/plugin.video.moviemazer | default.py | Python | gpl-2.0 | 19,585 |
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
from Components.config import config, configfile, getConfigListEntry
from Components.ConfigList import ConfigListScreen
from Components.SystemInfo import SystemInfo
from Components.Sources.StaticText import StaticText
from Components.Pixmap im... | popazerty/beyonwiz-sh4 | lib/python/Screens/UserInterfacePositioner.py | Python | gpl-2.0 | 10,293 |
"""
# TOP2049 Open Source programming suite
#
# Microchip8_18_common - basic file for 8bit PIC18 MCU
#
# Copyright (c) 2013 Pavel Stemberk <stemberk@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
#... | mbuesch/toprammer | libtoprammer/chips/microchip8/microchip8_18_common.py | Python | gpl-2.0 | 13,142 |
# -*- coding: utf-8 -*-
import socket
from string import strip
__author__ = 'Vinícius da Silveira Serafim <vinicius@serafim.eti.br>'
# endereço e porta do servidor para conexão
server_addr = ("127.0.0.1", 9000)
def main():
"""
Função principal.
"""
# (1) Criar socket cliente
client_socket = sock... | vsserafim/aula_sockets_echo | client_01.py | Python | gpl-2.0 | 1,291 |
#!/usr/bin/env python
from lammps import lammps
import os
import argparse
parser = argparse.ArgumentParser(description='Run LAMMPS simulation with an input file')
parser.add_argument('-i', '--input')
parser.add_argument('--resume')
parser.add_argument('--resett', default=False, action='store_true')
parser.add_argumen... | eddiejessup/pizza | scripts/runner.py | Python | gpl-2.0 | 1,614 |
import json
import os
import datetime
for i in range(9):
try:
os.chdir('../call_record/')
with open('callsSortedperson_'+str(i)+'.json','r') as f:
data=json.load(f)
print 'User: ',i
#print len(data)
friends=[]
for j in range(len(data)):
#print data[j][0]
friends.append(data[j][0])
... | shreya2111/Recommender-System | outgoing_call_count.py | Python | gpl-2.0 | 1,175 |
def printPicnic(itemsDict, leftWidth, rightWidth):
print('PICNIC ITEMS'.center(leftWidth + rightWidth, '-'))
for k, v in itemsDict.items():
print(k.ljust(leftWidth, '.') + str(v).rjust(rightWidth))
picnicItems = {'sandwiches': 12, 'apples': 15, 'cookies': 9000, 'cups': 4, 'bananas': 15, 'peaches':... | Bennson/Projects | Automate the boring stuff/Chapter 6/picnicTable.py | Python | gpl-2.0 | 388 |
from django.contrib.auth.models import User
from django.contrib.auth.views import login
from django.http import HttpResponse
import json
def home(request):
return HttpResponse("hello, %s" % str(request.user))
#return login(request) | danithaca/berrypicking | django/mysite-1.6/mysite/views.py | Python | gpl-2.0 | 241 |
from __future__ import absolute_import
from builtins import str
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.Processing import Processing
from processing.core.ProcessingLog import ProcessingLog
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from p... | sourcepole/qgis-wps-client | processingwps/WpsAlgorithm.py | Python | gpl-2.0 | 11,916 |
# expand-parameters-1.py
from wax import *
class MainFrame(VerticalFrame):
def Body(self):
b1 = Button(self, "expands horizontally")
self.AddComponent(b1, expand='h')
b2 = Button(self, "expands vertically")
self.AddComponent(b2, expand='v')
b3 = Button(self, "expands in bot... | MSMBA/msmba-workflow | msmba-workflow/srclib/wax/examples/expand-parameters-1.py | Python | gpl-2.0 | 536 |
#!/usr/bin/env python3
"""
* Copyright (c) 2015 BEEVC - Electronic Systems This file is part of BEESOFT
* 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... | beeverycreative/beeconnect | WaitForConnection.py | Python | gpl-2.0 | 8,838 |
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | sloanyang/aquantic | Tools/Scripts/webkitpy/port/mac_unittest.py | Python | gpl-2.0 | 12,566 |
# encoding: utf-8
# module _codecs_tw
# from /usr/lib/python2.7/lib-dynload/_codecs_tw.x86_64-linux-gnu.so
# by generator 1.135
# no doc
# no imports
# functions
def getcodec(*args, **kwargs): # real signature unknown
""" """
pass
# no classes
# variables with complex values
__map_big5 = None # (!) real va... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/_codecs_tw.py | Python | gpl-2.0 | 377 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# =============================================================================
# PAQUETE: instalador
# ARCHIVO: instalador/config.py
# COPYRIGHT:
# (C) 2012 William Abrahan Cabrera Reyes <william@linux.es>
# (C) 2012 Erick Manuel Birbe Salazar <erickcion@gmai... | willicab/instalador | instalador/clases/particiones.py | Python | gpl-2.0 | 15,469 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# general_hosts.py
#
# Copyright 2016-2020 fritzctl 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 2 of t... | not-na/fritzctl | fritzctl/ooapi/general_hosts.py | Python | gpl-2.0 | 9,883 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#Copyright (C) 2006 Inmaculada Luengo Merino, Néstor Arocha Rodríguez
#This file is part of pyrqt.
#
#pyrqt 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 ver... | nesaro/driza | pyrqt/carga/operaciones/compmedsim.py | Python | gpl-2.0 | 3,492 |
# -*- coding: utf-8 -*-
# This code is part of Amoco
# Copyright (C) 2015 Axel Tillequin (bdcht3@gmail.com)
# published under GPLv2 license
"""
cas/smt.py
==========
The smt module defines the amoco interface to the SMT solver.
Currently, only z3 is supported. This module allows to translate
any amoco expression int... | LRGH/amoco | amoco/cas/smt.py | Python | gpl-2.0 | 9,247 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | 3dfxsoftware/cbss-addons | account_partner_ledger_report/__openerp__.py | Python | gpl-2.0 | 1,670 |
# Copyright (c) 2009 Bea Lam. All rights reserved.
#
# This file is part of LightBlue.
#
# LightBlue 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 l... | karulis/pybluez | osx/_bluetoothsockets.py | Python | gpl-2.0 | 35,262 |
#
# vmnetx.controller.remote - Remote execution of a VM
#
# Copyright (C) 2008-2015 Carnegie Mellon University
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License as published
# by the Free Software Foundation. A copy of the GNU G... | cmusatyalab/vmnetx | vmnetx/controller/remote.py | Python | gpl-2.0 | 12,065 |
class DateNotFoundError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value) | macky360/Bitcoin-Related_Addresses | lib/marketquery/exceptions.py | Python | gpl-2.0 | 148 |
# coding=utf-8
"""Online Scout Manager Interface.
Usage:
check.py [-d] <apiid> <token>
check.py (-h | --help)
check.py --version
Options:
-d,--debug Turn on debug output.
-h,--help Show this screen.
--version Show version.
"""
import logging
from docopt import docopt
import osm
from grou... | hippysurfer/scout-records | check.py | Python | gpl-2.0 | 1,171 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2009 Gary Burton
# Copyright (C) 2009 Benny Malengier
# Copyright (C) 2010 Nick Hall
# Copyright (C) 2011 Tim G L Lyons
#
# This program is free software; you can redistribute it an... | dermoth/gramps | gramps/gui/editors/editnote.py | Python | gpl-2.0 | 15,225 |
'''Ensure that pylint finds the exported methods from flask.ext.'''
from flask.ext.wtf import Form
MYFORM = Form
| jschaf/pylint-flask | test/input/func_noerror_flask_ext_long.py | Python | gpl-2.0 | 115 |
import copy
description = "test sort"
arr = [ 10, 3, 44, 15, 40 , -10, -1000, 0, 0, 3000]
arr2 = [ -10.2, 4.33, 1.999, -399.22, -10000.1001, 10.9, 3.922, 59.01, -33.11, 0.3, 0.2, 0.1, 0.001, -0.001, -0.2, -0.4, -0.3, -0.222 ]
arr3 = [ { "key" : k } for k in arr2 ]
filedata = """{$
locals { v : %(arr)s, v2 : []... | airfrog/okws | test/regtest/cases/85.py | Python | gpl-2.0 | 1,198 |
# -*- coding: utf-8 -*-
"""
UV Light 2.0 Plugin
Copyright (C) 2018 Ishraq Ibne Ashraf <ishraq@tinkerforge.com>
__init__.py: Package initialization
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; eit... | Tinkerforge/brickv | src/brickv/plugin_system/plugins/uv_light_v2/__init__.py | Python | gpl-2.0 | 931 |
#!/usr/bin/env python
# Python Qt4 bindings for GUI objects
from PyQt4 import QtGui
# import the Qt4Agg FigureCanvas object, that binds Figure to
# Qt4Agg backend. It also inherits from QWidget
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
# Matplotlib Figure object
from matplotlib... | ArchaeoPY/ArchaeoPY | GUI_Templates/mplwidget.py | Python | gpl-2.0 | 1,485 |
# application to do huffman coding and decoding.
import sys
from collections import Counter
import math
# for assisting in sort operations
def key01(item):
return item[1]
def readFiles(flist):
pString=[]
for file01 in flist: # loop through files and process
pString=pString+open(file01,'r').read().split()
... | mphemanth/cusat | irws/huffman.py | Python | gpl-2.0 | 1,011 |
#!/bin/env dls-python2.6
'''Channel Access Example'''
from __future__ import print_function
# load correct version of catools
import require
from cothread.catools import *
print(caget('SR21C-DI-DCCT-01:SIGNAL'))
| epicsdeb/cothread | examples/simple.py | Python | gpl-2.0 | 216 |
#!/usr/bin/env python
import sys
import os
import glob
#######################################################
candidate_xsldirs = (
# Fedora
'/usr/share/sgml/docbook/xsl-stylesheets',
# Cygwin
'/usr/share/docbook-xsl',
# Debian
'/usr/share/xml/docbook/stylesheet/nwalsh',
# SUSE
'/usr/... | bdmod/extreme-subversion | BinarySourcce/subversion-1.6.17/doc/tools/bin/find-xsl.py | Python | gpl-2.0 | 1,191 |
#
# A tool for converting Pronto format hex codes to lircd.conf format
#
# Copyright by Olavi Akerman <olavi.akerman@gmail.com>
#
# pronto2lirc 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 ... | PPCDroid/external-lirc | tools/pronto2lirc.py | Python | gpl-2.0 | 4,612 |
class ZXSpectrumMameDriver:
pass
| FrodeSolheim/fs-uae-launcher | fsgamesys/platforms/zxspectrum/zxspectrummamedriver.py | Python | gpl-2.0 | 37 |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 13 09:11:25 2015
@author: paulinkenbrandt
"""
import py_compile
py_compile.compile("C:\\Users\\PAULINKENBRANDT\\Documents\\GitHub\\Snake_Valley\\snake.py") | inkenbrandt/Snake_Valley | untitled1.py | Python | gpl-2.0 | 205 |
#! usr/bin/env python2
from PySide import QtGui, QtCore
from PySide.QtCore import Qt
from settings import Icon
class Node(object):
Command, Form, Separator = 'command', 'form', 'separator'
@classmethod
def from_type(cls, type_, **kw):
cls = Command if kw['type'] == cls.Command ... | arubertoson/piemenu | piemenu/menusystem/node.py | Python | gpl-2.0 | 4,177 |
#!/usr/env python
# -*- coding: utf-8 -*-
__author__ = 'eduardo'
import unittest
import uuid
from . import config
from ..model import cs
from cassandra.cluster import Session
class TestCassandra(unittest.TestCase):
"""
Test interação com o banco de dados Cassandra
"""
def setUp(self):
"""
... | eduardosan/csindex | csindex/tests/test_cassandra.py | Python | gpl-2.0 | 2,692 |
import pf
from Var import var
import numpy,string
from Glitch import Glitch
"""A faster version of nextTok(), using memory allocated (once only)
using numpy, and using functions written in C. The slow, pure
python module is NexusToken.py. This version is about twice as fast.
Which one is used is under the control o... | Linhua-Sun/p4-phylogenetics | p4/NexusToken2.py | Python | gpl-2.0 | 5,196 |
# encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib/python3/dist-packages/PyQt4/QtGui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
from .QValidator import QValidator
class QIntValidator(QValidator):
"""
QIntValidator(QObject parent=None)
... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyQt4/QtGui/QIntValidator.py | Python | gpl-2.0 | 1,504 |
"""
Django settings for MimirInterface project.
Generated by 'django-admin startproject' using Django 1.8.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Bui... | Trigition/Mimir | MimirInterface/MimirInterface/settings.py | Python | gpl-2.0 | 2,662 |
# vim: set fileencoding=utf-8 sw=4 ts=4 et :
# pylint: disable-msg=C0111,W0212,R0904
# Copyright (C) 2011-2020 CS GROUP - France
# License: GNU GPL v2 <http://www.gnu.org/licenses/gpl-2.0.html>
from __future__ import absolute_import
from .test_xsdutil import XSDTest
class HosttemplateXSD(XSDTest):
"""
Test du... | vigilo/vigiconf | src/vigilo/vigiconf/test/test_xsd_hosttemplate.py | Python | gpl-2.0 | 732 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2010 Rafal Wojtczuk <rafal@invisiblethingslab.com>
# Copyright (C) 2013 Marek Marczykowski <marmarek@invisiblethingslab.com>
#
# This program is free software; you can redistribute it and/or
# modify it und... | Zrubi/qubes-core-admin | qmemman/qmemman.py | Python | gpl-2.0 | 12,060 |
from enigma import eServiceCenter, eServiceReference, eTimer, pNavigation, getBestPlayableServiceReference, iPlayableService, eActionMap, setPreferredTuner, eStreamServer
from Components.ParentalControl import parentalControl
from Components.SystemInfo import SystemInfo
from Components.config import config, configfile
... | kajgan/stbgui | Navigation.py | Python | gpl-2.0 | 12,831 |
# -*- coding: utf-8 -*-
#
# Copyright 2021 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at y... | unioslo/cerebrum | Cerebrum/modules/hr_import/errors.py | Python | gpl-2.0 | 948 |
import subprocess
import os
# setup the path to extopenscad (aka implicitCAD)
cad_bin=os.path.expanduser('~/.cabal/bin/extopenscad')
# set the current input dir to this script file's dir
inp_dir = '.'
# set the output to a directory next to this script file
out_dir = './output'
# set the output file extension to .stl
... | nmz787/microfluidic-cad | implicitCAD/process_all_escad.py | Python | gpl-2.0 | 1,723 |
from django.contrib import admin
from edc_base.modeladmin.mixins import (ModelAdminChangelistModelButtonMixin, ModelAdminRedirectMixin,
ModelAdminFormInstructionsMixin, ModelAdminFormAutoNumberMixin,
ModelAdminAuditFieldsMixin)
from simple... | TshepangRas/tshilo-dikotla | td_maternal/admin/potential_call_admin.py | Python | gpl-2.0 | 2,019 |
from pyIST import *
##############
terra_dir = '/Users/tohodson/Desktop/modis_download/MOST/MOD29E1D.005/'
aqua_dir = '/Users/tohodson/Desktop/modis_download/MOSA/MYD29E1D.005/'
hdf_file = '/Users/tohodson/Desktop/AQ_IST.hdf5'
DATAFIELD_NAME='Ice_Surface_Temperature_SP'
aqua_count = count_files(aqua_dir,'*.hdf')
te... | tohodson/modis-hdf5 | code/compile_hdf.py | Python | gpl-2.0 | 1,818 |
""" A class for training our perceptrons """
class Trainers:
""" Constructor """
def __init__(self, data, r=1):
self.data_vectors = data # training dataset
self.r = r
self.wrong_classified_vectors = ["dummy"]
def gradientDescent(self, perceptron):
print "Begin training..."
last = len(self.data_vectors[0])... | elpaxoudis/pattern-recognition | trainers.py | Python | gpl-2.0 | 1,725 |
# -*- coding: utf-8 -*-
import json
import urllib2
def get_authkey(zabbix_server, zabbix_user, zabbix_pass, head):
url = "http://" + zabbix_server + "/zabbix/api_jsonrpc.php"
pdata = json.dumps({"jsonrpc" : "2.0",
"method" : "user.login",
"params" : {
... | Shadow5523/zabbix_api | lib/auth.py | Python | gpl-2.0 | 669 |
from __future__ import division
from operator import add, mul
import cProfile
def memo(f):
cache = {}
def _f(*args):
try:
return cache[args]
except KeyError:
result = cache[args] = f(*args)
return result
except TypeError:
return f(*args)
... | m00nlight/hackerrank | algorithm/Number-Theory/nCr/main.py | Python | gpl-2.0 | 7,426 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-06-13 07:46
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... | gogobody/lifebone | usercenter/migrations/0001_initial.py | Python | gpl-2.0 | 1,747 |
#!/usr/bin/env python
"""Test form submission"""
__email__ = "nicolas.maire@unibas.ch"
__status__ = "Alpha"
from lxml import etree
import urllib2
import uuid
import logging
DEVICE_ID = "8d:77:12:5b:c1:3c"
def submit_data(data, url):
"""Submit an instance to ODKAggregate"""
r = urllib2.Request(url, data=da... | SwissTPH/openhds-sim | submission.py | Python | gpl-2.0 | 13,836 |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2019 EventGhost Project <http://www.eventghost.org/>
#
# 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 versi... | topic2k/EventGhost | eg/PythonPaths.py | Python | gpl-2.0 | 1,915 |
'''
Author: Julian van Eyken Date: Jul 9 2013
Test code for per-pixel effective exposure time weighting.
'''
import os.path
import photonlist.photlist as pl
import photonlist.RADecImage as rdi
from util.FileName import FileName
def getSimpleImage(fileName=FileName(run='PAL2012',date='20121211',tstamp='20121212... | bmazin/ARCONS-pipeline | photonlist/test/testExpTimeWeight.py | Python | gpl-2.0 | 1,192 |
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
"""Generate python dictionaries catalog from textual translation description.
This program converts a textual Uniforum-style message catalog (.po file) into
a python dictionary
Based on msgfmt.py by Martin v. Löwis <loewis@informatik.hu-berlin.de>
"""
import sys... | robmcmullen/peppy | i18n.in/make-podict.py | Python | gpl-2.0 | 13,109 |
from copy import deepcopy
import os
import ntpath
import daemon
from server import Accessor
from exceptions import ServoMissingFieldsException
class BaseServo(object):
'''
base object for a servo
constructed with a dictionary
'''
def __init__(self, data={}):
# Save off config data
... | arecker/msg | msg/servos.py | Python | gpl-2.0 | 8,000 |
import requests
from tel_types import User, Message, Update, UserProfilePhotos
import time
base_url = 'https://api.telegram.org/bot'
class Telegram:
def __init__(self, token):
self.call_url = base_url + token + '/'
self.token = token
self.req_timeout = 5
self.text_limit = 4096
self.last_error = ''
self.... | srijanrodo/telegram-bots-python-api | telegram.py | Python | gpl-2.0 | 8,175 |
import sys
import os.path
import platform
iRosetta_path = sys.argv[1]
icons = [("cfg", "Rosetta Configuration File"),
("cst", "Constraints File"),
("ensb", "Ensemble Archive"),
("fasta", "FASTA Sequence"),
("gz", "Compressed GZ Archive"),
("irm", "InteractiveROSETTA Module"... | schenc3/InteractiveROSETTA | InteractiveROSETTA/extensions.py | Python | gpl-2.0 | 5,948 |
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | michel-slm/bodhi | bodhi/services/comments.py | Python | gpl-2.0 | 6,317 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4
from django.conf import settings
import json
import sys
import csv
from datetime import datetime, date, time
from bson.code import Code
from bson.objectid import ObjectId
from bson.errors import InvalidId
from bson import json_util
from pymongo... | videntity/django-djmongo | djmongo/mongoutils.py | Python | gpl-2.0 | 17,724 |
# #
# Copyright 2013-2016 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 (... | hpcleuven/easybuild-framework | easybuild/framework/easyconfig/format/version.py | Python | gpl-2.0 | 30,531 |
#!/usr/bin/env python3.5
# -*- coding: utf-8 -*-
# Author: ChenLiang
# 执行系统命令
import os
os.system("ls -al")
os.mkdir("pwd")
read = os.popen("df -hT").read()
# 查看系统路径
import sys
print(sys.path)
# 命令行下tab补全命令
# For MAC:
import sys
import readline
import rlcompleter
if sys.platform == 'darwin' and sys.version_info[0... | smartczm/python-learn | Old-day01-10/s13-day1/system.py | Python | gpl-2.0 | 1,313 |
# -*- coding: utf-8 -*-
"""
cartogram_geopandas v0.0.0c:
Easy construction of continuous cartogram on a Polygon/MultiPolygon
GeoDataFrame (modify the geometry in place or create a new GeoDataFrame).
Code adapted to fit the geopandas.GeoDataFrame datastructure from
Carson Farmer's code (https://github... | mthh/cartogram_geopandas | cartogram_geopandas.py | Python | gpl-2.0 | 1,738 |
#! /usr/bin/env python
SRCDIR = "src"
SRCFILES = map(lambda f: SRCDIR + '/' + f + '.c',
["cdbmodule","cdb","cdb_make","cdb_hash",
"uint32_pack","uint32_unpack"])
from distutils.core import setup, Extension
setup (# Distribution meta-data
name = "python-cdb",
version = "... | pombredanne/python-cdb | setup.py | Python | gpl-2.0 | 1,203 |
import os, sys
import myfun
import numpy as np
import matplotlib as mpl
mpl.use('ps')
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy import interpolate
import lagrangian_stats
import scipy.fftpack
## READ archive (too many points... somehow)
# args: name, dayi, dayf, days
#label ... | jungla/ICOM-fluidity-toolbox | Detectors/offline_advection/plot_Tracer_spec.py | Python | gpl-2.0 | 3,374 |
#!/usr/bin/python2
#:indentSize=4:tabSize=4:noTabs=true:wrap=soft:
import numpy as np
import re
def simple_transfer(xin, x):
return (xin/abs(xin)) if xin else x
class BAM:
def __init__(self, s_mat_list, t_mat_list): #s_mat_list, t_mat_list = list of np.matrix
self.transfer = np.vectorize(simple_trans... | anirudhr/neural | bam_bias.py | Python | gpl-2.0 | 4,551 |
#-*- coding:utf-8 -*-
from django.db import models
# Create your models here.
class Candidate(models.Model):
name = models.CharField(max_length=250, verbose_name="Nombre de candidato")
votes = models.IntegerField(verbose_name="Cantidad de votos")
def __unicode__(self):
return self.name + str(self.votes)
| neosergio/hackatonqr | vote/models.py | Python | gpl-2.0 | 312 |
# F3AT - Flumotion Asynchronous Autonomous Agent Toolkit
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
# 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... | f3at/feat | src/feat/test/test_agents_monitor_intensive_care.py | Python | gpl-2.0 | 12,741 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2017 CERN.
#
# Zenodo 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 v... | slint/zenodo | zenodo/modules/support/config.py | Python | gpl-2.0 | 8,030 |
# -*- 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 'Difficulty'
db.create_table(u'achievement_difficulty', (
... | hkpeprah/git-achievements | app/achievement/migrations/0001_initial.py | Python | gpl-2.0 | 27,950 |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 20:18:08 2012
@author:
Sebastien Gros
Assistant Professor
Department of Signals and Systems
Chalmers University of Technology
SE-412 96 Göteborg, SWEDEN
grosse@chalmers.se
Python/casADi Module:
NMPC for Dynamic Optimal Power Flow and Power Dispatch
Requires the in... | sebchalmers/DynOPFlow | DynOPFlow.py | Python | gpl-2.0 | 55,808 |
# -*- coding:utf-8 -*-
# Cyril Fournier
# 19/01/2016
import random
import threading
import Queue
import time
import UtilsAndGlobal as UAG
# ==============================
# === Class Ghost ===
# ==============================
class Ghost():
"""
Object representing a ghost.
"""
def __init__(self, ID, sta... | Jidgdoi/PacmanPy | src/GhostAI.py | Python | gpl-2.0 | 5,502 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, print_function
VERSION = (1, 0, 8, 'final')
__version__ = VERSION
def get_version():
version = '{}.{}'.format(VERSION[0], VERSION[1])
if VERSION[2]:
version = '{}.{}'.format(version, VERSION[2])
if VERSION[3:] == ('... | quiqueporta/django-admin-dialog | django_admin_dialog/__init__.py | Python | gpl-2.0 | 502 |
# -*- coding: utf-8 -*-
from collections import defaultdict
from itertools import chain
from functools import wraps
from operator import itemgetter
from multiprocessing import (
current_process,
SimpleQueue,
Process,
)
from time import sleep
import logging
import sys
import traceback
from retrying import ... | ATRAN2/Futami | futami/ami.py | Python | gpl-2.0 | 7,977 |
from Products.Five.browser import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from plone.app.layout.viewlets.common import ViewletBase
from Products.CMFCore.utils import getToolByName
from AccessControl import getSecurityManager
from zope.component import getMultiAdapter
from zop... | uwosh/uwosh.initiatives | uwosh/initiatives/browser/initiatives.py | Python | gpl-2.0 | 1,839 |
import logging
import os
from autotest.client.shared import error, utils
from virttest import data_dir, utils_test
def umount_fs(mountpoint):
if os.path.ismount(mountpoint):
result = utils.run("umount -l %s" % mountpoint, ignore_status=True)
if result.exit_status:
logging.debug("Umount... | kylazhang/virt-test | libguestfs/tests/guestmount.py | Python | gpl-2.0 | 2,277 |
#!/usr/bin/python
import unittest
import mock
import os
class UdevTest(unittest.TestCase):
def setUp(self):
import blivet.udev
blivet.udev.os = mock.Mock()
blivet.udev.log = mock.Mock()
def test_udev_enumerate_devices(self):
import blivet.udev
ENUMERATE_LIST = [
... | pombredanne/blivet-1 | tests/udev_test.py | Python | gpl-2.0 | 5,747 |
#
#
# Copyright (C) 2007, 2011, 2012, 2013 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This progr... | badp/ganeti | qa/qa_instance.py | Python | gpl-2.0 | 44,869 |
#!/usr/bin/python
import requests
import time
s = requests.session()
login_data = {
'LDAPlogin':'xblask00',
'LDAPpasswd':'CHANGEME',
'special_p4_form': '1',
'login_form': '1',
'sentTime': str(int(time.time())),
'sv[fdkey]'... | blaskovic/utilities | vutbr-portal/news.py | Python | gpl-2.0 | 515 |
# demandimport.py - global demand-loading of modules for Mercurial
#
# Copyright 2006, 2007 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
'''
demandimport - automatic demandloading of modules
To e... | seewindcn/tortoisehg | src/mercurial/demandimport.py | Python | gpl-2.0 | 9,674 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
HubDistanceLines.py
---------------------
Date : May 2010
Copyright : (C) 2010 by Michael Minn
Email : pyqgis at michaelminn dot com
********************... | t-hey/QGIS-Original | python/plugins/processing/algs/qgis/HubDistanceLines.py | Python | gpl-2.0 | 6,322 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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 t... | unioslo/cerebrum | Cerebrum/modules/tsd/ResourceService.py | Python | gpl-2.0 | 5,210 |
#!/usr/bin/env python
import sys
import re
import getopt
from typing import List, Tuple
from feed_maker_util import IO
def main() -> int:
link: str = ""
title: str = ""
url_prefix = ""
state = 0
num_of_recent_feeds = 1000
optlist, _ = getopt.getopt(sys.argv[1:], "f:n:")
for o, a in optl... | terzeron/FeedMakerApplications | funbe/capture_item_funbe.py | Python | gpl-2.0 | 1,590 |
"""
Definition of the Prompt class, designed for editing Configuration
with a terminal prompt.
"""
from functools import partial
from prompt_toolkit import prompt
from prompt_toolkit.contrib.regular_languages.compiler import compile as pt_compile
from prompt_toolkit.contrib.completers import Word... | Aluriak/neural_world | neural_world/prompt.py | Python | gpl-2.0 | 4,845 |
#####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire #
# Copyright (C) 2006 Sami Kyöstilä ... | west2554/fofix | src/SongChoosingScene.py | Python | gpl-2.0 | 43,169 |
#!/usr/bin/env python
"""Handle records from /proc/net/sockstat data files"""
import regentest as RG
import ProcHandlers as PH
PFC = PH.ProcFieldConstants
USED = 'used'
INUSE = 'inuse'
ORPH = 'orphan'
TW = 'tw'
ALLOC = 'alloc'
MEM = 'mem'
MEMORY = 'memory'
# ---
# pylint: disable=R0914
def re_net_sockstat(inprec... | cnamejj/PyProc | regentest/net_sockstat.py | Python | gpl-2.0 | 1,758 |
import pybedtools
a = pybedtools.example_bedtool('a.bed')
b = pybedtools.example_bedtool('b.bed')
print "cat a.bed\n" + str(a)
print "cat b.bed\n" + str(b)
print a.intersect(b)
| khalidm/VarPub | src/mytest.py | Python | gpl-2.0 | 181 |
# -*-python-*-
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# 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) ... | bradallred/gemrb | gemrb/GUIScripts/iwd2/Options.py | Python | gpl-2.0 | 2,412 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('kappahistory', '0007_auto_20150303_2154'),
]
operations = [
migrations.AddField(
model_name='drive',
... | kappapolls/kappapolls | kappahistory/migrations/0008_auto_20150303_2155.py | Python | gpl-2.0 | 649 |
"""Common settings and globals."""
from os.path import abspath, basename, dirname, join, normpath
from sys import path
########## PATH CONFIGURATION
# Absolute filesystem path to the Django project directory:
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# Absolute filesystem path to the top-level project fold... | xu2243051/idc_assets_management | idc_assets_management/idc_assets_management/settings/base.py | Python | gpl-2.0 | 7,281 |
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your ... | kaplun/ops | modules/bibedit/lib/bibedit_engine.py | Python | gpl-2.0 | 83,631 |
#!/usr/bin/python3
from PyQt5.QtCore import QDate, QTime, QDateTime, Qt
now = QDate.currentDate()
print(now.toString(Qt.ISODate))
print(now.toString(Qt.DefaultLocaleLongDate))
datetime = QDateTime.currentDateTime()
print(datetime.toString())
time = QTime.currentTime()
print(time.toString(Qt.DefaultLocaleLongDate... | psas/liquid-engine-test-stand | TSAR/FrontEndSource/LearningPyQT/DateandTime.py | Python | gpl-2.0 | 555 |
#!/usr/bin/env python
from mongo_vars import MongoVars
from mongo_error import MongoError
class MongoDb(MongoVars):
"""
The db you want to use should inherit from this class
"""
def __init__(self):
"""
Init object
"""
raise MongoError("__init__ not yet implemented")
... | wideioltd/mongoapi2sql | mongoapi2sql/mongo_db.py | Python | gpl-2.0 | 3,344 |
## BTisWatchingU ##
#
# This program scans for bluetooth devices and add their address and name to a
# centralized database. This database have some simple facilities to determine
# where and when the device have been spotted.
# Copyright (C) 2008,2009 Philippe Chretien
#
# This program is free software; you can redi... | pchretien/btiswatchingu | python/bt_device.py | Python | gpl-2.0 | 1,349 |
# -*- 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 2 of the License, or
# (at your option) any later version.
from tests import TestCase, skipUnless
from tes... | elbeardmorez/quodlibet | quodlibet/tests/test_po.py | Python | gpl-2.0 | 11,377 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# logout - force-expire active login session
# Copyright (C) 2003-2014 The MiG Project lead by Brian Vinter
#
# This file is part of MiG.
#
# MiG is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public L... | heromod/migrid | mig/cgi-bin/logout.py | Python | gpl-2.0 | 1,078 |
#!/usr/bin/env python
#
# $File: IfElseFixed.py $
#
# This file is part of simuPOP, a forward-time population genetics
# simulation environment. Please visit http://simupop.sourceforge.net
# for details.
#
# Copyright (C) 2004 - 2010 Bo Peng (bpeng@mdanderson.org)
#
# This program is free software: you can redistribut... | BoPeng/simuPOP | docs/IfElseFixed.py | Python | gpl-2.0 | 1,537 |
# -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2008, 2010, 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 (a... | fjorba/invenio | modules/websearch/lib/search_engine_query_parser.py | Python | gpl-2.0 | 54,879 |
from swpy.dscovr.clients import DscovrClient, DscovrRTClient
from swpy.dscovr.graph import DscovrGraph | jongyeob/swpy | swpy/dscovr/__init__.py | Python | gpl-2.0 | 102 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2001 David R. Hampton
# Copyright (C) 2001-2006 Donald N. Allingham
# Copyright (C) 2007 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of ... | pmghalvorsen/gramps_branch | gramps/gen/plug/report/_reportbase.py | Python | gpl-2.0 | 2,801 |
import chimera
import XlaGuiTests
import xlinkanalyzer as xla
# for this test to run do:
# chimera --pypath ~/devel/XlinkAnalyzer --pypath ~/devel/pyxlinks/ run.py <name of this file>
RUNME = True
description = "Tests gui class"
class TestPolI(XlaGuiTests.XlaBaseTest):
def setUp(self):
mPaths = ['Pol... | crosslinks/XlinkAnalyzer | pytests/pyt_TestOldFormatPolI.py | Python | gpl-2.0 | 1,687 |