code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
#Section 1: Terminology
# 1) What is a recursive function?
# A recursive function is a function that calls itself.
#
#
# 2) What happens if there is no base case defined in a recursive function?
# The program would keep recursing itself.
#
#
# 3) What is the first thing to consider when designing a recursive function?... | tonsom1592-cmis/tonsom1592-cmis-cs2 | cs3quiz.py | Python | cc0-1.0 | 1,537 |
"""Builder for websites."""
import string
from regolith.dates import date_to_float
doc_date_key = lambda x: date_to_float(
x.get("year", 1970), x.get("month", "jan")
)
ene_date_key = lambda x: date_to_float(
x.get("end_year", 4242), x.get("end_month", "dec")
)
category_val = lambda x: x.get("category", "<unca... | scopatz/regolith | regolith/sorters.py | Python | cc0-1.0 | 2,389 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'BIOMD0000000102.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/BIOMD0000000102 | BIOMD0000000102/model.py | Python | cc0-1.0 | 427 |
#!/usr/bin/env python
import threading
import spam
def grab_cores(threads=1, count=int(1e9)):
_threads = []
for i in range(threads):
thread = threading.Thread(target=spam.busy, args=(count,))
_threads.append(thread)
thread.start()
for thread in _threads:
thread.join()
i... | wking/cpython-extension | grab-cores.py | Python | cc0-1.0 | 403 |
# Note - to use this script you need Jeff Garzik's python-bitcoinrpc
# https://github.com/jgarzik/python-bitcoinrpc
import os
import sys;
import json;
from bitcoinrpc.authproxy import AuthServiceProxy;
# SET THESE VALUES
rpc_user = "bitcoinrpc";
rpc_pass = "A7Xr149i7F6GxkhDbxWDTbmXooz1UZGhhyUYvaajA13Z";
rpc_host = "... | apoelstra/coinjoin | generate-tx.py | Python | cc0-1.0 | 3,413 |
"""Assign Params to Attributes by Joel Hedlund <joel.hedlund at gmail.com>.
PyDev script for generating python code that assigns method parameter
values to attributes of self with the same name. Activates with 'a' by
default. Edit global constants ACTIVATION_STRING and WAIT_FOR_ENTER if this
does not suit your needs... | smkr/pyclipse | plugins/org.python.pydev.jython/jysrc/pyedit_assign_params_to_attributes.py | Python | epl-1.0 | 3,468 |
# coding: iso-8859-1 -*-
"""
Created on Wed Oct 22 21:49:24 2014
@author: fábioandrews
"""
import facebook
from DadosDeAmigoEmComum import DadosDeAmigoEmComum
class AfinidadeLikesEscolaELocalidades:
def __init__(self,ACCESS_TOKEN_FACEBOOK):
self.token_do_facebook = ACCESS_TOKEN_FACEBOOK
self.meus... | Topicos-3-2014/friendlyadvice | AfinidadeLikesEscolaELocalidades.py | Python | epl-1.0 | 12,463 |
# Copyright 2005-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import logging
import subprocess
import portage
from portage import os
from portage.util import writemsg_level
from portage.output import create_color_func
good = create_color_func("GOOD")
bad = create_color_fun... | gmt/portage | pym/portage/sync/modules/git/git.py | Python | gpl-2.0 | 3,109 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
#
# Copyright (c) 2008-2014 University of Dundee.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or... | simleo/openmicroscopy | components/tools/OmeroWeb/omeroweb/webadmin/views.py | Python | gpl-2.0 | 43,638 |
"""
Author: Seyed Hamidreza Mohammadi
This file is part of the shamidreza/uniselection software.
Please refer to the LICENSE provided alongside the software (which is GPL v2,
http://www.gnu.org/licenses/gpl-2.0.html).
This file includes the code for putting all the pieces together.
"""
from utils import *
from extra... | shamidreza/unitselection | experiment.py | Python | gpl-2.0 | 3,464 |
#!/adsc/DDEA_PROTO/bin/python
from df_data_analysis_ddea import ddea_analysis
from datetime import datetime
import traceback
import sys
if __name__ == '__main__':
try:
if 3 <= len(sys.argv):
###urls = open(sys.argv[1]).readlines()
start_time = sys.argv[1]
end_time = ... | TinyOS-Camp/DDEA-DEV | Archive/[14_10_11] Dr_Jung_Update/ddea_cli.py | Python | gpl-2.0 | 688 |
ES_INDEX_NAME = "brainiak"
ES_TYPE_NAME = "query"
| bmentges/brainiak_api | src/brainiak/stored_query/__init__.py | Python | gpl-2.0 | 50 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
MENU_FILE = "File"
FILE_NEW = "New"
FILE_OPEN = "Open"
FILE_EXIT = "Exit"
TAB_DATA = "Data"
TAB_SQL = "SQL"
BUTTON_EXIT = "Exit"
| Smaed/pyDbManager | lib/Lang.py | Python | gpl-2.0 | 228 |
# Symantec BackupExec
# CVE-2007-6016,CVE-2007-6017
import logging
log = logging.getLogger("Thug")
def Set_DOWText0(self, val):
self.__dict__['_DOWText0'] = val
if len(val) > 255:
log.ThugLogging.log_exploit_event(self._window.url,
"Symantec BackupExec Acti... | fedelemantuano/thug | thug/ActiveX/modules/SymantecBackupExec.py | Python | gpl-2.0 | 2,143 |
# -*- coding: utf-8 -*-
'''
Created on Nov 14, 2014
Implementation of a hand speed-based segmentation module
@author: Arturo Curiel
'''
import zope.interface as zi
try:
import magic
except:
import nixtla.core.tools.magic_win as magic
from nixtla.core.base_module import BaseModule
from nixtla.segmentation.i... | acuriel/Nixtla | nixtla/segmentation/handspeed_based/implementation.py | Python | gpl-2.0 | 3,204 |
# 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... | Hao-Liu/avocado | avocado/core/restclient/cli/app.py | Python | gpl-2.0 | 4,537 |
# -*- coding: utf-8 -*-
from gi.overrides.keysyms import musicalflat
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
from PIL import Image
from pygame.mixer import music
class BancoReserva:
def __init__(self):
self.textura1 = glGenTextures(1)
self.obj = GLuint()
def... | diogenesfilho/Estadio | Estádio/projeto_orientado/app/Complex.py | Python | gpl-2.0 | 45,005 |
#!/usr/bin/env python
import os,sys
import glob
def mysystem(s):
print(s)
retval = os.system(s)
return retval
def main():
alphas = range(-8,9)
orders = [1]
machs = [0.55,0.65,0.75,0.85,0.95,1.05]
#now, we need to recursively move everybody back
for order in orders:
for mach in machs:
... | vincentbetro/NACA-SIM | imagescripts/plotfixEND1.py | Python | gpl-2.0 | 873 |
# -*- coding: utf-8 -*-
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ludacity.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| branchard/ludacity | manage.py | Python | gpl-2.0 | 253 |
## simple file type detection.
## if i had unlimited api access, i would send every single md5 to something like VirusTotal
forbidden_types = ['text/x-bash', 'text/scriptlet', 'application/x-opc+zip', 'application/com', 'application/x-msmetafile', 'application/x-shellscript', 'text/x-sh', 'text/x-csh', 'application/x-... | red-green/broscanner | file_scanning.py | Python | gpl-2.0 | 1,354 |
#!/usr/bin/python
#Covered by GPL V2.0
from encoders import *
from payloads import *
# generate_dictio evolution
class dictionary:
def __init__(self,dicc=None):
if dicc:
self.__payload=dicc.getpayload()
self.__encoder=dicc.getencoder()
else:
self.__payload=payload()
self.__encoder = [lambda x: en... | GHubgenius/wfuzz-1 | dictio.py | Python | gpl-2.0 | 1,098 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
SuroLeveling
A QGIS plugin
todo
-------------------
begin : 2016-02-12
git sha : $Format:%H$
copyr... | ctu-osgeorel-proj/bp-pesek-2016 | src/position_correction.py | Python | gpl-2.0 | 7,629 |
#
# Copyright 2015 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... | lyarwood/virt-deploy | virtdeploy/drivers/libvirt.py | Python | gpl-2.0 | 12,400 |
from Tools.Profile import profile
profile("LOAD:ElementTree")
import xml.etree.cElementTree
import os
profile("LOAD:enigma_skin")
from enigma import eSize, ePoint, eRect, gFont, eWindow, eLabel, ePixmap, eWindowStyleManager, addFont, gRGB, eWindowStyleSkinned, getDesktop
from Components.config import ConfigSubsection, ... | trunca/enigma2 | skin.py | Python | gpl-2.0 | 39,906 |
# Add any code that updates the current probability
# values of any of the nodes here.
# For example, here is a method that updates the probability of
# a single node, where this node is assumed to have a single parent.
def update_node_with_one_parent(n):
'''
For all possible values pv of the current node,
... | uraplutonium/adtree-py | src/BayesUpdating.py | Python | gpl-2.0 | 2,726 |
#!bpy
"""
to run:
(aAtually I have not been able to run this from command line - the thing
exits without rendering. If I add bpy.ops.render, it alwys renders layers, rather
then compositing output)
blender -b --python this_fnm.py
"""
import bpy
from math import radians
import fnmatch
import os
####################... | ivanamihalek/blender | texture_shadow_no_bg/cube_to_png.py | Python | gpl-2.0 | 10,222 |
#Aditya Joshi
#Enumerating Oriented Gene Ordering
from itertools import permutations,product
from math import fabs
n = int(raw_input())
def make_set(n):
set = []
for x in range(1,n+1):
set += [x]
return set
def plusAndMinusPermutations(items):
for p in permutations(items,len(i... | adijo/rosalind | old/gene_enumerations.py | Python | gpl-2.0 | 682 |
from __future__ import division
from django.conf import settings
from django.core.management.base import BaseCommand
import time
import datetime
import logging
from cali_water.usage_data_tasks import TasksForMonthlyWaterUseReport
logger = logging.getLogger("accountability_tracker")
class Command(BaseCommand):
hel... | SCPR/accountability-tracker | cali_water/management/commands/usage_tasks.py | Python | gpl-2.0 | 597 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# vim:ai:sta:et:ts=4:sw=4:sts=4
"""kernelng 0.x
Tool for maintaining customized overlays of kernel-ng.eclass-based ebuilds
Copyright 2005-2014 Gentoo Foundation
Copyright (C) 2014 Gregory M. Turner <gmt@be-evil.net>
Distributed under the terms of the GNU General ... | gmt/kernel-ng-util | kernelng/config.py | Python | gpl-2.0 | 46,364 |
# encoding: utf-8
# module samba.dcerpc.drsuapi
# from /usr/lib/python2.7/dist-packages/samba/dcerpc/drsuapi.so
# by generator 1.135
""" drsuapi DCE/RPC """
# imports
import dcerpc as __dcerpc
import talloc as __talloc
class DsReplicaObjMetaData2Ctr(__talloc.Object):
# no doc
def __init__(self, *args, **kwar... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/samba/dcerpc/drsuapi/DsReplicaObjMetaData2Ctr.py | Python | gpl-2.0 | 880 |
import pandas
array = hash()
array['a']='b'
| michaelpantic/tolScreenCleaner | test.py | Python | gpl-2.0 | 45 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 ve... | pombredanne/invenio | modules/bibformat/lib/elements/bfe_comments.py | Python | gpl-2.0 | 2,111 |
from datetime import datetime
from django.http import HttpResponse, HttpResponseRedirect
from django.views.generic import View, ListView, DetailView
from django.views.generic.edit import CreateView, UpdateView
from content.models import Sub, SubFollow, Post, Commit
from content.forms import SubForm, PostForm, CommitF... | ellipticaldoor/dfiid | project/content/views.py | Python | gpl-2.0 | 5,667 |
import time
import pygame
import colors
class Spritesheet():
surface = None
size = (0, 0)
def __init__(self, surface, size):
self.surface = surface
self.size = size
def get(self, x, y):
surf = pygame.Surface(self.size, pygame.SRCALPHA, 32)
croparea = (x * self.size[... | Plenglin/math-game | src/sprites.py | Python | gpl-2.0 | 1,911 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------#
# #
# This file is part of the Horus Project #
# ... | hroncok/horus | src/horus/util/profile.py | Python | gpl-2.0 | 30,519 |
# logging.py
# DNF Logging Subsystem.
#
# Copyright (C) 2013-2016 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program ... | dmach/dnf | dnf/logging.py | Python | gpl-2.0 | 7,178 |
"""
The singleton class that allows metadata and other attachables to be
attached to the entire website.
As the website at this level is one item of data rather than an entire
model, we have to use a singleton class to attach metadata to it.
"""
from django.conf import settings
from django.contrib.sites.models impor... | CaptainHayashi/lass | website/models/website_class.py | Python | gpl-2.0 | 2,747 |
"""
BitBake 'Fetch' implementations
Classes for obtaining upstream sources for the
BitBake build tools.
"""
# Copyright (C) 2003, 2004 Chris Larson
# Copyright (C) 2012 Intel Corporation
#
# SPDX-License-Identifier: GPL-2.0-only
#
# Based on functions from the base bb module, Copyright 2003 Holger Schurig
import o... | schleichdi2/OPENNFR-6.3-CORE | bitbake/lib/bb/fetch2/__init__.py | Python | gpl-2.0 | 67,666 |
import sys
import os
#For baseline and redundacy-detecion to prepare message size picture
def MessageSize(typePrefix, directory):
wf = open("%(typePrefix)s-msgsize.data"%vars(), "w")
wf.write("#Suggest Filename: %(typePrefix)s-message.data\n#Data for drawing message overall size in different Amount/Redunda... | momingsong/ns-3 | bash-py-gp/baseline_picdata.py | Python | gpl-2.0 | 12,175 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "decommentariis.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| scotartt/commentarius | decommentariis/manage.py | Python | gpl-2.0 | 256 |
## mappingsPage.py - show selinux mappings
## Copyright (C) 2006 Red Hat, Inc.
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any lat... | jpacg/su-binary | jni/selinux/gui/mappingsPage.py | Python | gpl-2.0 | 1,873 |
#
# Copyright (C) 2007, One Laptop Per Child
#
# 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.
#
# Thi... | lucian1900/Webified | messenger.py | Python | gpl-2.0 | 5,665 |
#! /usr/bin/env python
import sys
import os
import gtk
from arithmetic import Parser
class Editor(object):
'A minimal editor'
def __init__(self):
# path to UI file
scriptPath = os.path.split( sys.argv[0] )[0]
uiFilePath = os.path.join( scriptPath,'editor.ui' )
self.builder = ... | ppaez/arithmetic | editor-gtk.py | Python | gpl-2.0 | 2,609 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import re
import sys
from datetime import datetime, timedelta
import numpy as np
import pandas as pd
import pandas.compat as compat
import pandas.core.common as com
import pandas.util.testing as tm
from pandas import (Series, Index, DatetimeIndex, Timedel... | pjryan126/solid-start-careers | store/api/zillow/venv/lib/python2.7/site-packages/pandas/tests/test_base.py | Python | gpl-2.0 | 38,533 |
##
# This file is an EasyBuild reciPY as per https://github.com/hpcugent/easybuild
#
# Copyright:: Copyright 2012-2017 Uni.Lu/LCSB, NTUA
# Authors:: Cedric Laczny <cedric.laczny@uni.lu>, Fotis Georgatos <fotis@cern.ch>, Kenneth Hoste
# License:: MIT/GPL
# $Id$
#
# This work implements a part of the HPCBIOS project ... | ULHPC/easybuild-easyblocks | easybuild/easyblocks/m/metavelvet.py | Python | gpl-2.0 | 2,000 |
import os
import pandas as pd
from input import Input
class Main(Input):
name = "CSV File Input"
def build_file_list(self):
files = {}
for s in self.symbols:
normalized_file = "%s.%s" % (s, self.extension)
if os.path.isfile(os.path.join(self.symbol_dir, normalized_file)):
files[s] = os.path.join(self.... | hirodotp/mdata | inputs/csvfile.py | Python | gpl-2.0 | 678 |
from cellprofiler.gui.help import USING_METADATA_HELP_REF, USING_METADATA_GROUPING_HELP_REF, LOADING_IMAGE_SEQ_HELP_REF
TM_OVERLAP = 'Overlap'
TM_DISTANCE = 'Distance'
TM_MEASUREMENTS = 'Measurements'
TM_LAP = "LAP"
TM_ALL = [TM_OVERLAP, TM_DISTANCE, TM_MEASUREMENTS,TM_LAP]
LT_NONE = 0
LT_PHASE_1 = 1
LT_SPLIT = 2
LT_... | sstoma/CellProfiler | cellprofiler/modules/trackobjects.py | Python | gpl-2.0 | 137,657 |
#!/usr/bin/env python
"""
Do whatever is needed to get a security upload released
@contact: Debian FTP Master <ftpmaster@debian.org>
@copyright: 2010 Joerg Jaspert <joerg@debian.org>
@license: GNU General Public License version 2 or later
"""
# This program is free software; you can redistribute it and/or modify
# i... | purism/pdak | dak/new_security_install.py | Python | gpl-2.0 | 6,680 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# from http://homepage.hispeed.ch/py430/python/daemon.py
###########################################################################
# configure these paths:
LOGFILE = '/var/log/powerscout.log'
PIDFILE = '/var/run/powerscout.pid'
# and let USERPROG be the main function of ... | amm042/pywattnode | pypowerscout.py | Python | gpl-2.0 | 2,227 |
#import webdemo
| 3dfxsoftware/cbss-addons | webdemo/__init__.py | Python | gpl-2.0 | 16 |
# -*- coding: utf-8 -*-
###############################################################################################
#
# MediaPortal for Dreambox OS
#
# Coded by MediaPortal Team (c) 2013-2017
#
# This plugin is open source but it is NOT free software.
#
# This plugin may only be distributed to and executed... | schleichdi2/OpenNfr_E2_Gui-6.0 | lib/python/Plugins/Extensions/MediaPortal/additions/porn/wicked.py | Python | gpl-2.0 | 10,807 |
#!/usr/bmport settings
# -*- coding: utf-8 -*-
from django import http
from django.shortcuts import render
from main import models
from main import myforms
from main import cfg
from main import tools
from main import data_render
from main import database_manager
from main import scripts
from main import errors
from m... | asterix24/GestionaleCaldaie | main/views.py | Python | gpl-2.0 | 9,759 |
#*************************************************************************************************
#
# File Name: gui.py
# Project: Erebus Labs Sensor
# Revision Date: 04/13/2014
# Description: This file contains the main Erebus Sensor gui class
#
#***********************************************************... | erebus-labs/PSU-VOC-SENSOR-2K14 | Code/python_gui/erebus_sensor/gui.py | Python | gpl-2.0 | 15,795 |
# kate: replace-tabs on; indent-width 4; remove-trailing-spaces all; show-tabs on; newline-at-eof on;
# -*- coding:utf-8 -*-
'''
Copyright (C) 2014 Peter Urbanec
All Right Reserved
License: Proprietary / Commercial - contact enigma.licensing (at) urbanec.net
'''
import requests
import json
from fcntl import ioctl
fr... | popazerty/beyonwiz-4.1 | lib/python/Plugins/SystemPlugins/IceTV/API.py | Python | gpl-2.0 | 8,110 |
import math
from .link import Link
from nimbus.reports import report as rp
from nimbus.reports import input as inp
from nimbus.network.links.sections import circle as cir
from nimbus.network.links.sections import rectangle as rct
class Weir(Link):
def __init__(self, name=None, section=None, orif_coef... | benjiyamin/nimbus | nimbus/network/links/weir.py | Python | gpl-2.0 | 4,270 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Common/Shared code related to the Settings dialog
# Copyright (C) 2010-2018 Filipe Coelho <falktx@falktx.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 Softw... | falkTX/Cadence | src/shared_settings.py | Python | gpl-2.0 | 12,056 |
# -*- coding: utf-8 -*-
"""Functions for video streaming."""
import cStringIO
import fcntl
import os
import signal
import struct
import subprocess
import sys
import time
import types
import json
from PIL import Image
import v4l2
VIDEO_DEVICE = None
VIDEO_STREAM_PROCESS = None
VIDEO_INITIALIZED = False
VIDEO_SIZE = "-... | meguiraun/mxcube3 | mxcube3/video/streaming.py | Python | gpl-2.0 | 7,123 |
class Solution(object):
def isPerfectSquare(self, num):
"""
:type num: int
:rtype: bool
"""
# return num ** 0.5 == int(num ** 0.5)
if num < 2:
return True
x = num // 2
while x * x > num:
x = (x + num // x) // 2
return ... | xinqiu/My-LeetCode-Notes | Leetcode/367.py | Python | gpl-2.0 | 333 |
# Xlib.ext.__init__ -- X extension modules
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# 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 Lic... | lubosch/productivity-classifier-linux | Xlib/ext/__init__.py | Python | gpl-2.0 | 1,249 |
# -*- coding: utf-8 -*-
#
# Cheroke-admin
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
#
# Copyright (C) 2009-2010 Alvaro Lopez Ortega
#
# 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 So... | mdavid/cherokee-webserver-svnclone | admin/plugins/wildcard.py | Python | gpl-2.0 | 3,364 |
import inspect
import unittest
import mock
from pulp.server.db.connection import PulpCollection
from pulp.server.db.model.criteria import Criteria
from pulp.server.managers.content.query import ContentQueryManager
from test_cud import PulpContentTests, TYPE_1_DEF, TYPE_1_UNITS, TYPE_2_DEF, TYPE_2_UNITS
class PulpCo... | mhrivnak/pulp | server/test/unit/server/managers/content/test_query.py | Python | gpl-2.0 | 5,319 |
import Orange
import logging
import random
from discretization import *
from FeatureSelector import *
from utils import *
from sklearn import svm
from sklearn import cross_validation
from sklearn.metrics import f1_score, precision_recall_fscore_support
from sklearn.feature_extraction import DictVectorizer
import numpy ... | Sh1n/AML-ALL-classifier | main.py | Python | gpl-2.0 | 5,647 |
#!/usr/bin/env python
# class to convert/process modis data
#
# (c) Copyright Ingmar Nitze 2013
# Authors: Ingmar Nitze, Luca Delucchi
# Email: initze at ucc dot ie
# Email: luca dot delucchi at iasma dot it
#
##################################################################
#
# This MODIS Python class is licens... | gilliM/MFQ | ModisFromQgis/mypymodis/qualitymodis.py | Python | gpl-2.0 | 6,568 |
"""
Django settings for dfiid project.
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/
"""
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file_... | ellipticaldoor/dfiid | project/dfiid/settings/base.py | Python | gpl-2.0 | 2,415 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2021 Philipp Wolfer
#
# 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 Licen... | zas/picard | picard/const/appdirs.py | Python | gpl-2.0 | 1,741 |
# -*- coding: utf-8 -*-
'''
Template Add-on
Copyright (C) 2016 Demo
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 ... | dannyperry571/theapprentice | plugin.video.Carrera/default.py | Python | gpl-2.0 | 19,611 |
from ptrace.signames import signalName
class ProcessEvent(Exception):
"""
A process event: program exit, program killed by a signal, program
received a signal, etc.
The attribute "process" contains the related process.
"""
def __init__(self, process, message):
Exception.__init__(self, ... | pombredanne/python-ptrace | ptrace/debugger/process_event.py | Python | gpl-2.0 | 1,864 |
#
# corecd.py
#
# Copyright (C) 2014 Fabio Erculiani
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program ... | Sabayon/anaconda | pyanaconda/installclasses/corecd.py | Python | gpl-2.0 | 1,357 |
from sofia.step import Step
class MolecularWeights(Step):
"""
Reads in a set of molecular weights. The file of molecular weights can be obtained from
http://emboss.sourceforge.net/.
"""
IN = ['molecular_weight_file']
OUT = ['molecular_weight_set']
def run(self, molecular_weight_file):
... | childsish/sofia | templates/genomics/steps/molecular_weights.py | Python | gpl-2.0 | 742 |
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.dashboards.admin import dashboard
from openstack_dashboard.openstack.common.log import policy_is
class CheckHost(horizon.Panel):
name = _("Instance")
slug = 'checkhost'
img = '/static/dashboard/img/nav/checkhos... | ChinaMassClouds/copenstack-server | openstack/src/horizon-2014.2/openstack_dashboard/dashboards/admin/checkhost/panel.py | Python | gpl-2.0 | 495 |
# WARNING: This script copies all the files in this repo into the root
# WARNING: tree of the RaspberryPi and saves a backup file (.bak).
# WARNING: Need to be ran with "sudo".
import os
import shutil
try:
raw_input # Python 2
except NameError:
raw_input = input # Python 3
for directory in ('home'... | humitos/pyfispot | raspberrypi/copy_config_files.py | Python | gpl-2.0 | 1,278 |
"""
NCL User Guide Python Example: PyNGL_unstructured_ICON_triangles.py
Grid type: unstructured
Model: ICON
Info: - colored triangles
- add labelbar (colorbar)
- wkColorMap
18.02.16 meier-fleischer(at)dkrz.de
"""
import numpy as np
import math, time, sys, os
i... | likev/ncl | ncl_ncarg_src/ni/src/examples/nug/NUG_unstructured_ICON_triangles_PyNGL.py | Python | gpl-2.0 | 7,516 |
#!/usr/bin/python
#coding:utf-8
import requests
url="http://sendcloud.sohu.com/webapi/mail.send.json"
#files={ "file1": (u"1.pdf", open(u"1.pdf", "rb")),
# "file2": (u"2.pdf", open(u"2.pdf", "rb"))}
# 不同于登录SendCloud站点的帐号,您需要登录后台创建发信子帐号,使用子帐号和密码才可以进行邮件的发送。
params = {"api_user": "bargetor_test_C9Lnuz", \
"ap... | Bargetor/chestnut | bargetor/notifiction/test.py | Python | gpl-2.0 | 811 |
# This file is part of OpenDrift.
#
# OpenDrift 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 2
#
# OpenDrift is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without ev... | OpenDrift/opendrift | opendrift/models/windblow.py | Python | gpl-2.0 | 1,401 |
'''
|marx| offers several different source shapes. Tests in this module exercise
those sources (except ``SAOSAC``, which is heavily used in
:ref:`sect-tests.PSF` already).
'''
import shutil
import subprocess
import os
from collections import OrderedDict
from marxtest import base
title = 'Sources in |marx|'
tests = ... | Chandra-MARX/marx-test | tests/source.py | Python | gpl-2.0 | 10,336 |
# This file is part of Rubber and thus covered by the GPL
# (c) Emmanuel Beffara, 2002--2006
"""
LaTeX document building system for Rubber.
This module contains all the code in Rubber that actually does the job of
building a LaTeX document from start to finish.
"""
import os, os.path, sys, imp
import re
import string... | petrhosek/rubber | rubber/converters/latex.py | Python | gpl-2.0 | 42,452 |
"""
Social.py
Contains elements that enable connecting with external social sites.
Copyright (C) 2015 Timothy Edmund Crosley
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;... | timothycrosley/thedom | thedom/social.py | Python | gpl-2.0 | 14,474 |
#
# Kickstart module for the storage.
#
# Copyright (C) 2018 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is di... | atodorov/anaconda | pyanaconda/modules/storage/storage.py | Python | gpl-2.0 | 13,962 |
# -*- coding: utf-8 -*-
#
# This file is part of CERN Analysis Preservation Framework.
# Copyright (C) 2016 CERN.
#
# CERN Analysis Preservation Framework 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... | xchen101/analysis-preservation.cern.ch | cap/modules/experiments/permissions/lhcb.py | Python | gpl-2.0 | 1,489 |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from . import views
urlpatterns = [
url(r"^$", views.home, name="board"),
url(r"^/all$", views.all_feed, name="board_all"),
url(r"^/course/(?P<course_id>.*)?$", views.course_feed, name="board_course"),
url(r"^/submit/course/(?P<course_id>.*)?$... | jacobajit/ion | intranet/apps/board/urls.py | Python | gpl-2.0 | 1,474 |
# coding=utf-8
#Converts a csv contining country codes and numerical values, to json
#Years should be given in the header, like this:
#
# land, 1980, 1981, 1982
# se, 12, 13, 11
# fi 7, 10, 14
import csv
import json
import argparse
import os.path
import sys
import math
#Check if file exists
def is_... | jplusplus/thenmap-v0 | generators/utils/convert-csv-to-json.py | Python | gpl-2.0 | 2,991 |
def perfect_number():
sum, count, number = 0, 0, 1
top = input("enter a top value: ")
while number < top:
for i in range(1, number/2+1):
if number/i*i == number:
sum += i
if sum == number:
count += 1
print count, ".perfect number: ", numbe... | dogancankilment/UnixTools | utils/math/perfect_number.py | Python | gpl-2.0 | 477 |
#!/usr/bin/env python
#coding=utf8
'''
We are playing the Guess Game. The game is as follows:
I pick a number from 1 to n. You have to guess which number I picked.
Every time you guess wrong, I'll tell you whether the number I picked is higher or lower.
However, when you guess a particular number x, and you guess w... | mornsun/javascratch | src/topcoder.py/LC_375_Guess_Number_Higher_or_Lower_II.py | Python | gpl-2.0 | 2,229 |
# localrepo.py - read/write repository class for mercurial
#
# Copyright 2005-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.
from node import hex, nullid, short
from i18n import _
import peer, c... | vmg/hg-stable | mercurial/localrepo.py | Python | gpl-2.0 | 96,365 |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 25 13:08:19 2015
@author: jgimenez
"""
from PyQt4 import QtGui, QtCore
from initialConditions_ui import Ui_initialConditionsUI
import os
from utils import *
from PyFoam.RunDictionary.BoundaryDict import BoundaryDict
from PyFoam.RunDictionary.ParsedParameterFile import P... | jmarcelogimenez/petroFoam | initialConditions.py | Python | gpl-2.0 | 6,385 |
# -*- coding: utf-8 -*-
#
from rest_framework import serializers
from django.utils.translation import ugettext_lazy as _
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
from perms.models import AssetPermission, Action
__all__ = [
'AssetPermissionSerializer',
'ActionsField',
]
class Actio... | skyoo/jumpserver | apps/perms/serializers/asset/permission.py | Python | gpl-2.0 | 2,536 |
#coding=utf-8
#介紹:合併字典方式二
import pickle
import os
hashdataS = {}
hashdataP = {}
def updata(self,hashdic):
dic = open(self, 'rb')
newdata = cPickle.load(dic)
hashdic.update(newdata)
def main(dict1,dict2,hashname,new):
try:
updata(dict1,hashname) #载入
print 'befor: %s' %... | sveiow/doitpy | AutoAnswer/oldversion/kemuyimoni/字典加工/合并字典方式二.py | Python | gpl-2.0 | 758 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def initial_data(apps, schema_editor):
TC = apps.get_model('tech', 'TechCategory')
T = apps.get_model('tech', 'Tech')
tc = TC(name='Advanced Magnetism', cost=250, category='FF')
tc.save()
T(name='Cla... | dwagon/pymoo | moo/tech/migrations/0010_forcefield_techs.py | Python | gpl-2.0 | 8,262 |
# HTTP proxy for serving static resources and forwarding requests to Synthese.
# @file proxy.py
# @author Sylvain Pasche
#
# This file belongs to the SYNTHESE project (public transportation specialized software)
# Copyright (C) 2002 Hugues Romain - RCSmobility <contact@rcsmobility.com>
#
# This progra... | Open-Transport/synthese | legacy/tools/synthesepy/proxy.py | Python | gpl-2.0 | 9,018 |
import webbrowser
import platform
def get_version():
version = platform.python_version()
if len(version) != 3: # This is to exclude minor versions.
version = version[0:3]
return version
def open_doc(url):
webbrowser.open(url)
def open_library():
version = get_version()
url = "http... | bittercode/pyrrhic-ree | modules/onlineDocs.py | Python | gpl-2.0 | 530 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from bs4 import BeautifulSoup
def parse_html(html):
def strip_elem(e):
return str(e).strip()
def non_empty_children(elem):
if hasattr(elem, "children"):
return list(filter(strip_elem, elem.children))
else:
return ... | lucastx/tjrj-processos | tjrj/scraping.py | Python | gpl-2.0 | 1,302 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from miasm2.expression.expression import ExprId
from miasm2.core.cpu import gen_reg, gen_regs
gen_reg('PC', globals())
gen_reg('PC_FETCH', globals())
gen_reg('R_LO', globals())
gen_reg('R_HI', globals())
exception_flags = ExprId('exception_flags', 32)
PC_init = ExprId("... | rom1sqr/miasm | miasm2/arch/mips32/regs.py | Python | gpl-2.0 | 1,927 |
from datetime import datetime
from unittest import TestCase
from application.backend.models.person import gender, create_person_from_dict
from application.backend.tests.test_helpers import create_person
class PersonTest(TestCase):
def test_should_jsonify_itself(self):
date_of_birth = datetime.now()
... | wanderanimrod/family-tree | application/backend/tests/models/person_test.py | Python | gpl-2.0 | 1,433 |
import datetime
import hashlib
import random
import re
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.db import transaction
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
try:
from d... | meletakis/collato | esn/registration/models.py | Python | gpl-2.0 | 10,562 |
import unittest
from antelope_catalog.data_sources.local import TEST_ROOT
from antelope_catalog import LcCatalog
from lcatools.interfaces import IndexRequired
cat = LcCatalog(TEST_ROOT)
ref = 'calrecycle.antelope'
cat.new_resource(ref, 'http://www.antelope-lca.net/uo-lca/api/', 'AntelopeV1Client',
... | bkuczenski/lca-tools | antelope_catalog/providers/v1_client/tests/test_antelope_v1_client.py | Python | gpl-2.0 | 1,973 |
import sys
import numpy as np
import pylab
import matplotlib.pyplot as plt
import scipy.integrate
import scipy.optimize
from collections import namedtuple
import geo
import astro_help as ah
import disk_sub as disk
RADIAN=57.29598
C=2.997925e10
MSOL=1.979e33
G=6.670e-8
YR=3.1556925e7
EPSILON=1e-6
PI=3.1416
STEFAN_BOLT... | jhmatthews/cobra | source/disk_sub.py | Python | gpl-2.0 | 3,164 |
from time import time
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_delete
from django.dispatch import receiver
import os
def upload_path(instance, filename):
return 'uploads/user_{0}/{1}_{2}'.format(
instance.owner.id,
str(time... | andela-ooshodi/django-photo-application | djangophotoapp/photoapp/models.py | Python | gpl-2.0 | 1,310 |
from rest_framework import serializers
from csinterop.models import SharingProposal, Folder, User
class SharingProposalSerializer(serializers.ModelSerializer):
share_id = serializers.RelatedField(source='key')
permission = serializers.CharField(source='get_permission', read_only=True)
folder_name = serial... | cloudspaces/interop-protocol | csinterop/csinterop/serializers.py | Python | gpl-2.0 | 1,718 |
from __future__ import generators
import ConfigParser
import copy
import email.Message
import email.Parser
import email.Utils
import errno
import hmac
import inspect
import md5
import os
import popen2
import random
import re
import select
import sha
import shutil
import socket
import sys
import tempfile
import time
imp... | stevegt/isconf4 | lib/python/isconf/Cache.py | Python | gpl-2.0 | 23,037 |
#!/usr/bin/env python
# Creates and saves a JSON file to update the D3.js graphs
import MySQLdb
import MySQLdb.cursors
import json
import Reference as r
import logging
def CreateSentimentIndex(NegativeWords, PositiveWords, TotalWords):
''' Creates a sentiment value for the word counts'''
if TotalWords... | AdamDynamic/TwitterMetrics | CreateJson.py | Python | gpl-2.0 | 2,191 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.