text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
"""
SOM-based learning functions for CFProjections.
"""
from math import ceil
import param
from imagen import PatternGenerator, Gaussian
from holoviews import BoundingBox
from topo.base.arrayutil import L2norm, array_argmax
from topo.base.cf import CFPLearningFn
### JABHACKALERT: This class will be removed once th... | ioam/topographica | topo/learningfn/som.py | Python | bsd-3-clause | 5,130 | 0.009747 |
# This challenge is similar to the previous one. It operates under the same
# premise that you will have to replace the check_equals_ function. In this
# case, however, check_equals_ is called so many times that it wouldn't make
# sense to hook where each one was called. Instead, use a SimProcedure to write
# your ow... | cliffe/SecGen | modules/utilities/unix/ctf/metactf/files/repository/src_angr/dist/scaffold10.py | Python | gpl-3.0 | 4,519 | 0.011286 |
from .log import log_with
import logging
log = logging.getLogger(__name__)
import binascii
from .crypto import geturandom
import qrcode
import StringIO
import urllib
from privacyidea.lib.crypto import urandom
import string
import re
def generate_otpkey(key_size=20):
"""
generates the HMAC key of keysize. Shoul... | woddx/privacyidea | privacyidea/lib/utils.py | Python | agpl-3.0 | 5,349 | 0.002243 |
import numpy as n
import scipy.interpolate
import scipy.ndimage
def congrid(a, newdims, method='linear', centre=False, minusone=False):
'''Arbitrary resampling of source array to new dimension sizes.
Currently only supports maintaining the same number of dimensions.
To use 1-D arrays, first promote them to... | gsnyder206/synthetic-image-morph | congrid.py | Python | gpl-2.0 | 3,937 | 0.018542 |
'''
This script gets log loss on the validation set from full_val_set.pkl,
(generated by the full_validation_set.py script) for some simple,
no-learning models like the HistCTR, all 0's, or mean-value benchmark.
author: David Thaler
date: July 2015
'''
import avito2_io
from datetime import datetime
from eval import ... | davidthaler/Kaggle_Avito-2015 | val_run0.py | Python | mit | 1,259 | 0.01668 |
#!/usr/bin/python2.7 -tt
"""
Copyright 2012 University Of Southern California
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
... | rika/precip | precip/experiment.py | Python | apache-2.0 | 62,853 | 0.008146 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2016 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eith... | jitka/weblate | weblate/trans/admin_views.py | Python | gpl-3.0 | 7,747 | 0 |
#FLM: AT ChrisCorner
"""Round selected corners:
RADIUS is a Point instance that represents the x and y radius of the corner
HANDLELENGTH is a number between 0. and 1. that determines how long the
bezier handles should be, affecting the steepness of the curve
"""
import math
def getContourRange(nid,g):
cID = g.... | huertatipografica/huertatipografica-fl-scripts | AT_Outlines/AT-RoundCorners.py | Python | apache-2.0 | 2,230 | 0.045291 |
# Copyright: (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible import constants as ... | gregdek/ansible | lib/ansible/cli/adhoc.py | Python | gpl-3.0 | 7,375 | 0.002847 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'UI_RigDisplay.ui'
#
# Created: Wed Mar 21 21:43:33 2018
# by: pyside-uic 0.2.14 running on PySide 1.2.0
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_Form(object):
def setupUi(s... | rendermotion/RMPY | Tools/QT4/ui/FormRigDisplay.py | Python | lgpl-3.0 | 1,331 | 0.003005 |
# Generated by Django 2.2.13 on 2021-09-28 11:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bands', '0048_band_profile_thumb'),
]
operations = [
migrations.AddField(
model_name='band',
name='hidden_in_catalo... | InsulaCoworking/MusicCity | bands/migrations/0049_band_hidden_in_catalog.py | Python | gpl-2.0 | 567 | 0.001764 |
# ------------------------------------------------------------------------------------------------
# Copyright (c) 2016 Microsoft Corporation
#
# 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 ... | murven/malmo | Malmo/samples/Python_examples/tutorial_5_solved.py | Python | mit | 7,626 | 0.011671 |
#!/usr/bin/env python
import subprocess
import re
import math
from optparse import OptionParser
length_regexp = 'Duration: (\d{2}):(\d{2}):(\d{2})\.\d+,'
re_length = re.compile(length_regexp)
def main():
(filename, split_length) = parse_options()
if split_length <= 0:
print "Split length can't be 0... | ArneBab/video-splitter | ffmpeg-split.py | Python | apache-2.0 | 2,871 | 0.019157 |
"""
Support for Huawei LTE routers.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/huawei_lte/
"""
from datetime import timedelta
from functools import reduce
import logging
import operator
import voluptuous as vol
import attr
from homeassistant.const... | persandstrom/home-assistant | homeassistant/components/huawei_lte.py | Python | apache-2.0 | 3,730 | 0 |
# pylint: disable=missing-docstring, missing-module-docstring, invalid-name
# pylint: disable=too-few-public-methods, line-too-long, dangerous-default-value
# pylint: disable=wrong-import-order
# https://github.com/PyCQA/pylint/issues/4774
def github_issue_4774():
# Test literals
# https://github.com/PyCQA/pyl... | PyCQA/pylint | tests/functional/u/use/use_implicit_booleaness_not_comparison.py | Python | gpl-2.0 | 5,576 | 0.009146 |
# -*- coding: utf-8 -*-
'''
Sphinx setting.
'''
import os.path
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
extensions = [
'mamchecker.inl',
'sphinx.ext.mathjax',
'sphinxcontrib.tikz',
'sphinxcontrib.texfigure']
# i.e. same as conf.py and with page.html containing only {... | mamchecker/mamchecker | mamchecker/conf.py | Python | gpl-3.0 | 1,452 | 0.004132 |
"""
Harshad Number implementation
See: http://en.wikipedia.org/wiki/Harshad_number
"""
def is_harshad(n):
result=0
while n:
result+=n%10
n//=10
return n%result == 0 # Return if the remainder of n/result is 0 else return False
def main():
# test contains a set of harshad numbers
... | kennyledet/Algorithm-Implementations | 10_Harshad_Number/Python/wasi0013/HarshadNumber.py | Python | mit | 856 | 0.026869 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-05-16 18:59
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0012_auto_20180227_0858'),
]
operations = [
migrations.AlterModelOptions(
... | cmjatai/cmj | cmj/core/migrations/0013_auto_20180516_1559.py | Python | gpl-3.0 | 1,070 | 0.000939 |
from .. import BaseApi, NamedEndpoint
from .urls import MatchApiUrls
class MatchApi(NamedEndpoint):
"""
This class wraps the LoR-Match-V1 Api calls provided by the Riot API.
See https://developer.riotgames.com/apis#lor-match-v1 for more detailed
information
"""
def __init__(self, base_api: B... | pseudonym117/Riot-Watcher | src/riotwatcher/_apis/legends_of_runeterra/MatchApi.py | Python | mit | 1,097 | 0.000912 |
from .bgfx import *
from .bgfx_ex import *
from .bgfx_utils import *
from .bgfxdefines import *
| jnadro/pybgfx | pybgfx/__init__.py | Python | bsd-2-clause | 96 | 0 |
import numpy as np
from math import pi, tan, cos, sin, sqrt
import sys
import argparse
render = True
try:
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
except:
render = False
parser = argparse.ArgumentParser(description=\
"Calculates cutting path around cylinder for certain an... | mattjml/wood_cylinder_cut | cut.py | Python | apache-2.0 | 5,717 | 0.009271 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
**constants.py**
**Platform:**
Windows, Linux, Mac Os X.
**Description:**
Defines **Foundations** package default constants through the :class:`Constants` class.
**Others:**
"""
from __future__ import unicode_literals
import os
import platform
import fou... | KelSolaar/Foundations | foundations/globals/constants.py | Python | gpl-3.0 | 3,184 | 0.000942 |
# -*- coding: utf-8 -*-
from bottle import run, get, post, view, request, redirect, route, static_file, template
import bottle
import json
import threading
import requests
import time
import sys
messages = set([])
@bottle.route('/static/<path:path>')
def server_static(path):
return static_file(path, root='static'... | jpwbernardi/Computacao-Distribuida | Trabalho1/main.py | Python | gpl-3.0 | 816 | 0.011029 |
from math import exp
from colorsys import hls_to_rgb
import random
import struct
import threading
from time import sleep
class Wire:
def __init__(self, board, pin):
self.board = board
self.pin = pin
def __enter__(self):
self.board.uper_io(0, self.board.encode_sfp(100, [1]))
r... | 8devices/IoTPy | IoTPy/sandbox/ledstrip.py | Python | mit | 5,948 | 0.000841 |
import sys
sys.path.insert(1, "../../../")
import h2o, tests
def swpredsRF():
# Training set has two predictor columns
# X1: 10 categorical levels, 100 observations per level; X2: Unif(0,1) noise
# Ratio of y = 1 per Level: cat01 = 1.0 (strong predictor), cat02 to cat10 = 0.5 (weak predictors)
... | kyoren/https-github.com-h2oai-h2o-3 | h2o-py/tests/testdir_algos/rf/pyunit_swpredsRF.py | Python | apache-2.0 | 1,272 | 0.015723 |
import os
from flask import Flask
from ark.utils._time import friendly_time
from ark.master.views import master_app
from ark.account.views import account_app
from ark.goal.views import goal_app
from ark.oauth.views import oauth_app
from ark.dashboard.views import dashboard_app
from ark.goal.models import Goal
from ar... | N402/NoahsArk | ark/app.py | Python | mit | 3,309 | 0.000302 |
from Probabilidades import Probabilidad
from validador import *
a = Probabilidad()
a.cargarDatos("1","2","3","4","5","6")
uno = [" ------- ","| |","| # |","| |"," ------- "]
dos = [" ------- ","| # |","| |","| # |"," ------- "]
tres = [" ------- ","| # |","| # |","|... | pepitogithub/PythonScripts | Dados.py | Python | gpl-2.0 | 1,284 | 0.043614 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-09 12:57
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):
initial = True
dependencies = [
migration... | stphivos/django-angular2-fullstack-devops | backend/api/migrations/0001_initial.py | Python | mit | 955 | 0.002094 |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
# clicking on Welcome link.
driver = webdriver.Firefox()
driver.get("http://www.practiceselenium.com/")
driver.find_element_by_link_text("Check Out").click()
assert "Check Out" in driver.title
driver.close() | bishnucit/Python-Preludes | 6.py | Python | mit | 286 | 0.003497 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import pytest
from cryptography.hazmat.backends import _available_backen... | Ayrx/cryptography | tests/conftest.py | Python | bsd-3-clause | 1,721 | 0 |
"""
Yum plugin for Amazon S3 access.
This plugin provides access to a protected Amazon S3 bucket using either boto
or Amazon's REST authentication scheme.
On CentOS this file goes into /usr/lib/yum-plugins/s3.py
You will also need two configuration files. See s3.conf and s3test.repo for
examples on how to deploy t... | pjxiao/yum-s3-plugin | s3.py | Python | apache-2.0 | 9,268 | 0.006798 |
"""The test for the threshold sensor platform."""
import unittest
from homeassistant.setup import setup_component
from homeassistant.const import (
ATTR_UNIT_OF_MEASUREMENT, STATE_UNKNOWN, TEMP_CELSIUS)
from tests.common import get_test_home_assistant
class TestThresholdSensor(unittest.TestCase):
"""Tes... | persandstrom/home-assistant | tests/components/binary_sensor/test_threshold.py | Python | apache-2.0 | 13,704 | 0 |
from distutils.core import setup
from Cython.Build import cythonize
setup(
ext_modules=cythonize("matvec.pyx"),
)
| NuclearTalent/NuclearStructure | doc/Programs/cython_examples/matvec/setup.py | Python | cc0-1.0 | 119 | 0 |
# -*- coding: utf-8 -*-
"""The parsers and plugins interface classes."""
import abc
import os
from plaso.lib import errors
class BaseFileEntryFilter(object):
"""File entry filter interface."""
# pylint: disable=redundant-returns-doc
@abc.abstractmethod
def Match(self, file_entry):
"""Determines if a fi... | Onager/plaso | plaso/parsers/interface.py | Python | apache-2.0 | 8,018 | 0.008855 |
# -*- coding: utf-8 -*-
"""Flask application for publishing changes."""
__version__ = "0.0.1"
from cis_change_service import api
from cis_change_service import common
from cis_change_service import exceptions
from cis_change_service import idp
from cis_change_service import profile
__all__ = [api, common, exceptions... | mozilla-iam/cis | python-modules/cis_change_service/cis_change_service/__init__.py | Python | mpl-2.0 | 349 | 0 |
#!/usr/bin/env python
"""
Goal: Implement the application entry point.
@authors:
Andrei Sura <sura.andrei@gmail.com>
"""
import argparse
from olass.olass_client import OlassClient
from olass.version import __version__
DEFAULT_SETTINGS_FILE = 'config/settings.py'
def main():
""" Read args """
parser = arg... | indera/olass-client | olass/run.py | Python | mit | 1,316 | 0 |
import django_tables2 as tables
from django_tables2 import RequestConfig
from django_tables2.utils import A # alias for Accessor
from django.shortcuts import render
import inspect
class DtTemplate(tables.Table):
#name_first = tables.Column(verbose_name="First Name")
#name_last = tables.LinkColumn('track:... | ziposoft/godiva | src/zs/view_dt.py | Python | mit | 582 | 0.015464 |
# test_field.py
#
# Copyright 2017 Daniel Mende <mail@c0decafe.de>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain th... | ernw/dizzy | dizzy/tests/test_field.py | Python | bsd-3-clause | 3,596 | 0.003615 |
#!/usr/bin/env python
# omega - python client
# https://github.com/jfillmore/Omega-API-Engine
#
# Copyright 2011, Jonathon Fillmore
# Licensed under the MIT license. See LICENSE file.
# http://www.opensource.org/licenses/mit-license.php
"""Uses python introspection to provide PHP-like "var_dump" functionality for de... | jfillmore/Omega-API-Engine | clients/python/omega/dbg.py | Python | mit | 8,885 | 0.008216 |
from rest_framework import permissions
from rest_framework.permissions import BasePermission
class IsAuthenticatedOrCreate(permissions.IsAuthenticated):
def has_permission(self, request, view):
if request.method == 'POST':
return True
return super(IsAuthenticatedOrCreate, self).has_perm... | CornellProjects/hlthpal | web/project/main/permissions.py | Python | apache-2.0 | 624 | 0.008013 |
# -*- coding: utf-8 -*-
# Copyright 2017 IBM RESEARCH. 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 requ... | atilag/qiskit-sdk-py | qiskit/qasm/_node/_gatebody.py | Python | apache-2.0 | 1,570 | 0 |
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
import os
import sys
class Command(BaseCommand):
help = 'Update SPIN SOS112 feed.'
def handle(self, *args, **options):
from prometapi.sos112.models import SOS112, fetch_sos112, parse_sos112
i... | zejn/prometapi | prometapi/sos112/management/commands/update_sos112.py | Python | agpl-3.0 | 707 | 0.008487 |
# 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... | gunan/tensorflow | tensorflow/python/framework/meta_graph_test.py | Python | apache-2.0 | 43,142 | 0.007 |
# -*- coding: utf-8 -*-
import numpy as np
class RBM(object):
"""Restricted Boltzmann Machine (RBM) """
def __init__(self, theano, T, input=None, n_visible=784, n_hidden=500,
W=None, hbias=None, vbias=None, np_rng=None,
theano_rng=None):
"""
RBM constructor.... | aelaguiz/pyvotune | pyvotune/theano/rbm.py | Python | mit | 13,636 | 0.00066 |
#********************************************************************************
#* Dionaea
#* - catches bugs -
#*
#*
#*
#* Copyright (C) 2009 Paul Baecher & Markus Koetter
#*
#* This program is free software; you can redistribute it and/or
#* modify it under t... | gento/dionaea | modules/python/scripts/store.py | Python | gpl-2.0 | 2,119 | 0.032091 |
# Copyright (c) 2001-2017, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | xlqian/navitia | source/jormungandr/jormungandr/scenarios/helper_classes/streetnetwork_path.py | Python | agpl-3.0 | 8,235 | 0.002186 |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | gkc1000/pyscf | pyscf/pbc/df/mdf_ao2mo.py | Python | apache-2.0 | 6,690 | 0.003737 |
# Copyright 2014 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.
"""Imports event data obtained from the inspector's timeline."""
from telemetry.timeline import importer
import telemetry.timeline.slice as tracing_slice
imp... | catapult-project/catapult-csm | telemetry/telemetry/timeline/inspector_importer.py | Python | bsd-3-clause | 2,689 | 0.008553 |
from dots_editor import core, utf8_braille
import os, pygame, pytest
TEST_STRING = u'\u2801\u2803\u2809\u2819\u2811'
TEST_FILENAME = 'test.txt'
def test_setenv():
assert os.environ["SDL_VIDEODRIVER"] == "dummy"
def test_key_to_dot(game):
assert game.key_to_dot(pygame.K_f) == 1
assert game.key_to_dot(pyga... | Gailbear/dots-editor | tests/test_core.py | Python | mit | 2,462 | 0.005686 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.fsl.epi import EPIDeWarp
def test_EPIDeWarp_inputs():
input_map = dict(args=dict(argstr='%s',
),
cleanup=dict(argstr='--cleanup',
),
dph_file=dict(argstr='--dph %s',
mandatory=Tr... | mick-d/nipype_source | nipype/interfaces/fsl/tests/test_auto_EPIDeWarp.py | Python | bsd-3-clause | 1,781 | 0.03032 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | jj0hns0n/geonode | geonode/upload/urls.py | Python | gpl-3.0 | 1,501 | 0.002665 |
import vim
def func_header_snippet(row):
cmt = "//!"
cb = vim.current.buffer
start = row
while start >= 0:
line = cb[start-1].strip()
if not line.startswith(cmt):
break
start -= 1
print("HDR")
def select_snippet(line):
line = line.strip()
if line.star... | peter1010/my_vim | vimfiles/py_scripts/snippet.py | Python | gpl-2.0 | 569 | 0.010545 |
# -*- coding: utf-8 -*-
"""
Base Population Model to handle different type of models
"""
from __future__ import print_function
from __future__ import division
from builtins import range
from builtins import object
from past.utils import old_div
import os
import sys
import math
import random
import platform
import glo... | popdynamics/popdynamics | basepop.py | Python | mit | 40,337 | 0.001289 |
from setuptools import setup
with open('README.rst') as f:
long_description = f.read()
setup(
name = "fukei",
version = "0.1",
license = 'MIT',
description = "A Python Tornado port of shadowsocks and socks proxy",
author = 'Thomas Huang',
url = 'https://github.com/thomashuang/Fukei',
... | thomashuang/Fukei | setup.py | Python | mit | 865 | 0.020809 |
'''
Thrown when a user doesn't have an available question. There may be questions
that haven't been answered, but none of them are in the 'ready' state, meaning
that they've been parsed but their answer hasn't been computed.
'''
class NoQuestionReadyException(Exception):
def __init__(self, user):
self.user... | anyweez/regis | face/util/exceptions.py | Python | gpl-2.0 | 2,294 | 0.012642 |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | won0089/oppia | core/tests/test_utils.py | Python | apache-2.0 | 26,631 | 0.000263 |
"""
This file is part of L3Morpho.
Author: Michael Gasser <gasser@cs.indiana.edu>
-----------------------------------------------------------------
internals.py is part of
Natural Language Toolkit: Internal utility functions
Copyright (C) 2001-2008 University of Pennsylvania
Author: Steven Bird <sb@csse.unimelb.edu.... | LowResourceLanguages/hltdi-l3 | l3xdg/morphology/internals.py | Python | gpl-3.0 | 16,052 | 0.002803 |
# Copyright 2017 Google 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 writing, s... | thenenadx/forseti-security | google/cloud/security/common/gcp_api/iam.py | Python | apache-2.0 | 1,047 | 0 |
# -*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring communication protocol... | nagyistoce/netzob | test/src/test_netzob/test_Common/test_Type/test_Endianess.py | Python | gpl-3.0 | 2,233 | 0.010767 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
# Greed is a dice game where you roll up to five dice to accumulate
# points. The following "score" function will be used calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
#
# * A set of three ones is 100... | kimegitee/python-koans | python3/koans/about_scoring_project.py | Python | mit | 2,731 | 0.014647 |
#!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... | carthach/essentia | test/src/unittests/all_tests.py | Python | agpl-3.0 | 8,953 | 0.006143 |
#!/usr/bin/env python
import urllib
import urllib2
import urlparse
import json
import os
PUSHOVER_API = "https://api.pushover.net/1/"
class PushoverError(Exception): pass
def pushover(**kwargs):
assert 'message' in kwargs
if not 'token' in kwargs:
kwargs['token'] = os.environ['PUSHOVER_TOKEN']
... | abelboldu/nagpy-pushover | nagpy/util/pushover.py | Python | epl-1.0 | 690 | 0.007246 |
print '''
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10,001st prime number?
'''
def problem():
x,limit = 1,0
while limit != 10001:
x += 1
if isprime(x): limit += 1
print x
problem()
| willybh11/python | projectEuler/problems/e7.py | Python | gpl-3.0 | 287 | 0.020906 |
# Copyright 2018 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... | DavidNorman/tensorflow | tensorflow/python/keras/engine/training_dataset_test.py | Python | apache-2.0 | 22,565 | 0.004254 |
from Acquisition import aq_inner
from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile
from opencore.browser.base import BaseView, view
from opencore.project import LATEST_ACTIVITY
from opencore.project import PROJ_HOME
from opencore.project.utils import get_featurelets
from plone.memoize.instance ... | socialplanning/opencore | opencore/project/browser/base.py | Python | gpl-3.0 | 3,338 | 0.000899 |
# A test suite for pdb; at the moment, this only validates skipping of
# specified test modules (RFE #5142).
import imp
import sys
import os
import unittest
import subprocess
import textwrap
from test import test_support
# This little helper class is essential for testing pdb under doctest.
from test_doctest import _... | svanschalkwyk/datafari | windows/python/Lib/test/test_pdb.py | Python | apache-2.0 | 11,281 | 0.002748 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# BeautifulTable documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 18 15:59:32 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in th... | pri22296/beautifultable | docs/conf.py | Python | mit | 5,447 | 0 |
# Copyright 2005 Duke University
# Copyright (C) 2012-2018 Red Hat, Inc.
#
# 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 License, or
# (at your option) any later versio... | mattdm/dnf | dnf/base.py | Python | gpl-2.0 | 113,956 | 0.001667 |
import Base
import VS
import dynamic_mission
import vsrandom
import fixers
shipsize = VS.getPlayer().rSize()/35
#print "Ship Size: " + str(VS.getPlayer().rSize()) #debug
dynamic_mission.CreateMissions()
time_of_day='_day'
# ROOMS
landing = Base.Room ('Landing Pad')
if (VS.getPlayer().rSize()<=100):
Base.Texture (... | vinni-au/vega-strike | data/bases/frigid_mud.py | Python | gpl-2.0 | 4,436 | 0.018034 |
#
# awesome.py
#
# Copyright (C) 2014 Fabio Erculiani
#
# 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 License, or
# (at your option) any later version.
#
# This program... | Sabayon/anaconda | pyanaconda/installclasses/awesome.py | Python | gpl-2.0 | 1,507 | 0.000664 |
import os
from redlib.api.system import sys_command, CronDBus, CronDBusError, is_linux, is_windows
from ..util.logger import log
from . import Desktop, DesktopError
from . import gnome_desktop
from . import feh_desktop
if is_windows():
from .windows_desktop import WindowsDesktop
def load_optional_module(module, pa... | amol9/wallp | wallp/desktop/desktop_factory.py | Python | mit | 1,362 | 0.022761 |
#!/usr/bin/python2.6
import sys, string, os, time, fnmatch, imgFG, markup, re
from markup import oneliner as o
from numpy import *
import pdb
abi = ["DTB-004", "DTB-009", "DTB-024Pro", "DTB-030", "DTB-034", "DTB-036", "DTB-046", "DTB-049", "DTB-053", "DTB-064", "DTB-073"]
naive = ["DTB-003", "DTB-005", "DTB-011", ... | UCSC-MedBook/MedBook_ | tools/old-external-tools/shazam/abiFG.py | Python | bsd-3-clause | 14,508 | 0.010408 |
#!/usr/bin/env python
from autoliker.services.instagram import InstagramUserPhotoService
from autoliker.services.twitter import TwitterUserMentionService
if __name__ == '__main__':
services = [InstagramUserPhotoService, TwitterUserMentionService]
for service_cls in services:
service = service_cls()
... | streeter/autoliker | main.py | Python | mit | 617 | 0 |
# coding: utf-8
###################################################################
# Copyright (c) 2016-2022 European Synchrotron Radiation Facility #
# #
# Author: Marius Retegan #
# ... | mretegan/crispy | crispy/utils.py | Python | mit | 2,446 | 0 |
# -*- coding: utf-8 -*-
import re
import sympy
from colorama import Fore
from plugin import alias, plugin
@alias('calc', 'evaluate')
@plugin('calculate')
def calculate(jarvis, s):
"""
Jarvis will get your calculations done!
-- Example:
calculate 3 + 5
"""
tempt = s.replace(" ", "")
i... | sukeesh/Jarvis | jarviscli/plugins/evaluator.py | Python | mit | 9,968 | 0.000401 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Script to check language links for general pages.
Uses existing translations of a page, plus hints from the command line, to
download the equivalent pages from other languages. All of such pages are
downloaded as well and checked for interwiki links recursively until ther... | xZise/pywikibot-core | scripts/interwiki.py | Python | mit | 111,420 | 0.000701 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | nttks/edx-platform | openedx/core/djangoapps/ga_task/migrations/0001_initial.py | Python | agpl-3.0 | 1,256 | 0.000796 |
import numpy as np
from misc.Plotter import Plotter
class IQGenerator(object):
def __init__(self, f_baseband=10, f_s=1000, bits=[True, False, True, True, False, False]):
self.f_baseband = f_baseband
self.f_s = f_s
self.t_s = 1 / f_s
self.bits = bits
self.samples_per_cycle ... | splotz90/urh | misc/IQGenerator.py | Python | gpl-3.0 | 6,115 | 0.003598 |
from axiom.test.historic.stubloader import StubbedTest
from xquotient.compose import Composer, Drafts
class ComposerUpgradeTestCase(StubbedTest):
"""
Test that the Composer no longer has a 'drafts' attribute, that no Drafts
items have been created and that the other attributes have been copied.
"""
... | twisted/quotient | xquotient/test/historic/test_composer4to5.py | Python | mit | 598 | 0.001672 |
from setuptools import setup
setup(
name='uganda_common',
version='0.1',
license="BSD",
install_requires = ["rapidsms"],
description='A suite of utility functions for Uganda RSMS deployments.',
long_description='',
author='UNICEF Uganda T4D',
author_email='mossplix@gmail.com',
ur... | unicefuganda/edtrac | edtrac_project/rapidsms_uganda_common/setup.py | Python | bsd-3-clause | 845 | 0.002367 |
import logging
from ckan import model
from ckan import plugins as p
from ckanext.report.interfaces import IReport
from ckanext.archiver.interfaces import IPipe
from ckanext.archiver.logic import action, auth
from ckanext.archiver import helpers
from ckanext.archiver import lib
from ckanext.archiver.model import Archi... | ckan/ckanext-archiver | ckanext/archiver/plugin.py | Python | mit | 8,644 | 0.000231 |
import os, os.path
import shutil
import subprocess
from play.utils import *
COMMANDS = ['javadoc', 'jd']
HELP = {
'javadoc': 'Generate your application Javadoc'
}
def execute(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
play_env = kargs.get("env")
... | ericlink/adms-server | playframework-dist/play-1.1/framework/pym/play/commands/javadoc.py | Python | mit | 1,459 | 0.004798 |
# NNBlocks is a Deep Learning framework for computational linguistics.
#
# Copyright (C) 2015 Frederico Tommasi Caroli
#
# NNBlocks is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of t... | NNBlocks/NNBlocks | nnb/activation.py | Python | gpl-3.0 | 1,375 | 0.007273 |
#
# This file is part of Cockpit.
#
# Copyright (C) 2017 Red Hat, Inc.
#
# Cockpit 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 2.1 of the License, or
# (at your option) any later vers... | petervo/cockpit | pkg/lib/inotify.py | Python | lgpl-2.1 | 2,629 | 0.004184 |
#!/usr/bin/python
#
# Copyright 2002-2019 Barcelona Supercomputing Center (www.bsc.es)
#
# 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
... | mF2C/COMPSs | compss/programming_model/bindings/python/src/exaqute/ExaquteTaskPyCOMPSs.py | Python | apache-2.0 | 1,613 | 0 |
#!/usr/bin/python
#
# Copyright 2012 Google 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 a... | tripleee/gmail-oauth2-tools | python/oauth2.py | Python | apache-2.0 | 12,198 | 0.00705 |
# User creation text spoke
#
# Copyright (C) 2013-2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distrib... | jkonecny12/anaconda | pyanaconda/ui/tui/spokes/user.py | Python | gpl-2.0 | 11,266 | 0.00142 |
"""app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... | matokeotz/matokeo-api | app/app/urls.py | Python | mit | 1,219 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# flake8: noqa
#
# setup.py from openobject-server 7.0, included as is, except for the
# dependency list
#
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ... | anybox/anybox.recipe.openerp | anybox/recipe/openerp/tests/oerp70/setup.py | Python | agpl-3.0 | 3,751 | 0.018128 |
# Copyright 2014-2018 The ODL contributors
#
# This file is part of ODL.
#
# 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 https://mozilla.org/MPL/2.0/.
"""A simple example to get started with SPDH... | kohr-h/odl | odl/contrib/solvers/spdhg/examples/get_started.py | Python | mpl-2.0 | 2,277 | 0 |
# Copyright 2020 Google
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | quantumlib/ReCirq | recirq/hfvqe/analysis_test.py | Python | apache-2.0 | 6,819 | 0 |
import csv
import os
import color
def _GetDataDirPath():
return os.path.join(os.path.dirname(__file__), 'data')
def _GetCsvPath():
return os.path.join(_GetDataDirPath(), 'dmccolors.csv')
def _GetCsvString():
with open(_GetCsvPath()) as f:
return f.read().strip()
def _CreateDmcColorFromRow(row):
number =... | nanaze/pystitch | pystitch/dmc_colors.py | Python | apache-2.0 | 1,790 | 0.027374 |
# 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/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/__init__.py | Python | mit | 10,249 | 0.000195 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import os
import collections
import mock
import accurev.client
import accurev.depot
class TestAccuRevClient(unittest.TestCase):
def setUp(self):
self.client = accurev.client.Client()
def test_cmd(self):
self.client.chdir('somed... | grilo/pyaccurev | tests/test_client.py | Python | gpl-3.0 | 19,204 | 0.00125 |
#!/usr/bin/python2
# This is an Adaboost classifier
import sys
from util import get_split_training_dataset
from metrics import suite
import feature_selection_trees as fclassify
from sklearn.grid_search import GridSearchCV
from sklearn.ensemble import AdaBoostClassifier
from sklearn.tree import DecisionTreeClassifi... | bravelittlescientist/kdd-particle-physics-ml-fall13 | src/adaboost.py | Python | gpl-2.0 | 1,625 | 0.002462 |
# Copyright 2015 PerfKitBenchmarker 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 appli... | mateusz-blaszkowski/PerfKitBenchmarker | perfkitbenchmarker/providers/azure/provider_info.py | Python | apache-2.0 | 872 | 0.002294 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# vim:ai:sta:et:ts=4:sw=4:sts=4
"""kernelng 0.x
Tool for maintaining customized overlays of kernel-ng.eclass-based ebuilds
Copyright 2005-2014 Gentoo Foundation
Copyright (C) 2014 Gregory M. Turner <gmt@be-evil.net>
Distributed under the terms of the GNU General ... | gmt/kernel-ng-util | kernelng/config.py | Python | gpl-2.0 | 46,364 | 0.005133 |
# Copyright 2020 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | deepmind/dm_robotics | cpp/setup.py | Python | apache-2.0 | 4,478 | 0.00335 |
#!/usr/bin/env python3
import os
from config import Dirs, Disks, Files, XAS99_CONFIG
from utils import (xas, xdm, sinc, error, clear_env, delfile, check_obj_code_eq, check_image_set_eq,
check_image_files_eq, read_stderr, get_source_markers, check_errors)
# Main test
def runtest():
"""check c... | endlos99/xdt99 | test/as-checkobj.py | Python | gpl-3.0 | 4,385 | 0.00114 |
#!/usr/bin/env python
from __future__ import with_statement
#-------------------------------------------------------------------------------
import unittest
from xml.etree.ElementTree import fromstring
#-------------------------------------------------------------------------------
from xmlbuilder import XMLBuild... | JDrosdeck/xml-builder-0.9 | xmlbuilder/tests/__init__.py | Python | mit | 3,828 | 0.025078 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.