code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#-*- coding:utf-8 -*-
import logging
logging.basicConfig(level=logging.ERROR)
from cache_abstract import CacheAbstractDriver
import asyncio
try:
import redis
except ImportError:
logging.error("Can't import 'redis' module")
exit(-1)
try:
import aioredis
except ImportError:
logging.error("Can't import... | free-free/pyblog | pyblog/cache/redis_cache.py | Python | mit | 13,227 |
#
# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
#
from ipatests.test_xmlrpc import objectclasses
from ipatests.test_xmlrpc.xmlrpc_test import fuzzy_uuid, fuzzy_sudocmddn
from ipatests.test_xmlrpc.tracker.base import Tracker
from ipatests.util import assert_deepequal
class SudoCmdTracker(Tracker... | tbabej/freeipa | ipatests/test_xmlrpc/tracker/sudocmd_plugin.py | Python | gpl-3.0 | 4,040 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This file contains basic infrastructure for running the integration test cases.
Most test cases are in v2_integration.py. There are a few exceptions: Test cases
that don't test either the v1 or v2 API are in this file, and test cases that
have to run at a specific poin... | jcjones/boulder | test/integration-test.py | Python | mpl-2.0 | 8,555 |
# -*- coding: utf-8 -*
"""
Created on 25 mars 2013
@author: francois
"""
from django.test import RequestFactory
from django.core.urlresolvers import reverse
#from django.conf import settings
from django.utils.encoding import smart_text
from gsb.io import export_base
import gsb.io.export_csv as ex_csv
from .. import... | pfrancois/grisbi_django | gsb/tests/test_exports.py | Python | bsd-3-clause | 8,580 |
import sys
from string import Template
from collections import namedtuple
from pycparser import c_parser, c_ast, parse_file
Func = namedtuple('Func', ('name', 'type', 'args'))
Arg = namedtuple('Arg', ('name', 'type'))
Type = namedtuple('Type', ('ptr', 'name', 'array'))
class FuncDeclVisitor(c_ast.NodeVisitor):
de... | helmi03/gogeos | geos/geoscapi.py | Python | mit | 4,354 |
# Made by Mr. - Version 0.3 by DrLecter
import sys
from net.sf.l2j.gameserver.model.quest import State
from net.sf.l2j.gameserver.model.quest import QuestState
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest
ZOMBIE_SKIN = 1045
ADENA = 57
HEALING_POTION = 1061
class Quest (JQuest) :
def __... | Barrog/C4-Datapack | data/jscript/quests/319_ScentOfDeath/__init__.py | Python | gpl-2.0 | 2,095 |
# encoding: utf-8
#
# Copyright (C) 2015-2018 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | SolaWing/ycmd | ycmd/tests/typescript/get_completions_test.py | Python | gpl-3.0 | 11,404 |
########################################################
# run_tp.py: throughput prediction
# Author: Jamie Zhu <jimzhu@GitHub>
# Created: 2014/2/6
# Last updated: 2016/04/26
# Implemented approach: PMF
########################################################
import __init__
import os, sys, time
import numpy as np
f... | wsdream/WS-DREAM | benchmarks/model-based/NMF/run_tp.py | Python | mit | 1,704 |
#!/usr/bin/env python
# This file is part of Openplotter.
# Copyright (C) 2015 by sailoog <https://github.com/sailoog/openplotter>
#
# Openplotter 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... | ajros/openplotter | openplotter.py | Python | gpl-2.0 | 51,921 |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | batxes/4Cin | Six_mouse_models/Six_mouse_models_final_output_0.2_-0.1_11000/Six_mouse_models30079.py | Python | gpl-3.0 | 18,207 |
# Copyright 2014 IBM Corp.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | tmenjo/cinder-2015.1.1 | cinder/tests/test_db_api.py | Python | apache-2.0 | 77,524 |
# This file is part of the Shapy Project.
# Licensing information can be found in the LICENSE file.
# (C) 2015 The Shapy Team. All rights reserved.
import StringIO
from pyrr.objects import Quaternion, Matrix44, Vector3, Vector4
class Scene(object):
"""Class representing a whole scene."""
class Object(object):
... | ICShapy/shapy | shapy/scene.py | Python | mit | 5,133 |
"""infinite_jukebox.py - (c) 2017 - Dave Rensin - dave@rensin.com
An attempt to re-create the amazing Infinite Jukebox (http://www.infinitejuke.com)
created by Paul Lamere of Echo Nest. Uses the Remixatron module to do most of the
work.
"""
import argparse
import curses
import curses.textpad
import numpy as np
impor... | drensin/Remixatron | infinite_jukebox.py | Python | apache-2.0 | 9,859 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""The task RPC server code.
This server is an XML-RPC server which serves code from
rpc_methods.RPCMethods.
This server will run until shutdown is called ... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/testing/legion/rpc_server.py | Python | mit | 4,603 |
import os
import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../../'))
sys.path.inser... | prometheanfire/cloud-init | doc/rtd/conf.py | Python | gpl-3.0 | 2,399 |
# Copyright (c) 2014 Openstack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | barnsnake351/neutron | neutron/agent/ovsdb/impl_vsctl.py | Python | apache-2.0 | 10,358 |
# Copyright 2014-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | chase-qi/workload-automation | wlauto/devices/android/juno/__init__.py | Python | apache-2.0 | 9,475 |
#!/usr/bin/env python
import sys
from magic import Magic
from lib import mp3
from lib import flac
# VERSION
VERSION = "0.3-Dev"
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
END = '\033[0m'
# Return true if is an audio file
def isAudio(file):
isAudio = False
try:
mime = Magic(mime=True)
... | JuanjoSalvador/AudioInfo-Tool | ainfo.py | Python | mit | 2,669 |
"""
@brief test log(time=8s)
@author Xavier Dupre
"""
import sys
import os
import unittest
import shutil
from contextlib import redirect_stdout
from io import StringIO
from pyquickhelper.pycode import ExtTestCase
from pyquickhelper.pycode import process_standard_options_for_setup_help, get_temp_folder
from pyq... | sdpython/pyquickhelper | _unittests/ut_pycode/test_missing_function_pycode.py | Python | mit | 3,947 |
##Created at 08/02/2017 by Yubin Xie, MSKCC
##Modified at #### by ***
## This script is to find the starting points in the binary images and find the shortest path between them
import itertools
import math
from scipy import misc
from scipy.sparse.dok import dok_matrix
from scipy.sparse.csgraph import dijkstra
import op... | YubinXie/Computational-Pathology | Track.py | Python | gpl-2.0 | 6,559 |
from setuptools import setup, find_packages
import os
import tiempo
def file_name(rel_path):
dir_path = os.path.dirname(__file__)
return os.path.join(dir_path, rel_path)
def readlines(rel_path):
with open(file_name(rel_path)) as f:
ret = f.readlines()
return ret
setup(
author="Damon",
... | jmgamboa/tiempo | setup.py | Python | gpl-2.0 | 975 |
import sys
import psychopy
from psychopy import visual, core
import numpy as np
import scipy.ndimage
import matplotlib.pyplot as plt
import matplotlib as mpl
from PIL import Image
# import hmax
class Filters(object):
def gabor(self,theta=0, gamma=1, sigma=2, lam=5.6,k=10):
# g = np.exp(-np.pi*((alpha*x)**2... | qbilius/autoart | megztinis/megztinis.py | Python | mit | 15,781 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# tvalacarta
# XBMC Launcher (xbmc / xbmc-dharma / boxee)
# http://blog.tvalacarta.info/plugin-xbmc/
#------------------------------------------------------------
import urllib
import urllib2
import os
import re
import sys
from core... | conejoninja/pelisalacarta | python/main-classic/platformcode/launcher.py | Python | gpl-3.0 | 36,282 |
#!/usr/bin/env python
""" Script for capturing a panorama scene using a stepper motor
to rotate the Raspberry PI Camera module
Copyright (C) 2013 Harald Vistnes <harald.vistnes@gmail.com>
"""
import RPi.GPIO as GPIO
import time
import os
import math
import photocell
import temp
halfSteps = 3
# motor speed... | HaraldVistnes/PiPano | PiPano.py | Python | gpl-2.0 | 3,594 |
from django.contrib import admin
from feedthefox.devices.models import Build, Device, DeviceInfo
@admin.register(DeviceInfo)
class DeviceInfoAdmin(admin.ModelAdmin):
list_display = ('get_mozillian_username', 'device', 'imei',)
def get_mozillian_username(self, obj):
return obj.user.mozillian_username... | akatsoulas/feedthefox | feedthefox/devices/admin.py | Python | mpl-2.0 | 634 |
# -*- coding: utf-8 -*-
"""
Compare weights of two models layer wise.
The stats are printed in the terminal.
"""
from keras.models import load_model, Model
import numpy as np
import argparse
from scripts.util.custom_loss_functions import get_custom_objects
def parse_input():
parser = argparse.ArgumentParser(des... | StefReck/Km3-Autoencoder | compare_saved_models.py | Python | mit | 2,260 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# This file is part of IsCoder.
# IsCoder 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 versio... | iven/IsCoder | IsCoder/Profile.py | Python | gpl-2.0 | 2,665 |
import unittest
import sys
import greenlet
class ArgRefcountTests(unittest.TestCase):
def test_arg_refs(self):
args = ('a', 'b', 'c')
g = greenlet.greenlet(
lambda *args: greenlet.getcurrent().parent.switch(*args))
for i in range(100):
g.switch(*args)
self.a... | 2013Commons/HUE-SHARK | desktop/core/ext-py/greenlet-0.3.1/tests/test_leaks.py | Python | apache-2.0 | 631 |
import ntpath, logging
import os
from gevent import sleep
from cme.helpers.misc import gen_random_string
from impacket.dcerpc.v5.dcomrt import DCOMConnection
from impacket.dcerpc.v5.dcom import wmi
from impacket.dcerpc.v5.dtypes import NULL
class WMIEXEC:
def __init__(self, target, share_name, username, password,... | jorik041/CrackMapExec | cme/protocols/smb/wmiexec.py | Python | bsd-2-clause | 5,326 |
from block_linked_list import BlockLinkedList
from block import Block
from memory_request import MemoryRequest
class MemoryManager(Thread):
def __init__(self, mem_size, list_processes):
Thread.__init__(self)
block = Block(mem_size, 0)
self.free_blocks = [block]
self.busy_blocks = []
self.blocks = BlockLin... | WLSF/os-scheduler-simulator | Memory Management/memory_manager.py | Python | mit | 552 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Garn documentation build configuration file, created by
# sphinx-quickstart on Sun Jul 3 22:44:05 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... | nat13ejo/garn | docs/source/conf.py | Python | mit | 9,285 |
#Credit to http://www.forensicswiki.org/wiki/Windows_Prefetch_File_Format and https://github.com/libyal/libscca/blob/master/documentation/Windows%20Prefetch%20File%20(PF)%20format.asciidoc for file format info
import argparse
import sys
import struct
import datetime
import binascii
import os
#def usage():
#... | ohxeighty/prefetchExplorer | prefetchexplorer.py | Python | mit | 6,380 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/python-aiplatform | samples/snippets/model_service/get_model_evaluation_text_classification_sample.py | Python | apache-2.0 | 2,069 |
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | rakeshmi/cinder | cinder/api/contrib/volume_image_metadata.py | Python | apache-2.0 | 5,016 |
# -*- coding: utf-8 -*-
#
# This file is part of EUDAT B2Share.
# Copyright (C) 2015, 2016, University of Tuebingen, CERN.
#
# B2Share 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
# ... | emanueldima/b2share | b2share/config.py | Python | gpl-2.0 | 14,878 |
# coding:utf-8
'''
@Copyright:LintCode
@Author: lilsweetcaligula
@Problem: http://www.lintcode.com/problem/add-binary
@Language: Python
@Datetime: 17-02-15 14:35
'''
class Solution:
# @param {string} a a number
# @param {string} b a number
# @return {string} the result
def addBinary(self, a, b):
... | lilsweetcaligula/Online-Judges | lintcode/easy/add_binary/py/add_binary.py | Python | mit | 1,246 |
from zope.interface import implementer
from twisted.python import usage
from twisted.plugin import IPlugin
from twisted.application.service import IServiceMaker
import duct
from duct.configuration import ConfigFile
class Options(usage.Options):
optParameters = [
["config", "c", "duct.yml", "Config fil... | ducted/duct | twisted/plugins/duct_plugin.py | Python | mit | 652 |
#coding: utf-8
import cplex
from cplex.exceptions import CplexError
import csv
import time
from igraph import Graph
class RegnierProblem:
"""Regnier Problem Class
Clustering qualitative data through Integer Linear Programming.
Attributes:
S (list of list of int): Similarity Mat... | LuizHNLorena/Regnier-Problem | RegnierProblem.py | Python | mit | 40,062 |
import sys
import csv
import pickle
import numpy as np
from sklearn import svm
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
from sklearn.preprocessing import StandardScaler
training_data = []
training_classes = []
test_data = []
test_classes = []
path = '../../data/'
filename = pa... | PMantovani/road-irregularity-detector | classification_algorithm/src/svm_training.py | Python | apache-2.0 | 4,872 |
# -*- coding: utf-8 -*-
from django.contrib import admin
# from .models import AssociatedBox
# admin.site.register([AssociatedBox])
| rosscdh/django-box | dj_box/admin.py | Python | mit | 135 |
#Pyjsdl - Copyright (C) 2013 James Garnon <https://gatc.ca/>
#Released under the MIT License <https://opensource.org/licenses/MIT>
from pyjsdl.pyjsobj import Audio
from pyjsdl.time import Time
from pyjsdl import env
from pyjsdl import constants as Const
__docformat__ = 'restructuredtext'
class Mixer:
"""
**... | jggatc/pyjsdl | pyjsdl/mixer.py | Python | mit | 24,241 |
import os
import sys
from . import quickstart
QUICKSTART_DONE = 'MIQ_RUNTEST_QUICKSTART_DONE'
def main():
if QUICKSTART_DONE not in os.environ:
quickstart.main(quickstart.args_for_current_venv())
os.environ[QUICKSTART_DONE] = QUICKSTART_DONE
os.execl(sys.executable, sys.executable, *sys.a... | RedHatQE/cfme_tests | cfme/scripting/runtest.py | Python | gpl-2.0 | 379 |
from .y import *
print("x")
| pfalcon/micropython | tests/import/pkg6/x/__init__.py | Python | mit | 29 |
'''
Selection tests
===============
'''
import unittest
from kivy.uix.widget import Widget
from kivy.uix.listview import ListView, ListItemButton
from kivy.properties import NumericProperty, StringProperty
from kivy.adapters.listadapter import ListAdapter
from kivy.adapters.dictadapter import DictAdapter
from kivy.a... | tony/kivy | kivy/tests/test_selection.py | Python | mit | 21,558 |
import csv
import os
import logging
import re
import shutil
import tarfile
import glob
from datetime import datetime
from stat import ST_CTIME
import requests
from dipper.sources.Source import Source
from dipper.models.assoc.D2PAssoc import D2PAssoc
from dipper.models.Reference import Reference
from dipper.models.Mode... | TomConlin/dipper | dipper/sources/HPOAnnotations.py | Python | bsd-3-clause | 20,186 |
# Fall 2015 6.034 Lab 3: Games
import xmlrpclib
import traceback
import sys
import os
import tarfile
from game_api import (AbstractGameState, ConnectFourBoard, is_class_instance,
always_zero)
from toytree import (ToyTree, toytree_is_game_over, toytree_generate_next_states,
t... | jasonleaster/MIT_6.034_2015 | lab3/tester.py | Python | gpl-2.0 | 15,284 |
#!/usr/bin/env python
#
# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | julroy67/noto-emoji | generate_emoji_html.py | Python | apache-2.0 | 21,896 |
"""Test that model instances and relationships are created to database."""
from mars_street_view.models import DBSession, Rover, Photo, Camera
import pytest
def test_db_is_empty(dbtransaction, model_name):
"""Test that the database is empty of each model at test session start."""
model = globals()[model_name]... | mars-street-view/mars-street-view | mars_street_view/tests/test_models.py | Python | mit | 7,828 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2014, Nigel Small
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | fpieper/py2neo | test/core/1-main/neo4j_node_match_test.py | Python | apache-2.0 | 3,176 |
import os, sys
from django import setup
from django.conf import settings, global_settings
# Default settings for Django 1.7 applications
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django... | DarrenFrenkel/django-rea-people | runtests.py | Python | mit | 1,348 |
import base64
import functools
import inspect
import requests
from django.conf import settings
from django.utils.encoding import force_str
from django.utils.module_loading import import_string
class PermissionDenied(Exception):
pass
def create_report(request=None):
"""Run all checks and return a tuple cont... | mvantellingen/django-healthchecks | src/django_healthchecks/checker.py | Python | mit | 3,175 |
# -*- coding: utf-8 -*-
import collections
import datetime
import errno
import gzip
import io
import os
import sqlite3
import time
from beaver.utils import IS_GZIPPED_FILE, REOPEN_FILES, multiline_merge
from beaver.unicode_dammit import ENCODINGS
from beaver.base_log import BaseLog
class Tail(BaseLog):
"""Follow... | python-beaver/python-beaver | beaver/worker/tail.py | Python | mit | 20,826 |
# Copyright 2020 Google, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/serverless-expeditions | webhooks-with-cloud-run/MicroServices/Slack/slack_test.py | Python | apache-2.0 | 1,775 |
class BaseDatabaseValidation:
"""
This class encapsulates all backend-specific validation.
"""
def __init__(self, connection):
self.connection = connection
def check(self, **kwargs):
return []
def check_field(self, field, **kwargs):
return []
| mattseymour/django | django/db/backends/base/validation.py | Python | bsd-3-clause | 293 |
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
def table(t, name, sites_names, singulars):
font = {'size' : 32}
matplotlib.rc('font', **font)
t = np.around(t, decimals=2)
dc = 0.2 # color depth
left, width = 0.1, 0.9
bottom, height = 0.2, 0.9
M_table = [left, botto... | maxivanoff/fftoolbox | visual.py | Python | gpl-2.0 | 731 |
# Download the Python helper library from twilio.com/docs/python/install
import os
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
# To set up environmental variables, see http://twil.io/secure
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_... | TwilioDevEd/api-snippets | sync/rest/streams/retrieve-stream/retrieve-stream.7.x.py | Python | mit | 516 |
from django.db import models
from django.contrib.auth.models import User
from easy_thumbnails.fields import ThumbnailerImageField
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
#from django.utils import timezone
def pkgen()... | polypmer/obligarcy | obligarcy/models.py | Python | gpl-3.0 | 4,959 |
COMP_PREFIX_LIST_MODEL={
"":{'tags':(u"", ), "vocalized":(u"", )},
u'ب':{'tags':(u'جر', ), "vocalized":(u"بِ", )},
u'ل':{'tags':(u'جر', ), "vocalized":(u"لِ", )},
u'ال':{'tags':(u'تعريف', ), "vocalized":(u"الْ", )},
u'بال':{'tags':(u'جر', u'تعريف', ), "vocalized":(u"بِالْ", )},
u'لل':{'tags':(u'جر', u'تعريف', ), "... | linuxscout/arramooz | scripts/nouns/t.py | Python | gpl-2.0 | 2,802 |
'''
Module Gets all of the messages for an account
'''
from Module import *
import mailbox
import ScriptUtils
class testRootModuleMarkedAsLink(Module):
name = "Get Account Messages (Should Not be Visible!)"
description = "This module loads all the messages in a specified account"
root = False
output ... | grzgrzgrz3/tbscript-plugin | modules/testRootModuleMarkedAsLink.py | Python | gpl-3.0 | 1,122 |
"""
This module contains a single class that manages the scraping of data
from one or more supermarkets on mysupermarket.co.uk
"""
from datetime import datetime
from os import remove
from os.path import isfile, getmtime
from time import time
from scrapy import signals
from scrapy.crawler import Crawler
from scrapy.uti... | hmcc/price-search | scraper/scraper.py | Python | mit | 3,591 |
""" Settings for Django project """
import os
DEBUG = os.environ.get("DEBUG", False)
SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'
USE_L10N = True
USE_TZ = True
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
PROJECT... | cschwede/django-swiftbrowser | swiftbrowser/settings.py | Python | apache-2.0 | 2,292 |
# -*-coding:iso-8859-1 -*
import pygame,pdb,math
from pygame.locals import *
from .constantes import *
from .observateur import *
from .zonePensee import *
from .joueur import *
from .interrupteur import *
class BoiteOutils():
"""Classe permettant aux évènements d'accéder à des méthodes diverses pour réaliser de... | Rastagong/narro | Releases/0.1/narro/boiteOutils.py | Python | mit | 21,446 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016-2017 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | dpniel/snapcraft | integration_tests/test_store_download.py | Python | gpl-3.0 | 1,253 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-04-20 09:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0035_referent_project'),
]
operations = [
migrations.AddField(
... | MEEM-MLHD/territoire_conseil | src/projects/migrations/0036_auto_20170420_0938.py | Python | bsd-3-clause | 1,367 |
import unittest
import scipy as sp
import numpy as np
import sys
from limix.core.covar.dirIndirCov import DirIndirCov
from limix.utils.check_grad import mcheck_grad
class TestDirIndirCov(unittest.TestCase):
def setUp(self):
sp.random.seed(1)
# generate data
n = 10
f = 2
X ... | PMBio/limix | limix/core/covar/test/test_dirIndirCov.py | Python | apache-2.0 | 1,089 |
# bryde.utils
# Utilities for the NLTK Tutorial/Bryde module.
#
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com>
# Created: Sat May 28 21:43:21 2016 -0700
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: utils.py [] benjamin@bengfort.com $
"""
Utilities for th... | DistrictDataLabs/PyCon2016 | notebooks/tutorial/bryde/utils.py | Python | mit | 940 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import json, web
from lib.log import Log
class Env(object):
@staticmethod
def get(key):
if key and key in web.ctx.env:
return web.ctx.env[key]
else:
return web.ctx.env
@staticmethod
def set(key, value):
web.ctx.env[key] = value
@staticmethod
def setFro... | ZiTAL/zpy | private/lib/env.py | Python | agpl-3.0 | 439 |
#!/usr/bin/python
import dbus
bus = dbus.SessionBus()
proxy_obj = bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus')
dbus_iface = dbus.Interface(proxy_obj, 'org.freedesktop.DBus')
print "\n\nALL DBUS SERVICES -------------------------------------"
print dbus_iface.ListNames()
print "\n\nSEAHORSE DBUS ... | nobled/seahorse | tests/dbus-match-test.py | Python | gpl-2.0 | 792 |
"""
by Gravitium, 2015
version alpha
class math + function understand
"""
import math
class Math:
h = 6.62607004 * 10 ** -34
c = 299792458
G = 6.67384 * 10 ** -11
hbar = 1.054571726 * 10 ** -34
k = 1.3806488 * 10 ** - 23
electron_mass = 9.10938291 * 10 ** -31
golden = (1 + math.sqrt(5))/... | Gravitium/mif | mif.py | Python | cc0-1.0 | 10,597 |
from django.shortcuts import render, get_object_or_404
from .models import Category, Product
from .recommender import Recommender
from cart.forms import CartAddProductForm
def product_list(request, category_slug=None):
# price_filter_start = request.GET.get('price_filter_start', None)
# price_filter_end = req... | spectrumone/online-shop-template | myshop/shop/views.py | Python | mit | 1,601 |
import offshoot
offshoot.discover("Game", globals()) | SerpentAI/SerpentAI | serpent/games/__init__.py | Python | mit | 52 |
# Define Class Spectrograph
class SpecLine(object):
"""A line
These objects are spectrographs used in astronomy.
Units for minwave/maxwave/width are Angstrom.
"""
# - Attribute names are fixed. Therefore the __slots__
# - Ideally their values should be fixed as well (private) once initialized
# ... | guangtunbenzhu/BGT-Cosmology | Spectroscopy/speclines.py | Python | mit | 13,127 |
import bottle
def post_get(name, default=''):
return bottle.request.POST.get(name, default).strip()
def request_get_param(name, default=''):
return bottle.request.GET.get(name, default).strip()
def request_put_param(name, default=''):
return bottle.request.params.get(name, default).strip()
| antljones/opportunir | requestwrapper.py | Python | gpl-2.0 | 306 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 by Christian Tremblay, P.Eng <christian.tremblay@servisys.com>
# Licensed under LGPLv3, see file LICENSE in this source tree.
#
"""
Match.py - verify a point's status matches its commanded value.
Example:
Is a fan commanded to 'On' actually... | ChristianTremblay/BAC0 | BAC0/tasks/Match.py | Python | lgpl-3.0 | 3,267 |
# -*- coding: utf-8 -*-
from bdchecker.api import NewDatabaseTaskChecker
from bdcheckerapp.autograding.zaj5.unit5.utils import Zaj5TaskChecker, UserList
class TaskChecker(NewDatabaseTaskChecker):
display_stdout = True
class TestSuite(Zaj5TaskChecker):
def test_has_procedure(self):
self.... | jbzdak/data-base-checker | bdcheckerapp/autograding/zaj5/unit5/task3.py | Python | gpl-3.0 | 1,459 |
class Dog ():
def __init__(self, breed):
self.breed = breed
def bark(self):
return "Woof"
snoopy = Dog("Beagle")
scoobydoo = Dog("Great Dane")
| NendoTaka/CodeForReference | CodeWars/8kyu/barkingMad.py | Python | mit | 175 |
#
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | alxgu/ansible | lib/ansible/plugins/action/iosxr.py | Python | gpl-3.0 | 5,013 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "roses_project.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| cmdelatorre/roses | manage.py | Python | gpl-2.0 | 256 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'ProjectApplication.limit_on_members_number'
db.alter_column('im_projectapplication', 'li... | grnet/synnefo | snf-astakos-app/astakos/im/migrations/old/0070_auto__chg_field_projectapplication_limit_on_members_number.py | Python | gpl-3.0 | 26,128 |
"""
This file defines a reform.
A reform is a set of modifications to be applied to a reference tax and benefit system to carry out experiments.
See https://openfisca.org/doc/key-concepts/reforms.html
"""
# Import from openfisca-core the Python objects used to code the legislation in OpenFisca
from openfisca_core.re... | openfisca/country-template | openfisca_country_template/reforms/removal_basic_income.py | Python | agpl-3.0 | 866 |
import requests
def bricksnpieces_cookies(country='no'):
"""
Bricks&Pieces requires a couple of cookies to be set to fetch data.
State 3 is sale.
"""
return {'csAgeAndCountry': '{"age":"18","countrycode":"%s"}' % country.upper(),
'csRpFlowState': '{"state":3}', 'country': country.upper... | jensadne/brixdb | brixdb/service/bricksnpieces.py | Python | mit | 1,530 |
#!/usr/bin/env python
from __future__ import print_function
print ("Error message") | kartikthapar/jhu_snp_votingmachine | tests/TestPrint.py | Python | mit | 85 |
# Copyright 2013 Cloudbase Solutions Srl
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | eharney/nova | nova/virt/hyperv/migrationops.py | Python | apache-2.0 | 12,086 |
from django.db import models
from django.utils.translation import ugettext as _
from event_kiosk.presentations.models import Presentation
class Kiosk(models.Model):
name = models.SlugField(_('name'))
presentation = models.ForeignKey(to=Presentation, related_name='+', null=True, blank=True)
presentation_cal... | DesjardinsLab/event-kiosk | backend/event_kiosk/event_kiosk/kiosks/models.py | Python | mit | 848 |
import os
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from cacheops.simple import file_cache, FILE_CACHE_DIR
class Command(BaseCommand):
help = 'Clean filebased cache'
def handle(self, **options):... | dpetzold/django-cacheops | cacheops/management/commands/cleanfilecache.py | Python | bsd-3-clause | 407 |
# Copyright: (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ast import l... | fxfitz/ansible | lib/ansible/constants.py | Python | gpl-3.0 | 6,935 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 Mark Sandstrom
# Copyright (c) 2011-2015 Raphaël Barrois
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without ... | muhammad-ammar/factory_boy | factory/faker.py | Python | mit | 3,079 |
import os
from qtpy import QtWidgets
from glue.utils.qt import load_ui
from glue.external.echo.qt import autoconnect_callbacks_to_qt
from glue_vispy_viewers.utils import fix_tab_widget_fontsize
class ScatterLayerStyleWidget(QtWidgets.QWidget):
def __init__(self, layer_artist):
super(ScatterLayerStyle... | PennyQ/astro-vispy | glue_vispy_viewers/scatter/layer_style_widget.py | Python | bsd-2-clause | 3,165 |
#!/usr/bin/env python
#
# Copyright (C) 2011, 2012 Google Inc.
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe 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
# (... | dagorret/YouCompleteMe | python/ycm/base.py | Python | gpl-3.0 | 5,708 |
from pyvisdk.esxcli.executer import execute_soap
from pyvisdk.esxcli.base import Base
class SoftwareSourcesProfile(Base):
'''
Query depot contents image profiles
'''
moid = 'ha-cli-handler-software-sources-profile'
def list(self, depot, proxy=None):
'''
List all the image profiles ... | xuru/pyvisdk | pyvisdk/esxcli/handlers/ha_cli_handler_software_sources_profile.py | Python | mit | 1,748 |
# ! /usr/bin/env python
# _*_ coding:utf-8 _*_
"""
@author = lucas.wang
@create_time = 2018-02-02
DESC:FTP上传功能
"""
import os, ftplib
import time, socket
nonpassive = False
remotesite = "172.16.1.215"
remoteport = 22
remotedir = "/home/tomcat/deployment/apache-tomcat-7.0.47-ic/webapps/UpdateClient"
remoteuser = ... | Lucas-Wong/ToolsProject | FTP/Client_ftp.py | Python | gpl-3.0 | 2,574 |
from utils.exceptions import *
from utils.scraper import Scraper
import os
class Wallhaven(Scraper):
def __init__(self, base_dir, url_header, log_file):
super().__init__(log_file)
self._base_dir = base_dir
self._url_header = url_header
def get_latest(self):
"""
Parse ... | keeper-of-data/web-scraper | modules/wallhaven.py | Python | mit | 4,101 |
__author__ = 'rls'
class Robot:
"""Represents a robot, with a name."""
# A class variable, counting the number of robots
population = 0
def __init__(self, name):
"""Initializes the data."""
self.name = name
print('(Initializing {})'.format(self.name))
# When this pers... | rlsharpton/byte-of-Python | oop_objvar.py | Python | gpl-2.0 | 1,127 |
"""
exec_command
Implements exec_command function that is (almost) equivalent to
commands.getstatusoutput function but on NT, DOS systems the
returned status is actually correct (though, the returned status
values may be different by a factor). In addition, exec_command
takes keyword arguments for (re-)defining enviro... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/numpy/distutils/exec_command.py | Python | mit | 8,663 |
from __future__ import print_function
from __future__ import division
from .checkpoint import *
from .pars import *
from .domain import *
from . import util
from . import plot
from . import geom
from . import calc
| NYU-CAL/Disco | Python/discopy/__init__.py | Python | gpl-3.0 | 215 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Gewas.edi_naam'
db.alter_column('pestileaks_gewas', 'edi_naam', self.gf('django.db.models... | ivorbosloper/pestileaks | pestileaks/migrations/0011_auto__chg_field_gewas_edi_naam.py | Python | gpl-2.0 | 4,668 |
#
# Copyright 2014 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | ChinaMassClouds/copenstack-server | openstack/src/ceilometer-2014.2.2/ceilometer/network/statistics/port.py | Python | gpl-2.0 | 2,828 |
from __future__ import with_statement
import os
import warnings
import pickle
import math
import numpy as np
def getMatplotlibVersion():
"""
Get matplotlib version information.
:returns: Matplotlib version as a list of three integers or ``None`` if
matplotlib import fails.
"""
try:
... | askielboe/JAVELIN | javelin/psd.py | Python | gpl-2.0 | 4,690 |
'''
Created on 28/9/2015
@author: prodrig
'''
import logging
import pprint
import ckan.plugins as p
from ckanext.spatial.interfaces import ISpatialHarvester
from ckanext.spatial.harvesters.base import guess_resource_format
from ckanext.spatial.harvesters import CSWHarvester
#class CswHarvesterGeoslab(p.SingletonPlu... | oeg-upm/OTALEX-C | ckanext-geoslab_spatial/ckanext/geoslab_spatial/harvesters/csw_geoslab.py | Python | apache-2.0 | 2,846 |
#! /usr/bin/python
## This script allows to create automaticaly a test bench application based on the ConfigFile.xls
## Developed by Maurizio Montis (INFN Legnaro - Italy) and Jean-Francois DENIS (CEA - France)
## Mails: maurizio.montis@lnl.infn.it and jfdenis@cea.fr
import xlrd # Library for developers to extract... | Jack-at-LNL/funtests | tool/autobuild-TestScript.py | Python | gpl-3.0 | 7,132 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.