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
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/operations/__init__.py | Python | mit | 740 |
'''
Copyright (C) 2014 Muhd Amirul Ashraf bin Mohd Fauzi <asdacap@gmail.com>
This file is part of Automatic IIUM Schedule Formatter.
Automatic IIUM Schedule Formatter 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 Foundati... | asdacap/iiumschedule | models.py | Python | gpl-3.0 | 5,856 |
# encoding: utf8
##############################################################################
#
# Copyright (C) 2013 NaN Projectes de Programari Lliure, S.L.
# http://www.NaN-tic.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | gisce/retrofix | retrofix/aeat340.py | Python | gpl-3.0 | 7,451 |
# -*- coding: utf-8 -*-
#
# AWL simulator - GUI standard library window
#
# Copyright 2014 Michael Buesch <m@bues.ch>
#
# 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... | gion86/awlsim | awlsim/gui/library.py | Python | gpl-2.0 | 14,143 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import Union
from hwt.interfaces.std import Handshaked
from hwt.interfaces.utils import addClkRstn, propagateClkRstn
from hwt.serializer.mode import serializeParamsUniq
from hwt.synthesizer.interfaceLevel.interfaceUtils.utils import packIntf, \
connectPac... | Nic30/hwtLib | hwtLib/avalon/mm_buff.py | Python | mit | 3,419 |
import lib.args
import os.path
@lib.args.convert(directory=os.path.abspath, port=int)
def lighttpd(directory, port):
config = """
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_auth",
"mod_cgi"
)
cgi.assign = ( ".cgi" => "" )
server.port ... | aureooms/sak | sak/stream.py | Python | agpl-3.0 | 662 |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Elie Khoury <Elie.Khoury@idiap.ch>
# Fri Aug 30 11:42:30 CEST 2013
#
# Copyright (C) 2012-2013 Idiap Research Institute, Martigny, Switzerland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public L... | antoniorohit/xbob.spkrec | xbob/spkrec/feature_extraction/Cepstral.py | Python | gpl-3.0 | 4,007 |
#coding=utf-8
from admin import admin, AdminCtrl
class Admin_IndexCtrl(AdminCtrl):
@admin
def get(self, *args):
talks = self.datum('talks').result('select * from talks order by talk_id desc limit 3')
mails = self.datum('mails').result('select * from mails order by mail_id desc limit 3')
... | finron/luokr.com | www.luokr.com/app/ctrls/admin/index.py | Python | bsd-3-clause | 385 |
__author__ = "Felix Simkovic"
import unittest
from conkit.misc.selectalg import SubselectionAlgorithm
class TestSubselectionAlgorithm(unittest.TestCase):
def test_cutoff_1(self):
data = [1.0, 0.6, 0.5, 0.4, 0.4, 0.3, 0.2, 0.1]
keep, throw = SubselectionAlgorithm.cutoff(data)
self.assertE... | fsimkovic/cptbx | conkit/misc/tests/test_selectalg.py | Python | gpl-3.0 | 3,520 |
from astropy.io import fits as pyfits
import matplotlib.pyplot as plt
import pywcsgrid2
import matplotlib.patheffects as patheffects
# use path_effects
my_path_effects = [patheffects.withStroke(linewidth=3,
foreground="w")]
pywcsgrid2.Axes.default_path_effects = my_path_effec... | leejjoon/pywcsgrid2 | examples/demo_compass.py | Python | mit | 1,042 |
from __future__ import absolute_import
import sys
from behave.configuration import options as behave_options
from behave.__main__ import main as behave_main
from django.core.management.base import BaseCommand
from behave_django.environment import monkey_patch_behave
from behave_django.runner import (BehaviorDrivenTes... | bittner/behave-django | behave_django/management/commands/behave.py | Python | mit | 5,039 |
def busca_binaria(seq,procurado ):
"""
O(log n) em tempo de execução já que o while vai percorrer a sequencia
O(1) em memória pois possuirá apenas a sequencia e variaveis auxiliares
"""
if len(seq)==0:
return 0
else:
i=0
f=len(seq)-1
while(i<=f):
... | walelite/ES | BuscaBinaria.py | Python | mit | 1,762 |
# Generated by Django 2.0 on 2018-02-20 10:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('secrets', '0014_auto_20170313_1544'),
]
operations = [
migrations.AddField(
model_name='secretrevision',
name='plainte... | trehn/teamvault | teamvault/apps/secrets/migrations/0015_secretrevision_plaintext_data_sha256.py | Python | gpl-3.0 | 462 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# 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
# ... | trueship/readycloud-python-client | docs/conf.py | Python | bsd-3-clause | 8,470 |
# --
# Copyright (c) 2008-2022 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
# --
"""Callbacks manager
Manage the dictionary of the ids / callbacks associations
"""
import os
im... | nagareproject/core | nagare/services/callbacks.py | Python | bsd-3-clause | 5,279 |
""" Unit tests for the queue module.
"""
import spectrum.queue
def test(tmpdir):
""" Rudimentary queue test - messages in/out.
"""
MESSAGES = (('id1', 'first message'),
('id2', 'second message'),
('id3', 'third'))
queue = spectrum.queue.Queue(str(tmpdir))
for messag... | tomjon/piSpecMon | spectrum/test/queue.py | Python | gpl-2.0 | 497 |
"""
Simple definitions.
Author(s): Arno Bakker
"""
DLSTATUS_ALLOCATING_DISKSPACE = 0 # TODO: make sure this get set when in this alloc mode
DLSTATUS_WAITING4HASHCHECK = 1
DLSTATUS_HASHCHECKING = 2
DLSTATUS_DOWNLOADING = 3
DLSTATUS_SEEDING = 4
DLSTATUS_STOPPED = 5
DLSTATUS_STOPPED_ON_ERROR = 6
DLSTATUS_METADATA = 7
D... | vandenheuvel/tribler | Tribler/Core/simpledefs.py | Python | lgpl-3.0 | 4,397 |
#!/usr/bin/env python
# Copyright 2013 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.
"""Runs all ChromeDriver end to end tests."""
import optparse
import os
import platform
import sys
_THIS_DIR = os.path.abspath(os.pat... | mogoweb/chromium-crosswalk | chrome/test/chromedriver/test/run_all_tests.py | Python | bsd-3-clause | 7,438 |
#!/usr/bin/env python
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COP... | nusenu/tor-compass | compass.py | Python | mit | 27,881 |
from leapp.tags import Tag
class FirstBootTag(Tag):
name = 'first_boot'
| leapp-to/prototype | tests/data/leapp-rerun-tests-repos/ipu-rerun-repo/tags/firstboot.py | Python | lgpl-2.1 | 78 |
from haystack import indexes
from .models import User
from rlp.search.search_indexes import BaseIndex
class UserIndex(BaseIndex, indexes.Indexable):
def get_model(self):
return User
def index_queryset(self, using=None):
return self.get_model().objects.filter(is_staff=False, is_active=True)
... | HMSBeagle1831/rapidscience | rlp/accounts/search_indexes.py | Python | mit | 485 |
from django.db.models import QuerySet
from django.test import TestCase
from charcoallog.bank.brief_bank_service import BriefBank
from charcoallog.core import service
from charcoallog.core.service import BuildHome
from charcoallog.investments.brief_investment_service import BriefInvestment
class BuildHomeTest(TestCas... | hpfn/charcoallog | charcoallog/core/tests/test_service.py | Python | gpl-3.0 | 1,665 |
import numpy as np
__all__ = ["Metropolis"]
class Metropolis(object):
"""Accept steps based on the metropolis criterion
Parameters
----------
temperature : float
random : callable
return a random number in [0,1)
"""
def __init__(self, temperature, random=np.random.rand):
... | js850/PyGMIN | pygmin/accept_tests/metropolis.py | Python | gpl-3.0 | 2,138 |
"""
:Author: Pierre Barbier de Reuille <pierre.barbierdereuille@gmail.com>
Module implementing kernel-based estimation of density of probability.
"""
from __future__ import division, absolute_import, print_function
import numpy as np
from .kernels import normal_kernel1d
from .utils import namedtuple
from scipy import... | jtcb/regress-plan | astar/pyqt_fit/kde.py | Python | gpl-2.0 | 29,721 |
#
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later version.
#
#... | courtarro/gnuradio | gr-utils/python/modtool/templates.py | Python | gpl-3.0 | 20,594 |
# A POST request using requests library
import requests
# Base URL being accessed
url = 'http://httpbin.org/post'
# Dictionary of query parameters (if any)
parms = {
'name1' : 'value1',
'name2' : 'value2'
}
# Extra headers
headers = {
'User-agent' : 'none/ofyourbusiness',
'Spam' : 'Eggs'
}
resp = req... | tuanavu/python-cookbook-3rd | src/11/interacting_with_http_services_as_a_client/example3.py | Python | mit | 467 |
'''
gslab_misc: A library for miscellaneous python tools
============================================================================================
Current tools:
gencat: a Python library for concatenating text files.
'''
from .gencat.gencat import gencat
| gslab-econ/gslab_python | gslab_misc/__init__.py | Python | mit | 264 |
import json
class Record(object):
"""
Base class for TM record types.
"""
def __init__(self, context, resource_type=None, backing=None):
"""
Initiates an empty Record object.
context: Context
Determines the TM instance and organization to which the record
... | taguchimail/taguchi-python-api | taguchi/record.py | Python | mit | 1,229 |
import json
from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404
from django.views.decorators.http import require_http_methods
from .models import VisitCount
from .services import update_visit_count
@require_http_methods(["POST"])
def count_visit_ajax(request):
""" add 1 ... | FrancoisConstant/django-visits | visits/views.py | Python | mit | 643 |
# -*- coding: utf-8 -*-
# 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... | googleads/google-ads-python | google/ads/googleads/v10/resources/types/experiment_arm.py | Python | apache-2.0 | 2,613 |
import cv2
import numpy as np
def createMultipleThresholds(img):
#img = cv2.GaussianBlur(img, (7,7), 3)
combined_mask = np.zeros((img.shape[0], img.shape[1]), np.uint8) # start off with 2D array of zeros
# range for HSV threshold:
range_hsv = np.array([1,50,50]) # give little flexibility in hue but more in sat & v... | WWPOL/CV-Pong | hand_detection_test.py | Python | mit | 2,934 |
import multiprocessing
import logging
class Experimenter(object):
"""
Coordinated, parallel execution of Experiments with logging.
"""
def __init__(self, log_name, experiments, cpu_limit=2**16):
"""
:param experiments: A list of pypuf.experiments.experiment.base.Experiment
:pa... | nicostephan/pypuf | pypuf/experiments/experimenter.py | Python | gpl-3.0 | 1,942 |
import string
from process_common import *
from module_info import *
from module_skins import *
import string
# WARNING: The following should be the same as the number in face_generator.h
num_voice_types = 2
#####################
def replace_spaces(s0):
return string.replace(s0," ","_")
def write_face_tex(ofile... | CatalansMB/War1714 | src/process_skins.py | Python | gpl-2.0 | 3,230 |
# -*- coding: utf-8 -*-
"""
When lammps.data file was generated using msi2lmp.exe from MS-car/mdf with ClayFF, there are many redundant
bonds/angles/dihedrals/impropers etc, ususlly tens of thousands.
This file is used to remove redundant connections in .mdf file, but seems cannot remove clean after generating
.da... | riddlezyc/geolab | src/io/removeRedundant-mdf.py | Python | gpl-3.0 | 1,124 |
import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='nirvaris-profile',
version='3.0',
... | nirvaris/nirvaris-profile | setup.py | Python | mit | 1,256 |
#!/usr/bin/env python3
# Copyright (c) 2012 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.
'''Unit tests for ChromeScaledImage.'''
from __future__ import print_function
import os
import sys
if __name__ == '__main__':
... | chromium/chromium | tools/grit/grit/gather/chrome_scaled_image_unittest.py | Python | bsd-3-clause | 6,901 |
# Copyright 2012 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.
import logging
import tempfile
from telemetry import decorators
from telemetry.image_processing import image_util
from telemetry.image_processing import rgb... | CTSRD-SOAAP/chromium-42.0.2311.135 | tools/telemetry/telemetry/core/tab_unittest.py | Python | bsd-3-clause | 7,458 |
import tomviz.operators
class BinaryMinMaxCurvatureFlow(tomviz.operators.CancelableOperator):
def transform_scalars(self, dataset, stencil_radius=2, iterations=10,
threshold=50.0):
"""This filter smooths a binary image by evolving a level set with a
curvature-based speed... | cjh1/tomviz | tomviz/python/BinaryMinMaxCurvatureFlow.py | Python | bsd-3-clause | 3,933 |
from django.core.urlresolvers import reverse
from django.test import RequestFactory
from django.test import TestCase
from polling.models import CANDIDATE_CLINTON
from polling.models import CANDIDATE_STEIN
from polling.tests.factories import StateFactory
from users.tests.factories import UserFactory
from users.views im... | sbuss/voteswap | users/tests/test_profile_view.py | Python | mit | 3,936 |
from rest_framework import serializers
from astrobin_apps_iotd.models import IotdStaffMemberSettings
from common.mixins import RequestUserRestSerializerMixin
class StaffMemberSettingsSerializer(RequestUserRestSerializerMixin, serializers.ModelSerializer):
class Meta:
model = IotdStaffMemberSettings
... | astrobin/astrobin | astrobin_apps_iotd/api/serializers/staff_member_settings_serializer.py | Python | agpl-3.0 | 342 |
import itertools
import mimetools
import mimetypes
from cStringIO import StringIO
import urllib
import urllib2
import json
#import cookielib
"""
Use this view:
https://github.com/mbertrand/cga-worldmap/blob/dvn/geonode/dvn/views.py
Token
https://github.com/mbertrand/cga-worldmap/blob/dvn/geonode/settings/base.py
"""
... | IQSS/geoconnect | scripts/worldmap_api/test_import.py | Python | apache-2.0 | 1,599 |
# Copyright 2013-2020 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 Swarm(MakefilePackage):
"""A robust and fast clustering method for amplicon-based studies.... | iulian787/spack | var/spack/repos/builtin/packages/swarm/package.py | Python | lgpl-2.1 | 749 |
#!/usr/bin/env python3
"""
SVG cosmic dust generator.
"""
import base64
import os
import subprocess
import sys
from random import choice, randint, random
import twitter
from mako.template import Template
__license__ = 'http://unlicense.org/'
TEMPLATE_PATH = 'template.svg'
OUTPUT_SVG_PATH = 'output.svg'
OUTPUT_PN... | araile/dust | dust.py | Python | unlicense | 7,403 |
# Copyright (c) 2012 NetApp, Inc. All rights reserved.
# Copyright (c) 2014 Navneet Singh. All rights reserved.
# Copyright (c) 2014 Bob Callaway. 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 ... | Akrog/cinder | cinder/volume/drivers/netapp/options.py | Python | apache-2.0 | 9,645 |
from marshmallow import post_load
from marshmallow_sqlalchemy import field_for
from models import ma, User, Device, Measurement
class UserSchema(ma.Schema):
id = field_for(User, 'id', dump_only=True)
class Meta:
# Fields to expose
fields = ('id', 'name', 'username')
model = User
@... | KMSkelton/cgm_flask | schema.py | Python | mit | 920 |
#!/usr/bin/env python
#
# Copyright 2014 Facebook
#
# 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... | jetskijoe/SickGear | lib/tornado/http1connection.py | Python | gpl-3.0 | 31,668 |
import sys
sys.path.append("..")
from data_mining.association_rule.base import rules, lift, support
from data_mining.association_rule.apriori import apriori
from data_mining.association_rule.liftmin import apriorilift
from pat_data_association_rules import compare
LE = "leite"
PA = "pao"
SU = "suco"
OV = "ovos"
CA =... | JoaoFelipe/data-mining-algorithms | examples/custom_association_rules.py | Python | mit | 560 |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import os
import unittest
import xml.etree.ElementTree as ET
from pymatgen.core import Lattice, Structure
from pymatgen.io.exciting import ExcitingInput
from pymatgen.util.testing import PymatgenTest
"""
Tests the module to ... | vorwerkc/pymatgen | pymatgen/io/exciting/tests/test_inputs.py | Python | mit | 6,569 |
# -*- coding: utf-8 -*-
import numpy as np
from scipy.misc import logsumexp
def hypercube2simplex(zs):
fac = np.concatenate((1 - zs, np.array([1])))
zsb = np.concatenate((np.array([1]), zs))
fs = np.cumprod(zsb) * fac
return fs
def hypercube2simplex_jacobian(fs, zs):
jaco = np.zeros((zs.size, ... | ixkael/Delight | delight/posteriors.py | Python | mit | 4,921 |
#!/usr/local/bin/python
import os
import mysql.connector as mysql
metrics_mysql_password = os.environ["METRICS_MYSQL_PWD"]
sql_host = os.environ["SQL_HOST"]
metrics = os.environ["QUERY_ON"]
def dump_query_results():
"""
It is a simple SQL table dump of a given query so we can supply users with custom tables... | kbase/metrics | source/custom_scripts/dump_query_results.py | Python | mit | 4,387 |
"""
Admin interface for knowhow
"""
from flask_admin import Admin
admin = Admin(name='Knowhow',
template_mode='bootstrap3')
| abkfenris/knowhow | knowhow/admin/__init__.py | Python | mit | 140 |
"""Tests for discovery."""
import unittest
# Third-party modules.
import mock
from mlab.disco import simple_session
from mlab.disco import models
from mlab.disco import network
# Module under test.
import discovery
_JUNIPER_QFX_SYS_DESCR = ('Juniper Networks, Inc. qfx5100-48s-6q Ethernet '
... | m-lab/collectd-mlab | site-packages/mlab/disco/discovery_test.py | Python | apache-2.0 | 7,545 |
from typing import NamedTuple
from kfp.components import create_component_from_func, InputPath, OutputPath
def automl_create_tables_dataset_from_csv(
data_path: InputPath('CSV'),
target_column_name: str = None,
column_nullability: dict = {},
column_types: dict = {},
gcs_staging_uri: str = None, #... | kubeflow/pipelines | components/contrib/google-cloud/automl/Tables/Create_dataset/from_CSV/component.py | Python | apache-2.0 | 8,116 |
from __future__ import division
import sys
import tempfile
from distutils.spawn import find_executable
from subprocess import Popen, PIPE
from mbuild.compound import Compound
from mbuild.exceptions import MBuildError
from mbuild.box import Box
from mbuild import clone
__all__ = ['fill_box', 'fill_region', 'solvate']... | ctk3b/mbuild | mbuild/packing.py | Python | mit | 7,791 |
from .conf import settings
if settings.ENABLE_MULTILANGUAGE and 'modeltranslation' in settings.INSTALLED_APPS:
from modeltranslation.translator import translator, TranslationOptions
from .models import (Country)
class CountryTranslationOptions(TranslationOptions):
fields = ('name',)
translato... | kunitoki/nublas | nublas/translation.py | Python | mit | 367 |
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from django.utils import unittest
from django.contrib.auth.models import AnonymousUser, User
from account.views import SignupView, LoginView
class SignupEnabledView(SignupView):
def is_open(self):
return True... | django-rea/nrp | account/tests/test_views.py | Python | agpl-3.0 | 2,899 |
"""Analysis tools for wepy datasets.
Analysis of weighted ensemble (WE) datasets are complicated by their
nonlinear branching structure, and thus in its raw form cannot be
analyzed by the tools available for linear trajectories. See the
documentation (TODO: link) for a more in depth explanation of the
general structur... | ADicksonLab/wepy | src/wepy/analysis/__init__.py | Python | mit | 1,665 |
from django.shortcuts import render_to_response
from django.shortcuts import render
from Report.models import reports
from Report.models import Document
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
import sys
from Report.models import Folder
from pprint import pprint... | vivianbuan/cs3240-s15-team20 | SecureWitness/Report/views.py | Python | mit | 15,354 |
import os
import pkgutil
from importlib import import_module
from threading import local
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from django.utils._os import upath
from django.utils.functional import cached_property
from django.utils.module_... | memtoko/django | django/db/utils.py | Python | bsd-3-clause | 9,585 |
from datetime import datetime, timedelta
from time import sleep
from random import uniform
class SleepSchedule(object):
"""Pauses the execution of the bot every day for some time
Simulates the user going to sleep every day for some time, the sleep time
and the duration is changed every day by a random of... | cmezh/PokemonGo-Bot | pokemongo_bot/sleep_schedule.py | Python | mit | 12,346 |
import re
from urlparse import urlparse
def is_url(url):
url_pattern = re.compile('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+')
match = url_pattern.match(url)
if match:
return True
else:
return False
def base_url(url):
_parse_object = urlparse(ur... | Ralnoc/pyesdump | lib/url_tools.py | Python | gpl-2.0 | 406 |
from imports import *
ALTO=400
ANCHO=700
class Player(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface((50, 50))
self.image.fill((0, 0, 0))
pygame.draw.circle(self.image, (0, 0, 255), (25, 25), 25, 0)
self.rect = s... | jdiegoh3/Introduccion_juegos_plataforma | main.py | Python | gpl-3.0 | 3,006 |
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
import math
from open_image import open_image
def min_filter(path, region_size):
'''
Values for every pixel equals to the min of all values in the region
:param path: path to the image
:param region_size: size of the... | vvvityaaa/PyImgProcess | filter/min_filter.py | Python | mit | 1,289 |
from openerp.osv import osv, fields
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {}
def create(self, cr, uid, vals, context=None):
res = super(res_partner, self).create(cr, uid, vals, context=context)
config = self.pool.get("ir.model.data").xmlid_to_object(cr, uid, "customer_auto_email.conf... | charismab45515t/dtbs-carrent | customer_auto_email/model/res_partner.py | Python | gpl-2.0 | 637 |
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(36,GPIO.OUT)
while 1:
GPIO.output(36, GPIO.HIGH);
time.sleep(1);
GPIO.output(36, GPIO.LOW);
time.sleep(1);
| duchtran/cmpe195 | LED.py | Python | gpl-2.0 | 188 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-03-22 22:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Provide... | rails-to-cosmos/force | providers/migrations/0001_initial.py | Python | gpl-2.0 | 933 |
import angr
class rand(angr.SimProcedure):
def run(self):
rval = self.state.solver.BVS('rand', 31, key=('api', 'rand'))
return rval.zero_extend(self.state.arch.bits - 31)
| iamahuman/angr | angr/procedures/libc/rand.py | Python | bsd-2-clause | 192 |
"""
This file test whether Tribler is able to start when TriblerChain is enabled.
"""
from twisted.internet.defer import inlineCallbacks
from Tribler.Test.test_as_server import TestAsServer
from Tribler.community.triblerchain.community import TriblerChainCommunity, TriblerChainCommunityCrawler
from Tribler.dispersy.ut... | vandenheuvel/tribler | Tribler/Test/Community/Triblerchain/test_startup.py | Python | lgpl-3.0 | 2,154 |
# Copyright (C) 2005-2007 Carabos Coop. V. All rights reserved
# Copyright (C) 2008-2017 Vicent Mas. All rights reserved
#
# 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 Found... | ankostis/ViTables | vitables/start.py | Python | gpl-3.0 | 6,646 |
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow.contrib.distributions as tf_dist
import numpy as np
def variable_summaries(name, var):
"""Attach a lot of summaries to a Tensor."""
with tf.name_scope('summaries'):
mean = tf.reduce_mean(var)
t... | Kkari/bsc_thesis | my_rbm.py | Python | apache-2.0 | 24,089 |
# Copyright 2016 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... | mlperf/training_results_v0.5 | v0.5.0/google/research_v3.32/gnmt-tpuv3-32/code/gnmt/model/staging/models/rough/nmt/decoder.py | Python | apache-2.0 | 12,402 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-01-12 14:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0019_auto_20170105_1324'),
]
operations = [
migrations.RemoveFiel... | abecede753/trax | website/events/migrations/0020_auto_20170112_1440.py | Python | mit | 858 |
# This library is a cut down version of the `six` package; it
# is designed to contain exactly & only what we need to support
# Python 2 & 3 concurrently.
import sys
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
if PY3:
import io
StringIO = io.StringIO
def iteritems(d, **kw):
ret... | djm/python-scrapyd-api | scrapyd_api/compat.py | Python | bsd-2-clause | 604 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | inveniosoftware/invenio-cloudconnector | invenio_cloudconnector/version.py | Python | gpl-2.0 | 1,153 |
"""
WSGI config for fvserver project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | grahamgilbert/Crypt-Server | fvserver/wsgi.py | Python | apache-2.0 | 1,139 |
# -*- coding: utf-8 -*-
#
# (DC)² - DataCenter Deployment Control
# Copyright (C) 2010, 2011, 2012, 2013, 2014 Stephan Adig <sh@sourcecode.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; eit... | sadig/DC2 | components/dc2-lib/dc2/lib/web/helpers/__init__.py | Python | gpl-2.0 | 895 |
import tweetsclient.config
import tweetsclient.utils
from tweetsclient.config import Config
from tweetsclient.plugins import Plugin, TrackPlugin, QueuePlugin
from tweetsclient.beanstalk import BeanstalkPlugin
from tweetsclient.config_track import ConfigTrackPlugin
from tweetsclient.mysql_track import MySQLTrackPlugin... | sunlightlabs/politwoops-tweet-collector | lib/tweetsclient/__init__.py | Python | bsd-3-clause | 321 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Simon Perkins
#
# This file is part of montblanc.
#
# 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 L... | ska-sa/montblanc | montblanc/impl/rime/tensorflow/RimeSolver.py | Python | gpl-2.0 | 51,658 |
# Generated by Django 2.1.7 on 2019-03-23 03:46
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('discounts', '0008_auto_20180811_1026'),
]
operations = [
migrations.AlterField(
model_name='dis... | django-danceschool/django-danceschool | danceschool/discounts/migrations/0009_auto_20190322_2346.py | Python | bsd-3-clause | 972 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2016 Jonathan Schultz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... | BarraQDA/twitterScrape | twitterScrape/twitterValidate.py | Python | gpl-3.0 | 2,675 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class ShortCodeTestCase(Integra... | twilio/twilio-python | tests/integration/api/v2010/account/test_short_code.py | Python | mit | 6,758 |
"""
Rewrite engine to get disjuntive normal form of the rules
"""
from collections import OrderedDict
from functools import singledispatch
from itertools import chain, product
from pyknow.conditionalelement import AND, OR, NOT
from pyknow.fieldconstraint import ORFC, NOTFC, ANDFC
from pyknow.rule import Rule
from pykn... | buguroo/pyknow | pyknow/matchers/rete/dnf.py | Python | lgpl-3.0 | 3,591 |
"""Kinematic chain module."""
import logging
from abc import abstractmethod
from typing import Any, Optional, Sequence, Sized, Union
import attr
import numpy as np # type: ignore
from pybotics.errors import PyboticsError
from pybotics.json_encoder import JSONEncoder
from pybotics.link import Link, MDHLink, RevoluteM... | nnadeau/pybotics | pybotics/kinematic_chain.py | Python | mit | 5,242 |
import unittest2
import run_parallel as rp
import run_extract
import pq
from mock import patch
from io import BytesIO
import filecmp
import os
import subprocess
run_extract_tmp = 'tests/run_extract_tmp.tsv'
run_extract_expected = 'tests/run_extract.tsv'
def runcmd(command):
child = subprocess.Popen(
... | alexbyrnes/FCC-Political-Ads_The-Code | fpa/tests/tests.py | Python | agpl-3.0 | 4,833 |
from django.core.exceptions import ValidationError
from cyder.base.tests import ModelTestMixin
from cyder.cydns.address_record.models import AddressRecord
from cyder.cydns.cname.models import CNAME
from cyder.cydns.domain.models import Domain
from cyder.cydns.nameserver.models import Nameserver
from cyder.cydns.soa.mo... | zeeman/cyder | cyder/cydns/domain/tests/basic_tests.py | Python | bsd-3-clause | 7,274 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import autoslug.fields
class Migration(migrations.Migration):
dependencies = [
('promises', '0002_auto_20150512_0816'),
]
operations = [
migrations.AlterField(
model_name... | ciudadanointeligente/ddah-promises | promises/migrations/0003_auto_20150828_1500.py | Python | bsd-3-clause | 463 |
#!/usr/bin/env python -u
# encoding: utf-8
| peterhil/leftrb | leftrb/test/__init__.py | Python | gpl-3.0 | 43 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2013-2014, Epic Games, Inc.
# 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | hryamzik/ansible | lib/ansible/modules/monitoring/zabbix/zabbix_group.py | Python | gpl-3.0 | 6,570 |
# 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
# distributed under t... | google/googleapps-password-generator | models/password_generation_history.py | Python | apache-2.0 | 1,011 |
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
from sklearn.cross_validation import train_test_split, cross_val_score
from sklearn import svm
from sklearn.decomposition import PCA
def load_data(filename):
return np.genfromtxt(filename, delimiter=',')
def perform_pca(Xs, n_components):
... | aufziehvogel/kaggle | scikit-learn/predictor.py | Python | mit | 3,247 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import pickle
import uuid
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.views.generic import DetailView
from braces.views import LoginRequiredMixin
from redis... | wbg-optronix-lab/emergence-lab | dashboard/views.py | Python | mit | 4,847 |
#!/usr/bin/env python2.7
import urllib2
import json
import ConfigParser
import argparse
import os
import collections
class DigitalOceanInventory(object):
def __init__(self):
self.conf = ConfigParser.SafeConfigParser()
self.args = None
self.api_token = None
def read_config(self):
... | 2bithacker/ansible-modules | inventory/digitalocean.py | Python | bsd-3-clause | 2,629 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# ------------------------
# ----- AGGLEditor -----
# ------------------------
#
# A free/libre open-source graph grammar drawing tool.
#
# Copyright (C) 2012-2017 by Luis J. Manso
#
# AGGLEditor is free software: you can redistribute it and/or modify
... | ljmanso/AGM2 | tools/AGGLEditor.py | Python | gpl-3.0 | 31,833 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import base64
import hashlib
import imghdr
import struct
import urllib
from unittest import skip
from marionette impor... | cstipkovic/spidermonkey-research | testing/marionette/harness/marionette/tests/unit/test_screenshot.py | Python | mpl-2.0 | 7,925 |
__author__ = 'Shin'
"""
This is Django unit test example code.
Django unit test run with command,
"manage.py test target_app_name"
if you want test all app, let target_app_name blank
"manage.py test"
and then coverage run, report with command,
"python -m coverage run --source='.' manage.py test ta... | ShinJJang/django-unit-test-example | test_Exam.py | Python | gpl-2.0 | 3,803 |
import base64
import hashlib
import hmac
import uuid
from functools import partial
from django.conf import settings
from django.db.models import Q
from django.utils.encoding import force_bytes
import olympia.core.logger
from olympia import amo
from olympia.users.models import DeniedName, UserProfile
log = olympia... | lavish205/olympia | src/olympia/users/utils.py | Python | bsd-3-clause | 3,069 |
# -*- coding: utf-8 -*-
import odoo
from odoo.addons.point_of_sale.tests.common import TestPoSCommon
@odoo.tests.tagged('post_install', '-at_install')
class TestPosMargin(TestPoSCommon):
"""
Test the margin computation on orders with basic configuration
The tests contain the base scenarios.
"""
... | jeremiahyan/odoo | addons/point_of_sale/tests/test_pos_margin.py | Python | gpl-3.0 | 15,246 |
# 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 (t... | apache/allura | Allura/allura/lib/phone/nexmo.py | Python | apache-2.0 | 4,275 |
"""Redo the builtin repr() (representation) but with limits on most sizes."""
__all__ = ["Repr", "repr", "recursive_repr"]
import __builtin__ as builtins
from itertools import islice
try:
from thread import get_ident
except ImportError:
from _dummy_thread32 import get_ident
def recursive_repr(fillvalue='...'... | ARMmbed/yotta_osx_installer | workspace/lib/python2.7/site-packages/functools32/reprlib32.py | Python | apache-2.0 | 5,126 |
# -*- coding: utf-8 -*-
'''
loadstutents.py (camel/management)
xlrd: cell types: 0=Empty, 1=Text, 2=Number, 3=Date, 4=Boolean, 5=Error, 6=Blank
'''
import os, time, xlrd
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.contrib.auth.models import User
fr... | alcarney/camel | core/management/commands/backup/loadstudents_v1.py | Python | gpl-2.0 | 1,391 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.