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 -*-
"""
***************************************************************************
sql_dictionary.py
---------------------
Date : December 2015
Copyright : (C) 2015 by Hugo Mercier
Email : hugo dot mercier at oslandia dot com
**********... | wonder-sk/QGIS | python/plugins/db_manager/db_plugins/vlayers/sql_dictionary.py | Python | gpl-2.0 | 10,043 |
"""
Utils to get schedresources info from dedicated information system (CRIC)
"""
import urllib3
import json
import logging
from django.core.cache import cache
from core.schedresource.models import SchedconfigJson
from core.settings.config import CRIC_API_URL, DEPLOYMENT
_logger = logging.getLogger('bigpandamon')
... | PanDAWMS/panda-bigmon-core | core/schedresource/utils.py | Python | apache-2.0 | 8,706 |
# -*- coding: utf-8 -*-
"""
Passes through commands to the created device.
"""
from __future__ import unicode_literals, print_function
class DeviceFactory:
def __init__(self, factory):
self.factory = factory
def address(self):
return self.factory.address()
def reading(self):
ret... | chrisramsay/pysense | pysense/device/device_factory.py | Python | gpl-2.0 | 462 |
"""Run Alleyoop collapse tool on Slamdunk results."""
import os
import pandas as pd
from plumbum import TEE
from resolwe.process import Cmd, DataField, FileField, StringField
from resolwe_bio.process.runtime import ProcessBio
def compute_tpm(tcount):
"""Normalize readCount column to TPM values."""
exp = pd... | genialis/resolwe-bio | resolwe_bio/processes/slamdunk/alleyoop_collapse.py | Python | apache-2.0 | 3,626 |
# -*- coding: utf-8 -*-
"""
@author: Stijn Van Hoey
pySTAN: python STRucture ANalyst
"""
import numpy as np
import matplotlib.pyplot as plt
from evaluationfunctions import Evaluation, Likelihood
from sensitivity_base import SensitivityAnalysis
from sensitivity_dynamic import DynamicSensitivity
from se... | stijnvanhoey/pystran | pystran/__init__.py | Python | bsd-3-clause | 682 |
# -*- coding: utf-8 -*-
"""
This module contains a POI Manager core class which gives capability to mark
points of interest, re-optimise their position, and keep track of sample drift
over time.
Qudi is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as publish... | childresslab/MicrocavityExp1 | logic/poi_manager_logic.py | Python | gpl-3.0 | 35,041 |
# coding: utf-8
"""
MIT License
Copyright (c) 2019 Claude SIMON (https://q37.info/s/rmnmqd49)
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 limit... | epeios-q37/epeios | other/exercises/Hangman/workshop/_/_.py | Python | agpl-3.0 | 1,462 |
import boto.swf.layer2 as swf
from garcon import activity
from garcon import runner
import logging
import random
logger = logging.getLogger(__name__)
domain = 'dev'
name = 'workflow_sample'
create = activity.create(domain, name)
def activity_failure(context, activity):
num = int(random.random() * 4)
if nu... | pkuong/garcon | example/test_flow.py | Python | mit | 1,119 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('package', '0004_package_parsed_pkgbuild'),
]
operations = [
migrations.AddField(
model_name='package',
... | maikelwever/autoaurbuilder | autoaurbuilder/package/migrations/0005_package_extra_deps.py | Python | gpl-3.0 | 407 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2013 John Ralls <jralls@ceridwen.us>
# Copyright (C) 2020 Nick Hall <nick-h@gramps-project.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
... | SNoiraud/gramps | gramps/gen/utils/resourcepath.py | Python | gpl-2.0 | 4,665 |
#! /usr/bin/python
import sys, re, os
def generateFile(input_directory, file_name, output_directory,
package_heirarchy=None, module_name=None):
"""Generate a rst file telling sphinx to just generate documentation
for the public interface automatically. Output will be written to
*file_nam... | pnasrat/yum | docs/sphinxdocs/rstgenerator.py | Python | gpl-2.0 | 7,752 |
import sys
from fsgamesys.plugins.pluginmanager import PluginManager
"""
DOSBox-FS launcher script used for testing.
"""
def app_main():
executable = PluginManager.instance().find_executable("dosbox-fs")
process = executable.popen(sys.argv[1:])
process.wait()
| FrodeSolheim/fs-uae-launcher | launcher/apps/dosbox_fs.py | Python | gpl-2.0 | 276 |
# Be careful, this version is tweaked by Malte to avoid raising string exceptions...
"""Contains classes for a plain-text, client-server dbms.
Classes:
KirbyBase - database class
KBError - exceptions
Example:
from db import *
db = KirbyBase()
db.create('plane.tbl', ['name:str', 'country:str', '... | COSMOGRAIL/COSMOULINE | pipe/modules/kirbybase.py | Python | gpl-3.0 | 92,500 |
#!/usr/bin/env python
# Modification History
# 01/28/2017 Add jsdoc2md and some print statements to trace what's going on. Brian S Hayes (Hayeswise)
# 02/04/2017 Add if exists check around distribution file rather than use try block. Brian S Hayes (Hayeswise)
import glob
import time
import re
import io
import base64
... | hayeswise/ingress-intel-total-conversion | wise-build.py | Python | isc | 17,501 |
'''
To create the wheel run - python setup.py bdist_wheel
'''
from setuptools import setup
import os, sys
packages = []
root_dir = os.path.dirname(__file__)
if root_dir:
os.chdir(root_dir)
for dirpath, dirnames, filenames in os.walk('lcopt'):
# Ignore dirnames that start with '.'
if '__init__.py' in file... | pjamesjoyce/lcopt | setup.py | Python | bsd-3-clause | 4,911 |
import datetime
from ...place import Place
from ...spec import Spec
from .planet import Planet
from .dwarfplanet import DwarfPlanet
class System(Place):
"""Systems exist within galaxies, and can contain planets...
Attributes
allowedChildEntities Entity spec types that can be created from this context
spec ... | Jerad-M/ubfs | classes/custom/place/system.py | Python | apache-2.0 | 1,201 |
#!/usr/bin/python
#SSH BruteForcer
#http://www.darkc0de.com
#d3hydr8[at]gmail[dot]com
import sys, time
try:
import pexpect, pxssh
except(ImportError):
print "\nYou need the pexpect module."
print "http://www.noah.org/wiki/Pexpect\n"
sys.exit(1)
def brute(word):
print "Trying:",word
try:
s = pxssh... | knightmare2600/d4rkc0de | bruteforce/sshbrute.py | Python | gpl-2.0 | 1,327 |
import os
from weasyprint import HTML
import pyinotify
class EventHandler(pyinotify.ProcessEvent):
def process_IN_CREATE(self, event):
if event.pathname.endswith(".html"):
print "Creating:", event.pathname
print "Loading file"
wprint = HTML(filename=event.pathname)
... | cnelsonsic/Certificator | certificator/renderer.py | Python | agpl-3.0 | 1,252 |
"""
Support for Zwave cover components.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/cover.zwave/
"""
# Because we do not compile openzwave on CI
# pylint: disable=import-error
import logging
from homeassistant.components.cover import (
DOMAIN, SUPPOR... | morphis/home-assistant | homeassistant/components/cover/zwave.py | Python | apache-2.0 | 5,545 |
import unittest
import random
from stanford_algoritms_part1.build_blocks import partioners
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
self.seq = range(10)
def test_shuffle(self):
# make sure the shuffled sequence does not lose any elements
random.shuffle(self.se... | zaqwes8811/my-courses | my-cs/intern/java_details/java_sort_selection_details/partioners_test.py | Python | apache-2.0 | 637 |
from django.db import models
from django.utils.crypto import get_random_string
# Create your models here.
class NagMessage(models.Model):
nag_id = models.CharField(max_length=32)
message = models.TextField(null=True)
enable = models.BooleanField(default=False)
@staticmethod
def get():
if... | Maronato/SpottedBot | main/models.py | Python | agpl-3.0 | 797 |
import requests
from .Backup import Backup
from .BackupContainer import BackupContainer
from .Bridge import Bridge
from .BridgeCreate import BridgeCreate
from .BridgeCreateSetting import BridgeCreateSetting
from .CPUInfo import CPUInfo
from .CPUStats import CPUStats
from .CloudInit import CloudInit
from .Cluster impo... | zero-os/0-orchestrator | pyclient/zeroos/orchestrator/client/__init__.py | Python | apache-2.0 | 5,568 |
#!/usr/bin/env python3
#
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
"""Script to create snapshot bin file."""
import getopt
import optparse
import os... | dart-lang/sdk | runtime/tools/create_snapshot_bin.py | Python | bsd-3-clause | 5,553 |
# ADXL345 Python Check Vibration
#
# author: Ben Jung
# license: BSD
from adxl345 import ADXL345
from math import sqrt
import time
import requests
URL = 'http://admin.kaist.ac.kr:3535/get_data?'
ID = '1'
ON_OFF_STANDARD = 0.12
SLEEP_DELAY = 0.1
ACCUMULATED_NUMBER = 10
ACCUMULATED_STANDARD = 10
# Use BLE Beacon
B... | ben-jung/iow-rpi | sensor.py | Python | bsd-2-clause | 2,702 |
#!/usr/bin/python
# Copyright 2002 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# Tests that 'make' accepts target from other directories and that
# build request for those targets can be overriden.
fro... | gorkinovich/DefendersOfMankind | dependencies/luabind/boost-build/test/m1-02.py | Python | gpl-3.0 | 3,178 |
#
# 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, software
# ... | dragorosson/heat | heat/db/sqlalchemy/migrate_repo/versions/050_stack_tags.py | Python | apache-2.0 | 871 |
# (C) British Crown Copyright 2010 - 2017, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | QuLogic/iris | lib/iris/tests/system_test.py | Python | gpl-3.0 | 3,658 |
#################################################################################
# This file is the ftsolver module, which solves fault trees.
# It was developed by Paul S. Boneham. Copyright (C) 2015 Paul S. Boneham
#
# This program is free software: you can redistribute it and/or modify
# it under ... | pboneham/fault_tree_solver | fault_tree_nwx.py | Python | agpl-3.0 | 6,929 |
# encoding: utf-8
def fizzbuzz(number):
pass
| haikoschol/kata_quickstart | python/kata.py | Python | mit | 51 |
from .main import Boxcar2
def start():
return Boxcar2()
config = [{
'name': 'boxcar2',
'groups': [
{
'tab': 'notifications',
'list': 'notification_providers',
'name': 'boxcar2',
'options': [
{
'name': 'enabled',
... | entomb/CouchPotatoServer | couchpotato/core/notifications/boxcar2/__init__.py | Python | gpl-3.0 | 893 |
from setuptools import setup
setup(
name='scrutiny',
version='0.0.1',
description='',
author='Luke Macken',
author_email='lmacken@redhat.com',
url='https://github.com/lmacken/scrutiny',
install_requires=["fedmsg"],
packages=[],
entry_points="""
[moksha.consumer]
scm_consumer... | lmacken/scrutiny | setup.py | Python | gpl-3.0 | 368 |
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(16, GPIO.IN)
count = 0
try:
while True:
inputValue = GPIO.input(16)
if (inputValue == True):
count = count + 1
print("Button pressed " + str(count) + " times.")
time.sleep(.3)
time.sleep(0.25)
except KeyboardInterrupt:
pass
GPIO.cl... | IanMezza/GPIO-101 | basicUsage/button.py | Python | mit | 327 |
import serial
import csv
ser = serial.Serial()
millis = 0
port = input('COM Port [10]: ') or 10
destination = input('Output File [./data.csv]: ') or './data.csv'
ser.port = int(port)
ser.open()
with open(destination, 'w', encoding='utf8', newline='') as f:
writer = csv.writer(f)
while True:
str = ... | bmacdona9517/ISS-maintainSpeed | util/SerialLogger/SerialLogger.py | Python | mit | 412 |
"""
Test APIs.
"""
import json
import pytest
from mock import patch
from coursera import api
from coursera.test.utils import slurp_fixture
@pytest.fixture
def course():
course = api.CourseraOnDemand(session=None, course_id='0')
return course
@patch('coursera.api.get_page_json')
def test_ondemand_programm... | iemejia/coursera-dl | coursera/test/test_api.py | Python | lgpl-3.0 | 4,808 |
import numpy as np
from btgym.algorithms.utils import batch_stack, batch_gather, _show_struct
from btgym.research.gps.aac import GuidedAAC
from btgym.algorithms.runner.synchro import BaseSynchroRunner
class AACt2d(GuidedAAC):
"""
Trajectory2Distribution:
AAC class including methods enabling treating col... | Kismuz/btgym | btgym/research/metalearn_2/_aac_t2d.py | Python | lgpl-3.0 | 6,491 |
# -*- coding: utf-8 -*-
from domo import DomoDB, DomoSensor, DomoListener, DomoLog, DomoWatchdog
from multiprocessing import Process
import sys
class DomoApp:
def __init__(self):
pass
def run(self):
'''starting the threads, of course first the listener, then
the watchdog'''
# ... | iFabio2/domo | src/domo/DomoApp.py | Python | apache-2.0 | 1,244 |
#!/usr/bin/env python
from setuptools import setup
short_description = 'Robot Framework Jalali Date'
try:
description = open('README.rst').read()
except IOError:
description = short_description
classifiers = """
Development Status :: 5 - Production/Stable
License :: OSI Approved :: MIT License
Operating Syst... | samira-esnaashari/robotframework-jalali | setup.py | Python | mit | 1,208 |
#-*- coding:utf-8 -*-
import subprocess
from ErrorGenerator import ErrorGenerator
class PerlErrorGenerator(ErrorGenerator):
command = ["perl", "-wc"]
startFilePath = False
parseRegex = "(.*) line ([0-9]+)\.$"
lineIndex = 2
messageIndex = 1
stdout = None
stderr = subprocess.PIPE
| utisam/gfly | gfly/generators/PerlErrorGenerator.py | Python | gpl-3.0 | 287 |
import os,sys,glob
TSPROOT = os.getcwd()
XTOSDEFAULTS="W:\\bin\\XTOS\\4.1.P01"
TSPCLASSPATH = ''
TSPCLASSPATH += TSPROOT + '\\classes;'
#adding library files for TSP
TSPLIBPath = TSPROOT + '\\lib'
print TSPLIBPath
TSPCLASSPATH += ';'.join(['%s\\%s'%(TSPLIBPath,jar) for jar in glob.glob1(TSPLIBPath,'*.jar')])
TSPCL... | guanghaofan/MyTSP | 2.1.1.2/CPGTSP/reStartTSP.py | Python | gpl-2.0 | 1,009 |
from django.conf.urls.defaults import patterns, url
import views
urlpatterns = patterns('',
url('^openid/login/$', views.login, name="openid_login"),
url('^openid/callback/$', views.callback),
)
| GinnyN/towerofdimensions-django | django-allauth/build/lib/allauth/socialaccount/providers/openid/urls.py | Python | bsd-3-clause | 266 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Module for control model and related classes."""
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import validates
from ggrc import db
from ggrc.models.audit_object import Audita... | edofic/ggrc-core | src/ggrc/models/control.py | Python | apache-2.0 | 8,365 |
# Core imports
import copy
# Library imports
from dronekit import VehicleMode, LocationLocal, LocationGlobal, LocationGlobalRelative
# Package imports
from ..core.Threadable import Threadable
from ..geometry.Geometry_Spherical import Geometry_Spherical
class Vehicle(Threadable):
"""
Vehicle interface specifi... | timvandermeij/unmanned-vehicle-tomography | vehicle/Vehicle.py | Python | gpl-3.0 | 17,679 |
from twisted.internet.task import react
from pysnmp.hlapi.twisted import *
import socket
mapper_1 = "10.0.0.1"
mapper_2 = "10.0.0.2"
reducer = "10.0.0.3"
manager = "10.0.0.4"
def file_processing():
file_in = open("test.txt","r")
num_lines = sum(1 for line in file_in)
file_in.close()
file_in = open("te... | hylandnp/CS7012_DISTRIBUTED_PROJECT | manager.py | Python | mit | 2,200 |
from backend import db
from . import models
class UserTypeSerializer:
def serialize(self, user_types):
data=[]
for user_type in user_types:
data.append(
{'id': user_type.id,
'name': user_type.name,
})
return data
| sandroandrade/emile-server | cruds/crud_user_type/serializer.py | Python | gpl-3.0 | 294 |
from abc import ABCMeta, abstractmethod
class Generator(object):
__metaclass__ = ABCMeta
@abstractmethod
def generate(self, system, rom, playersControllers, gameResolution):
pass
def getResolution(self, config):
return config['videomode']
| nadenislamarre/recalbox-configgen | configgen/generators/Generator.py | Python | mit | 275 |
#We don't use sagenb.notebook.run_notebook because we want the server in the same python environment as our app so we have access to the Notebook and Worksheet objects.
#########
# Flask #
#########
import os, random
from guru.globals import GURU_PORT, GURU_NOTEBOOK_DIR
import sagenb.notebook.notebook as notebook
f... | rljacobson/Guru | guru/RunFlask.py | Python | mit | 2,460 |
# Copyright (c) 2016-present, Facebook, Inc.
#
# 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... | pietern/caffe2 | caffe2/python/layers_test.py | Python | apache-2.0 | 48,600 |
# Emulate the bare minimum for idna for the Swarming bot.
# In practice, we do not need it, and it's very large.
# See https://pypi.org/project/idna/
from encodings import idna
class IDNAError(Exception):
# Refered to by requests/models.py
pass
class core(object):
class IDNAError(Exception):
# Refered to... | endlessm/chromium-browser | tools/swarming_client/third_party/idna/__init__.py | Python | bsd-3-clause | 585 |
# rFactorTools GUI
# Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version... | Grumbel/rfactortools | rfactortools/gui/application.py | Python | gpl-3.0 | 3,511 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import tensorflow as tf
from niftynet.layer.base_layer import TrainableLayer
class GANImageBlock(TrainableLayer):
def __init__(self,
generator,
discriminator,
clip=None,
... | NifTK/NiftyNet | niftynet/layer/gan_blocks.py | Python | apache-2.0 | 1,858 |
import matplotlib
matplotlib.use('Qt4Agg')
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from sklearn import datasets
import pandas as pd
df = pd.read_csv('sms/sms.csv')
y = df.label
X = df.message
from sklearn.feature_extraction.text import TfidfVectorizer
print 'vectorizi... | moonbury/notebooks | github/MasteringMLWithScikit-learn/8365OS_07_Codes/pca-2d-plot.py | Python | gpl-3.0 | 677 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyPacificaUploader(PythonPackage):
"""Python Pacifica Uploader Library"""
homepage = ... | LLNL/spack | var/spack/repos/builtin/packages/py-pacifica-uploader/package.py | Python | lgpl-2.1 | 689 |
from hypothesis import given
from hypothesis.strategies import text
@given(text())
def test_uppercase_and_reverse_are_commutable(s):
print(repr(s))
assert s.upper()[::-1] == s[::-1].upper()
| alexwlchan/alexwlchan.net | src/_files/2021/test_for_noncommutative_strings.py | Python | mit | 200 |
import boto3
from werkzeug.utils import secure_filename
from .utils import convert_to_snake_case
from . import AbstractStorage, StorageExists, StorageNotExists, StorageNotAllowed
#Enhancement: Upload needs to have proper permissons public/private
#Enhancement: The get_existing_files method needs to handle subfolders
... | Speedy1991/Flask-FileUpload | flask_fileupload/storage/s3storage.py | Python | mit | 2,266 |
# Copyright (c) 2012 OpenStack Foundation.
# 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... | MaximNevrov/neutron | neutron/db/models_v2.py | Python | apache-2.0 | 12,581 |
from ._terminator import Terminator
__all__ = ("Terminator",)
| nikitanovosibirsk/vedro | vedro/plugins/terminator/__init__.py | Python | apache-2.0 | 63 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
import unittest
from io import StringIO
from ..helperfunctions import _xml_to_list
from ...worksheet import... | jmcnamara/XlsxWriter | xlsxwriter/test/worksheet/test_data_bar11.py | Python | bsd-2-clause | 8,784 |
import requests
import json
import logging
LOG = logging.getLogger(__name__)
class Forwarder(object):
def __init__(self):
this.fwd_url = 'http://localhost:9999/forward'
def forward(self, reason, host=None, data=None):
body = {
'reason': reason
}
if host is not None... | dscottcs/superluminal | superluminal/sample/forward_sample.py | Python | apache-2.0 | 510 |
"""HistogramBase - base for all histogram classes."""
from __future__ import annotations
import abc
import warnings
from typing import TYPE_CHECKING, cast
import numpy as np
from physt.binnings import BinningBase, as_binning
from physt.config import config
from physt.statistics import INVALID_STATISTICS
if TYPE_CHE... | janpipek/physt | physt/histogram_base.py | Python | mit | 34,929 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Meson(PythonPackage):
"""Meson is a portable open source build system meant to be both
... | LLNL/spack | var/spack/repos/builtin/packages/meson/package.py | Python | lgpl-2.1 | 4,020 |
# -*- coding: utf-8 -*-
"""
Common design parameters for minimum order design methods
@author: Christian Muenker
"""
from __future__ import print_function, division, unicode_literals
#from importlib import import_module
#import filterbroker as fb
class min_order_common(object):
def __init__(self):
... | honahursey/pyFDA | work/min_order_common.py | Python | apache-2.0 | 1,902 |
"""Remove unused models
Revision ID: 3f289637f530
Revises: 4ba1dd8c3080
Create Date: 2014-04-17 11:08:50.963964
"""
# revision identifiers, used by Alembic.
revision = '3f289637f530'
down_revision = '4ba1dd8c3080'
from alembic import op
def upgrade():
op.drop_table('aggtestgroup')
op.drop_table('testgroup... | bowlofstew/changes | migrations/versions/3f289637f530_remove_unused_models.py | Python | apache-2.0 | 442 |
"""
Extended math utilities.
"""
# Authors: Gael Varoquaux
# Alexandre Gramfort
# Alexandre T. Passos
# Olivier Grisel
# Lars Buitinck
# Stefan van der Walt
# Kyle Kastner
# Giorgio Patrini
# License: BSD 3 clause
from __future__ import division
from funct... | IshankGulati/scikit-learn | sklearn/utils/extmath.py | Python | bsd-3-clause | 27,505 |
#!/usr/bin/env python
import sleekxmpp
import sys
import gearman
import base64
import json
import logging
import configparser
CONFIG_FILE = '/home/django/projects/fun/fun/jabber.conf'
config = configparser.ConfigParser()
config.read(CONFIG_FILE)
logging.basicConfig(format='%(asctime)s [JABBER] %(message)s', filenam... | mitaka/fun | workers/jabber.py | Python | gpl-2.0 | 2,127 |
# Copyright (c) 2011-2013, ImageCat Inc.
#
# 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
# (at your option) any later version.
#
# This program is... | gem/sidd | sidd/taxonomy/gem/taxonomy.py | Python | agpl-3.0 | 17,545 |
#
# Copyright (c) 2008--2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | moio/spacewalk | backend/server/repomd/mapper.py | Python | gpl-2.0 | 23,045 |
from polyphony import testbench
def f(a):
return a
def int_f(a):
b = 3
c = f(b)
if c == 3:
return a
else:
return b
def bool_f(a):
b = (3 == 4)
c = f(b)
if c :
return a
else:
return a + 3
def ib_f(a):
if a == 1:
return int_f(a)
else:... | ryos36/polyphony-tutorial | malicious/type_test.py | Python | mit | 452 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-05-08 21:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cms', '0002_auto_20160508_1908'),
]
operations = [
migrations.AlterField(
... | porimol/django-blog | cms/migrations/0003_auto_20160508_2115.py | Python | mit | 461 |
# coding: utf8
# Copyright 2014-2017 CERN. This software is distributed under the
# terms of the GNU General Public Licence version 3 (GPL Version 3),
# copied verbatim in the file LICENCE.md.
# In applying this licence, CERN does not waive the privileges and immunities
# granted to it by virtue of its status as a... | blond-admin/BLonD | unittests/utils/test_blondmath.py | Python | gpl-3.0 | 20,919 |
import bpy
import mathutils
sphere = bpy.data.objects["Sphere"]
loc = (sphere.location.x, sphere.location.y, sphere.location.z)
class SphereTrackCoordinates(bpy.types.Panel):
"""A Custom Panel in the Viewport Toolbar"""
bl_label = "SphereTrackCoordinates"
bl_space_type = 'VIEW_3D'
bl_region_t... | james-massey/AdvancedReality | Blender Plugin/CoordinateTrack.py | Python | apache-2.0 | 1,302 |
"""
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2011 Cisco Systems, 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.ap... | rcbops/quantum-buildpackage | quantum/extensions/_pprofiles.py | Python | apache-2.0 | 2,300 |
# -*- coding: utf-8 -*-
from Components.ActionMap import ActionMap, HelpableActionMap, NumberActionMap
from Components.Harddisk import harddiskmanager, findMountPoint
from Components.Input import Input
from Components.Label import Label
from Components.MovieList import AUDIO_EXTENSIONS, MOVIE_EXTENSIONS, DVD_EXTENSIONS... | formiano/enigma2 | lib/python/Screens/InfoBarGenerics.py | Python | gpl-2.0 | 185,032 |
import os
import json
import uuid
import logging
import requests
from bdbag import bdbag_ro as ro
from deriva.core import format_exception
from deriva.core.utils.hash_utils import decodeBase64toHex
from deriva.core.utils.mime_utils import parse_content_disposition
from deriva.transfer.download.processors.query.base_que... | informatics-isi-edu/deriva-py | deriva/transfer/download/processors/query/bag_fetch_query_processor.py | Python | apache-2.0 | 5,645 |
# tf_unet 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.
#
# tf_unet is distributed in the hope that it will be useful,
# but WITHOUT ... | mughanibu/Deep-Learning-for-Inverse-Problems | tf_unet/image_gen.py | Python | mit | 3,652 |
#
# (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... | Inspq/ansible | lib/ansible/plugins/action/eos.py | Python | gpl-3.0 | 6,406 |
import logging
import time
from autotest.client.shared import error, utils
from virttest import utils_test
from autotest.client.shared.syncdata import SyncData
@error.context_aware
def run(test, params, env):
"""
KVM multi-host migration test:
Migration execution progress is described in documentation
... | uni-peter-zheng/tp-qemu | qemu/tests/migration_multi_host_timedrift.py | Python | gpl-2.0 | 5,402 |
from copy import copy, deepcopy
from object import Object
class CantBeFrozenException(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class ElemSizeException(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
... | tclose/FouTS | python/fouts/fibre/base/set.py | Python | gpl-3.0 | 13,285 |
# pylint: disable=R0903
"""
Write a program which implements a stack interface for integers. The interface
should have ‘push’ and ‘pop’ functions. Your task is to ‘push’ a series of
integers and then ‘pop’ and print every alternate integer.
INPUT SAMPLE:
Your program should accept a file as its first argument. The fi... | joelstanner/codeeval | python_solutions/STACK_IMPLEMENTATION/stack_implementation.py | Python | mit | 2,183 |
"""
Tests for send_email_base_command
"""
import datetime
from unittest import skipUnless
import ddt
import pytz
from django.conf import settings
from mock import DEFAULT, Mock, patch
from openedx.core.djangoapps.schedules.management.commands import SendEmailBaseCommand
from openedx.core.djangoapps.site_configurati... | stvstnfrd/edx-platform | openedx/core/djangoapps/schedules/management/commands/tests/test_send_email_base_command.py | Python | agpl-3.0 | 2,135 |
import textwrap
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options
# Just learning Yo!
import define, options
define("port", default=8000, help="run on the given port", type=int)
# Handlers that manipulate strings
class ReverseHandler(tornado.web.RequestH... | Wojtechnology/Muzit | learning/strings.py | Python | apache-2.0 | 908 |
class RepRapEventEnum:
PRINT_COMPLETE = 10
PRINT_STOPPED = 11
PRINT_STARTED = 13
PRINT_RESUMED = 14
PRINT_SENDGCODE = 15
QUEUE_DRAINED = 16
RECEIVED_MSG = 17
CONNECTED = 20
DISCONNECTED = 21
PRINT_ERROR = 99
class RepRapCmdEnum:
CMD_GCODE = 1
CMD_STARTPRINT = 2
CMD_STOPPRINT = 3
CMD_DRAINQUEUE = 4
CMD_E... | jbernardis/repraptoolbox | src/reprapenums.py | Python | gpl-3.0 | 417 |
#
# Copyright (c) 2015 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | retrography/scancode-toolkit | src/scancode/cli.py | Python | apache-2.0 | 14,382 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
int_or_none,
urlencode_postdata,
)
class HiDiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?hidive\.com/stream/(?P<title>[... | steebchen/youtube-dl | youtube_dl/extractor/hidive.py | Python | unlicense | 3,324 |
#
# Copyright (c) 2008-2015 Citrix Systems, Inc.
#
# 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 l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/network/rnat6_binding.py | Python | apache-2.0 | 3,410 |
from rest_framework import generics
| mattdennewitz/generator-mdtz-fluxible | generators/djapi/templates/views.py | Python | mit | 36 |
"""
Test module for Entrance Exams AJAX callback handler workflows
"""
import json
from mock import patch
from django.conf import settings
from django.contrib.auth.models import User
from django.test.client import RequestFactory
from contentstore.tests.utils import AjaxEnabledTestClient, CourseTestCase
from contentst... | solashirai/edx-platform | cms/djangoapps/contentstore/views/tests/test_entrance_exam.py | Python | agpl-3.0 | 13,750 |
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Callable,
Hashable,
Sequence,
cast,
)
import numpy as np
from pandas._typing import (
AggFuncType,
AggFuncTypeBase,
AggFuncTypeDict,
IndexLabel,
)
from pandas.util._decorators import (
Appender,
Substit... | jorisvandenbossche/pandas | pandas/core/reshape/pivot.py | Python | bsd-3-clause | 26,402 |
class formatCoord:
def __init__(self,X):
self.X = X
self.numrows,self.numcols=self.X.shape[0:2]
def update_coord(self, x, y):
col = int(x+0.5)
row = int(y+0.5)
if col>=0 and col<self.numcols and row>=0 and row<self.numrows:
z = self.X[row,col]
... | ChellyD65/patchSorter | lib/formatCoord.py | Python | gpl-2.0 | 556 |
__author__ = 'stuartreid'
class switch(object):
"""
This class provides the functionality we want. You only need to look at
this if you want to know how this works. It only needs to be defined
once, no need to muck around with its internals.
"""
def __init__(self, value):
self.value = ... | StuartGordonReid/Comp-Finance | Helpers/Switch.py | Python | lgpl-3.0 | 786 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-29 14:20
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependen... | PersonalGenomesOrg/genevieve | genevieve_client/migrations/0005_auto_20160329_1420.py | Python | mit | 1,067 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Django_study.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| zhangyage/Python-oldboy | day13/Django_study/manage.py | Python | apache-2.0 | 255 |
"""
A crypto engine for the 21st century.
"""
import sys
import string
sigma = {chr(65+i): i for i in range(26)}
rotation = None
plain = ''
cypher = ''
codes = []
newCodes = []
cypherList = []
while rotation is None:
try:
rotation = int(input("Choose a number for your cypher: "))
except ValueError:
... | caioproiete/illacceptanything | code/libcrypto.py | Python | mit | 1,304 |
# pylint: disable=E1120, C0103
from django.conf.urls import url
from thegamesdb import views
urlpatterns = [
url(r'^$', views.search, name='tgb.search'),
url(r'^search.json', views.search_json, name='tgd.search_json'),
url(r'^(\d+).json$', views.detail_to_lutris, name='tgd.detail'),
]
| Turupawn/website | thegamesdb/urls.py | Python | agpl-3.0 | 300 |
# Generated by Django 2.0.6 on 2018-11-09 14:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('iati', '0056_auto_20181109_1400'),
]
operations = [
migrations.RenameField(
model_name='documentlink',
old_name='period_targ... | openaid-IATI/OIPA | OIPA/iati/migrations/0057_auto_20181109_1402.py | Python | agpl-3.0 | 397 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from unittest import TestCase, main
from nine import str
from kajiki.doctype import DocumentTypeDeclaration, extract_dtd
XHTML1 = '<!DOCTYPE html PUBLIC "-//W3C//... | ollyc/kajiki | kajiki/tests/test_doctype.py | Python | mit | 1,604 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Acehaidrey/incubator-airflow | airflow/providers/amazon/aws/example_dags/example_local_to_s3.py | Python | apache-2.0 | 1,523 |
import logging
from processing.processor import DataProcessor
PROCESSORS = (
# TODO: Implement
)
def run(media_id=None):
logger = logging.getLogger(__name__)
logger.info('generate play media for Media.id=%s', media_id)
result = DataProcessor(PROCESSORS, logger=logger).run(media_id=media_id)
# T... | askoretskiy/private-photo-cloud | backend/processing/play_media/__init__.py | Python | gpl-3.0 | 814 |
"""
E261
Include at least two spaces before inline comment
"""
| landscape-test/all-messages | messages/pep8/E261.py | Python | unlicense | 64 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
_____ __
/ \ / |
/$$$$$$ |$$ | ______ _______ _______ __ __
$$ | $$/ $$ | / \ / |/ |/ | / |
$$ | $$ | $$$$$$ |/$$$$$$$//$$$$$$$/ ... | pbdeuchler/Classy | setup.py | Python | isc | 1,449 |
# Copyright (c) 2015-2019 Jack Morton <jhm@jemscout.com>
#
# 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 limitation the rights
# to use, copy, modify,... | jhm-/nhlscrappo | nhlscrappo/fetcher.py | Python | mit | 7,149 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.