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 |
|---|---|---|---|---|---|
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2014 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the Li... | salberin/libsigrokdecode | decoders/ir_rc5/__init__.py | Python | gpl-3.0 | 931 |
import tempfile
from pymol import cmd
cmd.show_as("cartoon", "experimental_structure")
cmd.show_as("cartoon", "predicted_structure")
rmsd = cmd.align('predicted_structure', 'experimental_structure')
cmd.bg_color('white')
handler, output_file = tempfile.mkstemp(prefix='alignment', suffix='.png')
cmd.png(output_file, ra... | mchelem/cref2 | cref/utils/pymolbench.py | Python | mit | 370 |
#coding:utf-8
'''
@author: shibkov
'''
from actions import SlavePack
| barsgroup/objectpack | src/objectpack/slave_object_pack/__init__.py | Python | mit | 70 |
# Copyright (C) 2010-2019 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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 v... | psci2195/espresso-ffans | samples/visualization_lbboundaries.py | Python | gpl-3.0 | 1,759 |
"""
FileCatalogHandler is a simple Replica and Metadata Catalog service
in the DIRAC framework
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
__RCSID__ = "$Id$"
import six
from six import StringIO
import csv
import os
from DIRAC.Core.DISET.RequestHan... | yujikato/DIRAC | src/DIRAC/DataManagementSystem/Service/FileCatalogHandler.py | Python | gpl-3.0 | 28,703 |
import random
import logging
from twisted.internet import defer, reactor
from zope.interface import implements
from lbrynet import interfaces
from lbrynet import conf
from lbrynet.core.client.ClientProtocol import ClientProtocolFactory
from lbrynet.core.Error import InsufficientFundsError
from lbrynet.core import utils... | zestyr/lbry | lbrynet/core/client/ConnectionManager.py | Python | mit | 9,657 |
## {{{ http://code.activestate.com/recipes/426406/ (r1)
from ConfigParser import SafeConfigParser
import logging, os
clog = logging.getLogger("Configuration")
#def getVersion():
# return 1
class Configuration:
def __init__ (self, fileName):
self.__checkForFile__(fileName)
cp = SafeConfigParser()... | leeclarke/homePi | src/python/Configuration.py | Python | gpl-3.0 | 2,038 |
import json
__author__ = 'lauft'
class CheckJson():
"""
check whether a composer JSON file meets certain requirements
"""
def __init__(self, path):
self.failed = False
try:
composer = open(path)
self.json = json.load(composer)
composer.close()
... | lauft/pyCheck | pycheck/checkjson.py | Python | mit | 637 |
# coding: utf8
# Copyright 2015-2018 Vincent Jacques <vincent@vincent-jacques.net>
from ActionTree import *
from . import *
class MultiThreadedExecutionTestCase(ActionTreeTestCase):
def test_many_dependencies(self):
# a
# /|\
# / | \
# b c d
a = self._action... | jacquev6/ActionTree | ActionTree/tests/multi_threaded_execution.py | Python | mit | 3,724 |
#!/usr/bin/env python
# coding=utf-8
#!/usr/bin/env python
# coding=utf-8
import commands
def run_cmd(cmd):
(status, output) = commands.getstatusoutput(cmd)
if int(status) != 0:
print 'error'
exit(1)
return status, output
def ping_baidu():
cmd = 'ping baidu.com'
status,output=run_c... | zhaochl/bash-utils | mac_wifi/wifi_check.py | Python | apache-2.0 | 566 |
# Copyright 2012 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 required by applicable law or ... | ehiller/CourseBuilderV19-TeacherDashboard | models/vfs.py | Python | apache-2.0 | 35,365 |
"""Python implementation of the InvenSense MPU-6050 Gyroscope / Accelerometer libray
Original inspiration:
MrTijn/Tijndagamer https://github.com/Tijndagamer/mpu6050
Jrowberg https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050
InvenSense https://invensense.com
Released under the MIT License
Copyright 2016
... | streamnsight/mpu6050 | mpu6050/mpu6050.py | Python | mit | 147,325 |
from L500analysis.data_io.get_cluster_data import GetClusterData
from L500analysis.utils.utils import aexp2redshift
from L500analysis.plotting.tools.figure_formatting import *
from L500analysis.plotting.profiles.tools.profiles_percentile \
import *
from L500analysis.utils.constants import rbins, linear_rbins
from d... | cavestruz/L500analysis | plotting/profiles/T_Vr_evolution/Tmw_Vr_evolution/plot_Tmw_Vr_r500c.py | Python | mit | 2,821 |
# -*- coding: utf-8 -*-
# Copyright (c) 2009 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a network access manager proxy for web pages.
"""
from __future__ import unicode_literals
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest
try:
from PyQt5.QtNetwork import ... | testmana2/test | Helpviewer/Network/NetworkAccessManagerProxy.py | Python | gpl-3.0 | 3,013 |
#!/usr/bin/env python
from setuptools import setup, find_packages
__version__ = "1.4"
setup(
name="awscodedeploy",
version=__version__,
description="CLI for Code Deploy supporting docker-compose",
author="Location Labs",
author_email="info@locationlabs.com",
url="http://locationlabs.com",
... | locationlabs/aws-code-deploy | setup.py | Python | apache-2.0 | 813 |
# Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0?
# Find all unique triplets in the array which gives the sum of zero.
# Elements in a triplet (a,b,c) must be in non-descending order. (ie, a <= b <= c)
# The solution set must not contain duplicate triplets.
# Solution:
# This ... | asraf209/leetcode | src/3SumClosest/main.py | Python | gpl-3.0 | 2,156 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('printy', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='PostItModel',
fields=[
... | jdsolucoes/Ppostit | printy/migrations/0002_auto_20150921_2215.py | Python | apache-2.0 | 967 |
import AnnounceSharePlugin
| OliverCole/ZeroNet | plugins/AnnounceShare/__init__.py | Python | gpl-2.0 | 27 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2017 The HORTON Development Team
#
# This file is part of HORTON.
#
# HORTON is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public Licens... | FarnazH/horton | horton/part/test/test_becke.py | Python | gpl-3.0 | 4,428 |
#!/usr/bin/env python
#coding=utf-8
from django.shortcuts import render_to_response
def index(request):
data = {'request':request}
return render_to_response('index.html', data)
| JuanbingTeam/djangobbs | djangobbs/index.py | Python | apache-2.0 | 197 |
#!/usr/bin/env python
"""
This tests the ability to render GPU resident data in VTK.
"""
import sys
import vtk
from vtk.test import Testing
from PistonTestCommon import *
class TestRendering(Testing.vtkTest):
def testRendering(self):
global args
renderer = vtk.vtkRenderer()
renwin = vtk.vtkRenderWind... | HopeFOAM/HopeFOAM | ThirdParty-0.1/ParaView-5.0.1/VTK/Accelerators/Piston/Testing/Python/TestRendering.py | Python | gpl-3.0 | 1,290 |
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 | SHH_WT_models/SHH_WT_models_final_output_0.1_-0.1_11000/SHH_WT_models11702.py | Python | gpl-3.0 | 17,574 |
# Copyright 2015 The TensorFlow Authors. 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 applica... | ZhangXinNan/tensorflow | tensorflow/tools/api/tests/api_compatibility_test.py | Python | apache-2.0 | 12,607 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | poznyakandrey/oslo.service | oslo_service/service.py | Python | apache-2.0 | 20,955 |
"""Implementation of treadmill admin CLI API invocation.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import inspect
import io
import click
import decorator
import jsonschema
from treadmill import authz as au... | bretttegart/treadmill | lib/python/treadmill/cli/admin/invoke.py | Python | apache-2.0 | 4,629 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-12 22:15
from __future__ import unicode_literals
from django.db import migrations
def add_sector_teams(apps, schema_editor):
SectorTeam = apps.get_model('fdi', 'SectorTeam')
sector_teams = {'Aero': 'Aerospace',
'AESC': 'Advan... | UKTradeInvestment/export-wins-data | fdi/migrations/0020_auto_20171012_2215.py | Python | gpl-3.0 | 21,669 |
#!/usr/bin/env python
import werkzeug
import datetime
import hashlib
import uuid
import sys
from sqlalchemy import Integer, Column, String, DateTime, Enum
from sqlalchemy import create_engine, Text
from sqlalchemy.orm import Session
from sqlalchemy.ext.declarative import declarative_base, declared_attr
# TODO fetch t... | x89/quotepy | quotepy/models.py | Python | mit | 1,736 |
# Copyright 2020 Akretion Renato Lima <renato.lima@akretion.com.br>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Sale MRP BOM",
"category": "Sale",
"license": "AGPL-3",
"author": "Akretion, Odoo Community Association (OCA)",
"version": "14.0.1.0.0",
"website": "htt... | OCA/sale-workflow | sale_mrp_bom/__manifest__.py | Python | agpl-3.0 | 625 |
"""
Role Assigner cog.
Randomly assigns roles to users.
"""
import os # Used to create folder path.
import random
import itertools
import discord
from discord.ext import commands
from __main__ import send_cmd_help # pylint: disable=no-name-in-module
from .utils import config, checks # pylint: disable=relative-beyond-t... | Injabie3/Red-DiscordBot | cogs/role_assigner.py | Python | gpl-3.0 | 8,368 |
# Playlist.py
#
# reads all available playlists, adjusts song paths, removes not copied songs,
# writes resulting playlist to destination
import mlsSong as sng
import config
import glob
import os
import sys
import codecs
def Playlist():
# get a list of all playlists
playlists = glob.glob(config.SOURCE_PL... | RalpH-himself/MusicLibrarySyncForMSC | mlsPlaylist.py | Python | gpl-3.0 | 3,927 |
# encoding: utf-8
from __future__ import unicode_literals
from .mtv import MTVServicesInfoExtractor
class SouthParkIE(MTVServicesInfoExtractor):
IE_NAME = 'southpark.cc.com'
_VALID_URL = r'https?://(?:www\.)?(?P<url>southpark\.cc\.com/(?:clips|full-episodes)/(?P<id>.+?)(\?|#|$))'
_FEED_URL = 'http://www... | Rudloff/youtube-dl | youtube_dl/extractor/southpark.py | Python | unlicense | 4,108 |
#!/usr/bin/python
#
# Copyright 2008, 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 required b... | chrisjowen/nLess | lib/PEG_GrammarExplorer/PEG_GrammarExplorer/PegSamples/python_2_5_2/input/adwords/awapi_python_samples_1.0.0/src/add_campaign.py | Python | apache-2.0 | 2,901 |
# Authors:
# Rob Crittenden <rcritten@redhat.com>
# Pavel Zuna <pzuna@redhat.com>
#
# Copyright (C) 2008 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
# th... | ofayans/freeipa | ipatests/test_xmlrpc/test_automount_plugin.py | Python | gpl-3.0 | 21,419 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0019_auto_20150216_0813'),
]
operations = [
migrations.AddField(
model_name='event',
name='ja... | SchoolIdolTomodachi/SchoolIdolAPI | api/migrations/0020_auto_20150217_1849.py | Python | apache-2.0 | 2,998 |
import gtk
class AcceleratorGroup:
"""Accelerator group provides customizable keyboard shortcuts for plugins
with automatically generated configuration."""
def __init__(self, application):
self._application = application
self._manager = self._application.accelerator_manager
self._... | Hammer2900/SunflowerX | application/accelerator_group.py | Python | gpl-3.0 | 7,451 |
# -*- coding: utf-8 -*-
"""ANTS Apply Transforms interface
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
>>> os.chdir(datadir)
"""
from __fu... | mick-d/nipype | nipype/interfaces/ants/utils.py | Python | bsd-3-clause | 11,113 |
# Copyright (c) 2013 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 ... | sebrandon1/neutron | neutron/plugins/ml2/db.py | Python | apache-2.0 | 12,959 |
"""
Extra functions for build-in datasets
"""
import torchvision.transforms as transforms
def build_transforms(normalize=True, center_crop=None, image_size=None,
random_crop=None, flip=None, random_resize_crop=None,
random_sized_crop=None, use_sobel=False):
"""
Args... | rdevon/cortex | cortex/built_ins/datasets/utils.py | Python | bsd-3-clause | 1,457 |
#!/usr/bin/python
#
# Copyright (C) 2007 Saket Sathe
#
# 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 applic... | xaeroman/pygrel | pygel/System/__init__.py | Python | apache-2.0 | 907 |
from __future__ import absolute_import, print_function
import logging
from datetime import time
from managers.models import Manager
from workshift.models import Semester, WorkshiftPool, WorkshiftType, \
RegularWorkshift
from workshift.utils import get_year_season, get_semester_start_end, \
make_manager_work... | knagra/farnsworth | workshift/fill.py | Python | bsd-2-clause | 12,986 |
# This file is part of HDL Checker.
#
# Copyright (c) 2015 - 2019 suoto (Andre Souto)
#
# HDL Checker 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 ... | suoto/hdlcc | hdl_checker/exceptions.py | Python | gpl-3.0 | 2,134 |
#!/usr/bin/env python
"""
Parse a simple Makefile and execute it.
Doen't support comments, variables, patterns or anything complex...
Doesn't check file system. all targets are always built.
"""
import os
def parse_makefile(fname):
"""Parses a makefile.
Input consists of only 2 kinds of lines::
... | veltzer/demos-python | src/exercises/advanced/build_system/solution2.py | Python | gpl-3.0 | 2,163 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from cms.admin import forms
from cms.admin.forms import PageUserForm
from cms.api import create_page, create_page_user
from cms.forms.fields import PageSelectFormField, SuperLazyIterator
from cms.forms.utils import (get_site_choices, get_page_choices,
u... | driesdesmet/django-cms | cms/tests/forms.py | Python | bsd-3-clause | 5,792 |
#!/usr/bin/env pythonw
import tkinter as Tk
from tkinter import ttk
import matplotlib
import numpy as np
import numpy.ma as ma
import new_cmaps
from new_cnorms import PowerNormWithNeg
from Numba2DHist import Fast2DHist, Fast2DWeightedHist, vecLog10Norm
import matplotlib.colors as mcolors
import matplotlib.gridspec as g... | pcrumley/Iseult | src/phase_plots.py | Python | gpl-3.0 | 50,141 |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1alpha1... | kubevirt/client-python | kubevirt/models/v1alpha1_virtual_machine_template_spec.py | Python | apache-2.0 | 4,066 |
import cards
# Player : armazena informacoes sobre o jogador, usado a nivel cliente para tomar acoes
class Player:
# Metodo construtor
def __init__(self):
self.hand = []
# Inicializa atributos no inicio de uma rodada
def round(self, card_strings):
card_list = []
for card i... | jvitorfromhell/truco | player.py | Python | gpl-3.0 | 975 |
#!/usr/bin/env python
# (c) Copyright [2016] Hewlett Packard Enterprise Development LP 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 Unless required by applicable
# law or agreed to in writ... | ThreatCentral/blackberries | src/ThreatCentral/transforms/URLToIndicators.py | Python | apache-2.0 | 3,518 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-04-24 01:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Task',... | rg3915/spark | spark/gamification/migrations/0001_initial.py | Python | mit | 739 |
"""
Copyright (c) 2020 Alex Forencich
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, merge, publish, distribute... | alexforencich/verilog-ethernet | example/KC705/fpga_gmii/tb/fpga_core/test_fpga_core.py | Python | mit | 7,184 |
## @package gradient
"""
Written by Daniel M. Aukes and CONTRIBUTORS
Email: danaukes<at>asu.edu.
Please see LICENSE for full license.
"""
# Functions for handling colour gradients.
from math import floor
from .enhanced_grid import Grid2D
from .image import mix_color
## A gradient without any interpol... | danaukes/popupcad | popupcad_gazebo/gradient.py | Python | mit | 1,330 |
from rest_framework import routers
from vendor import views
router = routers.SimpleRouter()
router.register("popsicles", views.PopsicleViewSet)
router.register("machines", views.MachineViewSet)
router.register("stock/removal", views.PopsicleRemovalViewSet)
router.register("stock/entry", views.PopsicleEntryViewSet)
ro... | pi2-picole/api | vendor/urls.py | Python | mit | 466 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | samedder/azure-cli | src/command_modules/azure-cli-consumption/azure/cli/command_modules/consumption/commands.py | Python | mit | 1,078 |
# -*- coding: utf-8 -*-
#!/usr/bin/python
#####
# Made by Jose Patricio VM
#####
# Script para generar pacos a partir de ordenes de Servicio de PCI Industrial
#
#
#####
import wget
import pyexcel
import datetime, time, re
from sys import argv
import simplejson
from linkaform_api import network, utils, settings
#Nomb... | linkaform/linkaform_api | linkaform_api/upload_file.py | Python | gpl-3.0 | 12,588 |
from hpp.corbaserver.rbprm.rbprmbuilder import Builder
from hpp.gepetto import Viewer
from hpp.corbaserver import Client
from hpp.corbaserver.robot import Robot as Parent
from hpp.corbaserver.rbprm.problem_solver import ProblemSolver
import omniORB.any
class Robot (Parent):
rootJointType = 'freeflyer'
packageName =... | pFernbach/hpp-rbprm-corba | script/scenarios/sandbox/dynamic/downSlope_hrp2_loadPath.py | Python | lgpl-3.0 | 4,915 |
# 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... | nathanbjenx/cairis | cairis/test/test_MisuseCaseFactory.py | Python | apache-2.0 | 1,777 |
# -*- coding: utf-8 -*-
import itertools
import os
import random
import string
from django.test import RequestFactory
from django.conf import settings
from django.contrib.auth.models import Group, Permission
from django.contrib.auth import get_user_model
from django.contrib.messages.storage.fallback import FallbackSto... | memodir/cv | src/testings/factory.py | Python | apache-2.0 | 8,832 |
# Copyright 2007 Matt Chaput. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the... | cscott/wikiserver | whoosh/query.py | Python | gpl-2.0 | 69,633 |
# Copyright (C) 2020 KMEE Informática LTDA
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
SIT_MANIF_PENDENTE = ('pendente', 'Pendente')
SIT_MANIF_CIENTE = ('ciente', 'Ciente da Operação')
SIT_MANIF_CONFIRMADO = ("confirmado", 'Confirmada operação')
SIT_MANIF_DESCONHECIDO = ("desconhecido", "Desconhe... | kmee/l10n-brazil | l10n_br_fiscal/constants/mdfe.py | Python | agpl-3.0 | 889 |
#!/usr/bin/env python
import errno
import os
import platform
import sys
BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
'https://s3.amazonaws.com/brave-laptop-binaries/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = os.getenv('LIBCHROMIUMCONTENT_COMMIT') or \
'd715734c03b0c892ea66695ae63fc0db9c3fc027'... | posix4e/electron | script/lib/config.py | Python | mit | 2,118 |
# coding: utf-8
import filecmp
import numbers
import re
from pathlib import Path
import numpy as np
import pytest
from scipy import sparse
from sklearn.datasets import dump_svmlight_file, load_svmlight_file
from sklearn.model_selection import train_test_split
import lightgbm as lgb
from lightgbm.compat import PANDAS_... | microsoft/LightGBM | tests/python_package_test/test_basic.py | Python | mit | 24,734 |
import pandas as pd
import matplotlib.pyplot as plt
batch_result = [[13.36782193183899, 0.33670586840811867, 0.91220000000000001], [10.780983924865723, 0.3779737023271133, 0.90410000000000001]]
cols = ['Time', 'Loss', 'Accuracy']
idx = ['128', '256']
df = pd.DataFrame(batch_result, index=idx, columns=cols)
print(df)
d... | shanaka-desoysa/tensorflow | hello_world/plot.py | Python | apache-2.0 | 900 |
from __future__ import absolute_import
from Components.Converter.Converter import Converter
from Components.Element import cached
class ValueRange(Converter, object):
def __init__(self, arg):
Converter.__init__(self, arg)
(self.lower, self.upper) = [int(x) for x in arg.split(',')]
@cached
def getBoolean(self):... | atvcaptain/enigma2 | lib/python/Components/Converter/ValueRange.py | Python | gpl-2.0 | 589 |
from pygame import Surface
from thorpy.miscgui import constants, functions, style
from thorpy.painting.painters.optionnal.illuminer import IlluminerAlphaExcept as Illuminer
from thorpy.painting import pilgraphics
def get_already_illuminated_title(hoverable, state, color=None):
color = style.COLOR_TXT_HOVER if c... | YannThorimbert/ThorPy-1.4.3 | thorpy/elements/_hoverutils/_hovergetter.py | Python | mit | 4,792 |
# (C) British Crown Copyright 2016, 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 later ve... | LukeC92/iris | docs/iris/example_tests/test_coriolis_plot.py | Python | lgpl-3.0 | 1,333 |
from django.test import TestCase
from django.core.urlresolvers import reverse
from common.factories import UserFactory
import contacts as contact_constants
from contacts import factories
from contacts import models
class ContactModelTests(TestCase):
def setUp(self):
self.book = factories.BookFactory.crea... | phildini/logtacts | contacts/tests/test_models.py | Python | mit | 9,784 |
# -*- coding: utf-8 -*-
import subprocess
import signal
import time
def handler(signum, frame):
print 'Start kill "run.py" ...'
subprocess.Popen(['pkill', '-SIGINT', 'run.py'])
if __name__ == "__main__":
process_count = 10
for i in range(process_count):
subprocess.Popen(['python', 'run.py... | Lamzin/wiki-parser | launcher.py | Python | gpl-3.0 | 406 |
# Copyright (C) 2007, One Laptop Per Child
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distrib... | quozl/sugar | src/jarabe/frame/clipboardobject.py | Python | gpl-3.0 | 4,332 |
import json
import os
from marvin.cloudstackException import printException
from marvin.codes import *
from optparse import OptionParser
import jsonHelper
from config.test_data import test_data
class managementServer(object):
def __init__(self):
self.mgtSvrIp = None
self.port = 8096
self.... | MissionCriticalCloud/cosmic | cosmic-marvin/marvin/configGenerator.py | Python | apache-2.0 | 16,647 |
"""
Tests covering the Open edX Paver prequisites installation workflow
"""
from __future__ import absolute_import
import os
import unittest
from mock import patch
from paver.easy import BuildFailure
import pavelib.prereqs
from pavelib.paver_tests.utils import PaverTestCase, fail_on_npm_install, unexpected_fail_on_... | ESOedX/edx-platform | pavelib/paver_tests/test_prereqs.py | Python | agpl-3.0 | 3,866 |
#problem 14
def collatz(x):
sum = 1
while x != 1:
if x % 2 == 0:
x = x / 2
else:
x = 3 * x + 1
sum += 1
return sum
maxlength = 0
value = 0
for i in range(1,1000000):
length = collatz(i)
if length > maxlength:
maxlength = length
value... | jhuang314/euler | p14.py | Python | mit | 355 |
import numpy
import theano
from fuel.datasets import IterableDataset
from numpy.testing import assert_allclose
from theano import tensor
from blocks.extensions import TrainingExtension, FinishAfter
from blocks.extensions.monitoring import TrainingDataMonitoring
from blocks.monitoring import aggregation
from blocks.alg... | rizar/attention-lvcsr | libs/blocks/tests/extensions/test_monitoring.py | Python | mit | 2,680 |
# Portions Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# Copyright 2013 Mercurial Contributors
#
# This software may be used and distributed according to the terms of the
# GNU General Public Licens... | facebookexperimental/eden | eden/hg-server/edenscm/mercurial/scmposix.py | Python | gpl-2.0 | 2,839 |
import pkgutil
import importlib
import logging
import os
from flask import Blueprint
def register_blueprints(app, package_name, package_path):
"""Register all Blueprint instances on the specified Flask application found
in all modules for the specified package.
:param app: the Flask application
:para... | stepanov-valentin/lpschedule | schedule/helpers.py | Python | mit | 1,506 |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.cloud.kms_v1.proto import (
resources_pb2 as google_dot_cloud_dot_kms__v1_dot_proto_dot_resources__pb2,
)
from google.cloud.kms_v1.proto import (
service_pb2 as google_dot_cloud_dot_kms__v1_dot_proto_dot_service__pb2,... | dhermes/gcloud-python | kms/google/cloud/kms_v1/proto/service_pb2_grpc.py | Python | apache-2.0 | 25,508 |
# 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 use ... | KevinLiLu/kafka | tests/kafkatest/tests/core/upgrade_test.py | Python | apache-2.0 | 9,230 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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) an... | j00bar/ansible | lib/ansible/playbook/helpers.py | Python | gpl-3.0 | 15,612 |
from flask import make_response
from flask import jsonify
from flask import Blueprint
from flask import request
from pymongo import MongoClient
from bson.objectid import ObjectId
from datetime import datetime, time
from twilio.rest import TwilioRestClient
from twilio.twiml import Response
import re
#ACCOUNT_SID = key
... | barca/WesFlix | WesFlix/src/order/order.py | Python | mit | 1,271 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2017 Vincent Noel (vincent.noel@butantan.gov.br)
#
# This file is part of libSigNetSim.
#
# libSigNetSim 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 Fou... | msreis/SigNetSim | signetsim/tests/test_event.py | Python | agpl-3.0 | 8,329 |
import glob
import data_Augment as da
norm = glob.glob("/home/neo/work/cnn_down/data/baby_box/*nor*")
down = glob.glob("/home/neo/work/cnn_down/data/baby_box/*down*")
print len(norm)
print len(down)
# train_nor=nor[:int(len(nor)*0.6+1)]
# test_nor=nor[int(len(nor)*0.6+2):int(len(nor)*0.6+2)+int(len(nor)*0.2+1)]
# val... | ishank26/Kutils | img/preprocess/label.py | Python | mit | 947 |
"""Definitions for all core logical instructions."""
import operator as op
from typing import Tuple
from pyshgp.push.type_library import PushTypeLibrary
from pyshgp.push.instruction import SimpleInstruction
def _and(a: bool, b: bool) -> Tuple[bool]:
return a and b,
def _or(a: bool, b: bool) -> Tuple[bool]:
... | erp12/pyshgp | pyshgp/push/instructions/logical.py | Python | mit | 3,014 |
import astropy.units as u
from astropy.coordinates import SkyOffsetFrame, SphericalRepresentation, UnitSphericalRepresentation
__all__ = ['NorthOffsetFrame']
class NorthOffsetFrame(object):
"""
A frame which is relative to some position and another frame. Based on
`astropy.coordinates.SkyOffsetFrame`
... | dpshelio/sunpy | sunpy/coordinates/offset_frame.py | Python | bsd-2-clause | 4,113 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views import defaults as default_views
from django.views.generic import Tem... | rdmurphy/django-template | config/urls.py | Python | mit | 1,047 |
def entry_to_offset(n):
""" Convert an entry number to an actual bytes offset. """
return n * (4*7)
| isra17/nrs | nrs/__init__.py | Python | gpl-3.0 | 109 |
from util import *
update_addonxml('video game') | bbr25/plugin.program.iarlnes | resources/lib/update_addonxml_provides_video.py | Python | gpl-2.0 | 49 |
# -*- coding: utf-8 -*-
from django.shortcuts import render, redirect
from django.views.generic import View
from django.http import HttpResponse
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.units import inch
from... | CallmeTorre/Idalia | ESCOM/ConsultarDocumento/views.py | Python | apache-2.0 | 2,955 |
from numpy import *
from subprocess import Popen, PIPE
from meshUtils import *
def aftMesh(xy, d=None):
'''
xy should be an n by 2 array describing the boundary:
1. The boundary is a union of loops.
2. In each loop, the first node and the last node must be identical.
This fact is used to distin... | gomezstevena/x-wind | src/meshAni2D.py | Python | gpl-3.0 | 2,998 |
#!/usr/bin/env python
import copy, errno, sys, stat, re
from bup import options, git, metadata, vfs
from bup.helpers import *
from bup._helpers import write_sparsely
optspec = """
bup restore [-C outdir] </branch/revision/path/to/dir ...>
--
C,outdir= change to given outdir before extracting files
numeric-ids restor... | jbaber/bup | cmd/restore-cmd.py | Python | lgpl-2.1 | 12,215 |
#!/usr/bin/env python3
import sys
import csv
import calcoohija
import calcplus
if __name__ == "__main__":
with open(sys.argv[1]) as fichero:
contenido = csv.reader(fichero)
for linea in contenido:
calcplus.operacion(linea)
| rpaunero/ptavi-p2 | calcplusplus.py | Python | gpl-2.0 | 260 |
# Copyright 2016 F5 Networks 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 to in writi... | wojtek0806/f5-common-python | test/functional/shared/test_bigip_failover_state.py | Python | apache-2.0 | 1,084 |
from rx.scheduledobserver import ScheduledObserver
class ObserveOnObserver(ScheduledObserver):
def __init__(self, scheduler, observer):
super(ObserveOnObserver, self).__init__(scheduler, observer)
def next(self, value):
super(ObserveOnObserver, self).next(value);
self.ensure_active()
... | Reactive-Extensions/RxPy | rx/observeonobserver.py | Python | apache-2.0 | 539 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-19 22:40
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateMode... | d120/pyofahrt | faq/migrations/0001_initial.py | Python | agpl-3.0 | 1,361 |
#!/usr/bin/env python2
# find-kam-node.py: python2 example of loading kam, resolving kam node, and
# printing out BEL terms
#
# usage: find-kam-node.py <kam name> <source_bel_term>
from random import choice
from suds import *
from ws import *
import time
def load_kam(client, kam_name):
'''
... | OpenBEL/openbel-framework-examples | web-api/python/find-kam-node.py | Python | apache-2.0 | 2,020 |
# Copyright (c) 2010-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 agree... | matthewoliver/swift | test/unit/common/middleware/test_gatekeeper.py | Python | apache-2.0 | 10,406 |
"""Uses the same strategy as
``adjacency_list.py``, but associates each DOM row with its owning
document row, so that a full document of DOM nodes can be loaded
using O(1) queries - the construction of the "hierarchy" is performed
after the load in a non-recursive fashion and is more
efficient.
"""
######... | wfxiang08/sqlalchemy | examples/elementtree/optimized_al.py | Python | mit | 8,157 |
# global imports
import numpy as np
import scipy.special as scsp
import scipy.optimize as scop
# local imports
import helper as bhlp
"""
ref Helias14:
Helias, Tetzlaff, Diesmann (2014) The Correlation Structure of
Local Neuronal Networks Intrinsically Results from Recurrent Dynamics
PLoS Comput Biol 10(1): e1003428
D... | jakobj/binary_network | meanfield.py | Python | bsd-2-clause | 6,477 |
__author__ = 'Nicholas C Pandolfi'
import os
import sys
from .lrbuilder import cachebuild
from .lrtools import ClosedError
class copen(object):
def __init__(self, file, overwrite = False):
object.__init__(self)
self.current = 1
self.filename = file
self.lines, self.__cache = cacheb... | nickpandolfi/linereader | previous/c_reader.py | Python | mit | 2,050 |
import rabbitpy
with rabbitpy.Connection() as connection:
with connection.channel() as channel:
exchange = rabbitpy.Exchange(channel, 'chapter4-example')
exchange.declare()
channel.enable_publisher_confirms()
message = rabbitpy.Message(channel,
'T... | gmr/RabbitMQ-in-Depth | Examples/4.1.3 Publisher Confirms.py | Python | bsd-3-clause | 603 |
import random
import pyjokes
from sopel import module
@module.commands('pyjoke')
@module.example('.pyjoke')
def pyjoke(bot, trigger):
"""Prints a random joke from the pyjoke repository"""
j1 = pyjokes.get_jokes(category='neutral')
j2 = pyjokes.get_jokes(category='adult')
bot.say(random.choice... | situx/tuxbot | pyjoke.py | Python | gpl-3.0 | 332 |
# setup.py
# This script will build the main subpackages
# See LICENSE for details
from distutils.util import get_platform
from numpy.distutils.misc_util import Configuration, get_info
from numpy.distutils.core import setup
from os.path import join
import sys
TTFORT_DIR = 'tt-fort'
TTFORT_SRC = [
'nan.f9... | uranix/ttpy | tt/setup.py | Python | mit | 1,856 |
# Generated by Django 2.2.9 on 2020-04-03 05:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('siteconfig', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='siteconfig',
old_name='hs_active_... | timberline-secondary/hackerspace | src/siteconfig/migrations/0002_auto_20200402_2201.py | Python | gpl-3.0 | 1,045 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.