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 |
|---|---|---|---|---|---|---|
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets Authors.
#
# 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 appl... | tensorflow/datasets | tensorflow_datasets/image_classification/imagenet_sketch/__init__.py | Python | apache-2.0 | 744 | 0.001344 |
##
## Biskit, a toolkit for the manipulation of macromolecular structures
## Copyright (C) 2004-2018 Raik Gruenberg & Johan Leckner
##
## 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 v... | graik/biskit | archive_biskit2/Biskit/AmberEntropySlave.py | Python | gpl-3.0 | 3,638 | 0.015118 |
"""
The :mod:`sklearn.pls` module implements Partial Least Squares (PLS).
"""
# Author: Edouard Duchesnay <edouard.duchesnay@cea.fr>
# License: BSD 3 clause
from ..base import BaseEstimator, RegressorMixin, TransformerMixin
from ..utils import check_arrays
from ..externals import six
import warnings
from abc import ... | chaluemwut/fbserver | venv/lib/python2.7/site-packages/sklearn/cross_decomposition/pls_.py | Python | apache-2.0 | 28,612 | 0.00021 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('orders', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='order',
name='paid',
... | spectrumone/online-shop-template | myshop/orders/migrations/0002_auto_20160213_1225.py | Python | mit | 390 | 0 |
# Django settings for trywsk project.
DEBUG = False
TEMPLATE_DEBUG = DEBUG
import os
from unipath import Path
PROJECT_ROOT = Path(__file__).ancestor(2)
PROJECT_ROOT = os.path.join(PROJECT_ROOT,'whisk_tutorial')
ADMINS = (
('IBM jStart', 'jstart@us.ibm.com'),
)
MANAGERS = ADMINS
DATABASES = {}
TEST_RUNNER = ... | ZmG/openwhisk-tutorial | deploy_settings/base.py | Python | apache-2.0 | 6,242 | 0.002884 |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import fasta
import genetics
import table
def main(argv):
codon = table.codon(argv[0])
strings = fasta.read_ordered(argv[1])
dna = strings[0]
introns = strings[1:]
for intron in introns:
dna ... | cowboysmall/rosalind | src/stronghold/rosalind_splc.py | Python | mit | 466 | 0.01073 |
"""Base settings shared by all environments.
This is a reusable basic settings file.
"""
from django.conf.global_settings import *
import os
import sys
import re
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
TIME_ZONE = 'GB'
USE_TZ = True
US... | seddonym/bobsleigh-seddonym | bobsleigh_seddonym/settings/base.py | Python | bsd-2-clause | 2,877 | 0.004171 |
# test re.sub with unmatched groups, behaviour changed in CPython 3.5
try:
import ure as re
except ImportError:
try:
import re
except ImportError:
print("SKIP")
raise SystemExit
try:
re.sub
except AttributeError:
print("SKIP")
raise SystemExit
# first group matches, se... | kerneltask/micropython | tests/extmod/ure_sub_unmatched.py | Python | mit | 419 | 0.002387 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
'''Pychemqt, Chemical Engineering Process simulator
Copyright (C) 2009-2017, Juan José Gómez Romera <jjgomera@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Softwar... | jjgomera/pychemqt | tools/terminal.py | Python | gpl-3.0 | 2,742 | 0.000365 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Person.slug'
db.delete_column(u'aldryn_people_person', ... | Venturi/cms | env/lib/python2.7/site-packages/aldryn_people/south_migrations/0026_auto__del_field_person_slug__del_field_person_name.py | Python | gpl-2.0 | 15,554 | 0.007651 |
"""
telemetry full tests.
"""
import platform
import sys
from unittest import mock
import pytest
import wandb
def test_telemetry_finish(runner, live_mock_server, parse_ctx):
with runner.isolated_filesystem():
run = wandb.init()
run.finish()
ctx_util = parse_ctx(live_mock_server.get_ctx()... | wandb/client | tests/test_telemetry_full.py | Python | mit | 3,333 | 0.0009 |
'''
Crunchyroll urlresolver plugin
Copyright (C) 2013 voinage
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 ... | xmbcrios/xmbcrios.repository | script.module.urlresolver/lib/urlresolver/plugins/crunchyroll.py | Python | gpl-2.0 | 2,694 | 0.012621 |
from django.apps import apps
from contextlib import contextmanager
def session():
return apps.get_app_config('basex').basex
@contextmanager
def recipe_db():
s = session()
s.execute('open recipe')
yield s
s.close()
| jajadinimueter/recipe | apps/basex/basex.py | Python | mit | 239 | 0 |
#! /usr/bin/env python
"""
Sample script that illustrates exclusive card connection decorators.
__author__ = "http://www.gemalto.com"
Copyright 2001-2010 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or m... | 12019/pyscard | smartcard/Examples/framework/sample_ExclusiveCardConnection.py | Python | lgpl-2.1 | 2,465 | 0.001623 |
import os
from nose.tools import (assert_equal,
assert_true)
from ckantoolkit import config
import ckan.tests.helpers as helpers
import ckan.tests.factories as factories
import ckanapi
import boto
from moto import mock_s3
import logging
log = logging.getLogger(__name__)
class TestS3Control... | okfn/ckanext-s3filestore | ckanext/s3filestore/tests/test_controller.py | Python | agpl-3.0 | 3,472 | 0.000288 |
"""All formatters from this pacakge should be easily mixed whith default ones using this pattern:
>>> from code_formatter.base import formatters
>>> from code_formatter import extras
>>> custom_formatters = formatters.copy()
>>> custom_formatters.register(extras.UnbreakableTupleFormatter,
... | paluh/code-formatter | code_formatter/extras/__init__.py | Python | bsd-3-clause | 12,919 | 0.005573 |
from uber.custom_tags import normalize_newlines
from panels import *
@all_renderable(c.STUFF)
class Root:
@unrestricted
def index(self, session, message=''):
if c.ALT_SCHEDULE_URL:
raise HTTPRedirect(c.ALT_SCHEDULE_URL)
else:
raise HTTPRedirect("internal")
@cached
... | magfest/panels | panels/site_sections/schedule.py | Python | agpl-3.0 | 14,930 | 0.004019 |
from __future__ import unicode_literals
# Ensure 'assert_raises' context manager support for Python 2.6
import tests.backport_assert_raises # flake8: noqa
from nose.tools import assert_raises
import boto3
import boto
from boto.exception import EC2ResponseError
import sure # noqa
from moto import mock_ec2
SAMPLE_DO... | riccardomc/moto | tests/test_ec2/test_vpcs.py | Python | apache-2.0 | 8,856 | 0.000339 |
import datetime
import logging
import textwrap
import time
import click
import hatarake
import hatarake.net as requests
from hatarake.config import Config
logger = logging.getLogger(__name__)
@click.group()
@click.option('-v', '--verbosity', count=True)
def main(verbosity):
logging.basicConfig(level=logging.WA... | kfdm/hatarake | hatarake/cli.py | Python | mit | 4,255 | 0.00047 |
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# 3p
import requests
# project
from checks import AgentCheck
from util import headers
class PHPFPMCheck(AgentCheck):
"""
Tracks basic php-fpm metrics via the status module
Requires php-fpm pools to ... | manolama/dd-agent | checks.d/php_fpm.py | Python | bsd-3-clause | 4,587 | 0.002616 |
#
#
#
#
from framework.deprecated.controllers import CommScheduler, CheckpointDriving, VisualSearchTask
from framework.latentmodule import LatentModule
from framework.convenience import ConvenienceFunctions
from framework.ui_elements.EventWatcher import EventWatcher
from framework.ui_elements.ScrollPresenter import S... | sccn/SNAP | src/modules/MBF/MBF2_A.py | Python | bsd-3-clause | 69,902 | 0.017625 |
import sqlite3
import time
conn = sqlite3.connect('log.db')
c = conn.cursor()
# Create table
c.execute("CREATE TABLE if not exists log (log_timestamp DECIMAL(12,8), "
"log_source text, msg_sequence integer, log_message text, status text)")
for x in range(0, 1000):
insertquery = "INSERT INTO log (log_ti... | bundgus/python-playground | sqlite-playground/sqlite_logfile_write.py | Python | mit | 511 | 0.007828 |
# -*- coding: utf-8 -*-
import functools
import httplib as http
import logging
import time
import bleach
from django.db.models import Q
from flask import request
from framework.auth.decorators import collect_auth
from framework.auth.decorators import must_be_logged_in
from framework.exceptions import HTTPError
from f... | erinspace/osf.io | website/search/views.py | Python | apache-2.0 | 8,117 | 0.00271 |
from __future__ import print_function
import unittest
import RMF
class Tests(unittest.TestCase):
def test_multiparent(self):
"""Test that nodes with multiple parents can be used and resolve"""
for suffix in RMF.suffixes:
path = RMF._get_temporary_file_path("alias2." + suffix)
... | salilab/rmf | test/test_aliases.py | Python | apache-2.0 | 1,442 | 0.000693 |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
# Ralf Habacker, 2006 (rh)
# Yinon Ehrlich, 2009
"""
clang/llvm detection.
"""
import os, sys
from waflib import Configure, Options, Utils
from waflib.Tools import ccroot, ar
from waflib.Configure import conf
@conf
def find_clang(conf):
"""
... | Gnomescroll/Gnomescroll | server/waflib/Tools/clang.py | Python | gpl-3.0 | 4,637 | 0.014449 |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... | NeilBryant/check_mk | modules/discovery.py | Python | gpl-2.0 | 52,283 | 0.004399 |
import copy
import mufsim.utils as util
import mufsim.gamedb as db
import mufsim.stackitems as si
from mufsim.errors import MufRuntimeError
from mufsim.insts.base import Instruction, instr
class InstPushItem(Instruction):
value = 0
def __init__(self, line, val):
self.value = val
super(InstPus... | revarbat/mufsim | mufsim/insts/stack.py | Python | bsd-2-clause | 11,103 | 0 |
#! /usr/env/python
"""
This module attempts to "component-ify" GT's Fastscape stream power erosion.
Created DEJH, March 2014.
"""
from __future__ import print_function
import numpy
import warnings
from landlab import ModelParameterDictionary, Component
from landlab.core.model_parameter_dictionary import MissingKeyErr... | csherwood-usgs/landlab | landlab/components/stream_power/fastscape_stream_power.py | Python | mit | 18,923 | 0.000053 |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from models import Project
class ProjectsTest(TestCase):
fixtures = ['test_data.json']
def test_project_listing(self):
"""
Verify that the project listing page contains a... | mazelife/django-belleville | belleville/projects/tests.py | Python | apache-2.0 | 1,492 | 0.004021 |
import paho.mqtt.client as mqtt
import json, time
import RPi.GPIO as GPIO
from time import sleep
# The script as below using BCM GPIO 00..nn numbers
GPIO.setmode(GPIO.BCM)
# Set relay pins as output
GPIO.setup(24, GPIO.OUT)
# ----- CHANGE THESE FOR YOUR SETUP -----
MQTT_HOST = "190.97.168.236"
MQTT_PORT = 1883
US... | pumanzor/security | raspberrypi/relaycontrol.py | Python | mit | 1,611 | 0.009932 |
#
# Copyright (c) 2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""Power cycle devices using the 'Mbed TAS RM REST API'."""
import os
import json
import time
import requests
from .host_test_plugins import HostTestPluginBase
class HostTestPluginPowerCycleResetMethod(H... | ARMmbed/greentea | src/htrun/host_tests_plugins/module_power_cycle_target.py | Python | apache-2.0 | 5,959 | 0.001175 |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from te... | segwit/atbcoin-insight | qa/rpc-tests/p2p-feefilter.py | Python | mit | 4,317 | 0.003938 |
import subprocess
"""
ideas from https://gist.github.com/godber/7692812
"""
class PdfInfo:
def __init__(self, filepath):
self.filepath = filepath
self.info = {}
self.cmd = "pdfinfo"
self.process()
def process(self):
labels = ['Title', 'Author', 'Creator', 'Producer', '... | manishgs/pdf-processor | pdftools/PdfInfo.py | Python | mit | 1,046 | 0.008604 |
#
# Copyright 2017 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... | google/ion | ion/dev/replace_strings.py | Python | apache-2.0 | 3,728 | 0.005633 |
#!/usr/bin/python
# -*- coding:utf8 -*-
import os
import tensorflow as tf
from keras import layers
from keras.applications.imagenet_utils import _obtain_input_shape
from keras.backend.tensorflow_backend import set_session
from keras.engine.topology import get_source_inputs
from keras.layers import *
from keras.models ... | GloryDream/generative_style_transfer | Project/generative_style_transfer/models/generative_model_v2.py | Python | apache-2.0 | 8,266 | 0.002662 |
from __future__ import unicode_literals
import ply.lex as lex
import pytz
from datetime import timedelta
from decimal import Decimal
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Q
from ply import yacc
from temba.utils import str_to_datetime
from temba.values.models import Value
... | reyrodrigues/EU-SMS | temba/contacts/search.py | Python | agpl-3.0 | 10,018 | 0.002995 |
# -*- coding: cp1252 -*-
import urllib,urllib2,re,cookielib,string,os,sys
import xbmc, xbmcgui, xbmcaddon, xbmcplugin
from resources.libs import main
#Mash Up - by Mash2k3 2012.
from t0mm0.common.addon import Addon
from resources.universal import playbackengine, watchhistory
addon_id = 'plugin.video.movie25'
selfAddo... | noba3/KoTos | addons/plugin.video.movie25/resources/libs/sports/fitnessblender.py | Python | gpl-2.0 | 7,228 | 0.022979 |
from bs4 import BeautifulSoup
from django.conf import settings
from django.contrib.gis import admin
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.forms.formsets import formset_factory
from django.http import HttpResponseRedirect
from django.utils.translation ... | geonition/geoforms | geoforms/admin.py | Python | mit | 17,493 | 0.009089 |
# Lint as: python3
# Copyright 2021 Google LLC. 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 ... | tensorflow/cloud | src/python/tensorflow_cloud/tuner/vizier_client_ucaip_interface.py | Python | apache-2.0 | 686 | 0 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Account Analytic Defaults',
'version': '1.0',
'category': 'Accounting',
'description': """
Set default values for your analytic accounts.
==============================================
Allows ... | vileopratama/vitech | src/addons/account_analytic_default/__openerp__.py | Python | mit | 847 | 0.002361 |
import collections
import itertools
import nengo
import pacman103
from .config import Config
import connection
import ensemble
import node
import probe
import utils
class Assembler(object):
"""The Assembler object takes a built collection of objects and connections
and converts them into PACMAN vertices and... | ctn-archive/nengo_spinnaker_2014 | nengo_spinnaker/assembler.py | Python | mit | 6,294 | 0.000794 |
#
# Copyright (C) 2010, 2011, 2014 Stanislav Bohm
#
# This file is part of Kaira.
#
# Kaira 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, version 3 of the License, or
# (at your option) any... | spirali/kaira | gui/process.py | Python | gpl-3.0 | 7,102 | 0.004365 |
from FindPathsPlugin import FindPathsPlugin
import tulipplugins
class FindPaths0(FindPathsPlugin):
""" Tulip plugin algorithm which searches for 1-hop paths """
def __init__(self, context):
FindPathsPlugin.__init__(self, context, 0)
# The line below does the magic to register the plugin to the plugin... | visdesignlab/TulipPaths | FindPaths0.py | Python | mit | 500 | 0.004 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | mistercrunch/panoramix | tests/integration_tests/dashboards/security/security_dataset_tests.py | Python | apache-2.0 | 8,417 | 0.001069 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2016 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either v... | rockneurotiko/wirecloud | src/wirecloud/platform/wiring/views.py | Python | agpl-3.0 | 6,563 | 0.00381 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/vlans/vlan/members/member/interface_ref/__init__.py | Python | apache-2.0 | 5,581 | 0.001254 |
# Copyright (c) 2014 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | swiftstack/swift3-stackforge | swift3/test/unit/test_obj.py | Python | apache-2.0 | 47,051 | 0.000043 |
# -*- coding: utf-8 -*-
"""
legit.helpers
~~~~~~~~~~~~~
Various Python helpers.
"""
import os
import platform
_platform = platform.system().lower()
is_osx = (_platform == 'darwin')
is_win = (_platform == 'windows')
is_lin = (_platform == 'linux')
def find_path_above(*names):
"""Attempt to locate given path ... | pombredanne/dGit | legit/helpers.py | Python | bsd-3-clause | 618 | 0.001618 |
import json,os,shelve
import asyncio,sys
DATAFILENAME="data"
def set_user_id(new_id):
_local_data["user_id"]=new_id
def set_login_token(token):
_local_data["login_token"]=token
def load_data():
global _local_data
if(os.path.exists(os.path.join(get_current_path(),DATAFILENAME))):
with open(os.pa... | dandfmd/Linfilesync | utils.py | Python | apache-2.0 | 2,486 | 0.020515 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | kitaro-tn/msgiver | _docs/conf.py | Python | mit | 4,844 | 0.000206 |
from __future__ import absolute_import, division, print_function, unicode_literals
from django.contrib.auth.decorators import user_passes_test
from django_otp import user_has_device
from django_otp.conf import settings
def otp_required(view=None, redirect_field_name='next', login_url=None, if_configured=False):
... | altanawealth/django-otp | django_otp/decorators.py | Python | bsd-2-clause | 1,053 | 0.003799 |
#
import common
__version__ = common.version
del common
import settings
| russell/slick | slick/__init__.py | Python | gpl-3.0 | 74 | 0.027027 |
#!/usr/bin/env python3
import os
import logging
from datetime import datetime
from settings import JSONDIR
from defs import load_data
from san_env import get_apps
debug_records_flag = False
def save(appname, relations):
apps = get_apps()
for filename, modelname, filters in relations:
records = load_... | tulsluper/sanscript | apps/fc/scripts/san_db.py | Python | gpl-3.0 | 1,228 | 0.001629 |
#!/apollo/env/MLEnvImprovement/bin/python
'''
Created on Jul 22, 2014
@author: galena
This code implements proximal stochastic gradient descent with AdaGrad for very large, sparse, multilabel problems.
The weights are stored in a sparse matrix structure that permits changing of the sparsity pattern on the fly, via ... | zackchase/sparse-multilabel-sgd | src/sgd2.py | Python | mit | 29,756 | 0.006486 |
#!/usr/bin/env python3
from anormbookmarker.test.test_enviroment import *
with self_contained_session(CONFIG.database_timestamp) as session:
BASE.metadata.create_all(session.bind)
# make a tag to make an alias to
aa = Tag.construct(session=session, tag='a a')
session.commit()
db_result = [('select CO... | jakeogh/anormbookmarker | anormbookmarker/test/tests/Tag/two_single_char_words.py | Python | mit | 876 | 0 |
import li_boost_shared_ptr
import gc
debug = False
# simple shared_ptr usage - created in C++
class li_boost_shared_ptr_runme:
def main(self):
if (debug):
print "Started"
li_boost_shared_ptr.cvar.debug_shared = debug
# Change loop count to run for a long time to monitor memory
loopCount = 1 ... | jrversteegh/softsailor | deps/swig-2.0.4/Examples/test-suite/python/li_boost_shared_ptr_runme.py | Python | gpl-3.0 | 18,306 | 0.003988 |
# -*- coding: utf-8 -*-
# See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class SaleAdvancePaymentInv(models.TransientModel):
_inherit = "sale.advance.payment.inv"
@api.model
def _get_advance_payment(self):
ctx = self.env.context.copy()
if ... | JayVora-SerpentCS/vertical-hotel | hotel/wizard/sale_make_invoice_advance.py | Python | agpl-3.0 | 2,320 | 0 |
import time
import json
import random
from flask import Flask, request, current_app, abort
from functools import wraps
from cloudbrain.utils.metadata_info import (map_metric_name_to_num_channels,
get_supported_devices,
get_metrics_... | andyh616/cloudbrain | cloudbrain/apiservice/rest_api_server.py | Python | agpl-3.0 | 6,641 | 0.004367 |
import sys
import re
# Copyright
# =========
# Copyright (C) 2015 Trustwave Holdings, 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 3 of the License, or
# (at your optio... | jack51706/malware-analysis | Python/CherryPicker/cherryConfig.py | Python | gpl-3.0 | 3,456 | 0.000868 |
from operator import itemgetter
__author__ = 'davide'
def pairwise(l):
for t in zip(l, l[1:]):
yield t
def pijavskij(f, L, a, b, eps=1E-5):
l = [(a, f(a)), (b, f(b))]
while True:
imin, Rmin, xmin = -1, float("inf"), -1
for i, t in enumerate(pairwise(l)):
... | DavideCanton/Python3 | num/pijavskij.py | Python | gpl-3.0 | 830 | 0.004819 |
import os
import sys
import string
from SCons.Script import *
from utils import _make_path_relative
BuildOptions = {}
Projects = []
Rtt_Root = ''
Env = None
class Win32Spawn:
def spawn(self, sh, escape, cmd, args, env):
# deal with the cmd build-in commands which cannot be used in
# subprocess.Po... | DigFarmer/aircraft | tools/building.py | Python | gpl-2.0 | 23,177 | 0.010398 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... | rwl/PyCIM | CIM15/IEC61970/Wires/DCLineSegment.py | Python | mit | 2,414 | 0.002486 |
#!/usr/bin/env python
# Script to analyze code and arrange ld sections.
#
# Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import sys
# LD script headers/trailers
COMMONHEADER = """
/* DO NOT EDIT! This is an autogenerated file. See... | suhorng/vm14hw1 | roms/seabios/tools/layoutrom.py | Python | gpl-2.0 | 15,541 | 0.00148 |
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 23 11:27:24 2017
@author: hd_mysky
"""
import pymongo as mongo
import pandas as pd
import os
from transform import harmonize_data
BASE_DIR = os.path.dirname(__file__) #获取当前文件的父目录绝对路径
file_path = os.path.join(BASE_DIR,'dataset','source_simple.csv')
conn = mongo.MongoCl... | hdmy/LagouSpider | dataMining/train_data.py | Python | mit | 756 | 0.005952 |
from __future__ import absolute_import
import unittest
import deviantart
from .helpers import mock_response, optional
from .api_credentials import CLIENT_ID, CLIENT_SECRET
class ApiTest(unittest.TestCase):
@optional(CLIENT_ID == "", mock_response('token'))
def setUp(self):
self.da = deviantart.Api(C... | neighbordog/deviantart | tests/test_api.py | Python | mit | 1,335 | 0.003745 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/buildpacks | builders/testdata/python/functions/with_env_var/main.py | Python | apache-2.0 | 705 | 0.004255 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsImageCache.
.. note:: 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.
"""
__a... | tomtor/QGIS | tests/src/python/test_qgsimagecache.py | Python | gpl-2.0 | 5,431 | 0.003498 |
"""
TwoDWalker.py is for controling the avatars in a 2D Scroller game environment.
"""
from GravityWalker import *
from panda3d.core import ConfigVariableBool
class TwoDWalker(GravityWalker):
"""
The TwoDWalker is primarily for a 2D Scroller game environment. Eg - Toon Blitz minigame.
TODO: This class is... | mgracer48/panda3d | direct/src/controls/TwoDWalker.py | Python | bsd-3-clause | 2,450 | 0.004082 |
# list of similar chars
# useful for suggestion mechanism
import re
import unicodedata
_xTransCharsForSpelling = str.maketrans({
'ſ': 's', 'ffi': 'ffi', 'ffl': 'ffl', 'ff': 'ff', 'ſt': 'ft', 'fi': 'fi', 'fl': 'fl', 'st': 'st'
})
def spellingNormalization (sWord):
return unicodedata.normalize("NFC", sWord.tran... | jmchrl/opb | grammalecte/graphspell/char_player.py | Python | gpl-3.0 | 10,597 | 0.002542 |
#! /usr/bin/python2
# vim: set fileencoding=utf-8
from dateutil.parser import parse
from subprocess import check_output
from shutil import copy
import datetime
import sys
import os.path
import isoweek
DATE_FORMAT = '%Y%m%d'
START = """\documentclass[a4paper,oneside,draft,
notitlepage,11pt,svgnames]{scrreprt}
\\newcomma... | daureg/illalla | diary/manage.py | Python | mit | 2,888 | 0.003809 |
# -*- coding: utf-8 -*-
# Copyright (c) 2021 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from ansible.module_utils.common.arg_spec import ArgumentSpecVa... | privateip/ansible | test/units/module_utils/common/arg_spec/test_validate_invalid.py | Python | gpl-3.0 | 3,830 | 0.002872 |
# -*- coding: utf-8 -*-
VSVersionInfo(
ffi=FixedFileInfo(
filevers=(4, 0, 0, 0),
prodvers=(4, 0, 0, 0),
mask=0x3f,
flags=0x0,
OS=0x4,
fileType=0x1,
subtype=0x0,
date=(0, 0)
),
kids=[
StringFileInfo(
[
StringT... | DmitryDmitrienko/usecasevstu | version_info.py | Python | apache-2.0 | 710 | 0.011268 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, SylvainCecchetto
# GNU General Public License v2.0+ (see LICENSE.txt or https://www.gnu.org/licenses/gpl-2.0.txt)
# This file is part of Catch-up TV & More
from __future__ import unicode_literals
import re
from codequick import Resolver
import urlquick
from resources.l... | Catch-up-TV-and-More/plugin.video.catchuptvandmore | resources/lib/channels/it/paramountchannel_it.py | Python | gpl-2.0 | 775 | 0.00129 |
#!/usr/bin/env python
"""tvnamer - Automagical TV episode renamer
Uses data from www.thetvdb.com (via tvdb_api) to rename TV episode files from
"some.show.name.s01e01.blah.avi" to "Some Show Name - [01x01] - The First.avi"
"""
__version__ = "3.0.0"
__author__ = "dbr/Ben"
| lahwaacz/tvnamer | tvnamer/__init__.py | Python | unlicense | 275 | 0 |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
import torch
import to... | mlperf/training_results_v0.7 | NVIDIA/benchmarks/transformer/implementations/pytorch/fairseq/optim/adam.py | Python | apache-2.0 | 7,859 | 0.00229 |
import logging
from typing import List
import numpy as np
import torch
import torch.nn as nn
from pinta.model.model_base import NN
LOG = logging.getLogger("ConvRNN")
class ConvRNN(NN):
"""
Combination of a convolutional front end and an RNN (GRU) layer below
>> see https://gist.github.com/spro/c87cc706... | blefaudeux/Pinta | pinta/model/model_rnn.py | Python | gpl-3.0 | 2,323 | 0.001722 |
from .utils import Impl
| comp-imaging/ProxImaL | proximal/utils/__init__.py | Python | mit | 24 | 0 |
import os
import threading
import Queue
# Windows import
import win32file
import win32pipe
import win32api
import win32con
import win32security
import win32process
import win32event
class Win32Spawn(object):
def __init__(self, cmd, shell=False):
self.queue = Queue.Queue()
self.is_terminated = Fal... | wizardxbl/rtt-stm32f10x | tools/win32spawn.py | Python | gpl-2.0 | 5,808 | 0.003616 |
# -*- coding: utf-8 -*-
import pytest
from thefuck.shells.tcsh import Tcsh
@pytest.mark.usefixtures('isfile', 'no_memoize', 'no_cache')
class TestTcsh(object):
@pytest.fixture
def shell(self):
return Tcsh()
@pytest.fixture(autouse=True)
def Popen(self, mocker):
mock = mocker.patch('t... | Clpsplug/thefuck | tests/shells/test_tcsh.py | Python | mit | 2,199 | 0 |
# coding=utf-8
# Copyright 2022 The ML Fairness Gym Authors.
#
# 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 applicab... | google/ml-fairness-gym | distributions.py | Python | apache-2.0 | 3,400 | 0.01 |
from collections import defaultdict
class Solution(object):
def removeBoxes(self, boxes):
"""
:type boxes: List[int]
:rtype: int
"""
unq, cnt = [], []
for b in boxes:
if not unq or b != unq[-1]:
unq.append(b)
cnt.append(1)... | wufangjie/leetcode | 546. Remove Boxes.py | Python | gpl-3.0 | 6,064 | 0.001484 |
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2013 Vauxoo - http://www.vauxoo.com/
# All Rights Reserved.
# info Vauxoo (info@vauxoo.com)
####################################... | 3dfxsoftware/cbss-addons | res_partner_btree/model/res_partner_btree.py | Python | gpl-2.0 | 1,459 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 23 11:24:38 2018
@author: nkarasiak
"""
try:
# if use in Qgis 3
from . import function_dataraster as dataraster
from .mainfunction import pushFeedback
except BaseException:
import function_dataraster as dataraster
from mainfunc... | lennepkade/dzetsaka | scripts/domainAdaptation.py | Python | gpl-3.0 | 12,927 | 0.000851 |
from datetime import timedelta
from django.conf import settings
from django.utils.timezone import now
from rest_framework import status, pagination
from rest_framework.generics import CreateAPIView, DestroyAPIView, ListAPIView
from rest_framework.response import Response
from churchill.api.v1.shots.serializers import... | manti-by/Churchill | churchill/api/v1/shots/views.py | Python | bsd-3-clause | 2,706 | 0.00037 |
"""Thetests for the Modbus sensor component."""
import pytest
from homeassistant.components.binary_sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.components.modbus.const import (
CALL_TYPE_COIL,
CALL_TYPE_DISCRETE,
CONF_INPUT_TYPE,
CONF_LAZY_ERROR,
CONF_SLAVE_COUNT,
)
from homeassistant.c... | rohitranjan1991/home-assistant | tests/components/modbus/test_binary_sensor.py | Python | mit | 7,895 | 0.000633 |
from __future__ import division, absolute_import, unicode_literals
import time
from qtpy import QtCore
from qtpy import QtGui
from qtpy import QtWidgets
from qtpy.QtCore import Qt
from qtpy.QtCore import Signal
from qtpy.QtWidgets import QDockWidget
from .. import core
from .. import gitcfg
from .. import qtcompat
f... | sthalik/git-cola | cola/widgets/standard.py | Python | gpl-2.0 | 19,289 | 0.000259 |
"""Support for Z-Wave fans."""
import math
from homeassistant.components.fan import (
DOMAIN as FAN_DOMAIN,
SUPPORT_SET_SPEED,
FanEntity,
)
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.util.percentage import (
percentag... | turbokongen/home-assistant | homeassistant/components/ozw/fan.py | Python | apache-2.0 | 2,383 | 0.001259 |
from open_vsdcli.vsd_common import *
@vsdcli.command(name='metadata-list')
@click.option('--entity', metavar='<name>', help="Can be any entity in VSD")
@click.option('--id', metavar='<ID>', help="ID of the entity")
@click.option('--global', 'is_global', is_flag=True,
help="Show global metadata instead o... | Numergy/openvsd | open_vsdcli/vsd_metadata.py | Python | apache-2.0 | 9,596 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# ***** BEGIN LICENSE BLOCK *****
# Copyright (C) 2012-2014, Hayaki Saito
#
# 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 restric... | saitoha/termprop | __init__.py | Python | mit | 1,329 | 0.015049 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/incubator-airflow | tests/always/test_project_structure.py | Python | apache-2.0 | 17,394 | 0.005577 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-01-04 10:49
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('polls', '0011_remove_vote_endorse'),
]
operations = [
migrations.RenameField(
... | stadtgestalten/stadtgestalten | grouprise/features/polls/migrations/0012_auto_20180104_1149.py | Python | agpl-3.0 | 437 | 0 |
# http://www.k12reader.com/dolch-word-list-sorted-alphabetically-by-grade-with-nouns/
f = open("data1.txt")
header = f.readline()
from collections import OrderedDict
database = OrderedDict()
for item in header.split():
database[item] = []
for line in f.readlines():
items = line.rstrip().split('\t')
... | satishgoda/adaofsw | tutorials/flashcard/sandbox/wordlists/data1.py | Python | mit | 633 | 0.007899 |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
import pyls
@pytest.fixture(scope='session')
def testdir(tmpdir_factory):
data_dir = tmpdir_factory.mktemp('data')
return str(data_dir)
@pytest.fixture(scope='session')
def mpls_results():
Xf = 1000
subj = 100
rs = np.random.RandomState(1... | rmarkello/pyls | pyls/tests/conftest.py | Python | gpl-2.0 | 1,115 | 0 |
from mcpi.minecraft import Minecraft
from time import sleep
mc = Minecraft.create()
class mic:
x=0
y=0
z=0
u=1
def usid(self):
t=mc.getPlayerEntityIds()
print t
def uspos(self,wkj):
self.x,self.y,self.z = mc.entity.getPos(wkj)
print self.x,self.y,self.z
... | jacchwill/will-minecraft | 1003.py | Python | gpl-3.0 | 552 | 0.047101 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Make sure function-level linking setting is extracted properly.
"""
import TestGyp
import sys
if sys.platform == 'win32... | Jet-Streaming/gyp | test/win/gyptest-cl-function-level-linking.py | Python | bsd-3-clause | 1,647 | 0.010322 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-01-30 14:30
from __future__ import unicode_literals
import enum
from django.db import migrations
import enumfields.fields
class TrxType(enum.Enum):
FINALIZED = 0
PENDING = 1
CANCELLATION = 2
class TrxStatus(enum.Enum):
PENDING = 0
FIN... | uppsaladatavetare/foobar-api | src/wallet/migrations/0006_auto_20170130_1430.py | Python | mit | 899 | 0.001112 |
# Copyright 2021 DeepMind Technologies Limited. 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 ... | deepmind/deepmind-research | nfnets/resnet.py | Python | apache-2.0 | 7,567 | 0.003965 |
# TODO inspect for Cython (see sagenb.misc.sageinspect)
from __future__ import print_function
from nose.plugins.skip import SkipTest
from nose.tools import assert_true
from os import path as op
import sys
import inspect
import warnings
import imp
from pkgutil import walk_packages
from inspect import getsource
import... | wronk/mne-python | mne/tests/test_docstring_parameters.py | Python | bsd-3-clause | 5,347 | 0 |
"""
Kaggle上的Quora question pairs比赛,按照Abhishek Thakur的思路,把整个流程跑通了
讲解的文章https://www.linkedin.com/pulse/duplicate-quora-question-abhishek-thakur。
里面有两个实现,基于传统机器学习模型的实现和基于深度学习的实现,这段脚本是后者。
基本的思路比较简单,不清楚的地方也添加了注释。使用GloVe的词向量库,把每个句子转换成词向量
拼接起来的矩阵,之后就可以搭建神经网络了。自己在Convolution1D、LSTM和DropOut那一块儿还
有些迷糊。
"""
import pandas as pd
... | LiuDongjing/myworks | 样例代码/deepnet.py | Python | gpl-3.0 | 11,241 | 0.005861 |
#!/usr/bin/env python
# coding=utf-8
"""288. An enormous factorial
https://projecteuler.net/problem=288
For any prime p the number N(p,q) is defined by N(p,q) = ∑n=0 to q Tn*pn
with Tn generated by the following random number generator:
S0 = 290797
Sn+1 = Sn2 mod 50515093
Tn = Sn mod p
Let Nfac(p,q) be the fa... | openqt/algorithms | projecteuler/pe288-an-enormous-factorial.py | Python | gpl-3.0 | 477 | 0.008421 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.