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 |
|---|---|---|---|---|---|
from django.contrib import admin
from django.utils.safestring import mark_safe
from edc_base.modeladmin_mixins import audit_fieldset_tuple
from ..admin_site import bcpp_subject_admin
from ..forms import QualityOfLifeForm
from ..models import QualityOfLife
from .modeladmin_mixins import CrfModelAdminMixin
@admin.reg... | botswana-harvard/bcpp-subject | bcpp_subject/admin/quality_of_life_admin.py | Python | gpl-3.0 | 1,552 |
#!/usr/bin/python
#
# This file is part of the tmtp (Tau Meta Tau Physica) project.
# For more information, see http://www.sew-brilliant.org/
#
# Copyright (C) 2010, 2011, 2012 Susan Spencer and Steve Conklin
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Genera... | tusuzu/tmtp | standalone/tmtpl/document.py | Python | gpl-3.0 | 13,294 |
# -*- coding: utf-8 -*-
"""
This file contains the Qudi module base class.
Qudi 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.
Qudi is dis... | drogenlied/qudi | core/base.py | Python | gpl-3.0 | 10,150 |
import os
import rospy, rospkg
import sys
import math
import yaml
from itertools import izip_longest
from operator import add, sub
from qt_gui.plugin import Plugin
from python_qt_binding import loadUi
from python_qt_binding.QtWidgets import QWidget
from PyQt5 import QtGui, QtWidgets, QtCore
from rqt_plot.rosplot impo... | Georacer/last_letter | rqt_dashboard/src/rqt_dashboard/dashboard.py | Python | gpl-3.0 | 16,075 |
//codecademy course answer
parrot = "Norwegian Blue"
print len(parrot)
| nurhandipa/python | codecademy/string_methods.py | Python | gpl-3.0 | 72 |
#-*- coding: utf-8 -*-
import os
import sys
import time
import re
from django.core.files import File as DjangoFile
from django.core.management.base import BaseCommand, NoArgsCommand
from optparse import make_option
from obp_legacy.models import *
from spf.models import Request, Match
from spf.util.lookup import Medi... | hzlf/openbroadcast | website/apps/spf/management/commands/spf_lookup.py | Python | gpl-3.0 | 5,465 |
# hello_someone.py
# ask the user for their name
# give a personalised greeting to the user
# using print and the variable we just made
| cowlingj/an-introduction-to-programming-with-python | exercises/hello_someone.py | Python | gpl-3.0 | 138 |
from obstacle import *
class Circle(Obstacle):
def __init__(self, Rc, dens, R):
Obstacle.__init__(self,Rc,dens)
if R <= 0:
raise Exception('Circle radius has to be positive')
self.R = R
def make(self, offset = 0):
N = int(np.round(2*np.pi*self.R*self.dens))
... | sknepneklab/SAMoS | configurations/MakeConfigurations/TissueWithObstacle/circle.py | Python | gpl-3.0 | 826 |
from setuptools import find_packages
from setuptools import setup
with open('README.md') as f:
setup(
name = 'swarm',
version = '0.5.0',
author = 'arvin.x',
author_email = 'arvin.x@icloud.com',
description = 'A modular distributed penetration testing too... | Arvin-X/swarm | setup.py | Python | gpl-3.0 | 1,370 |
#!/usr/bin/env python
#
# By Reynaldo R. Martinez P.
# Sept 15, 2016
# TigerLinux AT Gmail DOT Com
# Modules - Module file with a function - package version
#
#
# Second function, sum all items in a list
def sumallitems(inputlist):
result = inputlist[0]
for number in inputlist[1:]:
result = result + n... | tigerlinux/tigerlinux-extra-recipes | recipes/misc/python-learning/CORE/0031-module-packages-and-docs/package02/mymodule.py | Python | gpl-3.0 | 394 |
"""
Common task fixtures.
"""
#
# Fimfarchive, preserves stories from Fimfiction.
# Copyright (C) 2020 Joakim Soderlund
#
# 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 t... | JockeTF/fimfarchive | tests/tasks/conftest.py | Python | gpl-3.0 | 2,907 |
'''
A Python module for parsing Newick files.
Copyright (C) 2003-2008, Thomas Mailund <mailund@birc.au.dk>
This module contains the functionality for lexical analysis. You
rarely need to access it in your own modules and should probably only
use the parser or tree modules, and from those most likely only the
objects... | ptdtan/Ragout | lib/newick/lexer.py | Python | gpl-3.0 | 3,236 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
"""
Created on Sun Sep 18 20:24:29 2016
"""
list1 = [3, 44, 38, 5, 47, 15, 36, 26, 27, 2, 46, 4, 19, 50, 48]
list2 = [1,1,1,1,1,1,1,1]
list3 = [1,2,3,4,5,6,7,8]
list4 = [2,3,6,7,5,2,2,2]
list5 = [8,7,6,5,4,3,2,1]
#检查函数
def check(func):
print sort_bubble(list1)==func(lis... | zfrxiaxia/Code-zfr | visualgo数据结构/01_sort.py | Python | gpl-3.0 | 1,847 |
#!/usr/bin/env python
"""
Copyright (C) 2015 Louis Dijkstra
This file is part of gonl-sv
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 lat... | louisdijkstra/gonl-sv | back-up/version2/samplePhased_new.py | Python | gpl-3.0 | 14,587 |
from django.contrib import admin
from edc_model_admin import audit_fieldset_tuple
from ..admin_site import ambition_subject_admin
from ..forms import EducationForm
from ..models import Education
from .modeladmin_mixins import CrfModelAdminMixin
@admin.register(Education, site=ambition_subject_admin)
class Education... | botswana-harvard/ambition-subject | ambition_subject/admin/education_admin.py | Python | gpl-3.0 | 1,171 |
#!/usr/bin/python
"""
Copyright 2016 Paul Willworth <ioscode@gmail.com>
This file is part of Galaxy Harvester.
Galaxy Harvester 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 th... | druss316/G-Harvestor | html/udPassword.py | Python | gpl-3.0 | 2,697 |
""" Module which implements a demuxer for the camera output.
Several handlers may register to the different camera events
and they will be called in succession for each event.
"""
from multiprocessing import Process, Value, Event
import signal
from ..dvs128.controller import Controller
from ..dvs128.consts import *
... | orpinchasov/pycaer | pycaer/process/demux.py | Python | gpl-3.0 | 4,322 |
def First_Part(orbits):
Orbits = dict()
checksum = 0
for orbit in orbits:
od, og = orbit.split(')')
Orbits[og] = od
for og in Orbits.keys():
while 1:
try:
og = Orbits[og]
checksum += 1
except KeyError:
break... | ImpregnableProgrammer/Advent-of-Code | 2019/Day_06.py | Python | gpl-3.0 | 1,071 |
#-*- coding: utf-8 -*-
"""
default_config - the default configuration allowing to run this project
quickly and easily from the sources.
(c) 2013 - Copyright Red Hat Inc.
Authors:
- Pierre-Yves Chibon <pingou@pingoured.fr>
Distributed under License GPLv3 or later
You can find a copy of this lic... | fedora-infra/faitout | faitout/default_config.py | Python | gpl-3.0 | 2,128 |
#!/usr/bin/python
# -*- encoding: UTF-8 -*-
'''MATRIX Log File Maker
Version: 2
This script will create a csv file that will be a table of settings for all
STM data recorded from the Omicron MATRIX software.
List of classes: -none-
List of functions:
main
'''
# built-in modules
im... | ampron/pyMTRX | pyMTRX/scripts/notebook_sheet.py | Python | gpl-3.0 | 12,420 |
#!/usr/bin/env python
# $Id$
# Copyright 2013 Matthew Wall
# See the file LICENSE.txt for your full rights.
#
# Thanks to Sebastian John for the te923tool written in C (v0.6.1):
# http://te923.fukz.org/
# Thanks to Mark Teel for the te923 implementation in wview:
# http://www.wviewweather.com/
"""Classes and funct... | sai9/weewx-gitsvn | bin/weewx/drivers/te923.py | Python | gpl-3.0 | 39,957 |
import nltk
import string
import operator
from collections import Counter
#
# def get_tokens():
# with open('/home/davyx8/Downloads/data sets/lebowski/fargo.txt', 'r') as shakes:
# text = shakes.read()
# lowers = text.lower()
# #remove the punctuation using the character deletion step of translate
# ... | davyx8/Python | PRODICTIVE/tfidf.py | Python | gpl-3.0 | 2,184 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2016 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eith... | dtschan/weblate | weblate/api/views.py | Python | gpl-3.0 | 13,604 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
@frappe.whitelist()
def query_task(doctype, txt, searchfield, start, page_len, filters... | neilLasrado/erpnext | erpnext/projects/utils.py | Python | gpl-3.0 | 2,678 |
#!/usr/bin/env python
"""
Bulk load torents from mysql into elasticsearch `nyaav2` index,
which is assumed to already exist.
This is a one-shot deal, so you'd either need to complement it
with a cron job or some binlog-reading thing (TODO)
"""
import sys
import json
# This should be progressbar33
import progressbar
fr... | sharkykh/nyaa | import_to_es.py | Python | gpl-3.0 | 4,652 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-03-08 14:22
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("erudit", "0082_auto_20180208_1331"),
]
operations = [
migrations.AlterField... | erudit/eruditorg | eruditorg/erudit/migrations/0083_auto_20180308_0922.py | Python | gpl-3.0 | 494 |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from nasa_r2_common_msgs/ResetTableSceneRequest.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class ResetTableSceneRequest(genpy.Message):
_md5sum = "ba4b0b221fb425ac... | mkhuthir/catkin_ws | src/chessbot/devel/lib/python2.7/dist-packages/nasa_r2_common_msgs/srv/_ResetTableScene.py | Python | gpl-3.0 | 6,933 |
# $Id$ *** pyformex ***
##
## This file is part of pyFormex 0.8.9 (Fri Nov 9 10:49:51 CET 2012)
## pyFormex is a tool for generating, manipulating and transforming 3D
## geometrical models by sequences of mathematical operations.
## Home page: http://pyformex.org
## Project page: http://savannah.nongnu.org... | dladd/pyFormex | pyformex/plugins/f2flu.py | Python | gpl-3.0 | 7,649 |
# This file is from us, not the library developer
from __future__ import print_function
from collections import Counter
import struct
import sys
import time
import numpy as np
try:
from sklearn import neighbors, svm
HAVE_SK = True
except ImportError:
HAVE_SK = False
try:
import pygame
from pygam... | BtpPrograms/MHacks8 | Python/emg_test.py | Python | gpl-3.0 | 1,120 |
#!/usr/bin/env python
from __future__ import division
from __future__ import print_function
# General libraries
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import sys
import argparse
import datetime
import getpass
import os
import time
# OpenCV
import cv2
#... | meteoswiss-mdr/precipattractor | pyscripts/radar_extrapolation.py | Python | gpl-3.0 | 15,346 |
username = 'admin'
pwd = '123321...'
dbname = 'Prueba'
host = '127.0.0.1'
port = '8069'
filepath = '/home/aphu/Downloads/'
filename = 'cantvnet.ods'
| ITPS/oerp_gap_analysis_ITPS | utils/odf2gap/settings.py | Python | gpl-3.0 | 149 |
from pathlib import Path
def source_dir():
src = Path("@CMAKE_CURRENT_SOURCE_DIR@/../..")
if src.is_dir():
return src.relative_to(Path.cwd())
# If the file was not correctly configured by cmake, look for the source
# folder, assuming the build folder is inside the source folder.
current_p... | joakim-hove/ert | tests/utils.py | Python | gpl-3.0 | 582 |
# import python modules
import os
import time
import logging
import multiprocessing
# import django modules
# import third party modules
# import project specific model classes
from config.models import Origin
# import app specific utility classes
# import app specific utility functions
from .utils import packet_c... | hephestos/pythos | discovery/tasks.py | Python | gpl-3.0 | 3,656 |
# -*- coding: utf-8 -*-
# This file is part of the hdnet package
# Copyright 2014 the authors, see file AUTHORS.
# Licensed under the GPLv3, see file LICENSE for details
import os
import unittest
import shutil
class TestTmpPath(unittest.TestCase):
TMP_PATH = '/tmp/hdnettest'
def setUp(self):
if os... | team-hdnet/hdnet | tests/test_tmppath.py | Python | gpl-3.0 | 548 |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import sys
from django.core.management.base import BaseCommand
from core import models
logger = logging.getLogger('fairintranet.technicians')
class Command(BaseCommand):
help =... | fairdk/fair-ubuntu-centre | installscripts/data/intranet/fairintranet/technicians/management/commands/install_site.py | Python | gpl-3.0 | 1,436 |
""" Graphs results collected by germaind.py """
import pyx
import math
import json
exact = []
with open('exact.jsons') as f:
while True:
l = f.readline()
if not l:
break
d = json.loads(l[:-1])
exact.append((d[0]+1, d[0]*(d[2]/float(d[1]))))
exact2 = []
with open('exact2... | bwesterb/germain | graph.py | Python | gpl-3.0 | 2,140 |
"""
Apply access on a harmonization dataset.
"""
import sys
import mica.core
import mica.access
def add_arguments(parser):
"""
Add command specific options
"""
mica.access.add_permission_arguments(parser, True)
parser.add_argument('id', help='Harmonization dataset ID')
def do_command(args):
"... | apruden/mica2 | mica-python-client/src/main/python/mica/access_harmonization_dataset.py | Python | gpl-3.0 | 1,215 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('lizard_efcis', '0090_auto_20160222_1439'),
]
operations = [
migrations.AlterField(
model_name='mappingfield',
... | lizardsystem/lizard-efcis | lizard_efcis/migrations/0091_auto_20160315_0924.py | Python | gpl-3.0 | 1,198 |
from django.db import models
from django.db.models.signals import post_save
from django.contrib.auth.models import User
from sorl import thumbnail
class PerfilColumnista(models.Model):
user = models.OneToOneField(User, primary_key=True)
bio = models.TextField(blank=True, null=True)
image = thumbnail.Imag... | elhoyos/colombiatransparente | transparencia/models.py | Python | gpl-3.0 | 2,979 |
from lib.utils.Db import db
import re
from lib.exceptions.FindError import FindError
from lib.exceptions.DbError import DbError
from lib.exceptions.ValidationError import ValidationError
from lib.exceptions.SettingsValidationError import SettingsValidationError
from pluginbase import PluginBase
from lib.decorators.Memo... | inquisite/Inquisite-Core | lib/managers/SchemaManager.py | Python | gpl-3.0 | 25,915 |
# Copyright (C) 2011 Statoil ASA, Norway.
#
# The file 'ecl_grid.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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 Licens... | Ensembles/ert | python/python/ert/ecl/ecl_grid.py | Python | gpl-3.0 | 48,274 |
"""
:author: samu
:created: 2/20/13 8:46 PM
"""
import os
from cool_logging import getLogger
logger = getLogger('config-gen')
STANDARD_DIRS = [
'templates',
'extra_templates',
'data',
'build', # No real need..
]
STANDARD_FILES = {}
STANDARD_FILES['templates/example.html.jinja'] = \
'<h1>{{ ex... | rshk/config-gen | config_gen/commands/quickstart.py | Python | gpl-3.0 | 1,027 |
# Generated by Django 2.0.13 on 2019-08-10 20:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('profile_manager', '0004_auto_20190729_2101'),
]
operations = [
migrations.AddField(
model_name='profile',
name='get... | timberline-secondary/hackerspace | src/profile_manager/migrations/0005_profile_get_messages_by_email.py | Python | gpl-3.0 | 484 |
"""
========================
Broadcasting over arrays
========================
The term broadcasting describes how numpy treats arrays with different
shapes during arithmetic operations. Subject to certain constraints,
the smaller array is "broadcast" across the larger array so that they
have compatible shapes... | beiko-lab/gengis | bin/Lib/site-packages/numpy/doc/broadcasting.py | Python | gpl-3.0 | 5,688 |
from .SignalDataCanvas import SignalDataCanvas
from .SignalDataCanvas import SignalDataCanvasFast
| peace098beat/pyside_cookbook | 10_MatplotlibVSPygraph/mplcanvas/__init__.py | Python | gpl-3.0 | 104 |
# Write a function that, given:
#
# an amount of money
# a list of coin denominations
# computes the number of ways to make amount of money with coins of the
# available denominations.
# Example: for amount=4 and denominations=[1,2,3],
# your program would output 4: the number of ways to make 4 cents
# with those deno... | siddhartha-chandra/i_cake_python | 5.py | Python | gpl-3.0 | 4,376 |
from hubsan import *
import logging
import math
logging.basicConfig(level = logging.INFO)
hubsan = Hubsan()
hubsan.init()
hubsan.bind()
hubsan.safety()
print "bind complete"
session_id = hubsan.session_id
channel = hubsan.channel
print "channel: %d" % channel
print "session_id: %s" % format_packet(session_id)
pri... | chpatrick/hubsan | test.py | Python | gpl-3.0 | 530 |
from distutils.core import setup
from Cython.Build import cythonize
setup(
ext_modules=cythonize("cacss.pyx")
)
| mwv/Term-Discovery-Evaluation | term-discovery-evaluation/setup.py | Python | gpl-3.0 | 117 |
# -*- coding: utf-8 -*-
from collections import defaultdict
import io
import logging
import operator
import os.path
import socket
from babelfish import Language
from pkg_resources import EntryPoint
import requests
from stevedore import EnabledExtensionManager, ExtensionManager
from .subtitle import compute_score, get... | duramato/SickRage | lib/subliminal/api.py | Python | gpl-3.0 | 17,713 |
import pytest
import expipe
import subprocess
import click
from click.testing import CliRunner
import quantities as pq
import os.path as op
from expipe_plugin_cinpla.intan import IntanPlugin
from expipe_plugin_cinpla.electrical_stimulation import ElectricalStimulationPlugin
from expipe_plugin_cinpla.main import CinplaP... | CINPLA/expipe-dev | expipe-plugin-cinpla/tests/test_intan.py | Python | gpl-3.0 | 2,175 |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
db = DAL("sqlite://storage.sqlite")
| hiatobr/midiacapoeira | models/01_db.py | Python | gpl-3.0 | 142 |
# Author: Pontus Laestadius.
# Since: 2nd of March, 2017.
# Maintained since: 17th of April 2017.
from receiver import Receiver
print("Version 2.2")
Receiver("172.24.1.1", 9005)
| DIT524-V17/group-7 | TCP raspberry/server.py | Python | gpl-3.0 | 181 |
#import sys
#sys.path.append("/home/vxv/Workspace/graphTheory/graph")
#print (sys.path)
from graph.graph import Graph_Adj, Graph_Mat
if __name__ == "__main__":
g = { "a" : ["d"],
"b" : ["c"],
"c" : ["b", "c", "d", "e"],
"d" : ["a", "c"],
"e" : ["c"],
"f" : []
... | xyvab/graphTheory | test.py | Python | gpl-3.0 | 561 |
from exchange import __version__ as the_version, get_version
from . import ExchangeTest
class TestGetVersion(ExchangeTest):
def test_get_version(self):
self.assertTrue(
the_version in get_version(),
'%s != %s! Bad version!' % (the_version, get_version()))
| arhote/exchange | exchange/tests/test_get_version.py | Python | gpl-3.0 | 298 |
# -*- coding: utf-8 -*-
from django.db import models
class Request(models.Model):
'一个测试请求'
id = models.CharField(u'ID', max_length=32, primary_key=True)
url = models.CharField(u'访问地址', max_length=200)
method = models.CharField(u'方法', default='GET', max_length=6)
params = models.TextField(u'参数', d... | yszou/AceTest | Schema/models.py | Python | gpl-3.0 | 1,693 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012 VT SuperDARN Lab
# Full license can be found in LICENSE.txt
#
# 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
#... | MuhammadVT/davitpy | davitpy/pydarn/proc/music/music.py | Python | gpl-3.0 | 84,879 |
# subSystemBonusGallenteElectronic2TractorBeamVelocity
#
# Used by:
# Subsystem: Proteus Electronics - Emergent Locus Analyzer
type = "passive"
def handler(fit, module, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Tractor Beam",
"maxTractorVelocity"... | Ebag333/Pyfa | eos/effects/subsystembonusgallenteelectronic2tractorbeamvelocity.py | Python | gpl-3.0 | 458 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# Copyright 2015 Prairies Ariea
#
# This file is part of Files Sync.
#
# Files Sync 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 th... | prairiesariea/wsync | src/syncwrap/Helper.py | Python | gpl-3.0 | 1,723 |
from setuptools import setup
setup(name='peergrader',
version='0.1',
description='Peer grading project',
url='https://github.com/chrisgtech/peergrader',
author='Chris Graham',
author_email='chrisgraham@example.com',
license='GPLv3',
packages=[''],
zip_safe=False) | chrisgtech/peergrader | setup.py | Python | gpl-3.0 | 312 |
# -*- coding: utf-8 -*-
# wpcdesk - WordPress Comment Desktop
# Copyright (C) 2012 Eka Putra - ekaputra@balitechy.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of t... | ekaputra07/wpcdesk | wpcdesk/wpcdesk_threads.py | Python | gpl-3.0 | 3,754 |
# -*- coding: UTF-8 -*-
"""Common settings and globals."""
import os
from os.path import abspath, basename, dirname, join, normpath
from sys import path
from django.core.exceptions import ImproperlyConfigured
def get_env_variable(var_name):
""" Get the environment variable or return exception """
try:
... | HEG-Arc/wheel | django/wheel/settings/base.py | Python | gpl-3.0 | 9,098 |
#coding=utf-8
#2017.10.6,Flash,cookielib
import urllib2
import cookielib
filename="cookiebd.txt"
#声明一个cookieJar对象实例来保存cookie
cookie = cookielib.MozillaCookieJar(filename)
#利用urllib2库的HTTPCookieProcessor对象来创建cookie处理器
handler = urllib2.HTTPCookieProcessor(cookie)
#通过handler来构建opener
opener = urllib2.build_... | FlashXT/XJTU_WorkLog | 2017.10/Engineering/PythonCrawler/Crawler_cookielib2.py | Python | gpl-3.0 | 692 |
SERVER_HOSTNAME = "127.0.0.1"
SERVER_PORT = 9671
| prerit2010/web-frontend | config.py | Python | gpl-3.0 | 49 |
#
# Copyright (C) 2013 Savoir-Faire Linux Inc.
#
# This file is part of Sageo
#
# Sageo 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 optio... | smlacombe/sageo | app/forms/view.py | Python | gpl-3.0 | 5,955 |
# Authors:
# Pavel Zuna <pzuna@redhat.com>
#
# Copyright (C) 2009 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 versio... | hatchetation/freeipa | ipalib/plugins/baseldap.py | Python | gpl-3.0 | 76,643 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
a = tf.constant(10)
b = tf.constant(32)
c = a + b
d = a - b
run_list = [c, d]
print(sess.run(run_list))
| antkillerfarm/antkillerfarm_crazy | python/ml/tensorflow/unit_test/run_list.py | Python | gpl-3.0 | 257 |
# This file is part of Firemix.
#
# Copyright 2013-2016 Jonathan Evans <jon@craftyjon.com>
#
# Firemix 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... | nyarasha/firemix | patterns/radial_gradient.py | Python | gpl-3.0 | 7,317 |
# Copyright (c) 2001-2007 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Extended thread dispatching support.
For basic support see reactor threading API docs.
Maintainer: Itamar Shtull-Trauring
"""
import Queue
from twisted.python import failure
from twisted.internet import defer
def deferToThreadP... | Donkyhotay/MoonPy | twisted/internet/threads.py | Python | gpl-3.0 | 3,490 |
from BaseWorker import *
class FlickrWorker(BaseWorker):
key = '391fb6763fe0b5011cf52638067e0fed'
secret = '369f46a112452186'
def __init__(self, parent = None):
super(FlickrWorker, self).__init__(parent)
def run(self):
self.progressSignal.emit(self.stampConfi... | eugenesan/postman | postman/FlickrWorker.py | Python | gpl-3.0 | 2,057 |
#!/usr/bin/python
# coding:utf8
import numpy as np
from sklearn.decomposition import NMF
import matplotlib.pyplot as plt
RATE_MATRIX = np.array([[5, 5, 3, 0, 5, 5], [5, 0, 4, 0, 4, 4],
[0, 3, 0, 5, 4, 5], [5, 4, 3, 3, 5, 5]])
nmf = NMF(n_components=2) # 设有2个隐主题
user_distribution = nmf.fit_tr... | jiangzhonglian/MachineLearning | src/py3.x/16.RecommenderSystems/sklearn-RS-demo.py | Python | gpl-3.0 | 508 |
# This file is part of Beneath a Binary Sky.
# Copyright (C) 2016, Aidin Gharibnavaz <aidin@aidinhut.com>
#
# Beneath a Binary Sky 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
# Lice... | aidin36/beneath-a-binary-sky | src/world/object_updater.py | Python | gpl-3.0 | 4,428 |
from django import template
import datetime
register = template.Library()
# https://stackoverflow.com/a/8907269/2226755
def strfdelta(tdelta, fmt):
d = {"days": tdelta.days}
d["hours"], rem = divmod(tdelta.seconds, 3600)
d["minutes"], d["seconds"] = divmod(rem, 60)
return fmt.format(**d)
# TODO add... | ChantyTaguan/zds-site | zds/utils/templatetags/seconds_to_duration.py | Python | gpl-3.0 | 787 |
from datetime import datetime
import bencodepy
from feedparser import FeedParserDict
from sickchill import logger, settings
from sickchill.helper.common import try_int
from sickchill.oldbeard.classes import Proper, TorrentSearchResult
from sickchill.oldbeard.common import Quality
from sickchill.oldbeard.db import DBC... | Vagab0nd/SiCKRAGE | sickchill/providers/torrent/TorrentProvider.py | Python | gpl-3.0 | 3,971 |
from __future__ import division
import copy
import new
import math
import multiprocessing as mp
import time
import timeit
import shutil
import json as ujson
from tempfile import mkdtemp
import copy_reg
import numpy as np
import os
import os.path
from megaradrp.core.recipe import MegaraBaseRecipe
from numina.core im... | Pica4x6/megaradrp | megaradrp/recipes/calibration/weights.py | Python | gpl-3.0 | 15,527 |
import unittest
from mydict import Dict
class TestDict(unittest.TestCase):
def test_init(self):
d = Dict(a=1, b='test')
self.assertEqual(d.a, 1)
self.assertEqual(d.b, 'test')
self.assertTrue(isinstance(d, dict))
def test_key(self):
d = Dict()
d['key'] ... | isshe/Language | Python/20161127/11_unit_test_Dict.py | Python | gpl-3.0 | 868 |
"""
Django settings for website project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | Alex-Zamora/cms-basico-django | website/settings.py | Python | gpl-3.0 | 2,835 |
#!/usr/bin/env python
import GeePea
import numpy as np
#first define mean function in correct format
my_mean_func = lambda p,x: p[0] + p[1] * x
#create test data
x = np.linspace(0,1,50)
y = my_mean_func([1.,3.],x) + np.sin(2*np.pi*x) + np.random.normal(0,0.1,x.size)
#define mean function parameters and hyperparamet... | nealegibson/GeePea | examples/mean_function.py | Python | gpl-3.0 | 592 |
'''
Created on Aug 20, 2014
@author: valeriu
'''
import unittest
from activitytracker import ActivityError
class TestException(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_string_format(self):
exception = ActivityError(2, '{0}')
... | izzi/ActivityTracker | tests/testException.py | Python | gpl-3.0 | 509 |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from werkzeug import urls
from odoo import _, api, models
from odoo.exceptions import ValidationError
from odoo.tools.float_utils import float_compare
from odoo.addons.payment_alipay.controllers.main import AlipayController
_... | jeremiahyan/odoo | addons/payment_alipay/models/payment_transaction.py | Python | gpl-3.0 | 7,132 |
#!/usr/bin/env python3
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2015 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 pu... | r8b7xy/qutebrowser | scripts/dev/freeze.py | Python | gpl-3.0 | 4,059 |
#!/usr/bin/env python
#####################################################################################
# COMM TEST PROGRAM FOR FUJI PXG4 or PXR3 with RS485 option and modbus protocol
# This program shows how to read Temp from a Fuji PID
# ########################################################################... | MAKOMO/artisan | src/comm/CommFujiExamplePython2.6.py | Python | gpl-3.0 | 5,757 |
# -*- coding: utf-8 -*-
import re
from time import time
from module.plugins.Account import Account
class NetloadIn(Account):
__name__ = "NetloadIn"
__type__ = "account"
__version__ = "0.22"
__description__ = """Netload.in account plugin"""
__license__ = "GPLv3"
__authors__ = [... | mariusbaumann/pyload | module/plugins/accounts/NetloadIn.py | Python | gpl-3.0 | 1,342 |
import sys
import time
import os
import main_src.constants as constants
from main_src.tools.tools import get_argv
arcgis = get_argv(constants.PARAMETER_ARCGIS)
debugInfo = get_argv(constants.PARAMETER_DEBUG_PRT)
outDir = get_argv(constants.PARAMETER_PATH_TO_OUTPUT_DIRECTORY)
#logFile = open(outDir+os.sep+logF... | jerabekjak/smoderp | main_src/io_functions/prt.py | Python | gpl-3.0 | 2,490 |
# -*- coding: utf-8 -*-
"""
Unittests for DBusStore.
Please refer to ``__init__.py`` for general details.
"""
from __future__ import absolute_import, unicode_literals
import subprocess
from hamster_dbus import storage
from . import common
class TestDBusStore(common.HamsterDBusManagerTestCase):
def setUp(se... | projecthamster/hamster-dbus | tests/storage/test_dbus_store.py | Python | gpl-3.0 | 1,981 |
from itertools import cycle, izip
import logging
import re
from django.db import transaction
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
from geonode.maps.models import Map, Layer, MapLayer, Contact, ContactRole, Role, get_csw
from geonode.maps.gs_helpers import fixup_... | makinacorpus/geonode | src/GeoNodePy/geonode/maps/utils.py | Python | gpl-3.0 | 23,695 |
VERSION = (0, 5, 'pre')
# NOTE: This method was removed in 0.4.0, but restored in 0.4.2 after use-cases were
# reported that were impossible by merely subclassing MPTTModel.
def register(*args, **kwargs):
"""
Registers a model class as an MPTTModel, adding MPTT fields and adding MPTTModel to __bases__.
T... | rtts/qqq | mptt/__init__.py | Python | gpl-3.0 | 879 |
from django.db import models
# Stores metadata about observation nodes to further annotate bundles of asserions
# an observation bundles assertions
class ObsMetadata(models.Model):
source_id = models.CharField(max_length=200, db_index=True)
project_uuid = models.CharField(max_length=50, db_index=True)
obs... | portableant/open-context-py | opencontext_py/apps/ocitems/obsmetadata/models.py | Python | gpl-3.0 | 628 |
"""
Created on Tue Jul 21 13:57:18 2015
@author: thomas.douenne
"""
import pandas as pd
from ipp_macro_series_parser.config import Config
parser = Config()
transports_directory = parser.get('data', 'transports_directory')
prix_annuel_carburants = parser.get('data', 'prix_annuel_carburants_90_2014')
prix_mensuel_c... | taxipp/ipp-macro-series-parser | ipp_macro_series_parser/agregats_transports/parser_cleaner_prix_carburants.py | Python | gpl-3.0 | 8,939 |
import LibreNMS
import json
import logging
import os
import pymysql
import subprocess
import threading
import sys
import time
from datetime import timedelta
from datetime import datetime
from logging import debug, info, warning, error, critical, exception
from platform import python_version
from time import sleep
fro... | arjitc/librenms | LibreNMS/service.py | Python | gpl-3.0 | 24,575 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import os
import xmltodict
from bs4 import BeautifulSoup
from bs4 import CData
UPLOAD_DIR = '../html/uploads'
METADATA_NAME = 'metadata.xml'
PUBLISHER_NAME = 'Heidelberg University Press'
PUBLISHER_LOC = 'Heidelberg'
jsondata = [{'selected': True, 'type': 'book'}... | withanage/HEIDIEditor | static/WysiwigEditor/cgi/createJSON.py | Python | gpl-3.0 | 4,094 |
#!/usr/bin/python3
import os
import sys
import subprocess
import unittest
def testequal(a,b):
if (a==b):
print ("SUCCESS")
else:
print ("FAIL")
def getPortal():
output=subprocess.check_output(["iscsi-ls","iscsi://localhost:3260"])
print (output)
target=output[7:-25]
#Test if iSCSI portal is created (last par... | raqet/acquisition-client | testing/test-iscsi.py | Python | gpl-3.0 | 1,527 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author Pradeep Jairamani; github.com/pradeepjairamani
import socket
import socks
import time
import json
import threading
import string
import requests
import random
import os
from core.alert import *
from core.targets import target_type
from core.targets import target_t... | Nettacker/Nettacker | lib/scan/wp_timthumbs/engine.py | Python | gpl-3.0 | 10,981 |
#!/usr/bin/env python3
"""
This Project is a Python based HP ALM Purge Wizard.
This is the main file which do all stuff
For detailed informatin please visit
https://github.com/aytuncbeken/Hp-Alm-Purge-Tool
Author:Aytunc BEKEN
Python Version:3.6
License:GPL
"""
import threading
from concurre... | aytuncbeken/Hp-Alm-Purge-Tool | PurgeWizard.py | Python | gpl-3.0 | 8,814 |
"""Database access code...twistar?"""
| si618/pi-time | pi_time/pi_time/db.py | Python | gpl-3.0 | 39 |
"Implements subcommands for ``ymp init``"
import logging
import os
import shutil
import subprocess as sp
import click
import ymp
from ymp.cli.shared_options import command, group
log = logging.getLogger(__name__) # pylint: disable=invalid-name
@group()
def init():
"""Initialize YMP workspace"""
def have_co... | epruesse/ymp | src/ymp/cli/init.py | Python | gpl-3.0 | 3,545 |
# coding: utf-8
from __future__ import (absolute_import, division, print_function, unicode_literals)
import json
import logging
import boto3
import os
import sys
import time
# Path to modules needed to package local lambda function for upload
currentdir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os... | alanwill/aws-tailor | sam/functions/talr-entsupport/handler.py | Python | gpl-3.0 | 4,302 |
# coding=utf-8
import logging
import datetime
import os
filename = datetime.datetime.now().strftime("%Y-%m-%d")
path = './{0}.log'.format(filename)
logger = logging.getLogger("loggingmodule.NomalLogger")
formatter = logging.Formatter("[%(levelname)s][%(funcName)s][%(asctime)s]%(message)s")
handler = logging.FileH... | zhangxu273/JRQ-Order-Collector | JRQ Order Collector/Logger.py | Python | gpl-3.0 | 584 |
# Copyright (C) 2012 Aniket Panse <contact@aniketpanse.in
#
# 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 prog... | honeynet/beeswarm | beeswarm/drones/honeypot/tests/test_smtp.py | Python | gpl-3.0 | 7,214 |
#!/usr/bin/env python
# ============================================================================
# Project Name : iTrade
# Module Name : itrade_wxpropquote.py
#
# Description: wxPython quote properties display
#
# The Original Code is iTrade code (http://itrade.sourceforge.net).
#
# The Initial Developer ... | eternallyBaffled/itrade | itrade_wxpropquote.py | Python | gpl-3.0 | 21,182 |
from utils.edit_configs import get_json
class Logger:
config = get_json('server_configs')
log_config = {}
_instances = {}
@staticmethod
def get_singleton(client):
if client.shard_id not in Logger._instances:
Logger._instances[client.shard_id] = Logger()
return Logger.... | initzx/aobot | utils/logger.py | Python | gpl-3.0 | 3,201 |